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 Dec 21, 2020
1 parent c85704e commit 92c95ae
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle.kts
Expand Up @@ -75,6 +75,7 @@ allprojects {
jcenter()
maven("https://dl.bintray.com/jetbrains/markdown")
maven("http://download.eclipse.org/jgit/maven")
maven("https://dl.bintray.com/jetbrains/intellij-third-party-dependencies")
}

idea {
Expand Down Expand Up @@ -464,6 +465,7 @@ project(":ml-completion") {
}
}
dependencies {
implementation("org.jetbrains.intellij.deps.completion:completion-ranking-rust:0.0.4")
implementation(project(":"))
implementation(project(":common"))
testImplementation(project(":", "testOutput"))
Expand Down
@@ -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 RsMLRankingProvider : CatBoostJarCompletionModelProvider("Rust", "rust_features", "rust_model") {
override fun isLanguageSupported(language: Language): Boolean = language == RsLanguage
}
Expand Up @@ -3,5 +3,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.RsMLRankingProvider"/>
</extensions>
</idea-plugin>
@@ -0,0 +1,13 @@
/*
* 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

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

0 comments on commit 92c95ae

Please sign in to comment.