@@ -155,8 +155,7 @@ func NewINOLanguageServer(stdin io.Reader, stdout io.Writer, config *Config) *IN
155
155
return ls
156
156
}
157
157
158
- // InitializeReqFromIDE initializes a new request from the IDE
159
- func (ls * INOLanguageServer ) InitializeReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.InitializeParams ) (* lsp.InitializeResult , * jsonrpc.ResponseError ) {
158
+ func (ls * INOLanguageServer ) initializeReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.InitializeParams ) (* lsp.InitializeResult , * jsonrpc.ResponseError ) {
160
159
ls .writeLock (logger , false )
161
160
ls .sketchRoot = ideParams .RootURI .AsPath ()
162
161
ls .sketchName = ls .sketchRoot .Base ()
@@ -364,8 +363,7 @@ func (ls *INOLanguageServer) InitializeReqFromIDE(ctx context.Context, logger js
364
363
return resp , nil
365
364
}
366
365
367
- // ShutdownReqFromIDE executes a shutdown request from the IDE
368
- func (ls * INOLanguageServer ) ShutdownReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger ) * jsonrpc.ResponseError {
366
+ func (ls * INOLanguageServer ) shutdownReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger ) * jsonrpc.ResponseError {
369
367
done := make (chan bool )
370
368
go func () {
371
369
ls .progressHandler .Shutdown ()
@@ -376,8 +374,7 @@ func (ls *INOLanguageServer) ShutdownReqFromIDE(ctx context.Context, logger json
376
374
return nil
377
375
}
378
376
379
- // TextDocumentCompletionReqFromIDE handles a text document completion request received from the IDE
380
- func (ls * INOLanguageServer ) TextDocumentCompletionReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.CompletionParams ) (* lsp.CompletionList , * jsonrpc.ResponseError ) {
377
+ func (ls * INOLanguageServer ) textDocumentCompletionReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.CompletionParams ) (* lsp.CompletionList , * jsonrpc.ResponseError ) {
381
378
ls .readLock (logger , true )
382
379
defer ls .readUnlock (logger )
383
380
@@ -471,8 +468,7 @@ func (ls *INOLanguageServer) TextDocumentCompletionReqFromIDE(ctx context.Contex
471
468
return ideCompletionList , nil
472
469
}
473
470
474
- // TextDocumentHoverReqFromIDE handles a text document hover request received from the IDE
475
- func (ls * INOLanguageServer ) TextDocumentHoverReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.HoverParams ) (* lsp.Hover , * jsonrpc.ResponseError ) {
471
+ func (ls * INOLanguageServer ) textDocumentHoverReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.HoverParams ) (* lsp.Hover , * jsonrpc.ResponseError ) {
476
472
ls .readLock (logger , true )
477
473
defer ls .readUnlock (logger )
478
474
@@ -523,8 +519,7 @@ func (ls *INOLanguageServer) TextDocumentHoverReqFromIDE(ctx context.Context, lo
523
519
return & ideResp , nil
524
520
}
525
521
526
- // TextDocumentSignatureHelpReqFromIDE handles a text document signature help request received from the IDE
527
- func (ls * INOLanguageServer ) TextDocumentSignatureHelpReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.SignatureHelpParams ) (* lsp.SignatureHelp , * jsonrpc.ResponseError ) {
522
+ func (ls * INOLanguageServer ) textDocumentSignatureHelpReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.SignatureHelpParams ) (* lsp.SignatureHelp , * jsonrpc.ResponseError ) {
528
523
ls .readLock (logger , true )
529
524
defer ls .readUnlock (logger )
530
525
@@ -555,8 +550,7 @@ func (ls *INOLanguageServer) TextDocumentSignatureHelpReqFromIDE(ctx context.Con
555
550
return ideSignatureHelp , nil
556
551
}
557
552
558
- // TextDocumentDefinitionReqFromIDE handles a text document definition request received from the IDE
559
- func (ls * INOLanguageServer ) TextDocumentDefinitionReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.DefinitionParams ) ([]lsp.Location , []lsp.LocationLink , * jsonrpc.ResponseError ) {
553
+ func (ls * INOLanguageServer ) textDocumentDefinitionReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.DefinitionParams ) ([]lsp.Location , []lsp.LocationLink , * jsonrpc.ResponseError ) {
560
554
ls .readLock (logger , true )
561
555
defer ls .readUnlock (logger )
562
556
@@ -600,8 +594,7 @@ func (ls *INOLanguageServer) TextDocumentDefinitionReqFromIDE(ctx context.Contex
600
594
return ideLocations , ideLocationLinks , nil
601
595
}
602
596
603
- // TextDocumentTypeDefinitionReqFromIDE handles a text document type definition request received from the IDE
604
- func (ls * INOLanguageServer ) TextDocumentTypeDefinitionReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.TypeDefinitionParams ) ([]lsp.Location , []lsp.LocationLink , * jsonrpc.ResponseError ) {
597
+ func (ls * INOLanguageServer ) textDocumentTypeDefinitionReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.TypeDefinitionParams ) ([]lsp.Location , []lsp.LocationLink , * jsonrpc.ResponseError ) {
605
598
// XXX: This capability is not advertised in the initialization message (clangd
606
599
// does not advertise it either, so maybe we should just not implement it)
607
600
ls .readLock (logger , true )
@@ -647,8 +640,7 @@ func (ls *INOLanguageServer) TextDocumentTypeDefinitionReqFromIDE(ctx context.Co
647
640
return ideLocations , ideLocationLinks , nil
648
641
}
649
642
650
- // TextDocumentImplementationReqFromIDE handles a text document implementation request received from the IDE
651
- func (ls * INOLanguageServer ) TextDocumentImplementationReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.ImplementationParams ) ([]lsp.Location , []lsp.LocationLink , * jsonrpc.ResponseError ) {
643
+ func (ls * INOLanguageServer ) textDocumentImplementationReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.ImplementationParams ) ([]lsp.Location , []lsp.LocationLink , * jsonrpc.ResponseError ) {
652
644
ls .readLock (logger , true )
653
645
defer ls .readUnlock (logger )
654
646
@@ -692,8 +684,7 @@ func (ls *INOLanguageServer) TextDocumentImplementationReqFromIDE(ctx context.Co
692
684
return ideLocations , inoLocationLinks , nil
693
685
}
694
686
695
- // TextDocumentDocumentHighlightReqFromIDE handles a text document highlight request received from the IDE
696
- func (ls * INOLanguageServer ) TextDocumentDocumentHighlightReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.DocumentHighlightParams ) ([]lsp.DocumentHighlight , * jsonrpc.ResponseError ) {
687
+ func (ls * INOLanguageServer ) textDocumentDocumentHighlightReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.DocumentHighlightParams ) ([]lsp.DocumentHighlight , * jsonrpc.ResponseError ) {
697
688
ls .readLock (logger , true )
698
689
defer ls .readUnlock (logger )
699
690
@@ -740,8 +731,7 @@ func (ls *INOLanguageServer) TextDocumentDocumentHighlightReqFromIDE(ctx context
740
731
return ideHighlights , nil
741
732
}
742
733
743
- // TextDocumentDocumentSymbolReqFromIDE handles a text document symbol request received from the IDE
744
- func (ls * INOLanguageServer ) TextDocumentDocumentSymbolReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.DocumentSymbolParams ) ([]lsp.DocumentSymbol , []lsp.SymbolInformation , * jsonrpc.ResponseError ) {
734
+ func (ls * INOLanguageServer ) textDocumentDocumentSymbolReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.DocumentSymbolParams ) ([]lsp.DocumentSymbol , []lsp.SymbolInformation , * jsonrpc.ResponseError ) {
745
735
ls .readLock (logger , true )
746
736
defer ls .readUnlock (logger )
747
737
@@ -787,8 +777,7 @@ func (ls *INOLanguageServer) TextDocumentDocumentSymbolReqFromIDE(ctx context.Co
787
777
return ideDocSymbols , ideSymbolsInformation , nil
788
778
}
789
779
790
- // TextDocumentCodeActionReqFromIDE handles a text document code action request received from the IDE
791
- func (ls * INOLanguageServer ) TextDocumentCodeActionReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.CodeActionParams ) ([]lsp.CommandOrCodeAction , * jsonrpc.ResponseError ) {
780
+ func (ls * INOLanguageServer ) textDocumentCodeActionReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.CodeActionParams ) ([]lsp.CommandOrCodeAction , * jsonrpc.ResponseError ) {
792
781
ls .readLock (logger , true )
793
782
defer ls .readUnlock (logger )
794
783
@@ -857,8 +846,7 @@ func (ls *INOLanguageServer) TextDocumentCodeActionReqFromIDE(ctx context.Contex
857
846
return ideCommandsOrCodeActions , nil
858
847
}
859
848
860
- // TextDocumentFormattingReqFromIDE handles a text document formatting request received from the IDE
861
- func (ls * INOLanguageServer ) TextDocumentFormattingReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.DocumentFormattingParams ) ([]lsp.TextEdit , * jsonrpc.ResponseError ) {
849
+ func (ls * INOLanguageServer ) textDocumentFormattingReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.DocumentFormattingParams ) ([]lsp.TextEdit , * jsonrpc.ResponseError ) {
862
850
ls .writeLock (logger , true )
863
851
defer ls .writeUnlock (logger )
864
852
@@ -913,8 +901,7 @@ func (ls *INOLanguageServer) TextDocumentFormattingReqFromIDE(ctx context.Contex
913
901
return inoEdits , nil
914
902
}
915
903
916
- // TextDocumentRangeFormattingReqFromIDE handles a text document range formatting request received from the IDE
917
- func (ls * INOLanguageServer ) TextDocumentRangeFormattingReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.DocumentRangeFormattingParams ) ([]lsp.TextEdit , * jsonrpc.ResponseError ) {
904
+ func (ls * INOLanguageServer ) textDocumentRangeFormattingReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.DocumentRangeFormattingParams ) ([]lsp.TextEdit , * jsonrpc.ResponseError ) {
918
905
ls .writeLock (logger , true )
919
906
defer ls .writeUnlock (logger )
920
907
@@ -967,20 +954,17 @@ func (ls *INOLanguageServer) TextDocumentRangeFormattingReqFromIDE(ctx context.C
967
954
return inoEdits , nil
968
955
}
969
956
970
- // InitializedNotifFromIDE initializes a notification from the IDE
971
- func (ls * INOLanguageServer ) InitializedNotifFromIDE (logger jsonrpc.FunctionLogger , ideParams * lsp.InitializedParams ) {
957
+ func (ls * INOLanguageServer ) initializedNotifFromIDE (logger jsonrpc.FunctionLogger , ideParams * lsp.InitializedParams ) {
972
958
logger .Logf ("Notification is not propagated to clangd" )
973
959
}
974
960
975
- // ExitNotifFromIDE logs an exit notification from the IDE
976
- func (ls * INOLanguageServer ) ExitNotifFromIDE (logger jsonrpc.FunctionLogger ) {
961
+ func (ls * INOLanguageServer ) exitNotifFromIDE (logger jsonrpc.FunctionLogger ) {
977
962
ls .Clangd .conn .Exit ()
978
963
logger .Logf ("Arduino Language Server is shutting down." )
979
964
os .Exit (0 )
980
965
}
981
966
982
- // TextDocumentDidOpenNotifFromIDE handles a notification from the IDE that TextDocument is open
983
- func (ls * INOLanguageServer ) TextDocumentDidOpenNotifFromIDE (logger jsonrpc.FunctionLogger , ideParam * lsp.DidOpenTextDocumentParams ) {
967
+ func (ls * INOLanguageServer ) textDocumentDidOpenNotifFromIDE (logger jsonrpc.FunctionLogger , ideParam * lsp.DidOpenTextDocumentParams ) {
984
968
ls .writeLock (logger , true )
985
969
defer ls .writeUnlock (logger )
986
970
@@ -1039,8 +1023,7 @@ func (ls *INOLanguageServer) TextDocumentDidOpenNotifFromIDE(logger jsonrpc.Func
1039
1023
}
1040
1024
}
1041
1025
1042
- // TextDocumentDidChangeNotifFromIDE handles a notification from the IDE that TextDocument changed
1043
- func (ls * INOLanguageServer ) TextDocumentDidChangeNotifFromIDE (logger jsonrpc.FunctionLogger , ideParams * lsp.DidChangeTextDocumentParams ) {
1026
+ func (ls * INOLanguageServer ) textDocumentDidChangeNotifFromIDE (logger jsonrpc.FunctionLogger , ideParams * lsp.DidChangeTextDocumentParams ) {
1044
1027
ls .writeLock (logger , true )
1045
1028
defer ls .writeUnlock (logger )
1046
1029
@@ -1136,8 +1119,7 @@ func (ls *INOLanguageServer) TextDocumentDidChangeNotifFromIDE(logger jsonrpc.Fu
1136
1119
}
1137
1120
}
1138
1121
1139
- // TextDocumentDidSaveNotifFromIDE handles a notification from the IDE that TextDocument has been saved
1140
- func (ls * INOLanguageServer ) TextDocumentDidSaveNotifFromIDE (logger jsonrpc.FunctionLogger , ideParams * lsp.DidSaveTextDocumentParams ) {
1122
+ func (ls * INOLanguageServer ) textDocumentDidSaveNotifFromIDE (logger jsonrpc.FunctionLogger , ideParams * lsp.DidSaveTextDocumentParams ) {
1141
1123
ls .writeLock (logger , true )
1142
1124
defer ls .writeUnlock (logger )
1143
1125
@@ -1148,8 +1130,7 @@ func (ls *INOLanguageServer) TextDocumentDidSaveNotifFromIDE(logger jsonrpc.Func
1148
1130
ls .triggerRebuild ()
1149
1131
}
1150
1132
1151
- // TextDocumentDidCloseNotifFromIDE handles a notification from the IDE that TextDocument has been closed
1152
- func (ls * INOLanguageServer ) TextDocumentDidCloseNotifFromIDE (logger jsonrpc.FunctionLogger , ideParams * lsp.DidCloseTextDocumentParams ) {
1133
+ func (ls * INOLanguageServer ) textDocumentDidCloseNotifFromIDE (logger jsonrpc.FunctionLogger , ideParams * lsp.DidCloseTextDocumentParams ) {
1153
1134
ls .writeLock (logger , true )
1154
1135
defer ls .writeUnlock (logger )
1155
1136
@@ -1192,8 +1173,7 @@ func (ls *INOLanguageServer) TextDocumentDidCloseNotifFromIDE(logger jsonrpc.Fun
1192
1173
}
1193
1174
}
1194
1175
1195
- // FullBuildCompletedFromIDE receives a full build from the IDE and copies the results
1196
- func (ls * INOLanguageServer ) FullBuildCompletedFromIDE (logger jsonrpc.FunctionLogger , params * DidCompleteBuildParams ) {
1176
+ func (ls * INOLanguageServer ) fullBuildCompletedFromIDE (logger jsonrpc.FunctionLogger , params * DidCompleteBuildParams ) {
1197
1177
ls .writeLock (logger , true )
1198
1178
defer ls .writeUnlock (logger )
1199
1179
@@ -1212,8 +1192,7 @@ func (ls *INOLanguageServer) CopyFullBuildResults(logger jsonrpc.FunctionLogger,
1212
1192
}
1213
1193
}
1214
1194
1215
- // PublishDiagnosticsNotifFromClangd publishes a diagnostics if notified from Clangd
1216
- func (ls * INOLanguageServer ) PublishDiagnosticsNotifFromClangd (logger jsonrpc.FunctionLogger , clangParams * lsp.PublishDiagnosticsParams ) {
1195
+ func (ls * INOLanguageServer ) publishDiagnosticsNotifFromClangd (logger jsonrpc.FunctionLogger , clangParams * lsp.PublishDiagnosticsParams ) {
1217
1196
if ls .config .DisableRealTimeDiagnostics {
1218
1197
logger .Logf ("Ignored by configuration" )
1219
1198
return
@@ -1293,8 +1272,7 @@ func (ls *INOLanguageServer) PublishDiagnosticsNotifFromClangd(logger jsonrpc.Fu
1293
1272
}
1294
1273
}
1295
1274
1296
- // TextDocumentRenameReqFromIDE handles a request from the IDE to rename TextDocument
1297
- func (ls * INOLanguageServer ) TextDocumentRenameReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.RenameParams ) (* lsp.WorkspaceEdit , * jsonrpc.ResponseError ) {
1275
+ func (ls * INOLanguageServer ) textDocumentRenameReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.RenameParams ) (* lsp.WorkspaceEdit , * jsonrpc.ResponseError ) {
1298
1276
ls .writeLock (logger , false )
1299
1277
defer ls .writeUnlock (logger )
1300
1278
@@ -1340,8 +1318,7 @@ func (ls *INOLanguageServer) ideURIIsPartOfTheSketch(ideURI lsp.DocumentURI) boo
1340
1318
return res
1341
1319
}
1342
1320
1343
- // ProgressNotifFromClangd handles a progress request from clangd
1344
- func (ls * INOLanguageServer ) ProgressNotifFromClangd (logger jsonrpc.FunctionLogger , progress * lsp.ProgressParams ) {
1321
+ func (ls * INOLanguageServer ) progressNotifFromClangd (logger jsonrpc.FunctionLogger , progress * lsp.ProgressParams ) {
1345
1322
var token string
1346
1323
if err := json .Unmarshal (progress .Token , & token ); err != nil {
1347
1324
logger .Logf ("error decoding progress token: %s" , err )
@@ -1362,8 +1339,7 @@ func (ls *INOLanguageServer) ProgressNotifFromClangd(logger jsonrpc.FunctionLogg
1362
1339
}
1363
1340
}
1364
1341
1365
- // WindowWorkDoneProgressCreateReqFromClangd handles a progress create request from clangd
1366
- func (ls * INOLanguageServer ) WindowWorkDoneProgressCreateReqFromClangd (ctx context.Context , logger jsonrpc.FunctionLogger , params * lsp.WorkDoneProgressCreateParams ) * jsonrpc.ResponseError {
1342
+ func (ls * INOLanguageServer ) windowWorkDoneProgressCreateReqFromClangd (ctx context.Context , logger jsonrpc.FunctionLogger , params * lsp.WorkDoneProgressCreateParams ) * jsonrpc.ResponseError {
1367
1343
var token string
1368
1344
if err := json .Unmarshal (params .Token , & token ); err != nil {
1369
1345
logger .Logf ("error decoding progress token: %s" , err )
@@ -1373,8 +1349,7 @@ func (ls *INOLanguageServer) WindowWorkDoneProgressCreateReqFromClangd(ctx conte
1373
1349
return nil
1374
1350
}
1375
1351
1376
- // SetTraceNotifFromIDE gets a notification from the IDE to Set Trace to parameters
1377
- func (ls * INOLanguageServer ) SetTraceNotifFromIDE (logger jsonrpc.FunctionLogger , params * lsp.SetTraceParams ) {
1352
+ func (ls * INOLanguageServer ) setTraceNotifFromIDE (logger jsonrpc.FunctionLogger , params * lsp.SetTraceParams ) {
1378
1353
logger .Logf ("Notification level set to: %s" , params .Value )
1379
1354
ls .Clangd .conn .SetTrace (params )
1380
1355
}
0 commit comments