Object/Class

scala.meta.internal.metals

Fuzzy

Related Docs: class Fuzzy | package metals

Permalink

object Fuzzy extends 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
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Fuzzy
  2. Fuzzy
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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. val ExactSearchLimit: Int

    Permalink

    Queries fewer characters than this variable are treated as exact searches.

    Queries fewer characters than this variable are treated as exact searches.

    For example, the query "S" returns only symbols with the exact name "S" and not symbols like "Stream".

    Definition Classes
    Fuzzy
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def bloomFilterQueryStrings(query: String, includeTrigrams: Boolean = true): Iterable[CharSequence]

    Permalink

    Companion to bloomFilterSymbolStrings.

    Companion to bloomFilterSymbolStrings.

    Definition Classes
    Fuzzy
  7. def bloomFilterSymbolStrings(symbols: Iterable[String], hasher: StringBloomFilter): Unit

    Permalink
    Definition Classes
    Fuzzy
  8. def bloomFilterSymbolStrings(symbol: String, hasher: StringBloomFilter): Unit

    Permalink

    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".

    Definition Classes
    Fuzzy
  9. def bloomFilterSymbolStrings(symbols: Iterable[String]): StringBloomFilter

    Permalink
    Definition Classes
    Fuzzy
  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def endsWith(cs: CharSequence, string: String): Boolean

    Permalink
    Definition Classes
    Fuzzy
  12. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  17. def isAllNumeric(string: CharSequence): Boolean

    Permalink

    Returns true if this char sequence contains only digit characters.

    Returns true if this char sequence contains only digit characters.

    Definition Classes
    Fuzzy
  18. def isDelimiter(ch: Char): Boolean

    Permalink
    Definition Classes
    Fuzzy
  19. def isExactMatch(query: String, filename: CharSequence): Boolean

    Permalink
    Definition Classes
    Fuzzy
  20. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  21. def matches(query: CharSequence, symbol: CharSequence, skipNames: Int = 0): Boolean

    Permalink

    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."

    Definition Classes
    Fuzzy
  22. def matchesSubCharacters(query: CharSequence, sym: CharSequence): Boolean

    Permalink

    Returns true if all characters in the query have a case in-sensitive matching character in the symbol, in-order

    Returns true if all characters in the query have a case in-sensitive matching character in the symbol, in-order

    Matching examples: - int toInt - int instance // Because in and t - int intNumber

    Non-matching examples: - int inSub // missing t

    query

    the query string, like "int"

    sym

    the symbol to test for matching against the query string, like "toInt".

    Definition Classes
    Fuzzy
  23. def nameLength(symbol: CharSequence): Int

    Permalink

    Returns the length of the last name in this symbol.

    Returns the length of the last name in this symbol.

    Example: scala/Option$Some.class returns length of "Some"

    Definition Classes
    Fuzzy
  24. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  27. final def synchronized[T0](arg0: ⇒ T0): T0

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

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

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

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

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

Inherited from Fuzzy

Inherited from AnyRef

Inherited from Any

Ungrouped