Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Outliner is flat list, should be tree view #74

Closed
polarathene opened this issue Apr 15, 2018 · 6 comments
Closed

Outliner is flat list, should be tree view #74

polarathene opened this issue Apr 15, 2018 · 6 comments
Labels

Comments

@polarathene
Copy link

polarathene commented Apr 15, 2018

On the Atom IDE page, the outline view not only has some colouring, but items in the list are nested where appropriate. In my current file, a struct is listed with it's properties below it, but with no nesting, they're all presented at the same top level?

This enhancement was mentioned in a previous issue: #58 (comment) about filtering out local variables.

@alexheretic
Copy link
Member

The story is a little messy here. I asked pretty much the same thing not long ago.

The immediate cause is Rls not sending back the containerName field in the outline data, so atom-ide-ui cannot infer the hierarchy.

Muddying the mix; according to the protocol you aren't supposed to use containerName this way, this makes it harder for the Rls project to want to support it. Regardless, atom-ide-ui does use containerName because it works.

Fixing rust-lang/rls#86 is likely the way forward. ide-rust itself is just the middle man here.

@polarathene
Copy link
Author

polarathene commented Apr 15, 2018

Two comments in the issue below brought up the topic:

atom/atom-languageclient#116 (comment)

My concern is that the protocol explicitly warns against this behaviour: https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#document-symbols-request

The document symbol request is sent from the client to the server to return a flat list of all symbols found in a given text document. Neither the document's location range nor the documents container name should be used to reinfer a hierarchy.

atom/atom-languageclient#116 (comment)

It doesn't explain why you can't infer a hierarchy from this information.

Our implementation is based on v2 of this API which includes no such disclaimer https://github.com/Microsoft/language-server-protocol/blob/master/versions/protocol-2-x.md

First docs link on the protocol is no longer valid, docs for LSP are hosted here, currently v3.7 with the same text as first quoted comment.

Python Language Server has taken an approach to get a hierarchy as the linked issue discusses, merged PR here: palantir/python-language-server#176

The story is a little messy here. I asked pretty much the same thing not long ago.

That's the exact same issue/comment I linked to :P

It's unfortunate if the information available to atom-ide-rust is not enough to better display the outline as it's not so useful of a tool as it is. My current project fills the list with constants, enums and structs with values/fields, the latter which might be possible to nest to their enum/struct if the information is there.

@alexheretic
Copy link
Member

alexheretic commented Apr 15, 2018

Thanks, this is a useful collection of the relevant info.

Ultimately containerName is in the spec so there is nothing really stopping Rls from populating it. Of course, other than that someone needs to do the work and raise a pr over there.

@alexheretic
Copy link
Member

We have a clearer idea of the changes needed to rls to achieve this now rust-lang/rls#86 (comment).

@polarathene
Copy link
Author

That's great news! :) Looking forward to an improved outliner!

@alexheretic
Copy link
Member

ide-rust has moved to using rust-analyzer instead of RLS.

I'll close this issue for now, please open a new issue relating to rust-analyzer improvements.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants