Repository navigation
Expand file tree
/
Copy pathdata.go
More file actions
60 lines (52 loc) · 1.76 KB
/
Copy pathdata.go
File metadata and controls
60 lines (52 loc) · 1.76 KB
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
package testharness
import "github.com/sourcegraph/go-langserver/pkg/lsp"
// TestCase includes specific hover, definition, and references cases for a
// particular repository.
type TestCase struct {
Repo string
HoverCases []HoverCase
DefinitionCases []DefinitionCase
ReferencesCases []ReferencesCase
}
// HoverCase encodes the expected result for a hover operation.
type HoverCase struct {
File string
Line int
Character int
Resp lsp.Hover
}
// ToRequestParams provides syntactic sugar for writing test cases.
func (hc *HoverCase) ToRequestParams() *lsp.TextDocumentPositionParams {
return &lsp.TextDocumentPositionParams{
TextDocument: lsp.TextDocumentIdentifier{URI: hc.File},
Position: lsp.Position{Line: hc.Line, Character: hc.Character},
}
}
// DefinitionCase encodes the expected result for a definition operation.
type DefinitionCase struct {
File string
Line int
Character int
Resp []lsp.Location
}
// ToRequestParams provides syntactic sugar for writing test cases.
func (dc *DefinitionCase) ToRequestParams() *lsp.TextDocumentPositionParams {
return &lsp.TextDocumentPositionParams{
TextDocument: lsp.TextDocumentIdentifier{URI: dc.File},
Position: lsp.Position{Line: dc.Line, Character: dc.Character},
}
}
// ReferencesCase encodes the expected result for a references operation.
type ReferencesCase struct {
File string
Line int
Character int
Resp []lsp.Location
}
// ToRequestParams provides syntactic sugar for writing test cases.
func (rc *ReferencesCase) ToRequestParams() *lsp.TextDocumentPositionParams {
return &lsp.TextDocumentPositionParams{
TextDocument: lsp.TextDocumentIdentifier{URI: rc.File},
Position: lsp.Position{Line: rc.Line, Character: rc.Character},
}
}