Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete SemanticTokensOptions definition #49

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,16 +683,16 @@ const (
//
// Here is an example how such a string can be constructed using JavaScript / TypeScript:
//
// let markdown: MarkdownContent = {
// kind: MarkupKind.Markdown,
// value: [
// '# Header',
// 'Some text',
// '```typescript',
// 'someCode();',
// '```'
// ].join('\n')
// };
// let markdown: MarkdownContent = {
// kind: MarkupKind.Markdown,
// value: [
// '# Header',
// 'Some text',
// '```typescript',
// 'someCode();',
// '```'
// ].join('\n')
// };
//
// NOTE: clients might sanitize the return markdown. A client could decide to
// remove HTML from the markdown to avoid script execution.
Expand Down
15 changes: 11 additions & 4 deletions capabilities_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1021,13 +1021,20 @@ type GeneralClientCapabilities struct {
//
// The following features from the ECMAScript 2020 regular expression specification are NOT mandatory for a client:
//
// Assertions
// Assertions
//
// Lookahead assertion, Negative lookahead assertion, lookbehind assertion, negative lookbehind assertion.
// Character classes
//
// Character classes
//
// Matching control characters using caret notation (e.g. "\cX") and matching UTF-16 code units (e.g. "\uhhhh").
// Group and ranges
//
// Group and ranges
//
// Named capturing groups.
// Unicode property escapes
//
// Unicode property escapes
//
// None of the features needs to be supported.
//
// The only regular expression flag that a client needs to support is "i" to specify a case insensitive search.
Expand Down
12 changes: 12 additions & 0 deletions capabilities_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,23 @@ type LinkedEditingRangeRegistrationOptions struct {
StaticRegistrationOptions
}

// SemanticTokensFullOptions option of SemanticTokensOptions to indicate support for full and/or full with delta semantic tokens requests.
type SemanticTokensFullOptions struct {
// The server supports deltas for full documents.
Delta bool `json:"delta"`
}

// SemanticTokensOptions option of semantic tokens provider server capabilities.
//
// @since 3.16.0.
type SemanticTokensOptions struct {
WorkDoneProgressOptions
// The legend used by the server
Legend *SemanticTokensLegend `json:"legend,omitempty"`
// Server supports providing semantic tokens for a specific range of a document.
Range bool `json:"range"`
// Server supports providing semantic tokens for a full document.
Full interface{} `json:"full,omitempty"`
}

// SemanticTokensRegistrationOptions registration option of semantic tokens provider server capabilities.
Expand Down
1 change: 1 addition & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func ClientHandler(client Client, handler jsonrpc2.Handler) jsonrpc2.Handler {
}

// clientDispatch implements jsonrpc2.Handler.
//
//nolint:funlen,cyclop
func clientDispatch(ctx context.Context, client Client, reply jsonrpc2.Replier, req jsonrpc2.Request) (handled bool, err error) {
if ctx.Err() != nil {
Expand Down
2 changes: 2 additions & 0 deletions language.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ const (
)

// String implements fmt.Stringer.
//
//nolint:cyclop
func (k CompletionItemKind) String() string {
switch k {
Expand Down Expand Up @@ -730,6 +731,7 @@ const (
)

// String implements fmt.Stringer.
//
//nolint:cyclop
func (k SymbolKind) String() string {
switch k {
Expand Down
4 changes: 3 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func ServerDispatcher(conn jsonrpc2.Conn, logger *zap.Logger) Server {
}

// ServerHandler jsonrpc2.Handler of Language Server Prococol Server.
//
//nolint:unparam
func ServerHandler(server Server, handler jsonrpc2.Handler) jsonrpc2.Handler {
h := func(ctx context.Context, reply jsonrpc2.Replier, req jsonrpc2.Request) error {
Expand Down Expand Up @@ -55,6 +56,7 @@ func ServerHandler(server Server, handler jsonrpc2.Handler) jsonrpc2.Handler {
}

// serverDispatch implements jsonrpc2.Handler.
//
//nolint:gocognit,funlen,gocyclo,cyclop
func serverDispatch(ctx context.Context, server Server, reply jsonrpc2.Replier, req jsonrpc2.Request) (handled bool, err error) {
if ctx.Err() != nil {
Expand Down Expand Up @@ -1171,7 +1173,7 @@ func (s *server) CodeLensResolve(ctx context.Context, params *CodeLens) (_ *Code

// ColorPresentation sends the request from the client to the server to obtain a list of presentations for a color value at a given location.
//
// Clients can use the result to
// # Clients can use the result to
//
// - modify a color reference.
// - show in a color picker and let users pick one of the presentations.
Expand Down