Skip to content

Inconsistent treatment of backslashes in completion context. #43

@maxlandon

Description

@maxlandon

SUMMARY

Currently this library might suffer from sometimes slightly inconsistent behaviors between the buffer being executed and the one being completed. These inconsistencies are almost invariably due to backslash management. Some of these have been raised in #38.

Here I aim to do a recap so that anyone facing a behavior/bug that is not acceptable to them, might be able to at least burn a couple brain calories on how to fix all of this uniformly. Best case scenario being a code contribution.

State of the buffer before EXECUTION

Currently, the input line buffer is parsed with the github.com/mvdan/sh package, so that the console enables users to include comments in their command lines (saved in history), with those comments stripped before exec:

example [main] > root subcommand --flag value-for-flag \
                 --another-flag file.json # With a comment here, saved in hist but stripped before exec.

The executed line is in effect:

root subcommand --flag value-for-flag --another-flag file.json

The following example will even work in the example app:

example [main] in playground/console/example
> git checkout # This is a comment
  --create testing # And this is another
  --force                                                                                         12:29:42.649

Running git checkout command with branch: testing

State of the buffer before COMPLETION

The parsing code for the line in the completion context is entirely different (copied from this package and slightly modified). This is so that we can take more freedoms on what to pass to the completion context. The added cost however have been until now some inconsistent behavior here and there.

The line splitting code used before sending arguments to the completion engine is here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions