You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Annotate references with the name of the entity they occur in #396
The response to textDocument/references is currently just Location[] | null.
However, clients may want to show, for each reference, information such as the name of the entity (e.g. function or class) in which the reference occurs, which they cannot easily compute on the client side.
Could the protocol be extended so the response is something like Reference[] | null, where Reference contains both a Location and possibly extra information like the name of the containing entity?
Reacted by Raja Soufi, Marc Dumais, Momin Khan, Laurynas Lazauskas, Xavier Young, Katarzyna Marek, Peter Fajdiga, Victor Molostov, Robert Findley, Philipp Wagner and 1 more
Having a separate Reference structure is a good idea. There are potentially other interesting information a language server might want to include, for example the access type (read/write/both) in the case of references to a variable.
Reacted by Lars Hvam, Nathan Ridge, Aviv Dolev, jianyongli, Xavier Young and qouteall
I think this proposal could also help in #763
Also, just want to +1 for adding access types (read/get | write/set) - it's super useful during debugging to know the possible places that modify something (rather than just read it).
Another implementation to consider, at least for backward-compatibility, is to keep the current Location[] | null response, and augment the Location type with a metadata field that can hold a key-value map, same way it was done for notebooks:
Another implementation to consider, at least for backward-compatibility, is to keep the current Location[] | null response, and augment the Location type with a metadata field that can hold a key-value map, same way it was done for notebooks
It's equally BC to extend the Location interface with new props isn't it? Old usages can ignore the new props. Less data nesting that way.
Momin Khan (@foolmoron)
Yes it is- just took an example from another extension. Either way will be super helpful.
IMO one advantage for a metadata field is that each language can use its own key-value implementation of metadata, instead of finding some props that are useful to any arbitrary language.
See #1911 for a generalization of 'references' queries to allow servers to offer a variety of other queries that take the same form of input (a selection) and produce the same form of results (a set of [annotated] source locations) so that the client can re-use the same UI machinery for all of them.
All this was to make sure the data is safe in between user and receiver preventing rogue trusted handlers. Giving more to the user and server for safer security. Notebook can be changed to be very trigger happy taking files changing computers codes preventing use from using notebook like it was ment to be used. So I think this is how you protect are data from now on , just saying
Activity
dbaeumer commentedon Apr 9, 2018
I like the idea.
raja-s commentedon Jan 14, 2019
Having a separate
Referencestructure is a good idea. There are potentially other interesting information a language server might want to include, for example the access type (read/write/both) in the case of references to a variable.dbaeumer commentedon Dec 1, 2020
From #1155: a preview in a reference structure would be helpful as well.
avivdolev commentedon Jul 10, 2022
I think this proposal could also help in #763
Also, just want to +1 for adding access types (read/get | write/set) - it's super useful during debugging to know the possible places that modify something (rather than just read it).
Another implementation to consider, at least for backward-compatibility, is to keep the current
Location[] | nullresponse, and augment theLocationtype with ametadatafield that can hold a key-value map, same way it was done for notebooks:foolmoron commentedon Aug 21, 2023
It's equally BC to extend the Location interface with new props isn't it? Old usages can ignore the new props. Less data nesting that way.
avivdolev commentedon Aug 22, 2023
Momin Khan (@foolmoron)
Yes it is- just took an example from another extension. Either way will be super helpful.
IMO one advantage for a metadata field is that each language can use its own key-value implementation of metadata, instead of finding some props that are useful to any arbitrary language.
adonovan commentedon Sep 8, 2024
See #1911 for a generalization of 'references' queries to allow servers to offer a variety of other queries that take the same form of input (a selection) and produce the same form of results (a set of [annotated] source locations) so that the client can re-use the same UI machinery for all of them.
BloodyTalonsHuisman commentedon May 20, 2026
All this was to make sure the data is safe in between user and receiver preventing rogue trusted handlers. Giving more to the user and server for safer security. Notebook can be changed to be very trigger happy taking files changing computers codes preventing use from using notebook like it was ment to be used. So I think this is how you protect are data from now on , just saying