Skip to content

Commit ae89bbc

Browse files
committed
Fix bug in diffOperationToTextEdit
The original lineno extracted from the Addition DiffOperation needs to be increased by 1.
1 parent 3a6874d commit ae89bbc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Ide/PluginUtils.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ diffTextEdit fText f2Text withDeletions = J.List r
6767
(J.Position el 0)
6868

6969
diffOperationToTextEdit (Addition fm l) = J.TextEdit range nt
70-
-- fm has a range wrt to the changed file, which starts in the current file at l
71-
-- So the range has to be shifted to start at l
70+
-- fm has a range wrt to the changed file, which starts in the current file at l + 1
71+
-- So the range has to be shifted to start at l + 1
7272
where
7373
range = J.Range (J.Position (l' - 1) 0)
7474
(J.Position (l' - 1) 0)
75-
l' = max l sl -- Needed to add at the end of the file
75+
l' = max (l + 1) sl -- Needed to add at the end of the file
7676
sl = fst $ lrNumbers fm
7777
nt = T.pack $ unlines $ lrContents fm
7878

@@ -109,4 +109,4 @@ clientSupportsDocumentChanges caps =
109109
WorkspaceEditClientCapabilities mDc <- _workspaceEdit wCaps
110110
mDc
111111
in
112-
fromMaybe False supports
112+
fromMaybe False supports

0 commit comments

Comments
 (0)