1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
---@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
--- ```
---@type vim.lsp.Config
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
'bash',
'c',
'cpp',
'csharp',
'css',
'elixir',
'go',
'haskell',
'html',
'java',
'javascript',
'javascriptreact',
'javascript.jsx',
'json',
'kotlin',
'lua',
'nix',
'php',
'python',
'ruby',
'rust',
'scala',
'solidity',
'swift',
'typescript',
'typescriptreact',
'typescript.tsx',
'yaml',
},
root_markers = { 'sgconfig.yaml', 'sgconfig.yml' },
}
|