-
Notifications
You must be signed in to change notification settings - Fork 511
IntelliSense fails occasionally - again #2745
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
Comments
I found an instance in the logs of a completion request taking 35seconds (for future self, open the log file in vscode and do a regex search:
But I'm not sure if it was stuck in PowerShell or not. Either way, I think completion should be a cancellable action... I'm hoping PowerShell itself will handle it gracefully... so I think we should dupe this to PowerShell/PowerShellEditorServices#1295 because I want a requirement if that work to support cancellation. Let me discuss this in Triage tomorrow before I mark it. |
Or |
I can confirm that 2020.6.0 is better, but still falls over regularly. The extension logs show requests for completions just hanging until I give up after 20+ seconds (at which point they are "cancelled", which I believe is a lie in the current implementation). This is different than the behavior seen in earlier versions in that the extension itself isn't quite toast (in those cases I'd just see the log basically stop updating), but the user experience is still similar. I still have to kill the extension all the time to get it back into a working state. I'll try to collect some useful logs later today. |
Here's an interesting snippet from a couple minutes ago:
My log is pretty rotten with sequences like that. Also a fair number of these exceptions about entering nested pipelines. |
Thanks for looking into that @mattpwhite! Looks like further motivation for PowerShell/PowerShellEditorServices#1295 |
1596305359-91a018eb-cd5f-4159-a261-8ba50c0e8b2f1596305357826.zip Another log. Basically after first cancelled event everything goes to hell. It can go to hell as quick as 5-20 minutes in. |
The last years I have always moved to the ISE when writing more then 5 lines of code in PowerShell as IntelliSense is still not reliable at all. This week I am developing for Universal Dashboard and tried with VSCode as there is a plugin for UD. It is extremely painful. If the script gets a bit bigger, IntelliSense does not work at all. Closing the terminal does not solve the issue. It feels like in the old VBS times. Another area is DSC. When writing configurations or interacting with DSC cmdlets, IntelliSense dies. What data would help working on this? |
We recently published an update to our preview extension which has addressed a number of issues, would you mind giving it a try and letting us know if you are still hitting this? |
@raandree when you reference the script getting bigger, what size of script are you roughly seeing? |
@SydneyhSmith, right after commenting on this issue I got the notification about the new version of the PowerShell Preview extension. It feels much better! One issue is still there. IntelliSense works in the terminal but not in the code editor. I have created a screen recording of the behavior: https://1drv.ms/v/s!AuCqmYWYQ_kMnohF-j93qXWJsmtBXA?e=SLid98 |
Thanks @raandree for the screengrab that is super helpful! Noticed the red squigglies when you are expecting the completions---this may be due to the placement of the the cmd not being valid so we wouldnt expect completions to work there...what is the squiggly you are getting? |
I just want to add that for me, my problems happen on minutes/hourly basis. It's not occasional anymore. It may be related to my other issue #2908 but generally, it's pretty bad. I either stop using IntelliSense and try to pick things from memory or I restart session all the time. I can only imagine how it works for other people that never report issues thinking code just sucks. |
@SydneyhSmith I'm still experiencing this issue pretty regularly. Do you need extra logs to analyse the issue or what's the reason the Needs: Attention flag was removed? If there's a way I can help get to the root of this issue, I'd be more than willing to help. |
But the new Preview version is much younger than several months. Are you sure it's a new preview and could you retest with the current preview just to make sure? |
There are extended logs but they may not cover just simple completion services, especially just "hangs". You may want to try making a "fresh" portable vscode installation so you don't have to affect your existing setup, just download the zip of vscode and add a "data" folder to the extract. |
Yeah that'll cause some issues for sure. Try adding this to your "[powershell]": {
"editor.codeLens": false,
}, |
This seems to help, but to be sure I will test it for a longer period. Thanks anyway! |
@andschwa just a thought, we might want to look at using some heuristics to turn that off automatically in some workspaces. Ideally with an option to force it on always. As much as I'd like to guide folks to smaller workspaces, an very high number of folks just want to open up all their stuff at the same time. To the point where if someone is talking about issues with intellisense on discord, half the time I open with "how big is the workspace" and the answer is often "all of the stuff". |
(from my point of view) would be better to allow define folders that should
be searched. Or some sort of customizable solution.
Because it is very user friendly to have all your organization code at one
place and be able to search it at once etc.
Thanks in advance
Sebela
|
@ztrhgf FYI that sparse checkout is also a thing: |
sorry I don't understand what you mean by that |
@ztrhgf you can check out only a portion of a git repository (say an individual folder) without checking out the whole thing, similarly you could also "open folder" in vscode on that particular folder to cut down on the amount of files Powershell has to process. That is just a workaround in the meantime, of course it's a viable ask but it may take some time to implement. |
I see. Unfortunately, it is of no use for us because we have a custom CICD solution that requires all data to be locally available. But thanks for the tip anyway! I will test this further, but so far it seems that setting
when combined with the Preview version of the PowerShell extension helped a lot. It is definitely not perfect but is usable. |
Related featured request would make this configurable and probably help: #3884 |
@PrzemyslawKlys should we close this issue or are you still seeing the same thing? |
@andschwa We can close it because in my cases I believe it's related to [Types] stopping working and I believe @SeeminglyScience once explained it's a problem on PS 5.1. So I just try to use PS 7 most of the time. I am not sure whether you want that one as part of "issues", something that would be considered for a fix in a workaround in VSCode extension? Also I've also mentioned my problems here: #2745 (comment) but those are edge cases and I guess it would be again workaround in VSCode extension rather than anything else. Do you want them as issue/issues or should we just assume those are non-fixable and we should stop wasting time on that? |
@PrzemyslawKlys I'm looking at the screenshots in your linked comment...for the first example: function Set-Test {
[cmdletBinding()]
param(
[string] $Test,
[UnknownType] $Test1
)
}
Set-Test - If I understand correctly you're expecting at least For the second example with For the third example...I have no idea why that isn't working. I went to test it and expected it to work in the preview. Ok can you please file a separate issue about "Parameter hints are broken"? I was looking at them a little bit while improving the symbols, and realized they are very oddly implemented (for instance, we only look at parameter sets, which leads to weird suggestions) and clearly there's an issue where it's not getting any parameters for a function defined elsewhere in the workspace. It should, and I don't like that it's not! |
The idea around the first example is that I sometimes develop something without a library. For instance working on Exchange 2010/2013 script where you need to connect to Exchange to get cmdlets available, and that means if you don't have them connected/at hand, developing for it will be a nightmare. So it's not about UnknownType, it's about type that developer is not having at the moment. Sure PSScriptAnalyzer could help in detecting typos in "types" (is there such a rule?), but it's not about thatin that case. I guess with Github CoPilot things are a bit easier ... so maybe the effort is not worth it. The 2nd and 3rd examples are basically the same thing - the functions are stored in separate files, often in a Private folder. If you try to call them up outside of those files they will not work (in both cases). If you call them up at least once they will be in the session and work, but any changes to them won't be reflected. I would say this is how PowerShell works in VSCode now and there's no difference between my 2nd and 3rd example. So unless you're willing to Prescan all folders somehow and provide parameters hints even for private functions (after all you're not reading PSD1/PSM1 to deliver information) it won't work. My projects are always done the same way Private, Public folders, one function per file, and then all that is loaded up thru PSM1 and PSD1. In PSM1 during development, I have So, in my opinion, the current implementation "works as expected", according to the rules of PowerShell (where files are their own boundaries), but what would be cool from sysadmin/dev perspective that spends lots of time writing modules is the ability to "switch" between standard behavior and developer behavior somehow. Where by Developer behavior I mean working cross-files (within single workspace) regardless if those are loaded to specific session or not. After all you already have References up and running so extension is aware of functions existence. This would be helpful for developers to get a bit of that "C#" magic that they get. I understand this may not be your target audience to help those very few "devs" like me, who like to separate every function into their own existence. So I don't believe opening an issue "Parameter hints are broken" makes sense unless you're thinking @andschwa on going the extra mile on this because I believe those are as "expected" regardless of my feelings :-) |
Ok fair! One day it would be nice to go that extra mile, because honestly I agree with you. As a developer, I'd expect these to just work. But at least know why they aren't and it's "expected." Thanks! |
@PrzemyslawKlys as a non-optimal workaround, I have an alias in my profile that basically dot sources everything in my project, and if you do that you will get the intellisense. |
@JustinGrote I mostly switch to modifying PSD1 to * and just rerunning module and it works, or just take a bullet. I have plans to learn on how to create VSCode extensions and just create some GUI for actions I do frequently such as Importing module, maybe "live" edit PSD1 and rerun, things like that. Something that will make my development a bit less painful in some situations. I don't know yet when I will be able to do it - but I have been thinking on it for a while. Dot sourcing for hybrid modules is usually not enough. |
Issue Description
I am experiencing a problem with... IntelliSense failing.
1591449835-872343d1-59b3-436d-a112-c71c820037db1591449833798.zip
I feel a bit stupid filling this again but again got this issue. I am not sure if it's:
Or it's more about this:
But I still see hiccups that never recover. I deleted a lot of offending PowerShell modules, but since I have no clue about reasons it never recovering it's hard to say.
If you tell me what to look for, check I'm happy to do my own investigations.
Attached Logs
Follow the instructions in the README about
capturing and sending logs.
Environment Information
Visual Studio Code
PowerShell Information
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
The text was updated successfully, but these errors were encountered: