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:


Answer questions yyoncho

I think this really depends on the server. One case is for example html where the client can't easily determine how words with a - in it should be handled on rename.

So the idea is:

The user is on foo - the server knows that the client can calculate that foo can be calculated by the client and returns defaultBehaviour. The user is on foo-bar - the server knows that the client cannot calculate the proper range and returns it in the response.

Github User Rank List