Skip to content

Typing "n" breaks intellisense #193

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

Closed
Sharpiro opened this issue May 20, 2016 · 15 comments
Closed

Typing "n" breaks intellisense #193

Sharpiro opened this issue May 20, 2016 · 15 comments
Labels
Issue-Bug A bug to squash.
Milestone

Comments

@Sharpiro
Copy link

Sharpiro commented May 20, 2016

Description
When I type "n" on a fresh line, intellisense breaks until application is restarted

Repo

  1. Open VS Code and create a new document
  2. Select "Powershell" from the languages at the bottom right of the window
  3. Type any command not starting with "n" to show that intellisense is working.
  4. Type the letter "n" on a new line
  5. Test to see that intellisense is no longer functioning
  6. Restart VS Code (or close and re-open folder if you have one open) to regain functionality

Ex:

Test-Path
n
test-pat

Notes

  • I updated to the latest version of VS Code yesterday
  • I reinstalled vscode-powershell tools today
  • New user, can't verify if this happened before
@daviwil
Copy link
Contributor

daviwil commented May 20, 2016

Hey @Sharpiro, I just tried this with the latest releases of everything and couldn't reproduce it. Could you send some logs from the language server so that we can diagnose the issue?

You can gather logs by following these instructions:

Open up your VS Code User Settings (File -> Preferences -> User Settings) and insert this line into the file that appears in the pane on the right side:

"powershell.developer.editorServicesLogLevel": "Verbose"

Now restart VS Code and open a PowerShell file and try getting IntelliSense for a variable, then navigate to this path on your hard drive:

c:\Users\<yourusername>\.vscode\extensions\ms-vscode.PowerShell-0.6.1\bin

There should be a file there called EditorServices.log. Could you drag and drop it into your reply to this issue?

@Sharpiro
Copy link
Author

Sharpiro commented May 21, 2016

So i tried reproducing this error on my personal machine and I could not do it either.

This is currently only occuring on my work machine.
Here are the logs for it:

EditorServices.txt

5/21/2016 11:32:57 AM [ERROR] - Method "CurrentDomain_UnhandledException" at line 178 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Host\Program.cs

    System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.ArgumentException: parsing "^\s*notepad++.exe\s+\[" - Nested quantifier +.

I was surprised to see it say anything about notepad++. I ensured that app was closed and still had the same results.

@rkeithhill
Copy link
Contributor

rkeithhill commented May 21, 2016

This is the interesting bit:

    ---> (Inner Exception #0) System.ArgumentException: parsing "^\s*notepad++.exe\s+\[" - Nested quantifier +.
       at System.Text.RegularExpressions.RegexParser.ScanRegex()
       at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)
       at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, TimeSpan matchTimeout, Boolean useCache)
       at System.Text.RegularExpressions.Regex.IsMatch(String input, String pattern)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.CreateCompletionItem(CompletionDetails completionDetails, BufferRange completionRange, Int32 sortIndex)

I'm looking at it. Doh. This one is mine. I should have regex escaped the tooltip text before injecting it into a regex pattern. Well, at least it should be easy to fix.

@Sharpiro
Copy link
Author

any idea why this is happening sporadically, and what I could do for a workaround?

@rkeithhill
Copy link
Contributor

Not yet but I can repro this exception so that should give me some confidence to fix it.

@rkeithhill
Copy link
Contributor

@Sharpiro Do you have notepad++.exe on both machines?

@rkeithhill
Copy link
Contributor

rkeithhill commented May 21, 2016

I'm closing this issue here and tracking it in PSES PowerShell/PowerShellEditorServices#240

@Sharpiro
Copy link
Author

I do have notepad++ on both machines, and the application installs to the machine's path by default I believe.

@rkeithhill
Copy link
Contributor

On the machine that works, if you go to the PowerShell console and type Get-Process -Name Note<tab> does notepad++.exe show up as you tab through the process names?

@Sharpiro
Copy link
Author

yea it does, this auto-populates

Get-Process -Name notepad++
Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id  SI ProcessName
-------  ------    -----      ----- -----   ------     --  -- -----------
    187      17     8016      17772   122     0.39   2604   1 notepad++

My work machine is Win7 while my home machine(the one with no issues) is Win10, both using Powershell 5, though it was manually installed on the Win7 box.

@rkeithhill
Copy link
Contributor

Well I'm stumped for the moment. I was able to repro on my Windows 10 machine running version5.0.10586.122 of PowerShell.

@rkeithhill
Copy link
Contributor

As for a workaround - how often do you use notepad++.exe? :-) The only workaround I know of is to either temporarily remove the notepad++ install dir from the path or rename notepad++.exe to maybe notepadpp.exe until we push out 0.6.2.

@Sharpiro
Copy link
Author

removing it from path worked. I can now type the letter "n" again lol. Thanks.

@rkeithhill
Copy link
Contributor

Sorry, that's kind of a crappy workaround (and my bad for introducing this bug in the first place) but that's all I got until we can push out updated bits.

@daviwil
Copy link
Contributor

daviwil commented May 21, 2016

Since I've got another bug fix ready, I might be able to ship 0.6.2 on Monday.

@daviwil daviwil added this to the 0.6.2 milestone May 21, 2016
@daviwil daviwil added the Issue-Bug A bug to squash. label May 21, 2016
This was referenced Aug 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

No branches or pull requests

3 participants