Skip to content

fix: attempt to fix stale diagnostics #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lua/typescript-tools/autocommands/diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local c = require "typescript-tools.protocol.constants"
local plugin_config = require "typescript-tools.config"
local utils = require "typescript-tools.utils"
local plugin_api = require "typescript-tools.api"
local proto_utils = require "typescript-tools.protocol.utils"
local common = require "typescript-tools.autocommands.common"

local publish_diagnostic_mode = plugin_config.publish_diagnostic_mode
Expand All @@ -19,7 +18,7 @@ local request_diagnostics_throttled = utils.throttle(200, request_diagnostics_ap
local request_diagnostics_debounced = utils.debounce(200, request_diagnostics_api_wrapper)

---@param dispatchers Dispatchers
function M.setup_diagnostic_autocmds(dispatchers)
function M.setup_diagnostic_autocmds()
local augroup = vim.api.nvim_create_augroup("TypescriptToolsDiagnosticGroup", { clear = true })

if plugin_config.publish_diagnostic_on == publish_diagnostic_mode.change then
Expand All @@ -39,8 +38,8 @@ function M.setup_diagnostic_autocmds(dispatchers)

api.nvim_create_autocmd("InsertEnter", {
pattern = M.extensions_pattern,
callback = function(e)
proto_utils.publish_diagnostics(dispatchers, vim.uri_from_bufnr(e.buf), {})
callback = function()
vim.diagnostic.reset()
end,
group = augroup,
})
Expand Down
2 changes: 1 addition & 1 deletion lua/typescript-tools/rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function M.start(dispatchers)
tsserver_semantic = Tsserver.new("semantic", dispatchers)
end

autocommands.setup_autocommands(dispatchers)
autocommands.setup_autocommands()
custom_handlers.setup_lsp_handlers(dispatchers)

return {
Expand Down