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

Provide guidance to language and extension authors #11587

Closed
eamodio opened this issue Sep 6, 2016 · 6 comments
Closed

Provide guidance to language and extension authors #11587

eamodio opened this issue Sep 6, 2016 · 6 comments
Assignees
Labels
api feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code
Milestone

Comments

@eamodio
Copy link
Contributor

eamodio commented Sep 6, 2016

  • VSCode Version: Version 1.5.0-insider (1.5.0-insider) 538cd9d
  • OS Version: OS X El Capitan Version 10.11.6 (15G31)

Given the power of the abstractions that vscode provides for symbols, definitions, references, etc, I think it would be great if there was some guidance (best practices) documentation on how a language should provide the information. For example, when implementing a DocumentSymbolProvider what should the range be of the symbol? TypeScript/JavaScript/JSON seem to include the body of a symbol (that has one), where as C# (Omnisharp) only provides a range covering just the keyword alone. Which one is right or more accurately which one is provides more to build upon and should be considered the better practice.

Also along the same lines -- there is a LOT of power in the vscode.executeDocumentSymbolProvider, vscode.executeReferenceProvider, and others, but from the documentation I don't think it is really clear. For example, utilizing both vscode.executeDocumentSymbolProvider and vscode.executeReferenceProvider together, once should be able to create a single extension to provide usage CodeLens support for any language that supports those providers -- without the need of every language adding that type of support.

Thoughts?

@eamodio
Copy link
Contributor Author

eamodio commented Apr 10, 2017

Related to this I think it would be great if a symbol had 2 ranges:

  1. for the symbol itself (i.e. the keyword)
  2. for the "bounding" range -- the line or set of lines that cover the "contents" of the symbol

I think this would go a long way to help with confusion and differences in what the different language servers provide.

For example, an extension wishing to add a decoration to the symbol keyword would want the a range for the symbol itself, while an extension like GitLens wants the bounding range, so that it can provide rollup information about the symbol contents.

@kieferrm kieferrm assigned jrieken and unassigned kieferrm Apr 21, 2017
@kieferrm kieferrm added the feature-request Request for new features or functionality label Apr 21, 2017
@rcjsuen
Copy link
Contributor

rcjsuen commented Aug 20, 2017

Also see Microsoft/language-server-protocol#132 which also asks for clarity about a symbol's range. I quite like your idea of having two separate ranges to handle this case, @eamodio.

@kieferrm
Copy link
Member

Would it help if we beef up https://code.visualstudio.com/docs/extensionAPI/language-support ?

@rcjsuen
Copy link
Contributor

rcjsuen commented Aug 23, 2017

That would only help if the protocol was also updated and documented such that both VS Code's expectations and the protocol's expectations match. If VS Code is explicit about what it wants but the protocol doesn't then it puts language server authors in a tough spot because they need to consider the behaviour of language clients that aren't VS Code. That to me would kind of defeat the purpose of a language server if I need to worry about the clients that's calling the API.

@KamasamaK
Copy link

KamasamaK commented May 15, 2018

Separating the ranges is a good idea. Another issue when using the entire range of the construct in the SymbolInformation.location is that the "Peek Definition" functionality will highlight the entire block harming readability in my experience since it overwhelms the syntax highlighting (at least with the default theme).

@jrieken jrieken added this to the Backlog milestone Oct 31, 2019
@jrieken jrieken added the *out-of-scope Posted issue is not in scope of VS Code label Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code
Projects
None yet
Development

No branches or pull requests

7 participants
@eamodio @jrieken @kieferrm @mjbvz @rcjsuen @KamasamaK and others