Object

ammonite.shell

PathComplete

Related Doc: package shell

Permalink

object PathComplete

Logic to find path "literals" so we can attempt to autocomplete them based on what's actually on the filesystem.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PathComplete
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. sealed trait Interval extends AnyRef

    Permalink

    Enum used to tag the indices being returned by Highlighter

  2. case class PathLiteralInfo(base: Option[String], body: Seq[Option[String]], frag: Option[String], offset: Int) extends Product with Serializable

    Permalink

    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. None means it is an up instead of a literal path segment

    frag

    The last, potentially incomplete section of the path just before the cursor

  3. sealed trait Span extends AnyRef

    Permalink

    More-convenient data-structures to work with, compared to the raw tuple-output of Highlighter

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object Interval

    Permalink
  5. object Span

    Permalink
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def colorPath(path: Path): EscapeAttr

    Permalink
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. def findPathLiteral(snippet: String, cursor: Int): Option[PathLiteralInfo]

    Permalink

    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.

    snippet

    The entire code snippet in which we are requesting autocomplete

    cursor

    The position of the cursor when the user hits Tab

    returns

    None if no autocomplete is possible, otherwise a PathLiteralInfo

  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. def pathCompleteFilter(wd: ⇒ Path, colors: ⇒ Colors): Filter

    Permalink
  20. val rootMap: Map[Option[String], (Path) ⇒ Path]

    Permalink

    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

  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  22. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped