Open yeison opened 9 years ago
The same problem in Eclipse - note I believe it's only a problem in Windows.
Seem to have narrowed part of the problem to line 156 in WindowsTerminal.java - It just continues in an infinite loop even though I enter some input
You could try forcing the use of the UnsupportedTerminal instead, or setting jline.WindowsTerminal.directConsole=false as a system property.
We may be able to improve the terminal factory detection code. If you want to give it a try, feel free to investigate.
I used this to force unsupported:
jline.TerminalFactory.registerFlavor(jline.TerminalFactory.Flavor.WINDOWS, UnsupportedTerminal.class);
And input works but completion does not. Is that expected behavior of Unsupported terminal?
The same for Mac OS. See my opened issue. Autocompletion does not work in IDEA terminal when you debugging the code.
@gnodet I've investigated and I understand why the same issue occurs on windows, the WindowsTerminal
class is attempting to hook in to the command window with various dll calls that are obviously unsuitable for the kind of terminal IDEA is using. I imagine the issue is the same kind of problem in any other OS.
Detection would be nice, but it is not going to solve this issue, that you can't debug in IDEA.
I'm going to try and contact people who write IDEA and also look at the source for it here: https://github.com/JetBrains/intellij-community to try to work out what kind of terminal and how we can hook into it with a different Terminal
implementation.
Any progress on this?
THere's no way to have completion in the Intellij Console, mainly because Intellij will not transmet any character before hitting the
Workarounds include:
TERM=dumb
jline.terminal=none
or in jline's config fileTerminalFactory.registerFlavor(TerminalFactory.Flavor.WINDOWS, UnsupportedTerminal.class)
If you are using picocli with jline2.
You can delegate the heuristic to picocli which seems better than the jline2 heuristic.
The code can looks like :
// JLine 2 does not detect some terminal as not ANSI compatible, like Eclipse Console
// see : https://github.com/jline/jline2/issues/185
// So use picocli heuristic instead :
if (!Help.Ansi.AUTO.enabled() && //
Configuration.getString(TerminalFactory.JLINE_TERMINAL, TerminalFactory.AUTO).toLowerCase()
.equals(TerminalFactory.AUTO)) {
TerminalFactory.configure(Type.NONE);
}
If I run a ConsoleReader in IntelliJ, the input doesn't seem to end on new-line.