File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
app/src/cc/arduino/autocomplete Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 4343import org .fife .ui .autocomplete .ParameterizedCompletion .Parameter ;
4444import org .fife .ui .autocomplete .TemplateCompletion ;
4545
46+ import com .fasterxml .jackson .core .JsonParseException ;
4647import com .fasterxml .jackson .databind .ObjectMapper ;
4748
4849import processing .app .Editor ;
@@ -95,7 +96,25 @@ protected List<Completion> getCompletionsImpl(JTextComponent textarea) {
9596 // Parse engine output and build code completions
9697 ObjectMapper mapper = new ObjectMapper ();
9798 ArduinoCompletionsList allCc ;
98- allCc = mapper .readValue (out , ArduinoCompletionsList .class );
99+ try {
100+ allCc = mapper .readValue (out , ArduinoCompletionsList .class );
101+ } catch (JsonParseException e ) {
102+ System .err .println ("Error parsing autocomplete output:" );
103+ System .err .println ();
104+ int begin = (int ) e .getLocation ().getCharOffset () - 100 ;
105+ if (begin < 0 ) {
106+ begin = 0 ;
107+ }
108+ int end = begin + 100 ;
109+ if (end >= out .length ()) {
110+ System .err .println (out .substring (begin ));
111+ } else {
112+ System .err .println (out .substring (begin , end ));
113+ }
114+ System .err .println ();
115+ e .printStackTrace ();
116+ return res ;
117+ }
99118 for (ArduinoCompletion cc : allCc ) {
100119
101120 if (cc .type .equals ("Function" ) || cc .type .equals ("Macro" )) {
You can’t perform that action at this time.
0 commit comments