Skip to content

Commit

Permalink
[completion] Rewrite completion using the actual OSH lexer and parser!
Browse files Browse the repository at this point in the history
We're making use of parse_ctx.comp_state.

- The variable name completion is much more accurate now.  It handles $,
  ${, $P, and ${P, and the variable doesn't have to start a word (unlike
  in bash).
- Add EmitCompDummy() to the lexer.  PushHint() wasn't right because
  echo $(<TAB> didn't work.
- Add unit test infrastructure to simulate what readline does with
  set_completer_delims().
- Get rid of more than one old hacky mechanism for completion.
  • Loading branch information
Andy Chu committed Dec 14, 2018
1 parent 0b73828 commit 9a63adf
Show file tree
Hide file tree
Showing 12 changed files with 320 additions and 396 deletions.
4 changes: 2 additions & 2 deletions bin/oil.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ def ShellMain(lang, argv0, argv, login_shell):
splitter = split.SplitContext(mem) # TODO: share with executor.
ev = word_eval.CompletionWordEvaluator(mem, exec_opts, splitter, arena)
progress_f = ui.StatusLine()
var_action = completion.VariablesActionInternal(ex.mem)
root_comp = completion.RootCompleter(ev, comp_lookup, var_action,
# TODO: Should parse_ctx have a different arena?
root_comp = completion.RootCompleter(ev, comp_lookup, mem,
parse_ctx, progress_f, debug_f)
completion.Init(readline, root_comp, debug_f)
_InitDefaultCompletions(ex, comp_lookup)
Expand Down
Loading

0 comments on commit 9a63adf

Please sign in to comment.