Skip to content

Commit

Permalink
Remove deprecated rangeLength (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
Astavie authored Jul 6, 2023
1 parent 4b17be5 commit 9a663e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/main/java/org/javacs/FileStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,17 @@ private static String patch(String sourceText, TextDocumentContentChangeEvent ch
writer.write(change.text);

// Skip replaced text
reader.skip(change.rangeLength);
if (change.range.start.line == change.range.end.line) {
int chars = change.range.end.character - change.range.start.character;
reader.skip(chars);
} else {
int lines = change.range.end.line - change.range.start.line;
int chars = change.range.end.character;
for (int lineSkip = 0; lineSkip < lines; lineSkip++) {
reader.readLine();
}
reader.skip(chars);
}

// Write remaining text
while (true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

public class TextDocumentContentChangeEvent {
public Range range;
public Integer rangeLength;
public String text;
}

0 comments on commit 9a663e8

Please sign in to comment.