Enum used to tag the indices being returned by Highlighter
An identifier representing the absolute path which this
path literal is based on. If None
, then we've only
found a relative path
The various path segments, as String
s. None
means it
is an up
instead of a literal path segment
The last, potentially incomplete section of the path just before the cursor
More-convenient data-structures to work with, compared to the raw tuple-output of Highlighter
Searches the current snippet for path-like forms ending at the current cursor.
Searches the current snippet for path-like forms ending at the current cursor. Doesn't actually go to the filesystem to see what exists, just returns a PathLiteralInfo representing the structure of the path-like-syntax it found
The overall approach is somewhat convoluted, but roughly:
- Use highlightIndices
to search for all syntactic instances of
strings, identifiers or symbols within the text, since those are
the forms that can comprise path literals
- Convert the raw index-tuples into a sequence of objects representing
each found form
- Search backwards from the end of the that list. Take up any initial
(possibly half-complete) Symbol/String literal to become the frag
,
gobble up any /
s followed by ups
or Symbol/String literals to
form the path, and stop if you reach a absolute path "literal"
wd
/pwd
/home
/root
or if you can't parse anything anymore.
The entire code snippet in which we are requesting autocomplete
The position of the cursor when the user hits Tab
None
if no autocomplete is possible, otherwise a PathLiteralInfo
Small hard-coded list of how to convert the names of various path-literal-roots into actual Paths.
Small hard-coded list of how to convert the names of various
path-literal-roots into actual Paths. Some depend on the REPL's
wd
, others don't
Logic to find path "literals" so we can attempt to autocomplete them based on what's actually on the filesystem.