tekumara / typos-lsp

Source code spell checker for Visual Studio Code, Neovim and other LSP clients
https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode
MIT License
162 stars 4 forks source link

Config file settings not applied in neovim #55

Closed r-vdp closed 3 months ago

r-vdp commented 3 months ago

I have setup typos-lsp like this:

local xdg_config_home = vim.env.XDG_CONFIG_HOME or (vim.env.HOME .. "/.config")
local nvim_lsp = require("lspconfig")
local capabilities = vim.lsp.protocol.make_client_capabilities()

local on_attach = function(client, bufnr)
  -- A bunch of keybindings and autocommands
end

nvim_lsp.typos_lsp.setup({
  on_attach = on_attach,
  capabilities = capabilities,
  init_options = {
    diagnosticSeverity = "hint",
    config = xdg_config_home .. "/typos.toml",
  }
})

This works great, and using inotifywait I can see that the config file is indeed opened when the lsp server starts.

The config file looks like this:

[default]
extend-ignore-re = ["snd-hda-intel"]
locale = "en-gb"
[default.extend-identifiers]

[default.extend-words]

When I run typos --config ~/.config/typos.toml on my project directory, snd-hda-intel is ignored as it should, however in neovim it's still shown as a typo.

Is typos-lsp somehow not passing the config file to typos?

MidStein commented 3 months ago

Hello, I had the same problem. Setting root_dir like https://github.com/tekumara/typos-lsp/issues/29#issuecomment-1888524584 fixed it.

r-vdp commented 3 months ago

I set root_dir as suggested in that comment but the config is still not being applied.

I also see that the config file is actually being opened when the language server starts, but the settings are not actually applied. It does work when running typos directly though.

tekumara commented 3 months ago

Thanks for raising this, support for extend-ignore-re was missing and has now been added!