PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.7k stars 490 forks source link

Dynamic Comment Snippet not triggered if backspace is used. #962

Open gerane opened 7 years ago

gerane commented 7 years ago

System Details

Copy / paste the below commands into the PowerShell Integrated Terminal, and paste the output here

code -v
1.12.2
19222cdc84ce72202478ba1cec5cb557b71163de

$pseditor.EditorServicesVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
1      4      1      0       

code --list-extensions --show-versions

$PSVersionTable

Name                           Value                                                                                                                                                          
----                           -----                                                                                                                                                          
PSVersion                      5.1.14393.1066                                                                                                                                                 
PSEdition                      Desktop                                                                                                                                                        
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                        
BuildVersion                   10.0.14393.1066                                                                                                                                                
CLRVersion                     4.0.30319.42000                                                                                                                                                
WSManStackVersion              3.0                                                                                                                                                            
PSRemotingProtocolVersion      2.3                                                                                                                                                            
SerializationVersion           1.1.0.1                                                                                                                                                        

Issue Description

When trying to trigger the Dynamic Comment Help snippet, if you typo and have to use backspace when typing "##", it won't trigger the Snippet.

Attached Logs

kapilmb commented 7 years ago

What is the sequence of the key-strokes that is causing this?

gerane commented 7 years ago

One I know I've done would be

, $, backspace,

On Jul 18, 2017 6:39 PM, "Kapil Borle" notifications@github.com wrote:

What is the sequence of the key-strokes that is causing this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PowerShell/vscode-powershell/issues/962#issuecomment-316228746, or mute the thread https://github.com/notifications/unsubscribe-auth/AGWoQK8RrHGGKeJg8PmgaTa3gEYJbc84ks5sPUIsgaJpZM4OaFCo .

kapilmb commented 7 years ago

With the given keystrokes, this is expected. The help is triggered only if the keystrokes are ~<,# or~ #,#. Anything else will not trigger help completion. In your case the editor sees "backspace,#" and hence it doesn't trigger the completion.

daviwil commented 7 years ago

Maybe we should support the case where the user backspaces and continues typing the character sequence? Would that increase the complexity a lot?

kapilmb commented 7 years ago

It will probably not increase the complexity a lot if we need to make it a 3-state machine instead of the current 2-state machine. But, I think the added complexity would still be unwarranted. A simple workaround for the current issue would be to press backspace twice and then retype the magic sequence again.

gerane commented 7 years ago

@kapilmb My one issue with this is that a user won't know they need to do this. It might just seem unreliable and get less adoption. It took me some testing to actually pinpoint that the issue was the backspace. If I hadn't investigated with the intention to file a bug, then I might not have realized it was caused by the backspace.

JustinGrote commented 4 years ago

@SydneyhSmith @TylerLeonhardt Seems to be fixed with latest version and can probably be closed.

Reproduction of: https://github.com/PowerShell/vscode-powershell/issues/962#issuecomment-316250384 Capture

SydneyhSmith commented 4 years ago

Thanks @JustinGrote, after a second look it seems that the initial issue was about the dynamic help generation function (##), which we can still re-pro so I am going to leave it open...thanks again for all your help!

TylerLeonhardt commented 4 years ago

Yeah this feature use to also trigger on <# but we got rid of it because of the conflicting VS Code snippet (<##>)