20
20
import org .graalvm .shadowed .org .jline .reader .UserInterruptException ;
21
21
import org .jcodings .specific .UTF8Encoding ;
22
22
import org .truffleruby .RubyContext ;
23
+ import org .truffleruby .RubyLanguage ;
23
24
import org .truffleruby .builtins .CoreMethod ;
24
25
import org .truffleruby .builtins .CoreMethodArrayArgumentsNode ;
25
26
import org .truffleruby .builtins .CoreMethodNode ;
@@ -93,7 +94,7 @@ public abstract static class CompletionProcSetNode extends PrimitiveArrayArgumen
93
94
@ TruffleBoundary
94
95
@ Specialization
95
96
protected RubyProc setCompletionProc (RubyProc proc ) {
96
- final ProcCompleter completer = new ProcCompleter (getContext (), proc );
97
+ final ProcCompleter completer = new ProcCompleter (getContext (), getLanguage (), proc );
97
98
getContext ().getConsoleHolder ().setCompleter (completer );
98
99
return proc ;
99
100
}
@@ -112,7 +113,7 @@ protected RubyArray getScreenSize() {
112
113
readline .getTerminal ().getWidth ()
113
114
};
114
115
115
- return ArrayHelpers .createArray (getContext (), store );
116
+ return ArrayHelpers .createArray (getContext (), getLanguage (), store );
116
117
}
117
118
118
119
}
@@ -276,10 +277,12 @@ protected int setOutput(int fd, RubyIO io) {
276
277
private static class ProcCompleter implements Completer {
277
278
278
279
private final RubyContext context ;
280
+ private final RubyLanguage language ;
279
281
private final RubyProc proc ;
280
282
281
- public ProcCompleter (RubyContext context , RubyProc proc ) {
283
+ public ProcCompleter (RubyContext context , RubyLanguage language , RubyProc proc ) {
282
284
this .context = context ;
285
+ this .language = language ;
283
286
this .proc = proc ;
284
287
}
285
288
@@ -290,7 +293,7 @@ public void complete(LineReader lineReader, ParsedLine commandLine, List<Candida
290
293
boolean complete = lineReader .getBuffer ().cursor () == lineReader .getBuffer ().length ();
291
294
292
295
RubyString string = StringOperations
293
- .createString (context , StringOperations .encodeRope (buffer , UTF8Encoding .INSTANCE ));
296
+ .createString (context , language , StringOperations .encodeRope (buffer , UTF8Encoding .INSTANCE ));
294
297
RubyArray completions = (RubyArray ) context .send (proc , "call" , string );
295
298
for (Object element : ArrayOperations .toIterable (completions )) {
296
299
final String completion = ((RubyString ) element ).getJavaString ();
0 commit comments