japhib / pico8-ls

PICO-8 Language Server
MIT License
64 stars 8 forks source link

Magic comments for disabling a warning on the next line, or for the whole file #13

Open japhib opened 2 years ago

japhib commented 2 years ago

Something like:

-- pico8-ls disable
-- pico8-ls disable-line
-- pico8-ls disable-function

Since we don't have any auto corrections for warnings/errors, it'd be nice if adding these showed up as a code correction for warnings/errors. (like they do for eslint)

japhib commented 2 years ago

Maybe also a magic comment to disable "unknown global" for a specific variable -- although, maybe a better answer is just setting something like my_var = nil at the top of the file. (that does take tokens, though, and a magic comment would not.)

freaky-m0 commented 1 year ago

Something like that would be nice. I use pico-build and split the code over multiple files. So I get "undefined variable" everywhere xD

gcoulby commented 1 year ago

Something like that would be nice. I use pico-build and split the code over multiple files. So I get "undefined variable" everywhere xD

A quick workaround (though not ideal) is to add

"Lua.diagnostics.disable": ["undefined-global", "lowercase-global"]

to you workspace settings.lua or globally if you don't want to worry about it for every project (but then you loose those errors on normal lua files)