Skip to content
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

Formatting PowerShell document during execution? #1562

Closed
PrzemyslawKlys opened this issue Oct 6, 2018 · 20 comments
Closed

Formatting PowerShell document during execution? #1562

PrzemyslawKlys opened this issue Oct 6, 2018 · 20 comments

Comments

@PrzemyslawKlys
Copy link
Contributor

System Details

System Details Output

### VSCode version: 1.27.2 f46c4c469d6e6d8c46f268d1553c5dc4b475840f x64

### VSCode extensions:
[createInstance] extensionManagementService depends on downloadService which is NOT registered.
aaron-bond.better-comments@2.0.1
abusaidm.html-snippets@0.2.1
AlanWalk.markdown-toc@1.5.6
alefragnani.Bookmarks@9.1.0
azemoh.one-monokai@0.3.7
ban.spellright@3.0.2
batisteo.vscode-django@0.17.0
bierner.markdown-preview-github-styles@0.1.3
daiyy.quick-html-previewer@0.3.0
DavidAnson.vscode-markdownlint@0.20.0
DavidWang.ini-for-vscode@0.0.4
dbaeumer.vscode-eslint@1.6.0
donjayamanne.githistory@0.4.3
donjayamanne.jupyter@1.1.4
donjayamanne.python-extension-pack@1.4.0
DotJoshJohnson.xml@2.3.2
eamodio.gitlens@8.5.6
eg2.tslint@1.0.39
emilast.LogFileHighlighter@2.4.1
emmanuelbeziat.vscode-great-icons@2.1.44
Equinusocio.vsc-material-theme@2.4.2
felixfbecker.php-debug@1.12.6
formulahendry.code-runner@0.9.4
gerane.Theme-dimmed-monokai@0.0.2
gharveymn.nightswitch@1.1.0
GitHub.vscode-pull-request-github@0.1.6
GrapeCity.gc-excelviewer@2.1.26
hdg.live-html-previewer@0.3.0
hnw.vscode-auto-open-markdown-preview@0.0.4
HookyQR.beautify@1.4.4
IBM.output-colorizer@0.1.2
ikappas.phpcs@1.0.5
ionutvmi.reg@0.0.2
JerryHong.autofilename@0.1.3
joaompinto.asciidoctor-vscode@0.15.1
johnpapa.winteriscoming@0.8.0
Kelvin.vscode-sshfs@1.10.0
kisstkondoros.vscode-codemetrics@1.17.3
KnisterPeter.vscode-github@0.30.0
magicstack.MagicPython@1.1.0
mariorodeghiero.vue-theme@1.1.1
mechatroner.rainbow-csv@0.6.0
mkloubert.vs-deploy@14.0.0
mkloubert.vscode-remote-workspace@0.34.0
ms-mssql.mssql@1.4.0
ms-python.python@2018.8.0
ms-vscode.csharp@1.16.1
ms-vscode.PowerShell@1.9.0
ms-vsliveshare.vsliveshare@0.3.735
ms-vsts.team@1.136.0
quicktype.quicktype@12.0.46
redhat.java@0.32.0
robertohuertasm.vscode-icons@7.27.0
Shan.code-settings-sync@3.1.2
stkb.rewrap@1.9.1
streetsidesoftware.code-spell-checker@1.6.10
streetsidesoftware.code-spell-checker-polish@1.0.0
TomasHubelbauer.zip-file-system@1.0.0
vangware.dark-plus-material@1.4.3
VisualStudioExptTeam.vscodeintellicode@1.0.4
vscjava.vscode-java-debug@0.13.0
vscjava.vscode-java-pack@0.4.0
vscjava.vscode-java-test@0.9.0
vscjava.vscode-maven@0.11.0
WakaTime.vscode-wakatime@1.2.3
wayou.vscode-todo-highlight@1.0.4
whizkydee.material-palenight-theme@1.9.4
wholroyd.jinja@0.0.8
xaver.clang-format@1.6.2
yzhang.markdown-all-in-one@1.6.0
zhuangtongfa.Material-theme@2.17.3
Zignd.html-css-class-completion@1.11.0


### PSES version: 1.9.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.17763.1
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.1
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I run a script. During running of the script I edit some stuff and press Save. It does format on save (as designed) but it seems it queue it for later...

image

image

Now if i continue edits it will queue it more and more..

Attached Logs

10/6/2018 8:47:46 PM [NORMAL] - Language server starting --
10/6/2018 8:47:46 PM [NORMAL] -     exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
10/6/2018 8:47:46 PM [NORMAL] -     args: C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.9.0'-AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\modules'-EnableConsoleRepl -LogLevel 'Diagnostic' -LogPath 'C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\logs\1538851666-301dad12-f1db-4f10-b147-f4b211689b651538724044891\EditorServices.log' -SessionDetailsPath 'C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\sessions\PSES-VSCode-6188-174776' -FeatureFlags @()
10/6/2018 8:47:47 PM [NORMAL] - powershell.exe started, pid: 20588
10/6/2018 8:47:48 PM [NORMAL] - Language server started.
10/6/2018 8:47:48 PM [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_b63b9071-eebd-42a6-84a5-7cb714b7f19f...
10/6/2018 8:47:48 PM [NORMAL] - {"status":"started","debugServiceTransport":"NamedPipe","languageServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_2f66723a-cc27-406c-996b-64363372e615","languageServicePipeName":"\\\\.\\pipe\\PSES_b63b9071-eebd-42a6-84a5-7cb714b7f19f"}
10/6/2018 8:47:48 PM [NORMAL] - Language service connected.
10/6/2018 8:53:29 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 8:53:30 PM [VERBOSE] - Document formatting finished in 1.387s
10/6/2018 8:55:39 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 8:55:42 PM [VERBOSE] - Document formatting finished in 3.41s
10/6/2018 8:56:35 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 8:56:42 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 8:56:48 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:15:44 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...

As you can see the script is running I press Save on multiple times and it seems to be starting reformat and reformat again and again. My guess is that when it's done it will do 4 times reformat right? Maybe it should disable that feature when script is running since it's not doing anything?

@PrzemyslawKlys
Copy link
Contributor Author

The script is running now 2nd hour and I've been doing some edits on it

10/6/2018 8:47:46 PM [NORMAL] - Language server starting --
10/6/2018 8:47:46 PM [NORMAL] -     exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
10/6/2018 8:47:46 PM [NORMAL] -     args: C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.9.0'-AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\modules'-EnableConsoleRepl -LogLevel 'Diagnostic' -LogPath 'C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\logs\1538851666-301dad12-f1db-4f10-b147-f4b211689b651538724044891\EditorServices.log' -SessionDetailsPath 'C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\sessions\PSES-VSCode-6188-174776' -FeatureFlags @()
10/6/2018 8:47:47 PM [NORMAL] - powershell.exe started, pid: 20588
10/6/2018 8:47:48 PM [NORMAL] - Language server started.
10/6/2018 8:47:48 PM [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_b63b9071-eebd-42a6-84a5-7cb714b7f19f...
10/6/2018 8:47:48 PM [NORMAL] - {"status":"started","debugServiceTransport":"NamedPipe","languageServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_2f66723a-cc27-406c-996b-64363372e615","languageServicePipeName":"\\\\.\\pipe\\PSES_b63b9071-eebd-42a6-84a5-7cb714b7f19f"}
10/6/2018 8:47:48 PM [NORMAL] - Language service connected.
10/6/2018 8:53:29 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 8:53:30 PM [VERBOSE] - Document formatting finished in 1.387s
10/6/2018 8:55:39 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 8:55:42 PM [VERBOSE] - Document formatting finished in 3.41s
10/6/2018 8:56:35 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 8:56:42 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 8:56:48 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:15:44 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 9:50:24 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:50:31 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:50:41 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:50:53 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:51:03 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:51:10 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:52:38 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:52:58 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:55:18 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:56:23 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:56:36 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:58:04 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:00:06 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 10:00:32 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 10:00:42 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 10:00:45 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 10:03:08 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:03:28 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:03:38 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:06:50 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:07:10 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:07:23 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:07:36 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:07:37 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:07:39 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:07:51 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:08:02 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:08:14 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:08:21 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:08:27 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:08:48 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:09:05 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:10:14 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...

Now the question is if that process should be suspended or maybe running separate to the one running the script and so the running script could be refactored further while the one is running?

@PrzemyslawKlys
Copy link
Contributor Author

Now the same problem touches multiple other issues. If the script is running Go definition doesn't work. I suspect anything related to PowerShell is paused until script is done. So in my case 2-4 hours :-)

@PrzemyslawKlys
Copy link
Contributor Author

When finally unlocked...

10/6/2018 8:47:46 PM [NORMAL] - Language server starting --
10/6/2018 8:47:46 PM [NORMAL] -     exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
10/6/2018 8:47:46 PM [NORMAL] -     args: C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.9.0'-AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\modules'-EnableConsoleRepl -LogLevel 'Diagnostic' -LogPath 'C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\logs\1538851666-301dad12-f1db-4f10-b147-f4b211689b651538724044891\EditorServices.log' -SessionDetailsPath 'C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\sessions\PSES-VSCode-6188-174776' -FeatureFlags @()
10/6/2018 8:47:47 PM [NORMAL] - powershell.exe started, pid: 20588
10/6/2018 8:47:48 PM [NORMAL] - Language server started.
10/6/2018 8:47:48 PM [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_b63b9071-eebd-42a6-84a5-7cb714b7f19f...
10/6/2018 8:47:48 PM [NORMAL] - {"status":"started","debugServiceTransport":"NamedPipe","languageServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_2f66723a-cc27-406c-996b-64363372e615","languageServicePipeName":"\\\\.\\pipe\\PSES_b63b9071-eebd-42a6-84a5-7cb714b7f19f"}
10/6/2018 8:47:48 PM [NORMAL] - Language service connected.
10/6/2018 8:53:29 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 8:53:30 PM [VERBOSE] - Document formatting finished in 1.387s
10/6/2018 8:55:39 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 8:55:42 PM [VERBOSE] - Document formatting finished in 3.41s
10/6/2018 8:56:35 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 8:56:42 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 8:56:48 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:15:44 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 9:50:24 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:50:31 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:50:41 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:50:53 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:51:03 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:51:10 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:52:38 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:52:58 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:55:18 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:56:23 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:56:36 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 9:58:04 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:00:06 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 10:00:32 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 10:00:42 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 10:00:45 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 10:03:08 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:03:28 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:03:38 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:06:50 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:07:10 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:07:23 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:07:36 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:07:37 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:07:39 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:07:51 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:08:02 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:08:14 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:08:21 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:08:27 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:08:48 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:09:05 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:10:14 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 10:30:25 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 10:30:51 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 11:34:43 PM [VERBOSE] - Document formatting finished in 9488.785s
10/6/2018 11:34:46 PM [VERBOSE] - Document formatting finished in 8341.71s
10/6/2018 11:38:36 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/6/2018 11:38:37 PM [VERBOSE] - Document formatting finished in 1.096s
10/6/2018 11:38:40 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 11:38:51 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 11:38:52 PM [VERBOSE] - Document formatting finished in 0.257s
10/6/2018 11:39:06 PM [VERBOSE] - Formatting entire document - file:///c%3A/Users/pklys/OneDrive%20-%20Evotec/Support/GitHub/PSWinDocumentation/Public/Get-WinADDomainInformation.ps1...
10/6/2018 11:39:06 PM [VERBOSE] - Document formatting finished in 0.219s

So only some executed. Sorry that I pasted it as multiple logs.

@rjmholt
Copy link
Contributor

rjmholt commented Oct 8, 2018

Wow, I'm surprised that actually finished in the end. It sounds like there are a few things we should be doing to handle formatting better.

Ultimately, the formatting itself is done by PSScriptAnalyzer. But we should probably put some delays, cancellations, etc. in there to make it nicer.

@rjmholt
Copy link
Contributor

rjmholt commented Oct 8, 2018

Tagging @tylerl0706 and @SeeminglyScience for visibility.

@PrzemyslawKlys
Copy link
Contributor Author

Please notice Go to definition doesn't work either in this. Not sure if its' related to PSScriptAnalyzer as well but half of options doesn't work when script is running. Sorry if you noticed this, just making sure it doesn't go unnoticed.

@rjmholt
Copy link
Contributor

rjmholt commented Oct 8, 2018

Do completions or the integrated terminal work?

@PrzemyslawKlys
Copy link
Contributor Author

vscodedebugsession1

vscodedebugsession

It looks like this

@rjmholt
Copy link
Contributor

rjmholt commented Oct 8, 2018

Yeah so it looks like the underlying session is effectively dead. Does it come back when the formatting finally finishes?

@PrzemyslawKlys
Copy link
Contributor Author

Yes. It seems it's working on the same session as the script. If script is executed any action within VS Code is paused. Which makes developing "long" running scripts a bit harder ;-) And those are 2-3 minutes on my dev machine, but I've some running for hours like asking O365 for data.

@PrzemyslawKlys
Copy link
Contributor Author

To be completely fair ISE also pauses things I believe.

@SeeminglyScience
Copy link
Collaborator

Yeah, most language features require being in the pipeline thread. If something is currently running there, the queue will just build up until it's finished.

In 2.0 we could take over the thread via PowerShell's eventing system, but we could only take over between sequence points. If something in .NET was blocking, it would still be frozen until it finishes. (Also, that's not currently implemented for taking over anything other than PSRL, but it's something we should consider)

@rjmholt
Copy link
Contributor

rjmholt commented Oct 8, 2018

Do we have a way to "send Ctrl+C" or some other SIGINT-style thing to the command executing in the pipeline?

Otherwise, I'm not entirely sure what we can do to stop a long-running formatter

@SeeminglyScience
Copy link
Collaborator

Actually formatting/PSSA in general is one of the few things that do not need the pipeline thread (at least, not the main pipeline). That bit is more likely due to the fact that we currently only handle one language service request at a time.

@SeeminglyScience
Copy link
Collaborator

SeeminglyScience commented Oct 8, 2018

Do we have a way to "send Ctrl+C" or some other SIGINT-style thing to the command executing in the pipeline?

Otherwise, I'm not entirely sure what we can do to stop a long-running formatter

In this instance I don't think it's the formatter that is running for a long time. I believe it's just that the formatter isn't really starting until the script is over.

We can request a stop though, with PowerShell.Stop/PowerShell.BeginStop. That is dependent on the current command either being PowerShell based, or implementing Cmdlet.StopProcessing though. If it doesn't, or it's a direct method call, then it'll block until it's completed regardless. Some engine specific methods will check ExecutionContext.CurrentPipelineStopping, but that's not a public API.

@PrzemyslawKlys
Copy link
Contributor Author

I just had this case where I would run this script

$prop1 = @{"arg1" = "something1"; "arg2" = "something" }
$prop2 = @{"arg1" = "something3"; "arg2" = "something4"}
$Table1 = @()
$table2 = @()
$table1 = new-object psobject -prop $prop1

$table2 = new-object psobject -prop $prop2

#try
$table1
Write-host "line. divider"
$table2

Run it.. added one little Select-Object and pressed F5 (or save and f5) by accident

$prop1 = @{"arg1" = "something1"; "arg2" = "something" }
$prop2 = @{"arg1" = "something3"; "arg2" = "something4"}
$Table1 = @()
$table2 = @()
$table1 = new-object psobject -prop $prop1

$table2 = new-object psobject -prop $prop2

#try
$table1 | Select-Object
Write-host "line. divider"
$table2

and I would see formatting powershell suddenly going nuts

10/10/2018 2:12:26 PM [NORMAL] - Language service connected.
10/10/2018 2:13:09 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/10/2018 2:13:09 PM [VERBOSE] - Document formatting finished in 0.503s
10/10/2018 2:13:18 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationADWithPasswordQuality.ps1...
10/10/2018 2:13:18 PM [VERBOSE] - Document formatting finished in 0.285s
10/10/2018 2:14:45 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSWinDocumentation/Examples/Run-DocumentationAD.ps1...
10/10/2018 2:14:45 PM [VERBOSE] - Document formatting finished in 0.237s
10/10/2018 2:28:45 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSWinDocumentation/Examples/Test-1.ps1...
10/10/2018 2:28:45 PM [VERBOSE] - Document formatting finished in 0.056s
10/10/2018 2:28:55 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSWinDocumentation/Examples/Test-1.ps1...
10/10/2018 2:28:55 PM [VERBOSE] - Document formatting finished in 0.056s
10/10/2018 2:29:14 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSWinDocumentation/Examples/tesssot.ps1...
10/10/2018 2:29:14 PM [VERBOSE] - Document formatting finished in 0.088s
10/10/2018 2:29:38 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSWinDocumentation/Examples/tesssot.ps1...
10/10/2018 2:29:39 PM [VERBOSE] - Document formatting finished in 0.088s
10/10/2018 2:29:52 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSWinDocumentation/Examples/tesssot.ps1...
10/10/2018 2:29:52 PM [VERBOSE] - Document formatting finished in 0.062s
10/10/2018 2:30:14 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSWinDocumentation/Examples/tesssot.ps1...
10/10/2018 2:30:28 PM [VERBOSE] - Document formatting finished in 13.684s

After it came back F5 doesn't work anymore. It doesn't display any message either

1539173542-fa293ce8-7d4d-4c82-acd6-50ff768550271539173534901.zip

I restarted powershell and it came back

image

1539173542-fa293ce8-7d4d-4c82-acd6-50ff768550271539173534901.zip

2nd log is taken after restart of powershell (I guess it contains a bit more information on what happend). Not sure if it's related to this one or you want another ticket

@rjmholt
Copy link
Contributor

rjmholt commented Oct 10, 2018

Ok, in the immediate I think we should introduce a timeout on formatting like we have script analysis. I think the deeper issue is a common one we have with the async context, which will require a fair amount of careful work.

@SeeminglyScience
Copy link
Collaborator

@rjmholt I think I'm misunderstanding something about this issue in particular.

To me it looks like VSCode is reporting that it is starting formatting before we PSES even gets the message, and the time it takes is not the formatter, but waiting for the existing launch request to finish before it even starts formatting.

@rjmholt
Copy link
Contributor

rjmholt commented Oct 11, 2018

@SeeminglyScience since I haven't looked very closely at the actual implementation, I'm thinking your interpretation is probably the best one. But either way, a timeout on formatting feels like the best way to stop the formatter going wild here, no?

@PrzemyslawKlys
Copy link
Contributor Author

I'm getting this more and more lately.

10/11/2018 5:13:40 PM [NORMAL] - Language server starting --
10/11/2018 5:13:40 PM [NORMAL] -     exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
10/11/2018 5:13:40 PM [NORMAL] - Syntax Folding Provider registered
10/11/2018 5:13:40 PM [NORMAL] -     args: C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.9.0'-AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\modules'-EnableConsoleRepl -LogLevel 'Diagnostic' -LogPath 'C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\logs\1539270820-861a2ee3-6a0c-49da-b894-d1d113324ee41539270675156\EditorServices.log' -SessionDetailsPath 'C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\sessions\PSES-VSCode-18668-538929' -FeatureFlags @()
10/11/2018 5:13:40 PM [NORMAL] - powershell.exe started, pid: 27504
10/11/2018 5:13:42 PM [NORMAL] - Language server started.
10/11/2018 5:13:42 PM [NORMAL] - {"status":"started","debugServiceTransport":"NamedPipe","languageServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_18a4317c-2c4a-42ea-b9b1-052a0115d237","languageServicePipeName":"\\\\.\\pipe\\PSES_2c0ae8b3-c373-4587-a819-74c36493410e"}
10/11/2018 5:13:42 PM [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_2c0ae8b3-c373-4587-a819-74c36493410e...
10/11/2018 5:13:42 PM [NORMAL] - Language service connected.
10/11/2018 5:14:00 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSSecurePassword/Publish/PublishMe.ps1...
10/11/2018 5:14:00 PM [VERBOSE] - Document formatting finished in 0.164s
10/11/2018 5:14:06 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSSecurePassword/Publish/PublishMe.ps1...
10/11/2018 5:14:06 PM [VERBOSE] - Document formatting finished in 0.12s
10/11/2018 5:17:47 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSSecurePassword/Public/New-Password.ps1...
10/11/2018 5:17:47 PM [VERBOSE] - Document formatting finished in 0.058s
10/11/2018 5:18:08 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSSecurePassword/Public/New-Password.ps1...
10/11/2018 5:18:08 PM [VERBOSE] - Document formatting finished in 0.097s
10/11/2018 5:18:47 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSSecurePassword/Public/New-Password.ps1...
10/11/2018 5:18:47 PM [VERBOSE] - Document formatting finished in 0.06s
10/11/2018 5:18:59 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSSecurePassword/Public/New-Password.ps1...
10/11/2018 5:18:59 PM [VERBOSE] - Document formatting finished in 0.064s
10/11/2018 5:19:46 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSSecurePassword/Public/New-Password.ps1...
10/11/2018 5:19:46 PM [VERBOSE] - Document formatting finished in 0.057s
10/11/2018 5:19:51 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSSecurePassword/Public/New-Password.ps1...
10/11/2018 5:19:51 PM [VERBOSE] - Document formatting finished in 0.049s
10/11/2018 5:20:14 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSSecurePassword/Public/New-Password.ps1...
10/11/2018 5:20:14 PM [VERBOSE] - Document formatting finished in 0.053s
10/11/2018 5:20:28 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSSecurePassword/Public/New-Password.ps1...
10/11/2018 5:20:28 PM [VERBOSE] - Document formatting finished in 0.065s
10/11/2018 5:20:53 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSSecurePassword/Public/New-Password.ps1...
10/11/2018 5:20:53 PM [VERBOSE] - Document formatting finished in 0.106s
10/11/2018 5:22:36 PM [VERBOSE] - Formatting entire document - file:///c%3A/Support/GitHub/PSSecurePassword/Public/New-Password.ps1...
10/11/2018 5:22:39 PM [VERBOSE] - Document formatting finished in 3.09s
10/11/2018 5:24:20 PM [NORMAL] - Shutting down language client...
10/11/2018 5:24:20 PM [NORMAL] - Terminating PowerShell process...

Not really sure why. I can just start a project (open VSCode and new folder with few files and see it happen). Not sure why thou. And I am not exactly sure if terminating formatting would fix this. As the formatting part actually in this "smaller" case finishes 3.09s (still a lot). But then I can't run anything. In this case restarting powershell helps out. I do have logs from this if required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants