Skip to content

Instantly share code, notes, and snippets.

@SkypLabs
Last active October 27, 2022 09:42
Show Gist options
  • Save SkypLabs/58f3e847e475a07d6a24b691714fa270 to your computer and use it in GitHub Desktop.
Save SkypLabs/58f3e847e475a07d6a24b691714fa270 to your computer and use it in GitHub Desktop.
Set up CodeQL language server in coc.nvim

Set up CodeQL language server in coc.nvim

CodeQL CLI includes a language server which can be easily set up in coc.nvim by adding the content of this coc-settings.json file to your own configuration file.

Given that coc.nvim uses Vim filetype detection system and not file extensions, you need to let Vim know about *.ql files being CodeQL files. One way to do that is to add codeql.vim to ~/.vim/ftdetect.

{
"languageserver":{
"codeql": {
"command": "codeql",
"args": [
"execute",
"language-server",
"--check-errors",
"ON_CHANGE",
"-q"
],
"filetypes": [
"codeql",
"ql"
],
"initializationOptions": {},
"settings": {}
}
}
" Set '.ql' files as CodeQL files.
au BufRead,BufNewFile *.ql set filetype=codeql
@SkypLabs
Copy link
Author

A blog post has been published about this topic: https://blog.skyplabs.net/posts/codeql-lsp-vim/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment