-
Notifications
You must be signed in to change notification settings - Fork 286
Feature Request: Automatically add brackets for interpolated strings. #200
Comments
I thought I would comment and provide a visual on how this works in Sublime Text 3, and what I would want to see in |
+1 on this issue. The way Sublime handles this is perfect. |
+1 - atom has this feature as well - missing it in vscode for ruby and js |
+1, coming from sublime, this really is uncommon and I keep removing my variables |
The only missing part I can see here is the ability to know whether we are inside a string or not. Code doesn't expose token info so we may probably need to rely on a parser to get the info. @castwide can solargraph provide token info considering it's using |
@rebornix There might be a trick to it, but it's possible. It can already determine whether a position in the code is inside a string token. With a little more work, it should be able to identify the notation and gracefully handle incomplete brackets. The call to check the token would have to be asynchronous; I don't know if that's a problem or not. |
Right now there is no such thing that you type something and Code autocompletes immediately, Code always shows the auto complete dropdown list. So for this feature, an ideal solution is
As |
@castwide we have a dozen auto complete related issues https://github.com/rubyide/vscode-ruby/issues?q=is%3Aopen+is%3Aissue+label%3Aautocomplete here, would like to see how they go in your extension. |
I imagined this feature would work like auto closing bracket pairs. Adding I'll go through those other issues and see which ones can be resolved by Solargraph. It looks like some of them already are. |
I'm in the process of adding LSP support to the Solargraph gem. It should be able to handle this feature using the protocol's textDocument/onTypeFormatting message. In my tests, it's able to 1) detect when it's inside a string and close an interpolation's bracket; and 2) detect when it's inside the interpolation and provide completion items. |
Closing for issue cleanup. Apologies if this is still an issue. We are working to improve the core extension experience. |
Is this issue tracked anywhere else, if it's closed here? It's still needed. |
This would fall under formatting in #317 |
Hi, I created a solution specifically for this issue. Feel free to try it out. https://marketplace.visualstudio.com/items?itemName=aliariff.auto-add-brackets |
Auto add brackets is out of date? |
@aliariff extension is working like a charm! |
Your environment
vscode-ruby
version: 0.14.0Expected behavior
Typing
#
should automatically expand to#{}
with the cursor in between the braces when you are between double quotes.Actual behavior
Typing
#
does not add any additional characters.Steps to reproduce the problem
#
The text was updated successfully, but these errors were encountered: