@@ -37,6 +37,7 @@ import Data.HashMap.Strict (HashMap)
3737import Data.HashMap.Strict qualified as HashMap
3838import Data.LineCol (LineCol (.. ))
3939import Data.LineColRange
40+ import Data.Map qualified as Map
4041import Data.Path (AbsPath )
4142import Data.Path qualified as Path
4243import Data.Pos
@@ -154,23 +155,18 @@ editToProto rope edit =
154155 changeToProto rope <$> Edit. getChanges edit
155156
156157-- TODO: convert fsEdits
158+
157159sourceEditToProto :: SourceEdit -> StaticLsM LSP. WorkspaceEdit
158160sourceEditToProto 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