Background
Original reported by @nrayburn-tech in oxc-project/oxc-intellij-plugin#477 (comment)
Setup
oxfmt setting endOfLine: 'crlf'
- File content with LF, example
debugger;\ndebugger;\n
Problem
When formatting the file will, oxfmt --lsp will generate internally debugger;\r\ndebugger;\r\n.
Then it calculates the minimal text edit.
The minimal text edit on this example is: \r\ndebugger;\r.
The result is returned to the editor.
The editor now sees the solo \r at the end, and will append a second line, next to the \n line.
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#textDocuments
Positions are line end character agnostic, so you cannot specify a position that denotes \r|\n or \n| where | represents the character offset.
Expected
The minimal text edit should be \r\ndebugger;\r\n, and covering the \n position too, so the editor knows that we want to replace the line, instead of appending one.
Background
Original reported by @nrayburn-tech in oxc-project/oxc-intellij-plugin#477 (comment)
Setup
oxfmtsettingendOfLine: 'crlf'debugger;\ndebugger;\nProblem
When formatting the file will,
oxfmt --lspwill generate internallydebugger;\r\ndebugger;\r\n.Then it calculates the minimal text edit.
The minimal text edit on this example is:
\r\ndebugger;\r.The result is returned to the editor.
The editor now sees the solo
\rat the end, and will append a second line, next to the\nline.https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#textDocuments
Expected
The minimal text edit should be
\r\ndebugger;\r\n, and covering the\nposition too, so the editor knows that we want to replace the line, instead of appending one.