Skip to content

Commit 1276ded

Browse files
authored
More precise types for client and server rename capabilities (#31)
This is a continuation to #30. Apparently, nvim and emacs treat rename capabilities a bit differently which is why I didn't notice the problem before I tried using Marksman with Emacs.
1 parent 078ec02 commit 1276ded

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/Types.fs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,19 @@ type InlayHintClientCapabilities =
709709
/// hint.
710710
ResolveSupport: InlayHintClientCapabilitiesResolveSupport option }
711711

712+
type RenameClientCapabilities =
713+
{ /// Whether rename supports dynamic registration.
714+
DynamicRegistration: bool option
715+
/// Client supports testing for validity of rename operations before execution.
716+
/// @since version 3.12.0
717+
PrepareSupport: bool option
718+
/// Whether the client honors the change annotations in text edits and resource operations
719+
/// returned via the rename request's workspace edit by for example presenting the workspace
720+
/// edit in the user interface and asking for confirmation.
721+
///
722+
/// @since 3.16.0
723+
HonorsChangeAnnotations: bool option }
724+
712725
/// Text document specific client capabilities.
713726
type TextDocumentClientCapabilities =
714727
{ Synchronization: SynchronizationCapabilities option
@@ -756,7 +769,7 @@ type TextDocumentClientCapabilities =
756769
DocumentLink: DynamicCapabilities option
757770

758771
/// Capabilities specific to the `textDocument/rename`
759-
Rename: DynamicCapabilities option
772+
Rename: RenameClientCapabilities option
760773

761774
/// Capabilities for the `textDocument/foldingRange`
762775
FoldingRange: FoldingRangeCapabilities option
@@ -989,6 +1002,13 @@ type WorkspaceServerCapabilities =
9891002
FileOperations: WorkspaceFileOperationsServerCapabilities option }
9901003
static member Default = { WorkspaceFolders = None; FileOperations = None }
9911004

1005+
1006+
/// RenameOptions may only be specified if the client states that it supports prepareSupport in its
1007+
/// initial initialize request.
1008+
type RenameOptions =
1009+
{ /// Renames should be checked and tested before being executed.
1010+
PrepareProvider: bool option }
1011+
9921012
type ServerCapabilities =
9931013
{ /// Defines how text documents are synced. Is either a detailed structure defining each notification or
9941014
/// for backwards compatibility the TextDocumentSyncKind number.
@@ -1040,7 +1060,7 @@ type ServerCapabilities =
10401060
DocumentOnTypeFormattingProvider: DocumentOnTypeFormattingOptions option
10411061

10421062
/// The server provides rename support.
1043-
RenameProvider: bool option
1063+
RenameProvider: U2<bool, RenameOptions> option
10441064

10451065
/// The server provides document link support.
10461066
DocumentLinkProvider: DocumentLinkOptions option

0 commit comments

Comments
 (0)