Skip to content

Commit

Permalink
build(deps): generate based on github.com/golang/tools@048e15e (#16)
Browse files Browse the repository at this point in the history
Co-authored-by: laytan <laytan@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and laytan authored Nov 17, 2023
1 parent 4954af4 commit 1d51a8d
Show file tree
Hide file tree
Showing 17 changed files with 223 additions and 680 deletions.
2 changes: 1 addition & 1 deletion .tools_commit_hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c00d71d
048e15e
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ module github.com/laytan/go-lsp-protocol
go 1.18

require (
github.com/google/go-cmp v0.5.9
golang.org/x/mod v0.12.0
golang.org/x/sys v0.12.0
golang.org/x/telemetry v0.0.0-20230919143304-dd3d43c296e4
golang.org/x/tools v0.13.0
github.com/google/go-cmp v0.6.0
golang.org/x/mod v0.14.0
golang.org/x/telemetry v0.0.0-20231114163143-69313e640400
golang.org/x/tools v0.15.0
)

require golang.org/x/sys v0.14.0 // indirect
22 changes: 11 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/telemetry v0.0.0-20230919143304-dd3d43c296e4 h1:8UKgM6RV6tVUWPOKlSEunJpIzYW3oy9aV//8cJz0UE4=
golang.org/x/telemetry v0.0.0-20230919143304-dd3d43c296e4/go.mod h1:ppZ76JTkRgJC2GQEgtVY3fiuJR+N8FU2MAlp+gfN1E4=
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/telemetry v0.0.0-20231114163143-69313e640400 h1:brbkEFfGwNGAEkykUOcryE/JiHUMMJouzE0fWWmz/QU=
golang.org/x/telemetry v0.0.0-20231114163143-69313e640400/go.mod h1:P6hMdmAcoG7FyATwqSr6R/U0n7yeXNP/QXeRlxb1szE=
golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8=
golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk=
57 changes: 0 additions & 57 deletions pkg/lsp/protocol/enums.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,103 +129,46 @@ func formatEnum(f fmt.State, c rune, i int, names []string, unknown string) {
}
}

func parseEnum(s string, names []string) int {
for i, name := range names {
if s == name {
return i
}
}
return 0
}

func (e TextDocumentSyncKind) Format(f fmt.State, c rune) {
formatEnum(f, c, int(e), namesTextDocumentSyncKind[:], "TextDocumentSyncKind")
}

func ParseTextDocumentSyncKind(s string) TextDocumentSyncKind {
return TextDocumentSyncKind(parseEnum(s, namesTextDocumentSyncKind[:]))
}

func (e MessageType) Format(f fmt.State, c rune) {
formatEnum(f, c, int(e), namesMessageType[:], "MessageType")
}

func ParseMessageType(s string) MessageType {
return MessageType(parseEnum(s, namesMessageType[:]))
}

func (e FileChangeType) Format(f fmt.State, c rune) {
formatEnum(f, c, int(e), namesFileChangeType[:], "FileChangeType")
}

func ParseFileChangeType(s string) FileChangeType {
return FileChangeType(parseEnum(s, namesFileChangeType[:]))
}

func ParseWatchKind(s string) WatchKind {
return WatchKind(parseEnum(s, namesWatchKind[:]))
}

func (e CompletionTriggerKind) Format(f fmt.State, c rune) {
formatEnum(f, c, int(e), namesCompletionTriggerKind[:], "CompletionTriggerKind")
}

func ParseCompletionTriggerKind(s string) CompletionTriggerKind {
return CompletionTriggerKind(parseEnum(s, namesCompletionTriggerKind[:]))
}

func (e DiagnosticSeverity) Format(f fmt.State, c rune) {
formatEnum(f, c, int(e), namesDiagnosticSeverity[:], "DiagnosticSeverity")
}

func ParseDiagnosticSeverity(s string) DiagnosticSeverity {
return DiagnosticSeverity(parseEnum(s, namesDiagnosticSeverity[:]))
}

func (e DiagnosticTag) Format(f fmt.State, c rune) {
formatEnum(f, c, int(e), namesDiagnosticTag[:], "DiagnosticTag")
}

func ParseDiagnosticTag(s string) DiagnosticTag {
return DiagnosticTag(parseEnum(s, namesDiagnosticTag[:]))
}

func (e CompletionItemKind) Format(f fmt.State, c rune) {
formatEnum(f, c, int(e), namesCompletionItemKind[:], "CompletionItemKind")
}

func ParseCompletionItemKind(s string) CompletionItemKind {
return CompletionItemKind(parseEnum(s, namesCompletionItemKind[:]))
}

func (e InsertTextFormat) Format(f fmt.State, c rune) {
formatEnum(f, c, int(e), namesInsertTextFormat[:], "InsertTextFormat")
}

func ParseInsertTextFormat(s string) InsertTextFormat {
return InsertTextFormat(parseEnum(s, namesInsertTextFormat[:]))
}

func (e DocumentHighlightKind) Format(f fmt.State, c rune) {
formatEnum(f, c, int(e), namesDocumentHighlightKind[:], "DocumentHighlightKind")
}

func ParseDocumentHighlightKind(s string) DocumentHighlightKind {
return DocumentHighlightKind(parseEnum(s, namesDocumentHighlightKind[:]))
}

func (e SymbolKind) Format(f fmt.State, c rune) {
formatEnum(f, c, int(e), namesSymbolKind[:], "SymbolKind")
}

func ParseSymbolKind(s string) SymbolKind {
return SymbolKind(parseEnum(s, namesSymbolKind[:]))
}

func (e TextDocumentSaveReason) Format(f fmt.State, c rune) {
formatEnum(f, c, int(e), namesTextDocumentSaveReason[:], "TextDocumentSaveReason")
}

func ParseTextDocumentSaveReason(s string) TextDocumentSaveReason {
return TextDocumentSaveReason(parseEnum(s, namesTextDocumentSaveReason[:]))
}
26 changes: 24 additions & 2 deletions pkg/lsp/protocol/generate/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,30 @@ func genStructs(model Model) {
types[nm] = out.String()
}
// base types
types["DocumentURI"] = "type DocumentURI string\n"
types["URI"] = "type URI = string\n"
types["DocumentURI"] = `
// A DocumentURI is the URI of a client editor document.
//
// Care should be taken to handle encoding in URIs. For
// example, some clients (such as VS Code) may encode colons
// in drive letters while others do not. The URIs below are
// both valid, but clients and servers should be consistent
// with the form they use themselves to ensure the other party
// doesn’t interpret them as distinct URIs. Clients and
// servers should not assume that each other are encoding the
// same way (for example a client encoding colons in drive
// letters cannot assume server responses will have encoded
// colons). The same applies to casing of drive letters - one
// party should not assume the other party will return paths
// with drive letters cased the same as it.
//
// file:///c:/project/readme.md
// file:///C%3A/project/readme.md
//
type DocumentURI string
`
types["URI"] = `// A URI is an arbitrary URL (e.g. https), not necessarily a file.
type URI = string
`

types["LSPAny"] = "type LSPAny = interface{}\n"
// A special case, the only previously existing Or type
Expand Down
Loading

0 comments on commit 1d51a8d

Please sign in to comment.