Replies: 3 comments 3 replies
-
This would be highly complex in all but the simplest cases, and those simples cases would be trivial to fix by hand, so don't see it as something justifying the work required to accomplish it It would also need to be able to guess what you wanted to do, because often errors aren't necessarily this easy to identify what was wrong, a "fix" might make it worse because the editor guessed wrong, even in this trivial case it might not be obvious what type to return for example |
Beta Was this translation helpful? Give feedback.
-
Sure it would be complex. In the first place there should only be a framework which allows adding quick fixes to specific errors. Simple cases (like in the example) could get implemented, complex cases maybe not. My experience with vscode and Typescript is that even the trivial quick fixes are very useful and make coding faster. About your shadowing example: Yes, there would be a lot of errors that couldn't be automatically fixed. But I don't find that a good reason to not to automatically fix simple cases (even if the implementation itself isn't simple). That shadowing example is also a good example for a complex, if not impossible, case for rename refactoring, which is also sorely missed. |
Beta Was this translation helpful? Give feedback.
-
How about a quick fix for declaring variables. You type Vector2(100,100) then press the quick fix button/keyboard shortcut var vector2: Vector2 = Vector2(100,100) The cursor marks vector2 and you can type the variable name you want. I don't know about the cost/benefit aspect. Other IDEs support such features for a number of languages and it speeds up development. Everything that helps moving runtime errors to "compile-time" errors helps all developers using an IDE enormously. |
Beta Was this translation helpful? Give feedback.
-
Visual Studio Code has an excellent Quick Fix tool which can make code changes (at least) to Typescript code. Similar functionality would be really nice in GDScript. For example, I have set Untyped Declaration setting to "Error" and get this error message:
The fix is simple, just add
-> int
to the function declaration. Sure, I can do it myself, but why should I? Godot already knows what the function returns, so it could do it automatically. Especially if I have lots of old code with errors like this, fixing these kind of simple errors gets quite arduous.So I would like too see a Quick Fix button (and keyboard shortcut) below the error message. There could be additional information about what kind of fix is done, for example in this case something like: "return type will be changed to int".
Beta Was this translation helpful? Give feedback.
All reactions