@@ -731,7 +731,7 @@ func startClangd(compileCommandsDir, sketchCpp *paths.Path, compilers map[string
731731func (handler * InoHandler ) didOpen (inoDidOpen * lsp.DidOpenTextDocumentParams ) (* lsp.DidOpenTextDocumentParams , error ) {
732732 // Add the TextDocumentItem in the tracked files list
733733 inoItem := inoDidOpen .TextDocument
734- handler .docs [inoItem .URI .Canonical ()] = & inoItem
734+ handler .docs [inoItem .URI .AsPath (). String ()] = & inoItem
735735
736736 // If we are tracking a .ino...
737737 if inoItem .URI .Ext () == ".ino" {
@@ -752,8 +752,8 @@ func (handler *InoHandler) didOpen(inoDidOpen *lsp.DidOpenTextDocumentParams) (*
752752
753753func (handler * InoHandler ) didClose (inoDidClose * lsp.DidCloseTextDocumentParams ) (* lsp.DidCloseTextDocumentParams , error ) {
754754 inoIdentifier := inoDidClose .TextDocument
755- if _ , exist := handler .docs [inoIdentifier .URI .Canonical ()]; exist {
756- delete (handler .docs , inoIdentifier .URI .Canonical ())
755+ if _ , exist := handler .docs [inoIdentifier .URI .AsPath (). String ()]; exist {
756+ delete (handler .docs , inoIdentifier .URI .AsPath (). String ())
757757 } else {
758758 log .Printf (" didClose of untracked document: %s" , inoIdentifier .URI )
759759 return nil , unknownURI (inoIdentifier .URI )
@@ -789,8 +789,9 @@ func (handler *InoHandler) ino2cppTextDocumentItem(inoItem lsp.TextDocumentItem)
789789 cppItem .Version = handler .sketchMapper .CppText .Version
790790 } else {
791791 cppItem .LanguageID = inoItem .LanguageID
792- cppItem .Text = handler .docs [inoItem .URI .Canonical ()].Text
793- cppItem .Version = handler .docs [inoItem .URI .Canonical ()].Version
792+ inoPath := inoItem .URI .AsPath ().String ()
793+ cppItem .Text = handler .docs [inoPath ].Text
794+ cppItem .Version = handler .docs [inoPath ].Version
794795 }
795796
796797 return cppItem , nil
@@ -799,7 +800,7 @@ func (handler *InoHandler) ino2cppTextDocumentItem(inoItem lsp.TextDocumentItem)
799800func (handler * InoHandler ) didChange (ctx context.Context , req * lsp.DidChangeTextDocumentParams ) (* lsp.DidChangeTextDocumentParams , error ) {
800801 doc := req .TextDocument
801802
802- trackedDoc , ok := handler .docs [doc .URI .Canonical ()]
803+ trackedDoc , ok := handler .docs [doc .URI .AsPath (). String ()]
803804 if ! ok {
804805 return nil , unknownURI (doc .URI )
805806 }
@@ -1405,7 +1406,7 @@ func (handler *InoHandler) cpp2inoTextEdit(cppURI lsp.DocumentURI, cppEdit lsp.T
14051406}
14061407
14071408func (handler * InoHandler ) cpp2inoDocumentSymbols (cppSymbols []lsp.DocumentSymbol , inoRequestedURI lsp.DocumentURI ) []lsp.DocumentSymbol {
1408- inoRequested := inoRequestedURI .Canonical ()
1409+ inoRequested := inoRequestedURI .AsPath (). String ()
14091410 log .Printf (" filtering for requested ino file: %s" , inoRequested )
14101411 if inoRequestedURI .Ext () != ".ino" || len (cppSymbols ) == 0 {
14111412 return cppSymbols
0 commit comments