-
-
Notifications
You must be signed in to change notification settings - Fork 950
formatter: support TextEdit LSP struct #13629
Description
Starting on working to implement oxfmt into the language server, the first problem I found is that the service of oxfmt will check if the complete source code is changed and modifies it
Lines 67 to 70 in 78a1146
| let code = Formatter::new(&allocator, options).build(&ret.program); | |
| let elapsed = start_time.elapsed(); | |
| let is_changed = source_text != code; |
The Language Server Protocol supports formatting too, but tells the client what to change.
This happens normally with Range/Span and the new source text:
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_formatting
Feature request:
Implement a logic, so the server can send the partial source text, which should be modified, to the client.
Response:
result: TextEdit[] | null describing the modification to the document to be formatted.
error: code and message set in case an exception happens during the formatting request.
Other solution:
Just send the complete text file. Do not know how this will result into text cursor position and maybe other problems.
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackPriority
Start date
Target date
Effort