Closed David-Else closed 2 years ago
The installer looks harmless FWIW https://github.com/brymer-meneses/grammar-guard.nvim/blob/a52876d45ce29f22a4e538ce389eec848fb9f078/lua/grammar-guard/installer.lua#L1-L40
If you don't want to use the installer, there isn't much difference between this extension and just:
local bin_path = '/home/michael/.local/share/nvim/grammar-guard/ltex/bin/ltex-ls'
require('lspconfig/configs').ltex_ls = {
default_config = {
cmd = { bin_path },
filetypes = { 'tex', 'bib', 'markdown' },
root_dir = require('lspconfig/util').find_git_ancestor,
settings = {
ltex = {
enabled = { 'latex', 'tex', 'bib', 'markdown' },
language = 'en',
diagnosticSeverity = 'information',
setenceCacheSize = 2000,
additionalRules = {
enablePickyRules = true,
motherTongue = 'en',
},
trace = { server = 'verbose' },
dictionary = {},
disabledRules = {},
hiddenFalsePositives = {},
},
},
},
}
require('lspconfig').ltex_ls.setup {
--on_attach = on_attach,
--handlers = handlers,
}
@mjlbach Thanks for helping! I added the above, but it is not attaching. I get the following from Lspinfo
:
Other clients that match the filetype: markdown
~
~ Config: ltex_ls
~ filetypes: tex, bib, markdown
~ root directory: NA
~ cmd: /home/david/bin/ltex-ls-14.0.0/bin/ltex-ls
~ cmd is executable: true
~ autostart: true
~ custom handlers:
The logs don't mention ltex_ls
. Does it need a root directory type, or maybe something else is missing?
Yeah, I always keep my latex files under a git directory. While the built in client doesn't need you to pass root, lspconfig still expects a "root" (note, not rootUri) in order to handle "autoattaching" vs autospawning. This is a holdover from the original design of lspconfig, I would just move your files into a git directory (sorry, it's late for me). In the rewrite you can use a scratch server for all latex docs, or declaratively set up projects (via project local configuration files, or my declaratively specifying the project in a runtime lua file, with fallback behavior resembling the current lspconfig behavior but will all the util.dirname hacks purged.
@mjlbach I think I have found a bug in the LSP setup you provided, or maybe Neovim itself. Please have a look at these two comments, what do you think? https://github.com/valentjn/ltex-ls/issues/113#issuecomment-951239242
Codeactions is more @mfusseneggers's thing (sorry to throw you under the bus :P) as I don't really use them. You can file an issue on neovim/neovim (core, not lspconfig) with:
~@mfusseneggers~@mfussenegger ^
@mjlbach @oblitum The https://github.com/brymer-meneses/grammar-guard.nvim/issues/5#issuecomment-951661711 bug was a user error, plz ignore.
@mjlbach It would be great to get the config you gave me into nvim-lspconfig! It works perfectly, I see no reason to delay it.
I'm not delaying it, someone just needs to file/follow-up on the PR, and preferably continue implementing client-side, of-spec functionality in grammarguard (or another) plugin that we can then link to if someone wants something more full featured.
Now ltex-lsp is in nvim-lspconfig I assume grammar-guard is going to need a major update, so this issue is probably irrelevant, I will close it.
It says
[grammar-guard] The ltex language server has not been installed. Run :GrammarInstall to install it.
, this is not true, I haveltex-ls
installed and in the path. I don't want to run the installer as I don't know what it does to my system, I would like to use my own installation.In my
init.vim
I have this extension installed via vim-plug:lsp.lua
But I get
E5108: Error executing lua xxx/lsp.lua:17: attempt to index field 'grammar_guard' (a nil value)
PS I hope this pull request https://github.com/neovim/nvim-lspconfig/pull/863 gets sorted soon, I am trying this extension until then.
I tried with Neovim 0.5.1 and the master, Thanks!