-
Notifications
You must be signed in to change notification settings - Fork 799
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 TreeItem API/provider #253
Comments
Just to note, I think the existing "documentSymbols" is almost exactly the right API to provide an "Outline View" as used in Atom, IntelliJ, Eclipse, VisualStudio. The only thing it needs is one small addition: it currently emits Anyway, I don't actually understand what "TreeItem" is for or what it looks like, and didn't get enough understanding from those two links. But I wanted to flag that if it's a tree for outline view, then I think we should tread carefully. |
It's for any kind of tree that might be useful in the Explorer view: alternative file explorer, project navigation, convenient command pane, etc. General purpose. |
However, I should clarify that I don't necessarily think this should be a core part of the LSP. Since this is a VS Code UI feature and not necessarily something that's generally applicable to editors, not sure if it makes sense as a first-class member of the protocol. That's just my opinion, though, I'd be fine if there was first-class support for tree views since I'm going to implement in my language server either way :) |
fyi @jrieken |
Yeah it is basically a vscode only feature but I think it would actually be quite useful in any generic editor. And as servers & clients both don't need to support all features I don't think it would hurt to add it. It isn't a big deal if it doesn't get added as we can add it with custom functions. Usage example for this feature is for example a nodejs dependency viewer like in the visual studio plugin or a dependency viewer (also like in visual studio), just this could be used and customized by language server authors. |
I fully support previous comment from @daviwil . The TreeItem from VSCode, as I understand it, doesn't seem at all related to programming languages but more an advanced widget in VSCode for rendering trees (like other UI toolkits may already have). It's more specific to VSCode's UI layer than a feature of an IDE related to a programming language. I don't think it makes sense in the LSP. There are already multiple solutions to build a nice and complete tree from the
Adding stuff that's not consistent is making the API a bit messier and then harder to evolve and maintain. We should avoid being to greedy and keep focused on finding operations or notifications that makes sense for an IDE to request to a language. |
Having something like an outline view is tracked here: microsoft/vscode#5605. Indeed, there are already extensions using the tree API and api command to get to an outline view. I think that is a valid stepping-stone until we are tackling that in the provider-spirit. By that I mean, will spec a new
That is correct. The |
So it seems like we all agree it's a vscode request ;) Should we close this issue? |
Yeah, I'd say it will be better to track this in the vscode-repo. Ideas is to branch out from the catch-all-issue, with define provider and data model, define bread-crumbs ui, define tree ui |
@mickaelistria I'm looking at the eclipse implementation of reconstructing outline view from documentSymbols. This implementation trusts that the "location.range" returned from documentSymbols will be the range of the entire symbol, from the start of line 10 right up to the end of line 40 in the code below.
Is that really correct? My understanding was that documentSymbols returns the range purely of the symbol identifier itself, purely the range of the |
Not sure it's correct conforming to the LSP spec, but at least, it works for VSCode CSS, JSon and HTML language servers. But I agree there are some good reasons to doubt about it ;) |
I agree that we should close the issue and will do so. The design goal of the LSP was to provide language 'smartness' that can be shared between tools not to implement UI that can be shared between tools. I think there is some space for shared descriptive UI as well but I would argue that this should be a different protocol than LSP. |
TreeItems got added to 1.13
https://code.visualstudio.com/docs/extensionAPI/vscode-api#TreeItem
https://code.visualstudio.com/docs/extensionAPI/extension-points#_contributesviews
The text was updated successfully, but these errors were encountered: