-
Notifications
You must be signed in to change notification settings - Fork 803
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
textDocumentPositionParams: add optional range #2027
base: gh-pages
Are you sure you want to change the base?
Conversation
This change adds an optional range field to textDocumentPositionParams so that clients can, for example, query a subexpression such as x.f within a larger expression g(x.f[i]). Also, clarify the text about cursor bias. Fixes microsoft#377 Fixes microsoft#1029
@microsoft-github-policy-service agree company="Google" |
@adonovan to merge something into the spec we usually require an implementation in at least one client. Are you willing to provide that as well. And I was wondering if we at least should flag this as a feature / capability from the client side so that the servers know what to expect. In VS Code for example there will be a lot of cases where we can't fill in the range since it is not part of the original API request and getting it from the active editor is not possible (e.g. there might not be one, the cursor has been moved, ...) |
I already have an implementation in eglot (Emacs): it's just a few lines.
I don't think this needs to be a capability; it's just an optional field, and its type tells the server that it can't be relied upon. |
Sorry for not providing it earlier, but here's the diff to eglot: (defun eglot--TextDocumentPositionParams ()
"Compute TextDocumentPositionParams."
(list :textDocument (eglot--TextDocumentIdentifier)
- :position (eglot--pos-to-lsp-position)))
+ :position (eglot--pos-to-lsp-position))
+ (if (region-active-p)
+ (list :range
+ (list :start (eglot--pos-to-lsp-position (region-beginning))
+ :end (eglot--pos-to-lsp-position (region-end))))))) |
Is there anything we can do to help move this process along? |
The "one client" seems always mean vscode. |
This change adds an optional range field to textDocumentPositionParams so that clients can, for example, query a subexpression such as x.f within a larger expression g(x.f[i]).
Also, clarify the text about cursor bias.
Fixes #377
Fixes #1029