Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,12 @@ jobs:
- name: Fetch Sources
uses: actions/checkout@v4

# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v3

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
java-version: 21

# Setup Gradle
- name: Setup Gradle
Expand Down Expand Up @@ -83,7 +79,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
java-version: 21

# Setup Gradle
- name: Setup Gradle
Expand All @@ -98,7 +94,7 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: tests-result
name: tests-result-${{ matrix.os }}
path: ${{ github.workspace }}/build/reports/tests

# Run plugin structure verification along with IntelliJ Plugin Verifier
Expand All @@ -108,6 +104,13 @@ jobs:
runs-on: ubuntu-latest
steps:

# Free GitHub Actions Environment Disk Space
- name: Maximize Build Space
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
large-packages: false

# Check out the current repository
- name: Fetch Sources
uses: actions/checkout@v4
Expand All @@ -117,12 +120,19 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
java-version: 21

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

# Cache Plugin Verifier IDEs
- name: Setup Plugin Verifier IDEs Cache
uses: actions/cache@v4
with:
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}

# Run Verify Plugin task and IntelliJ Plugin Verifier tool
- name: Run Plugin Verification tasks
run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
Expand All @@ -133,4 +143,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: pluginVerifier-result
path: ${{ github.workspace }}/build/reports/pluginVerifier
path: ${{ github.workspace }}/build/reports/pluginVerifier
2 changes: 1 addition & 1 deletion .run/Run Plugin.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
</component>
37 changes: 28 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

plugins {
id("java") // Java support
alias(libs.plugins.kotlin) // Kotlin support
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
alias(libs.plugins.changelog) // Gradle Changelog Plugin
alias(libs.plugins.kover) // Gradle Kover Plugin
}

group = providers.gradleProperty("pluginGroup").get()
version = providers.gradleProperty("pluginVersion").get()

// Set the JVM language level used to build the project.
kotlin {
jvmToolchain(17)
jvmToolchain(21)
}

// Configure project's dependencies
Expand All @@ -29,37 +31,37 @@ repositories {
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
dependencies {
testImplementation(libs.junit)
testImplementation(libs.opentest4j)

// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
intellijPlatform {
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))

create(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the formatting?

providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion")
)
// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })

instrumentationTools()
pluginVerifier()
zipSigner()
phpstorm("2025.1")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave it


testFramework(TestFrameworkType.Platform)
}
}

// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
intellijPlatform {
pluginConfiguration {
name = providers.gradleProperty("pluginName")
version = providers.gradleProperty("pluginVersion")

val changelog = project.changelog // local variable for configuration cache compatibility
// Get the latest available change notes from the changelog file
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
(getOrNull(pluginVersion) ?: getUnreleased()).withHeader(false).withEmptySections(false),
Changelog.OutputType.HTML,
)
}
Expand All @@ -86,8 +88,25 @@ changelog {
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
}

// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
kover {
reports {
total {
xml {
onCheck = true
}
}
}
}

tasks {
wrapper {
gradleVersion = providers.gradleProperty("gradleVersion").get()
}
}

sourceSets {
test {
resources.srcDir("src/test/")
}
}
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ pluginGroup = com.vk
pluginName = kphpstorm
pluginRepositoryUrl = https://github.com/VKCOM/kphpstorm
# SemVer format -> https://semver.org
pluginVersion = 1.2.14
pluginVersion = 1.2.15

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 243
pluginUntilBuild = 243.*
pluginSinceBuild = 251
pluginUntilBuild = 251.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IU
platformVersion = 2024.3
platformType = PS
platformVersion = 2025.1

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
platformPlugins = com.jetbrains.php:243.21565.211
platformPlugins =
# Example: platformBundledPlugins = com.intellij.java
platformBundledPlugins = com.intellij.java
platformBundledPlugins = com.jetbrains.php

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.10.2
gradleVersion = 8.13

# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency = false
Expand Down
8 changes: 6 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
[versions]
# libraries
junit = "4.13.2"
opentest4j = "1.3.0"

# plugins
changelog = "2.2.1"
intelliJPlatform = "2.0.1" # TODO: update this in next update: https://youtrack.jetbrains.com/issue/MP-7019
kotlin = "1.9.25"
intelliJPlatform = "2.5.0"
kotlin = "2.1.20"
kover = "0.9.1"

[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
opentest4j = { group = "org.opentest4j", name = "opentest4j", version.ref = "opentest4j" }

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 2 additions & 3 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/main/kotlin/com/vk/kphpstorm/kphptags/KphpDocTag.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.vk.kphpstorm.kphptags
import com.intellij.lang.annotation.AnnotationHolder
import com.intellij.lang.annotation.HighlightSeverity
import com.intellij.psi.PsiElement
import com.intellij.psi.util.PsiTreeUtil
import com.jetbrains.php.lang.documentation.phpdoc.PhpDocUtil
import com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocComment
import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag
Expand Down Expand Up @@ -72,7 +73,8 @@ abstract class KphpDocTag(
}

fun findThisTagInDocComment(docCommentOwner: PhpNamedElement): PhpDocTag? {
return findThisTagInDocComment(docCommentOwner.docComment ?: return null)
return PsiTreeUtil.findChildrenOfType(docCommentOwner.docComment, PhpDocTag::class.java)
.firstOrNull { it.name == nameWithAt }
}

inline fun <reified T : PhpDocTag> findThisTagsInDocComment(docComment: PhpDocComment): List<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import com.jetbrains.php.lang.documentation.phpdoc.parser.tags.PhpDocTagParser
import com.jetbrains.php.lang.parser.PhpParserErrors
import com.jetbrains.php.lang.parser.PhpPsiBuilder
import com.vk.kphpstorm.exphptype.psi.TokensToExPhpTypePsiParsing
import com.vk.kphpstorm.kphptags.psi.KphpDocElementTypes
import com.vk.kphpstorm.kphptags.psi.KphpDocJsonAttributePsiImpl
import com.vk.kphpstorm.kphptags.psi.KphpDocJsonForEncoderPsiImpl
import com.vk.kphpstorm.kphptags.psi.KphpDocTagJsonElementType

class KphpDocTagJsonParser : PhpDocTagParser() {
override fun getElementType() = KphpDocTagJsonElementType
override fun getElementType() = KphpDocElementTypes.kphpDocTagJson

override fun parseContents(builder: PhpPsiBuilder): Boolean {
val paramsTagParser = PhpDocParamTagParser()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package com.vk.kphpstorm.kphptags.parser

import com.jetbrains.php.lang.documentation.phpdoc.parser.tags.PhpDocTagParser
import com.jetbrains.php.lang.parser.PhpPsiBuilder
import com.vk.kphpstorm.kphptags.psi.KphpDocTagSimpleElementType
import com.vk.kphpstorm.kphptags.psi.KphpDocElementTypes

class KphpDocTagSimpleParser : PhpDocTagParser() {
override fun getElementType() = KphpDocTagSimpleElementType
override fun getElementType() = KphpDocElementTypes.kphpDocTagSimple

override fun parseContents(builder: PhpPsiBuilder) = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import com.jetbrains.php.lang.documentation.phpdoc.lexer.PhpDocTokenTypes
import com.jetbrains.php.lang.documentation.phpdoc.parser.tags.PhpDocTagParser
import com.jetbrains.php.lang.parser.PhpParserErrors
import com.jetbrains.php.lang.parser.PhpPsiBuilder
import com.vk.kphpstorm.kphptags.psi.KphpDocTagTemplateClassElementType
import com.vk.kphpstorm.kphptags.psi.KphpDocElementTypes
import com.vk.kphpstorm.kphptags.psi.KphpDocTplParameterDeclPsiImpl

class KphpDocTagTemplateClassParser : PhpDocTagParser() {
override fun getElementType() = KphpDocTagTemplateClassElementType
override fun getElementType() = KphpDocElementTypes.kphpDocTagTemplateClass

override fun parseContents(builder: PhpPsiBuilder): Boolean {
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import com.jetbrains.php.lang.documentation.phpdoc.lexer.PhpDocTokenTypes
import com.jetbrains.php.lang.documentation.phpdoc.parser.tags.PhpDocTagParser
import com.jetbrains.php.lang.parser.PhpParserErrors
import com.jetbrains.php.lang.parser.PhpPsiBuilder
import com.vk.kphpstorm.kphptags.psi.KphpDocTagWarnPerformanceElementType
import com.vk.kphpstorm.kphptags.psi.KphpDocElementTypes
import com.vk.kphpstorm.kphptags.psi.KphpDocWarnPerformanceItemPsiImpl

class KphpDocTagWarnPerformanceParser : PhpDocTagParser() {
override fun getElementType() = KphpDocTagWarnPerformanceElementType
override fun getElementType() = KphpDocElementTypes.kphpDocTagWarnPerformance

override fun parseContents(builder: PhpPsiBuilder): Boolean {
do {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.vk.kphpstorm.kphptags.psi

import com.jetbrains.php.lang.psi.PhpElementType
import com.vk.kphpstorm.KphpStormParserDefinition


Expand All @@ -21,27 +22,26 @@ object KphpDocElementTypes {
* * do not store anything in stubs, so their contents is unaccessible from other files
* Such doc tags are 'simple'
*/
val kphpDocTagSimple = KphpDocTagSimpleElementType
val kphpDocTagSimple = PhpElementType("@kphp-simple")

/**
* '@kphp-warn-performance ...' and '@kphp-analyze-performance ...'
* They don't store stubs, but have a psi parser
*/
val kphpDocTagWarnPerformance = KphpDocTagWarnPerformanceElementType
val kphpDocTagWarnPerformance = PhpElementType("@kphp-warn-performance")

/**
* '@kphp-json [for EncoderName] attribute[= optional value]'
* They don't store stubs, but have a psi parser
*/
val kphpDocTagJson = KphpDocTagJsonElementType
val kphpDocTagJson = PhpElementType("@kphp-json")

/**
* '@kphp-template-class T1, T2'
* (NOTE! This is not working in KPHP for now, it is just a matter of IDE experiments for future)
* This tag stores "T1,T2" in stubs and has custom psi for them, therefore is not simple
*/
val kphpDocTagTemplateClass = KphpDocTagTemplateClassElementType

val kphpDocTagTemplateClass = PhpElementType("@kphp-template-class")
}


Loading
Loading