Fix for indention issue#617
Conversation
Signed-off-by: Sheng Chen <sheche@microsoft.com>
| let startCharacterNum = changes[0].range.start.character; | ||
| let endLineNum = startLineNum; | ||
| for (let newText of changes) { | ||
| endLineNum += newText.newText.split('\n').length - 1; |
There was a problem hiding this comment.
What if the line delimiter is \r\n? The solution is probably platform dependent
There was a problem hiding this comment.
Ok, let me change it to split(/\r?\n/)
|
The PR seems to work as expected so far. Except for the potential line-delimiter issue, my main concern is about the use of seemingly random (it's not) index values while manipulating objects. |
Signed-off-by: Sheng Chen <sheche@microsoft.com>
Signed-off-by: Sheng Chen <sheche@microsoft.com>
Signed-off-by: Sheng Chen <sheche@microsoft.com>
|
@fbricon Updated the code to support the discontinuous condition. Sometimes the server side may response multiple ranges which are discontinuous. We need to range format each of them separately. |
|
Testing that fix, I found that formatting with tabs always uses spaces instead. See eclipse-jdtls/eclipse.jdt.ls#775 |
A workaround for issue #557.
For now, just send a range format request after
workspace.applyEdit()Some GIFs for illustration:
Add unimplemented methods
Extract to local variable
Extract to constant
Extract to method