Skip to content

Add CI workflow to lint and check formatting of Go code #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added comment and renamed UnknownURI->UnknownURIError
  • Loading branch information
cmaglie authored and MatteoPologruto committed Aug 4, 2022
commit d17645afe811c93fd6a425ab009e3bfb7f38447a
7 changes: 4 additions & 3 deletions ls/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ func (ls *INOLanguageServer) TextDocumentDidChangeNotifFromIDE(logger jsonrpc.Fu
// Apply the change to the tracked sketch file.
trackedIdeDocID := ideTextDocIdentifier.URI.AsPath().String()
if doc, ok := ls.trackedIdeDocs[trackedIdeDocID]; !ok {
logger.Logf("Error: %s", &UnknownURI{ideTextDocIdentifier.URI})
logger.Logf("Error: %s", &UnknownURIError{ideTextDocIdentifier.URI})
return
} else if updatedDoc, err := textedits.ApplyLSPTextDocumentContentChangeEvent(doc, ideParams); err != nil {
logger.Logf("Error: %s", err)
Expand Down Expand Up @@ -1598,10 +1598,11 @@ func (ls *INOLanguageServer) cpp2inoTextEdit(logger jsonrpc.FunctionLogger, cppU
return inoURI, inoEdit, inPreprocessed, err
}

type UnknownURI struct {
// UnknownURIError is an error when an URI is not recognized
type UnknownURIError struct {
URI lsp.DocumentURI
}

func (e *UnknownURI) Error() string {
func (e *UnknownURIError) Error() string {
return "Document is not available: " + e.URI.String()
}
2 changes: 1 addition & 1 deletion ls/ls_clang_to_ide.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (ls *INOLanguageServer) clang2IdeDocumentURI(logger jsonrpc.FunctionLogger,
return ideDoc.URI, nil
}
}
return lsp.DocumentURI{}, &UnknownURI{URI: clangURI}
return lsp.DocumentURI{}, &UnknownURIError{URI: clangURI}
}

// /another/global/path/to/source.cpp <-> /another/global/path/to/source.cpp
Expand Down
4 changes: 2 additions & 2 deletions ls/ls_ide_to_clang.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (ls *INOLanguageServer) idePathToIdeURI(logger jsonrpc.FunctionLogger, inoP
logger.Logf(" !!! > %s", p)
}
uri := lsp.NewDocumentURI(inoPath)
return uri, &UnknownURI{uri}
return uri, &UnknownURIError{uri}
}
return doc.URI, nil
}
Expand All @@ -44,7 +44,7 @@ func (ls *INOLanguageServer) ide2ClangDocumentURI(logger jsonrpc.FunctionLogger,
inside, err := idePath.IsInsideDir(ls.sketchRoot)
if err != nil {
logger.Logf("ERROR: could not determine if '%s' is inside '%s'", idePath, ls.sketchRoot)
return lsp.NilURI, false, &UnknownURI{ideURI}
return lsp.NilURI, false, &UnknownURIError{ideURI}
}
if !inside {
clangURI := ideURI
Expand Down