Class WorkspaceEditExtensions
- Namespace
- RDCore.SDK.Server.ProtocolExtensions
- Assembly
- RDCore.SDK.dll
A WorkspaceEdit as a client can apply it (LSP 3.17 §WorkspaceEdit): its documentChanges to a client that said it
takes them (workspace.workspaceEdit.documentChanges), and its changes to any other; its change annotations to a client that said it takes
those (changeAnnotationSupport).
public static class WorkspaceEditExtensions
- Inheritance
-
WorkspaceEditExtensions
- Inherited Members
Remarks
A client that did not say it takes documentChanges reads changes alone, and applies none of an edit that has none. changes are the
edits of each document by its URI: they cannot say which version of a document they are edits of, which the spec allows - such a client applies them to
the text it has - nor that a file is created, renamed or deleted.
An edit that has both is giving its changes as the alternative of its documentChanges, for a client that does not take them: they are the
same edits, and one client is sent one of them.
Methods
For(WorkspaceEdit, ClientCapabilities?)
The edit as the client can apply it.
public static WorkspaceEdit For(this WorkspaceEdit edit, ClientCapabilities? client)
Parameters
editWorkspaceEditThe edit, as the server made it.
clientClientCapabilitiesWhat the client said it can do, as it initialized; none when it is not known, which is a client that takes neither
documentChangesnor change annotations.
Returns
- WorkspaceEdit
To a client that takes
documentChanges: the edit, when it says nothing the client did not say it takes. To any other: itschangesalone, when it has them; otherwise the text edits of itsdocumentChangesaschanges, by document, in the order they were written.To a client that does not take change annotations - and in
changes, which cannot carry them - an edit whose annotation asks the user to confirm it is left out, being one the user would only have applied if they chose to; the others are sent without their annotation.
Exceptions
- WorkspaceEditNotSupportedException
The edit creates, renames or deletes a file, and the client did not say it does that (
documentChangesandresourceOperations); or, to a client that does not takedocumentChanges, it edits one document in more than oneTextDocumentEdit- the second's ranges are of the text the first made, whichchangescannot say.
TakesChangeAnnotations(ClientCapabilities?)
Whether the client said it takes the change annotations of a WorkspaceEdit: an edit it asks its user to confirm, a label it shows.
public static bool TakesChangeAnnotations(this ClientCapabilities? client)
Parameters
clientClientCapabilitiesWhat the client said it can do, as it initialized; none when it is not known.
Returns
- bool
true when it said
workspace.workspaceEdit.changeAnnotationSupport; false when it did not, or is not known.
TakesDocumentChanges(ClientCapabilities?)
Whether the client said it takes the documentChanges of a WorkspaceEdit.
public static bool TakesDocumentChanges(this ClientCapabilities? client)
Parameters
clientClientCapabilitiesWhat the client said it can do, as it initialized; none when it is not known.