Skip to content

Commit f8c2e0b

Browse files
Merge pull request #283 from pmizio/fix-diagnostic-method-fired-for-all
fix: fires request_diagnostics only for typescipt client
2 parents 3ecf6b2 + 4d77687 commit f8c2e0b

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

lua/typescript-tools/api.lua

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ local a = require "plenary.async"
22
local uv = require "plenary.async.uv_async"
33
local au = require "plenary.async.util"
44
local c = require "typescript-tools.protocol.constants"
5-
local plugin_config = require "typescript-tools.config"
65
local async = require "typescript-tools.async"
76
local utils = require "typescript-tools.utils"
87

@@ -141,18 +140,16 @@ end
141140
---@param callback fun(params: table, result: table)|nil
142141
function M.request_diagnostics(callback)
143142
local text_document = vim.lsp.util.make_text_document_params()
144-
local client = utils.get_clients {
145-
name = plugin_config.plugin_name,
146-
bufnr = vim.uri_to_bufnr(text_document.uri),
147-
}
143+
local bufnr = vim.uri_to_bufnr(text_document.uri)
144+
local typescript_client = get_typescript_client(bufnr)
148145

149-
if #client == 0 then
146+
if typescript_client == nil then
150147
return
151148
end
152149

153-
vim.lsp.buf_request(0, c.CustomMethods.Diagnostic, {
150+
typescript_client.request(c.CustomMethods.Diagnostic, {
154151
textDocument = text_document,
155-
}, callback)
152+
}, callback, bufnr)
156153
end
157154

158155
---@param is_sync boolean

0 commit comments

Comments
 (0)