void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { String originalText = getTextWithEnvVarReplacement(parameters); if (originalText != null) { int lastSlashIndex = originalText.lastIndexOf("/"); if (lastSlashIndex >= 0) { String afterSlash = originalText.substring(lastSlashIndex + 1); String beforeSlash = originalText.substring(0, lastSlashIndex); boolean isRoot = beforeSlash.isEmpty(); if (beforeSlash.startsWith("/") || isRoot || beforeSlash.startsWith("~")) { // absolute paths String path = beforeSlash.equals("~") ? "~/" : beforeSlash; String maybeFilePath = FileUtil.expandUserHome(unquote(path)); File dir = isRoot ? new File("/") : new File(maybeFilePath); if (dir.exists() && dir.isDirectory()) { File[] files = dir.listFiles(); if (files != null) { List<LookupElement> collect = ContainerUtil.map(files, ShFilePathCompletionContributor::createFileLookupElement); String prefix = afterSlash.endsWith("\\") ? afterSlash.substring(0, afterSlash.length() - 1) : afterSlash; result.withPrefixMatcher(prefix).caseInsensitive().addAllElements(collect); } } result.stopHere(); } } } }