-
Notifications
You must be signed in to change notification settings - Fork 798
Godot-gdscript-toolkit formatter and linter support #827
Godot-gdscript-toolkit formatter and linter support #827
Conversation
Thanks for putting this in! You can try enabling debug logging and see if the output from the formatter matches what you expect. Otherwise, I'll have a chance to test this out myself later this week. |
so this is what it gave me
gdformat is very simple it is just |
Are you sure it supports |
it does support stdin it needed the arg "-", I did that and the formatter works, now I will attempt to make the linter work or should put that in another PR? |
Either way works! I'll mention that diagnostic sources can be significantly trickier depending on the output format. |
I will give it a try! |
so the null-ls debug catches the output from gdlint and display it
|
this is the full log
|
Looks like it's outputting to |
That indicates that it's not accepting input from Edit: also, to clear the CI failures, you'll just want to run the files through StyLua, either through the command line or via the null-ls built-in. |
Well it works, it indeed needs a temp file (doesn't accept from stdin nor output one) and it worked as expected! Sadly, the linter doesn't report columns |
Two options:
Either way, judging from the output you posted, I think we'll need #2 as a fallback. |
If there are other linters that do the same, I will leave it as is. |
This is a new output with temp files and no stdin |
Sorry, I should have been clearer - if you leave it as-is, it'll just default to 0, meaning it applies to the entire line (which is totally fine). If everything is working, this looks good to me, but let me know when you think it's ready to merge. |
Oh, ok! I think it's ready to merge, I tested it a bit more, and it's seem fine. |
Awesome, thanks for working on this! |
gdlint is not working with null-ls for me. Running gdlint I see errors in this format:
Did they change the output format or am I missing a config? Currently null-ls reports no errors via the source gdlint, it shows errors reported by gdscript lsp. |
@sassanh it works fine on my end? it works with both branches of require("null-ls").setup({
sources = {
require("null-ls").builtins.diagnostics.gdlint
}
}) |
Thanks for the quick reply, I do have that source in my null-ls setup: null_ls.setup {
on_attach = On_attach,
sources = {
null_ls.builtins.code_actions.gitsigns,
null_ls.builtins.formatting.gdformat,
null_ls.builtins.diagnostics.gdlint,
},
} gdformat works well when I write the file, but gdlint doesn't work, gdlint command line on the hand works as expected, it is just not working with null-ls. It even shows as active in NullLsInfo:
If it is working fine for you then there should be something wrong in my setup. |
I'm using gdtoolkit 4.0.1 from pypi, what do you mean by "both branches" of gdtoolkit? Is gdlint generating errors like this for you?
|
The output generated by my gdlint binary doesn't seem to match with what these lines expect: on_output = h.diagnostics.from_patterns({
{
pattern = [[:(%d+): (.*)]],
groups = { "row", "message" },
},
}), So I guess your gdlint is generating errors in a different format. |
I think I understand what's happening now, gdlint raises errors and reports them in a different format when the code has certain syntax errors. And while defining functions inside functions works with Godot, seems like gdlint can't handle it. So there is no problem with the way we are setting up gdlint for null-ls. |
there are two branches for |
just added the formatter gdformat from https://github.com/Scony/godot-gdscript-toolkit
it doesn't work with
lua vim.lsp.buf.formatting_sync()
I don't know why...help