Skip to content

Commit

Permalink
- Indicate that the schema file in the tree view is non-physical to p…
Browse files Browse the repository at this point in the history
…revent conflicts with Kotlin PSI file intention (#18)

- Switched from deprecated NodeJS Utils to NodeJsInterpreterManager to ensure compatibility with 2016.x versions
(cherry picked from commit 6137f80)
  • Loading branch information
jimmeyer-els committed Aug 17, 2016
1 parent c37c134 commit dd537e6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
import com.intellij.execution.process.ProcessOutputTypes;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.PluginManager;
import com.intellij.javascript.nodejs.NodeDetectionUtil;
import com.intellij.javascript.nodejs.NodeSettingsUtil;
import com.intellij.javascript.nodejs.interpreter.NodeJsInterpreter;
import com.intellij.javascript.nodejs.interpreter.NodeJsInterpreterManager;
import com.intellij.javascript.nodejs.interpreter.local.NodeJsLocalInterpreter;
import com.intellij.lang.jsgraphql.JSGraphQLDebugUtil;
import com.intellij.lang.jsgraphql.ide.project.JSGraphQLLanguageUIProjectService;
import com.intellij.openapi.application.Application;
Expand Down Expand Up @@ -84,14 +85,11 @@ public JSGraphQLNodeLanguageServiceInstance(@NotNull Project project) {
}

public static String getNodeInterpreter(Project project) {
String interpreterPath = NodeSettingsUtil.getInterpreterPath(project);
if(interpreterPath == null) {
File interpreterInPath = NodeDetectionUtil.findInterpreterInPath();
if(interpreterInPath != null) {
interpreterPath = interpreterInPath.getAbsolutePath();
}
}
return interpreterPath;
final NodeJsInterpreter nodeJsInterpreter = NodeJsInterpreterManager.getInstance(project).getDefault();
if(nodeJsInterpreter instanceof NodeJsLocalInterpreter) {
return ((NodeJsLocalInterpreter) nodeJsInterpreter).getInterpreterSystemDependentPath();
}
return null;
}

private void createProcessHandler() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.intellij.extapi.psi.PsiFileBase;
import com.intellij.lang.jsgraphql.schema.JSGraphQLSchemaFileType;
import com.intellij.lang.jsgraphql.schema.JSGraphQLSchemaLanguage;
import com.intellij.lang.jsgraphql.schema.ide.project.JSGraphQLSchemaLanguageProjectService;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.psi.FileViewProvider;
import com.intellij.psi.search.ProjectScope;
Expand Down Expand Up @@ -41,4 +42,13 @@ public String toString() {
return "GraphQL Schema File";
}

@Override
public boolean isPhysical() {
if(Boolean.TRUE.equals(getVirtualFile().getUserData(JSGraphQLSchemaLanguageProjectService.IS_GRAPHQL_SCHEMA_VIRTUAL_FILE))) {
// indicate that the psi file that backs the "GraphQL Schemas" project tree node is considered non-physical.
// this hides it from PSI file intentions etc.
return false;
}
return super.isPhysical();
}
}

0 comments on commit dd537e6

Please sign in to comment.