From b7ef29a8886a57aadb787807a7c6cf74c1f0ed3a Mon Sep 17 00:00:00 2001 From: anand Date: Wed, 17 Dec 2025 15:57:55 +0530 Subject: Nixos --- nvim/lsp/ast_grep.lua | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 nvim/lsp/ast_grep.lua (limited to 'nvim/lsp/ast_grep.lua') diff --git a/nvim/lsp/ast_grep.lua b/nvim/lsp/ast_grep.lua new file mode 100755 index 0000000..6ba3d7c --- /dev/null +++ b/nvim/lsp/ast_grep.lua @@ -0,0 +1,37 @@ +---@brief +--- +--- https://ast-grep.github.io/ +--- +--- ast-grep(sg) is a fast and polyglot tool for code structural search, lint, rewriting at large scale. +--- ast-grep LSP only works in projects that have `sgconfig.y[a]ml` in their root directories. +--- ```sh +--- npm install [-g] @ast-grep/cli +--- ``` +return { + cmd = { 'ast-grep', 'lsp' }, + workspace_required = true, + reuse_client = function(client, config) + config.cmd_cwd = config.root_dir + return client.config.cmd_cwd == config.cmd_cwd + end, + filetypes = { -- https://ast-grep.github.io/reference/languages.html + 'c', + 'cpp', + 'rust', + 'go', + 'java', + 'python', + 'javascript', + 'javascriptreact', + 'javascript.jsx', + 'typescript', + 'typescriptreact', + 'typescript.tsx', + 'html', + 'css', + 'kotlin', + 'dart', + 'lua', + }, + root_markers = { 'sgconfig.yaml', 'sgconfig.yml' }, +} -- cgit v1.2.3