vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

Intellisense on Windows: PowerShell cmdlets is not working

Open markallisongit opened this issue 8 years ago • 24 comments

System Details

  • Operating system name and version: Windows 10 1709
  • VS Code version: Version 1.19.3 x64
  • PowerShell extension version: 1.5.1
  • Output from $PSVersionTable: See below
Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:

code -v
code : The term 'code' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1
+ code -v
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (code:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

$pseditor.EditorServicesVersion
Empty line - nothing was output

code --list-extensions --show-versions
code : The term 'code' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1
+ code --list-extensions --show-versions
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (code:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

$PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.16299.98
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.98
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

Intellisense for PowerShell cmdlets is not working.

Attached Logs

Logs folder is empty! However if I enable developer tools in Help menu, I can see this:

/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:4056 [ms-vscode.PowerShell]Cannot read property 'text' of undefined
e.$onExtensionRuntimeError @ /C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:4056
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:4056 TypeError: Cannot read property 'text' of undefined
	at HelpCompletionFeature.onEvent (C:\Users\mark\.vscode\extensions\ms-vscode.powershell-1.5.1\out\src\features\HelpCompletion.js:34:100)
	at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:87:238)
	at e.$acceptDirtyStateChanged (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:432:782)
	at t.e.invoke (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:516:87)
	at e._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:357:580)
	at e._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:357:270)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:356:206
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:358:204
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:85:988
	at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:87:218)
e.$onExtensionRuntimeError @ /C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:4056
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:4056 [ms-vscode.PowerShell]Cannot read property 'text' of undefined
e.$onExtensionRuntimeError @ /C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:4056
/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:4056 TypeError: Cannot read property 'text' of undefined
	at HelpCompletionFeature.onEvent (C:\Users\mark\.vscode\extensions\ms-vscode.powershell-1.5.1\out\src\features\HelpCompletion.js:34:100)
	at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:87:238)
	at e.$acceptDirtyStateChanged (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:432:782)
	at e.$acceptModelSaved (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:432:565)
	at t.e.invoke (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:516:87)
	at e._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:357:580)
	at e._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:357:270)
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:356:206
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:358:204
	at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:85:988
e.$onExtensionRuntimeError @ /C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:4056

markallisongit avatar Feb 04 '18 13:02 markallisongit

Thanks for the report, @markallisongit! Are you using VSCode Insiders or Stable?

TylerLeonhardt avatar Feb 06 '18 06:02 TylerLeonhardt

@tylerl0706 using stable. I am having the exact same problem on my desktop and my laptop with same Windows versions and vscode versions. I built a new Windows 10 1709 VM and installed code with all my extensions, but didn't see the issue.

markallisongit avatar Feb 06 '18 08:02 markallisongit

Same issue here on Windows 8.1, Visual Studio Code v1.20.1, PS Extension v1.6.0, and another colleagues using Win10. Tab auto-complete on common PS cmdlets doesn't seem to work... for example get-childitem... but any cmdlet really. I found a similar article in 2016 of this being fixed, but it seems to have returned? Any word on an ETA for a fix?

tolarianNZ avatar Mar 05 '18 04:03 tolarianNZ

Very interested to know when this might be fixed. I've got a new laptop and the same issue has appeared there too.

markallisongit avatar Mar 24 '18 11:03 markallisongit

Hoping replies via email work. It was user error for me in the end. Even once you install the PowerShell extension for whatever reason you need to click Reload. When I did this all works really well now. May not be everyone's case but hope this helps.

Best regards,

Ryan Pool

On Sat, 24 Mar. 2018, 10:26 pm Mark Allison, [email protected] wrote:

Very interested to know when this might be fixed. I've got a new laptop and the same issue has appeared there too.

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

tolarianNZ avatar Mar 24 '18 11:03 tolarianNZ

@tolarianNZ no this did not work for me, neither does a reboot nor reinstall of the extension.

markallisongit avatar Mar 24 '18 18:03 markallisongit

Ah I almost forgot, you must also save the script as .ps1 before it can recognise which language to base your code on. Unsaved code won't work.

Best regards,

Ryan Pool

On Sun, 25 Mar. 2018, 5:04 am Mark Allison, [email protected] wrote:

@tolarianNZ https://github.com/tolarianNZ no this did not work for me, neither does a reboot nor reinstall of the extension.

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

tolarianNZ avatar Mar 24 '18 20:03 tolarianNZ

Actually, you don't have to save it as a .ps1 you can just change the language mode to PowerShell and the extension will start.

You can change this by opening up the command pallet (ctrl(or cmd on Mac)+shift+p) and type "language". It should say something like "Change language mode" and then hit enter and find PowerShell.

TylerLeonhardt avatar Mar 24 '18 21:03 TylerLeonhardt

This error:

Cannot read property 'text' of undefined
	at HelpCompletionFeature.onEvent (C:\Users\mark\.vscode\extensions\ms-vscode.powershell-1.5.1\out\src\features\HelpCompletion.js:34:100)

has been fixed and will appear in the next drop 1.6.1. However, there are likely many causes of Intellisense not appearing so YMMV.

rkeithhill avatar Mar 25 '18 06:03 rkeithhill

@rkeithhill I notice that 1.7.0 has been released but this issue was not included. Any ideas on whether it will appear in the next one?

markallisongit avatar Apr 27 '18 12:04 markallisongit

Ah. So you can still reproduce the issue?

Can you set the log level to "diagnostic" and let me know if any logs get generated then? Instructions here if you need them: https://github.com/PowerShell/vscode-powershell#2-capture-verbose-logs-and-send-them-to-us

TylerLeonhardt avatar Apr 27 '18 15:04 TylerLeonhardt

Hi!

I have the same issue, IntelliSense is not at all working, and it hasn't for many months. What it does is auto-completing what I've written before in that script, and nothing else. I've set the log level to verbose as described in https://github.com/PowerShell/vscode-powershell#2-capture-verbose-logs-and-send-them-to-us, but there's no log files in $HOME.vscode\extensions\ms-vscode.PowerShell-\logs.

Today I uninstalled vscode, removed the folder $HOME.vscode, removed all vscode related folders from %appdata% and %programdata%, but nothing works. When will it be fixed, or is it something with my computer? Right now it makes more sense to write powershell scripts in ISE, which is sad.

  • Operating system name and version: Windows 10 1803, build 17133
  • VS Code version: 1.23.1
  • Powershell extension version: 1.7.0
  • Output from $PSVersionTable: See below
Name                           Value
----                           -----
PSVersion                      5.1.17133.1
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17133.1
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Picture 1: It only auto-completes things that I've written before in that script. image

Picture 2: And nothing else. image

Picture 3: The language is set to PowerShell image

nicolaigj avatar May 30 '18 07:05 nicolaigj

@tylerl0706 Yes, I still have the issue and am now using ISE instead but really want to use vscode. The logs folder is empty. I even monitored it with vscode running and nothing got written there. I tried Verbose and Diagnostic levels, and nothing for both.

markallisongit avatar May 30 '18 07:05 markallisongit

@nicolaigj based on your screenshot, it looks like the PowerShell extension is not started.

Can you try opening the command pallet (ctrl+shift+p) and running "PowerShell: Restart Current Session"?

Also, could you switch your log level to Diagnostic? That will give us another log file if PowerShell is failing to start.

TylerLeonhardt avatar May 30 '18 14:05 TylerLeonhardt

@markallisongit if you could also do those steps, that'd be great!

TylerLeonhardt avatar May 30 '18 14:05 TylerLeonhardt

Hi!

Worked with restart current session! I have to do that every time I open code, the fix wont't persist through restarts of code.

Switched to diagnostic, and is started producing logs, please see attached logs.

Start-EditorServices.log vscode-powershell.log EditorServices.log

nicolaigj avatar May 31 '18 11:05 nicolaigj

@tylerl0706 worked for me too!

vscode-markallisongit.zip

markallisongit avatar May 31 '18 12:05 markallisongit

It's a bit strange that you needed to run that. The extension should start when you opened a .ps1 or .psm1 or .psd1.

Sometimes people configure VSCode to not start the extension when you open one of these files and I'm wondering if this is the case.

Could you (@nicolaigj + @markallisongit) share the user settings json with us so I can confirm?

TylerLeonhardt avatar Jun 05 '18 21:06 TylerLeonhardt

I had the same issue and when checking my VSCode settings I had disabled powershell to start automatically:

"powershell.startAutomatically": false

After reverting the change Intellisense started to work.

I disabled it because I didn't want the integrated powershell console to start every time I started code.

imauriciovargas avatar Jun 06 '18 18:06 imauriciovargas

@tylerl0706 I had disabled it for the same reason as @imauriciovargas I don't want the PowerShell Window to show when starting vscode, but I do want intellisense. Is there a way to do that?

markallisongit avatar Jun 07 '18 08:06 markallisongit