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

Unable to open file on click in Problems Tab #1593

Closed
PrzemyslawKlys opened this issue Oct 28, 2018 · 13 comments
Closed

Unable to open file on click in Problems Tab #1593

PrzemyslawKlys opened this issue Oct 28, 2018 · 13 comments
Labels
Issue-Bug A bug to squash.

Comments

@PrzemyslawKlys
Copy link
Contributor

PrzemyslawKlys commented Oct 28, 2018

System Details

System Details Output

### VSCode version: 1.28.2 7f3ce96ff4729c91352ae6def877e59c561f4850 x64

### VSCode extensions:
aaron-bond.better-comments@2.0.2
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.6
batisteo.vscode-django@0.17.0
bierner.markdown-preview-github-styles@0.1.3
DavidAnson.vscode-markdownlint@0.21.0
DavidWang.ini-for-vscode@0.0.4
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
emilast.LogFileHighlighter@2.4.2
emmanuelbeziat.vscode-great-icons@2.1.44
Equinusocio.vsc-material-theme@2.5.1
felixfbecker.php-debug@1.12.6
formulahendry.code-runner@0.9.4
gerane.Theme-dimmed-monokai@0.0.2
gharveymn.nightswitch@1.1.0
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.7
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.11.1
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.7.1
mkloubert.vs-deploy@14.0.0
mkloubert.vscode-remote-workspace@0.36.5
ms-mssql.mssql@1.4.0
ms-python.python@2018.9.1
ms-vscode.csharp@1.16.2
ms-vscode.PowerShell@1.9.0
ms-vsliveshare.vsliveshare@0.3.869
ms-vsts.team@1.142.0
quicktype.quicktype@12.0.46
redhat.java@0.33.0
robertohuertasm.vscode-icons@7.27.0
Shan.code-settings-sync@3.2.0
stkb.rewrap@1.9.1
streetsidesoftware.code-spell-checker@1.6.10
streetsidesoftware.code-spell-checker-polish@1.0.0
swyphcosmo.spellchecker@1.2.13
TomasHubelbauer.zip-file-system@1.0.0
vangware.dark-plus-material@1.4.3
VisualStudioExptTeam.vscodeintellicode@1.0.5
vscjava.vscode-java-debug@0.14.0
vscjava.vscode-java-pack@0.4.0
vscjava.vscode-java-test@0.10.0
vscjava.vscode-maven@0.11.1
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
zhuangtongfa.Material-theme@2.17.6
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

In problems Tab it shows me file paths. But it seems you try to make it relative and something isn't playing well.

image

It seems that if there is depth higher then 1 relative path isn't relative to the path of folder but it goes back to C drive using full path but removing drive letter.

image

I suspect this problem often shows up in searching for definition or in other places (can't confirm it thou). I had times where I would click find 'Go To Definitions' and it would try to search for it for long time entering into infinite loop (showing the progress of searching but nothing really happens - the progress stays up even after I restarted PowerShell Session).

Maybe it manifests itself in other places (invisible to naked eye) as well so worth taking a deeper look.

Expected Behaviour

Relative Paths or full paths. Up to you ;-)

@PrzemyslawKlys
Copy link
Contributor Author

I actually wonder if it's not the reason it fails to quickly format document.

image

For me I can get formatting powershell for minutes now.

@PrzemyslawKlys
Copy link
Contributor Author

Ever since I turned on PSAnalyzer in options (for some reason it was off) it works partially and always borking out on those paths

image

Before when I had it disabled it wasn't reporting anything but most of my problems may be related to how I build modules with folder, within folder and probably searching down isn't working correctly.

Are you able to reproduce it?

@rkeithhill
Copy link
Contributor

What version of PSSA is shown as imported in the PS integrated console? Run Get-Module to see that version info.

@PrzemyslawKlys
Copy link
Contributor Author

PrzemyslawKlys commented Nov 3, 2018

    Directory: C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.1.3      Plaster                             {Invoke-Plaster, New-PlasterManifest, Get-PlasterTemplate, Test-PlasterManifest}
Script     1.9.0      PowerShellEditorServices            {Start-EditorServicesHost, Get-PowerShellEditorServicesVersion, Compress-LogDir}
Script     0.2.0      PowerShellEditorServices.VSCode     {New-VSCodeHtmlContentView, Show-VSCodeHtmlContentView, Close-VSCodeHtmlContentView, Set-VSCodeHtmlContentView...}
Script     1.17.1     PSScriptAnalyzer                    {Get-ScriptAnalyzerRule, Invoke-ScriptAnalyzer, Invoke-Formatter}

@PrzemyslawKlys
Copy link
Contributor Author

To say I had to ask for Get-Module -List explicitly and get you that list.

By default I get:

image

@rkeithhill
Copy link
Contributor

Nevermind. I see what is going on here. Thanks for the bug report. Will try to get this fixed.

@rkeithhill
Copy link
Contributor

OK, I thought I knew what was going on but I can't repro this. On my PC I open a workspace and then open a file one level above it. In this case, I'm given the absolute path in the Problems window and double-clicking does open the file. This is what I see:

image

So I assume you opened a workspace that had the Private\Main subdirs in it. How did you get this file opened into VSCode:

image

Finding references will not search outside of the root workspace. Are you opening multi-root workspace?

@PrzemyslawKlys
Copy link
Contributor Author

PrzemyslawKlys commented Nov 4, 2018

This is how it looks:

image

I always open a folder PSWinReporting or PSWindocumentation or whatever and it has dirs in dirs. So I do it like you. With a Private\ Public folder, Ignore, Data and so on. But recently I started to add Public\AWS<file> Public\AD<file>

In other words in DIR\DIR\file.ps1 or even DIR\DIR\DIR\file.ps1 - I remember once opening a large repository of my junk scripts and VSCode was failing to work properly (long time ago) but maybe it's still affecting VSCode? I am not opening multi-root. One project per VScode Instance.

image

Notice how on your screen it takes InvokePlaster RelativePath and then the absolute path for build.psake.ps1? why does it do this differently? And in my case, it tries to do relative but for some reason fails.

@PrzemyslawKlys
Copy link
Contributor Author

PrzemyslawKlys commented Nov 6, 2018

To be honest I don't get it

image

It doesn't appear to be consisent.

image

Notice how it's trying to take Absolute Path for the first 5 entries and then for the next 2 entries it's relative. What's more, it's actual folder within a folder.

And it happens on same Project. I open PSSharedGoods as my main project and it took some of it in Relative and some absolute...

But now thinking about it I use a tricky setup:

  • My files are stored on C:\Users\pklys\OneDrive - Evotec\Support\Github\PSSharedGoods

But I actually symlink that C:\Users\pklys\OneDrive - Evotec\Support to C:\Support so I can access it via C:\Support\GitHub\PSsharedGoods

And then I do another trick where when I "build" my module I actually link files from My projects into PowerShellModule directory so that I can use Import-Module and test how it behaves for someone who would load it from PS Gallery. While I don't think Symlinks matter here because it works in some scenarios I am just adding this as a potential information.

Closed, reopened VSCode:

image

Same folder, same project. One Absolute path, the other one relative path. One working, one not. Not really sure where the difference is between them :-)

@rkeithhill
Copy link
Contributor

rkeithhill commented Nov 16, 2018

So we think we know what is going on with these paths but it's going to take a bit of time to fix. What happens is that when PSES (running in the PSIC process) opens script files it creates simple filesystem paths. When those paths are passed back to VSCode, VSCode is expecting them to be in a particular Uri format. We are not converting those file system paths to this Uri format which causes this issue. @SeeminglyScience @rjmholt

@PrzemyslawKlys
Copy link
Contributor Author

Take your time. I only wanted to ask whether this could be related to all my other problems. I seem to be hitting more and more "stuck" or formatting that never finishes, very long times to process everything and I'm wondering if this issue could be at all related?

@PrzemyslawKlys
Copy link
Contributor Author

PrzemyslawKlys commented Jan 26, 2019

Just thought I would update this

image

I've opened a folder and then I've used Open File and gave it full path C:\Users\pklys\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1

It opened properly in VSCode, yet in the Problems tab, the path is totally incorrect. And the problems tab is showing different extension data (I've actually disable PSSA analysis due to this issue). I'm wondering whether this is a problem of only PowerShell extension, multiple extensions or VSCode itself?

@rkeithhill
Copy link
Contributor

The next update 1.12.0 should fix this issue. If for some reason it does not, please re-open this issue. Fixed by PowerShell/PowerShellEditorServices#872 and PowerShell/PowerShellEditorServices#887

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

No branches or pull requests

3 participants