Packages

object Fuzzy

Metals fuzzy search for strings.

Goals: - predictable, the user should understand why particular results matched a given query. When the search is too fuzzy the results become noisy and the user has little control over how to narrow the results. - fast, we perform fuzzy search on a lot of string in critical paths on ever user keystroke. We avoid allocations and backtracking when possible even if it comes at the price of less readable code.

The following pairs of (query, symbol) match. - InStr java/io/InputFileStream# - IFS java/io/InputFileStream# - i.InStr java/io/InputFileStream# - j.i.InStr java/io/InputFileStream# - M.Entry java/util/Map#Entry# (inner classes are like packages)

The following pairs of (query, symbol) do not match. - IpStr java/io/InputFileStream# (missing leading n before p) - instr java/io/InputFileStream# (lowercase queries are exact, WorkspaceSymbolProvider works around this limitation by guessing multiple capitalizations of all-lowercase queries) - MapEntry java/io/InputFileStream# (missing . separator after "Map") - j.InStr java/io/InputFileStream# (missing io separator, the java/ package must be direct parent)

Glossary and conventions used in this file: - query, what the user typed to look up a symbol. - symbol, a SemanticDB Java/Scala symbol (https://scalameta.org/docs/semanticdb/specification.html) or a java.util.zip.ZipEntry name pointing to a classfile. - delimiter, one of the characters '.' or '/' or '#' that separate package/class/object/trait names in SemanticDB symbols, or '$' that separates inner classes in classfile names. - name, characters between delimiters like "io" in "java/io/InputStream". - main name, the last name in the query or symbol. For example, "Pos" is the main name in "s.m.Pos". - qa, the start index in the query string. - qb, the end index in the query string. - sa, the start index in the symbol string. - sb, the end index in the symbol string.

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

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def bloomFilterQueryStrings(query: String, includeTrigrams: Boolean = true): Iterable[CharSequence]

    Companion to bloomFilterSymbolStrings.

  6. def bloomFilterSymbolStrings(symbols: Iterable[String], result: Set[CharSequence] = mutable.Set.empty): Set[CharSequence]

    Returns the set of strings to insert into a bloom filter index of a single package or file.

    Returns the set of strings to insert into a bloom filter index of a single package or file.

    Given a query and set of symbols where there exists at least one symbol where Fuzzy.matches(query, symbol), this method must meet the following constraints: predicate symbols.exists(symbol => Fuzzy.matches(query, symbol)) implies bloomFilterQueryStrings(query).forall(bloom.mightContain) where bloom = BloomFilter(bloomFilterSymbolStrings)

    What this method roughly tries to achieve is extract the substrings of the symbols that can appear in queries. For example, given the symbol InputFileChunkedStream we insert the following substrings:

    - All prefixes of the individual names Input, File, Chunked and Stream, example: "I", "In", "Inp", ..., "Strea", "Stream". - All trigrams of uppercase characters, example: "IFC", "IFS", "FCS".

    symbols

    all symbols in a source file or a package.

  7. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def matches(query: CharSequence, symbol: CharSequence, skipNames: Int): Boolean

    Returns true if the query matches the given symbol.

    Returns true if the query matches the given symbol.

    query

    the search query like "m.Pos"

    symbol

    the symbol to test the query against like "scala/meta/inputs/Position#"

    skipNames

    the number of names in the symbol to jump over. For regular search, use 0. Use 1 to let the query "m.Pos" match "scala/meta/Position#Range."

  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped