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
168 stars 4 forks source link

Has anyone gotten `typos.config` to work on Neovim? #31

Closed mawkler closed 5 months ago

mawkler commented 6 months ago

I'm trying to explicitly set the typos config using typos.config. However, it doesn't seem to get picked up. I've tried specifying the config value in all kinds of ways, but none of them seems to work:

require('lspconfig').typo_lsp.setup({
  init_options = {
    config = '/custom/path/.typos.toml',
    config = {'/custom/path/.typos.toml'},
  },
  config = {'/custom/path/.typos.toml'},
  config = '/custom/path/.typos.toml',
  settings = {
    typos = {
      config = {'/custom/path/.typos.toml'},
      config = '/custom/path/.typos.toml',
    }
  }
})

What am I doing wrong?

tekumara commented 6 months ago

config is received via initializationOptions so it goes in init_options, eg:

require('lspconfig').typos_lsp.setup({
    init_options = {
      config = '/custom/path/.typos.toml',
    }
})

However, it looks like there's an edge case! When Neovim doesn't initialise typo_lsp with workspaceFolders (ie: workspaceFolders = vim.NIL) the config file is ignored 😱 This is something that typos-lsp should handle, so I'll look into making a fix.

PS: It looks like workspaceFolders is derived from root_dir by default (ie: when not explicitly set). However, if workspaceFolders is not explicitly set, and root_dir is nil (because it doesn't contain any of these files) then we end up with rootPath = vim.NIL, rootUri = vim.NIL, workspaceFolders = vim.NIL and therefore an ignored config file 😞

mawkler commented 6 months ago

Interesting, thanks for looking into it!

mawkler commented 5 months ago

@tekumara Is the v0.1.12 release supposed to show up under releases? It still seems to show v0.1.11 as the latest version 🤔

tekumara commented 5 months ago

Unfortunately there's a 32-bit windows build error I haven't managed to fix yet blocking the release 😞

tekumara commented 5 months ago

Fixed and v0.1.12 has been released, let me know how you go 🤞

mawkler commented 5 months ago

@tekumara Yes, my issue has been fixed! Thank you very much!