@@ -157,16 +157,20 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
157157 log .Printf (" --> hover(%s:%d:%d)\n " , doc .TextDocument .URI , doc .Position .Line , doc .Position .Character )
158158
159159 case * lsp.DidChangeTextDocumentParams : // "textDocument/didChange":
160+ log .Printf ("UNHANDLED " + req .Method )
160161 uri = p .TextDocument .URI
161162 err = handler .ino2cppDidChangeTextDocumentParams (ctx , p )
162163 case * lsp.DidSaveTextDocumentParams : // "textDocument/didSave":
164+ log .Printf ("UNHANDLED " + req .Method )
163165 uri = p .TextDocument .URI
164166 err = handler .sketchToBuildPathTextDocumentIdentifier (& p .TextDocument )
165167 case * lsp.DidCloseTextDocumentParams : // "textDocument/didClose":
168+ log .Printf ("UNHANDLED " + req .Method )
166169 uri = p .TextDocument .URI
167170 err = handler .sketchToBuildPathTextDocumentIdentifier (& p .TextDocument )
168171 handler .deleteFileData (uri )
169172 case * lsp.CodeActionParams : // "textDocument/codeAction":
173+ log .Printf ("UNHANDLED " + req .Method )
170174 uri = p .TextDocument .URI
171175 err = handler .ino2cppCodeActionParams (p )
172176 // case "textDocument/signatureHelp":
@@ -178,29 +182,38 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
178182 // case "textDocument/implementation":
179183 // fallthrough
180184 case * lsp.TextDocumentPositionParams : // "textDocument/documentHighlight":
185+ log .Printf ("UNHANDLED " + req .Method )
181186 uri = p .TextDocument .URI
182187 err = handler .ino2cppTextDocumentPositionParams (p )
183188 case * lsp.ReferenceParams : // "textDocument/references":
189+ log .Printf ("UNHANDLED " + req .Method )
184190 uri = p .TextDocument .URI
185191 err = handler .ino2cppTextDocumentPositionParams (& p .TextDocumentPositionParams )
186192 case * lsp.DocumentFormattingParams : // "textDocument/formatting":
193+ log .Printf ("UNHANDLED " + req .Method )
187194 uri = p .TextDocument .URI
188195 err = handler .sketchToBuildPathTextDocumentIdentifier (& p .TextDocument )
189196 case * lsp.DocumentRangeFormattingParams : // "textDocument/rangeFormatting":
197+ log .Printf ("UNHANDLED " + req .Method )
190198 uri = p .TextDocument .URI
191199 err = handler .ino2cppDocumentRangeFormattingParams (p )
192200 case * lsp.DocumentOnTypeFormattingParams : // "textDocument/onTypeFormatting":
201+ log .Printf ("UNHANDLED " + req .Method )
193202 uri = p .TextDocument .URI
194203 err = handler .ino2cppDocumentOnTypeFormattingParams (p )
195204 case * lsp.DocumentSymbolParams : // "textDocument/documentSymbol":
205+ log .Printf ("UNHANDLED " + req .Method )
196206 uri = p .TextDocument .URI
197207 err = handler .sketchToBuildPathTextDocumentIdentifier (& p .TextDocument )
198208 case * lsp.RenameParams : // "textDocument/rename":
209+ log .Printf ("UNHANDLED " + req .Method )
199210 uri = p .TextDocument .URI
200211 err = handler .ino2cppRenameParams (p )
201212 case * lsp.DidChangeWatchedFilesParams : // "workspace/didChangeWatchedFiles":
213+ log .Printf ("UNHANDLED " + req .Method )
202214 err = handler .ino2cppDidChangeWatchedFilesParams (p )
203215 case * lsp.ExecuteCommandParams : // "workspace/executeCommand":
216+ log .Printf ("UNHANDLED " + req .Method )
204217 err = handler .ino2cppExecuteCommand (p )
205218 }
206219 if err != nil {
@@ -823,6 +836,11 @@ func (handler *InoHandler) FromClangd(ctx context.Context, connection *jsonrpc2.
823836 switch p := params .(type ) {
824837 case * lsp.PublishDiagnosticsParams :
825838 // "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+
826844 if newPathFromURI (p .URI ).EquivalentTo (handler .buildSketchCpp ) {
827845 // we should transform back N diagnostics of sketch.cpp.ino into
828846 // their .ino counter parts (that may span over multiple files...)
@@ -845,11 +863,14 @@ func (handler *InoHandler) FromClangd(ctx context.Context, connection *jsonrpc2.
845863 URI : pathToURI (filename ),
846864 Diagnostics : inoDiags ,
847865 }
848- if err := handler .StdioConn .Notify (ctx , req .Method , msg ); err != nil {
849- return nil , err
850- }
851866 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
853874 }
854875 }
855876
0 commit comments