WIP: Move to vim.lsp
This commit is contained in:
parent
0b367e1656
commit
d3945cc621
9 changed files with 348 additions and 41 deletions
32
home/modules/nvim/config/lsp/ts_ls.lua
Normal file
32
home/modules/nvim/config/lsp/ts_ls.lua
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
local dnscUtils = require("dnsc.utils")
|
||||
|
||||
return {
|
||||
init_options = { hostInfo = "neovim" },
|
||||
cmd = { "typescript-language-server", "--stdio" },
|
||||
filetypes = {
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"javascript.jsx",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"typescript.tsx",
|
||||
},
|
||||
root_dir = dnscUtils.root_pattern("tsconfig.json", "jsconfig.json", "package.json", ".git"),
|
||||
init_options = {
|
||||
preferences = {
|
||||
importModuleSpecifierPreference = "relative",
|
||||
importModuleSpecifierEnding = "minimal",
|
||||
},
|
||||
},
|
||||
handlers = {
|
||||
["textDocument/definition"] = function(err, result, method, ...)
|
||||
if vim.tbl_islist(result) and #result > 1 then
|
||||
local filtered_result = dnscUtils.filter(result, dnscUtils.filterReactDTS)
|
||||
return vim.lsp.handlers["textDocument/definition"](err, filtered_result, method, ...)
|
||||
end
|
||||
|
||||
vim.lsp.handlers["textDocument/definition"](err, result, method, ...)
|
||||
end,
|
||||
},
|
||||
single_file_support = true,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue