Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fab9a95

Browse files
committedAug 4, 2022
Added comment and renamed UnknownURI->UnknownURIError
1 parent bd1f67f commit fab9a95

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed
 

‎ls/ls.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ func (ls *INOLanguageServer) TextDocumentDidChangeNotifFromIDE(logger jsonrpc.Fu
10641064
// Apply the change to the tracked sketch file.
10651065
trackedIdeDocID := ideTextDocIdentifier.URI.AsPath().String()
10661066
if doc, ok := ls.trackedIdeDocs[trackedIdeDocID]; !ok {
1067-
logger.Logf("Error: %s", &UnknownURI{ideTextDocIdentifier.URI})
1067+
logger.Logf("Error: %s", &UnknownURIError{ideTextDocIdentifier.URI})
10681068
return
10691069
} else if updatedDoc, err := textedits.ApplyLSPTextDocumentContentChangeEvent(doc, ideParams); err != nil {
10701070
logger.Logf("Error: %s", err)
@@ -1598,10 +1598,11 @@ func (ls *INOLanguageServer) cpp2inoTextEdit(logger jsonrpc.FunctionLogger, cppU
15981598
return inoURI, inoEdit, inPreprocessed, err
15991599
}
16001600

1601-
type UnknownURI struct {
1601+
// UnknownURIError is an error when an URI is not recognized
1602+
type UnknownURIError struct {
16021603
URI lsp.DocumentURI
16031604
}
16041605

1605-
func (e *UnknownURI) Error() string {
1606+
func (e *UnknownURIError) Error() string {
16061607
return "Document is not available: " + e.URI.String()
16071608
}

‎ls/ls_clang_to_ide.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (ls *INOLanguageServer) clang2IdeDocumentURI(logger jsonrpc.FunctionLogger,
8787
return ideDoc.URI, nil
8888
}
8989
}
90-
return lsp.DocumentURI{}, &UnknownURI{URI: clangURI}
90+
return lsp.DocumentURI{}, &UnknownURIError{URI: clangURI}
9191
}
9292

9393
// /another/global/path/to/source.cpp <-> /another/global/path/to/source.cpp

‎ls/ls_ide_to_clang.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func (ls *INOLanguageServer) idePathToIdeURI(logger jsonrpc.FunctionLogger, inoP
2020
logger.Logf(" !!! > %s", p)
2121
}
2222
uri := lsp.NewDocumentURI(inoPath)
23-
return uri, &UnknownURI{uri}
23+
return uri, &UnknownURIError{uri}
2424
}
2525
return doc.URI, nil
2626
}
@@ -44,7 +44,7 @@ func (ls *INOLanguageServer) ide2ClangDocumentURI(logger jsonrpc.FunctionLogger,
4444
inside, err := idePath.IsInsideDir(ls.sketchRoot)
4545
if err != nil {
4646
logger.Logf("ERROR: could not determine if '%s' is inside '%s'", idePath, ls.sketchRoot)
47-
return lsp.NilURI, false, &UnknownURI{ideURI}
47+
return lsp.NilURI, false, &UnknownURIError{ideURI}
4848
}
4949
if !inside {
5050
clangURI := ideURI

0 commit comments

Comments
 (0)
Please sign in to comment.