blob: 8785e0dcbc385b3c898b15d4fefe643a7718d767 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#pragma once
#include "LibLsp/JsonRpc/serializer.h"
#include <string>
#include "lsRange.h"
//Since 3.16.0 there is also the concept of an annotated text edit which supports to add an annotation to a text edit.
//The annotation can add information describing the change to the text edit.
/**
* Additional information that describes document changes.
*
* @since 3.16.0
*/
struct lsChangeAnnotation
{
/**
* A human-readable string describing the actual change. The string
* is rendered prominent in the user interface.
*/
std::string label;
/**
* A flag which indicates that user confirmation is needed
* before applying the change.
*/
boost::optional<bool> needsConfirmation;
/**
* A human-readable string which is rendered less prominent in
* the user interface.
*/
boost::optional < std::string > description;
MAKE_REFLECT_STRUCT(lsChangeAnnotation, label, needsConfirmation, description)
};
MAKE_REFLECT_STRUCT(lsChangeAnnotation, label, needsConfirmation, description)
//Usually clients provide options to group the changes along the annotations they are associated with.
//To support this in the protocol an edit or resource operation refers to a change annotation
//using an identifier and not the change annotation literal directly.This allows servers to use
//the identical annotation across multiple edits or resource operations which then allows clients
//to group the operations under that change annotation.The actual change annotations together with
//their identifers are managed by the workspace edit via the new property changeAnnotations.
/**
* An identifier referring to a change annotation managed by a workspace
* edit.
*
* @since 3.16.0.
*/
using lsChangeAnnotationIdentifier = std::string;
/**
* A special text edit with an additional change annotation.
*
* @since 3.16.0.
*/
//A textual edit applicable to a text document.
struct lsTextEdit {
// The range of the text document to be manipulated. To insert
// text into a document create a range where start === end.
lsRange range;
// The string to be inserted. For delete operations use an
// empty string.
std::string newText;
/**
* The actual annotation identifier.
*/
boost::optional<lsChangeAnnotationIdentifier> annotationId;
bool operator==(const lsTextEdit& that);
std::string ToString() const;
MAKE_SWAP_METHOD(lsTextEdit, range, newText, annotationId)
};
MAKE_REFLECT_STRUCT(lsTextEdit, range, newText, annotationId)
using lsAnnotatedTextEdit = lsTextEdit;
|