Skip to content

Commit 7580165

Browse files
committed
all: fix lint suggestions
1 parent f2e3a16 commit 7580165

12 files changed

+47
-39
lines changed

basic.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,10 @@ type DocumentSelector []*DocumentFilter
593593
type MarkupKind string
594594

595595
const (
596-
// PlainText is supported as a content format
596+
// PlainText is supported as a content format.
597597
PlainText MarkupKind = "plaintext"
598598

599-
// Markdown is supported as a content format
599+
// Markdown is supported as a content format.
600600
Markdown MarkupKind = "markdown"
601601
)
602602

client_gojay.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
)
1919

2020
// Deliver implements jsonrpc2.Handler.
21+
//nolint:funlen,gocognit
2122
func (h clientHandler) Deliver(ctx context.Context, r *jsonrpc2.Request, delivered bool) bool {
2223
if delivered {
2324
return false

client_json.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
)
1818

1919
// Deliver implements jsonrpc2.Handler.
20+
//nolint:funlen,gocognit
2021
func (h clientHandler) Deliver(ctx context.Context, r *jsonrpc2.Request, delivered bool) bool {
2122
if delivered {
2223
return false

errors.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package protocol
66

77
import (
88
"context"
9+
"errors"
910

1011
"go.uber.org/zap"
1112

@@ -14,7 +15,8 @@ import (
1415

1516
// ReplyError replies error message.
1617
func ReplyError(ctx context.Context, err error, req *jsonrpc2.Request) {
17-
if _, ok := err.(*jsonrpc2.Error); !ok {
18+
var jrpcErr *jsonrpc2.Error
19+
if !errors.As(err, &jrpcErr) {
1820
err = jsonrpc2.Errorf(jsonrpc2.ParseError, "%v", err)
1921
}
2022

general.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ type InitializeParams struct {
6767
WorkspaceFolders []WorkspaceFolder `json:"workspaceFolders,omitempty"`
6868
}
6969

70-
// WorkspaceClientCapabilitiesWorkspaceEdit capabilities specific to `WorkspaceEdit`s
70+
// WorkspaceClientCapabilitiesWorkspaceEdit capabilities specific to `WorkspaceEdit`s.
7171
type WorkspaceClientCapabilitiesWorkspaceEdit struct {
7272
// DocumentChanges is the client supports versioned document changes in `WorkspaceEdit`s
7373
DocumentChanges bool `json:"documentChanges,omitempty"`
@@ -170,7 +170,7 @@ type TextDocumentClientCapabilitiesSynchronization struct {
170170
WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"`
171171
}
172172

173-
// TextDocumentClientCapabilitiesCompletion Capabilities specific to the `textDocument/completion`
173+
// TextDocumentClientCapabilitiesCompletion Capabilities specific to the `textDocument/completion`.
174174
type TextDocumentClientCapabilitiesCompletion struct {
175175
// Whether completion supports dynamic registration.
176176
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
@@ -226,7 +226,7 @@ type TextDocumentClientCapabilitiesCompletionItem struct {
226226
PreselectSupport bool `json:"preselectSupport,omitempty"`
227227
}
228228

229-
// TextDocumentClientCapabilitiesHover capabilities specific to the `textDocument/hover`
229+
// TextDocumentClientCapabilitiesHover capabilities specific to the `textDocument/hover`.
230230
type TextDocumentClientCapabilitiesHover struct {
231231
// DynamicRegistration whether hover supports dynamic registration.
232232
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
@@ -236,7 +236,7 @@ type TextDocumentClientCapabilitiesHover struct {
236236
ContentFormat []MarkupKind `json:"contentFormat,omitempty"`
237237
}
238238

239-
// TextDocumentClientCapabilitiesSignatureHelp capabilities specific to the `textDocument/signatureHelp`
239+
// TextDocumentClientCapabilitiesSignatureHelp capabilities specific to the `textDocument/signatureHelp`.
240240
type TextDocumentClientCapabilitiesSignatureHelp struct {
241241
// DynamicRegistration whether signature help supports dynamic registration.
242242
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
@@ -266,19 +266,19 @@ type TextDocumentClientCapabilitiesParameterInformation struct {
266266
LabelOffsetSupport bool `json:"labelOffsetSupport,omitempty"`
267267
}
268268

269-
// TextDocumentClientCapabilitiesReferences capabilities specific to the `textDocument/references`
269+
// TextDocumentClientCapabilitiesReferences capabilities specific to the `textDocument/references`.
270270
type TextDocumentClientCapabilitiesReferences struct {
271271
// DynamicRegistration whether references supports dynamic registration.
272272
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
273273
}
274274

275-
// TextDocumentClientCapabilitiesDocumentHighlight capabilities specific to the `textDocument/documentHighlight`
275+
// TextDocumentClientCapabilitiesDocumentHighlight capabilities specific to the `textDocument/documentHighlight`.
276276
type TextDocumentClientCapabilitiesDocumentHighlight struct {
277277
// DynamicRegistration Whether document highlight supports dynamic registration.
278278
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
279279
}
280280

281-
// TextDocumentClientCapabilitiesDocumentSymbol capabilities specific to the `textDocument/documentSymbol`
281+
// TextDocumentClientCapabilitiesDocumentSymbol capabilities specific to the `textDocument/documentSymbol`.
282282
type TextDocumentClientCapabilitiesDocumentSymbol struct {
283283
// DynamicRegistration whether document symbol supports dynamic registration.
284284
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
@@ -290,25 +290,25 @@ type TextDocumentClientCapabilitiesDocumentSymbol struct {
290290
HierarchicalDocumentSymbolSupport bool `json:"hierarchicalDocumentSymbolSupport,omitempty"`
291291
}
292292

293-
// TextDocumentClientCapabilitiesFormatting capabilities specific to the `textDocument/formatting`
293+
// TextDocumentClientCapabilitiesFormatting capabilities specific to the `textDocument/formatting`.
294294
type TextDocumentClientCapabilitiesFormatting struct {
295295
// DynamicRegistration whether formatting supports dynamic registration.
296296
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
297297
}
298298

299-
// TextDocumentClientCapabilitiesRangeFormatting capabilities specific to the `textDocument/rangeFormatting`
299+
// TextDocumentClientCapabilitiesRangeFormatting capabilities specific to the `textDocument/rangeFormatting`.
300300
type TextDocumentClientCapabilitiesRangeFormatting struct {
301301
// DynamicRegistration whether range formatting supports dynamic registration.
302302
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
303303
}
304304

305-
// TextDocumentClientCapabilitiesOnTypeFormatting Capabilities specific to the `textDocument/onTypeFormatting`
305+
// TextDocumentClientCapabilitiesOnTypeFormatting Capabilities specific to the `textDocument/onTypeFormatting`.
306306
type TextDocumentClientCapabilitiesOnTypeFormatting struct {
307307
// DynamicRegistration whether on type formatting supports dynamic registration.
308308
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
309309
}
310310

311-
// TextDocumentClientCapabilitiesDeclaration capabilities specific to the `textDocument/declaration`
311+
// TextDocumentClientCapabilitiesDeclaration capabilities specific to the `textDocument/declaration`.
312312
type TextDocumentClientCapabilitiesDeclaration struct {
313313
// DynamicRegistration whether declaration supports dynamic registration. If this is set to `true`
314314
// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
@@ -323,7 +323,7 @@ type TextDocumentClientCapabilitiesDeclaration struct {
323323

324324
// TextDocumentClientCapabilitiesDefinition capabilities specific to the `textDocument/definition`.
325325
//
326-
// Since 3.14.0
326+
// Since 3.14.0.
327327
type TextDocumentClientCapabilitiesDefinition struct {
328328
// DynamicRegistration whether definition supports dynamic registration.
329329
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
@@ -334,7 +334,7 @@ type TextDocumentClientCapabilitiesDefinition struct {
334334

335335
// TextDocumentClientCapabilitiesTypeDefinition capabilities specific to the `textDocument/typeDefinition`
336336
//
337-
// Since 3.6.0
337+
// Since 3.6.0.
338338
type TextDocumentClientCapabilitiesTypeDefinition struct {
339339
// DynamicRegistration whether typeDefinition supports dynamic registration. If this is set to `true`
340340
// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
@@ -349,7 +349,7 @@ type TextDocumentClientCapabilitiesTypeDefinition struct {
349349

350350
// TextDocumentClientCapabilitiesImplementation capabilities specific to the `textDocument/implementation`.
351351
//
352-
// Since 3.6.0
352+
// Since 3.6.0.
353353
type TextDocumentClientCapabilitiesImplementation struct {
354354
// DynamicRegistration whether implementation supports dynamic registration. If this is set to `true`
355355
// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
@@ -362,7 +362,7 @@ type TextDocumentClientCapabilitiesImplementation struct {
362362
LinkSupport bool `json:"linkSupport,omitempty"`
363363
}
364364

365-
// TextDocumentClientCapabilitiesCodeAction capabilities specific to the `textDocument/codeAction`
365+
// TextDocumentClientCapabilitiesCodeAction capabilities specific to the `textDocument/codeAction`.
366366
type TextDocumentClientCapabilitiesCodeAction struct {
367367
// DynamicRegistration whether code action supports dynamic registration.
368368
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
@@ -389,13 +389,13 @@ type TextDocumentClientCapabilitiesCodeActionKind struct {
389389
ValueSet []CodeActionKind `json:"valueSet"`
390390
}
391391

392-
// TextDocumentClientCapabilitiesCodeLens capabilities specific to the `textDocument/codeLens`
392+
// TextDocumentClientCapabilitiesCodeLens capabilities specific to the `textDocument/codeLens`.
393393
type TextDocumentClientCapabilitiesCodeLens struct {
394394
// DynamicRegistration Whether code lens supports dynamic registration.
395395
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
396396
}
397397

398-
// TextDocumentClientCapabilitiesDocumentLink capabilities specific to the `textDocument/documentLink`
398+
// TextDocumentClientCapabilitiesDocumentLink capabilities specific to the `textDocument/documentLink`.
399399
type TextDocumentClientCapabilitiesDocumentLink struct {
400400
// DynamicRegistration whether document link supports dynamic registration.
401401
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
@@ -404,15 +404,15 @@ type TextDocumentClientCapabilitiesDocumentLink struct {
404404
// TextDocumentClientCapabilitiesColorProvider capabilities specific to the `textDocument/documentColor` and the
405405
// `textDocument/colorPresentation` request.
406406
//
407-
// Since 3.6.0
407+
// Since 3.6.0.
408408
type TextDocumentClientCapabilitiesColorProvider struct {
409409
// DynamicRegistration whether colorProvider supports dynamic registration. If this is set to `true`
410410
// the client supports the new `(ColorProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
411411
// return value for the corresponding server capability as well.
412412
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
413413
}
414414

415-
// TextDocumentClientCapabilitiesRename capabilities specific to the `textDocument/rename`
415+
// TextDocumentClientCapabilitiesRename capabilities specific to the `textDocument/rename`.
416416
type TextDocumentClientCapabilitiesRename struct {
417417
// DynamicRegistration whether rename supports dynamic registration.
418418
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
@@ -433,7 +433,7 @@ type TextDocumentClientCapabilitiesPublishDiagnostics struct {
433433

434434
// TextDocumentClientCapabilitiesFoldingRange capabilities specific to `textDocument/foldingRange` requests.
435435
//
436-
// Since 3.10.0
436+
// Since 3.10.0.
437437
type TextDocumentClientCapabilitiesFoldingRange struct {
438438
// DynamicRegistration whether implementation supports dynamic registration for folding range providers. If this is set to `true`
439439
// the client supports the new `(FoldingRangeProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
@@ -695,14 +695,14 @@ type StaticRegistrationOptions struct {
695695
ID string `json:"id,omitempty"`
696696
}
697697

698-
// ServerCapabilitiesWorkspace specific server capabilities
698+
// ServerCapabilitiesWorkspace specific server capabilities.
699699
type ServerCapabilitiesWorkspace struct {
700700
WorkspaceFolders *ServerCapabilitiesWorkspaceFolders `json:"workspaceFolders,omitempty"`
701701
}
702702

703703
// ServerCapabilitiesWorkspaceFolders is the server supports workspace folder.
704704
//
705-
// Since 3.6.0
705+
// Since 3.6.0.
706706
type ServerCapabilitiesWorkspaceFolders struct {
707707
// Supported is the server has support for workspace folders
708708
Supported bool `json:"supported,omitempty"`

general_gojay.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ func (v SymbolKinds) MarshalJSONArray(enc *gojay.Encoder) {
221221
// IsNil implements gojay.MarshalerJSONArray.
222222
func (v SymbolKinds) IsNil() bool { return len(v) == 0 }
223223

224-
// UnmarshalJSONArray decodes JSON array elements into slice
224+
// UnmarshalJSONArray decodes JSON array elements into slice.
225225
func (v *SymbolKinds) UnmarshalJSONArray(dec *gojay.Decoder) error {
226226
var value SymbolKind
227227
if err := dec.Float64((*float64)(&value)); err != nil {
@@ -492,7 +492,7 @@ func (v MarkupKinds) MarshalJSONArray(enc *gojay.Encoder) {
492492
// IsNil implements gojay.MarshalerJSONArray.
493493
func (v MarkupKinds) IsNil() bool { return len(v) == 0 }
494494

495-
// UnmarshalJSONArray decodes JSON array elements into slice
495+
// UnmarshalJSONArray decodes JSON array elements into slice.
496496
func (v *MarkupKinds) UnmarshalJSONArray(dec *gojay.Decoder) error {
497497
var value MarkupKind
498498
if err := dec.String((*string)(&value)); err != nil {
@@ -1236,6 +1236,7 @@ func (v *TextDocumentClientCapabilities) MarshalJSONObject(enc *gojay.Encoder) {
12361236
func (v *TextDocumentClientCapabilities) IsNil() bool { return v == nil }
12371237

12381238
// UnmarshalJSONObject implements gojay's UnmarshalerJSONObject.
1239+
//nolint:funlen,gocognit
12391240
func (v *TextDocumentClientCapabilities) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {
12401241
switch k {
12411242
case keySynchronization:
@@ -1887,6 +1888,7 @@ func (v *ServerCapabilities) MarshalJSONObject(enc *gojay.Encoder) {
18871888
func (v *ServerCapabilities) IsNil() bool { return v == nil }
18881889

18891890
// UnmarshalJSONObject implements gojay's UnmarshalerJSONObject.
1891+
//nolint:funlen
18901892
func (v *ServerCapabilities) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {
18911893
switch k {
18921894
case keyTextDocumentSync:

language.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ type SignatureHelpRegistrationOptions struct {
395395
TriggerCharacters []string `json:"triggerCharacters,omitempty"`
396396
}
397397

398-
// ReferenceParams params of Find References Request
398+
// ReferenceParams params of Find References Request.
399399
type ReferenceParams struct {
400400
TextDocumentPositionParams
401401

@@ -657,12 +657,12 @@ type CodeActionParams struct {
657657
// to a default value when unknown.
658658
type CodeActionKind string
659659

660-
// A set of predefined code action kinds
660+
// A set of predefined code action kinds.
661661
const (
662-
// QuickFix base kind for quickfix actions: 'quickfix'
662+
// QuickFix base kind for quickfix actions: 'quickfix'.
663663
QuickFix CodeActionKind = "quickfix"
664664

665-
// Refactor base kind for refactoring actions: 'refactor'
665+
// Refactor base kind for refactoring actions: 'refactor'.
666666
Refactor CodeActionKind = "refactor"
667667

668668
// RefactorExtract base kind for refactoring extraction actions: 'refactor.extract'
@@ -703,7 +703,7 @@ const (
703703
// Source code actions apply to the entire file.
704704
Source CodeActionKind = "source"
705705

706-
// SourceOrganizeImports base kind for an organize imports source action: `source.organizeImports`
706+
// SourceOrganizeImports base kind for an organize imports source action: `source.organizeImports`.
707707
SourceOrganizeImports CodeActionKind = "source.organizeImports"
708708
)
709709

@@ -957,7 +957,7 @@ const (
957957

958958
// FoldingRange capabilities specific to `textDocument/foldingRange` requests.
959959
//
960-
// Since 3.10.0
960+
// Since 3.10.0.
961961
type FoldingRange struct {
962962
// StartLine is the zero-based line number from where the folded range starts.
963963
StartLine float64 `json:"startLine"`

server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func (s *server) CodeLensResolve(ctx context.Context, params *CodeLens) (result
323323
// Clients can use the result to
324324
//
325325
// - modify a color reference.
326-
// - show in a color picker and let users pick one of the presentations
326+
// - show in a color picker and let users pick one of the presentations.
327327
func (s *server) ColorPresentation(ctx context.Context, params *ColorPresentationParams) (result []ColorPresentation, err error) {
328328
err = s.Conn.Call(ctx, MethodTextDocumentColorPresentation, params, &result)
329329

@@ -418,7 +418,7 @@ func (s *server) DidChangeWatchedFiles(ctx context.Context, params *DidChangeWat
418418
// or if the server has registered itself to receive this notification.
419419
// To register for the workspace/didChangeWorkspaceFolders send a client/registerCapability request from the server to the client.
420420
//
421-
// The registration parameter must have a registrations item of the following form, where id is a unique id used to unregister the capability (the example uses a UUID)
421+
// The registration parameter must have a registrations item of the following form, where id is a unique id used to unregister the capability (the example uses a UUID).
422422
func (s *server) DidChangeWorkspaceFolders(ctx context.Context, params *DidChangeWorkspaceFoldersParams) (err error) {
423423
err = s.Conn.Notify(ctx, MethodWorkspaceDidChangeWorkspaceFolders, params)
424424
return
@@ -467,7 +467,7 @@ func (s *server) DidSave(ctx context.Context, params *DidSaveTextDocumentParams)
467467
// For example:
468468
//
469469
// - Color boxes showing the actual color next to the reference
470-
// - Show a color picker when a color reference is edited
470+
// - Show a color picker when a color reference is edited.
471471
func (s *server) DocumentColor(ctx context.Context, params *DocumentColorParams) (result []ColorInformation, err error) {
472472
err = s.Conn.Call(ctx, MethodTextDocumentDocumentColor, params, &result)
473473

server_gojay.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
)
1919

2020
// Deliver implements jsonrpc2.Handler.
21+
//nolint:funlen,gocognit
2122
func (h serverHandler) Deliver(ctx context.Context, r *jsonrpc2.Request, delivered bool) bool {
2223
if delivered {
2324
return false

server_json.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
)
1818

1919
// Deliver implements jsonrpc2.Handler.
20+
//nolint:funlen,gocognit
2021
func (h serverHandler) Deliver(ctx context.Context, r *jsonrpc2.Request, delivered bool) bool {
2122
if delivered {
2223
return false

0 commit comments

Comments
 (0)