Search in sources :

Example 1 with GoApplicationRunConfigurationProducer

use of com.goide.runconfig.application.GoApplicationRunConfigurationProducer in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoRunConfigurationProducerTest method testSameRunApplicationConfigurationOnPackage.

public void testSameRunApplicationConfigurationOnPackage() {
    PsiFile file = myFixture.configureByText("a.go", "package main; <caret>\nfunc main() {}");
    PsiElement at = file.findElementAt(myFixture.getCaretOffset());
    assertNotNull(at);
    ConfigurationContext configurationContext = new ConfigurationContext(at);
    GoApplicationRunConfigurationProducer producer = new GoApplicationRunConfigurationProducer();
    GoApplicationConfiguration runConfiguration = createRunAppFileConfiguration(file.getVirtualFile().getPath());
    assertTrue(producer.isConfigurationFromContext(runConfiguration, configurationContext));
    runConfiguration = createRunAppFileConfiguration(file.getVirtualFile().getPath() + "_vl");
    assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
}
Also used : ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) GoApplicationRunConfigurationProducer(com.goide.runconfig.application.GoApplicationRunConfigurationProducer) PsiFile(com.intellij.psi.PsiFile) GoApplicationConfiguration(com.goide.runconfig.application.GoApplicationConfiguration) PsiElement(com.intellij.psi.PsiElement)

Example 2 with GoApplicationRunConfigurationProducer

use of com.goide.runconfig.application.GoApplicationRunConfigurationProducer in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoRunConfigurationProducerTest method testSameRunApplicationConfigurationOnDirectory.

public void testSameRunApplicationConfigurationOnDirectory() {
    PsiFile file = myFixture.addFileToProject("import/path/a.go", "package main; func main(){}");
    PsiDirectory directory = file.getParent();
    assertNotNull(directory);
    ConfigurationContext configurationContext = new ConfigurationContext(directory);
    GoApplicationRunConfigurationProducer producer = new GoApplicationRunConfigurationProducer();
    GoApplicationConfiguration runConfiguration = createRunAppPackageConfiguration("import/path");
    assertTrue(producer.isConfigurationFromContext(runConfiguration, configurationContext));
    runConfiguration = createRunAppPackageConfiguration("import/path/other");
    assertFalse(producer.isConfigurationFromContext(runConfiguration, configurationContext));
}
Also used : ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) GoApplicationRunConfigurationProducer(com.goide.runconfig.application.GoApplicationRunConfigurationProducer) PsiDirectory(com.intellij.psi.PsiDirectory) PsiFile(com.intellij.psi.PsiFile) GoApplicationConfiguration(com.goide.runconfig.application.GoApplicationConfiguration)

Aggregations

GoApplicationConfiguration (com.goide.runconfig.application.GoApplicationConfiguration)2 GoApplicationRunConfigurationProducer (com.goide.runconfig.application.GoApplicationRunConfigurationProducer)2 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)2 PsiFile (com.intellij.psi.PsiFile)2 PsiDirectory (com.intellij.psi.PsiDirectory)1 PsiElement (com.intellij.psi.PsiElement)1