-
Notifications
You must be signed in to change notification settings - Fork 510
CodeLens blocking execution of code and also auto formatting i.e. F8/Format Document not working #1326
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
The most helpful logs are under your |
@rkeithhill are you okay if I use the Insiders version ? or would you prefer if I provide logs from the standard version? |
Either would be fine. But in the case of Insiders the dir will be under |
Thanks @rkeithhill I restarted the current session to start a fresh set of logs. I have a nice clean repro. . . The steps I took were:
I hope this is helpful for the timings when you look into the EditorServices.log that is attached. |
By the way here is the full output from the session, it appears that I pressed F8 Five times, based on the returned output. The four initial and the one half way down.
|
gc $Home\Desktop\1526767589-74dc5124-5067-4b8d-8a55-af9f05b1bd761526761220289\EditorServices.log | sls 'Attempting to execute command' -Context 2,2 2018-05-19 16:06:35 Attempting to execute command(s):
2018-05-19 16:06:35 Attempting to execute command(s):
2018-05-19 16:06:36 Attempting to execute command(s):
2018-05-19 16:06:36 Attempting to execute command(s):
2018-05-19 16:10:40 Attempting to execute command(s):
2018-05-19 16:10:40 Attempting to execute command(s):
2018-05-19 16:10:40 Attempting to execute command(s):
2018-05-19 16:10:40 ttempting to execute command(s):
2018-05-19 16:14:56 Attempting to execute command(s):
|
Let me know if I repro with get-date would be more helpful? |
Also these are my profile settings for the autoformat
I attached another repro with just F8 on get-date
|
Just out of curiosity, if you disable the formatOnType, does the issue still happen? |
Hey @tylerl0706 yes tried that.. Still the same, just nothing gets logged, because the format isn't triggered, however the delay is still there. Whatever is blocking stops the formatting as well as the execution. Once that block has completed, both occur/run straight away. |
@tylerl0706 yeah, we need threadsafe logging:
|
Oh wow. Well @rjmholt is actively working on this! 😃 |
@brwilkinson Dang. I can't repro this on my Win 10 PC using PS 6.1 preview 2. What happens if you create a new, empty Also what do these two commands return: |
@rkeithhill perhaps try writing and loading a small function?! I can repro with the following: new blank script: D:\OneDrive\Foo.ps1 (BTW I also tested outside of onedrive path, this issue still occurs). get-date (F8 works) gps (F8 works) gmo | foreach Name (F8 works)
(Get-Runspace -id 4).CreatePipeline("Get-Module PSScriptAnalyzer").Invoke() (F8 works)
Type in a function foo (breaks, does not execute on F8)
still waiting . . . (still broken) Original load of the function still waiting + 5 minute later made a test change to the file, just pressed enter to make / delete a line, nothing logged, since I have all auto formatting disabled. Still waiting .. . . +7 minutes. finally loads the function,
date is returned, not blocked right now. Sunday, May 20, 2018 12:40:20 PM This is the full output from the terminal
|
You can try disabling code analysis by appending this to your workspace or user settings file:
|
I tried disabling scriptanalysis, I restarted VSCode and it does appear to actually be disabled however that did not make any difference. Let me know if there are any other settings that I can change?! Are the codeFormatting rules also disabled when scriptanalysis is turned off? Otherwise I can disable all of those rules? |
It looks like code formatting is controlled separately from the |
I think I have more of an idea where the issue stems. Here are the repro steps.
they are all good. as soon as I put the function keyword the extra line space is created to insert the setting shown below (0 references). However the line is blank while the process that is causing the delay is running. So I just see the blank line (between line 10 and 11) eventually I see . . the 0 references then F8 on gps works fine. If I switch out tabs then come back, no blank line by function, then it starts the search again. I am blocked while that process runs. If that process starts on one script/tab, I am also blocked on other scripts/tabs while it runs. |
@rkeithhill Thanks for your assistance in finding this I have been searching and trying so many things every day for several weeks (even months, perhaps a year) and now that I see it, it's so clear. |
Okay I looked through many other open issues and see similar things . . I disabled codeLens: The issue seems much better . . . For now I would say codeLens is the likely root cause of this issue. |
@rkeithhill @tylerl0706 @rjmholt Let me know if you are able to repro on the CodeLens issue, with some function in a ps script and the delay in resolving the references lookup?! |
This is likely related to some other perf issues we are currently fighting. @rjmholt has been addressing the thread-safe logging, I've been working on canceling requests that take too long. we'll follow up when we have something to share here 👍 |
Did this ever get resolved, since I still have this exact same issue with daily use of the extension? It's really frustrating restarting the extension every 5 minutes. . in order to use it? It's impossible to actually write any code? |
Linking to this more recent issue #1769 |
Going to close this as a result of the major architectural changes we made in the omnisharp port....please let us know if this is not fixed in the PowerShell Preview Extension |
As of 9/28/2020 I'm having this issue, running the latest VScode version. My frustration led me to this post. |
I tried disabling CodeLens, issue still came back. |
@tropez1971 are you able to confirm the version of vscode that you are using? |
1.49.2 I also just swapped out my PowerShell Extension (v2020.6.0) for the PowerShell Preview Extension (v2020.9.0) and the issue still persists. |
And to be clear, here is the issue I'm running into, which seems to be the same as the OP. I open VSCode, then I open various .ps1 files for work. If I highlight code in one of my open .ps1 files, then right-click on it and execute just that code (aka F8), the first few times I do it after a fresh restart it seems to work. Then all of a sudden it stops working, code doesn't execute. If I copy that same code to the clipboard, then paste it into the terminal window at the bottom, it executes fine, and immediately. If I wait a short bit, varying time, eventually I see the code from my F8 press earlier show up and attempt to execute but it's delayed by minutes before it actually makes its way to the terminal. So right now I'm just copying the code I want to run, and pasting it into the terminal window at the bottom which is a pain in the butt, but at least it prevents random script sections from running at a later time when I don't want them to because I pressed f8 on some code 5 minutes earlier. |
Thanks @tropez1971 sounds like a slightly different issue, however it is one that we are working on with PowerShell/PowerShellEditorServices#1295 |
System Details
Issue Description
When I press F8, nothing happens, I only see output after 30 seconds up to 3 minutes.
The Integrated console just shows the last of the debug output
#-- Waiting for EditorServicesHost to complete execution ---------------------
However if I actually change the ps1 file that is open I see in the powershell extension log , that things are happening.
E.g. formatting and it also shows the language service is connected.
5/19/2018 2:32:24 PM [NORMAL] - Connecting to language service on port 13493...
5/19/2018 2:32:24 PM [NORMAL] - Language service connected.
5/19/2018 2:35:17 PM [VERBOSE] - Formatting on type at position {"line":35,"character":0} -
However the logs in the integrated console/terminal shows the same thing as the logs that I have attached.
#-- Waiting for EditorServicesHost to complete execution ---------------------
The F8 is non responsive. . . the commands are being queued somewhere however since after around ~2 minutes I will see the output.
E.g.
if I have this in the ps1 file, then I press F8 twice, nothing happens, then around 2 minutes later I see the output
I can type in the terminal the whole time.
e.g. typing in the terminal/console
However if I am pressing F8 on the ps1 script, nothing happens again. . . for about 2 minutes. . . then the result returns again.
I have this experience 100% of the time with both ps 6 and ps 5.1.
Sometimes I can write code for up to 15 minutes without this occurring. . . Mostly the Integrated Console is just unusable.
This is not a new issue, it has always been like this. Also I do screen shares with customers that I work with daily and I see the exact same issues with all of them. There are also references to this issue in pretty much Every Video from the PowerShell Conferences in both US and EU that have been published.
If you have a Windows 10 machine try it for yourself, it's easy to repro.
Between VSCode.exe --> winpty-agent.exe --> conhost.exe --> pwsh.exe --> The PowerShell extension --> PowerShell EditorServices I am not really sure where to look.
For the past two weeks I have been trying anything I can think off to work out what is causing the issue. . . including migrating my workflow to use pscore 6.0 and also using the Insider version, plus removing all extensions.
The main reason I am reporting is now is because, I actually decided to turn off the debug logging, incase it was part of the problem. . . so I switched it off. . .
Then for the first time ever, when I actually switched it on again, I actually started to see the diagnostics logs, that I had actually never seen before 😊
So I hope with these I can actually determine what is causing this long term issue.
Although for some reason the logs only seem to show the startup ? the last thing I see is:
#-- Waiting for EditorServicesHost to complete execution ---------------------
I have tried both
and
"terminal.integrated.rendererType": "dom",
these do not make any difference.
My extension are set to auto update, I deleted any extensions that I don't actually use everyday.
I have worked in both VSCode and the VSCode Insiders and this is the same issue on both.
Logs attached, they actually just show extactly what I now see in the console which is up to the following line and then nothing after ?
#-- Waiting for EditorServicesHost to complete execution ---------------------
I am not sure if that is normal of if the editorservices have hung ? The formatting seems to be working so I don't think they have hung, there is just nothing extra in the logs.
One other thing however if I do select a single line of code and then choose Format Selection, then all I see in the status bar is "Formatting PowerShell document …." which also lasts about 2 minutes.
So now if I . . .
Press F8 on a line of code 5 times . . . I wait. . .
While I am waiting if I do a format selection I see the "Formatting PowerShell document …." . . I wait.
After a few minutes, the two both complete at the same time, which I guess is expected.
Sometimes (like right now) the format and the F8 work fine/ as I would expect, however the good times only last around another 3 minutes, it starts again then go back to 1) . . . same issue again. I just waited two minutes and it's locked again, I just don't see any new logs anywhere ? only those startup logs ? which I have attached.
If I restart the current session, I see the new editor services startup. . . I see the integrated console has finished loading, I press F8 on the line of code, nothing. it's just the same, I wait. then eventually the command writes out.
One more detail, if I am on the Output "PowerShell extension Log" and I press F8 on the script, it flips be back to the Integrated console/terminal, however there is no output . . . until a minute later, then the results from pressing the F8 returns.
Are there any logs for EditorServices other than what appear to be startup logs?
happy to video screen capture of this or do a screen share. . .
The text was updated successfully, but these errors were encountered: