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

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


        if (!file.getName().endsWith("_test.go")) {
            return false;
        }

        GoFile goFile = (GoFile) file;
        PsiElement psiSourceElement = (PsiElement) sourceElement.get();

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

            psiSourceElement = locationToTestFunction(psiSourceElement);

            Project project = file.getProject();
            Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(virtualFile);
            GoTestConfiguration testConfig = (GoTestConfiguration) configuration;

            String packageName = goFile.getFullPackageName();
            testConfig.packageName = packageName;
            testConfig.packageDir = goFile.getContainingDirectory().getVirtualFile().getCanonicalPath();

            testConfig.testTargetType = GoTestConfiguration.TestTargetType.Package;

            if (psiSourceElement instanceof GoFile) {
                configuration.setName(packageName);
View Full Code Here


        }

        for (VirtualFile child : dir.getChildren()) {
            if (child.getFileType() == GoFileType.INSTANCE &&
                    child.getNameWithoutExtension().endsWith("_test")) {
                GoFile childGoFile = (GoFile) PsiManager.getInstance(project).findFile(child);
                if (packageName.equals(getPackageName(childGoFile)) &&
                        fileContainsTest(childGoFile)) {
                    return true;
                }
            }
View Full Code Here

        String pkgName = file.getPackageImportPath();
        if (pkgName.endsWith("_test")) {
            String fileName = file.getName();
            String testedFileName = fileName.replace("_test", "");
            try {
                GoFile testedFile = (GoFile) file.getParent().findFile(testedFileName);

                return testedFile.getPackageImportPath();
            } catch (NullPointerException ignored) {

            }

        }
View Full Code Here

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

            GoFile goFile = (GoFile) PsiManager.getInstance(project).findFile(file);
            for (GoFunctionDeclaration func : GoFileUtils.getFunctionDeclarations(goFile)) {
                if (funcName.equals(func.getFunctionName())) {
                    Location location = new PsiLocation<PsiElement>(project, func);
                    return Collections.singletonList(location);
                }
View Full Code Here

    @Override
    public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
                                       @NotNull ResolveState state, PsiElement lastParent,
                                       @NotNull PsiElement place) {

        GoFile files[] = getFiles();

        for (GoFile file : files) {

            ProgressIndicatorProvider.checkCanceled();
View Full Code Here

        if (doc == null || !(startElement instanceof GoExpr) || !(psiFile instanceof GoFile))
            return;

        TextRange textRange = startElement.getTextRange();

        GoFile file = (GoFile) psiFile;

        GoType[] expressionType = getStartElement().getType();

        String typeDescription = GoTypes.getRepresentation(type, file);
View Full Code Here

        } else {
            return null;
        }

        String script = "package main\nimport " + otherImport;
        GoFile newFile = createGoFile(file, script);
        if (newFile == null) {
            return null;
        }
        GoImportDeclarations[] imports = newFile.getImportDeclarations();
        if (imports == null || imports.length != 1) {
            return null;
        }

        return imports[0];
View Full Code Here

        }

        Document doc = editor.getDocument();
        int lineNumber = doc.getLineNumber(editor.getCaretModel().getOffset());

        GoFile goFile = (GoFile) file;
        final PsiElement rightCurly;
        final PsiElement block;
        if (startElement instanceof GoFunctionDeclaration) {
            block = ((GoFunctionDeclaration) startElement).getBlock();
            rightCurly = block.getLastChild();
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.