Skip to content

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

@drx777

Description

@drx777

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/need-triageTeam needs to triage and take a first look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions