Search in sources :

Example 1 with MissingSdk

use of org.elixir_lang.mix.MissingSdk in project intellij-elixir by KronicDeth.

the class Annotator method doAnnotate.

@Nullable
@Override
public List<Issue> doAnnotate(PsiFile file) {
    List<Issue> issueList;
    try {
        ProcessOutput processOutput = ExecUtil.execAndGetOutput(generalCommandLine(file));
        Project project = file.getProject();
        Module module = ModuleUtilCore.findModuleForPsiElement(file);
        issueList = lineListToIssueList(processOutput.getStdoutLines(), project, module);
    } catch (ExecutionException | MissingSdk executionException) {
        issueList = emptyList();
    }
    return issueList;
}
Also used : Project(com.intellij.openapi.project.Project) MissingSdk(org.elixir_lang.mix.MissingSdk) ProcessOutput(com.intellij.execution.process.ProcessOutput) Module(com.intellij.openapi.module.Module) ExecutionException(com.intellij.execution.ExecutionException) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with MissingSdk

use of org.elixir_lang.mix.MissingSdk in project intellij-elixir by KronicDeth.

the class Annotator method generalCommandLine.

@NotNull
private static GeneralCommandLine generalCommandLine(@NotNull String workingDirectory, @NotNull Project project, @Nullable Module module, @NotNull List<String> parameters) throws MissingSdk {
    Sdk sdk;
    if (module != null) {
        sdk = mostSpecificSdk(module);
    } else {
        sdk = mostSpecificSdk(project);
    }
    if (sdk == null) {
        throw new MissingSdk(project, module);
    }
    GeneralCommandLine commandLine = Mix.commandLine(emptyMap(), workingDirectory, sdk, emptyList(), emptyList());
    commandLine.addParameters(parameters);
    return commandLine;
}
Also used : MissingSdk(org.elixir_lang.mix.MissingSdk) GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) Type.mostSpecificSdk(org.elixir_lang.sdk.elixir.Type.mostSpecificSdk) MissingSdk(org.elixir_lang.mix.MissingSdk) Sdk(com.intellij.openapi.projectRoots.Sdk) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

MissingSdk (org.elixir_lang.mix.MissingSdk)2 ExecutionException (com.intellij.execution.ExecutionException)1 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 ProcessOutput (com.intellij.execution.process.ProcessOutput)1 Module (com.intellij.openapi.module.Module)1 Project (com.intellij.openapi.project.Project)1 Sdk (com.intellij.openapi.projectRoots.Sdk)1 Type.mostSpecificSdk (org.elixir_lang.sdk.elixir.Type.mostSpecificSdk)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1