-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
In the code editor, keep right side of cursor after autocompletion #9528
Comments
Most editors like VS Code actually behave like Godot is currently working: simplescreenrecorder-2024-04-15_17.26.07.mp4Replacing the end of the word is often (but not always) desired when doing autocompletion, as it can save a lot of time. The autocompletion system doesn't know that you want to replace This sounds like something that should be addressed by holding down a modifier when you don't want the text until the end of the word to be replaced. In VS Code, holding down Shift when pressing Enter will do that. (This doesn't work when clicking the suggestion with the mouse though.) Ctrl + Enter will ignore the autocompletion prompt and go to the next line. |
I must have changed something in VS code. It doesn't do this for me. I have to say that this happens to me about once every ten minutes while writing code in the Godot editor, as opposed to the use case that it's meant to help with (which is quickly dealt with with Ctrl + Shift + Right + Backspace/Del, as one would do when auto-correction isn't available). Keep in mind I've been silently tolerating this ever since it was introduced until I finally snapped today. In any case, I'll edit the proposal to suggest an Editor setting allowing the user to toggle this behavior. The default can stay whatever the standard is. |
I don't think an editor setting is the best way to approach this, as whether you want existing text to be replaced depends on a case-by-case basis. You don't want to have to go through the editor settings every time you want to accept an autocompletion suggestion that requires replacing the text until the end of the word 🙂 There's also the fact that the editor settings dialog is starting to be pretty complex, with a lot of settings that are barely ever toggled. This adds to the maintenance and QA burden. |
There are two shortcuts: |
It's understandable that one doesn't want to add bloat to the editor settings, as this can discourage users from tweaking the editor to their preferences. Personally, it seems to me that this behavior is so undesirable that 1. one would expect to see it in the settings 2. solutions involving a hotkey to change the behavior dynamically, such as the solution offered by kitbdev, don't help simply getting the behavior off my mind, as there is no situation where I want Tab or Enter to delete the right hand side of the cursor, and the attention load with handling auto-completion is unchanged. That said, if this proposal fails to garner support, I will acknowledge that this is just a pet peeve of mine and will be happy using VS code or recompiling Godot after taking this behavior out myself. It's also important to bear in mind that this is the kind of thing that one silently deals with as the vast majority of users won't even notice it. Most of my settings toggles in applications are from behavior that I didn't notice were there until seeing it described in the settings. Anecdotally, while watching a friend coding in Godot I've noticed him struggle with this behavior plenty of times without ever noticing what the problem was. |
Maybe I wasn't clear, but you can remove the shortcut from I think both behaviors have their uses, but maybe we can be more clear about them. I guess we could mention the shortcuts at the bottom of the completion window? |
Sorry if this is obvious, but I'm having trouble finding this menu. I looked at Editor > Editor Settings, Project > Project Settings (Advanced Settings toggled), directly inputted the string into the Project Settings field, and also looked at the Godot editor_settings.xml file, but I didn't find these settings anywhere. (Am using Godot 4.2.1 stable mono) |
Okay, my apologies it was somewhat obvious, had to go to the shortcuts tab in the Editor Settings. I am very glad to see that this was already offered as a setting. I do think we can afford to be more clear about how to find them, since I would initially associate this to a general Editor setting rather than a keyboard shortcut setting, but I have no idea how we could accomplish that without introducing bloat. My toggle proposal is clearly worse functionality-wise than the existing solution of offering shortcut keys for both situations. Would like to hear opinions on how the clarity could be improved as if I hadn't posted about it here I would've had to tolerate it, randomly stumble upon the idea of looking at the Shortcuts tab, or move to a different editor. That said I acknowledge my proposal itself is only indirectly related to such discussion so I would not be surprised if it were closed. |
Describe the project you are working on
Game with GDScript.
Describe the problem or limitation you are having in your project
It's a common occurrence that a user wants to backtrack in a line and add some text. The most common use case is when we access something from a different namespace, but forget to specify the namespace. For example:
Here, I have to specify that UNHIT comes from the RhythmNote namespace. As I start typing, the autocompletion suggests what I want:
However, once I press TAB, the right side of the cursor is deleted:
This behavior is personally highly distracting, and I expect it will also be so for other users as it is the kind of behavior that you can't really expect from an editor until you've been exposed to it previously. The solution of holding down a modifier key to avoid the behavior is hard to come across on one's own, and rather janky.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Providing a toggle for users whose focus is easily upset by code editors doing party tricks for the sake of "convenience" while making the more common use cases (from the perspective of said user) terribly inconvenient would greatly improve the comfort of writing code.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
In the editor settings for the code editor, a toggle is provided to remove this behavior.
If this enhancement will not be used often, can it be worked around with a few lines of script?
No.
Is there a reason why this should be core and not an add-on in the asset library?
N/A
The text was updated successfully, but these errors were encountered: