Debian Codegraph @

LspCpp/include/LibLsp/lsp/location_type.h

raw
1 #pragma once
2
3 #include "lsDocumentUri.h"
4 #include "lsRange.h"
5 //Represents a location inside a resource, such as a line inside a text file.
6 struct lsLocation
7 {
8 lsLocation();
9 lsLocation(lsDocumentUri uri, lsRange range);
10
11 bool operator==(lsLocation const& other) const;
12 bool operator<(lsLocation const& o) const;
13
14 lsDocumentUri uri;
15 lsRange range;
16 MAKE_SWAP_METHOD(lsLocation, uri, range)
17 };
18 MAKE_REFLECT_STRUCT(lsLocation, uri, range)
19
20 struct LinkLocation : public lsLocation
21 {
22 std::string displayName;
23 std::string kind;
24 MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName, kind)
25 };
26 MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName, kind)
27
28 //Represents a link between a sourceand a target location.
29 struct LocationLink
30 {
31 /**
32 * Span of the origin of this link.
33 *
34 * Used as the underlined span for mouse interaction. Defaults to the word range at
35 * the mouse position.
36 */
37 optional<lsRange> originSelectionRange;
38
39 /**
40 * The target resource identifier of this link.
41 */
42
43 lsDocumentUri targetUri;
44
45 /**
46 * The full target range of this link. If the target for example is a symbol then target range is the
47 * range enclosing this symbol not including leading/trailing whitespace but everything else
48 * like comments. This information is typically used to highlight the range in the editor.
49 */
50
51 lsRange targetRange;
52
53 /**
54 * The range that should be selected and revealed when this link is being followed, e.g the name of a function.
55 * Must be contained by the the `targetRange`. See also `DocumentSymbol#range`
56 */
57
58 lsRange targetSelectionRange;
59
60 MAKE_SWAP_METHOD(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange);
61 };
62 MAKE_REFLECT_STRUCT(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange);