Please stop deleting my code on auto-complete

Answered

Why does Rider delete code to the right of my cursor when I use auto-complete? I just don't get it.

Take the following line:

In this line, I forgot to get the directory-name from the full filename. So I start typing:

That's good! I want "GetDirectoryName" and hit Tab.

As a result, Rider deletes the code to the right of my cursor:

Why?

I don't get it! 

This happens all the time while coding. And the workaround sucks:

Instead of just hitting Tab, I need to hit Escape, Space, Cursor left, Ctrl+Space and then Tab. And then I need to delete the space again.

What business does the auto-complete have with the code to the right of my cursor?

11
10 comments

Hello Andreas,

Thank you for contacting Rider support. It happens because `Tab` key is responsible for `Choose Lookup Item Replace`. Also, there is a different action `Choose Lookup Item` which is assigned to `Enter`. 
I suggest the following solutions:

  1. To use `Enter` for autocomplete instead of `Tab` and use `Tab` if only you want to replace the code on the right.
  2. To remap `Tab` to `Choose Lookup Item` action from settings:
  • Find `File | Settings | Keymap | Editor Actions | Choose Lookup Item Replace` action (You can type `Choose Lookup` into search textbox to find it easier);
  • Right-click on it;
  • Select `Remove Tab`;
  • Find `File | Settings | Keymap | Editor Actions | Choose Lookup Item` action;
  • Right-click on it;
  • Select `Add Keyboard Shortcut`;
  • Click `+`;
  • Select `Set Tab` -> `Ok` -> `Keep`;

Hope it helps.

7

Thank you! All (!) members in my team changed the behavior as soon as the read your post. After each one cursed Rider for deleting code on the right side of the cursor.

Who does actually want this kind of behavior on a regular basis?

I think it could be a good idea to change the default-settings.

6

Hello Andreas,

Thank you for your feedback. We will probably change this default behavior for newcomers from Visual Studio. We will need to discuss this with the team.

Have a nice day!

1

Glad I found this. It's one of those things that has ALWAYS annoyed me about Rider, but that I never got round to finding a 'fix' for... until today!

1

Hey! Is it just me or making changes to "Choose Lookup Item" or "Choose Lookup Item Replace" doesn't make a difference? I even restarted Rider after and it still made no difference.

1

Hello Matt,

It is strange. Would you mind sharing the additional information as described below?

  • Enable the Editors, Completion, EditorsDumpAllTypingAndActions trace scenarios via Help | Diagnostic Tools | Choose Trace Scenarios;
  • Reproduce the issue;
  • Collect Rider logs via Help | Collect Logs;
  • Disable the trace scenarios enabled;
  • Upload log archive to the Upload service and let me know the upload id;

Thank you in advance and have a nice day!

0

In case someone arrives here through desperate searching to solve the same issue in ReSharper (since R# and Rider have shared codebase), change the behavior in Options-Environment-Completing Characters. Change Tab Key from Replaces to Inserts.

0

This seems to have no effect even after restarting

0
Hello,

Thank you for contacting Rider Support.

Is it possible to share the code snippet where the issue is reproduced?

Thank you in advance!
0

Please sign in to leave a comment.