mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
[evaluation-plugin] ML-2598 Support multiple extensions for the language in evaluation
GitOrigin-RevId: 01c933c333f1922e7622014b5b82aa798052659e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
eb8986c979
commit
4b45ffc244
@@ -1,32 +1,32 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.cce.core
|
||||
|
||||
enum class Language(val displayName: String, private val extension: String, val ideaLanguageId: String, val needSdk: Boolean = false,
|
||||
enum class Language(val displayName: String, private val extensions: List<String>, val ideaLanguageId: String, val needSdk: Boolean = false,
|
||||
val curlyBracket: Boolean = true) {
|
||||
JAVA("Java", "java", "JAVA", needSdk = true),
|
||||
PYTHON("Python", "py", "Python", needSdk = true, curlyBracket = false),
|
||||
KOTLIN("Kotlin", "kt", "kotlin", needSdk = true),
|
||||
RUBY("Ruby", "rb", "ruby", needSdk = true),
|
||||
SCALA("Scala", "scala", "Scala", needSdk = true),
|
||||
CPP("C++", "cpp", "ObjectiveC"),
|
||||
PHP("PHP", "php", "PHP"),
|
||||
JS("JavaScript", "js", "JavaScript"),
|
||||
VUE("Vue", "vue", "Vue"),
|
||||
TYPESCRIPT("TypeScript", "ts", "TypeScript"),
|
||||
GO("Go", "go", "go"),
|
||||
DART("Dart", "dart", "Dart", needSdk = true),
|
||||
RUST("Rust", "rs", "Rust"),
|
||||
CSHARP("C#", "cs", "C#"),
|
||||
CSS("CSS", "css", "CSS"),
|
||||
LESS("Less", "less", "LESS"),
|
||||
SCSS("SCSS", "scss", "SCSS"),
|
||||
HTML("HTML", "html", "HTML"),
|
||||
ANOTHER("Another", "*", ""),
|
||||
UNSUPPORTED("Unsupported", "", ""); // TODO: There are no unsupported languages
|
||||
JAVA("Java", listOf("java"), "JAVA", needSdk = true),
|
||||
PYTHON("Python", listOf("py"), "Python", needSdk = true, curlyBracket = false),
|
||||
KOTLIN("Kotlin", listOf("kt"), "kotlin", needSdk = true),
|
||||
RUBY("Ruby", listOf("rb"), "ruby", needSdk = true),
|
||||
SCALA("Scala", listOf("scala"), "Scala", needSdk = true),
|
||||
CPP("C++", listOf("cpp"), "ObjectiveC"),
|
||||
PHP("PHP", listOf("php"), "PHP"),
|
||||
JS("JavaScript", listOf("js", "jsx"), "JavaScript"),
|
||||
VUE("Vue", listOf("vue"), "Vue"),
|
||||
TYPESCRIPT("TypeScript", listOf("ts", "tsx"), "TypeScript"),
|
||||
GO("Go", listOf("go"), "go"),
|
||||
DART("Dart", listOf("dart"), "Dart", needSdk = true),
|
||||
RUST("Rust", listOf("rs"), "Rust"),
|
||||
CSHARP("C#", listOf("cs"), "C#"),
|
||||
CSS("CSS", listOf("css"), "CSS"),
|
||||
LESS("Less", listOf("less"), "LESS"),
|
||||
SCSS("SCSS", listOf("scss"), "SCSS"),
|
||||
HTML("HTML", listOf("html"), "HTML"),
|
||||
ANOTHER("Another", listOf(), ""),
|
||||
UNSUPPORTED("Unsupported", listOf(), ""); // TODO: There are no unsupported languages
|
||||
|
||||
companion object {
|
||||
fun resolve(displayName: String): Language = entries.find { it.displayName.equals(displayName, ignoreCase = true) } ?: ANOTHER
|
||||
|
||||
fun resolveByExtension(extension: String): Language = entries.find { it.extension == extension } ?: ANOTHER
|
||||
fun resolveByExtension(extension: String): Language = entries.find { it.extensions.contains(extension) } ?: ANOTHER
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user