@@ -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
7668type 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}
0 commit comments