Repository navigation
Add parseForComplete method to Parser interface and use it. - #2
Closed
PerBothner wants to merge 1 commit into
Closed
PerBothner wants to merge 1 commit into
PerBothner wants to merge 1 commit into
Conversation
We provide a default implementation of parseForComplete (just call parse), but an override allows clients more flexibility with less overhead.
Contributor
Author
|
Ping? Is this a acceptable solution to the problem mentioned in the pull request? |
Member
|
Sorry, I missed the PR. I'd rather having an enum, that would be more explicit, as I'm not really sure there's a "default" context really. |
Contributor
Author
|
Ok - I created pull request #4. |
hyee
added a commit
to hyee/jline3.29
that referenced
this pull request
Apr 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We provide a default implementation of parseForComplete (just call parse),
but an override allows clients more flexibility with less overhead.
I was having problems getting tab-completion working with Kawa. One reason is that Kawa's parser is fairly complex, and I want completion to be context dependent - which means it also needs to parse and analyze the partial line. So you're getting two parses (which is wasteful), plus the first parse doesn't know it's in completion context (and thus shouldn't throw EOFError).
Creating and using a new parseForComplete method seemed like a simple and clean solution. Kawa command completion now works again with jline3.
An alternative is to add a flag to the parse method (perhaps an enum, since there are a multiple different contexts that parse is called).