Examples of TextRange


Examples of com.intellij.openapi.util.TextRange

  @Override
  public int getTextStartOffset(@NotNull PsiElement element) {
    if (element instanceof HaxeComponentName) {
      element = element.getParent();
    }
    final TextRange textRange = element.getTextRange();
    return textRange.getStartOffset();
  }
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

  @Override
  public int getTextEndOffset(@NotNull PsiElement element) {
    if (element instanceof HaxeComponentName) {
      element = element.getParent();
    }
    final TextRange textRange = element.getTextRange();
    return textRange.getEndOffset();
  }
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

public class RegexLanguageInjector implements LanguageInjector {
  @Override
  public void getLanguagesToInject(@NotNull PsiLanguageInjectionHost host, @NotNull InjectedLanguagePlaces injectionPlacesRegistrar) {
    if (host instanceof HaxeRegularExpression) {
      final String text = host.getText();
      final TextRange textRange = new TextRange(text.indexOf('/') + 1, text.lastIndexOf('/'));
      injectionPlacesRegistrar.addPlace(RegExpLanguage.INSTANCE, textRange, null, null);
    }
  }
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

  private static TextRange getTextRangeForLine(Document document, int line) {
    try {
      int lineStartOffset = document.getLineStartOffset(line);
      int lineEndOffset = document.getLineEndOffset(line);
      return new TextRange(lineStartOffset, lineEndOffset);
    } catch (IndexOutOfBoundsException e) {
      // Local file should be different than remote
      return TextRange.EMPTY_RANGE;
    }
  }
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

    if (document == null) {
      return TextRange.EMPTY_RANGE;
    }
    int line = document.getLineNumber(psiElement.getTextOffset());
    int lineEndOffset = document.getLineEndOffset(line);
    return new TextRange(psiElement.getTextOffset(), lineEndOffset);
  }
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

    final Set<SonarIssue> issues;

    if (!DocumentChangeListener.CHANGED_FILES.contains(psiFile.getVirtualFile())) {
      issues = IssuesByFileIndex.getIssuesForFile(psiFile);
      for (SonarIssue issue : issues) {
        final TextRange textRange = Finders.getLineRange(psiFile, issue.getLine());
        createInvisibleHighlighter(psiFile, issue, textRange);
      }
    } else {
      final Set<SonarIssue> issuesFromHighlighters = Sets.newLinkedHashSet();
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

      Optional<PsiElement> startElement = Finders.findFirstElementAtLine(psiFile, issue.getLine());
      if (!startElement.isPresent()) {
        // There is no AST element on this line. Maybe a tabulation issue on a blank line?
        annotation = createAnnotation(holder, issue.formattedMessage(), Finders.getLineRange(psiFile, issue.getLine()), severity);
      } else if (startElement.get().isValid()) {
        TextRange lineRange = Finders.getLineRange(startElement.get());
        annotation = createAnnotation(holder, issue.formattedMessage(), lineRange, severity);
      } else {
        annotation = null;
      }
    }
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

    Set<SonarIssue> issues = IssuesByFileIndex.getIssuesForFile(psiFile);
    for (final SonarIssue issue : issues) {
      if (!processIssue(issue)) continue;
      final ProblemHighlightType severity = SonarToIjSeverityMapping.toProblemHighlightType(issue.getSeverity());
      final TextRange textRange = Finders.getLineRange(psiFile, issue.getLine());
      final ProblemDescriptor problemDescriptor = problemsHolder.getManager().createProblemDescriptor(psiFile, textRange,
          issue.formattedMessage() + " " + issue.getRuleKey(),
          severity,
          false
      );
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

    }

    HbPath path = PsiTreeUtil.findChildOfType(targetBlockMustache, HbPath.class);
    final Document document = PsiDocumentManager.getInstance(project).getDocument(file);
    if (path != null && document != null) {
      final TextRange textRange = path.getTextRange();
      document.replaceString(textRange.getStartOffset(), textRange.getEndOffset(), myCorrectedName);
    }
  }
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

            // only on alias and namespace use main ns
            if(tagName.contains("\\")) {
                rangeEnd = tagName.indexOf("\\") + rangeStart;
            }

            return new TextRange(rangeStart, rangeEnd);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.