File tree 2 files changed +13
-2
lines changed
lsp-types/src/Language/LSP/Types
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ type family ResponseResult (m :: Method f Request) :: Type where
193
193
ResponseResult TextDocumentOnTypeFormatting = List TextEdit
194
194
-- Rename
195
195
ResponseResult TextDocumentRename = WorkspaceEdit
196
- ResponseResult TextDocumentPrepareRename = Range |? RangeWithPlaceholder
196
+ ResponseResult TextDocumentPrepareRename = Maybe ( Range |? RangeWithPlaceholder )
197
197
-- FoldingRange
198
198
ResponseResult TextDocumentFoldingRange = List FoldingRange
199
199
ResponseResult TextDocumentSelectionRange = List SelectionRange
Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ inferServerCapabilities clientCaps o h =
153
153
, _documentFormattingProvider = supportedBool STextDocumentFormatting
154
154
, _documentRangeFormattingProvider = supportedBool STextDocumentRangeFormatting
155
155
, _documentOnTypeFormattingProvider = documentOnTypeFormattingProvider
156
- , _renameProvider = supportedBool STextDocumentRename
156
+ , _renameProvider = renameProvider
157
157
, _documentLinkProvider = supported' STextDocumentDocumentLink $ DocumentLinkOptions
158
158
(Just False )
159
159
(supported SDocumentLinkResolve )
@@ -233,6 +233,17 @@ inferServerCapabilities clientCaps o h =
233
233
error " executeCommandCommands needs to be set if a executeCommandHandler is set"
234
234
| otherwise = Nothing
235
235
236
+ clientSupportsPrepareRename = fromMaybe False $
237
+ clientCaps ^? LSP. textDocument . _Just . LSP. rename . _Just . LSP. prepareSupport . _Just
238
+
239
+ renameProvider
240
+ | clientSupportsPrepareRename
241
+ , supported_b STextDocumentRename
242
+ , supported_b STextDocumentPrepareRename = Just $
243
+ InR . RenameOptions Nothing . Just $ True
244
+ | supported_b STextDocumentRename = Just (InL True )
245
+ | otherwise = Just (InL False )
246
+
236
247
sync = case textDocumentSync o of
237
248
Just x -> Just (InL x)
238
249
Nothing -> Nothing
You can’t perform that action at this time.
0 commit comments