Skip to content

Commit

Permalink
#6411: Add Rust ranking provider based on CatBoost model
Browse files Browse the repository at this point in the history
  • Loading branch information
artemmukhin committed Nov 30, 2020
1 parent 4571960 commit 9ada816
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle.kts
Expand Up @@ -74,6 +74,7 @@ allprojects {
mavenCentral()
jcenter()
maven("https://dl.bintray.com/jetbrains/markdown")
maven("https://dl.bintray.com/jetbrains/intellij-third-party-dependencies")
}

idea {
Expand Down Expand Up @@ -456,6 +457,7 @@ project(":ml-completion") {
setPlugins(mlCompletionPlugin)
}
dependencies {
implementation("org.jetbrains.intellij.deps.completion:completion-ranking-rust:0.0.4")
implementation(project(":"))
implementation(project(":common"))
testImplementation(project(":", "testOutput"))
Expand Down
15 changes: 15 additions & 0 deletions ml-completion/src/main/kotlin/org/rust/ml/RustMLRankingProvider.kt
@@ -0,0 +1,15 @@
/*
* Use of this source code is governed by the MIT license that can be
* found in the LICENSE file.
*/

package org.rust.ml

import com.intellij.internal.ml.catboost.CatBoostJarCompletionModelProvider
import com.intellij.lang.Language
import org.rust.lang.RsLanguage

@Suppress("UnstableApiUsage")
class RustMLRankingProvider : CatBoostJarCompletionModelProvider("Rust", "rust_features", "rust_model") {
override fun isLanguageSupported(language: Language): Boolean = language == RsLanguage
}
Expand Up @@ -2,5 +2,6 @@
<extensions defaultExtensionNs="com.intellij">
<completion.ml.ranking.features.policy language="Rust" implementationClass="org.rust.ml.RsCompletionFeaturesPolicy"/>
<completion.ml.elementFeatures language="Rust" implementationClass="org.rust.ml.RsElementFeatureProvider"/>
<completion.ml.model implementation="org.rust.ml.RustMLRankingProvider"/>
</extensions>
</idea-plugin>
@@ -0,0 +1,18 @@
/*
* Use of this source code is governed by the MIT license that can be
* found in the LICENSE file.
*/

package org.rust.ml

import org.junit.Test

/*
* Use of this source code is governed by the MIT license that can be
* found in the LICENSE file.
*/

class RustModelMetadataConsistencyTest {
@Test
fun `test model metadata consistency`() = RustMLRankingProvider().assertModelMetadataConsistent()
}

0 comments on commit 9ada816

Please sign in to comment.