-
Notifications
You must be signed in to change notification settings - Fork 769
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
Improves semantic trigger match. #292
Conversation
I think this change should come with some tests to go with it, and a code comment explaining the behaviour. It's not super-obvious what's going on, and/or why this is necessary 😬 Review status: 0 of 1 files reviewed at latest revision, all discussions resolved. Comments from the review on Reviewable.io |
BTW. This is very, very cool. I'm super excited! Like, it's Christmas or something. Review status: 0 of 1 files reviewed at latest revision, all discussions resolved. Comments from the review on Reviewable.io |
I does make sense to only try to match until the user's caret column. :) Like @puremourning said, having some tests here would be nice. Review status: 0 of 1 files reviewed at latest revision, all discussions resolved. Comments from the review on Reviewable.io |
Reworded commit message and added comment. Will try to figure out a test tomorrow (too late here). see ya Review status: 0 of 1 files reviewed at latest revision, all discussions resolved. Comments from the review on Reviewable.io |
Guys... I just gave up coming up with a test for this. It's clear it makes sense, adds a performance improvement, don't break tests, but I just forgot how it changes behavior, if it ever does, with the current state of the project. At the time I applied it I was trying several kinds of mechanisms for argument hints and in one of those I needed that, not sure whether it's still necessary. Review status: 0 of 1 files reviewed at latest revision, all discussions resolved. Comments from the review on Reviewable.io |
IIRC it was to do with ignoring whitespace after a trigger? e.g. trigger on Reviewed 1 of 1 files at r2. Comments from the review on Reviewable.io |
Exactly, and I just expended quite a lot of time trying to find that issue where I commented about that, but I just coudn't find it. Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from the review on Reviewable.io |
Regarding it being useful about ignoring whitespace after a trigger, I just don't recall :-( Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from the review on Reviewable.io |
Related? ycm-core/YouCompleteMe#1337
|
Hmm, actually no, although this pull contains parts I'll pull again later. I commented about this specifically with someone at the issue tracker, he was having doubts regarding how it was actually working since the code was looking for matches at the entire line, I guess for Obj-C completion. I suggested this could be a fix for his problems. Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from the review on Reviewable.io |
Let's confirm that this change is useful in some way before committing it. And if we do want to commit it, we don't necessarily need a test proving a bug is fixed, we can go with a test that proves chars after the caret can't be examined. Also, it's one simple line change with no conditionals/loops that's exercised by every other completion test we have, so I'd be fine with it landing without a test. Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from the review on Reviewable.io |
If we decide to commit this I think that we can simplify some code, for example the Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from the review on Reviewable.io |
@vheon Actually I'll propose remotion of _StringTriggerMatches. It's being used solely in tests, it's not being used by completers because all triggers when prepared are transformed into regexes. The current state of the code base is a bit confuse regarding that because it appear string matches are being used while in truth they are not. Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from the review on Reviewable.io |
Yes, this is very confusing. Anyway IMHO a test like: ok_( not cu._MatchesSemanticTrigger( 'foo->bar', 4, ['->'] ) ) will be enough for this change. Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from the review on Reviewable.io |
Match triggers until user's caret column solely. Trying to match triggers with characters after user's caret column doesn't seem to have any utility.
@vheon It seems like I changed my commit description, I think this is nothing beyond that, a minor optimization I've stumbled upon. Even though minor, I just happen not to like regex matching at will :) Review status: all files reviewed at latest revision, all discussions resolved, some commit checks pending. Comments from the review on Reviewable.io |
If tests already cover this, then I'm ok with merging this as it is Reviewed 1 of 1 files at r2. Comments from the review on Reviewable.io |
OK, let's merge this then. Thanks for the PR! @homu r+ |
📌 Commit c26a4e5 has been approved by |
Improves semantic trigger match. Improves semantic trigger match. Match triggers until user's caret column solely. Trying to match triggers with characters after user's caret column doesn't seem to have any utility. --- This is the first in a series of pull-requests that will transparently enable #1300 for any completer that cares for. After this minimal foundation is stablished, an initial Swift completer will be available, supporting diagnostics, fix-it's, semantic completion and argument hints. Changes will also be proposed to enable hints for C and C++. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/292) <!-- Reviewable:end -->
☀️ Test successful - status |
For record, there's more room for improvement over regex matching. After taking a look at it again, initially it was regex matching the entire line regardless of start_column, this is now fixed, but regex matching from beginning of line until trigger's ending position, for which we already have its termination through Taking the current code aside a bit, and thinking of the simplest form of trigger matching to its core, when we already have its termination (
I know perf diff should be minor, but besides this, I guess code would get simpler and of clearer intent. |
I thought of this when I saw the code for the code review. I'm not super familiar with that part of the codebase so I don't know how complex it would be to put this in place. |
Nor do I, although at its core it's a simplification, I'm not sure what the extent of refactoring for compiled |
Improves semantic trigger match.
Match triggers until user's caret column solely. Trying to match
triggers with characters after user's caret column doesn't seem
to have any utility.
This is the first in a series of pull-requests that will transparently enable
#1300 for any completer that cares for. After this minimal foundation is
stablished, an initial Swift completer will be available, supporting diagnostics,
fix-it's, semantic completion and argument hints. Changes will also be
proposed to enable hints for C and C++.