@@ -279,9 +279,9 @@ func (handler *InoHandler) HandleMessageFromIDE(ctx context.Context, conn *jsonr
279
279
log .Printf ("--> %s(%s:%s)" , req .Method , p .TextDocument .URI , p .Position )
280
280
inoURI = p .TextDocument .URI
281
281
if res , e := handler .ino2cppTextDocumentPositionParams (p ); e == nil {
282
- cppURI = p .TextDocument .URI
282
+ cppURI = res .TextDocument .URI
283
283
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 )
285
285
} else {
286
286
err = e
287
287
}
@@ -453,7 +453,7 @@ func (handler *InoHandler) refreshCppDocumentSymbols() error {
453
453
if err != nil {
454
454
return errors .WithMessage (err , "quering source code symbols" )
455
455
}
456
- result = handler .transformClangdResult ("textDocument/documentSymbol" , cppURI , "" , result )
456
+ result = handler .transformClangdResult ("textDocument/documentSymbol" , cppURI , lsp . NilURI , result )
457
457
if symbols , ok := result .([]lsp.DocumentSymbol ); ! ok {
458
458
return errors .WithMessage (err , "quering source code symbols (2)" )
459
459
} else {
@@ -748,7 +748,7 @@ func (handler *InoHandler) ino2cppDocumentURI(inoURI lsp.DocumentURI) (lsp.Docum
748
748
inside , err := inoPath .IsInsideDir (handler .sketchRoot )
749
749
if err != nil {
750
750
log .Printf (" could not determine if '%s' is inside '%s'" , inoPath , handler .sketchRoot )
751
- return "" , unknownURI (inoURI )
751
+ return lsp . NilURI , unknownURI (inoURI )
752
752
}
753
753
if ! inside {
754
754
log .Printf (" passing doc identifier to '%s' as-is" , inoPath )
@@ -763,7 +763,7 @@ func (handler *InoHandler) ino2cppDocumentURI(inoURI lsp.DocumentURI) (lsp.Docum
763
763
}
764
764
765
765
log .Printf (" could not determine rel-path of '%s' in '%s': %s" , inoPath , handler .sketchRoot , err )
766
- return "" , err
766
+ return lsp . NilURI , err
767
767
}
768
768
769
769
func (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
791
791
inside , err := cppPath .IsInsideDir (handler .buildSketchRoot )
792
792
if err != nil {
793
793
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
795
795
}
796
796
if ! inside {
797
797
log .Printf (" keep doc identifier to '%s' as-is" , cppPath )
@@ -806,7 +806,7 @@ func (handler *InoHandler) cpp2inoDocumentURI(cppURI lsp.DocumentURI, cppRange l
806
806
}
807
807
808
808
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
810
810
}
811
811
812
812
func (handler * InoHandler ) ino2cppTextDocumentPositionParams (inoParams * lsp.TextDocumentPositionParams ) (* lsp.TextDocumentPositionParams , error ) {
@@ -833,7 +833,7 @@ func (handler *InoHandler) ino2cppTextDocumentPositionParams(inoParams *lsp.Text
833
833
func (handler * InoHandler ) ino2cppRange (inoURI lsp.DocumentURI , inoRange lsp.Range ) (lsp.DocumentURI , lsp.Range , error ) {
834
834
cppURI , err := handler .ino2cppDocumentURI (inoURI )
835
835
if err != nil {
836
- return "" , lsp.Range {}, err
836
+ return lsp . NilURI , lsp.Range {}, err
837
837
}
838
838
if cppURI .AsPath ().EquivalentTo (handler .buildSketchCpp ) {
839
839
cppRange := handler .sketchMapper .InoToCppLSPRange (inoURI , inoRange )
@@ -919,7 +919,7 @@ func (handler *InoHandler) ino2cppWorkspaceEdit(origEdit *lsp.WorkspaceEdit) *ls
919
919
}
920
920
921
921
func (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 )
923
923
924
924
switch r := result .(type ) {
925
925
case * lsp.Hover :
@@ -1423,5 +1423,5 @@ func (handler *InoHandler) showMessage(ctx context.Context, msgType lsp.MessageT
1423
1423
}
1424
1424
1425
1425
func 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 ( ))
1427
1427
}
0 commit comments