Skip to content
This repository has been archived by the owner on Dec 22, 2024. It is now read-only.

Commit

Permalink
Switch to org.jetbrains.intellij.platform v2.0.0-beta6 (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
InSyncWithFoo committed Jun 13, 2024
1 parent 8e758a0 commit b880c90
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 108 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ jobs:
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
./gradlew listProductsReleases
-
name: Build plugin
run: |
Expand Down Expand Up @@ -245,7 +243,7 @@ jobs:
continue-on-error: true
run: |
chmod +x ./gradlew
./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
-
name: Upload result
if: always()
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ TODO.md
### Generated ###
.gradle/
.kotlin/
.intellijPlatform/
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
Expand Down
2 changes: 1 addition & 1 deletion .run/Run IDE for UI Tests.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</option>
<option name="taskNames">
<list>
<option value="runIdeForUiTests"/>
<option value="testIdeUi"/>
</list>
</option>
<option name="vmOptions"/>
Expand Down
2 changes: 1 addition & 1 deletion .run/Run Verifications.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</option>
<option name="taskNames">
<list>
<option value="runPluginVerifier"/>
<option value="verifyPlugin"/>
</list>
</option>
<option name="vmOptions" value=""/>
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ For code changes, see [`CHANGELOG_CODE.md`][_-1].
and includes `py` and `pyi` by default.
Previously, only `.py` files are recognized.

### Changed

* PyCharm has a bug leading to extra quotes being added
when autocompleting `Literal` strings and `TypedDict` keys.
A monkeypatch has been added to mitigate the issues.
This patch might be reverted in the future, when the bug is fixed.


## [0.5.0] - 2024-05-27

Expand Down
16 changes: 10 additions & 6 deletions CHANGELOG_CODE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@ For user-facing changes, see [`CHANGELOG.md`][_-1].

### Changed

* [`PyrightBundle`][60-1] and [`PyrightIcon`][60-2] are renamed. (HEAD)
* Gradle is updated to 8.8. (HEAD)
* [`PyrightBundle`][60-1] and [`PyrightIcon`][60-2] are renamed. (81e35bb9)
* Gradle is updated to 8.8. (81e35bb9)
* [The Kover Gradle Plugin][60-3] is updated to 0.8.1. (8e758a00)
* [The IntelliJ Platform Gradle Plugin][60-4] is updated to 2.0.0-beta6. (HEAD)

### Fixed

* [`SuppressQuickFix`][60-3] names are now stored as messages. (0775b1ee)
* [`SuppressQuickFix`][60-5] names are now stored as messages. (0775b1ee)


[60-1]: https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/blob/HEAD/src/main/kotlin/com/insyncwithfoo/pyrightls/Bundle.kt
[60-2]: https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/blob/HEAD/src/main/kotlin/com/insyncwithfoo/pyrightls/Icon.kt
[60-3]: https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/blob/0775b1ee/src/main/kotlin/com/insyncwithfoo/pyrightls/server/diagnostics/SuppressQuickFix.kt
[60-1]: https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/blob/81e35bb9/src/main/kotlin/com/insyncwithfoo/pyrightls/Bundle.kt
[60-2]: https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/blob/81e35bb9/src/main/kotlin/com/insyncwithfoo/pyrightls/Icon.kt
[60-3]: https://github.com/Kotlin/kotlinx-kover
[60-4]: https://github.com/JetBrains/intellij-platform-gradle-plugin
[60-5]: https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/blob/0775b1ee/src/main/kotlin/com/insyncwithfoo/pyrightls/server/diagnostics/SuppressQuickFix.kt


## [0.5.0] - 2024-05-27
Expand Down
44 changes: 24 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Pyright Language Server for PyCharm Professional

[![Build](https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/actions/workflows/build.yaml/badge.svg)](https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/actions/workflows/build.yaml)
[![Version](https://img.shields.io/jetbrains/plugin/v/24146)][5]
[![Rating](https://img.shields.io/jetbrains/plugin/r/rating/24146)][5]
[![Downloads](https://img.shields.io/jetbrains/plugin/d/24146)][5]
[![Build](https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/actions/workflows/build.yaml/badge.svg)][5]
[![Version](https://img.shields.io/jetbrains/plugin/v/24146)][6]
[![Rating](https://img.shields.io/jetbrains/plugin/r/rating/24146)][7]
[![Downloads](https://img.shields.io/jetbrains/plugin/d/24146)][8]

![](./.github/readme/demo-1.png)

Expand All @@ -12,7 +12,7 @@ Pyright language server integration for PyCharm Professional.

This plugin acts as a bridge between [the Pyright language server][1]
and [the experimental LSP API][2] added in PyCharm Professional 2023.2
to give you annotations about your code as you edit your Python files.
to give you diagnostics about your code as you edit your Python files.

Note: If you use PyCharm Community,
install [the <i>Pyright</i> plugin][3] instead.
Expand Down Expand Up @@ -54,32 +54,36 @@ Add the following line to the <b>Help</b> | <b>Diagnostic Tools</b> |

## Installation

This plugin [is available][5] on the Marketplace.
You can also download the ZIP files manually from [the <i>Releases</i> tab][6]
or [the <i>Actions</i> tab][7] and follow the instructions described [here][8].
This plugin [is available][8] on the Marketplace.
You can also download the ZIP files manually
from [the <i>Releases</i> tab][9] or [the <i>Actions</i> tab][10]
and follow the instructions described [here][11].

Currently supported versions:
2024.1 (build 241.14494.241) - 2024.2.* (build 242.*).


## Credits

Most of the code is derived from [@koxudaxi/ruff-pycharm-plugin][9].
Most of the code is derived from [@koxudaxi/ruff-pycharm-plugin][12].
It is such a fortune that that plugin does almost the same thing
and is also written in Kotlin, and hence easily understandable.

The SVG and PNG logos are derived from [the README image][10]
The SVG and PNG logos are derived from [the README image][13]
of the [@microsoft/pyright][1] repository,
generated using Inkscape's autotrace feature.

Some other files are based on or copied directly from
[@JetBrains/intellij-platform-plugin-template][11].


[5]: https://plugins.jetbrains.com/plugin/24146
[6]: https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/releases
[7]: https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/actions/workflows/build.yaml
[8]: https://www.jetbrains.com/help/pycharm/managing-plugins.html#install_plugin_from_disk
[9]: https://github.com/koxudaxi/ruff-pycharm-plugin
[10]: https://github.com/microsoft/pyright/blob/main/docs/img/PyrightLarge.png
[11]: https://github.com/JetBrains/intellij-platform-plugin-template
[@JetBrains/intellij-platform-plugin-template][14].


[5]: https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/actions/workflows/build.yaml
[6]: https://plugins.jetbrains.com/plugin/24146/versions
[7]: https://plugins.jetbrains.com/plugin/24146/reviews
[8]: https://plugins.jetbrains.com/plugin/24146
[9]: https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/releases
[10]: https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/actions/workflows/build.yaml
[11]: https://www.jetbrains.com/help/pycharm/managing-plugins.html#install_plugin_from_disk
[12]: https://github.com/koxudaxi/ruff-pycharm-plugin
[13]: https://github.com/microsoft/pyright/blob/main/docs/img/PyrightLarge.png
[14]: https://github.com/JetBrains/intellij-platform-plugin-template
154 changes: 90 additions & 64 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,43 +1,113 @@
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)

plugins {
alias(libs.plugins.kotlin) // Kotlin support
alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
alias(libs.plugins.changelog) // Gradle Changelog Plugin
alias(libs.plugins.qodana) // Gradle Qodana Plugin
alias(libs.plugins.kover) // Gradle Kover Plugin
alias(libs.plugins.kotlin)
alias(libs.plugins.intellijPlatform)
alias(libs.plugins.changelog)
alias(libs.plugins.qodana)
alias(libs.plugins.kover)
}

group = properties("pluginGroup").get()
version = properties("pluginVersion").get()

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

// Configure project's dependencies
repositories {
mavenCentral()

// IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
intellijPlatform {
defaultRepositories()
}
}

// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
dependencies {
testImplementation(kotlin("test"))

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

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

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

instrumentationTools()
pluginVerifier()
testFramework(TestFrameworkType.Platform.JUnit4)
}
}

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

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

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

with(it.lines()) {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
}
}

val changelog = project.changelog // local variable for configuration cache compatibility
// Get the latest available change notes from the changelog file
changeNotes = properties("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML,
)
}
}

ideaVersion {
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")
}
}

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
signing {
certificateChain = environment("CERTIFICATE_CHAIN")
privateKey = environment("PRIVATE_KEY")
password = environment("PRIVATE_KEY_PASSWORD")
}

publishing {
token = environment("PUBLISH_TOKEN")
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels = properties("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
}

verifyPlugin {
ides {
recommended()
}
}
}

// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
Expand All @@ -63,67 +133,23 @@ tasks {
systemProperty("ide.experimental.ui", "true")
systemProperty("projectView.hide.dot.idea", "false")
systemProperty("terminal.new.ui", "false")
systemProperty("ide.tree.painter.compact.default", "true")
}

wrapper {
gradleVersion = properties("gradleVersion").get()
}

patchPluginXml {
version = properties("pluginVersion")
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

with(it.lines()) {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
}
}

val changelog = project.changelog // local variable for configuration cache compatibility
// Get the latest available change notes from the changelog file
changeNotes = properties("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML,
)
}
}
}

// Configure UI tests plugin
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
runIdeForUiTests {
testIdeUi {
systemProperty("robot-server.port", "8082")
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
systemProperty("jb.consents.confirmation.enabled", "false")
}

signPlugin {
certificateChain = environment("CERTIFICATE_CHAIN")
privateKey = environment("PRIVATE_KEY")
password = environment("PRIVATE_KEY_PASSWORD")
}

publishPlugin {
dependsOn("patchChangelog")
token = environment("PUBLISH_TOKEN")
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels = properties("pluginVersion").map {
listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" })
}
dependsOn(patchChangelog)
}
}
9 changes: 7 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ platformType = PY
platformVersion = 242-EAP-SNAPSHOT

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

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.8
Expand All @@ -29,3 +31,6 @@ org.gradle.configuration-cache = true

# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching = true

# https://jetbrains-platform.slack.com/archives/C05C80200LS/p1716992543096089
org.jetbrains.intellij.platform.buildFeature.useBinaryReleases = false
Loading

0 comments on commit b880c90

Please sign in to comment.