Skip to content
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

Disable "missing-fields" warning in Lua LSP by default #503

Closed
ashrasmun opened this issue Nov 12, 2023 · 11 comments
Closed

Disable "missing-fields" warning in Lua LSP by default #503

ashrasmun opened this issue Nov 12, 2023 · 11 comments

Comments

@ashrasmun
Copy link

ashrasmun commented Nov 12, 2023

Hello,

I think it would be a great idea to extend lua_ls settings to ignore noisy warnings that are irrelevant for a beginner.

From:

    lua_ls = {
        Lua = {
            workspace = { checkThirdParty = false },
            telemetry = { enable = false },
        },
    },

To:

    lua_ls = {
        Lua = {
            workspace = { checkThirdParty = false },
            telemetry = { enable = false },
            diagnostics = {
                disable = { "missing-fields" },
            },
        },
    },

Reference: https://github.com/LuaLS/lua-language-server/wiki/Settings#diagnosticsdisable
I cannot see any template for suggestions, so I hope I won't be automatically dismissed 😊

Kind Regards

@feoh
Copy link
Collaborator

feoh commented Nov 12, 2023

I'm confused by this. The missing fields indicators are one of the basic features of every LSP. I see this in Python as well as Lua.

From where I sit it's a desirable feature.

Thank you for your contribution in any case!

Why do you want to turn them off?

Unless people in the community feel very strongly about this I'd prefer we not make this change.

@ashrasmun
Copy link
Author

As a beginner, I was more confused about the fact that a major part of config was underlined because of these warnings and I thought I am expected to fix the warnings in order to repair this config. However I understand your point - I just shared my initial user's experience with this configuration.

@feoh
Copy link
Collaborator

feoh commented Nov 12, 2023

Thanks very much for the idea. I just think it's throwing the baby out with the bathwater :) Closing this for now.

@feoh feoh closed this as completed Nov 12, 2023
@wommy
Copy link
Contributor

wommy commented Nov 21, 2023

i agree, i thought my config was broken,
but i vote for

    lua_ls = {
        Lua = {
            workspace = { checkThirdParty = false },
            telemetry = { enable = false },
            -- NOTE: Toggle below if Lua LSP Warnings are too much
            -- :help Link
            -- diagnostics = { disable = "missing-fields" },
        },
    },

@dam9000
Copy link
Contributor

dam9000 commented Nov 21, 2023

@wommy what is the :help Link for? Not sure it's related to the issue?

@feoh
Copy link
Collaborator

feoh commented Nov 21, 2023

@wommy Please generate a PR for this and, obviously minus the :help link, I'll merge it. I like how this signposts the way for people who want this disabled but doesn't short circuit the lsp defaults.

@feoh feoh reopened this Nov 21, 2023
@StraightOuttaCrompton
Copy link

Just some related items I've spotted whilst looking for a solution to this.

A pull request in nvim-cpm to fix this is open 🎉

An issue in treesitter, but looks like it isn't a priority

And finally there is an example of how to supress the warnings using a mix of ---@diagnostic disable: missing-fields, ---@diagnostic enable: missing-fields, and ---@diagnostic disable-next-line: missing-fields.

@wommy
Copy link
Contributor

wommy commented Nov 22, 2023

i was trying to echo how TJ has the :help's peppered throughout,
but i had another appointment so i just typed up something quick and i thought thatd be clear

as im just trying to make the transition from the vimscript to lua myself, im totally unfamiliar,
is there a way to point to lua-language-server/settings#diagnosticsDisable
what should be pointed to? is there something equivalent / better?

@wommy
Copy link
Contributor

wommy commented Nov 22, 2023

#511

@dam9000
Copy link
Contributor

dam9000 commented Nov 22, 2023

@wommy I don't think there is a help entry for that, at least I could not found one. Using the http link should work just as fine, or leaving the comment as is is probably also good enough.

@wommy
Copy link
Contributor

wommy commented Nov 24, 2023

#511 got merged

vsratobury added a commit to vsratobury/config.nvim that referenced this issue Nov 29, 2023
@feoh feoh closed this as completed Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants