99 "strings"
1010
1111 "arduino.cc/builder"
12+ "arduino.cc/builder/i18n"
1213 "arduino.cc/builder/types"
1314 "arduino.cc/builder/utils"
1415 "github.com/fsnotify/fsnotify"
@@ -87,6 +88,7 @@ func (s *builderServer) Autocomplete(ctx context.Context, args *pb.BuildParams)
8788 s .ctx .WarningsLevel = args .WarningsLevel
8889 s .ctx .PrototypesSection = ""
8990 s .ctx .CodeCompleteAt = args .CodeCompleteAt
91+ s .ctx .CodeCompletions = ""
9092
9193 s .ctx .IncludeFolders = s .ctx .IncludeFolders [0 :0 ]
9294 s .ctx .LibrariesObjectFiles = s .ctx .LibrariesObjectFiles [0 :0 ]
@@ -96,14 +98,16 @@ func (s *builderServer) Autocomplete(ctx context.Context, args *pb.BuildParams)
9698 s .ctx .ImportedLibraries = s .ctx .ImportedLibraries [0 :0 ]
9799
98100 s .watch ()
101+ oldlogger := s .ctx .GetLogger ()
102+ logger := i18n.NoopLogger {}
103+ s .ctx .SetLogger (logger )
99104
100105 err := builder .RunPreprocess (s .ctx )
101- if err != nil {
102- return & pb.Response {Line : s .ctx .GetLogger ().Flush ()}, err
103- }
104106
105- // No feature was found, return an unnamed feature
106- return & pb.Response {Line : s .ctx .GetLogger ().Flush ()}, nil
107+ response := pb.Response {Line : s .ctx .CodeCompletions }
108+ s .ctx .SetLogger (oldlogger )
109+
110+ return & response , err
107111}
108112
109113// GetFeature returns the feature at the given point.
0 commit comments