-
Notifications
You must be signed in to change notification settings - Fork 768
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
[READY] Allow completers to set the start column #681
Conversation
Codecov Report
@@ Coverage Diff @@
## master #681 +/- ##
==========================================
- Coverage 94.84% 94.78% -0.06%
==========================================
Files 79 79
Lines 5296 5316 +20
Branches 172 172
==========================================
+ Hits 5023 5039 +16
- Misses 228 232 +4
Partials 45 45 |
Review status: 0 of 3 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed. ycmd/request_wrap.py, line 112 at r1 (raw file):
Seems like you want to implement With the current approach we implement a nice API for reading computed fields but not for setting them, which is weird. This would need a bit of re-architecting since ycmd/completers/javascript/tern_completer.py, line 206 at r1 (raw file):
The +1 needs a comment. ycmd/completers/javascript/tern_completer.py, line 208 at r1 (raw file):
This would need an extensive comment as I don't really understand why you're doing this. :D Comments from Reviewable |
Thanks for the review! I've updated it according to Val's suggestion and added some tests. I should also note, this is only fixed in the Vim client with ycm-core/YouCompleteMe#2489 which adds some more valuable context. Review status: 0 of 8 files reviewed at latest revision, 3 unresolved discussions. ycmd/request_wrap.py, line 112 at r1 (raw file): Previously, Valloric (Val Markovic) wrote…
OK sure :) Done. ycmd/completers/javascript/tern_completer.py, line 206 at r1 (raw file): Previously, Valloric (Val Markovic) wrote…
Done. ycmd/completers/javascript/tern_completer.py, line 208 at r1 (raw file): Previously, Valloric (Val Markovic) wrote…
Done. Comments from Reviewable |
Thanks for the PR! Review status: 0 of 8 files reviewed at latest revision, 7 unresolved discussions, some commit checks broke. ycmd/request_wrap.py, line 45 at r2 (raw file):
Keys are keys?! :D :P ycmd/request_wrap.py, line 91 at r2 (raw file):
Since you don't actually want the setter, you should use ycmd/request_wrap.py, line 100 at r2 (raw file):
Same as above, ycmd/completers/javascript/tern_completer.py, line 208 at r1 (raw file): Previously, puremourning (Ben Jackson) wrote…
Wow, you really took "extensive" to heart! Thanks for explaining this so thoroughly! :) ycmd/completers/javascript/tern_completer.py, line 209 at r2 (raw file):
typo: "rainge" ycmd/completers/javascript/tern_completer.py, line 216 at r2 (raw file):
Missing closing paren. ycmd/completers/javascript/tern_completer.py, line 218 at r2 (raw file):
aown I recommend turning on spell checking in Vim :P Comments from Reviewable |
Reviewed 1 of 3 files at r1, 7 of 7 files at r2. Comments from Reviewable |
ac9c57a
to
b507fed
Compare
☔ The latest upstream changes (presumably #722) made this pull request unmergeable. Please resolve the merge conflicts. |
a36f939
to
1e03249
Compare
now possible with ycm-core/YouCompleteMe#2657! |
1e03249
to
93707d2
Compare
@zzbot try appveyor flaked? |
[RFC] Allow completers to set the start column We always calculate the start column based on our own identifier semantics. However, some completion engines might have a different interpretation, and indeed the javascript completer does exactly that for `require( '` Fixes: #671 This PR is just to demonstrate the approach for comments. It isn't really tested yet (the tests will certainly fail). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/681) <!-- Reviewable:end -->
☀️ Test successful - status-travis |
Reviewed 2 of 7 files at r2, 6 of 6 files at r3. ycmd/request_wrap.py, line 61 at r3 (raw file):
This should be aligned with Comments from Reviewable |
93707d2
to
f19b4c3
Compare
Review status: all files reviewed at latest revision, 7 unresolved discussions, some commit checks failed. ycmd/request_wrap.py, line 45 at r2 (raw file): Previously, Valloric (Val Markovic) wrote…
I meant keys of ycmd/request_wrap.py, line 91 at r2 (raw file): Previously, Valloric (Val Markovic) wrote…
done. ycmd/request_wrap.py, line 100 at r2 (raw file): Previously, Valloric (Val Markovic) wrote…
Done. ycmd/request_wrap.py, line 61 at r3 (raw file): Previously, bstaletic wrote…
Done. ycmd/completers/javascript/tern_completer.py, line 209 at r2 (raw file): Previously, Valloric (Val Markovic) wrote…
Done. ycmd/completers/javascript/tern_completer.py, line 216 at r2 (raw file): Previously, Valloric (Val Markovic) wrote…
Done. ycmd/completers/javascript/tern_completer.py, line 218 at r2 (raw file): Previously, Valloric (Val Markovic) wrote…
You probably won't believe me, but I actually do use If only there was an autocomplete plugin for Vim which supported offering dictionary suggestions when typing in comments.... OK kill me. I think that's fair. Comments from Reviewable |
@puremourning This has no Reviewed 1 of 1 files at r4. Comments from Reviewable |
I honk it is g2g from server POV. when we're happy with ycm-core/YouCompleteMe#2657 then we can merge this. It's safe to merge without it (I think) - will check |
Reviewed 7 of 7 files at r2, 5 of 6 files at r3, 1 of 1 files at r4. ycmd/request_wrap.py, line 135 at r4 (raw file):
Why don't we just remove the ycmd/request_wrap.py, line 148 at r4 (raw file):
Same comment as above. ycmd/tests/request_wrap_test.py, line 284 at r4 (raw file):
Missing space after Comments from Reviewable |
f19b4c3
to
608f53e
Compare
Review status: all files reviewed at latest revision, 8 unresolved discussions. ycmd/request_wrap.py, line 135 at r4 (raw file): Previously, micbou wrote…
Fair point. Done. ycmd/request_wrap.py, line 148 at r4 (raw file): Previously, micbou wrote…
Fair point. Done. ycmd/tests/request_wrap_test.py, line 284 at r4 (raw file): Previously, micbou wrote…
Done. Comments from Reviewable |
Hang on. I marked comments as done, but i haven't done them. Senile moment. Lemme see what happened. |
Review status: all files reviewed at latest revision, 8 unresolved discussions. ycmd/request_wrap.py, line 135 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
Correction. I tried this and it just doesn't work. It's not super intuitive, but I'll explain: The problem is that the calculation of the fields Basically:
I hope that makes sense... It took me a few mins to work it out :) ycmd/request_wrap.py, line 148 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
See above. I've added a brief comment to explain. Comments from Reviewable |
608f53e
to
d6a5700
Compare
OK panic over, I wasn't going mad. I reverted it because it was wrong :) |
d6a5700
to
4fe692c
Compare
I don't know what codecov is moaning about, coverage seems good to me. |
Codecov is moaning (I like that word in this context) about this. At least that's the only file with negative coverage diff according to codecov, but I can't understand why. Reviewed 2 of 2 files at r5. Comments from Reviewable |
Reviewed 1 of 2 files at r5. ycmd/request_wrap.py, line 135 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
Right. I didn't think this through. What about Comments from Reviewable |
Review status: all files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. ycmd/request_wrap.py, line 135 at r4 (raw file): Previously, micbou wrote…
Hmm do we really want to change the The original examples that i remember for the omnicompleter were:
That said, I just tested it out with the javacomplete2 @annotation thing and it isn't working correctly (it's replacing in the right position, but the @ symbol is removed). Will need to drill into that. Comments from Reviewable |
Reviewed 1 of 2 files at r5. ycmd/request_wrap.py, line 135 at r4 (raw file):
This is already the case for the JavaScript completer with the proposed changes. The query is still not set when the start column is updated. It's only computed when filtering the candidates. This means that when changing the start column, we are also changing the query. Try to access the query before computing the candidates. This leads to ycmd returning all candidates when inserting the second punctuation mark in a This is because the query is empty in that case (the start column is at the second punctuation mark). However, if we access the query after computing the candidates (and thus after updating the start column), the query is Comments from Reviewable |
Review status: all files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. ycmd/request_wrap.py, line 135 at r4 (raw file): public class Test {
@SuppressW
public static void main(String[] args) {
}
} The omnifunc returns 2 for the
For confirmation, the result is: public class Test {
SuppressWarnings
public static void main(String[] args) {
}
} and the Vim help says (of the findstart result):
So a Can you check my logic on that? Comments from Reviewable |
Review status: all files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. ycmd/request_wrap.py, line 135 at r4 (raw file):
You're right. I think we should clear the query when forcing the start codepoint/ start column. as it's calculated based on the actual return of the Comments from Reviewable |
Review status: all files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. ycmd/request_wrap.py, line 135 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
actually i can't repro your behaviour with or without the change to 'query' Comments from Reviewable |
Review status: all files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. ycmd/request_wrap.py, line 135 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
Going back to the omnifunc thing. Testing without YCM, (going straight to the omnifunc) I get more sensible results, so something is certainly fishy with the interaction with the omnifunc. Comments from Reviewable |
Review status: all files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. ycmd/request_wrap.py, line 135 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
Fixed it. The two issues are totally related. The solution was to fix the 'query' parameter as you mentioned, and to assign the start column before calling the omnifunc. Comments from Reviewable |
…sn't agree with the completion engine
4fe692c
to
b5742d3
Compare
Review status: 6 of 8 files reviewed at latest revision, 6 unresolved discussions. ycmd/request_wrap.py, line 135 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
OK this is now done. Comments from Reviewable |
Reviewed 2 of 2 files at r6. ycmd/request_wrap.py, line 135 at r4 (raw file): Previously, puremourning (Ben Jackson) wrote…
Awesome! Comments from Reviewable |
Given the number of s, I think we can merge this. @zzbot r+ Review status: all files reviewed at latest revision, 5 unresolved discussions, some commit checks failed. Comments from Reviewable |
📌 Commit b5742d3 has been approved by |
[READY] Allow completers to set the start column We always calculate the start column based on our own identifier semantics. However, some completion engines might have a different interpretation, and indeed the javascript completer does exactly that for `require( '` Fixes: #671 This PR is just to demonstrate the approach for comments. It isn't really tested yet (the tests will certainly fail). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/681) <!-- Reviewable:end -->
💔 Test failed - status-travis |
This bot hates me. @zzbot retry Review status: all files reviewed at latest revision, 5 unresolved discussions, some commit checks failed. Comments from Reviewable |
[READY] Allow completers to set the start column We always calculate the start column based on our own identifier semantics. However, some completion engines might have a different interpretation, and indeed the javascript completer does exactly that for `require( '` Fixes: #671 This PR is just to demonstrate the approach for comments. It isn't really tested yet (the tests will certainly fail). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/681) <!-- Reviewable:end -->
☀️ Test successful - status-travis |
[READY] Reset the start column in omnifunc completer # PR Prelude Thank you for working on YCM! :) **Please complete these steps and check these boxes (by putting an `x` inside the brackets) _before_ filing your PR:** - [X] I have read and understood YCM's [CONTRIBUTING][cont] document. - [X] I have read and understood YCM's [CODE_OF_CONDUCT][code] document. - [X] I have included tests for the changes in my PR. If not, I have included a rationale for why I haven't. - [X] **I understand my PR may be closed if it becomes obvious I didn't actually perform all of these steps.** # Why this change is necessary and useful A number of issues have been raised over the years where YCM doesn't interact great with the user's omnifunc. This is commonly because we ignore the omnifunc's `findstart` response, and use our own implementation (`base.CompletionStartColumn`). In combination with ycm-core/ycmd#681 this change uses the omnifunc's start column for completions and fixes ycm-core/ycmd#671 and others, such as: - #1322 probably (not yet tested) - #1957 - #1816 Note: This is just an initial test for sharing the code to gauge reaction. Not fully tested yet. [cont]: https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md [code]: https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2489) <!-- Reviewable:end -->
[READY] Improve completion of include statements in C-family languages This PR fixes the issue where completion is interrupted after inserting a non-identifier character in include statements. See issues ycm-core/YouCompleteMe#281 and ycm-core/YouCompleteMe#1553. This is done by moving the include completion logic from the filename completer to the Clang one and by setting the start column to the right position thanks to PR #681. A benefit of moving the logic to the Clang completer is that `<C-Space>` now works in include statements. Here's a demo before the changes: ![include-statement-before](https://user-images.githubusercontent.com/10026824/30808129-1c03f634-a1fd-11e7-8de3-0fcc84424d89.gif) and after: ![include-statement-after](https://user-images.githubusercontent.com/10026824/30808134-1e8446e8-a1fd-11e7-9cbe-7bf9b7583fb2.gif) You'll notice that no error is shown to the user after inserting the dot. Fixes ycm-core/YouCompleteMe#281. Fixes ycm-core/YouCompleteMe#1553. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/843) <!-- Reviewable:end -->
We always calculate the start column based on our own identifier semantics.
However, some completion engines might have a different interpretation, and indeed the javascript completer does exactly that for
require( '
Fixes: #671
This PR is just to demonstrate the approach for comments. It isn't really tested yet (the tests will certainly fail).
This change is