microsoft/vscode-languageserver-node

Implement hierarchical document outline

dbaeumer opened this issue · 8 comments

Implement hierarchical document outline

I've started playing around with this branch in the Haxe language server, working well so far. 👍

One question: is selectionRange implemented yet? Picking a symbol from Ctrl+Shift+O moves the cursor to the start of range (rather than selectionRange as I would have expected). For instance in this case, the selectionRange is foo, yet the cursor is positioned before public which is where range starts:

The selectionRange is used to denote what to do if the cursor moves into the range. In VS Code for example we then select the symbol in the outline. So it is not what the editor selects it is the range the editor is sensitive to the symbol when its selection moves in.

Hm.. I thought that's what range is for?

The range enclosing this symbol not including leading/trailing whitespace but everything else like comments. This information is typically used to determine if the the clients cursor is inside the symbol to reveal in the symbol in the UI.

Sorry. You are correct. I got confused myself.

And yes that should be implemented. It is converted as follows:

		let result = new code.DocumentSymbol(
			value.name,
			value.detail,
			asSymbolKind(value.kind),
			asRange(value.range),
			asRange(value.selectionRange)
		);

can you reproduce this using a non LSP based example?

Yes, this seems more like a VSCode issue: microsoft/vscode#54857

Thanks for testing. I created a new version today which as not official support for document symbol.