Repository navigation
Add filesystem meta-commands and path completion - #1613
dcavalcante wants to merge 4 commits into
Conversation
|
Hi @dcavalcante , there are some conflicts to resolve. |
Hey @j-bennet thanks for the heads up, updated! |
…#1632 conflict preview)
| # e.g. 'table' -> self.get_table_matches | ||
| matcher = self.suggestion_matchers[suggestion_type] | ||
| matches.extend(matcher(self, suggestion, word_before_cursor)) | ||
| completion_text = document.text_before_cursor if suggestion_type is Path else word_before_cursor |
There was a problem hiding this comment.
Why did you have to specialcase Path here?
There was a problem hiding this comment.
Path needs the full command text because filesystem arguments can contain spaces.
The normal matcher input comes from document.get_word_before_cursor(WORD=True), so for something like:
\i space directory/q
it only gives the matcher directory/q. For path completion, though, the actual argument is space directory/q.
Passing document.text_before_cursor for Path lets get_path_matches() call parse_special_command() and recover the complete path argument before handing it to PathCompleter.
I special-cased it here to keep the existing matcher contract unchanged for the other suggestion types. There is also a regression test for this case in test_path_completion_handles_spaces.
Summary
\cdand\lsfilesystem commands.\cd,\e,\i,\log-file,\ls, and\o.Validation