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

[documentSymbol] Location ranges should span entire definition #188

Closed
svenefftinge opened this issue Nov 5, 2017 · 3 comments
Closed

Comments

@svenefftinge
Copy link

Since the LSP doesn't provide hierarchical symbols, yet, outline tree implementations for Vs Code, Theia and Eclipse are based on location.ranges to compute parent/child relationship based on nesting. This python LS unfortunately only covers the range of the identifier not the full construct, so it doesn't work here. Other LS implementations provide the full range.

See e.g. https://github.com/patrys/vscode-code-outline/blob/master/src/symbolOutline.ts#L97

@gatesn
Copy link
Contributor

gatesn commented Nov 5, 2017

Can you find a Microsoft implementation of outline view? I'd rather use that as reference for how to interpret something explicitly forbidden in the protocol: https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#document-symbols-request

Some of the comments do hint at the location spanning more than just the identifier name:

The location of this symbol. The location's range is used by a tool
to reveal the location in the editor. If the symbol is selected in the
tool the range's start information is used to position the cursor. So
the range usually spwans more then the actual symbol's name and does
normally include thinks like visibility modifiers.

But then shortly after, inferring hierarchy is disallowed:

The range doesn't have to denote a node range in the sense of a abstract
syntax tree. It can therefore not be used to re-construct a hierarchy of
the symbols.

And this warning is repeated for containerName:

The name of the symbol containing this symbol. This information is for
user interface purposes (e.g. to render a qaulifier in the user interface
if necessary). It can't be used to re-infer a hierarchy for the document
symbols.

@svenefftinge
Copy link
Author

Yes, see also microsoft/language-server-protocol#132.
Still, there is no other practical solution atm and using the ranges seems a viable workaround until the mentioned hierarchy information is made available explicitly.

@gatesn
Copy link
Contributor

gatesn commented Mar 25, 2018

@svenefftinge I can't seem to be able to reproduce this? The ranges PYLS reports (at least now, wonder if Jedi changed?) span the full definition:

screen shot 2018-03-25 at 09 53 19

Please re-open if you're still seeing issues

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

No branches or pull requests

2 participants