-
Notifications
You must be signed in to change notification settings - Fork 441
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
Add support to view inherited members #2342 #2590
base: master
Are you sure you want to change the base?
Conversation
5033b82
to
aa7b6e0
Compare
@rgrunber please have a look at the patch and let me know what you think ? |
dad7afa
to
8d52ed3
Compare
Is it possible to display them in the My thought is: we can register a switch button at the navigation bar of the
Then JDT.LS will provide different content based on current mode. |
@jdneo You mean using the new ls extension method ? |
Not exactly. I'm thinking that we should use the existing LSP request for document symbols. At JDT.LS side, it will store a preference saying that which mode is enabled now (show inherited members or not) and return the response accordingly. |
@jdneo ahhh i see, thats sounds neat. I can have a look at it this weekend. |
BTW, one thing might be tricky and risk: I'm not sure if it's possible to let outline view do a refresh programmatically. Since when the mode is changed, the content needs to do a refresh. Seems impossible now: microsoft/vscode#108722 |
@jdneo the refreshing is a issue. One possibility is try to trigger a file change event, but I couldn’t find a way to that either. Another issue is when we add the menu item into view/title it is also shown for other languages as well, I couldn’t find away to remove or disable it based on the active editor which is presented by outline. Even finding a way to disable it, it will be shown for all languages. Therefore it seems to be better that showing inherited members comes from vscode it self so we have more control over the action/menus. |
Will adding But the 'refresh' blocks us anyway. What if we do not expose the shortcut at the navigation bar of the outline view? Instead, we just exposing a setting first. Because when user is changing the setting's value, the user must switch between editors and the change of the editor will kick off a new document symbol request (if I remeber it correctly) and thus refresh the outline view? |
No it doesn't work. Seems like editorLangId is not present I this view context.
I can try that out and see if it solves. |
I tried the approach you mentioned @jdneo. We have few issues
Therefore I guess for now we can only have our own outline UI with our own LS extension since otherwise the document symbol quick picker will have symbols which cannot be navigated to. WDYT ? |
@gayanper, thank you for trying that approach! I filed an issue at VS Code repo about the uri support for document symbol: microsoft/vscode#157461
Yes, looks like in short term we have to forget about the integrated outline view 😥. The reference view in your initial commit might be an option. @testforstephen @rgrunber What do you think? Should we go forward to use reference view to show the inherited members, or we wait for VS Code team's opinion a little bit then decide where will we go? |
The upstream request is in the stage of collecting upvotes now. For anyone want to have this capability, please vote (👍) at microsoft/vscode#157461. |
The change works pretty well for me. I would be fine with reviewing the 2 contributions (JDT-LS + vscode-java) to at least get this merged until we can use the outline view instead. We could then also add some of the options available to the outline view. (eg. sort elements, exclude fields, static members, non-public members, etc.) Overall though, it would be nice to expose the "extended members" from the symbol outline of the command palette This is the closest thing to |
Hello, can we please have this merged? Thanks! |
The reference view API is used to show the document outline with inherited symbols using the new java.ls extension method. Signed-off-by: Gayan Perera <[email protected]>
75e11b9
to
9ec8a5a
Compare
Looks like the API change for outline view won't happen in the near future, we can go with the reference view now. I'll review this PR recently. |
} | ||
|
||
const params: DocumentSymbolParams = { | ||
textDocument: TextDocumentIdentifier.create(this.location.uri.toString()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we do not persist the document location as a member, but always get the active document's uri (if it's available and is a java-like file).
By doing this, after user changes focus to another java file, he can click the refresh button to get the extended outline for the new file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do so will it be violating the intended API usage ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean the API of the reference view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the reference view's API does not ban us to do so?
What we need is just change textDocument: TextDocumentIdentifier.create(this.location.uri.toString())
to textDocument: TextDocumentIdentifier.create(window.activeEditor.document.uri.toString())
with some checks before to make sure the document is available and is a java-like file.
@@ -543,6 +544,17 @@ export class StandardLanguageClient { | |||
} | |||
})); | |||
|
|||
context.subscriptions.push(commands.registerCommand(Commands.SHOW_EXTEND_OUTLINE, (location: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides register a command to let user trigger manually. Is it possible that when we received an active editor change event (window.onDidChangeActiveTextEditor
), we help user to auto refresh the extended outline view if it's expanded now. - need to check if the reference view api has such capability to let us check its expand status.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CsCherrYY Do you know how to get the expand status of the reference view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no such API in specific reference view extension. Since reference view is a tree view isself, maybe there is some status we can get from that tree view?
@CsCherrYY @rgrunber @jdneo @testforstephen I would like to reiterate on this. I was looking into vscode quick outline and outline view are more build toward the document outline. Therefore my new suggestion is, we introduce outline hierarchy similar to call hierarchy or type hierarchy as a separate command. We can use the same reference view to start with. WDYT ? |
@gayanper I'm fine with that approach. It looks like the VS Code team will expose the required APIs for the outline view. We can go with the reference view first. |
May this feature please be merged? :) |
The reference view API is used to show the document outline with inherited
symbols using the new java.ls extension method.
Signed-off-by: Gayan Perera [email protected]