brymer-meneses / grammar-guard.nvim

Grammar Guard is a Neovim plugin that checks your grammar as you write your LaTeX, Markdown or plain text document.
Apache License 2.0
153 stars 6 forks source link

Change ltex configs? #14

Open Antomek opened 2 years ago

Antomek commented 2 years ago

Hi all,

I gave grammar-guard a go, mainly because I wanted to change my ltex-ls language settings easily and so far nothing has worked (e.g. overriding the default configs of nvim-lsp-installer or trying these instructions.

Setting this:

-- setup the ltex-ls LSP config
require("lspconfig").grammar_guard.setup({
    settings = {
        ltex = {
            enabled = { "bibtex", "context", "context.tex", "html", "latex", "markdown", "org", "restructuredtext", "rsweave"},
            language = "en-GB",
            diagnosticSeverity = "information",
            setenceCacheSize = 2000,
            additionalRules = {
                enablePickyRules = false,
                motherTongue = "en",
            },
            trace = { server = "off" },
            dictionary = {},
            disabledRules = {},
            hiddenFalsePositives = {},
        },
    },
})

as my config though, appeared to have no effect (settings remain at default). Did I make a silly mistake somewhere? Any tips on how to easily edit my configs? (Even better if I could swap languages with a keymap!)

Thanks!

engeir commented 2 years ago

This works for me:

require("nvim-lsp-installer").on_server_ready(function(server)
    -- Specify the default options which we'll use to setup all servers
    local opts = {
        on_attach = on_attach,
    }

    if server.name == "ltex" then
        opts.settings = {
            ltex = {
                enabled = { "latex", "tex", "bib", "markdown" },
                language = "en-GB",
                diagnosticSeverity = "information",
                setenceCacheSize = 2000,
                additionalRules = {
                    enablePickyRules = true,
                    motherTongue = "en",
                },
                trace = { server = "verbose" },
                dictionary = {},
                disabledRules = {},
                hiddenFalsePositives = {},
            },
        }
    end

    server:setup(opts)
end)

See config. This also works, btw.