barreiroleo / ltex_extra.nvim

Provides external LTeX file handling (off-spec lsp) and other functions.
GNU General Public License v3.0
142 stars 15 forks source link

not assuming settings.ltex exist #13

Closed chomosuke closed 1 year ago

chomosuke commented 2 years ago

Sometimes I don't have any settings to pass into lspconfig.ltex.setup {}. Hence client.config.settings.ltex ended up being nil. This causes exceptions.

I did some refactoring so that every time settings.ltex would be initialized to {} before it's indexed.

barreiroleo commented 2 years ago

Hi @chomosuke! Thanks for your PR, I missed the notification, sorry for the late reply... Thanks for the refactor, I wanted to make this extract a long time ago.

In theory, ~.setting.ltex should contain at least the default settings for the server. So I don't know if it's better to do an initialization to {} or notify the users that they don't have a config. I have to test it but, am I missing something?

chomosuke commented 2 years ago

Hey @barreiroleo, in my experience, if I don't write out

{
   settings = {
        ltex = {},
    },
}

Then ~.settings.ltex would be nil. And I don't have any setting to put into ltex so i'd rather not write that out. I'm using nvim 7.2 btw :).