ravibrock / spellwarn.nvim

Display spelling errors as diagnostics
MIT License
58 stars 1 forks source link

Allow overriding the diagnostic settings the way you can with `vim.diagnostic.set()` #6

Open titaniumtraveler opened 4 days ago

titaniumtraveler commented 4 days ago

The motivating example is that I like having virtualtext = true for lsp diagnostics, but for spelling mistakes I prefer to just have different highlighting. (i. e. the misspelled word being underscored)

So it would be cool if there were a config option to just pass opts directly to the vim.diagnostic.set() as described in :h vim.diagnostic.config():

For example, if a user enables virtual text globally with vim.diagnostic.config({ virtual_text = true })

and a diagnostic producer sets diagnostics with vim.diagnostic.set(ns, 0, diagnostics, { virtual_text = false })

I know you can set that on a per-namespace basis. (Just learned that lol) But I think having a config option would still be more convenient.

Edit: My stopgap for now is

require "spellwarn".setup()

local ns = vim.api.nvim_get_namespaces()["Spellwarn"]
vim.diagnostic.config({ virtual_text = false }, ns)
ravibrock commented 4 days ago

Perhaps I'm misunderstanding something, but what would be the point of using Spellwarn if it doesn't display diagnostics? You can already jump between spelling mistakes with [s and ]s, and there are plugins like vim-spellcheck that allow you to populate the quickfix list with errors if you want them to all be in one place.