summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/location_type.h
blob: 14e130f5719a009933d914291792438abdfeca18 (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
#pragma once

#include "lsDocumentUri.h"
#include "lsRange.h"
//Represents a location inside a resource, such as a line inside a text file.
struct lsLocation {
	lsLocation();
	lsLocation(lsDocumentUri uri, lsRange range);

	bool operator==(const lsLocation& other) const;
	bool operator<(const lsLocation& o) const;

	lsDocumentUri uri;
	lsRange range;
	MAKE_SWAP_METHOD(lsLocation, uri, range)
};
MAKE_REFLECT_STRUCT(lsLocation, uri, range)



struct LinkLocation :public lsLocation
{
	std::string displayName;
	std::string kind;
	MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName, kind)
};
MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName,kind)

//Represents a link between a sourceand a target location.
struct LocationLink
{
	/**
	 * Span of the origin of this link.
	 *
	 * Used as the underlined span for mouse interaction. Defaults to the word range at
	 * the mouse position.
	 */
	boost::optional<lsRange>  originSelectionRange;

	/**
	 * The target resource identifier of this link.
	 */

	lsDocumentUri targetUri;

	/**
	 * The full target range of this link. If the target for example is a symbol then target range is the
	 * range enclosing this symbol not including leading/trailing whitespace but everything else
	 * like comments. This information is typically used to highlight the range in the editor.
	 */

	lsRange targetRange;

	/**
	 * The range that should be selected and revealed when this link is being followed, e.g the name of a function.
	 * Must be contained by the the `targetRange`. See also `DocumentSymbol#range`
	 */

	lsRange targetSelectionRange;

	MAKE_SWAP_METHOD(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange);
};
MAKE_REFLECT_STRUCT(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange);