Skip to content

Commit 782e96a

Browse files
committed
Fixed linting errors
1 parent 0ea1887 commit 782e96a

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

ls/ls.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ type INOLanguageServer struct {
6868
sketchRebuilder *sketchRebuilder
6969
}
7070

71-
type TranslationOpts struct {
72-
loadRelToIde bool
73-
}
74-
7571
// Config describes the language server configuration.
7672
type Config struct {
7773
Fqbn string
@@ -92,6 +88,10 @@ var extToFileType = map[string]string{
9288
".hpp": "cpp",
9389
}
9490

91+
type translationOpts struct {
92+
loadRelToIde bool
93+
}
94+
9595
var yellow = color.New(color.FgHiYellow)
9696

9797
func (ls *INOLanguageServer) writeLock(logger jsonrpc.FunctionLogger, requireClangd bool) {
@@ -612,7 +612,7 @@ func (ls *INOLanguageServer) textDocumentDefinitionReqFromIDE(ctx context.Contex
612612

613613
var ideLocations []lsp.Location
614614
if clangLocations != nil {
615-
opts := TranslationOpts{loadRelToIde: true}
615+
opts := translationOpts{loadRelToIde: true}
616616
ideLocations, err = ls.clang2IdeLocationsArray2(logger, clangLocations, &opts)
617617
if err != nil {
618618
logger.Logf("Error: %v", err)

ls/ls_clang_to_ide.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (ls *INOLanguageServer) clang2IdeRangeAndDocumentURI(logger jsonrpc.Functio
3636
// - The IDE DocumentURI and Range
3737
// - a boolean that is true if the clang range is in the preprocessed area of the sketch
3838
// - an error
39-
func (ls *INOLanguageServer) clang2IdeRangeAndDocumentURI2(logger jsonrpc.FunctionLogger, clangURI lsp.DocumentURI, clangRange lsp.Range, opts *TranslationOpts) (lsp.DocumentURI, lsp.Range, bool, error) {
39+
func (ls *INOLanguageServer) clang2IdeRangeAndDocumentURI2(logger jsonrpc.FunctionLogger, clangURI lsp.DocumentURI, clangRange lsp.Range, opts *translationOpts) (lsp.DocumentURI, lsp.Range, bool, error) {
4040
// Sketchbook/Sketch/Sketch.ino <-> build-path/sketch/Sketch.ino.cpp
4141
// Sketchbook/Sketch/AnotherTab.ino <-> build-path/sketch/Sketch.ino.cpp (different section from above)
4242
if ls.clangURIRefersToIno(clangURI) {
@@ -320,7 +320,7 @@ func (ls *INOLanguageServer) cland2IdeTextEdits(logger jsonrpc.FunctionLogger, c
320320
func (ls *INOLanguageServer) clang2IdeLocationsArray(logger jsonrpc.FunctionLogger, clangLocations []lsp.Location) ([]lsp.Location, error) {
321321
return ls.clang2IdeLocationsArray2(logger, clangLocations, nil)
322322
}
323-
func (ls *INOLanguageServer) clang2IdeLocationsArray2(logger jsonrpc.FunctionLogger, clangLocations []lsp.Location, opts *TranslationOpts) ([]lsp.Location, error) {
323+
func (ls *INOLanguageServer) clang2IdeLocationsArray2(logger jsonrpc.FunctionLogger, clangLocations []lsp.Location, opts *translationOpts) ([]lsp.Location, error) {
324324
ideLocations := []lsp.Location{}
325325
for _, clangLocation := range clangLocations {
326326
ideLocation, inPreprocessed, err := ls.clang2IdeLocation2(logger, clangLocation, opts)
@@ -340,7 +340,7 @@ func (ls *INOLanguageServer) clang2IdeLocationsArray2(logger jsonrpc.FunctionLog
340340
func (ls *INOLanguageServer) clang2IdeLocation(logger jsonrpc.FunctionLogger, clangLocation lsp.Location) (lsp.Location, bool, error) {
341341
return ls.clang2IdeLocation2(logger, clangLocation, nil)
342342
}
343-
func (ls *INOLanguageServer) clang2IdeLocation2(logger jsonrpc.FunctionLogger, clangLocation lsp.Location, opts *TranslationOpts) (lsp.Location, bool, error) {
343+
func (ls *INOLanguageServer) clang2IdeLocation2(logger jsonrpc.FunctionLogger, clangLocation lsp.Location, opts *translationOpts) (lsp.Location, bool, error) {
344344
ideURI, ideRange, inPreprocessed, err := ls.clang2IdeRangeAndDocumentURI2(logger, clangLocation.URI, clangLocation.Range, opts)
345345
return lsp.Location{
346346
URI: ideURI,

ls/ls_ide_to_clang.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ func makeTextDocumentItem(logger jsonrpc.FunctionLogger, path string) (lsp.TextD
4242
if filetype == "unknown" {
4343
return lsp.TextDocumentItem{URI: uri, LanguageID: filetype}, false, &UnknownFileExtensionError{ext}
4444
}
45-
languageId := filetype
45+
languageID := filetype
4646
version := 0
4747

4848
text, err := os.ReadFile(path)
4949
if err != nil {
5050
logger.Logf("Could not read file: %v", err)
5151
return lsp.TextDocumentItem{}, false, err
5252
}
53-
return lsp.TextDocumentItem{URI: uri, LanguageID: languageId, Version: version, Text: string(text)}, true, nil
53+
return lsp.TextDocumentItem{URI: uri, LanguageID: languageID, Version: version, Text: string(text)}, true, nil
5454

5555
}
56-
func (ls *INOLanguageServer) idePathToIdeURI2(logger jsonrpc.FunctionLogger, inoPath string, opts *TranslationOpts) (lsp.DocumentURI, error) {
56+
func (ls *INOLanguageServer) idePathToIdeURI2(logger jsonrpc.FunctionLogger, inoPath string) (lsp.DocumentURI, error) {
5757
if inoPath == sourcemapper.NotIno.File {
5858
return sourcemapper.NotInoURI, nil
5959
}

0 commit comments

Comments
 (0)