@@ -279,9 +279,9 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
279279 log .Printf ("--> %s(%s:%s)" , req .Method , p .TextDocument .URI , p .Position )
280280 inoURI = p .TextDocument .URI
281281 if res , e := handler .ino2cppTextDocumentPositionParams (p ); e == nil {
282- cppURI = p .TextDocument .URI
282+ cppURI = res .TextDocument .URI
283283 params = res
284- log .Printf (" --> %s(%s:%s)" , req .Method , p .TextDocument .URI , p .Position )
284+ log .Printf (" --> %s(%s:%s)" , req .Method , res .TextDocument .URI , res .Position )
285285 } else {
286286 err = e
287287 }
@@ -453,7 +453,7 @@ func (handler *InoHandler) refreshCppDocumentSymbols() error {
453453 if err != nil {
454454 return errors .WithMessage (err , "quering source code symbols" )
455455 }
456- result = handler .transformClangdResult ("textDocument/documentSymbol" , cppURI , "" , result )
456+ result = handler .transformClangdResult ("textDocument/documentSymbol" , cppURI , lsp . NilURI , result )
457457 if symbols , ok := result .([]lsp.DocumentSymbol ); ! ok {
458458 return errors .WithMessage (err , "quering source code symbols (2)" )
459459 } else {
@@ -748,7 +748,7 @@ func (handler *InoHandler) ino2cppDocumentURI(inoURI lsp.DocumentURI) (lsp.Docum
748748 inside , err := inoPath .IsInsideDir (handler .sketchRoot )
749749 if err != nil {
750750 log .Printf (" could not determine if '%s' is inside '%s'" , inoPath , handler .sketchRoot )
751- return "" , unknownURI (inoURI )
751+ return lsp . NilURI , unknownURI (inoURI )
752752 }
753753 if ! inside {
754754 log .Printf (" passing doc identifier to '%s' as-is" , inoPath )
@@ -763,7 +763,7 @@ func (handler *InoHandler) ino2cppDocumentURI(inoURI lsp.DocumentURI) (lsp.Docum
763763 }
764764
765765 log .Printf (" could not determine rel-path of '%s' in '%s': %s" , inoPath , handler .sketchRoot , err )
766- return "" , err
766+ return lsp . NilURI , err
767767}
768768
769769func (handler * InoHandler ) cpp2inoDocumentURI (cppURI lsp.DocumentURI , cppRange lsp.Range ) (lsp.DocumentURI , lsp.Range , error ) {
@@ -791,7 +791,7 @@ func (handler *InoHandler) cpp2inoDocumentURI(cppURI lsp.DocumentURI, cppRange l
791791 inside , err := cppPath .IsInsideDir (handler .buildSketchRoot )
792792 if err != nil {
793793 log .Printf (" could not determine if '%s' is inside '%s'" , cppPath , handler .buildSketchRoot )
794- return "" , lsp.Range {}, err
794+ return lsp . NilURI , lsp.Range {}, err
795795 }
796796 if ! inside {
797797 log .Printf (" keep doc identifier to '%s' as-is" , cppPath )
@@ -806,7 +806,7 @@ func (handler *InoHandler) cpp2inoDocumentURI(cppURI lsp.DocumentURI, cppRange l
806806 }
807807
808808 log .Printf (" could not determine rel-path of '%s' in '%s': %s" , cppPath , handler .buildSketchRoot , err )
809- return "" , lsp.Range {}, err
809+ return lsp . NilURI , lsp.Range {}, err
810810}
811811
812812func (handler * InoHandler ) ino2cppTextDocumentPositionParams (inoParams * lsp.TextDocumentPositionParams ) (* lsp.TextDocumentPositionParams , error ) {
@@ -833,7 +833,7 @@ func (handler *InoHandler) ino2cppTextDocumentPositionParams(inoParams *lsp.Text
833833func (handler * InoHandler ) ino2cppRange (inoURI lsp.DocumentURI , inoRange lsp.Range ) (lsp.DocumentURI , lsp.Range , error ) {
834834 cppURI , err := handler .ino2cppDocumentURI (inoURI )
835835 if err != nil {
836- return "" , lsp.Range {}, err
836+ return lsp . NilURI , lsp.Range {}, err
837837 }
838838 if cppURI .AsPath ().EquivalentTo (handler .buildSketchCpp ) {
839839 cppRange := handler .sketchMapper .InoToCppLSPRange (inoURI , inoRange )
@@ -919,7 +919,7 @@ func (handler *InoHandler) ino2cppWorkspaceEdit(origEdit *lsp.WorkspaceEdit) *ls
919919}
920920
921921func (handler * InoHandler ) transformClangdResult (method string , inoURI , cppURI lsp.DocumentURI , result interface {}) interface {} {
922- cppToIno := inoURI != "" && inoURI .AsPath ().EquivalentTo (handler .buildSketchCpp )
922+ cppToIno := inoURI != lsp . NilURI && inoURI .AsPath ().EquivalentTo (handler .buildSketchCpp )
923923
924924 switch r := result .(type ) {
925925 case * lsp.Hover :
@@ -1423,5 +1423,5 @@ func (handler *InoHandler) showMessage(ctx context.Context, msgType lsp.MessageT
14231423}
14241424
14251425func unknownURI (uri lsp.DocumentURI ) error {
1426- return errors .New ("Document is not available: " + string ( uri ))
1426+ return errors .New ("Document is not available: " + uri . String ( ))
14271427}
0 commit comments