File tree 1 file changed +20
-1
lines changed
app/src/cc/arduino/autocomplete
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 43
43
import org .fife .ui .autocomplete .ParameterizedCompletion .Parameter ;
44
44
import org .fife .ui .autocomplete .TemplateCompletion ;
45
45
46
+ import com .fasterxml .jackson .core .JsonParseException ;
46
47
import com .fasterxml .jackson .databind .ObjectMapper ;
47
48
48
49
import processing .app .Editor ;
@@ -95,7 +96,25 @@ protected List<Completion> getCompletionsImpl(JTextComponent textarea) {
95
96
// Parse engine output and build code completions
96
97
ObjectMapper mapper = new ObjectMapper ();
97
98
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
+ }
99
118
for (ArduinoCompletion cc : allCc ) {
100
119
101
120
if (cc .type .equals ("Function" ) || cc .type .equals ("Macro" )) {
You can’t perform that action at this time.
0 commit comments