aliariff / vscode-auto-add-brackets

Automatically add complete brackets when writing interpolated string
https://marketplace.visualstudio.com/items?itemName=aliariff.auto-add-brackets
MIT License
10 stars 4 forks source link

Auto-insert in Ruby mode not working for me #9

Closed ijdickinson closed 4 years ago

ijdickinson commented 5 years ago

I have version 0.9.0 of the plugin running in VsCode 1.33.1. Auto-insertion triggered by $ in JavaScript mode is working fine, but in Ruby mode I can type # inside a double-quoted string and nothing happens.

aliariff commented 5 years ago

Do you see any error message in the console log?

Open console log via Help -> Toggle Developer Tools

ijdickinson commented 5 years ago

Yes, there was an error that was essentially this issue: https://github.com/rubyide/vscode-ruby/issues/358

Despite some attempts, I have been unable to get rubyLocate to work. So, following the advice from that ticket, I have now switched to Solargraph. As far as I can tell, SolarGraph and auto-add-brackets extensions are working correctly:

[Extension Host] debugger listening on port 2316
/snap/code/6/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:4342 
Overwriting grammar scope name to file mapping for scope source.ruby.
Old grammar file: 
file:///snap/code/6/usr/share/code/resources/app/extensions/ruby/syntaxes/ruby.tmLanguage.json.
New grammar file: 
file:///home/ian/.vscode/extensions/rebornix.ruby-0.22.3/syntaxes/ruby.cson.json
register @ /snap/code/6/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:4342
/snap/code/6/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:235 

[Extension Host] "auto-add-brackets" extension is now active!
/snap/code/6/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:235 
[Extension Host] Solargraph is listening PORT=32999 PID=25902
/snap/code/6/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:235 
[Extension Host] [ANY] Solargraph initialized (1.0264513199945213 seconds)

Unfortunately, still no auto-complete on # in Ruby-mode

aliariff commented 5 years ago

I am not really sure what is the problem here because there is no any error or anything that shown in console log. But you can try following step to try debug what is the reason, I have some feeling that the extension is have conflict with other extension so try to disable all of the extensions you have and let auto-add-bracket be the only extension running and see what happen.

If it is still does not work, it might be because of the file extension problem, maybe the extension failed to active due to undetected file extension which is should be .rb, but this one is unlikely to happen, but could be the reason like what happen with .erb file when VSCode detect it as html file so the extension can not work, because thinking that you are working with html file now, not erb file.

dwarfi09 commented 5 years ago

Does not work here in ruby- or erb-mode, too (Version 0.9.0, VS-code 1.37.0). I disabled all other packages - it still does not work. Console tells me auto-add-brackets" extension is now active!.

jclusso commented 5 years ago

I started getting this error command 'auto.addInterpolation' not found

aliariff commented 5 years ago

Hi everyone, I just update the dependency package, so make sure to upgrade to the latest version, hopefully, it's solved your problem.

sebweaver commented 4 years ago

Hello,

Same issue with version 0.10.0.

I have the auto-add-brackets" extension is now active! in the log (no error) but nothing happens when I press # in a double-quoted string.

aliariff commented 4 years ago

Hi @sebweaver

Could you create a video for that?

sebweaver commented 4 years ago

@aliariff sure, here it is: https://uptobox.com/ixulffdw823c

My config:

Version: 1.39.2
Commit: 6ab598523be7a800d7f3eb4d92d7ab9a66069390
Date: 2019-10-15T15:33:40.634Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Linux x64 4.4.0-166-generic

As you can see on the video, this is the only extension enabled and there is no error in the debug console.

aliariff commented 4 years ago

Hi @sebweaver

Thanks for giving me more information. Do you use shift+3 to show #?

sebweaver commented 4 years ago

@aliariff Bingo, I forgot to precise that I use a french keyboard...

So your message made me think to check the current beybindings and I found that auto.addInterpolation is actually bound to Shit+" which matchs Shift+3 on a US keyboard.

But here are the issues with that:

  1. It's not the native binding to get the # on a french keyboard which is AltGr+"
  2. it prevents me from typing 3 in a interpolated ruby string, unless using the numeric keypad

Admitting the 2nd point is no big deal, the 1st one still remains an issue.

So I tried to define a AltGr+" but without success, because... you just simply can't with VSCode... :disappointed:

So I think I'll go with Ctrl+Alt+"... Not very convenient, but I can live with that.

Thanks for you support and I'll hope this feedback could help someone else.

ijdickinson commented 4 years ago

Thanks @sebweaver for the clue that the root cause is with the keyboard layout. I'm using a UK keyboard, and character inserted by shift-3 is actually the £ character (British pound). On my keyboard, the key that inserts # is on the same row as j-k-l.

In order to get the key that inserts the # character into my code to trigger auto-insert, I:

@aliariff I'm going to close this issue as it's not a bug in auto-insert per se, but it might be worth updating the docs to make it clear that users with non-USA keyboard layouts may need to make this change.

aliariff commented 4 years ago

@ijdickinson

Ok good to know that it is also solved your problem. I will update the doc regarding the different keyboard layout.

alexanderadam commented 3 years ago

I started getting this error command 'auto.addInterpolation' not found

I'm getting the exact same error on US layout and Shift + 3 is the actual #. I tried setting the shortcuts again but the issue persists.

Do you have any advice?