ycm-core / ycmd

A code-completion & code-comprehension server
https://ycm-core.github.io/ycmd/
GNU General Public License v3.0
1.69k stars 764 forks source link

[READY] Prefer selectionRange over range in LSP Location-like objects #1744

Closed bstaletic closed 3 months ago

bstaletic commented 3 months ago

Currently, the LSP specification uses selectionRange in only three places:

  1. In selectionRange requests
  2. In hierarchy items
  3. In DocumentSymbol

Since ycmd does not support the first and the third point, we can ignore them..

As for hierarchy items, range property is meant to span the entire symbol definition, while selectionRange property is meant to span just the identifier of a symbol. Note that range also can include a docstring preceeding a function definition. That means that symbol[ 'range' ][ 'start' ] might be pointing at the start of a docstring, instead of pointing at the function name.

Current behaviour of the tested servers:

Not handling selectionRange properly leads to at least two problems:

  1. In hierarchy requests, the description of the root node can be wrong.
  2. Requesting outgoing calls of an incoming call picks the wrong location altogether.

This change is Reviewable

bstaletic commented 3 months ago

Already discussed and a different approach was decided for #1733 Closing.