Skip to content
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

Parse arguments to :load the same way the shell does #322

Open
byorgey opened this issue Jan 27, 2022 · 2 comments
Open

Parse arguments to :load the same way the shell does #322

byorgey opened this issue Jan 27, 2022 · 2 comments
Labels
C-Moderate Effort Should take a moderate amount of time to address. S-Nice to have Minor importance U-Parsing Z-Feature Request Z-Student Good project for a student.

Comments

@byorgey
Copy link
Member

byorgey commented Jan 27, 2022

If you try to :load something from a path that has spaces, it stops prior to the space and claims it can't find the given module. One might even argue this is a bug since tab completion will fill in a file name with backslash-escaped spaces, but then :load chokes on it.

@byorgey byorgey added C-Low Hanging Fruit Shouldn't take too much time; ideal issues for new contributors. S-Nice to have Minor importance U-Parsing Z-Feature Request labels Jan 27, 2022
@byorgey byorgey changed the title Allow spaces in :load path Allow spaces in :load path Jan 27, 2022
@byorgey
Copy link
Member Author

byorgey commented Jan 29, 2022

Should really parse file names in the same way the shell does, since that's what tab autocomplete already does. i.e. with optional single or double quotes, escaped spaces, etc. And we can ALSO accept just plain spaces in the middle, since :load always has a single argument, so we don't need to worry about distinguishing where arguments begin and end.

@byorgey
Copy link
Member Author

byorgey commented Jan 29, 2022

See https://hackage.haskell.org/package/ShellCheck-0.4.2/docs/src/ShellCheck-Parser.html for inspiration, e.g.

readSingleQuotedLiteral = do
    singleQuote
    strs <- many1 readSingleQuotedPart
    singleQuote
    return $ concat strs

readSingleQuotedPart =
    readSingleEscaped
    <|> many1 (noneOf "'\\\x2018\x2019")

Actually the ShellCheck parsing code is way overkill because it's also checking for various common issues, etc...

@byorgey byorgey added C-Moderate Effort Should take a moderate amount of time to address. and removed C-Low Hanging Fruit Shouldn't take too much time; ideal issues for new contributors. labels Jan 28, 2023
@byorgey byorgey changed the title Allow spaces in :load path Parse arguments to :load the same way the shell does Jan 28, 2023
@byorgey byorgey added the Z-Student Good project for a student. label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Moderate Effort Should take a moderate amount of time to address. S-Nice to have Minor importance U-Parsing Z-Feature Request Z-Student Good project for a student.
Projects
None yet
Development

No branches or pull requests

1 participant