fix: don't eval function calls for suggestions (#1382)

This commit is contained in:
André Medeiros 2019-03-05 14:26:08 -05:00 committed by GitHub
parent 78201ce9df
commit 73a06725ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -92,7 +92,10 @@ export default class Suggestions {
}
public getSuggestions(cmd: string, cb: (results: SuggestionsList) => any) {
// Don't bother returning suggestions for empty commands or for
// commands that already have `(` or `)` to avoid executing code
if (cmd === "") { return cb([]); }
if (cmd.indexOf("(") !== -1 || cmd.indexOf(")") !== -1) { return cb([]); }
const suggestions = this.suggestions;