aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lsp/ts_query_ls.lua
blob: 665b2d8d6cd1e4d34dba39510884a12cb4d8d64a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---@brief
---
--- https://github.com/ribru17/ts_query_ls
--- Can be configured by passing a "settings" object to `vim.lsp.config('ts_query_ls', {})`:
--- ```lua
--- vim.lsp.config('ts_query_ls', {
---   init_options = {
---     parser_install_directories = {
---       '/my/parser/install/dir',
---     },
---     -- This setting is provided by default
---     parser_aliases = {
---       ecma = 'javascript',
---       jsx = 'javascript',
---       php_only = 'php',
---     },
---   },
--- })
--- ```

-- Disable the (slow) built-in query linter, which will show duplicate diagnostics. This must be done before the query
-- ftplugin is sourced.
vim.g.query_lint_on = {}

---@type vim.lsp.Config
return {
  cmd = { 'ts_query_ls' },
  filetypes = { 'query' },
  root_markers = { '.tsqueryrc.json', '.git' },
  init_options = {
    parser_aliases = {
      ecma = 'javascript',
      jsx = 'javascript',
      php_only = 'php',
    },
    parser_install_directories = {
      vim.fn.stdpath('data') .. '/site/parser',
    },
  },
  on_attach = function(_, buf)
    vim.bo[buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
  end,
}