IntelliJ IDEA插件-无法导入包com.jetbrains.python
我正在为ItelliJ IDEA社区版2018.1.5编写一个插件。我设置了Executor类和GenericProgramRunner类IntelliJ IDEA插件-无法导入包com.jetbrains.python,python,intellij-idea,intellij-plugin,Python,Intellij Idea,Intellij Plugin,我正在为ItelliJ IDEA社区版2018.1.5编写一个插件。我设置了Executor类和GenericProgramRunner类 public class CheckerRunner extends GenericProgramRunner { @NotNull @Override public String getRunnerId() { return "CheckerRunner"; } @Override publ
public class CheckerRunner extends GenericProgramRunner {
@NotNull
@Override
public String getRunnerId() {
return "CheckerRunner";
}
@Override
public boolean canRun(@NotNull String executorId, @NotNull RunProfile runProfile) {
boolean result = executorId.equals(CheckerExecutor.EXECUTOR_ID) ;
result = result && runProfile.getClass().toString().contains("PythonRunConfiguration");
return result;
}
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
RunProfile profile = env.getRunProfile();
if (profile != null) {
System.out.println(profile.getClass().toString());
}
return null;
}
}
我试图导入类com.jetbrains.python.run.PythonRunConfiguration
以用于运行程序的doExecute
方法,但它似乎找不到包come.jetbrains.python
。表示无法解析符号“python”
这是我的跑步者课程的代码
public class CheckerRunner extends GenericProgramRunner {
@NotNull
@Override
public String getRunnerId() {
return "CheckerRunner";
}
@Override
public boolean canRun(@NotNull String executorId, @NotNull RunProfile runProfile) {
boolean result = executorId.equals(CheckerExecutor.EXECUTOR_ID) ;
result = result && runProfile.getClass().toString().contains("PythonRunConfiguration");
return result;
}
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
RunProfile profile = env.getRunProfile();
if (profile != null) {
System.out.println(profile.getClass().toString());
}
return null;
}
}
在canRun
方法中,条件runProfile.getClass().toString()包含(“PythonRunConfiguration”)
的计算结果为true。
doExecute
方法打印class com.jetbrains.python.run.PythonRunConfiguration
到控制台。为什么我不能导入该类?您是否查阅了有关的文档?您需要在Python插件上添加依赖项。谢谢!成功了。