@@ -157,16 +157,20 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
157
157
log .Printf (" --> hover(%s:%d:%d)\n " , doc .TextDocument .URI , doc .Position .Line , doc .Position .Character )
158
158
159
159
case * lsp.DidChangeTextDocumentParams : // "textDocument/didChange":
160
+ log .Printf ("UNHANDLED " + req .Method )
160
161
uri = p .TextDocument .URI
161
162
err = handler .ino2cppDidChangeTextDocumentParams (ctx , p )
162
163
case * lsp.DidSaveTextDocumentParams : // "textDocument/didSave":
164
+ log .Printf ("UNHANDLED " + req .Method )
163
165
uri = p .TextDocument .URI
164
166
err = handler .sketchToBuildPathTextDocumentIdentifier (& p .TextDocument )
165
167
case * lsp.DidCloseTextDocumentParams : // "textDocument/didClose":
168
+ log .Printf ("UNHANDLED " + req .Method )
166
169
uri = p .TextDocument .URI
167
170
err = handler .sketchToBuildPathTextDocumentIdentifier (& p .TextDocument )
168
171
handler .deleteFileData (uri )
169
172
case * lsp.CodeActionParams : // "textDocument/codeAction":
173
+ log .Printf ("UNHANDLED " + req .Method )
170
174
uri = p .TextDocument .URI
171
175
err = handler .ino2cppCodeActionParams (p )
172
176
// case "textDocument/signatureHelp":
@@ -178,29 +182,38 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
178
182
// case "textDocument/implementation":
179
183
// fallthrough
180
184
case * lsp.TextDocumentPositionParams : // "textDocument/documentHighlight":
185
+ log .Printf ("UNHANDLED " + req .Method )
181
186
uri = p .TextDocument .URI
182
187
err = handler .ino2cppTextDocumentPositionParams (p )
183
188
case * lsp.ReferenceParams : // "textDocument/references":
189
+ log .Printf ("UNHANDLED " + req .Method )
184
190
uri = p .TextDocument .URI
185
191
err = handler .ino2cppTextDocumentPositionParams (& p .TextDocumentPositionParams )
186
192
case * lsp.DocumentFormattingParams : // "textDocument/formatting":
193
+ log .Printf ("UNHANDLED " + req .Method )
187
194
uri = p .TextDocument .URI
188
195
err = handler .sketchToBuildPathTextDocumentIdentifier (& p .TextDocument )
189
196
case * lsp.DocumentRangeFormattingParams : // "textDocument/rangeFormatting":
197
+ log .Printf ("UNHANDLED " + req .Method )
190
198
uri = p .TextDocument .URI
191
199
err = handler .ino2cppDocumentRangeFormattingParams (p )
192
200
case * lsp.DocumentOnTypeFormattingParams : // "textDocument/onTypeFormatting":
201
+ log .Printf ("UNHANDLED " + req .Method )
193
202
uri = p .TextDocument .URI
194
203
err = handler .ino2cppDocumentOnTypeFormattingParams (p )
195
204
case * lsp.DocumentSymbolParams : // "textDocument/documentSymbol":
205
+ log .Printf ("UNHANDLED " + req .Method )
196
206
uri = p .TextDocument .URI
197
207
err = handler .sketchToBuildPathTextDocumentIdentifier (& p .TextDocument )
198
208
case * lsp.RenameParams : // "textDocument/rename":
209
+ log .Printf ("UNHANDLED " + req .Method )
199
210
uri = p .TextDocument .URI
200
211
err = handler .ino2cppRenameParams (p )
201
212
case * lsp.DidChangeWatchedFilesParams : // "workspace/didChangeWatchedFiles":
213
+ log .Printf ("UNHANDLED " + req .Method )
202
214
err = handler .ino2cppDidChangeWatchedFilesParams (p )
203
215
case * lsp.ExecuteCommandParams : // "workspace/executeCommand":
216
+ log .Printf ("UNHANDLED " + req .Method )
204
217
err = handler .ino2cppExecuteCommand (p )
205
218
}
206
219
if err != nil {
@@ -823,6 +836,11 @@ func (handler *InoHandler) FromClangd(ctx context.Context, connection *jsonrpc2.
823
836
switch p := params .(type ) {
824
837
case * lsp.PublishDiagnosticsParams :
825
838
// "textDocument/publishDiagnostics"
839
+ log .Printf (" <-- publishDiagnostics(%s):" , p .URI )
840
+ for _ , diag := range p .Diagnostics {
841
+ log .Printf (" > %d:%d - %v: %s" , diag .Range .Start .Line , diag .Range .Start .Character , diag .Severity , diag .Code )
842
+ }
843
+
826
844
if newPathFromURI (p .URI ).EquivalentTo (handler .buildSketchCpp ) {
827
845
// we should transform back N diagnostics of sketch.cpp.ino into
828
846
// their .ino counter parts (that may span over multiple files...)
@@ -845,11 +863,14 @@ func (handler *InoHandler) FromClangd(ctx context.Context, connection *jsonrpc2.
845
863
URI : pathToURI (filename ),
846
864
Diagnostics : inoDiags ,
847
865
}
848
- if err := handler .StdioConn .Notify (ctx , req .Method , msg ); err != nil {
849
- return nil , err
850
- }
851
866
if enableLogging {
852
- log .Println ("--> " , req .Method )
867
+ log .Printf ("<-- publishDiagnostics(%s):" , msg .URI )
868
+ for _ , diag := range msg .Diagnostics {
869
+ log .Printf (" > %d:%d - %v: %s" , diag .Range .Start .Line , diag .Range .Start .Character , diag .Severity , diag .Code )
870
+ }
871
+ }
872
+ if err := handler .StdioConn .Notify (ctx , "textDocument/publishDiagnostics" , msg ); err != nil {
873
+ return nil , err
853
874
}
854
875
}
855
876
0 commit comments