diff options
author | PBird <[email protected]> | 2021-07-19 19:44:44 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-19 21:14:44 +0430 |
commit | ecb02ba7feddc65564e83e8695b52d3139c82461 (patch) | |
tree | c89273af923c62822a3e35026c49347060770c04 | |
parent | 1399d2670aced6f39033c64b26e91887dc87f9a5 (diff) |
fix document highlight bug for javascript,typescript... (#1017)
-rw-r--r-- | lua/lsp/init.lua | 4 | ||||
-rw-r--r-- | lua/lsp/tsserver-ls.lua | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index efc2f30d..7e6982b5 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -196,8 +196,8 @@ function lsp_config.PeekImplementation() end end -if O.lsp.document_highlight then - function lsp_config.common_on_attach(client, bufnr) +function lsp_config.common_on_attach(client, bufnr) + if O.lsp.document_highlight then documentHighlight(client, bufnr) end end diff --git a/lua/lsp/tsserver-ls.lua b/lua/lsp/tsserver-ls.lua index 01db611c..18e56dae 100644 --- a/lua/lsp/tsserver-ls.lua +++ b/lua/lsp/tsserver-ls.lua @@ -47,6 +47,13 @@ end -- require'completion'.on_attach(client) -- require'illuminate'.on_attach(client) -- end + +local on_attach = function(client, bufnr) + local lsp = require "lsp" + lsp.common_on_attach(client, bufnr) + lsp.tsserver_on_attach(client, bufnr) +end + require("lspconfig").tsserver.setup { cmd = { DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server", @@ -60,8 +67,7 @@ require("lspconfig").tsserver.setup { "typescriptreact", "typescript.tsx", }, - on_attach = require("lsp").tsserver_on_attach, - -- on_attach = require'lsp'.common_on_attach, + on_attach = on_attach, -- This makes sure tsserver is not used for formatting (I prefer prettier) settings = { documentFormatting = false }, handlers = { |