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
Provide ML completion ranking for Rust #6419
Conversation
c11e7c7
to
8932e67
Compare
ml-completion/src/test/kotlin/RustElementFeatureProviderTest.kt
Outdated
Show resolved
Hide resolved
8932e67
to
7585297
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except minor comments
ml-completion/src/test/kotlin/org/rust/ml/RsElementFeatureProviderTest.kt
Outdated
Show resolved
Hide resolved
ml-completion/src/main/kotlin/org/rust/ml/RsElementFeatureProvider.kt
Outdated
Show resolved
Hide resolved
ml-completion/src/main/kotlin/org/rust/ml/RsElementFeatureProvider.kt
Outdated
Show resolved
Hide resolved
ml-completion/src/main/kotlin/org/rust/ml/RsElementFeatureProvider.kt
Outdated
Show resolved
Hide resolved
ml-completion/src/main/kotlin/org/rust/ml/RustMLRankingProvider.kt
Outdated
Show resolved
Hide resolved
ml-completion/src/test/kotlin/org/rust/ml/RustModelMetadataConsistencyTest.kt
Outdated
Show resolved
Hide resolved
ml-completion/src/main/kotlin/org/rust/ml/RsElementFeatureProvider.kt
Outdated
Show resolved
Hide resolved
7585297
to
9ada816
Compare
65a8bc2
to
9ada816
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rebase into master, please? It will show the problem with com.intellij.stats.completion
dependency (CI faces it because it actually checks master + your changes)
ml-completion/src/test/kotlin/org/rust/ml/RsElementFeatureProviderTest.kt
Outdated
Show resolved
Hide resolved
ml-completion/src/test/kotlin/org/rust/ml/RustModelMetadataConsistencyTest.kt
Outdated
Show resolved
Hide resolved
ml-completion/src/main/kotlin/org/rust/ml/RustMLRankingProvider.kt
Outdated
Show resolved
Hide resolved
ml-completion/src/test/kotlin/org/rust/ml/RustModelMetadataConsistencyTest.kt
Outdated
Show resolved
Hide resolved
ml-completion/src/main/resources/META-INF/ml-completion-only.xml
Outdated
Show resolved
Hide resolved
9ada816
to
cfdbea2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, there is a merge conflict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, I've added missed keywords in #6492 (it was merged recently) so we should update RsKeywordMLKind
and the corresponding tests
b798157
to
92c95ae
Compare
Rebased onto master (the first force-push) and fixed comments (the second force-push). Also, I removed |
92c95ae
to
d3b9ac4
Compare
Now we provide these two features: * Categorical feature `kind` to consider keyword/PSI type of element * Binary feature `is_from_stdlib` to consider if element's origin is stdlib
d3b9ac4
to
bbd5aa8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
Build succeeded: |
7237: Update Rust ML ranking provider to 0.2.2 r=Undin a=ortem Part of #6411. This PR updates the Rust ML ranking provider version to 0.2.2. The new model takes into account Rust-specific features introduced in #6419, and so is more precise than the previous one. In addition, this PR adds support for decorating the most relevant item with a star icon. <img width="725" alt="Screenshot 2021-05-19 at 16 22 48" src="https://user-images.githubusercontent.com/4854600/118829579-83d4f200-b8be-11eb-9eff-0a6e303fcd35.png"> This feature can be enabled via `Mark the most relevant item in the completion popup` option in `Preferences | Editor | General | Code Completion` settings. changelog: Update experimental code completion ranking for Rust based on machine learning. The ranking model is disabled by default for now. You can enable it via `Editor | General | Code Completion | Machine Learning-Assisted Completion` [settings](https://www.jetbrains.com/help/idea/auto-completing-code.html#ml_completion). Co-authored-by: ortem <ortem00@gmail.com>
7237: Update Rust ML ranking provider to 0.2.2 r=Undin a=ortem Part of #6411. This PR updates the Rust ML ranking provider version to 0.2.2. The new model takes into account Rust-specific features introduced in #6419, and so is more precise than the previous one. In addition, this PR adds support for decorating the most relevant item with a star icon. <img width="725" alt="Screenshot 2021-05-19 at 16 22 48" src="https://user-images.githubusercontent.com/4854600/118829579-83d4f200-b8be-11eb-9eff-0a6e303fcd35.png"> This feature can be enabled via `Mark the most relevant item in the completion popup` option in `Preferences | Editor | General | Code Completion` settings. changelog: Update experimental code completion ranking for Rust based on machine learning. The ranking model is disabled by default for now. You can enable it via `Editor | General | Code Completion | Machine Learning-Assisted Completion` [settings](https://www.jetbrains.com/help/idea/auto-completing-code.html#ml_completion). Co-authored-by: ortem <ortem00@gmail.com>
7777: Enable by default ML code completion ranking for Rust r=Undin a=ortem This PR enables the new ML-based code completion ranking by default. See #6419 for more information on this feature. In case of any issues, the new ranking model can be disabled in `Editor | General | Code Completion | Machine Learning-Assisted Completion` settings. Part of #6411 changelog: Enable by default code completion ranking for Rust based on machine learning. Now the completion suggestions are sorted by their relevance based on the rules learned from data we have gathered anonymously during our EAPs. Note that we have not collected any source code, only information about your interactions with the code completion UI. In case of any issues, you can disable the new ranking model via `Editor | General | Code Completion | Machine Learning-Assisted Completion` settings. Co-authored-by: Artem Mukhin <ortem00@gmail.com>
Part of #6411
This PR adds a new module
ml-completion
to the project. This module provides the ML-based code completion ranking support for Rust. Currently, it consists of:RsCompletionFeaturesPolicy
enabling Ngram model for future modelsRsElementFeatureProvider
providing Rust-specific features to train future models, with testsRsMLRankingProvider
providing an initial ranking model (trained without the stuff above, therefore not very intelligent so far)Thanks to @bibaev for help!
How to use
The new ranking model can be enabled in
Editor | General | Code Completion | Machine Learning-Assisted Completion
settings (see help for more details). However, at the moment, the model is very rough, so it's not strongly recommended for enabling.changelog: Provide experimental code completion ranking for Rust based on machine learning. It applies rules learned from data we have gathered anonymously during our EAPs, which results in better suggestions. Note that we have not collected any source code, only information about your interactions with the code completion UI. The ranking model is disabled by default for now. You can enable it via
Editor | General | Code Completion | Machine Learning-Assisted Completion
settings.