mirror of
https://github.com/neovim/nvim-lspconfig.git
synced 2025-12-24 23:11:00 +01:00
Problem:
`csharp` is not a valid filetype in neovim. csharp files are of filetype `cs`.
You can see a warning by doing
```lua
vim.ls.enable({ "ast_grep"})
```
`:checkheatlh lsp` or `:LspInfo` shows this warning:
```
vim.lsp: Enabled Configurations
⚠️ WARNING Unknown filetype 'csharp' (Hint: filename extension != filetype).
```
49 lines
1015 B
Lua
49 lines
1015 B
Lua
---@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',
|
|
'cs',
|
|
'css',
|
|
'elixir',
|
|
'go',
|
|
'haskell',
|
|
'html',
|
|
'java',
|
|
'javascript',
|
|
'javascriptreact',
|
|
'json',
|
|
'kotlin',
|
|
'lua',
|
|
'nix',
|
|
'php',
|
|
'python',
|
|
'ruby',
|
|
'rust',
|
|
'scala',
|
|
'solidity',
|
|
'swift',
|
|
'typescript',
|
|
'typescriptreact',
|
|
'yaml',
|
|
},
|
|
root_markers = { 'sgconfig.yaml', 'sgconfig.yml' },
|
|
}
|