Skip to content

Codelens shows references to files/folders excluded using "files.exclude" setting #1039

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

Closed
oldlost opened this issue Sep 29, 2017 · 17 comments
Closed
Labels
Area-Pester Issue-Enhancement A feature request (enhancement).

Comments

@oldlost
Copy link

oldlost commented Sep 29, 2017

System Details

  • Operating system name and version: Windows Server 2012 R2
  • VS Code version: 1.16.1
  • PowerShell extension version: 1.4.3
  • Output from $PSVersionTable:

Name Value


PSRemotingProtocolVersion 2.3
BuildVersion 10.0.10586.117
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSVersion 5.0.10586.117
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
SerializationVersion 1.1.0.1

Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:

code -v
code : The term 'code' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ code -v
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (code:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS> $pseditor.EditorServicesVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
1      4      1      0


PS> code --list-extensions --show-versions
code : The term 'code' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ code --list-extensions --show-versions
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (code:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.0.10586.117
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.117
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I am experiencing a problem with codelens, in that the references it shows includes files and folders that are excluded using "files.exclude" in the settings file. Is this by design? Is there any way to exclude files and folders from the codelens references?

Attached Logs

I will be glad to attach logs if you think it will help, but I doubt logs will help with this issue.

@Jaykul
Copy link

Jaykul commented Oct 6, 2017

I'd love this too. As we've been moving to a function-per-file source "built" into single-file PSM1 modules, those psm1 files sometimes end up within the folder that I've selected as the root of a project -- this means they show up in go to definition and interfere with finding the file I needed to edit...

@BernieWhite
Copy link

Agree, great suggestion. I also use a build directory in the project root, code in src keeps being associated with references to code in build. It definitely slows down my workflow, checking if the reference is actually to the correct files.

For me personally, exclusion though "search.exclude" which implicitly includes "files.exclude" in the filter would be preferred. I often refer back to the build folder within VSCode, so hiding it within the explorer by using "files.exclude" would be less optimal.

@ghost
Copy link

ghost commented May 20, 2018

If you use a local history extension, you will end up to 10.000+ found references very quickly.
Codelens and even IntelliSense will just stop working then.
My first workaround was deactivating codelens.
Now I just moved the local history folder outside the workspace folder.

It would be sufficient, if VSCode ignores ALL hidden files and folders by default (or by settings), instead of using ignore lists, since most folders you wish to ignore (like .history .vs .vscore .git .svn...) are hidden by default.

@TylerLeonhardt
Copy link
Member

This is a reasonable request. However, I think rather than using files.exclude we should have our own setting for codelens - maybe something like:

powershell.codelens.exclude

Ideally vscode could have a codelens.exclude. This would be useful for other dynamic languages as well.

files.exclude has more to do with what shows up in the workspace (like .git) and users might want to see published output in their workspace.

@joeyaiello
Copy link

And we'll make sure to talk to someone on the VS Code team before we walk down an implementation path.

But in either case, this would roughly halve the number of files we're analyzing for modules who use a build/publish folder structure, so I think it's important to the perf/stability work as well.

@rkeithhill
Copy link
Contributor

And maybe we do what this setting does:

  // Configure glob patterns for excluding files and folders in searches. Inherits all glob patterns from the files.exclude setting.
  "search.exclude": {
    "**/node_modules": true,
    "**/bower_components": true
  },

inherits its default value from file.exclude as a starting point. Or maybe we inherit from search.exclude as has been suggested earlier in this thread?

@caparkaya
Copy link

Hello,
Are there any developments on this? Any time / release plan? Any help needed? I'm looking for this as well, and would love to contribute to solution if required & possible.
Kind Regards,

@rjmholt
Copy link
Contributor

rjmholt commented Aug 1, 2018

Hi @caparkaya, sorry we've been a bit busy lately. It looks like there is a desire for this, but it's currently not being worked on. There might still be the odd thing to discuss, like:

  • What should the option be called?
  • Should CodeLens and debug optout be given the same option?
  • Does it make sense to not use VSCode's files.exclude? (I think we've already agreed that we shouldn't use it, but just enumerating considerations)
  • What should a default be?

The other thing that still needs to happen is @joeyaiello's requirement:

And we'll make sure to talk to someone on the VS Code team before we walk down an implementation path.

@tylerl0706 @rkeithhill @SeeminglyScience any thoughts here?

@rjmholt
Copy link
Contributor

rjmholt commented Aug 1, 2018

Oh, meant to add... @caparkaya we are always over the moon to accept contributions -- feel free to open a PR anytime! Contributions also get mentioned in the CHANGELOG.

@lllopo
Copy link

lllopo commented Feb 7, 2019

This is much needed. Indexing the .history folder is awful. I always end up with references to some history version of a file. Total nightmare.

@Jaykul
Copy link

Jaykul commented Mar 1, 2019

There should be a custom setting (or a codelens.exclude) so the extension can exclude things from parsing that we still want to have show up in the sidebar file list.

However, like search.exclude that new setting must inherit files.exclude regardless. It should probably inherit search.exclude -- but I'm not totally set on that.

The point is that you shouldn't spend time parsing files that aren't even visible to the user -- and the user shouldn't have to add additional exclusions if they've already hidden the files.

@glennsarti
Copy link
Contributor

glennsarti commented Mar 4, 2019

@Jaykul Just to confirm, you're talking about ignoring files for the;

(The reason I ask is the term CodeLens has a very specific meaning in the Language Server Protocol)

  • The references intellisense item
    image

  • The Goto Definition and Peek Definition intellisense items

@glennsarti
Copy link
Contributor

For reference: I'll probably need to import https://www.nuget.org/packages/Microsoft.Extensions.FileSystemGlobbing into PSES to help with the globs that come from files.exclude

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Mar 4, 2019

@glennsarti the package you referenced I did evaluate. I tried using it for the RecursivelyEnumerateFiles function in PSES and there was no way to handle any file access exceptions... It would just stop the whole glob operation.

This was the really good one I found:
https://github.com/mganss/Glob.cs

@glennsarti
Copy link
Contributor

Cross reference
PowerShell/PowerShellEditorServices#877

@glennsarti
Copy link
Contributor

My PSES PR is making great headway into this. Won't be too long now.

@SydneyhSmith
Copy link
Collaborator

Closing as the fix has been merged and will be available in the next preview release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Pester Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests