Closed markdumay closed 3 years ago
@markdumay Thanks for contributing! I understand you said problem and approve this change. But I forgotten enabled run forked pull request on CircleCI. I'll dig CircleCI docs, but could you amend and force push this branch? Thanks.
Great, good to hear you approve the proposed change. I made a small documentation change and submitted a force push. It seems this has triggered the CircleCI workflows. There is now an error though:
./capabilities_client_gojay.go:1824: cannot use v.Full (type interface {}) as type bool in argument to enc.BoolKeyOmitEmpty: need type assertion
./capabilities_client_gojay.go:1836: cannot use &v.Full (type *interface {}) as type *bool in argument to dec.Bool
WARN invalid TestEvent: FAIL go.lsp.dev/protocol [build failed]
It looks like the capabilities_client_gojay.go
file is out of sync. Is there a specific command that you run to regenerate the gojay
files?
@markdumay sorry for late, I'll comment later, maybe ~6h.
@markdumay Unfortunately, the gojay bindings are written by my hand.
Could you patch the below diff? It should work.
diff --git a/capabilities_client_gojay.go b/capabilities_client_gojay.go
index 3c2be32..759d87a 100644
--- a/capabilities_client_gojay.go
+++ b/capabilities_client_gojay.go
@@ -1821,7 +1821,7 @@ var (
// MarshalJSONObject implements gojay.MarshalerJSONObject.
func (v *SemanticTokensWorkspaceClientCapabilitiesRequests) MarshalJSONObject(enc *gojay.Encoder) {
enc.BoolKeyOmitEmpty(keyRange, v.Range)
- enc.BoolKeyOmitEmpty(keyFull, v.Full)
+ enc.AddInterfaceKey(keyFull, v.Full)
}
// IsNil implements gojay.MarshalerJSONObject.
@@ -1833,7 +1833,7 @@ func (v *SemanticTokensWorkspaceClientCapabilitiesRequests) UnmarshalJSONObject(
case keyRange:
return dec.Bool(&v.Range)
case keyFull:
- return dec.Bool(&v.Full)
+ return dec.Interface(&v.Full)
}
return nil
}
Thanks @zchee, I force pushed the changes. CircleCI now indicates I'm not authorized to run the workflows though.
Merging #27 (9f6c20c) into main (c071fd8) will not change coverage. The diff coverage is
100.0%
.
@@ Coverage Diff @@
## main #27 +/- ##
=====================================
Coverage 60.5% 60.5%
=====================================
Files 40 40
Lines 5538 5538
=====================================
Hits 3356 3356
Misses 2143 2143
Partials 39 39
Flag | Coverage Δ | |
---|---|---|
gojay | 67.0% <100.0%> (ø) |
|
json | 20.4% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
capabilities_client.go | 100.0% <ø> (ø) |
|
capabilities_client_gojay.go | 91.4% <100.0%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update c071fd8...9f6c20c. Read the comment docs.
@markdumay merged. Thanks contribute!
@markdumay also released a new tag.
https://github.com/go-language-server/protocol/releases/tag/v0.11.2
Great, glad to help. Keep up the good work!
First of all, great to see you guys are making the effort to port the LSP specification to Go. I started experimenting with your package quite recently. I encountered a small problem when trying to unmarshal the
InitializeParams
as generated byvscode-languageclient
with version7.0.0
. VSCode generates the client capabilities automatically, but handling the payload ofInitializeParams
on the server side (written in Go using your protocol package) gives the following error:It seems the following section of the
InitializeParams
JSON is the cause of the issue.According to the official specification, the value for
full
can be eitherboolean
or another embedded struct.This PR fixes the issue by adjusting the struct
SemanticTokensWorkspaceClientCapabilitiesRequests
incapabilities_client.go
. It simply changes the type ofFull
frombool
tointerface{}
. Let me know if you need more evidence or supporting files to reproduce the error.