mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-10740 Error trying to create new Pyramid project
removed duplicated code
This commit is contained in:
@@ -2,11 +2,7 @@ package com.jetbrains.rest;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -16,32 +12,6 @@ import java.util.Set;
|
||||
public class RestUtil {
|
||||
private RestUtil() {}
|
||||
|
||||
@Nullable
|
||||
public static String findQuickStart(final String sdkHome) {
|
||||
final String runnerName = "sphinx-quickstart" + (SystemInfo.isWindows ? ".exe" : "");
|
||||
File binPath = new File(sdkHome);
|
||||
File binDir = binPath.getParentFile();
|
||||
if (binDir == null) return null;
|
||||
File runner = new File(binDir, runnerName);
|
||||
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
|
||||
runner = new File(new File(binDir, "scripts"), runnerName);
|
||||
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
|
||||
runner = new File(new File(binDir.getParentFile(), "scripts"), runnerName);
|
||||
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
|
||||
runner = new File(new File(binDir.getParentFile(), "local"), runnerName);
|
||||
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
|
||||
runner = new File(new File (new File(binDir.getParentFile(), "local"), "bin"), runnerName);
|
||||
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
|
||||
|
||||
// Search in standard unix path
|
||||
runner = new File(new File("/usr", "bin"), runnerName);
|
||||
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
|
||||
runner = new File(new File (new File("/usr", "local"), "bin"), runnerName);
|
||||
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String[] SPHINX_DIRECTIVES = new String[] {
|
||||
"module::" , "automodule::" , "autoclass::" , "toctree::" , "glossary::" , "code-block::", "versionadded::",
|
||||
"versionchanged::", "deprecated::", "seealso::", "centered::", "hlist::", "index::", "productionlist::", "highlight::",
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.jetbrains.rest.completion;
|
||||
|
||||
import com.intellij.codeInsight.completion.*;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.patterns.PsiElementPattern;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
@@ -33,15 +31,6 @@ public class DirectiveCompletionContributor extends CompletionContributor {
|
||||
for (String tag : RestUtil.getDirectives()) {
|
||||
result.addElement(LookupElementBuilder.create(tag));
|
||||
}
|
||||
Sdk sdk = ProjectRootManager.getInstance(parameters.getPosition().getProject()).getProjectSdk();
|
||||
if (sdk != null) {
|
||||
String sphinx = RestUtil.findQuickStart(sdk.getHomePath());
|
||||
if (sphinx != null) {
|
||||
for (String tag : RestUtil.SPHINX_DIRECTIVES) {
|
||||
result.addElement(LookupElementBuilder.create(tag));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user