-
Notifications
You must be signed in to change notification settings - Fork 10
[Issue] Problem working with lunarvim #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you for your positive feedback! Glad that you find the plugin useful. As I don't use LunarVim myself, I might need your help here. Could you confirm whether you are executing -- Setup Lsp.
local capabilities = require("lvim.lsp").common_capabilities()
require("lvim.lsp.manager").setup("ltex", {
on_attach = function ()
require("ltex-utils").on_attach(bufnr)
require("lvim.lsp").common_on_attach(client, bufnr)
end,
on_init = require("lvim.lsp").common_on_init, -- probably not necessary?
capabilities = capabilities, -- probably not necessary?
}) If you could provide further information, it would help to resolve your issue more effectively. |
Thank for your quick response! With the tips I move one step forward I suppose: The way I config with lvim/lazy now is something like this now: {
"jhofscheier/ltex-utils.nvim",
dependencies = {
"neovim/nvim-lspconfig",
"nvim-telescope/telescope.nvim",
"nvim-telescope/telescope-fzf-native.nvim", -- optional
},
opts = {
dictionary = {
-- Path to the directory where dictionaries are stored.
-- Defaults to the Neovim cache directory.
path = vim.fn.expand("~") .. "/.local/share/ltex",
---Returns the dictionary file name for given language `lang`
filename = function(lang)
return lang .. ".txt"
end,
-- use vim internal dictionary to add unkown words
use_vim_dict = false,
-- show/suppress vim command output such as `spellgood` or `mkspell`
vim_cmd_output = false,
},
rule_ui = {
-- key to modify rule
modify_rule_key = "<CR>",
-- key to delete rule
delete_rule_key = "d",
-- key to cleanup deprecated rules
cleanup_rules_key = "c",
-- key to jump to respective place in file
goto_key = "g",
-- enable line numbers in preview window
previewer_line_number = true,
-- wrap lines in preview window
previewer_wrap = true,
-- options for creating new telescope windows
telescope = { bufnr = 0 },
},
diagnostics = {
-- time to wait for language tool to complete parsing document
-- debounce time in milliseconds
debounce_time_ms = 500,
-- use diagnostics data for modifying hiddenFalsePositives rules
diags_false_pos = true,
-- use diagnostics data for modifying disabledRules rules
diags_disable_rules = true,
},
},
config = function(opts)
require("ltex-utils").setup(opts)
require("lspconfig").ltex.setup({
capabilities = require("lvim.lsp").common_capabilities(),
on_init = require("lvim.lsp").common_on_init, -- probably not necessary?
on_attach = function(client, bufnr)
-- your other on_attach code
-- for example, set keymaps here, like
-- vim.keymap.set({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action, opts)
-- (see below code block for more details)
require("ltex-utils").on_attach(bufnr)
require("lvim.lsp").common_on_attach(client, bufnr)
end,
settings = {
language = "en-US",
diagnosticSeverity = "information",
setenceCacheSize = 2000,
additionalRules = {
enablePickyRules = true,
motherTongue = "en-US",
},
trace = { server = "verbose" },
-- dictionary = "~/.config/lvim/dict/", -- added global dictionary path
completionEnabled = "true",
checkfrenquency = "edit",
statusBarItem = "true",
disabledRules = {},
-- hiddenFalsePositives = {},
},
})
end,
},
While when run LTeUtil commands, some complains about setting, and tried to empty setting table to nil or create the json manually...
So far, intend to "hardcoding" the ltex-setting to get everything up and running, and still sometime confused by opts and settings config described by README so far. |
Thanks for the additional information 😃 That's interesting. I have an idea what could be the issue. Could you try amending your config as follows? {
"jhofscheier/ltex-utils.nvim",
dependencies = {
"neovim/nvim-lspconfig",
"nvim-telescope/telescope.nvim",
"nvim-telescope/telescope-fzf-native.nvim", -- optional
},
opts = {
...-- what you have should be fine -> leave it unchanged
},
config = function(opts)
require("ltex-utils").setup(opts)
require("lspconfig").ltex.setup({
capabilities = require("lvim.lsp").common_capabilities(),
on_init = require("lvim.lsp").common_on_init,
on_attach = function(client, bufnr)
require("ltex-utils").on_attach(bufnr)
require("lvim.lsp").common_on_attach(client, bufnr)
end,
settings = {
ltex = {
language = "en-US",
diagnosticSeverity = "information",
setenceCacheSize = 2000,
additionalRules = {
enablePickyRules = true,
motherTongue = "en-US",
},
trace = { server = "verbose" },
-- dictionary = "~/.config/lvim/dict/", -- added global dictionary path
completionEnabled = "true",
checkFrequency = "edit",
statusBarItem = "true",
},
},
})
end,
}, Notice the additional key (Please also note that I changed Let me know if this fixes the issue for your. |
Thanks it basically works now ;) While, seems the dictionary opt did not work with such config. Tried there, eventually dictionary using the stdpath cache one... -- path = vim.fn.expand("~") .. "/.local/share/ltex/",
-- path = "/Users/xyz/.local/share/ltex/",
-- path = vim.api.nvim_call_function("stdpath", {"cache"}) .. "/ltex/", Further more, it might need some extra handling to store the config automatically (at least configurable), some time saw many xxx_lte.json files for buffers under edit, not even in the ft supported by ltex-ls, something like NvimTree_1__ltex.json (let me know if it needs extra ticket for this ...). |
Glad to hear that you managed to get the plugin working. Could you provide some more information about what exactly is not working with regards to the dictionary? Happy to help with that. Thanks for pointing out the issue with "random" xxx_ltex.json files popping up. It should be fixed in the newest version. Please pull the update. Should the issue still persist, I'd be grateful if you would create another issue with some further details. |
Thanks, the radom buffer issue is fixed by latest update. While, regarding the dictionary, seems my customised path is not effective... the newly added words via ltex-util is stored in cache and not the path defined in opts, which is called in config as you suggestion: opts = {
dictionary = {
-- Path to the directory where dictionaries are stored.
-- Defaults to the Neovim cache directory.
path = vim.fn.expand("~") .. "/.local/share/ltex/",
....
}
config = function(opts)
require("ltex-utils").setup(opts)
require("lspconfig").ltex.setup({
The same config as you suggested. |
First of all, good job done!
Trial several ltex lsp nvim extensions and yours most fits the trends :)
While combining with lunarvim, if just config with
require("lvim.lsp.manager").setup("ltex")
and README's recommandation seems none of the LTeXUtils commands could work, and no faulty log reported.Tried both vimspell or w/o it.
The text was updated successfully, but these errors were encountered: