profile
viewpoint

Ask questionsprepareRename: what is defaultBehavior, rationale

LSP 3.16 will introduce a new response to textDocument/prepareRename: defaultBehavior. However, from the spec, I am not 100% sure how to interpret such a response: "if [ ... ] is returned, the rename position is valid and the client should use its default behavior to compute the rename range".

Does this mean that servers could always return defaultBehavior when renaming is possible, or only in some yet-unspecified "obvious" cases, like the c-style identifier under the cursor? Renaming might be more complex in certain cases, e.g. for labels in C/Lua, which should include the colon in the rename range. Should a client then implement language-specific behavior to determine rename ranges?

Also, what is the purpose of this response, and what can be gained by implementing it client-side (to conserve traffic, ...)?

Related discussion: https://github.com/emacs-lsp/lsp-mode/pull/2353#issuecomment-732788423.

microsoft/language-server-protocol

Answer questions dbaeumer

I converted the capability to an enum to make it more clear that the default bahavior is expandable. Fell free to spec some if you client does something different than selecting the language identifier.

useful!
source:https://uonfu.com/
Github User Rank List