Vscode-cpptools: Adopt new DocumentSymbol API

Created on 6 Jul 2018  路  26Comments  路  Source: microsoft/vscode-cpptools

With the 1.25 release we have finalised the API for the outline tree. A DocumentSymbolProvider should now return document symbols which can represent a hierarchy and that can differentiate between the full range of a symbol and the selection range, e.g. the name of a function.

Note that we synthesise trees using range-containment when a provider returns SymbolInformation-objects and that that isn't perfect. Adopting the new API makes the outline more robust and support features like follow-cursor and diagnostics association.

Let me know if need more information is needed. Happy Coding!

Feature Request Language Service fixed (release pending)

Most helpful comment

Source Insight* provides two outline views, one for symbols inside file, another for project wide.
It seems it takes you forever to implement the outline / symbol view in your code project.
What is your plan to implement on this?

With this feature, your code project is a source code editor.
Without it, your code is just another text editor.

All 26 comments

What are the rules to update the outline view? I turned it on for a bit and it seemed to be stale as I added new code items to the file. We currently only update our document symbols list when the file is saved, but the outline didn't update when I saved the file.

EDIT:
Ah, I get it now. We use the LSP to communicate with VS Code, so we're using the SymbolInformation stuff you mentioned above. I'm not sure if/when the vscode-languageclient module will support this. Is it on Dirk's backlog to add this?

Yeah, Dirk is on it. I hope the LSP updates soon

Microsoft/language-server-protocol#327 is fixed. This feature would rock the world. Especially for editing large files and classes.

Where should I start if I wanted to help with this? This feature would be very useful for me.

@micmelesse It requires changes to our closed source code, so unfortunately you can't help unless you work for Microsoft. We sometimes mark bugs that could be fixed with our open source typescript with "help wanted".

Source Insight* provides two outline views, one for symbols inside file, another for project wide.
It seems it takes you forever to implement the outline / symbol view in your code project.
What is your plan to implement on this?

With this feature, your code project is a source code editor.
Without it, your code is just another text editor.

We prioritize features based on the number of upvotes. Please add your +1 to the original post to voice your support for this feature.

@bobbrow this issue is currently placed at #12 in terms of :+1:. Does that mean that it is finally being considered now?

The issues ahead of this one have been around for 2+ years, so I don't understand how the prioritization process actually is supposed to work though... You guys use some weighting and dependencies as well, right? Perhaps milestone-labeling could be helpful for clarifying - so that so it doesn't start to seem like this is just an issue graveyard/gulag.

@runelabs Being number 12 means there are 11 features with higher priority (along with feedback received from our survey). But this issue might be quick to fix compared to the others so that makes it more likely to get finished sooner. I don't know enough about out schedule to put it on a milestone date yet, but we will add it once we figure out our plan for the next few months.

If fixing this solves #2556 and #2401, then I am up-voting this. I intend to use VS Code as a full-time editor for my C/C++ code base, but lack of this feature makes it really hard to navigate the code :(

@VinayGupta23 Yeah, those issues should be fixed via this issue.

@micmelesse It requires changes to our closed source code, so unfortunately you can't help unless you work for Microsoft. We sometimes mark bugs that could be fixed with our open source typescript with "help wanted".

Could you clarify which part is closed source?

@goretkin The code that is in Microsoft.VSCode.CPP.Extension.* and Microsoft.VSCode.CPP.IntelliSense.Msvc.*.

It's not entirely clear from the opening post, but this issue is about making the outline hierarchical, right?

@CelticMinstrel Hierarchical is one aspect, but other issues would be fixed as well via switching to the newer API that returns more info about symbol ranges, such as breadcrumbs.

Oh yeah, I noticed when the new breadcrumbs showed up that it doesn't tell me which function I'm in.

Please support

the outline should not be plain, it shall be a tree like view that have the member/methods unders the class name . Currently I cannot find a specified method through the outline as many similar classes are in one big cpp file

The fix for this will be in 0.26.0.

Improved document symbols are available with 0.26.0.

@sean-mcmanus I am using 0.26.0 but the Follow Cursor option in the outline is not working.

This 0.26.0 removed Alt+N C/C++ Navigate...

Is there the new way to do what the 0.25.1 Alt+N keyboard shortcut did?

Ctrl+Shift+O is close to previous functionality, but it seems to have dropped the declaration qualifier that was so you can see the difference between declaration and definition in the symbol list.

@psclkhoury can you open a new issue with more information about your problem? We've tested out the Follow Cursor feature in the Outline view and it is working for us. There may be something special about your code that we're not handling well.
image

@awmorgan, there is a command "Focus Breadcrumbs" that you can use in place of the old Navigate command. The default key combo is CTL+SHIFT+., but you can map that to ALT+N if you prefer that key combo instead.

@bobbrow I realized that it is only not working in some files, I will try to see what is causing it and then open a new issue. Thanks

Was this page helpful?
0 / 5 - 0 ratings