-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
selectionrange.go
110 lines (88 loc) · 3.68 KB
/
selectionrange.go
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// SPDX-FileCopyrightText: 2021 The Go Language Server Authors
// SPDX-License-Identifier: BSD-3-Clause
package protocol
// SelectionRangeProviderOptions selection range provider options interface.
type SelectionRangeProviderOptions interface{}
// SelectionRange represents a selection range represents a part of a selection hierarchy.
//
// A selection range may have a parent selection range that contains it.
//
// @since 3.15.0.
type SelectionRange struct {
// Range is the Range of this selection range.
Range Range `json:"range"`
// Parent is the parent selection range containing this range. Therefore `parent.range` must contain this Range.
Parent *SelectionRange `json:"parent,omitempty"`
}
// EnableSelectionRange is the whether the selection range.
type EnableSelectionRange bool
// compile time check whether the EnableSelectionRange implements a SelectionRangeProviderOptions interface.
var _ SelectionRangeProviderOptions = (*EnableSelectionRange)(nil)
// Value implements SelectionRangeProviderOptions interface.
func (v EnableSelectionRange) Value() interface{} {
return bool(v)
}
// NewEnableSelectionRange returns the new EnableSelectionRange underlying types SelectionRangeProviderOptions.
func NewEnableSelectionRange(enable bool) SelectionRangeProviderOptions {
v := EnableSelectionRange(enable)
return &v
}
// SelectionRangeOptions is the server capability of selection range.
type SelectionRangeOptions struct {
WorkDoneProgressOptions
}
// compile time check whether the EnableSelectionRange implements a SelectionRangeProviderOptions interface.
var _ SelectionRangeProviderOptions = (*EnableSelectionRange)(nil)
// Value implements SelectionRangeProviderOptions interface.
func (v *SelectionRangeOptions) Value() interface{} {
return v
}
// NewSelectionRangeOptions returns the new SelectionRangeOptions underlying types SelectionRangeProviderOptions.
func NewSelectionRangeOptions(enableWorkDoneProgress bool) SelectionRangeProviderOptions {
v := SelectionRangeOptions{
WorkDoneProgressOptions: WorkDoneProgressOptions{
WorkDoneProgress: enableWorkDoneProgress,
},
}
return &v
}
// SelectionRangeRegistrationOptions is the server capability of selection range registration.
type SelectionRangeRegistrationOptions struct {
SelectionRangeOptions
TextDocumentRegistrationOptions
StaticRegistrationOptions
}
// compile time check whether the SelectionRangeRegistrationOptions implements a SelectionRangeProviderOptions interface.
var _ SelectionRangeProviderOptions = (*SelectionRangeRegistrationOptions)(nil)
// Value implements SelectionRangeProviderOptions interface.
func (v *SelectionRangeRegistrationOptions) Value() interface{} {
return v
}
// NewSelectionRangeRegistrationOptions returns the new SelectionRangeRegistrationOptions underlying types SelectionRangeProviderOptions.
func NewSelectionRangeRegistrationOptions(enableWorkDoneProgress bool, selector DocumentSelector, id string) SelectionRangeProviderOptions {
v := SelectionRangeRegistrationOptions{
SelectionRangeOptions: SelectionRangeOptions{
WorkDoneProgressOptions: WorkDoneProgressOptions{
WorkDoneProgress: enableWorkDoneProgress,
},
},
TextDocumentRegistrationOptions: TextDocumentRegistrationOptions{
DocumentSelector: selector,
},
StaticRegistrationOptions: StaticRegistrationOptions{
ID: id,
},
}
return &v
}
// SelectionRangeParams represents a parameter literal used in selection range requests.
//
// @since 3.15.0.
type SelectionRangeParams struct {
WorkDoneProgressParams
PartialResultParams
// TextDocument is the text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// Positions is the positions inside the text document.
Positions []Position `json:"positions"`
}