5// WorkspaceSymbolResult is an interface for types that represent workspace symbols
6type WorkspaceSymbolResult interface {
9 isWorkspaceSymbol() // marker method
12func (ws *WorkspaceSymbol) GetName() string { return ws.Name }
13func (ws *WorkspaceSymbol) GetLocation() Location {
14 switch v := ws.Location.Value.(type) {
18 return Location{URI: v.URI}
22func (ws *WorkspaceSymbol) isWorkspaceSymbol() {}
24func (si *SymbolInformation) GetName() string { return si.Name }
25func (si *SymbolInformation) GetLocation() Location { return si.Location }
26func (si *SymbolInformation) isWorkspaceSymbol() {}
28// Results converts the Value to a slice of WorkspaceSymbolResult
29func (r Or_Result_workspace_symbol) Results() ([]WorkspaceSymbolResult, error) {
31 return make([]WorkspaceSymbolResult, 0), nil
33 switch v := r.Value.(type) {
34 case []WorkspaceSymbol:
35 results := make([]WorkspaceSymbolResult, len(v))
40 case []SymbolInformation:
41 results := make([]WorkspaceSymbolResult, len(v))
47 return nil, fmt.Errorf("unknown symbol type: %T", r.Value)
51// DocumentSymbolResult is an interface for types that represent document symbols
52type DocumentSymbolResult interface {
55 isDocumentSymbol() // marker method
58func (ds *DocumentSymbol) GetRange() Range { return ds.Range }
59func (ds *DocumentSymbol) GetName() string { return ds.Name }
60func (ds *DocumentSymbol) isDocumentSymbol() {}
62func (si *SymbolInformation) GetRange() Range { return si.Location.Range }
64// Note: SymbolInformation already has GetName() implemented above
65func (si *SymbolInformation) isDocumentSymbol() {}
67// Results converts the Value to a slice of DocumentSymbolResult
68func (r Or_Result_textDocument_documentSymbol) Results() ([]DocumentSymbolResult, error) {
70 return make([]DocumentSymbolResult, 0), nil
72 switch v := r.Value.(type) {
73 case []DocumentSymbol:
74 results := make([]DocumentSymbolResult, len(v))
79 case []SymbolInformation:
80 results := make([]DocumentSymbolResult, len(v))
86 return nil, fmt.Errorf("unknown document symbol type: %T", v)
90// TextEditResult is an interface for types that can be used as text edits
91type TextEditResult interface {
94 isTextEdit() // marker method
97func (te *TextEdit) GetRange() Range { return te.Range }
98func (te *TextEdit) GetNewText() string { return te.NewText }
99func (te *TextEdit) isTextEdit() {}
101// AsTextEdit converts Or_TextDocumentEdit_edits_Elem to TextEdit
102func (e Or_TextDocumentEdit_edits_Elem) AsTextEdit() (TextEdit, error) {
104 return TextEdit{}, fmt.Errorf("nil text edit")
106 switch v := e.Value.(type) {
109 case AnnotatedTextEdit:
115 return TextEdit{}, fmt.Errorf("unknown text edit type: %T", e.Value)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list