Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yaegassy/coc-ast-grep
coc.nvim extension for ast-grep language server
https://github.com/yaegassy/coc-ast-grep
coc-extensions coc-nvim neovim vim
Last synced: 10 days ago
JSON representation
coc.nvim extension for ast-grep language server
- Host: GitHub
- URL: https://github.com/yaegassy/coc-ast-grep
- Owner: yaegassy
- License: mit
- Created: 2022-11-14T21:53:57.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-21T02:10:36.000Z (29 days ago)
- Last Synced: 2024-10-21T05:27:39.241Z (28 days ago)
- Topics: coc-extensions, coc-nvim, neovim, vim
- Language: TypeScript
- Homepage:
- Size: 321 KB
- Stars: 13
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [WIP] coc-ast-grep
> fork from a [ast-grep-vscode](https://github.com/ast-grep/ast-grep-vscode)
[coc.nvim](https://github.com/neoclide/coc.nvim) extension for [ast-grep](https://github.com/ast-grep/ast-grep) language server
## Install
You need to have [coc.nvim](https://github.com/neoclide/coc.nvim) installed for this extension to work.
**e.g. vim-plug**:
```vim
Plug 'yaegassy/coc-ast-grep', {'do': 'yarn install --frozen-lockfile'}
```## Usage
The ast-grep language server requires `sgconfig.yml` in the project root to work properly.
- See:
## !!Known Issues!!
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.
## !!Note!!
Currently the extension is only enabled in `typescript` files.
```
{
// ...snip
"activationEvents": [
"onLanguage:typescript"
],
// ...snip
}
```## Configuration options
- `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.## To register a ast-grep language server without coc-extension
Add the following settings to `coc-settings.json`.
```json
{
"languageserver": {
"ast-grep": {
"command": "sg",
"args": ["lsp"],
"filetypes": ["typescript"],
"rootPatterns": [
"sgconfig.yml"
]
}
}
}
```## Thanks
- [ast-grep](https://github.com/ast-grep/ast-grep)
- [ast-grep-vscode](https://github.com/ast-grep/ast-grep-vscode)## License
MIT
---
> This extension is built with [create-coc-extension](https://github.com/fannheyward/create-coc-extension)