Skip to content

Commit

Permalink
Merge pull request #283 from pmizio/fix-diagnostic-method-fired-for-all
Browse files Browse the repository at this point in the history
fix: fires request_diagnostics only for typescipt client
  • Loading branch information
KostkaBrukowa authored Jul 18, 2024
2 parents 3ecf6b2 + 4d77687 commit f8c2e0b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lua/typescript-tools/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ local a = require "plenary.async"
local uv = require "plenary.async.uv_async"
local au = require "plenary.async.util"
local c = require "typescript-tools.protocol.constants"
local plugin_config = require "typescript-tools.config"
local async = require "typescript-tools.async"
local utils = require "typescript-tools.utils"

Expand Down Expand Up @@ -141,18 +140,16 @@ end
---@param callback fun(params: table, result: table)|nil
function M.request_diagnostics(callback)
local text_document = vim.lsp.util.make_text_document_params()
local client = utils.get_clients {
name = plugin_config.plugin_name,
bufnr = vim.uri_to_bufnr(text_document.uri),
}
local bufnr = vim.uri_to_bufnr(text_document.uri)
local typescript_client = get_typescript_client(bufnr)

if #client == 0 then
if typescript_client == nil then
return
end

vim.lsp.buf_request(0, c.CustomMethods.Diagnostic, {
typescript_client.request(c.CustomMethods.Diagnostic, {
textDocument = text_document,
}, callback)
}, callback, bufnr)
end

---@param is_sync boolean
Expand Down

0 comments on commit f8c2e0b

Please sign in to comment.