Vscode-ruby: Typing `do` and pressing enter should automatically insert `end`

Created on 6 Oct 2017  ·  8Comments  ·  Source: rubyide/vscode-ruby

Your environment

  • vscode-ruby version: 0.15.0
  • Ruby version: 2.4.1
  • VS Code version: 1.16.1
  • Operating System: MacOS 10.12.6

Steps to reproduce the problem

Create a block by typing a statement that ends with do and press enter.

Expected behavior

The newline is given one additional level of indentation. Another line that just has theend keyword is automatically inserted on a line below the cursor.

Actual behavior

The line with end is not automatically inserted, so I am forced to tediously type this in. The new line is indented, however.

Please PR this into this extension. This really keeps me from being able to use VSCode as an IDE for my Ruby code. This is a feature that's available in other modern IDEs for Ruby, such as RubyMine and Atom.

Notes

I wonder if there are elements of this issue related to #210.

feature-request

Most helpful comment

It'd be nice if this functionality was included in this extension, but in the meantime you can use: https://github.com/kaiwood/vscode-endwise

All 8 comments

It'd be nice if this functionality was included in this extension, but in the meantime you can use: https://github.com/kaiwood/vscode-endwise

@papa-whisky thanks for that suggestion, I'm going to install that one right now.

I wonder if it is worth making a PR to add a note about this _temporary_ workaround until this is added to vscode-ruby.

Also, as in Atom, dop or some alternative should create a block with block parameter.

Sorry for replying this issue so late. @ecbrodie it's a nice feature to have in vscode-ruby, so PR welcome!

@aoozdemir I suppose what you described is code snippet, which you can add to your personal snippet file in VSCode. We can probably port https://github.com/atom/language-ruby/blob/master/snippets/language-ruby.cson to vscode as well.

I rarely use VSCode anymore, so I have little incentive to submit a PR
unless that situation changes. I do highly encourage this package's core
contributors to take on implementing this, though. The do...end blocks are
quite a core and frequently used language feature of Ruby, so lacking this
functionality will severely hinder this package's adoption rate.

On Jan 31, 2018 22:30, "Peng Lyu" notifications@github.com wrote:

Sorry for replying this issue so late. @ecbrodie
https://github.com/ecbrodie it's a nice feature to have in vscode-ruby,
so PR welcome!

@aoozdemir https://github.com/aoozdemir I suppose what you described is
code snippet, which you can add to your personal snippet file in VSCode.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/rubyide/vscode-ruby/issues/213#issuecomment-362147804,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABwluMrJszeAlA3jaa9mIsYdlPnDx5A_ks5tQS_VgaJpZM4Pw7H2
.

@rebornix If wanted, I can prepare a PR and port the functionality over to this extension (Wasn‘t aware there is an open issue here, this one was opened shortly after our last conversation).

But I need to find the cause of a performance bug first, after the last update of this extension I started noticing a slowdown when pressing enter and now received an issue from another user (https://github.com/kaiwood/vscode-endwise/issues/7) - disabling this one solves it, but is not really a viable solution :)

Anyways, question: Should this feature have a setting to disable it? Enabled or disabled by default?

@rebornix I can't believe I've missed that idea. Thank you 👍

Closing for issue cleanup. Apologies if this is still an issue. We are working to improve the core extension experience.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pelletencate picture pelletencate  ·  5Comments

chrisnicola picture chrisnicola  ·  5Comments

wingrunr21 picture wingrunr21  ·  4Comments

webmastak picture webmastak  ·  4Comments

rebornix picture rebornix  ·  3Comments