| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package protocol |
| 6 |
|
| 7 |
import ( |
| 8 |
"fmt" |
| 9 |
) |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
const CodeActionUnknownTrigger CodeActionTriggerKind = 0 |
| 15 |
|
| 16 |
var ( |
| 17 |
namesTextDocumentSyncKind [int(Incremental) + 1]string |
| 18 |
namesMessageType [int(Log) + 1]string |
| 19 |
namesFileChangeType [int(Deleted) + 1]string |
| 20 |
namesWatchKind [int(WatchDelete) + 1]string |
| 21 |
namesCompletionTriggerKind [int(TriggerForIncompleteCompletions) + 1]string |
| 22 |
namesDiagnosticSeverity [int(SeverityHint) + 1]string |
| 23 |
namesDiagnosticTag [int(Unnecessary) + 1]string |
| 24 |
namesCompletionItemKind [int(TypeParameterCompletion) + 1]string |
| 25 |
namesInsertTextFormat [int(SnippetTextFormat) + 1]string |
| 26 |
namesDocumentHighlightKind [int(Write) + 1]string |
| 27 |
namesSymbolKind [int(TypeParameter) + 1]string |
| 28 |
namesTextDocumentSaveReason [int(FocusOut) + 1]string |
| 29 |
) |
| 30 |
|
| 31 |
func init() { |
| 32 |
namesTextDocumentSyncKind[int(None)] = "None" |
| 33 |
namesTextDocumentSyncKind[int(Full)] = "Full" |
| 34 |
namesTextDocumentSyncKind[int(Incremental)] = "Incremental" |
| 35 |
|
| 36 |
namesMessageType[int(Error)] = "Error" |
| 37 |
namesMessageType[int(Warning)] = "Warning" |
| 38 |
namesMessageType[int(Info)] = "Info" |
| 39 |
namesMessageType[int(Log)] = "Log" |
| 40 |
|
| 41 |
namesFileChangeType[int(Created)] = "Created" |
| 42 |
namesFileChangeType[int(Changed)] = "Changed" |
| 43 |
namesFileChangeType[int(Deleted)] = "Deleted" |
| 44 |
|
| 45 |
namesWatchKind[int(WatchCreate)] = "WatchCreate" |
| 46 |
namesWatchKind[int(WatchChange)] = "WatchChange" |
| 47 |
namesWatchKind[int(WatchDelete)] = "WatchDelete" |
| 48 |
|
| 49 |
namesCompletionTriggerKind[int(Invoked)] = "Invoked" |
| 50 |
namesCompletionTriggerKind[int(TriggerCharacter)] = "TriggerCharacter" |
| 51 |
namesCompletionTriggerKind[int(TriggerForIncompleteCompletions)] = "TriggerForIncompleteCompletions" |
| 52 |
|
| 53 |
namesDiagnosticSeverity[int(SeverityError)] = "Error" |
| 54 |
namesDiagnosticSeverity[int(SeverityWarning)] = "Warning" |
| 55 |
namesDiagnosticSeverity[int(SeverityInformation)] = "Information" |
| 56 |
namesDiagnosticSeverity[int(SeverityHint)] = "Hint" |
| 57 |
|
| 58 |
namesDiagnosticTag[int(Unnecessary)] = "Unnecessary" |
| 59 |
|
| 60 |
namesCompletionItemKind[int(TextCompletion)] = "text" |
| 61 |
namesCompletionItemKind[int(MethodCompletion)] = "method" |
| 62 |
namesCompletionItemKind[int(FunctionCompletion)] = "func" |
| 63 |
namesCompletionItemKind[int(ConstructorCompletion)] = "constructor" |
| 64 |
namesCompletionItemKind[int(FieldCompletion)] = "field" |
| 65 |
namesCompletionItemKind[int(VariableCompletion)] = "var" |
| 66 |
namesCompletionItemKind[int(ClassCompletion)] = "type" |
| 67 |
namesCompletionItemKind[int(InterfaceCompletion)] = "interface" |
| 68 |
namesCompletionItemKind[int(ModuleCompletion)] = "package" |
| 69 |
namesCompletionItemKind[int(PropertyCompletion)] = "property" |
| 70 |
namesCompletionItemKind[int(UnitCompletion)] = "unit" |
| 71 |
namesCompletionItemKind[int(ValueCompletion)] = "value" |
| 72 |
namesCompletionItemKind[int(EnumCompletion)] = "enum" |
| 73 |
namesCompletionItemKind[int(KeywordCompletion)] = "keyword" |
| 74 |
namesCompletionItemKind[int(SnippetCompletion)] = "snippet" |
| 75 |
namesCompletionItemKind[int(ColorCompletion)] = "color" |
| 76 |
namesCompletionItemKind[int(FileCompletion)] = "file" |
| 77 |
namesCompletionItemKind[int(ReferenceCompletion)] = "reference" |
| 78 |
namesCompletionItemKind[int(FolderCompletion)] = "folder" |
| 79 |
namesCompletionItemKind[int(EnumMemberCompletion)] = "enumMember" |
| 80 |
namesCompletionItemKind[int(ConstantCompletion)] = "const" |
| 81 |
namesCompletionItemKind[int(StructCompletion)] = "struct" |
| 82 |
namesCompletionItemKind[int(EventCompletion)] = "event" |
| 83 |
namesCompletionItemKind[int(OperatorCompletion)] = "operator" |
| 84 |
namesCompletionItemKind[int(TypeParameterCompletion)] = "typeParam" |
| 85 |
|
| 86 |
namesInsertTextFormat[int(PlainTextTextFormat)] = "PlainText" |
| 87 |
namesInsertTextFormat[int(SnippetTextFormat)] = "Snippet" |
| 88 |
|
| 89 |
namesDocumentHighlightKind[int(Text)] = "Text" |
| 90 |
namesDocumentHighlightKind[int(Read)] = "Read" |
| 91 |
namesDocumentHighlightKind[int(Write)] = "Write" |
| 92 |
|
| 93 |
namesSymbolKind[int(File)] = "File" |
| 94 |
namesSymbolKind[int(Module)] = "Module" |
| 95 |
namesSymbolKind[int(Namespace)] = "Namespace" |
| 96 |
namesSymbolKind[int(Package)] = "Package" |
| 97 |
namesSymbolKind[int(Class)] = "Class" |
| 98 |
namesSymbolKind[int(Method)] = "Method" |
| 99 |
namesSymbolKind[int(Property)] = "Property" |
| 100 |
namesSymbolKind[int(Field)] = "Field" |
| 101 |
namesSymbolKind[int(Constructor)] = "Constructor" |
| 102 |
namesSymbolKind[int(Enum)] = "Enum" |
| 103 |
namesSymbolKind[int(Interface)] = "Interface" |
| 104 |
namesSymbolKind[int(Function)] = "Function" |
| 105 |
namesSymbolKind[int(Variable)] = "Variable" |
| 106 |
namesSymbolKind[int(Constant)] = "Constant" |
| 107 |
namesSymbolKind[int(String)] = "String" |
| 108 |
namesSymbolKind[int(Number)] = "Number" |
| 109 |
namesSymbolKind[int(Boolean)] = "Boolean" |
| 110 |
namesSymbolKind[int(Array)] = "Array" |
| 111 |
namesSymbolKind[int(Object)] = "Object" |
| 112 |
namesSymbolKind[int(Key)] = "Key" |
| 113 |
namesSymbolKind[int(Null)] = "Null" |
| 114 |
namesSymbolKind[int(EnumMember)] = "EnumMember" |
| 115 |
namesSymbolKind[int(Struct)] = "Struct" |
| 116 |
namesSymbolKind[int(Event)] = "Event" |
| 117 |
namesSymbolKind[int(Operator)] = "Operator" |
| 118 |
namesSymbolKind[int(TypeParameter)] = "TypeParameter" |
| 119 |
|
| 120 |
namesTextDocumentSaveReason[int(Manual)] = "Manual" |
| 121 |
namesTextDocumentSaveReason[int(AfterDelay)] = "AfterDelay" |
| 122 |
namesTextDocumentSaveReason[int(FocusOut)] = "FocusOut" |
| 123 |
} |
| 124 |
|
| 125 |
func formatEnum(f fmt.State, i int, names []string, unknown string) { |
| 126 |
s := "" |
| 127 |
if i >= 0 && i < len(names) { |
| 128 |
s = names[i] |
| 129 |
} |
| 130 |
if s != "" { |
| 131 |
fmt.Fprint(f, s) |
| 132 |
} else { |
| 133 |
fmt.Fprintf(f, "%s(%d)", unknown, i) |
| 134 |
} |
| 135 |
} |
| 136 |
|
| 137 |
func (e TextDocumentSyncKind) Format(f fmt.State, c rune) { |
| 138 |
formatEnum(f, int(e), namesTextDocumentSyncKind[:], "TextDocumentSyncKind") |
| 139 |
} |
| 140 |
|
| 141 |
func (e MessageType) Format(f fmt.State, c rune) { |
| 142 |
formatEnum(f, int(e), namesMessageType[:], "MessageType") |
| 143 |
} |
| 144 |
|
| 145 |
func (e FileChangeType) Format(f fmt.State, c rune) { |
| 146 |
formatEnum(f, int(e), namesFileChangeType[:], "FileChangeType") |
| 147 |
} |
| 148 |
|
| 149 |
func (e CompletionTriggerKind) Format(f fmt.State, c rune) { |
| 150 |
formatEnum(f, int(e), namesCompletionTriggerKind[:], "CompletionTriggerKind") |
| 151 |
} |
| 152 |
|
| 153 |
func (e DiagnosticSeverity) Format(f fmt.State, c rune) { |
| 154 |
formatEnum(f, int(e), namesDiagnosticSeverity[:], "DiagnosticSeverity") |
| 155 |
} |
| 156 |
|
| 157 |
func (e DiagnosticTag) Format(f fmt.State, c rune) { |
| 158 |
formatEnum(f, int(e), namesDiagnosticTag[:], "DiagnosticTag") |
| 159 |
} |
| 160 |
|
| 161 |
func (e CompletionItemKind) Format(f fmt.State, c rune) { |
| 162 |
formatEnum(f, int(e), namesCompletionItemKind[:], "CompletionItemKind") |
| 163 |
} |
| 164 |
|
| 165 |
func (e InsertTextFormat) Format(f fmt.State, c rune) { |
| 166 |
formatEnum(f, int(e), namesInsertTextFormat[:], "InsertTextFormat") |
| 167 |
} |
| 168 |
|
| 169 |
func (e DocumentHighlightKind) Format(f fmt.State, c rune) { |
| 170 |
formatEnum(f, int(e), namesDocumentHighlightKind[:], "DocumentHighlightKind") |
| 171 |
} |
| 172 |
|
| 173 |
func (e SymbolKind) Format(f fmt.State, c rune) { |
| 174 |
formatEnum(f, int(e), namesSymbolKind[:], "SymbolKind") |
| 175 |
} |
| 176 |
|
| 177 |
func (e TextDocumentSaveReason) Format(f fmt.State, c rune) { |
| 178 |
formatEnum(f, int(e), namesTextDocumentSaveReason[:], "TextDocumentSaveReason") |
| 179 |
} |