-
Notifications
You must be signed in to change notification settings - Fork 223
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
Add-Type -AssemblyName not taken into account by the completion #637
Comments
So the intellisense provided by PSES is powered by the same API that powers tab completion in the PowerShell engine. For a lot of things, that API relies on session state. Until the engine can provide purely static completion for things like this the only way is to alter the session state of the runspace PSES is running in. Ideally this would be done via an integrated console, but the easiest way to provide a way to do this for new implementations is to implement the equivalent of VSCode's F8 or Here's some relevant bits from VSCode: PowerShell.RunSelection definition And from PSES HandleEvaluateRequest definition As a sort of work around, you can also add bits of code for completion to your profile. Make sure to edit the one for the editor host ( |
Okay the workaround with "settings": {
"powershell": {
"enableProfileLoading": true,
}
} Anyway I think there might be at least some basic support for |
Unfortunately there isn't, there's been discussions on how to implement it (mostly around When in doubt, you can check by loading up PowerShell with no profile and running something like this $script = '
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.'
TabExpansion2 -inputScript $script -cursorColumn $script.Length If that doesn't give you the completion you expect, PSES won't either. Because of the dynamic nature of PowerShell, a lot of completion is based on what's loaded in the runspace. There's a bunch of completion improvements in core, but it's still kind of hard to get great intellisense without a way to invoke scripts in the runspace directly. |
Yeah @rjmholt, @joeyaiello and I were talking about this the other day. Same thing goes for We want folks to use A plan isn't shelled out just yet, but expect more in this space in the near future. |
Yeah, the problem with getting completions on We've been discussing this a bit in relation to the VS Code extension and for PSSA, and I think we're hoping to implement some support for
To be clear, the way PowerShell works (depending on the module path, etc.), even |
In the meantime, if Sublime supports F8 style execution, try executing the Add-Type line(s). That works in VSCode. |
Might need to do some work on a Sublime extension to get F8 to work. Here's what we do in VSCode: We have F8 bound to this command: which sends the |
Is this still the recommendation for this issue? I'm working on setting up PSES as the LSP for Neovim, and this issue is the only relevant search result I've found. It's a pretty old issue so I want to make sure I'm following best practices when setting up PSES. |
I tried to look for the solution in existing tickets, but found no ticket mentioning
Add-Type
support.I am using now PSES in Sublime Text with PR and recipe at: #629 (comment) and I found that it is not completing .NET types loaded by
Add-Type
e.g.:completes only to types present in
System.IO.Compression
but notSystem.IO.Compression.FileSystem
, likeZipFile
.Also trying to complete
[System.IO.Compression.ZipFile]::
returns nothing. I tried adding explicit path, no effect.Do I need to explicitly specify additional modules somewhere when starting PSES or it should pick up the
Add-Type
from my script?The text was updated successfully, but these errors were encountered: