diff options
| author | Alvaro Muñoz <pwntester@github.com> | 2020-03-26 04:10:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-26 12:10:41 +0900 |
| commit | 0bc2ab054b6c2c9a7b146aff3d556c6c57c0b91c (patch) | |
| tree | 523953b31dceea38971dd3ddb6343c1deacfaede /lua/nvim_lsp/codeqlls.lua | |
| parent | [docgen] Update README.md (diff) | |
| download | nvim-lspconfig-0bc2ab054b6c2c9a7b146aff3d556c6c57c0b91c.tar nvim-lspconfig-0bc2ab054b6c2c9a7b146aff3d556c6c57c0b91c.tar.gz nvim-lspconfig-0bc2ab054b6c2c9a7b146aff3d556c6c57c0b91c.tar.bz2 nvim-lspconfig-0bc2ab054b6c2c9a7b146aff3d556c6c57c0b91c.tar.lz nvim-lspconfig-0bc2ab054b6c2c9a7b146aff3d556c6c57c0b91c.tar.xz nvim-lspconfig-0bc2ab054b6c2c9a7b146aff3d556c6c57c0b91c.tar.zst nvim-lspconfig-0bc2ab054b6c2c9a7b146aff3d556c6c57c0b91c.zip | |
Add CodeQL support (#138)
* Add support for CodeQL LS
Diffstat (limited to 'lua/nvim_lsp/codeqlls.lua')
| -rw-r--r-- | lua/nvim_lsp/codeqlls.lua | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/lua/nvim_lsp/codeqlls.lua b/lua/nvim_lsp/codeqlls.lua new file mode 100644 index 00000000..dfa917de --- /dev/null +++ b/lua/nvim_lsp/codeqlls.lua @@ -0,0 +1,50 @@ +local configs = require "nvim_lsp/configs" +local util = require "nvim_lsp/util" + +local server_name = "codeqlls" + +local root_pattern = util.root_pattern("qlpack.yml") + +configs[server_name] = { + default_config = { + cmd = {"codeql", "execute", "language-server", "--check-errors", "ON_CHANGE", "-q"}; + filetypes = {'codeql'}; + root_dir = function(fname) + return root_pattern("qlpack.yml") or util.path.dirname(fname) + end; + log_level = vim.lsp.protocol.MessageType.Warning; + before_init = function(initialize_params, config) + initialize_params['workspaceFolders'] = {{ + name = 'workspace', + uri = initialize_params['rootUri'] + }} + end; + settings = { + ["search_path"] = {} + }; + }; + docs = { + package_json = "https://github.com/github/vscode-codeql/blob/master/extensions/ql-vscode/package.json"; + description = [[ +Reference: +https://help.semmle.com/codeql/codeql-cli.html + +Binaries: +https://github.com/github/codeql-cli-binaries + ]]; + default_config = { + settings = { + search_path = [[list containing all search paths, eg: '~/codeql-home/codeql-repo']]; + }; + }; + }; + on_new_config = function(config) + if type(config.settings.search_path) == 'table' and not vim.tbl_isempty(config.settings.search_path) then + local search_path = "--search-path=" + for _, path in ipairs(config.settings.search_path) do + search_path = search_path..vim.fn.expand(path)..":" + end + config.cmd = {"codeql", "execute", "language-server", "--check-errors", "ON_CHANGE", "-q", search_path} + end + end; +} |
