File: lsTextEdit.h

package info (click to toggle)
asymptote 3.02%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 33,400 kB
  • sloc: cpp: 172,516; ansic: 69,728; python: 14,967; sh: 5,599; javascript: 4,866; lisp: 1,507; perl: 1,417; makefile: 1,028; yacc: 610; lex: 449; xml: 182; asm: 8
file content (80 lines) | stat: -rw-r--r-- 2,593 bytes parent folder | download | duplicates (2)
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
#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.
         */
    optional<bool> needsConfirmation;

    /**
         * A human-readable string which is rendered less prominent in
         * the user interface.
         */
    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.
 */
    optional<lsChangeAnnotationIdentifier> annotationId;

    bool operator==(lsTextEdit const& that);
    std::string ToString() const;
    MAKE_SWAP_METHOD(lsTextEdit, range, newText, annotationId)
};
MAKE_REFLECT_STRUCT(lsTextEdit, range, newText, annotationId)

using lsAnnotatedTextEdit = lsTextEdit;