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

Implement document and workspace symbol providers for classes #3

Closed
daviwil opened this issue Nov 9, 2015 · 26 comments
Closed

Implement document and workspace symbol providers for classes #3

daviwil opened this issue Nov 9, 2015 · 26 comments
Assignees
Labels
Area-Symbols & References Issue-Enhancement A feature request (enhancement). Resolution-Fixed Will close automatically.

Comments

@daviwil
Copy link
Contributor

daviwil commented Nov 9, 2015

This requires an implementation of the DocumentSymbolProvider and WorkspaceSymbolProvider interfaces. Relevant code will need to be added to PowerShell Editor Services to support this behavior.

@daviwil daviwil added the Issue-Enhancement A feature request (enhancement). label Nov 9, 2015
@daviwil daviwil added this to the 0.1.0 milestone Nov 9, 2015
@daviwil daviwil changed the title Add document and workspace symbol providers Implement document and workspace symbol providers Nov 9, 2015
@daviwil
Copy link
Contributor Author

daviwil commented Nov 9, 2015

Assigning Keith since this is for the feature he was interested in helping with. I'll provide more details privately.

@daviwil daviwil modified the milestones: 0.1.0, Backlog Jan 2, 2016
@sgtoj
Copy link

sgtoj commented Sep 16, 2016

Would this allow for symbols search and goto for PS 5.0's classes and enums?

@daviwil
Copy link
Contributor Author

daviwil commented Sep 16, 2016

Yep, that's something we haven't finished yet. Seems like you had commented on the Editor Services issue for this a while back:

PowerShell/PowerShellEditorServices#14

Sorry about that :/ I'll see if I can get some help to get that implemented for the 0.8.0 release!

@daviwil daviwil modified the milestones: 0.8.0, Backlog Sep 16, 2016
@daviwil daviwil changed the title Implement document and workspace symbol providers Implement document and workspace symbol providers for classes Sep 16, 2016
@daviwil daviwil modified the milestones: Backlog, 0.8.0 Nov 29, 2016
@Golosok
Copy link

Golosok commented Feb 20, 2017

Any updates on this? I have version 0.9.0 now and this doesn't seem to work.

@daviwil daviwil mentioned this issue Mar 13, 2017
14 tasks
@powercode
Copy link

Any updates?

This is a big missing piece for me. I try to do most of the development as classes, and wrap them with functions to get the task based abstractions.
But that means navigation is only available for a minor subset of my code.

@mmajcica
Copy link

Same here, enums are not 'colored' at all (plain white).

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Jan 26, 2018

Just for the record, @mmajcica, enums being not colored is an EditorSyntax issue. That's all the syntax highlighting. This issue is opened there:
PowerShell/EditorSyntax#29

Thank you all for your patience! Classes and enums are lacking at the moment for sure. The best thing to do is 👍 issues as that is one factor we look at for priority.

@mud5150
Copy link

mud5150 commented Feb 13, 2019

@rjmholt Should I expect go to definition to work now if I'm using the 2.0 preview extension? Just installed and it doesn't appear to be working.

@rkeithhill
Copy link
Contributor

Not yet. First step is dropping support for v3 AST which 2.0 preview does. Next step is to add support for classes (and enums).

@rjmholt
Copy link
Contributor

rjmholt commented Feb 22, 2019

Agreed, it would be much better to provide both versions. Right now we're managing with some difficult with relatively small code base, but can't imagine how complex it will be as our code base gets larger.

Precisely the problem we face in this code base. We've been trying to make the code more maintainable since we're spread thin across 30k lines of C#, and tangling things up in compile-time macros means the code gets harder to reason about and we have to juggle multiple DLLs to load at runtime.

The decision to not compile a different DLL for PS v3/4 (compared to PS v5) was made by @daviwil in an earlier iteration of the project, but adding the capability back in presented a significant architecture-changing work item for new maintainers.

Anyway, now that PSReadLine means we are incompatible with PS v3/4, we can feasibly move back to an AstVisitor2 implementation without much complexity. But there are other things that need fixing first. It's the kind of thing that a community contribution would probably add much faster.

@TylerLeonhardt
Copy link
Member

This will be trickier than anticipated. Uncommenting the code that already existed didn't really do much. Here's what it has:

  • Class method symbols (but not references)
  • Class constructor symbols (but not references)

Here's what it's missing:

  • Class property symbols and references
  • Class (as in the type itself) symbols and references
  • Class method references
  • Class constructor references
  • Enum symbols and references

References here means actually going through and figuring out that a symbol ([MyClass]::Foo) is a reference of a class symbol (in this case a property of class MyClass). This will be tricky with non-static members... and will probably be best effort.

So yeah. Lot's to do.

TylerLeonhardt added a commit that referenced this issue Jul 14, 2020
* initial changes

* add activation event

* add block comment support

* add saveMarkdownCellsAs setting

* set metadata in new cells on save

* actually work across files

* updated API with metadata

* refactor based on option and new Kernel type

* add github action and proposed

* add pwsh

* remove old

* trigger PR

* add log

* force cron to trigger

* time

* time

* time

* better titles

* powershell comments

* remove not needed comments

* use githubrunnumber

* use run_id

* Update Notebook dts (#3)

Co-authored-by: TylerLeonhardt <TylerLeonhardt@users.noreply.github.com>

* better check for registering

* Update Notebook dts (#4)

Co-authored-by: TylerLeonhardt <TylerLeonhardt@users.noreply.github.com>

* rob's feedback

* Add a few tests

* added save test

* move to utils.sleep

* fix regex

* add logger

* Codacy part 1

* Codacy part 2

* Update Notebook dts (#5)

Co-authored-by: TylerLeonhardt <TylerLeonhardt@users.noreply.github.com>

* move GitHub Action to use master

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: TylerLeonhardt <TylerLeonhardt@users.noreply.github.com>
Co-authored-by: Tyler Leonhardt (POWERSHELL) <tyleonha@microsoft.com>
@SydneyhSmith SydneyhSmith removed this from the Future milestone Jan 26, 2021
@NonulliLester
Copy link

Is this planned or being worked on?

@JustinGrote
Copy link
Collaborator

@lesterm5150 it's definitely noted as needed but the current highest priority is getting the extension stabilized with the new revamped internal engine to the point it's good for a stable release.

@Golosok
Copy link

Golosok commented Nov 28, 2022

Any update or ETA?

@DougChandler
Copy link

Not sure if this been reported, but when editing a script that contains classes, the breadcrumb at the top of the script does not work for any class/method/enum.
Since I use classes, this is very frustrating :(

@mpetr
Copy link

mpetr commented Jan 27, 2023

as an heavy user of classes in all bigger projects, the ETA (or knowing any alternative approach) would be nice

@andyleejordan
Copy link
Member

This is landing in the next preview!!!

@andyleejordan
Copy link
Member

@andyleejordan andyleejordan self-assigned this Feb 2, 2023
@andyleejordan andyleejordan added the Resolution-Fixed Will close automatically. label Feb 2, 2023
@JustinGrote
Copy link
Collaborator

JustinGrote commented Feb 7, 2023

@andschwa working great! I have about as complex of a class as it gets in ModuleFast, and methods aren't showing up for some reason for the most part, I think maybe because I implement IComparable and it's only picking up those base methods like Equals?

https://github.com/JustinGrote/ModuleFast/blob/b531aa9ee95eb5941a064c9c0d0f2892e298db15/ModuleFast.psm1#L608-L620

image
image

I have less complex classes that work fine and show all methods like NuGetRange
image

Let me know if this needs a new issue.

@andyleejordan
Copy link
Member

@JustinGrote I know it's confusing, but those three screenshots all look like completions which are handled via the PowerShell completion engine, so perhaps an issue there? After you've typed out the method name (with at least () so the PowerShell parser knows it's a method invocation) can you do "go-to definition" on it? And if you pull up the Outline view, do you see all your methods?

@SeeminglyScience
Copy link
Collaborator

Yeah there's typically nothing we can do in the extension to make new completions appear.

That said, you might be hitting PowerShell/PowerShellEditorServices#1810 which is our problem. If it shows up after a Esc then Ctrl + Space then it's ours. If not, then you'd want to open in PowerShell/PowerShell

@JustinGrote
Copy link
Collaborator

@andschwa @SeeminglyScience oops I conflated two different things, you're right! Sorry about that, doing a quick symbol search and I'm seeing what I expect to see as well. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Symbols & References Issue-Enhancement A feature request (enhancement). Resolution-Fixed Will close automatically.
Projects
None yet
Development

No branches or pull requests