Пример #1
0
  @org.jetbrains.annotations.NotNull
  public Object[] getVariants() {
    List<Object> variants = Lists.newArrayList();

    BashFunctionVariantsProcessor processor = new BashFunctionVariantsProcessor();
    PsiTreeUtil.treeWalkUp(processor, this, this.getContainingFile(), ResolveState.initial());

    variants.addAll(processor.getFunctionDefs());

    if (BashProjectSettings.storedSettings(getProject()).isAutocompleteBuiltinCommands()) {
      variants.addAll(LanguageBuiltins.commands);
    }

    if (BashProjectSettings.storedSettings(getProject()).isSupportBash4()) {
      variants.addAll(LanguageBuiltins.commands_v4);
    }

    return variants.toArray();
  }
Пример #2
0
  @NotNull
  public Object[] getVariants() {
    List<Object> variants = Lists.newArrayList();

    // collect the previously declared variables
    final BashVarVariantsProcessor processor = new BashVarVariantsProcessor(this);
    PsiTreeUtil.treeWalkUp(processor, this, this.getContainingFile(), ResolveState.initial());

    variants.addAll(createPsiItems(processor.getVariables()));

    if (BashProjectSettings.storedSettings(getProject()).isAutocompleteBuiltinVars()) {
      variants.addAll(createItems(LanguageBuiltins.bashShellVars, BashIcons.BASH_VAR_ICON));
      variants.addAll(createItems(LanguageBuiltins.bourneShellVars, BashIcons.BOURNE_VAR_ICON));
    }

    if (BashProjectSettings.storedSettings(getProject()).isAutcompleteGlobalVars()) {
      variants.addAll(
          createItems(
              BashProjectSettings.storedSettings(getProject()).getGlobalVariables(),
              BashIcons.GLOBAL_VAR_ICON));
    }

    return variants.toArray();
  }