object PathComplete
Logic to find path "literals" so we can attempt to autocomplete them based on what's actually on the filesystem.
- Alphabetic
- By Inheritance
- PathComplete
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- sealed trait Interval extends AnyRef
Enum used to tag the indices being returned by Highlighter
- case class PathLiteralInfo(base: Option[String], body: Seq[Option[String]], frag: Option[String], offset: Int) extends Product with Serializable
- base
An identifier representing the absolute path which this path literal is based on. If
None, then we've only found a relative path- body
The various path segments, as
Strings.Nonemeans it is anupinstead of a literal path segment- frag
The last, potentially incomplete section of the path just before the cursor
- sealed trait Span extends AnyRef
More-convenient data-structures to work with, compared to the raw tuple-output of Highlighter
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def colorPath(path: Path): EscapeAttr
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def findPathLiteral(snippet: String, cursor: Int): Option[PathLiteralInfo]
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
highlightIndicesto 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 thefrag, gobble up any/s followed byupsor Symbol/String literals to form the path, and stop if you reach a absolute path "literal"wd/pwd/home/rootor if you can't parse anything anymore.- snippet
The entire code snippet in which we are requesting autocomplete
- cursor
The position of the cursor when the user hits Tab
- returns
Noneif no autocomplete is possible, otherwise a PathLiteralInfo
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def pathCompleteFilter(wd: => Path, colors: => Colors): Filter
- val rootMap: Map[Option[String], (Path) => Path]
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 - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- object Interval
- object Span