Package com.intellij.lang.javascript.psi

Examples of com.intellij.lang.javascript.psi.JSElementVisitor


*/
public class KarmaConfigFileInspection extends JSInspection {
  @NotNull
  @Override
  protected PsiElementVisitor createVisitor(final ProblemsHolder holder, LocalInspectionToolSession session) {
    return new JSElementVisitor() {
      @Override
      public void visitJSLiteralExpression(final JSLiteralExpression node) {
        for (PsiReference ref : node.getReferences()) {
          if (ref instanceof KarmaConfigFileReference) {
            handleReference((KarmaConfigFileReference) ref, holder);
View Full Code Here


  }

  @Nullable
  private static String buildBasePath(@NotNull JSFile jsFile) {
    final Ref<String> basePathRef = Ref.create(null);
    JSElementVisitor visitor = new JSElementVisitor() {
      @Override
      public void visitJSProperty(JSProperty property) {
        String name = JsPsiUtils.getPropertyName(property);
        if (BASE_PATH_VAR_NAME.equals(name)) {
          JSLiteralExpression value = ObjectUtils.tryCast(property.getValue(), JSLiteralExpression.class);
          if (value != null && value.isQuotedLiteral()) {
            basePathRef.set(StringUtil.stripQuotesAroundValue(value.getText()));
          }
        }
      }

      @Override
      public void visitElement(PsiElement element) {
        ProgressIndicatorProvider.checkCanceled();
        if (basePathRef.isNull()) {
          element.acceptChildren(this);
        }
      }
    };
    visitor.visitJSFile(jsFile);
    return basePathRef.get();
  }
View Full Code Here

    if (!ApplicationManager.getApplication().isUnitTestMode()) {
      if (!JstdSettingsUtil.areJstdConfigFilesInProject(project)) {
        return JSElementVisitor.NOP_ELEMENT_VISITOR;
      }
    }
    return new JSElementVisitor() {
      @Override
      public void visitJSCallExpression(final JSCallExpression jsCallExpression) {
        JSFile jsFile = null;
        if (jsCallExpression != null) {
          jsFile = ObjectUtils.tryCast(jsCallExpression.getContainingFile(), JSFile.class);
View Full Code Here

TOP

Related Classes of com.intellij.lang.javascript.psi.JSElementVisitor

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.