mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 08:06:56 +07:00
[gitlab] IDEA-350674 Get rid of YAML plugin dependency in GitHub and GitLab plugins
Removed YAML plugin dependency in favor of simple file mask check GitOrigin-RevId: f906ca8a1bccb2e440033d54686032f6b7386abc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
90696209b4
commit
0809cedafa
@@ -20,7 +20,6 @@
|
||||
<dependencies>
|
||||
<plugin id="com.intellij.modules.lang"/>
|
||||
<plugin id="Git4Idea"/>
|
||||
<plugin id="org.jetbrains.plugins.yaml"/>
|
||||
</dependencies>
|
||||
|
||||
<xi:include href="/META-INF/github-core-config.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
|
||||
@@ -78,6 +78,5 @@
|
||||
<orderEntry type="library" name="kotlinx-serialization-json" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="kotlinc.kotlinx-serialization-compiler-plugin" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.coroutines" />
|
||||
<orderEntry type="module" module-name="intellij.yaml" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.github.extensions
|
||||
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
@@ -9,15 +8,11 @@ import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.util.CachedValueProvider
|
||||
import com.intellij.psi.util.CachedValuesManager
|
||||
import org.jetbrains.yaml.YAMLFileType
|
||||
import org.jetbrains.yaml.YAMLLanguage
|
||||
|
||||
const val PARSE_DELAY = 1000L
|
||||
|
||||
fun isGithubActionsFile(virtualFile: VirtualFile, project: Project?): Boolean {
|
||||
if (project == null) return false
|
||||
val isYamlFile = FileTypeRegistry.getInstance().isFileOfType(virtualFile, YAMLFileType.YML)
|
||||
if (!isYamlFile) return false
|
||||
return PsiManager.getInstance(project).findFile(virtualFile)?.let { isGithubActionsFile(it) } == true
|
||||
}
|
||||
|
||||
@@ -54,12 +49,11 @@ fun isGithubWorkflowFile(psiFile: PsiFile?): Boolean {
|
||||
private fun matchesDefaultFilePath(psiFile: PsiFile, vararg pattern: Regex): Boolean {
|
||||
val virtualFile = psiFile.originalFile.virtualFile
|
||||
if (virtualFile == null) return false
|
||||
return (psiFile.language.`is`(YAMLLanguage.INSTANCE)
|
||||
&& pattern.any { it.matches(StringUtil.newBombedCharSequence(virtualFile.path, PARSE_DELAY)) })
|
||||
return (pattern.any { it.matches(StringUtil.newBombedCharSequence(virtualFile.path, PARSE_DELAY)) })
|
||||
}
|
||||
|
||||
val githubActionsFilePattern =
|
||||
Regex("""^.*action\.ya?ml${'$'}""")
|
||||
Regex("""^.*(/|^)action\.ya?ml${'$'}""")
|
||||
|
||||
private val githubWorkflowsFilePattern =
|
||||
Regex("""^.*/\.github/workflows/.*\.(ya?ml)${'$'}""")
|
||||
|
||||
Reference in New Issue
Block a user