Skip to content
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

AutoIndent clears autocompletion buffer, 'end' becomes 'def' in Ruby #29210

Closed
iccub opened this issue Jun 21, 2017 · 19 comments
Closed

AutoIndent clears autocompletion buffer, 'end' becomes 'def' in Ruby #29210

iccub opened this issue Jun 21, 2017 · 19 comments
Assignees
Labels
editor-autoindent Editor auto indentation issues suggest IntelliSense, Auto Complete verified Verification succeeded
Milestone

Comments

@iccub
Copy link

iccub commented Jun 21, 2017

  • VSCode Version: Code - Insiders 1.14.0-insider (a49a426, 2017-06-21T05:07:22.267Z)
  • OS Version: Darwin x64 16.6.0
  • Extensions:
Extension Author (truncated) Version
Ruby reb 0.12.1

GIF for better explanation:

out

Steps to Reproduce:

  1. In .rb file, type something to trigger indentation with 'end' keyword(like class or method)

After 'end' keyword is finished, indentation happens and suddenly autocompletion changes from 'end' to 'def' or other suggestion. Then, pressing enter makes 'endef', if you want to leave 'end' you need to press esc, which isn't too ergonomic.
When cursor is on proper indentation though, 'end' autocomplete seem to work just fine
Other keywords like 'else', 'rescue' behave properly

This bug didn't occur in vscode 1.13.1.
Related issue: #2272

@rebornix
Copy link
Member

@iccub did you run into this issue still if you run without any extension? code-insiders --disable-extensions

@rebornix rebornix added the info-needed Issue requires more information from poster label Jun 21, 2017
@iccub
Copy link
Author

iccub commented Jun 22, 2017

Sorry for late reply, I'm in eu timezone

It's the same without extensions too, I reinstalled clean version to be sure

@joelbandi
Copy link

I have the same issue in Version 1.15.1 (1.15.1) as well.
end automatically becomes endef and its really dragging me down 😢

@chrmarti chrmarti removed the insiders label Sep 27, 2017
@iamoni
Copy link

iamoni commented Sep 28, 2017

very annoying little issue. still going on.

@chdezmar
Copy link

Still going on for 1.18.1. Any quick fix?

@jeremykay
Copy link

Would also love to see a fix for this.

@jrieken
Copy link
Member

jrieken commented Dec 11, 2017

Someone: Please provide a code sample and steps that reproduce this

dec-11-2017 09-54-25

@chdezmar
Copy link

endef_vscode
Pressing ENTER after end adds endef instead of new line.

@jrieken
Copy link
Member

jrieken commented Dec 11, 2017

not for me...

@chdezmar
Copy link

I am working on a rails project, is that behavior probably coming from that context?

@jrieken
Copy link
Member

jrieken commented Dec 11, 2017

How would I be able to tell from an animated gif?

@chdezmar
Copy link

just providing more info. My understanding is that autocompletion adds suggestions from keywords coming from the file you are working on. A possible solution could be to disable it for keywords such as end when pressing enter.

@jrieken
Copy link
Member

jrieken commented Dec 11, 2017

just providing more info.

To be honest, you are saying I see this too and you are attaching a similar animated gif. Yes, that's more info but doesn't help me because I still cannot reproduce this. Please follow this guide: https://github.com/Microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions#writing-good-bug-reports-and-feature-requests, esp. the section of reproducible steps and the code snippet.

Please put yourself into my shoes for a second. Folks make me follow nervous gifs and make me type that into the editor (did people forget about copy&paste?!?).

It doesn't repo for me, folks say it reproduces so the truth is that the crucial piece of information is still missing. Unfortunately I don't have time for some exploratory investigation but I do have many other, more precise, issues to work on. So guess what happens? I work on other things.

So, please test this for once with latest insiders, then share your sample (not a gif nor an image, those are just for decoration), then write down precise steps that leave no room for interpretation which I can follow. A good validation is to test those steps on a different workspace, with different files and/or settings because I don't have your workspace (unless you can share it with me). Thanks for helping out.

@whitissolutions
Copy link

I was having the same issue as the others above and I found a fix by installing "vscode-endwise" extension. Which will auto provide an end when one is needed.

@robruder
Copy link

I was having the same issue, and was able to fix it by installing the rcodetools gem.

@pmossman
Copy link

@jrieken I have reproduced this on an out-of-the-box installation of the latest VS Code Insiders (Version 1.21.0-insider)

  1. Create a new file with a .rb extension
  2. Type the word 'enabled' at the top of the file (to give autosuggestion a word to suggest from the file)
  3. Begin typing out your function definition:
def foo
    bar
  1. Hit enter after bar, and your cursor should be on the same indentation level as bar
  2. Begin typing end. Notice that as soon as you type d the word end should unindent to the left.
  3. Autosuggest will now offer enabled, and hitting enter at this point replaces end with enabled.

And now your favorite, a gif

@jrieken jrieken added this to the March 2018 milestone Feb 28, 2018
@jrieken
Copy link
Member

jrieken commented Mar 8, 2018

Autosuggest will now offer enabled, and hitting enter at this point replaces end with enabled.

So, your expectation is that outdenting cancels suggest, right? @rebornix Does the editor emit a special change event or a special cursor change reason for that?

@jrieken jrieken removed the info-needed Issue requires more information from poster label Mar 8, 2018
@pmossman
Copy link

pmossman commented Mar 8, 2018

Yep, I would expect the outdent to cancel any suggestions. This would match Sublime Text's behavior, demonstrated here:

sublime-behavior

@jrieken
Copy link
Member

jrieken commented Mar 9, 2018

Thanks @pmossman. I have pushed a change that cancels a suggest session when the start of the to be completed word shifts left. Fingers crossed that this doesn't break other, yet unknown, usages...

@jrieken jrieken closed this as completed Mar 9, 2018
jrieken added a commit that referenced this issue Mar 9, 2018
joaomoreno pushed a commit that referenced this issue Mar 9, 2018
@RMacfarlane RMacfarlane added the verified Verification succeeded label Mar 30, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-autoindent Editor auto indentation issues suggest IntelliSense, Auto Complete verified Verification succeeded
Projects
None yet
Development

No branches or pull requests