diff --git a/build.gradle.kts b/build.gradle.kts index 8909d95dfb4..4f3f4354de3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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 { @@ -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")) diff --git a/ml-completion/src/main/kotlin/org/rust/ml/RustMLRankingProvider.kt b/ml-completion/src/main/kotlin/org/rust/ml/RustMLRankingProvider.kt new file mode 100644 index 00000000000..500b3c86d71 --- /dev/null +++ b/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 +} diff --git a/ml-completion/src/main/resources/META-INF/ml-completion-only.xml b/ml-completion/src/main/resources/META-INF/ml-completion-only.xml index ce21b54c7d6..53dadcfcef0 100644 --- a/ml-completion/src/main/resources/META-INF/ml-completion-only.xml +++ b/ml-completion/src/main/resources/META-INF/ml-completion-only.xml @@ -2,5 +2,6 @@ + diff --git a/ml-completion/src/test/kotlin/org/rust/ml/RustModelMetadataConsistencyTest.kt b/ml-completion/src/test/kotlin/org/rust/ml/RustModelMetadataConsistencyTest.kt new file mode 100644 index 00000000000..f0a16d18331 --- /dev/null +++ b/ml-completion/src/test/kotlin/org/rust/ml/RustModelMetadataConsistencyTest.kt @@ -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() +}