Skip to content

Commit ef9a89e

Browse files
committed
Fix document changes version bug
1 parent bcca365 commit ef9a89e

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

src/StaticLS/ProtoLSP.hs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import Data.HashMap.Strict (HashMap)
3737
import Data.HashMap.Strict qualified as HashMap
3838
import Data.LineCol (LineCol (..))
3939
import Data.LineColRange
40+
import Data.Map qualified as Map
4041
import Data.Path (AbsPath)
4142
import Data.Path qualified as Path
4243
import Data.Pos
@@ -154,23 +155,18 @@ editToProto rope edit =
154155
changeToProto rope <$> Edit.getChanges edit
155156

156157
-- TODO: convert fsEdits
158+
157159
sourceEditToProto :: SourceEdit -> StaticLsM LSP.WorkspaceEdit
158160
sourceEditToProto SourceEdit {fileEdits} = do
159-
documentChanges <- for (HashMap.toList fileEdits) \(path, edit) -> do
161+
changesKVs <- for (HashMap.toList fileEdits) $ \(path, edit) -> do
160162
rope <- IDE.Monad.getSourceRope path
161-
pure
162-
LSP.TextDocumentEdit
163-
{ _textDocument =
164-
LSP.OptionalVersionedTextDocumentIdentifier
165-
{ _uri = absPathToUri path
166-
, _version = LSP.InR LSP.Null
167-
}
168-
, _edits = LSP.InL <$> editToProto rope edit
169-
}
163+
let edits = editToProto rope edit
164+
pure (absPathToUri path, edits)
165+
170166
pure
171167
LSP.WorkspaceEdit
172-
{ _changes = Nothing
173-
, _documentChanges = Just (fmap LSP.InL documentChanges)
168+
{ _changes = Just (Map.fromList changesKVs)
169+
, _documentChanges = Nothing
174170
, _changeAnnotations = Nothing
175171
}
176172

0 commit comments

Comments
 (0)