fork from a ast-grep-vscode
coc.nvim extension for ast-grep language server
You need to have coc.nvim installed for this extension to work.
e.g. vim-plug:
Plug 'yaegassy/coc-ast-grep', {'do': 'yarn install --frozen-lockfile'}
The ast-grep language server requires sgconfig.yml
in the project root to work properly.
The language client will crash if sgconfig.yml
is not in the project root or if the rules are not properly configured.
I think it needs to be adjusted either on the ast-grep language server (sg lsp
) side or on the coc.nvim
side.
Currently the extension is only enabled in typescript
files.
{
// ...snip
"activationEvents": [
"onLanguage:typescript"
],
// ...snip
}
astGrep.enable
: Enable coc-ast-grep extension, default: true
astGrep.serverPath
: Specify the language server binary path. If the binary is not found, use the binary included in the extension, default: sg
astGrep.configPath
: Customize ast-grep config file path relative.Add the following settings to coc-settings.json
.
{
"languageserver": {
"ast-grep": {
"command": "sg",
"args": ["lsp"],
"filetypes": ["typescript"],
"rootPatterns": [
"sgconfig.yml"
]
}
}
}
MIT
This extension is built with create-coc-extension