Package ro.redeul.google.go.lang.psi

Examples of ro.redeul.google.go.lang.psi.GoFile


        Set<String> packages = new HashSet<String>();

        for (PsiFile child : childs) {
            if (child instanceof GoFile) {
                GoFile goFile = (GoFile) child;

                if (!goFile.getPackage().isMainPackage()) {
                    packages.add(goFile.getPackage().getPackageName());
                }
            }
        }

        builder.addKind("New file", GoIcons.GO_ICON_16x16, "single.go");
View Full Code Here


            if (expressions.length == 0 && hasNamedReturns)
                return;

            int returnTypeIndex = 0;

            GoFile currentFile = (GoFile) statement.getContainingFile();
            // match the expression types with the expected return types.
            for (GoExpr expression : expressions) {
                GoType[] expressionTypes = expression.getType();
                if (expressionTypes.length > 1 && expressions.length > 1) {
                    result.addProblem(
View Full Code Here

            if (child.getFileType() != GoFileType.INSTANCE ||
                child.getNameWithoutExtension().endsWith("_test")) {
                continue;
            }

            GoFile packageGoFile = (GoFile) PsiManager.getInstance(project)
                                                      .findFile(child);
            assert packageGoFile != null;

            if (packageGoFile.getPackage()
                             .getPackageName()
                             .equals(defaultPackageName)) {
                files.add(packageGoFile);
            }
        }
View Full Code Here

    @Override
    public boolean isConfigurationFromContext(RunConfiguration configuration, ConfigurationContext context) {
        if ( configuration.getType() != getConfigurationType() )
            return false;

        GoFile file = locationToFile(context.getLocation());
        if ( file == null || file.getMainFunction() == null)
            return false;

        VirtualFile virtualFile = file.getVirtualFile();
        if (virtualFile == null)
            return false;

        GoApplicationConfiguration goAppConfig = (GoApplicationConfiguration) configuration;

        try {

            Project project = file.getProject();
            Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(virtualFile);
            String name = file.getVirtualFile().getCanonicalPath();

            GoApplicationModuleBasedConfiguration configurationModule = goAppConfig.getConfigurationModule();

            if ( ! StringUtil.equals(goAppConfig.workingDir, project.getBasePath()) ||
                 ! StringUtil.equals(goAppConfig.scriptName, name) ||
View Full Code Here

        return element;
    }

    protected RunnerAndConfigurationSettings createConfigurationByElement(Location location, ConfigurationContext context) {

        GoFile goFile = locationToFile(location);

        if (goFile == null) return null;

        if ( goFile.getMainFunction() == null ) {
            return null;
        }

        return createConfiguration(goFile, context.getModule());
    }
View Full Code Here

                continue;
            }

            GoApplicationConfiguration goApplicationConfiguration = (GoApplicationConfiguration) configuration;

            GoFile goFile = locationToFile(location);
            if ( goFile != null ) {
                VirtualFile virtualFile = goFile.getVirtualFile();
                if ( virtualFile != null && virtualFile.getPath().endsWith(FileUtil.toSystemIndependentName(goApplicationConfiguration.scriptName))) {
                    return existingConfiguration;
                }
            }
        }
View Full Code Here

     */
    @Nullable
    public static String InspectionGenFuncArgs(PsiElement e, List<String> stringList) {
        StringBuilder stringBuilder = new StringBuilder();
        int arg = 0;
        final GoFile currentFile = (GoFile) e.getContainingFile();


        if (GoUtil.isFunctionNameIdentifier(e)) {
            GoCallOrConvExpression callOrConvExpression = findParentOfType(e, GoCallOrConvExpression.class);
            stringBuilder.append("(");
View Full Code Here

            return;
        }

        final RangeMarker rangeMarker = doc.createRangeMarker(startElement.getTextRange());

        GoFile goFile = (GoFile) file;
        Template template;
        GoVarDeclarations[] globalVariables = goFile.getGlobalVariables();
        if (globalVariables.length == 0) {
            template = createNewStatementTemplate(editor, goFile, startElement);
        } else {
            GoVarDeclarations lastVar = globalVariables[globalVariables.length - 1];
            template = createAppendGlobalVariableTemplate(editor, lastVar, startElement);
View Full Code Here

            return GoIcons.GO_ICON_24x24;
        }

        @Override
        TreeElement[] getChildren() {
            GoFile psiFile = (GoFile) element;

            ArrayList<StructureViewTreeElement> children = new ArrayList<StructureViewTreeElement>();

            for (GoLiteralIdentifier id : getConstDeclarations(psiFile)) {
                children.add(new GoStructureViewElement(new ConstLiteralIdentifierInfo(id)));
View Full Code Here

    @Override
    public boolean isConfigurationFromContext(RunConfiguration configuration, ConfigurationContext context) {
        if (configuration.getType() != getConfigurationType())
            return false;

        GoFile file = locationToFile(context.getLocation());
        if (file == null || !file.getName().endsWith("_test.go")) {
            return false;
        }

        PsiElement target = locationToTestFunction(context.getPsiLocation());
        GoTestConfiguration testConfig = (GoTestConfiguration) configuration;

        try {
            VirtualFile virtualFile = file.getVirtualFile();
            if (virtualFile == null)
                return false;

            Project project = file.getProject();
            Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(virtualFile);
            GoApplicationModuleBasedConfiguration configurationModule = testConfig.getConfigurationModule();
            String packageName = file.getPackageName();

            if (!StringUtil.equals(testConfig.packageDir, file.getContainingDirectory().getVirtualFile().getCanonicalPath()) ||
                    !StringUtil.equals(testConfig.workingDir, project.getBasePath()) ||
                    !(testConfig.testTargetType == GoTestConfiguration.TestTargetType.Package) ||
                    !(StringUtil.equals(packageName, file.getPackageName())) ||
                    !(configurationModule != null && module != null && module.equals(configurationModule.getModule())))
                return false;

            if (target instanceof GoFile) {
                GoTestConfiguration.Type executionMode =
View Full Code Here

TOP

Related Classes of ro.redeul.google.go.lang.psi.GoFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.