Closed witnessmonolith closed 4 months ago
Formatters in VSCode are only invoked when you request them, so I don't understand why this would be necessary. Do you have format-on-save enabled?
Maybe you could try:
{
"[gdscript]": {
"editor.formatOnSave": false
}
}
@DaelonSuzuka Thanks for the suggestion. I tried this:
"editor.formatOnSave": true,
"[gdscript]": {
"editor.formatOnSave": false
},
but doesn't work. Looks like "gdscript" isn't a known language identifier by VSCode.
Does the extension define the language identifier?
When are your files actually being formatted? Do you have editor.formatOnType
enabled too (why would anybody want format-on-type?)? For troubleshooting purposes, what happens if you disable formatOnSave entirely>
Does the extension define the language identifier?
Yes, gdscript
is the identifier for the GDScript language, as defined by this extension.
I have this block:
"[gdscript]": {
"editor.defaultFormatter": "geequlim.godot-tools",
"editor.insertSpaces": false
},
in my VSCode settings, so I'm pretty sure that's the correct syntax for per-language settings.
Thank you! I figured out my issue. Tl;dr: my test was bad. and this does work:
"editor.formatOnSave": true,
"[gdscript]": {
"editor.formatOnSave": false
},
Thanks for your help!
Awesome, I'm glad that fixes it.
Godot version
4/irrelevant
VS Code version
irrelevant
Godot Tools VS Code extension version
2.0.0
System information
irrelevant
Problem statement
It would be nice to have an on/off option for the built-in code formatter, because, as of right now, it is still in development and would introduce problems and inconsistencies from time to time, and other parts of the extension shouldn't be affected by this.
My point is, disabling the formatter will unblock users who don't care as much for the code formatting, those, who are using alternatives such as Scony's solution, and those, who are willing to use and test some other functionality of the extension aside from the formatting.
I tried to play around the
settings.json
but to no luck:Also, didn't find the option to turn the formatter off (if it's already exists).
Proposed solution
To have something like
available for the configuration.