mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
bugfix HDFSFileInterpreter completion
This commit is contained in:
parent
90a7e518c2
commit
7cc30c3a31
1 changed files with 8 additions and 8 deletions
|
|
@ -262,19 +262,19 @@ public class HDFSFileInterpreter extends FileInterpreter {
|
|||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
logger.info("Completion request at position\t" + cursor + " in string " + buf);
|
||||
final List suggestions = new ArrayList<>();
|
||||
final List<InterpreterCompletion> suggestions = new ArrayList<>();
|
||||
if (StringUtils.isEmpty(buf)) {
|
||||
suggestions.add("ls");
|
||||
suggestions.add("cd");
|
||||
suggestions.add("pwd");
|
||||
suggestions.add(new InterpreterCompletion("ls", "ls"));
|
||||
suggestions.add(new InterpreterCompletion("cd", "cd"));
|
||||
suggestions.add(new InterpreterCompletion("pwd", "pwd"));
|
||||
return suggestions;
|
||||
}
|
||||
|
||||
//part of a command == no spaces
|
||||
if (buf.split(" ").length == 1){
|
||||
if ("cd".contains(buf)) suggestions.add("cd");
|
||||
if ("ls".contains(buf)) suggestions.add("ls");
|
||||
if ("pwd".contains(buf)) suggestions.add("pwd");
|
||||
if ("cd".contains(buf)) suggestions.add(new InterpreterCompletion("cd", "cd"));
|
||||
if ("ls".contains(buf)) suggestions.add(new InterpreterCompletion("ls", "ls"));
|
||||
if ("pwd".contains(buf)) suggestions.add(new InterpreterCompletion("pwd", "pwd"));
|
||||
|
||||
return suggestions;
|
||||
}
|
||||
|
|
@ -311,7 +311,7 @@ public class HDFSFileInterpreter extends FileInterpreter {
|
|||
String beforeLastPeriod = unfinished.substring(0, unfinished.lastIndexOf('.') + 1);
|
||||
//beforeLastPeriod should be the start of fs.pathSuffix, so take the end of it.
|
||||
String suggestedFinish = fs.pathSuffix.substring(beforeLastPeriod.length());
|
||||
suggestions.add(suggestedFinish);
|
||||
suggestions.add(new InterpreterCompletion(suggestedFinish,suggestedFinish));
|
||||
}
|
||||
}
|
||||
return suggestions;
|
||||
|
|
|
|||
Loading…
Reference in a new issue