Skip to content

Commit

Permalink
feat: add unmarshalling support for a number of server capability opt…
Browse files Browse the repository at this point in the history
…ions with union types
  • Loading branch information
fr3shw3b committed Jun 14, 2024
1 parent 67f3de0 commit 9e3f3e0
Show file tree
Hide file tree
Showing 9 changed files with 1,305 additions and 50 deletions.
10 changes: 9 additions & 1 deletion lsp_3_17/base_structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ type WorkDoneProgressParams struct {
// }
//
// ```
type WorkDownProgressOptions struct {
type WorkDoneProgressOptions struct {
WorkDoneProgress *bool `json:"workDoneProgress,omitempty"`
}

Expand All @@ -886,3 +886,11 @@ const (
TraceValueMessage = TraceValue("messages")
TraceValueVerbose = TraceValue("verbose")
)

// TextDocumentRegistrationOptions provides general
// text document registration options.
type TextDocumentRegistrationOptions struct {
// A document selector to identify to identify the scope of the registration.
// If set to null the document selector provided on the client side will be used.
DocumentSelector *DocumentSelector `json:"documentSelector"`
}
24 changes: 24 additions & 0 deletions lsp_3_17/helpers_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package lsp

import (
"encoding/json"

"github.com/stretchr/testify/suite"
)

type serverCapabilityFixture struct {
name string
input string
expected *ServerCapabilities
}

func testServerCapabilities(s *suite.Suite, tests []serverCapabilityFixture) {
for _, test := range tests {
s.Run(test.name, func() {
capabilities := &ServerCapabilities{}
err := json.Unmarshal([]byte(test.input), capabilities)
s.Require().NoError(err)
s.Require().Equal(test.expected, capabilities)
})
}
}
Loading

0 comments on commit 9e3f3e0

Please sign in to comment.