Skip to content

Commit 074844d

Browse files
authored
[skip-changelog] Removed legacy 'codecomplete' implementation. (#2124)
* Skip useless operations in legacy test * Removed legacy 'codecomplete' implementation.
1 parent 5a5ae94 commit 074844d

File tree

2 files changed

+3
-43
lines changed

2 files changed

+3
-43
lines changed

Diff for: legacy/builder/preprocess_sketch.go

+3-41
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"os/exec"
2222
"path/filepath"
2323
"runtime"
24-
"strings"
2524

2625
bldr "github.com/arduino/arduino-cli/arduino/builder"
2726
"github.com/arduino/arduino-cli/legacy/builder/constants"
@@ -36,7 +35,7 @@ var ArduinoPreprocessorProperties = properties.NewFromHashmap(map[string]string{
3635
// Ctags
3736
"tools.arduino-preprocessor.path": "{runtime.tools.arduino-preprocessor.path}",
3837
"tools.arduino-preprocessor.cmd.path": "{path}/arduino-preprocessor",
39-
"tools.arduino-preprocessor.pattern": `"{cmd.path}" "{source_file}" "{codecomplete}" -- -std=gnu++11`,
38+
"tools.arduino-preprocessor.pattern": `"{cmd.path}" "{source_file}" -- -std=gnu++11`,
4039

4140
"preproc.macros.flags": "-w -x c++ -E -CC",
4241
})
@@ -63,14 +62,7 @@ func (s *PreprocessSketchArduino) Run(ctx *types.Context) error {
6362
}
6463
}
6564

66-
var err error
67-
if ctx.CodeCompleteAt != "" {
68-
err = new(OutputCodeCompletions).Run(ctx)
69-
} else {
70-
err = bldr.SketchSaveItemCpp(ctx.Sketch.MainFile, []byte(ctx.Source), ctx.SketchBuildPath)
71-
}
72-
73-
return err
65+
return bldr.SketchSaveItemCpp(ctx.Sketch.MainFile, []byte(ctx.Source), ctx.SketchBuildPath)
7466
}
7567

7668
type ArduinoPreprocessorRunner struct{}
@@ -83,21 +75,6 @@ func (s *ArduinoPreprocessorRunner) Run(ctx *types.Context) error {
8375
toolProps := buildProperties.SubTree("tools").SubTree("arduino-preprocessor")
8476
preprocProperties.Merge(toolProps)
8577
preprocProperties.SetPath(constants.BUILD_PROPERTIES_SOURCE_FILE, targetFilePath)
86-
if ctx.CodeCompleteAt != "" {
87-
if runtime.GOOS == "windows" {
88-
//use relative filepath to avoid ":" escaping
89-
splt := strings.Split(ctx.CodeCompleteAt, ":")
90-
if len(splt) == 3 {
91-
//all right, do nothing
92-
} else {
93-
splt[1] = filepath.Base(splt[0] + ":" + splt[1])
94-
ctx.CodeCompleteAt = strings.Join(splt[1:], ":")
95-
}
96-
}
97-
preprocProperties.Set("codecomplete", "-output-code-completions="+ctx.CodeCompleteAt)
98-
} else {
99-
preprocProperties.Set("codecomplete", "")
100-
}
10178

10279
pattern := preprocProperties.Get(constants.BUILD_PROPERTIES_PATTERN)
10380
if pattern == constants.EMPTY_STRING {
@@ -131,21 +108,6 @@ func (s *ArduinoPreprocessorRunner) Run(ctx *types.Context) error {
131108
result := utils.NormalizeUTF8(buf)
132109

133110
//fmt.Printf("PREPROCESSOR OUTPUT:\n%s\n", output)
134-
if ctx.CodeCompleteAt != "" {
135-
ctx.CodeCompletions = string(result)
136-
} else {
137-
ctx.Source = string(result)
138-
}
139-
return nil
140-
}
141-
142-
type OutputCodeCompletions struct{}
143-
144-
func (s *OutputCodeCompletions) Run(ctx *types.Context) error {
145-
if ctx.CodeCompletions == "" {
146-
// we assume it is a json, let's make it compliant at least
147-
ctx.CodeCompletions = "[]"
148-
}
149-
ctx.WriteStdout([]byte(ctx.CodeCompletions))
111+
ctx.Source = string(result)
150112
return nil
151113
}

Diff for: legacy/builder/types/context.go

-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ type Context struct {
7272
LibraryDirs paths.PathList // List of paths pointing to individual library root folders
7373
WatchedLocations paths.PathList
7474
FQBN *cores.FQBN
75-
CodeCompleteAt string
7675
Clean bool
7776

7877
// Build options are serialized here
@@ -110,7 +109,6 @@ type Context struct {
110109
Sketch *sketch.Sketch
111110
Source string
112111
SourceGccMinusE string
113-
CodeCompletions string
114112

115113
WarningsLevel string
116114

0 commit comments

Comments
 (0)