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

Support PyCharm EAP 211.* #181

Merged
merged 5 commits into from
Feb 11, 2021
Merged
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
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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