Open RaphaelNeubert opened 4 weeks ago
Hi Raphael,
Based on your mason config, I don't think client.settings
doesn't exist. It's just a reference to your server settings and it looks ok.
Could you provide your ltex_extra config? Maybe is an issue with configured languages
Thanks for the quick response. I basically copied the ltex_extra config from the readme and changed the language:
config = function()
require("ltex_extra").setup({
load_langs = { 'de-DE', 'en-US' }, -- Which languages do you want to load on init.
path = ".ltex", -- Path to your ltex files
})
end
If i print the first level of the client table using:
local function print_first_level(tbl)
for key, value in pairs(tbl) do
if type(value) == "table" then
print(key .. " = <table>")
else
print(key .. " = " .. tostring(value))
end
end
end
function LtexExtra:SetLtexSettings(settings)
local client = LtexExtra:GetLtexClient()
assert(client, "Client not available")
print_first_level(client)
LtexExtra.internal_settings = vim.tbl_deep_extend("force", client.settings, settings)
LtexExtra:SyncInternalState()
end
it prints:
id = 2
cancel_request = function: 0x7f388c34a928
handlers = <table>
request_sync = function: 0x7f388c34d4c8
rpc = <table>
commands = <table>
is_stopped = function: 0x7f388c34a9c0
offset_encoding = utf-16
workspace_did_change_configuration = function: 0x7f388c395e70
name = ltex
_on_attach = function: 0x7f388c34a9f8
attached_buffers = <table>
server_capabilities = <table>
workspace_folders = <table>
config = <table>
requests = <table>
stop = function: 0x7f388c34a978
supports_method = function: 0x7f388bbb3af0
messages = <table>
request = function: 0x7f388c34b330
initialized = true
notify = function: 0x7f388c34a8e0
No settings entry. If i do
print_first_level(client.config)
i get:
single_file_support = true
on_attach = function: 0x7f88e9788050
workspace_folders = <table>
log_level = 2
on_exit = function: 0x7f88e9787680
init_options = <table>
name = ltex
get_language_id = function: 0x7f88e990a4a0
message_level = 2
capabilities = <table>
flags = <table>
cmd_cwd = /home/raphael/htw/bachelorthesis/doc
cmd = <table>
filetypes = <table>
root_dir = /home/raphael/htw/bachelorthesis/doc
settings = <table>
handlers = <table>
autostart = true
_on_attach = function: 0x7f88e9c679c8
on_init = function: 0x7f88e9790358
settings entry exists.
I've noticed that
function LtexExtra:SyncInternalState()
local client = LtexExtra:GetLtexClient()
assert(client ~= nil, "Error to sync setings. Client not available")
client.settings.ltex = LtexExtra:GetLtexSettings().ltex
return client.notify("workspace/didChangeConfiguration", LtexExtra:GetLtexSettings())
seems to expect settings to have a .ltex entry which wasn't the case in the config i provided in the original post. For that reason i have changed it to:
ltex = {
ltex = {
enabled = { "latex", "tex", "bib", "markdown" },
language = "auto",
diagnosticSeverity = "information",
sentenceCacheSize = 2000,
additionalRules = {
enablePickyRules = true,
motherTongue = "de",
},
disabledRules = {
fr = { "APOS_TYP", "FRENCH_WHITESPACE" },
},
dictionary = {
['de-DE'] = {'MuZero', 'anotherword'},
},
},
},
(additional ltex nesting)
If i change client.settings to client.config.settings (in SetLtexSettings and SyncInternalState), everything works as expected.
I'm on neovim-0.9.5.
Yeah, I forgot about that peculiarity of ltex server. settings["ltex"]
entry is needed because the specs.
Mine for example:
{
filetypes = { 'bib', 'markdown', 'org', 'plaintex', 'rst', 'rnoweb', 'tex' },
settings = {
ltex = {
checkFrequency = 'save',
language = { "en-US", 'es-AR' },
additionalRules = {
enablePickyRules = true,
motherTongue = 'es-AR',
},
},
},
}
Could you show me your client table and your client.config table? You can use the the print_first_level(table) function i've provided earlier to make the output non-recursive and therefore shorter.
The path to my actual settings is now client.config.settings.ltex so i still need to change the code of this plugin to make it work.
I have ltex installed using mason. I configure it the following way:
the list servers has an entry ltex:
When opening a .tex file i get the following error:
Inside the function SetLtexSettings found in this plugins init.lua (dev branch) the line that causes the error is:
LtexExtra.internal_settings = vim.tbl_deep_extend("force", client.settings, settings)
The reason is that client.settings simply does not exists. Lsp client settings appear to be stored at client.config.settings.I don't know much about lua or neovim so i'm wondering if i did a mistake in configuring ltex or if this is a bug and the line needs to be changed.