Skip to content

Tab auto-completion in PowerShell fails with EOFError: Escaped new line #1169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
drx777 opened this issue May 6, 2025 · 0 comments
Open
Labels
status/need-triage Team needs to triage and take a first look

Comments

@drx777
Copy link

drx777 commented May 6, 2025

see previously closed ticket #240

I can still reproduce this issue with Windows 11 PowerShell:

$ shell> pselect --path t<TAB>arget/<TAB>
org. jline.reader.EOFError: Escaped new line
at org.springframework.shell.Jline.ExtendedDefaultParser.parse(ExtendedDefaultParser.java:138) ~[spring-shell-core-3.4.0.jar!/:3.4.0J
at org-jline.reader.impl.LineReaderImpl.doComplete(LineReaderImpl.java:4459) ~[jline-reader-3.26.3. jar!/:na]
at org-jline.reader.impl.LineReaderImpl.doComplete(LineReaderImpl.java:4435) ~[jline-reader-3.26.3.jar!/:na]
at org.jline.reader.impl.LineReaderImpl.expand0rComplete(LineReaderImpl.java:4374) ~[jline-reader-3.26.3.jar!/:na]

Here's the relevant code:

@ShellComponent
public class ComponentCommands extends AbstractShellComponent {

  @ShellMethod (key = "pselect", value = "Path input", group = "Components")
    public String pathSelector (@ShellOption(valueProvider = FileValueProvider.class, help = "path to input file", value = "path") String path) {
      Path filePath = Path.of(path);
      return (Files.exists(filePath) ? "file exists" : "file not found") + filePath.toAbsolutePath();
    }
  }
}

However, using double backslash (\\) does work as expected, i.e. the path lookup works - once. Tab completion does then de-duplicate the backslash though and in doing so duplicates the initial character(s), so it's still not feasible, but that seems to be a distinct issue.

pselect_e2.mp4

I started to write a specific FileValueProvider for windows using double backslashes, but that had the same issue with the first character(s) replacement rendering the input invalid.

@github-actions github-actions bot added the status/need-triage Team needs to triage and take a first look label May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/need-triage Team needs to triage and take a first look
Projects
None yet
Development

No branches or pull requests

1 participant