Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #181 from koxudaxi/support_pycharm_eap_211
Browse files Browse the repository at this point in the history
Support PyCharm EAP 211.*
  • Loading branch information
koxudaxi committed Feb 11, 2021
2 parents e4191dc + cbab31c commit 436f3a2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 24 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Expand Up @@ -18,16 +18,16 @@ plugins {

intellij {
pluginName project.name
version "2020.3.3"
version "211.5538.22-EAP-SNAPSHOT"
type "PC"
updateSinceUntilBuild false
downloadSources true
plugins "python-ce", "org.toml.lang:$toml_version"
}

patchPluginXml {
sinceBuild "203.7148"
untilBuild "203.*"
sinceBuild "211.5538.22"
untilBuild "211.*"
}

allprojects {
Expand Down
7 changes: 6 additions & 1 deletion resources/META-INF/plugin.xml
@@ -1,9 +1,14 @@
<idea-plugin url="https://github.com/koxudaxi/poetry-pycharm-plugin" require-restart="true">
<id>com.koxudaxi.poetry</id>
<name>Poetry</name>
<version>1.0.7</version>
<version>1.1.0</version>
<vendor email="koaxudai@gmail.com">Koudai Aono @koxudaxi</vendor>
<change-notes><![CDATA[
<h2>version 1.1.0</h2>
<p>Features</p>
<ul>
<li>Support PyCharm EAP 211.* [#181]</li>
</ul>
<h2>version 1.0.7</h2>
<p>Bug fixes</p>
<ul>
Expand Down
15 changes: 0 additions & 15 deletions src/com/koxudaxi/poetry/PoetrySdkProvider.kt
Expand Up @@ -7,7 +7,6 @@ import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.projectRoots.SdkAdditionalData
import com.intellij.openapi.util.UserDataHolder
import com.jetbrains.python.packaging.ui.PyPackageManagementService
import com.jetbrains.python.psi.PyFile
import com.jetbrains.python.sdk.PyInterpreterInspectionQuickFixData
import com.jetbrains.python.sdk.PySdkProvider
import com.jetbrains.python.sdk.PythonSdkUtil
Expand All @@ -16,13 +15,6 @@ import org.jdom.Element
import javax.swing.Icon

class PoetrySdkProvider : PySdkProvider {
override val configureSdkProgressText: String
get() = "Looking for a pyproject.toml"

override fun configureSdk(project: Project, module: Module, existingSdks: List<Sdk>): Sdk? {
return detectAndSetupPoetry(project, module, existingSdks)
}

override fun createEnvironmentAssociationFix(module: Module, sdk: Sdk, isPyCharm: Boolean, associatedModulePath: String?): PyInterpreterInspectionQuickFixData? {
if (sdk.isPoetry) {
val message = when {
Expand All @@ -45,13 +37,6 @@ class PoetrySdkProvider : PySdkProvider {
return if (sdk.isPoetry) PoetryInstallQuickFix() else null
}

override fun createMissingSdkFix(module: Module, file: PyFile): PyInterpreterInspectionQuickFixData? {
return when {
UsePoetryQuickFix.isApplicable(module) -> PyInterpreterInspectionQuickFixData(UsePoetryQuickFix(null, module), "No Python interpreter configured for the project")
else -> null
}
}

override fun createNewEnvironmentPanel(project: Project?, module: Module?, existingSdks: List<Sdk>, newProjectPath: String?, context: UserDataHolder): PyAddNewEnvPanel {
return PyAddNewPoetryPanel(null, null, existingSdks, newProjectPath, context)
}
Expand Down
8 changes: 3 additions & 5 deletions src/com/koxudaxi/poetry/PyPoetrySdkConfiguration.kt
@@ -1,5 +1,6 @@
package com.koxudaxi.poetry

import com.intellij.codeInspection.util.IntentionName
import com.jetbrains.python.sdk.configuration.PyProjectSdkConfigurationExtension
import com.intellij.execution.ExecutionException
import com.intellij.ide.util.PropertiesComponent
Expand Down Expand Up @@ -28,13 +29,10 @@ class PyPoetrySdkConfiguration : PyProjectSdkConfigurationExtension {

private val LOGGER = Logger.getInstance(PyPoetrySdkConfiguration::class.java)

override fun isApplicable(module: Module): Boolean = module.pyProjectToml != null

override fun createAndAddSdkForConfigurator(module: Module): Sdk? = createAndAddSDk(module, false)

override fun getIntentionName(module: Module): String {
return "Create a poetry environment using ${module.pyProjectToml?.name}"
}
override fun getIntention(module: Module): @IntentionName String? =
module.pyProjectToml?.let { "Create a poetry environment using ${it.name}" }

override fun createAndAddSdkForInspection(module: Module): Sdk? = createAndAddSDk(module, true)

Expand Down

0 comments on commit 436f3a2

Please sign in to comment.