コード例 #1
0
 private static void addBasePathCompletionsIfNeeded(
     @NotNull CompletionParameters parameters,
     @NotNull CompletionResultSet result,
     @NotNull BipartiteString caretBipartiteElementText) {
   YAMLKeyValue keyValue =
       ObjectUtils.tryCast(parameters.getPosition().getParent(), YAMLKeyValue.class);
   if (keyValue != null) {
     if (keyValue.getParent() instanceof YAMLDocument && BasePathInfo.isBasePathKey(keyValue)) {
       BasePathInfo basePathInfo = newBasePathInfo(parameters);
       if (basePathInfo != null) {
         VirtualFile configDir = basePathInfo.getConfigDir();
         if (configDir != null) {
           addPathCompletions(result, caretBipartiteElementText, configDir, true);
         }
       }
     }
   }
 }
コード例 #2
0
 private static void addInnerSequencePathCompletionsIfNeeded(
     @NotNull CompletionParameters parameters,
     @NotNull CompletionResultSet result,
     @NotNull BipartiteString caretBipartiteElementText) {
   PsiElement element = parameters.getPosition();
   YAMLKeyValue keyValue =
       JstdConfigFileUtils.getVerifiedHierarchyHead(
           element.getParent(),
           new Class[] {YAMLSequence.class, YAMLCompoundValue.class},
           YAMLKeyValue.class);
   BasePathInfo basePathInfo = newBasePathInfo(parameters);
   boolean keyMatched =
       keyValue != null && JstdConfigFileUtils.isTopLevelKeyWithInnerFileSequence(keyValue);
   if (basePathInfo != null && keyMatched) {
     VirtualFile basePath = basePathInfo.getBasePath();
     if (basePath != null && keyValue.getParent() instanceof YAMLDocument) {
       addPathCompletions(result, caretBipartiteElementText, basePath, false);
     }
   }
 }