File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
lsp-types/src/Language/LSP/Types Expand file tree Collapse file tree 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
193193 ResponseResult TextDocumentOnTypeFormatting = List TextEdit
194194 -- Rename
195195 ResponseResult TextDocumentRename = WorkspaceEdit
196- ResponseResult TextDocumentPrepareRename = Range |? RangeWithPlaceholder
196+ ResponseResult TextDocumentPrepareRename = Maybe ( Range |? RangeWithPlaceholder )
197197 -- FoldingRange
198198 ResponseResult TextDocumentFoldingRange = List FoldingRange
199199 ResponseResult TextDocumentSelectionRange = List SelectionRange
Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ inferServerCapabilities clientCaps o h =
153153 , _documentFormattingProvider = supportedBool STextDocumentFormatting
154154 , _documentRangeFormattingProvider = supportedBool STextDocumentRangeFormatting
155155 , _documentOnTypeFormattingProvider = documentOnTypeFormattingProvider
156- , _renameProvider = supportedBool STextDocumentRename
156+ , _renameProvider = renameProvider
157157 , _documentLinkProvider = supported' STextDocumentDocumentLink $ DocumentLinkOptions
158158 (Just False )
159159 (supported SDocumentLinkResolve )
@@ -233,6 +233,17 @@ inferServerCapabilities clientCaps o h =
233233 error " executeCommandCommands needs to be set if a executeCommandHandler is set"
234234 | otherwise = Nothing
235235
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+
236247 sync = case textDocumentSync o of
237248 Just x -> Just (InL x)
238249 Nothing -> Nothing
You can’t perform that action at this time.
0 commit comments