Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 400503f

Browse files
committedAug 3, 2022
Fix formatting errors in go files
1 parent 7196b79 commit 400503f

File tree

7 files changed

+166
-40
lines changed

7 files changed

+166
-40
lines changed
 

‎ls/builder.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ type SketchRebuilder struct {
3232
mutex sync.Mutex
3333
}
3434

35+
// NewSketchBuilder makes a new SketchRebuilder and returns its pointer
3536
func NewSketchBuilder(ls *INOLanguageServer) *SketchRebuilder {
3637
res := &SketchRebuilder{
3738
trigger: make(chan chan<- bool, 1),
@@ -57,6 +58,7 @@ func (ls *INOLanguageServer) triggerRebuild() {
5758
ls.sketchRebuilder.TriggerRebuild(nil)
5859
}
5960

61+
// TriggerRebuild assigns completed to the trigger if ready
6062
func (r *SketchRebuilder) TriggerRebuild(completed chan<- bool) {
6163
r.mutex.Lock()
6264
defer r.mutex.Unlock()
@@ -207,8 +209,8 @@ func (ls *INOLanguageServer) generateBuildEnvironment(ctx context.Context, fullB
207209
Verbose: true,
208210
SkipLibrariesDiscovery: !fullBuild,
209211
}
210-
compileReqJson, _ := json.MarshalIndent(compileReq, "", " ")
211-
logger.Logf("Running build with: %s", string(compileReqJson))
212+
compileReqJSON, _ := json.MarshalIndent(compileReq, "", " ")
213+
logger.Logf("Running build with: %s", string(compileReqJSON))
212214

213215
compRespStream, err := client.Compile(context.Background(), compileReq)
214216
if err != nil {

‎ls/ls.go

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ func NewINOLanguageServer(stdin io.Reader, stdout io.Writer, config *Config) *IN
155155
return ls
156156
}
157157

158+
// InitializeReqFromIDE initializes a new request from the IDE
158159
func (ls *INOLanguageServer) InitializeReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.InitializeParams) (*lsp.InitializeResult, *jsonrpc.ResponseError) {
159160
ls.writeLock(logger, false)
160161
ls.sketchRoot = ideParams.RootURI.AsPath()
@@ -363,6 +364,7 @@ func (ls *INOLanguageServer) InitializeReqFromIDE(ctx context.Context, logger js
363364
return resp, nil
364365
}
365366

367+
// ShutdownReqFromIDE executes a shutdown request from the IDE
366368
func (ls *INOLanguageServer) ShutdownReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger) *jsonrpc.ResponseError {
367369
done := make(chan bool)
368370
go func() {
@@ -374,6 +376,7 @@ func (ls *INOLanguageServer) ShutdownReqFromIDE(ctx context.Context, logger json
374376
return nil
375377
}
376378

379+
// TextDocumentCompletionReqFromIDE handles a text document completion request received from the IDE
377380
func (ls *INOLanguageServer) TextDocumentCompletionReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.CompletionParams) (*lsp.CompletionList, *jsonrpc.ResponseError) {
378381
ls.readLock(logger, true)
379382
defer ls.readUnlock(logger)
@@ -468,6 +471,7 @@ func (ls *INOLanguageServer) TextDocumentCompletionReqFromIDE(ctx context.Contex
468471
return ideCompletionList, nil
469472
}
470473

474+
// TextDocumentHoverReqFromIDE handles a text document hover request received from the IDE
471475
func (ls *INOLanguageServer) TextDocumentHoverReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.HoverParams) (*lsp.Hover, *jsonrpc.ResponseError) {
472476
ls.readLock(logger, true)
473477
defer ls.readUnlock(logger)
@@ -519,6 +523,7 @@ func (ls *INOLanguageServer) TextDocumentHoverReqFromIDE(ctx context.Context, lo
519523
return &ideResp, nil
520524
}
521525

526+
// TextDocumentSignatureHelpReqFromIDE handles a text document signature help request received from the IDE
522527
func (ls *INOLanguageServer) TextDocumentSignatureHelpReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.SignatureHelpParams) (*lsp.SignatureHelp, *jsonrpc.ResponseError) {
523528
ls.readLock(logger, true)
524529
defer ls.readUnlock(logger)
@@ -550,6 +555,7 @@ func (ls *INOLanguageServer) TextDocumentSignatureHelpReqFromIDE(ctx context.Con
550555
return ideSignatureHelp, nil
551556
}
552557

558+
// TextDocumentDefinitionReqFromIDE handles a text document definition request received from the IDE
553559
func (ls *INOLanguageServer) TextDocumentDefinitionReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.DefinitionParams) ([]lsp.Location, []lsp.LocationLink, *jsonrpc.ResponseError) {
554560
ls.readLock(logger, true)
555561
defer ls.readUnlock(logger)
@@ -594,6 +600,7 @@ func (ls *INOLanguageServer) TextDocumentDefinitionReqFromIDE(ctx context.Contex
594600
return ideLocations, ideLocationLinks, nil
595601
}
596602

603+
// TextDocumentTypeDefinitionReqFromIDE handles a text document type definition request received from the IDE
597604
func (ls *INOLanguageServer) TextDocumentTypeDefinitionReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.TypeDefinitionParams) ([]lsp.Location, []lsp.LocationLink, *jsonrpc.ResponseError) {
598605
// XXX: This capability is not advertised in the initialization message (clangd
599606
// does not advertise it either, so maybe we should just not implement it)
@@ -640,6 +647,7 @@ func (ls *INOLanguageServer) TextDocumentTypeDefinitionReqFromIDE(ctx context.Co
640647
return ideLocations, ideLocationLinks, nil
641648
}
642649

650+
// TextDocumentImplementationReqFromIDE handles a text document implementation request received from the IDE
643651
func (ls *INOLanguageServer) TextDocumentImplementationReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.ImplementationParams) ([]lsp.Location, []lsp.LocationLink, *jsonrpc.ResponseError) {
644652
ls.readLock(logger, true)
645653
defer ls.readUnlock(logger)
@@ -684,6 +692,7 @@ func (ls *INOLanguageServer) TextDocumentImplementationReqFromIDE(ctx context.Co
684692
return ideLocations, inoLocationLinks, nil
685693
}
686694

695+
// TextDocumentDocumentHighlightReqFromIDE handles a text document highlight request received from the IDE
687696
func (ls *INOLanguageServer) TextDocumentDocumentHighlightReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.DocumentHighlightParams) ([]lsp.DocumentHighlight, *jsonrpc.ResponseError) {
688697
ls.readLock(logger, true)
689698
defer ls.readUnlock(logger)
@@ -731,6 +740,7 @@ func (ls *INOLanguageServer) TextDocumentDocumentHighlightReqFromIDE(ctx context
731740
return ideHighlights, nil
732741
}
733742

743+
// TextDocumentDocumentSymbolReqFromIDE handles a text document symbol request received from the IDE
734744
func (ls *INOLanguageServer) TextDocumentDocumentSymbolReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.DocumentSymbolParams) ([]lsp.DocumentSymbol, []lsp.SymbolInformation, *jsonrpc.ResponseError) {
735745
ls.readLock(logger, true)
736746
defer ls.readUnlock(logger)
@@ -762,13 +772,13 @@ func (ls *INOLanguageServer) TextDocumentDocumentSymbolReqFromIDE(ctx context.Co
762772
// Convert response for IDE
763773
var ideDocSymbols []lsp.DocumentSymbol
764774
if clangDocSymbols != nil {
765-
if s, err := ls.clang2IdeDocumentSymbols(logger, clangDocSymbols, clangParams.TextDocument.URI, ideParams.TextDocument.URI); err != nil {
775+
s, err := ls.clang2IdeDocumentSymbols(logger, clangDocSymbols, clangParams.TextDocument.URI, ideParams.TextDocument.URI)
776+
if err != nil {
766777
logger.Logf("Error: %s", err)
767778
ls.Close()
768779
return nil, nil, &jsonrpc.ResponseError{Code: jsonrpc.ErrorCodesInternalError, Message: err.Error()}
769-
} else {
770-
ideDocSymbols = s
771780
}
781+
ideDocSymbols = s
772782
}
773783
var ideSymbolsInformation []lsp.SymbolInformation
774784
if clangSymbolsInformation != nil {
@@ -777,6 +787,7 @@ func (ls *INOLanguageServer) TextDocumentDocumentSymbolReqFromIDE(ctx context.Co
777787
return ideDocSymbols, ideSymbolsInformation, nil
778788
}
779789

790+
// TextDocumentCodeActionReqFromIDE handles a text document code action request received from the IDE
780791
func (ls *INOLanguageServer) TextDocumentCodeActionReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.CodeActionParams) ([]lsp.CommandOrCodeAction, *jsonrpc.ResponseError) {
781792
ls.readLock(logger, true)
782793
defer ls.readUnlock(logger)
@@ -846,6 +857,7 @@ func (ls *INOLanguageServer) TextDocumentCodeActionReqFromIDE(ctx context.Contex
846857
return ideCommandsOrCodeActions, nil
847858
}
848859

860+
// TextDocumentFormattingReqFromIDE handles a text document formatting request received from the IDE
849861
func (ls *INOLanguageServer) TextDocumentFormattingReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.DocumentFormattingParams) ([]lsp.TextEdit, *jsonrpc.ResponseError) {
850862
ls.writeLock(logger, true)
851863
defer ls.writeUnlock(logger)
@@ -860,12 +872,12 @@ func (ls *INOLanguageServer) TextDocumentFormattingReqFromIDE(ctx context.Contex
860872
}
861873
clangURI := clangTextDocument.URI
862874

863-
if cleanup, err := ls.createClangdFormatterConfig(logger, clangURI); err != nil {
875+
cleanup, err := ls.createClangdFormatterConfig(logger, clangURI)
876+
if err != nil {
864877
logger.Logf("Error: %s", err)
865878
return nil, &jsonrpc.ResponseError{Code: jsonrpc.ErrorCodesInternalError, Message: err.Error()}
866-
} else {
867-
defer cleanup()
868879
}
880+
defer cleanup()
869881

870882
clangParams := &lsp.DocumentFormattingParams{
871883
WorkDoneProgressParams: ideParams.WorkDoneProgressParams,
@@ -894,13 +906,14 @@ func (ls *INOLanguageServer) TextDocumentFormattingReqFromIDE(ctx context.Contex
894906
}
895907

896908
// Edits may span over multiple .ino files, filter only the edits relative to the currently displayed file
897-
if inoEdits, ok := ideEdits[ideURI]; !ok {
909+
inoEdits, ok := ideEdits[ideURI]
910+
if !ok {
898911
return []lsp.TextEdit{}, nil
899-
} else {
900-
return inoEdits, nil
901912
}
913+
return inoEdits, nil
902914
}
903915

916+
// TextDocumentRangeFormattingReqFromIDE handles a text document range formatting request received from the IDE
904917
func (ls *INOLanguageServer) TextDocumentRangeFormattingReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.DocumentRangeFormattingParams) ([]lsp.TextEdit, *jsonrpc.ResponseError) {
905918
ls.writeLock(logger, true)
906919
defer ls.writeUnlock(logger)
@@ -918,12 +931,12 @@ func (ls *INOLanguageServer) TextDocumentRangeFormattingReqFromIDE(ctx context.C
918931
Range: clangRange,
919932
}
920933

921-
if cleanup, e := ls.createClangdFormatterConfig(logger, clangURI); e != nil {
934+
cleanup, e := ls.createClangdFormatterConfig(logger, clangURI)
935+
if e != nil {
922936
logger.Logf("cannot create formatter config file: %v", err)
923937
return nil, &jsonrpc.ResponseError{Code: jsonrpc.ErrorCodesInternalError, Message: err.Error()}
924-
} else {
925-
defer cleanup()
926938
}
939+
defer cleanup()
927940

928941
clangEdits, clangErr, err := ls.Clangd.conn.TextDocumentRangeFormatting(ctx, clangParams)
929942
if err != nil {
@@ -947,23 +960,26 @@ func (ls *INOLanguageServer) TextDocumentRangeFormattingReqFromIDE(ctx context.C
947960
}
948961

949962
// Edits may span over multiple .ino files, filter only the edits relative to the currently displayed file
950-
if inoEdits, ok := sketchEdits[ideURI]; !ok {
963+
inoEdits, ok := sketchEdits[ideURI]
964+
if !ok {
951965
return []lsp.TextEdit{}, nil
952-
} else {
953-
return inoEdits, nil
954966
}
967+
return inoEdits, nil
955968
}
956969

970+
// InitializedNotifFromIDE initializes a notification from the IDE
957971
func (ls *INOLanguageServer) InitializedNotifFromIDE(logger jsonrpc.FunctionLogger, ideParams *lsp.InitializedParams) {
958972
logger.Logf("Notification is not propagated to clangd")
959973
}
960974

975+
// ExitNotifFromIDE logs an exit notification from the IDE
961976
func (ls *INOLanguageServer) ExitNotifFromIDE(logger jsonrpc.FunctionLogger) {
962977
ls.Clangd.conn.Exit()
963978
logger.Logf("Arduino Language Server is shutting down.")
964979
os.Exit(0)
965980
}
966981

982+
// TextDocumentDidOpenNotifFromIDE handles a notification from the IDE that TextDocument is open
967983
func (ls *INOLanguageServer) TextDocumentDidOpenNotifFromIDE(logger jsonrpc.FunctionLogger, ideParam *lsp.DidOpenTextDocumentParams) {
968984
ls.writeLock(logger, true)
969985
defer ls.writeUnlock(logger)
@@ -1023,6 +1039,7 @@ func (ls *INOLanguageServer) TextDocumentDidOpenNotifFromIDE(logger jsonrpc.Func
10231039
}
10241040
}
10251041

1042+
// TextDocumentDidChangeNotifFromIDE handles a notification from the IDE that TextDocument changed
10261043
func (ls *INOLanguageServer) TextDocumentDidChangeNotifFromIDE(logger jsonrpc.FunctionLogger, ideParams *lsp.DidChangeTextDocumentParams) {
10271044
ls.writeLock(logger, true)
10281045
defer ls.writeUnlock(logger)
@@ -1119,6 +1136,7 @@ func (ls *INOLanguageServer) TextDocumentDidChangeNotifFromIDE(logger jsonrpc.Fu
11191136
}
11201137
}
11211138

1139+
// TextDocumentDidSaveNotifFromIDE handles a notification from the IDE that TextDocument has been saved
11221140
func (ls *INOLanguageServer) TextDocumentDidSaveNotifFromIDE(logger jsonrpc.FunctionLogger, ideParams *lsp.DidSaveTextDocumentParams) {
11231141
ls.writeLock(logger, true)
11241142
defer ls.writeUnlock(logger)
@@ -1130,6 +1148,7 @@ func (ls *INOLanguageServer) TextDocumentDidSaveNotifFromIDE(logger jsonrpc.Func
11301148
ls.triggerRebuild()
11311149
}
11321150

1151+
// TextDocumentDidCloseNotifFromIDE handles a notification from the IDE that TextDocument has been closed
11331152
func (ls *INOLanguageServer) TextDocumentDidCloseNotifFromIDE(logger jsonrpc.FunctionLogger, ideParams *lsp.DidCloseTextDocumentParams) {
11341153
ls.writeLock(logger, true)
11351154
defer ls.writeUnlock(logger)
@@ -1173,14 +1192,16 @@ func (ls *INOLanguageServer) TextDocumentDidCloseNotifFromIDE(logger jsonrpc.Fun
11731192
}
11741193
}
11751194

1195+
// FullBuildCompletedFromIDE receives a full build from the IDE and copies the results
11761196
func (ls *INOLanguageServer) FullBuildCompletedFromIDE(logger jsonrpc.FunctionLogger, params *DidCompleteBuildParams) {
11771197
ls.writeLock(logger, true)
11781198
defer ls.writeUnlock(logger)
11791199

1180-
ls.CopyFullBuildResults(logger, params.BuildOutputUri.AsPath())
1200+
ls.CopyFullBuildResults(logger, params.BuildOutputURI.AsPath())
11811201
ls.triggerRebuild()
11821202
}
11831203

1204+
// CopyFullBuildResults copies the results of a full build
11841205
func (ls *INOLanguageServer) CopyFullBuildResults(logger jsonrpc.FunctionLogger, buildPath *paths.Path) {
11851206
fromCache := buildPath.Join("libraries.cache")
11861207
toCache := ls.buildPath.Join("libraries.cache")
@@ -1191,6 +1212,7 @@ func (ls *INOLanguageServer) CopyFullBuildResults(logger jsonrpc.FunctionLogger,
11911212
}
11921213
}
11931214

1215+
// PublishDiagnosticsNotifFromClangd publishes a diagnostics if notified from Clangd
11941216
func (ls *INOLanguageServer) PublishDiagnosticsNotifFromClangd(logger jsonrpc.FunctionLogger, clangParams *lsp.PublishDiagnosticsParams) {
11951217
if ls.config.DisableRealTimeDiagnostics {
11961218
logger.Logf("Ignored by configuration")
@@ -1271,6 +1293,7 @@ func (ls *INOLanguageServer) PublishDiagnosticsNotifFromClangd(logger jsonrpc.Fu
12711293
}
12721294
}
12731295

1296+
// TextDocumentRenameReqFromIDE handles a request from the IDE to rename TextDocument
12741297
func (ls *INOLanguageServer) TextDocumentRenameReqFromIDE(ctx context.Context, logger jsonrpc.FunctionLogger, ideParams *lsp.RenameParams) (*lsp.WorkspaceEdit, *jsonrpc.ResponseError) {
12751298
ls.writeLock(logger, false)
12761299
defer ls.writeUnlock(logger)
@@ -1348,6 +1371,7 @@ func (ls *INOLanguageServer) WindowWorkDoneProgressCreateReqFromClangd(ctx conte
13481371
return nil
13491372
}
13501373

1374+
// SetTraceNotifFromIDE gets a notification from the IDE to Set Trace to parameters
13511375
func (ls *INOLanguageServer) SetTraceNotifFromIDE(logger jsonrpc.FunctionLogger, params *lsp.SetTraceParams) {
13521376
logger.Logf("Notification level set to: %s", params.Value)
13531377
ls.Clangd.conn.SetTrace(params)

‎ls/ls_ide_to_clang.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ func (ls *INOLanguageServer) ide2ClangRange(logger jsonrpc.FunctionLogger, ideUR
9494
if ls.clangURIRefersToIno(clangURI) {
9595
if clangRange, ok := ls.sketchMapper.InoToCppLSPRangeOk(ideURI, ideRange); ok {
9696
return clangURI, clangRange, nil
97-
} else {
98-
return lsp.DocumentURI{}, lsp.Range{}, fmt.Errorf("invalid range %s:%s: could not be mapped to Arduino-preprocessed sketck.ino.cpp", ideURI, ideRange)
9997
}
98+
return lsp.DocumentURI{}, lsp.Range{}, fmt.Errorf("invalid range %s:%s: could not be mapped to Arduino-preprocessed sketck.ino.cpp", ideURI, ideRange)
10099
} else if inSketch {
101100
// Convert other sketch file ranges (.cpp/.h)
102101
clangRange := ideRange

‎ls/lsp_client_clangd.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type ClangdLSPClient struct {
2121
ls *INOLanguageServer
2222
}
2323

24+
// NewClangdLSPClient creates and returns a new client
2425
func NewClangdLSPClient(logger jsonrpc.FunctionLogger, dataFolder *paths.Path, ls *INOLanguageServer) *ClangdLSPClient {
2526
clangdConfFile := ls.buildPath.Join(".clangd")
2627
clangdConf := fmt.Sprintln("Diagnostics:")
@@ -72,7 +73,7 @@ func NewClangdLSPClient(logger jsonrpc.FunctionLogger, dataFolder *paths.Path, l
7273
ls: ls,
7374
}
7475
client.conn = lsp.NewClient(clangdStdio, clangdStdio, client)
75-
client.conn.SetLogger(&LSPLogger{
76+
client.conn.SetLogger(&PLogger{
7677
IncomingPrefix: "IDE LS <-- Clangd",
7778
OutgoingPrefix: "IDE LS --> Clangd",
7879
HiColor: color.HiRedString,
@@ -82,73 +83,90 @@ func NewClangdLSPClient(logger jsonrpc.FunctionLogger, dataFolder *paths.Path, l
8283
return client
8384
}
8485

86+
// Run sends a Run notification to Clangd
8587
func (client *ClangdLSPClient) Run() {
8688
client.conn.Run()
8789
}
8890

91+
// Close sends an Exit notification to Clangd
8992
func (client *ClangdLSPClient) Close() {
9093
client.conn.Exit() // send "exit" notification to Clangd
9194
// TODO: kill client.conn
9295
}
9396

9497
// The following are events incoming from Clangd
9598

99+
// WindowShowMessageRequest is not implemented
96100
func (client *ClangdLSPClient) WindowShowMessageRequest(context.Context, jsonrpc.FunctionLogger, *lsp.ShowMessageRequestParams) (*lsp.MessageActionItem, *jsonrpc.ResponseError) {
97101
panic("unimplemented")
98102
}
99103

104+
// WindowShowDocument is not implemented
100105
func (client *ClangdLSPClient) WindowShowDocument(context.Context, jsonrpc.FunctionLogger, *lsp.ShowDocumentParams) (*lsp.ShowDocumentResult, *jsonrpc.ResponseError) {
101106
panic("unimplemented")
102107
}
103108

109+
// WindowWorkDoneProgressCreate is not implemented
104110
func (client *ClangdLSPClient) WindowWorkDoneProgressCreate(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.WorkDoneProgressCreateParams) *jsonrpc.ResponseError {
105111
return client.ls.WindowWorkDoneProgressCreateReqFromClangd(ctx, logger, params)
106112
}
107113

114+
// ClientRegisterCapability is not implemented
108115
func (client *ClangdLSPClient) ClientRegisterCapability(context.Context, jsonrpc.FunctionLogger, *lsp.RegistrationParams) *jsonrpc.ResponseError {
109116
panic("unimplemented")
110117
}
111118

119+
// ClientUnregisterCapability is not implemented
112120
func (client *ClangdLSPClient) ClientUnregisterCapability(context.Context, jsonrpc.FunctionLogger, *lsp.UnregistrationParams) *jsonrpc.ResponseError {
113121
panic("unimplemented")
114122
}
115123

124+
// WorkspaceWorkspaceFolders is not implemented
116125
func (client *ClangdLSPClient) WorkspaceWorkspaceFolders(context.Context, jsonrpc.FunctionLogger) ([]lsp.WorkspaceFolder, *jsonrpc.ResponseError) {
117126
panic("unimplemented")
118127
}
119128

129+
// WorkspaceConfiguration is not implemented
120130
func (client *ClangdLSPClient) WorkspaceConfiguration(context.Context, jsonrpc.FunctionLogger, *lsp.ConfigurationParams) ([]json.RawMessage, *jsonrpc.ResponseError) {
121131
panic("unimplemented")
122132
}
123133

134+
// WorkspaceApplyEdit is not implemented
124135
func (client *ClangdLSPClient) WorkspaceApplyEdit(context.Context, jsonrpc.FunctionLogger, *lsp.ApplyWorkspaceEditParams) (*lsp.ApplyWorkspaceEditResult, *jsonrpc.ResponseError) {
125136
panic("unimplemented")
126137
}
127138

139+
// WorkspaceCodeLensRefresh is not implemented
128140
func (client *ClangdLSPClient) WorkspaceCodeLensRefresh(context.Context, jsonrpc.FunctionLogger) *jsonrpc.ResponseError {
129141
panic("unimplemented")
130142
}
131143

144+
// Progress sends a Progress notification
132145
func (client *ClangdLSPClient) Progress(logger jsonrpc.FunctionLogger, progress *lsp.ProgressParams) {
133146
client.ls.ProgressNotifFromClangd(logger, progress)
134147
}
135148

149+
// LogTrace is not implemented
136150
func (client *ClangdLSPClient) LogTrace(jsonrpc.FunctionLogger, *lsp.LogTraceParams) {
137151
panic("unimplemented")
138152
}
139153

154+
// WindowShowMessage is not implemented
140155
func (client *ClangdLSPClient) WindowShowMessage(jsonrpc.FunctionLogger, *lsp.ShowMessageParams) {
141156
panic("unimplemented")
142157
}
143158

159+
// WindowLogMessage is not implemented
144160
func (client *ClangdLSPClient) WindowLogMessage(jsonrpc.FunctionLogger, *lsp.LogMessageParams) {
145161
panic("unimplemented")
146162
}
147163

164+
// TelemetryEvent is not implemented
148165
func (client *ClangdLSPClient) TelemetryEvent(jsonrpc.FunctionLogger, json.RawMessage) {
149166
panic("unimplemented")
150167
}
151168

169+
// TextDocumentPublishDiagnostics sends a notification to Publish Dignostics
152170
func (client *ClangdLSPClient) TextDocumentPublishDiagnostics(logger jsonrpc.FunctionLogger, params *lsp.PublishDiagnosticsParams) {
153171
go client.ls.PublishDiagnosticsNotifFromClangd(logger, params)
154172
}

‎ls/lsp_logger.go

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import (
1010
"go.bug.st/lsp/jsonrpc"
1111
)
1212

13-
type LSPLogger struct {
13+
// PLogger is a lsp logger
14+
type PLogger struct {
1415
IncomingPrefix, OutgoingPrefix string
1516
HiColor, LoColor func(format string, a ...interface{}) string
1617
ErrorColor func(format string, a ...interface{}) string
@@ -20,69 +21,89 @@ func init() {
2021
log.SetFlags(log.Lmicroseconds)
2122
}
2223

23-
func (l *LSPLogger) LogOutgoingRequest(id string, method string, params json.RawMessage) {
24+
// LogOutgoingRequest prints an outgoing request into the log
25+
func (l *PLogger) LogOutgoingRequest(id string, method string, params json.RawMessage) {
2426
log.Print(l.HiColor("%s REQU %s %s", l.OutgoingPrefix, method, id))
2527
}
26-
func (l *LSPLogger) LogOutgoingCancelRequest(id string) {
28+
29+
// LogOutgoingCancelRequest prints an outgoing cancel request into the log
30+
func (l *PLogger) LogOutgoingCancelRequest(id string) {
2731
log.Print(l.LoColor("%s CANCEL %s", l.OutgoingPrefix, id))
2832
}
29-
func (l *LSPLogger) LogIncomingResponse(id string, method string, resp json.RawMessage, respErr *jsonrpc.ResponseError) {
33+
34+
// LogIncomingResponse prints an incoming response into the log if there is no error
35+
func (l *PLogger) LogIncomingResponse(id string, method string, resp json.RawMessage, respErr *jsonrpc.ResponseError) {
3036
e := ""
3137
if respErr != nil {
3238
e = l.ErrorColor(" ERROR: %s", respErr.AsError())
3339
}
3440
log.Print(l.LoColor("%s RESP %s %s%s", l.IncomingPrefix, method, id, e))
3541
}
36-
func (l *LSPLogger) LogOutgoingNotification(method string, params json.RawMessage) {
42+
43+
// LogOutgoingNotification prints an outgoing notification into the log
44+
func (l *PLogger) LogOutgoingNotification(method string, params json.RawMessage) {
3745
log.Print(l.HiColor("%s NOTIF %s", l.OutgoingPrefix, method))
3846
}
3947

40-
func (l *LSPLogger) LogIncomingRequest(id string, method string, params json.RawMessage) jsonrpc.FunctionLogger {
48+
// LogIncomingRequest prints an incoming request into the log
49+
func (l *PLogger) LogIncomingRequest(id string, method string, params json.RawMessage) jsonrpc.FunctionLogger {
4150
spaces := " "
4251
log.Print(l.HiColor(fmt.Sprintf("%s REQU %s %s", l.IncomingPrefix, method, id)))
43-
return &LSPFunctionLogger{
52+
return &PFunctionLogger{
4453
colorFunc: l.HiColor,
4554
prefix: fmt.Sprintf("%s %s %s", spaces[:len(l.IncomingPrefix)], method, id),
4655
}
4756
}
48-
func (l *LSPLogger) LogIncomingCancelRequest(id string) {
57+
58+
// LogIncomingCancelRequest prints an incoming cancel request into the log
59+
func (l *PLogger) LogIncomingCancelRequest(id string) {
4960
log.Print(l.LoColor("%s CANCEL %s", l.IncomingPrefix, id))
5061
}
51-
func (l *LSPLogger) LogOutgoingResponse(id string, method string, resp json.RawMessage, respErr *jsonrpc.ResponseError) {
62+
63+
// LogOutgoingResponse prints an outgoing response into the log if there is no error
64+
func (l *PLogger) LogOutgoingResponse(id string, method string, resp json.RawMessage, respErr *jsonrpc.ResponseError) {
5265
e := ""
5366
if respErr != nil {
5467
e = l.ErrorColor(" ERROR: %s", respErr.AsError())
5568
}
5669
log.Print(l.LoColor("%s RESP %s %s%s", l.OutgoingPrefix, method, id, e))
5770
}
58-
func (l *LSPLogger) LogIncomingNotification(method string, params json.RawMessage) jsonrpc.FunctionLogger {
71+
72+
// LogIncomingNotification prints an incoming notification into the log
73+
func (l *PLogger) LogIncomingNotification(method string, params json.RawMessage) jsonrpc.FunctionLogger {
5974
spaces := " "
6075
log.Print(l.HiColor(fmt.Sprintf("%s NOTIF %s", l.IncomingPrefix, method)))
61-
return &LSPFunctionLogger{
76+
return &PFunctionLogger{
6277
colorFunc: l.HiColor,
6378
prefix: fmt.Sprintf("%s %s", spaces[:len(l.IncomingPrefix)], method),
6479
}
6580
}
66-
func (l *LSPLogger) LogIncomingDataDelay(delay time.Duration) {
81+
82+
// LogIncomingDataDelay prints the delay of incoming data into the log
83+
func (l *PLogger) LogIncomingDataDelay(delay time.Duration) {
6784
log.Printf("IN Elapsed: %v", delay)
6885
}
69-
func (l *LSPLogger) LogOutgoingDataDelay(delay time.Duration) {
86+
87+
// LogOutgoingDataDelay prints the delay of outgoing data into the log
88+
func (l *PLogger) LogOutgoingDataDelay(delay time.Duration) {
7089
log.Printf("OUT Elapsed: %v", delay)
7190
}
7291

73-
type LSPFunctionLogger struct {
92+
// PFunctionLogger is a lsp function logger
93+
type PFunctionLogger struct {
7494
colorFunc func(format string, a ...interface{}) string
7595
prefix string
7696
}
7797

78-
func NewLSPFunctionLogger(colofFunction func(format string, a ...interface{}) string, prefix string) *LSPFunctionLogger {
98+
// NewLSPFunctionLogger creates a new function logger
99+
func NewLSPFunctionLogger(colofFunction func(format string, a ...interface{}) string, prefix string) *PFunctionLogger {
79100
color.NoColor = false
80-
return &LSPFunctionLogger{
101+
return &PFunctionLogger{
81102
colorFunc: colofFunction,
82103
prefix: prefix,
83104
}
84105
}
85106

86-
func (l *LSPFunctionLogger) Logf(format string, a ...interface{}) {
107+
func (l *PFunctionLogger) Logf(format string, a ...interface{}) {
87108
log.Print(l.colorFunc(l.prefix+": "+format, a...))
88109
}

‎ls/lsp_server_ide.go

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@ import (
1010
"go.bug.st/lsp/jsonrpc"
1111
)
1212

13+
// IDELSPServer is an IDE lsp server
1314
type IDELSPServer struct {
1415
conn *lsp.Server
1516
ls *INOLanguageServer
1617
}
1718

19+
// NewIDELSPServer creates and return a new server
1820
func NewIDELSPServer(logger jsonrpc.FunctionLogger, in io.Reader, out io.Writer, ls *INOLanguageServer) *IDELSPServer {
1921
server := &IDELSPServer{
2022
ls: ls,
2123
}
2224
server.conn = lsp.NewServer(in, out, server)
2325
server.conn.RegisterCustomNotification("ino/didCompleteBuild", server.ArduinoBuildCompleted)
24-
server.conn.SetLogger(&LSPLogger{
26+
server.conn.SetLogger(&PLogger{
2527
IncomingPrefix: "IDE --> LS",
2628
OutgoingPrefix: "IDE <-- LS",
2729
HiColor: color.HiGreenString,
@@ -31,204 +33,254 @@ func NewIDELSPServer(logger jsonrpc.FunctionLogger, in io.Reader, out io.Writer,
3133
return server
3234
}
3335

36+
// Run runs the server connection
3437
func (server *IDELSPServer) Run() {
3538
server.conn.Run()
3639
}
3740

41+
// Initialize sends an initilize request
3842
func (server *IDELSPServer) Initialize(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.InitializeParams) (*lsp.InitializeResult, *jsonrpc.ResponseError) {
3943
return server.ls.InitializeReqFromIDE(ctx, logger, params)
4044
}
4145

46+
// Shutdown sends a shutdown request
4247
func (server *IDELSPServer) Shutdown(ctx context.Context, logger jsonrpc.FunctionLogger) *jsonrpc.ResponseError {
4348
return server.ls.ShutdownReqFromIDE(ctx, logger)
4449
}
4550

51+
// WorkspaceSymbol is not implemented
4652
func (server *IDELSPServer) WorkspaceSymbol(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.WorkspaceSymbolParams) ([]lsp.SymbolInformation, *jsonrpc.ResponseError) {
4753
panic("unimplemented")
4854
}
4955

56+
// WorkspaceExecuteCommand is not implemented
5057
func (server *IDELSPServer) WorkspaceExecuteCommand(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.ExecuteCommandParams) (json.RawMessage, *jsonrpc.ResponseError) {
5158
panic("unimplemented")
5259
}
5360

61+
// WorkspaceWillCreateFiles is not implemented
5462
func (server *IDELSPServer) WorkspaceWillCreateFiles(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CreateFilesParams) (*lsp.WorkspaceEdit, *jsonrpc.ResponseError) {
5563
panic("unimplemented")
5664
}
5765

66+
// WorkspaceWillRenameFiles is not implemented
5867
func (server *IDELSPServer) WorkspaceWillRenameFiles(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.RenameFilesParams) (*lsp.WorkspaceEdit, *jsonrpc.ResponseError) {
5968
panic("unimplemented")
6069
}
6170

71+
// WorkspaceWillDeleteFiles is not implemented
6272
func (server *IDELSPServer) WorkspaceWillDeleteFiles(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DeleteFilesParams) (*lsp.WorkspaceEdit, *jsonrpc.ResponseError) {
6373
panic("unimplemented")
6474
}
6575

76+
// TextDocumentWillSaveWaitUntil is not implemented
6677
func (server *IDELSPServer) TextDocumentWillSaveWaitUntil(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.WillSaveTextDocumentParams) ([]lsp.TextEdit, *jsonrpc.ResponseError) {
6778
panic("unimplemented")
6879
}
6980

81+
// TextDocumentCompletion is not implemented
7082
func (server *IDELSPServer) TextDocumentCompletion(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CompletionParams) (*lsp.CompletionList, *jsonrpc.ResponseError) {
7183
return server.ls.TextDocumentCompletionReqFromIDE(ctx, logger, params)
7284
}
7385

86+
// CompletionItemResolve is not implemented
7487
func (server *IDELSPServer) CompletionItemResolve(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CompletionItem) (*lsp.CompletionItem, *jsonrpc.ResponseError) {
7588
panic("unimplemented")
7689
}
7790

91+
// TextDocumentHover sends a request to hover a text document
7892
func (server *IDELSPServer) TextDocumentHover(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.HoverParams) (*lsp.Hover, *jsonrpc.ResponseError) {
7993
return server.ls.TextDocumentHoverReqFromIDE(ctx, logger, params)
8094
}
8195

96+
// TextDocumentSignatureHelp requests help for text document signature
8297
func (server *IDELSPServer) TextDocumentSignatureHelp(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.SignatureHelpParams) (*lsp.SignatureHelp, *jsonrpc.ResponseError) {
8398
return server.ls.TextDocumentSignatureHelpReqFromIDE(ctx, logger, params)
8499
}
85100

101+
// TextDocumentDeclaration is not implemented
86102
func (server *IDELSPServer) TextDocumentDeclaration(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DeclarationParams) ([]lsp.Location, []lsp.LocationLink, *jsonrpc.ResponseError) {
87103
panic("unimplemented")
88104
}
89105

106+
// TextDocumentDefinition sends a request to define a text document
90107
func (server *IDELSPServer) TextDocumentDefinition(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DefinitionParams) ([]lsp.Location, []lsp.LocationLink, *jsonrpc.ResponseError) {
91108
return server.ls.TextDocumentDefinitionReqFromIDE(ctx, logger, params)
92109
}
93110

111+
// TextDocumentTypeDefinition sends a request to define a type for the text document
94112
func (server *IDELSPServer) TextDocumentTypeDefinition(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.TypeDefinitionParams) ([]lsp.Location, []lsp.LocationLink, *jsonrpc.ResponseError) {
95113
return server.ls.TextDocumentTypeDefinitionReqFromIDE(ctx, logger, params)
96114
}
97115

116+
// TextDocumentImplementation sends a request to implement a text document
98117
func (server *IDELSPServer) TextDocumentImplementation(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.ImplementationParams) ([]lsp.Location, []lsp.LocationLink, *jsonrpc.ResponseError) {
99118
return server.ls.TextDocumentImplementationReqFromIDE(ctx, logger, params)
100119
}
101120

121+
// TextDocumentReferences is not implemented
102122
func (server *IDELSPServer) TextDocumentReferences(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.ReferenceParams) ([]lsp.Location, *jsonrpc.ResponseError) {
103123
panic("unimplemented")
104124
}
105125

126+
// TextDocumentDocumentHighlight sends a request to highlight a text document
106127
func (server *IDELSPServer) TextDocumentDocumentHighlight(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentHighlightParams) ([]lsp.DocumentHighlight, *jsonrpc.ResponseError) {
107128
return server.ls.TextDocumentDocumentHighlightReqFromIDE(ctx, logger, params)
108129
}
109130

131+
// TextDocumentDocumentSymbol sends a request for text document symbol
110132
func (server *IDELSPServer) TextDocumentDocumentSymbol(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentSymbolParams) ([]lsp.DocumentSymbol, []lsp.SymbolInformation, *jsonrpc.ResponseError) {
111133
return server.ls.TextDocumentDocumentSymbolReqFromIDE(ctx, logger, params)
112134
}
113135

136+
// TextDocumentCodeAction sends a request for text document code action
114137
func (server *IDELSPServer) TextDocumentCodeAction(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CodeActionParams) ([]lsp.CommandOrCodeAction, *jsonrpc.ResponseError) {
115138
return server.ls.TextDocumentCodeActionReqFromIDE(ctx, logger, params)
116139
}
117140

141+
// CodeActionResolve is not implemented
118142
func (server *IDELSPServer) CodeActionResolve(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CodeAction) (*lsp.CodeAction, *jsonrpc.ResponseError) {
119143
panic("unimplemented")
120144
}
121145

146+
// TextDocumentCodeLens is not implemented
122147
func (server *IDELSPServer) TextDocumentCodeLens(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CodeLensParams) ([]lsp.CodeLens, *jsonrpc.ResponseError) {
123148
panic("unimplemented")
124149
}
125150

151+
// CodeLensResolve is not implemented
126152
func (server *IDELSPServer) CodeLensResolve(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CodeLens) (*lsp.CodeLens, *jsonrpc.ResponseError) {
127153
panic("unimplemented")
128154
}
129155

156+
// TextDocumentDocumentLink is not implemented
130157
func (server *IDELSPServer) TextDocumentDocumentLink(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentLinkParams) ([]lsp.DocumentLink, *jsonrpc.ResponseError) {
131158
panic("unimplemented")
132159
}
133160

161+
// DocumentLinkResolve is not implemented
134162
func (server *IDELSPServer) DocumentLinkResolve(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentLink) (*lsp.DocumentLink, *jsonrpc.ResponseError) {
135163
panic("unimplemented")
136164
}
137165

166+
// TextDocumentDocumentColor is not implemented
138167
func (server *IDELSPServer) TextDocumentDocumentColor(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentColorParams) ([]lsp.ColorInformation, *jsonrpc.ResponseError) {
139168
panic("unimplemented")
140169
}
141170

171+
// TextDocumentColorPresentation is not implemented
142172
func (server *IDELSPServer) TextDocumentColorPresentation(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.ColorPresentationParams) ([]lsp.ColorPresentation, *jsonrpc.ResponseError) {
143173
panic("unimplemented")
144174
}
145175

176+
// TextDocumentFormatting sends a request to format a text document
146177
func (server *IDELSPServer) TextDocumentFormatting(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentFormattingParams) ([]lsp.TextEdit, *jsonrpc.ResponseError) {
147178
return server.ls.TextDocumentFormattingReqFromIDE(ctx, logger, params)
148179
}
149180

181+
// TextDocumentRangeFormatting sends a request to format the range a text document
150182
func (server *IDELSPServer) TextDocumentRangeFormatting(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentRangeFormattingParams) ([]lsp.TextEdit, *jsonrpc.ResponseError) {
151183
return server.ls.TextDocumentRangeFormattingReqFromIDE(ctx, logger, params)
152184
}
153185

186+
// TextDocumentOnTypeFormatting is not implemented
154187
func (server *IDELSPServer) TextDocumentOnTypeFormatting(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentOnTypeFormattingParams) ([]lsp.TextEdit, *jsonrpc.ResponseError) {
155188
panic("unimplemented")
156189
}
157190

191+
// TextDocumentRename sends a request to rename a text document
158192
func (server *IDELSPServer) TextDocumentRename(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.RenameParams) (*lsp.WorkspaceEdit, *jsonrpc.ResponseError) {
159193
return server.ls.TextDocumentRenameReqFromIDE(ctx, logger, params)
160194
}
161195

196+
// TextDocumentFoldingRange is not implemented
162197
func (server *IDELSPServer) TextDocumentFoldingRange(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.FoldingRangeParams) ([]lsp.FoldingRange, *jsonrpc.ResponseError) {
163198
panic("unimplemented")
164199
}
165200

201+
// TextDocumentSelectionRange is not implemented
166202
func (server *IDELSPServer) TextDocumentSelectionRange(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.SelectionRangeParams) ([]lsp.SelectionRange, *jsonrpc.ResponseError) {
167203
panic("unimplemented")
168204
}
169205

206+
// TextDocumentPrepareCallHierarchy is not implemented
170207
func (server *IDELSPServer) TextDocumentPrepareCallHierarchy(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CallHierarchyPrepareParams) ([]lsp.CallHierarchyItem, *jsonrpc.ResponseError) {
171208
panic("unimplemented")
172209
}
173210

211+
// CallHierarchyIncomingCalls is not implemented
174212
func (server *IDELSPServer) CallHierarchyIncomingCalls(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CallHierarchyIncomingCallsParams) ([]lsp.CallHierarchyIncomingCall, *jsonrpc.ResponseError) {
175213
panic("unimplemented")
176214
}
177215

216+
// CallHierarchyOutgoingCalls is not implemented
178217
func (server *IDELSPServer) CallHierarchyOutgoingCalls(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CallHierarchyOutgoingCallsParams) ([]lsp.CallHierarchyOutgoingCall, *jsonrpc.ResponseError) {
179218
panic("unimplemented")
180219
}
181220

221+
// TextDocumentSemanticTokensFull is not implemented
182222
func (server *IDELSPServer) TextDocumentSemanticTokensFull(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.SemanticTokensParams) (*lsp.SemanticTokens, *jsonrpc.ResponseError) {
183223
panic("unimplemented")
184224
}
185225

226+
// TextDocumentSemanticTokensFullDelta is not implemented
186227
func (server *IDELSPServer) TextDocumentSemanticTokensFullDelta(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.SemanticTokensDeltaParams) (*lsp.SemanticTokens, *lsp.SemanticTokensDelta, *jsonrpc.ResponseError) {
187228
panic("unimplemented")
188229
}
189230

231+
// TextDocumentSemanticTokensRange is not implemented
190232
func (server *IDELSPServer) TextDocumentSemanticTokensRange(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.SemanticTokensRangeParams) (*lsp.SemanticTokens, *jsonrpc.ResponseError) {
191233
panic("unimplemented")
192234
}
193235

236+
// WorkspaceSemanticTokensRefresh is not implemented
194237
func (server *IDELSPServer) WorkspaceSemanticTokensRefresh(ctx context.Context, logger jsonrpc.FunctionLogger) *jsonrpc.ResponseError {
195238
panic("unimplemented")
196239
}
197240

241+
// TextDocumentLinkedEditingRange is not implemented
198242
func (server *IDELSPServer) TextDocumentLinkedEditingRange(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.LinkedEditingRangeParams) (*lsp.LinkedEditingRanges, *jsonrpc.ResponseError) {
199243
panic("unimplemented")
200244
}
201245

246+
// TextDocumentMoniker is not implemented
202247
func (server *IDELSPServer) TextDocumentMoniker(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.MonikerParams) ([]lsp.Moniker, *jsonrpc.ResponseError) {
203248
panic("unimplemented")
204249
}
205250

206251
// Notifications ->
207252

253+
// Progress is not implemented
208254
func (server *IDELSPServer) Progress(logger jsonrpc.FunctionLogger, params *lsp.ProgressParams) {
209255
panic("unimplemented")
210256
}
211257

258+
// Initialized sends an initialized notification
212259
func (server *IDELSPServer) Initialized(logger jsonrpc.FunctionLogger, params *lsp.InitializedParams) {
213260
server.ls.InitializedNotifFromIDE(logger, params)
214261
}
215262

263+
// Exit sends an exit notification
216264
func (server *IDELSPServer) Exit(logger jsonrpc.FunctionLogger) {
217265
server.ls.ExitNotifFromIDE(logger)
218266
}
219267

268+
// SetTrace sends a set trace notification
220269
func (server *IDELSPServer) SetTrace(logger jsonrpc.FunctionLogger, params *lsp.SetTraceParams) {
221270
server.ls.SetTraceNotifFromIDE(logger, params)
222271
}
223272

273+
// WindowWorkDoneProgressCancel is not implemented
224274
func (server *IDELSPServer) WindowWorkDoneProgressCancel(logger jsonrpc.FunctionLogger, params *lsp.WorkDoneProgressCancelParams) {
225275
panic("unimplemented")
226276
}
227277

278+
// WorkspaceDidChangeWorkspaceFolders is not implemented
228279
func (server *IDELSPServer) WorkspaceDidChangeWorkspaceFolders(logger jsonrpc.FunctionLogger, params *lsp.DidChangeWorkspaceFoldersParams) {
229280
panic("unimplemented")
230281
}
231282

283+
// WorkspaceDidChangeConfiguration purpose is explained below
232284
func (server *IDELSPServer) WorkspaceDidChangeConfiguration(logger jsonrpc.FunctionLogger, params *lsp.DidChangeConfigurationParams) {
233285
// At least one LSP client, Eglot, sends this by default when
234286
// first connecting, even if the otions are empty.
@@ -240,45 +292,54 @@ func (server *IDELSPServer) WorkspaceDidChangeConfiguration(logger jsonrpc.Funct
240292

241293
}
242294

295+
// WorkspaceDidChangeWatchedFiles is not implemented
243296
func (server *IDELSPServer) WorkspaceDidChangeWatchedFiles(logger jsonrpc.FunctionLogger, params *lsp.DidChangeWatchedFilesParams) {
244297
panic("unimplemented")
245298
}
246299

300+
// WorkspaceDidCreateFiles is not implemented
247301
func (server *IDELSPServer) WorkspaceDidCreateFiles(logger jsonrpc.FunctionLogger, params *lsp.CreateFilesParams) {
248302
panic("unimplemented")
249303
}
250304

305+
// WorkspaceDidRenameFiles is not implemented
251306
func (server *IDELSPServer) WorkspaceDidRenameFiles(logger jsonrpc.FunctionLogger, params *lsp.RenameFilesParams) {
252307
panic("unimplemented")
253308
}
254309

310+
// WorkspaceDidDeleteFiles is not implemented
255311
func (server *IDELSPServer) WorkspaceDidDeleteFiles(logger jsonrpc.FunctionLogger, params *lsp.DeleteFilesParams) {
256312
panic("unimplemented")
257313
}
258314

315+
// TextDocumentDidOpen sends a notification the a text document is open
259316
func (server *IDELSPServer) TextDocumentDidOpen(logger jsonrpc.FunctionLogger, params *lsp.DidOpenTextDocumentParams) {
260317
server.ls.TextDocumentDidOpenNotifFromIDE(logger, params)
261318
}
262319

320+
// TextDocumentDidChange sends a notification the a text document has changed
263321
func (server *IDELSPServer) TextDocumentDidChange(logger jsonrpc.FunctionLogger, params *lsp.DidChangeTextDocumentParams) {
264322
server.ls.TextDocumentDidChangeNotifFromIDE(logger, params)
265323
}
266324

325+
// TextDocumentWillSave is not implemented
267326
func (server *IDELSPServer) TextDocumentWillSave(logger jsonrpc.FunctionLogger, params *lsp.WillSaveTextDocumentParams) {
268327
panic("unimplemented")
269328
}
270329

330+
// TextDocumentDidSave sends a notification the a text document has been saved
271331
func (server *IDELSPServer) TextDocumentDidSave(logger jsonrpc.FunctionLogger, params *lsp.DidSaveTextDocumentParams) {
272332
server.ls.TextDocumentDidSaveNotifFromIDE(logger, params)
273333
}
274334

335+
// TextDocumentDidClose sends a notification the a text document has been closed
275336
func (server *IDELSPServer) TextDocumentDidClose(logger jsonrpc.FunctionLogger, params *lsp.DidCloseTextDocumentParams) {
276337
server.ls.TextDocumentDidCloseNotifFromIDE(logger, params)
277338
}
278339

279340
// DidCompleteBuildParams is a custom notification from the Arduino IDE, sent
280341
type DidCompleteBuildParams struct {
281-
BuildOutputUri *lsp.DocumentURI `json:"buildOutputUri"`
342+
BuildOutputURI *lsp.DocumentURI `json:"buildOutputUri"`
282343
}
283344

284345
func (server *IDELSPServer) ArduinoBuildCompleted(logger jsonrpc.FunctionLogger, raw json.RawMessage) {

‎ls/progress.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type progressProxy struct {
3434
endReq *lsp.WorkDoneProgressEnd
3535
}
3636

37+
// NewProgressProxy creates a new ProgressProxyHandler and returns its pointer
3738
func NewProgressProxy(conn *lsp.Server) *ProgressProxyHandler {
3839
res := &ProgressProxyHandler{
3940
conn: conn,

0 commit comments

Comments
 (0)
Please sign in to comment.