-
Notifications
You must be signed in to change notification settings - Fork 143
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
-FLAG:"PATH" Style Completion Not Working #59
Comments
Makes sense, thanks for the description and context information. I'll take a look. Yes, a generator can handle that manually (see |
You're welcome and thanks for taking a look at this. I'll play around with |
This is a very good find, thank you!
The problem is a nuanced mismatch between how Readline and Clink (v1.0 and higher) think about match expansion. Clink breaks the line into words, and uses completion to extend words. Readline backtracks from the current cursor point to find a point to start matching; one point is an unclosed quote, another is a word break, and so on. Readline sees The Clink rewrite wasn't designed to handle this case, so I'll need to do some minor surgery on the design. Clink needs to be able to see it as three words But there's more to it:
This will require some thought to make sure it's all handled well, without making things complicated for lua scripts. |
Clink 0.4.9 does not work correctly in this case, by the way. It interprets the quoted string as a separate word as though it were not connected to the For example:
|
Here's what I think is needed:
I've opened 3 new issues to track those: Thanks again @CampinCarl for noticing and reporting this! FWIW, point 3 is "nice to have", but is not required -- I think it shouldn't be very expensive to support, but I can't promise anything just yet. The reason it isn't strictly required is that custom generators can be written to handle any arbitrarily complex syntax in an input line. For example, a custom generator handles environment variable completions embedded within words, and the entire argmatcher system is itself just a built-in custom generator. |
Readline chooses word break positions differently than Clink does. Readline just scans backwards looking for certain characters. That leads to `"ab cd"#` completing to `"ab cd"ab cd" #`, and issue #59 where `-flag:"#` completes wrongly. Clink parses the line into words, and lets lua scripts influence word break positions. So Clink must always force Readline to use Clink's word break position, otherwise the two systems can essentially try to complete different words. Which of course goes poorly.
Thanks Chris! Interesting point on v0.4.9. Sounds like it "worked" for what I needed but wasn't actually working as intended. I'll keep an eye on the new issues you've opened. |
Checking in to say the new build works great for this use case. Thanks! |
Thanks for confirming! |
First, huge thanks to the developers for keeping this project alive; it's awesome!
I'm trying to get
-flag:"path"
style completion working, which works in v0.4.9 when a double quote is present. Here's a use case example with Saxonica's XSLT utility, ref: Saxon Documentation - Running XSLT from the Command Linetransf
+ [TAB] =Transform.exe
-xs
+ [TAB] =-xsl:
-xsl:"
or-xsl:"foo
+ [TAB] =-xsl:"
/-xsl:"foo
(no path completion)I think it might be possible to replicate this behavior in Lua? Conceptually, I'm looking for a way to treat the colon as a separator between the
-xsl
flag and thefoo.xsl
argument, similar to the Linking Parsers example. The clink.filematches function looks suitable for this purpose, but I don't know how to solve the colon issue.Any advice from the devs/community would be greatly appreciated.
The text was updated successfully, but these errors were encountered: