Completion

object Completion
Companion
class
trait Product
trait Mirror
class Object
trait Matchable
class Any

Type members

Classlikes

class Completer(val mode: Mode, val prefix: String, pos: SourcePosition)

Computes code completions depending on the context in which completion is requested

Computes code completions depending on the context in which completion is requested

Value Params
mode

Should complete names of terms, types or both

pos

Cursor position where completion was requested For the results of all xyzCompletions methods term names and type names are always treated as different keys in the same map and they never conflict with each other.

prefix

The prefix that all suggested completions should start with

final class Mode(val bits: Int) extends AnyVal

The completion mode: defines what kinds of symbols should be included in the completion results.

The completion mode: defines what kinds of symbols should be included in the completion results.

Companion
object
object Mode
Companion
class

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Inherited from
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Inherited from
Mirror

Value members

Concrete methods

def completionMode(path: List[Tree], pos: SourcePosition): Mode

Inspect path to determine what kinds of symbols should be considered.

Inspect path to determine what kinds of symbols should be considered.

If the path starts with:

  • a RefTree, then accept symbols of the same kind as its name;
  • a renaming import, and the cursor is on the renamee, accept both terms and types;
  • an import, accept both terms and types;

Otherwise, provide no completion suggestion.

def completionOffset(path: List[Tree]): Int

Inspect path to determine the offset where the completion result should be inserted.

Inspect path to determine the offset where the completion result should be inserted.

def completionPrefix(path: List[Tree], pos: SourcePosition): String

Inspect path to determine the completion prefix. Only symbols whose name start with the returned prefix should be considered.

Inspect path to determine the completion prefix. Only symbols whose name start with the returned prefix should be considered.

def completions(pos: SourcePosition)(using Context): (Int, List[Completion])

Get possible completions from tree at pos

Get possible completions from tree at pos

Returns

offset and list of symbols for possible completions

def describeCompletions(completions: Map[Name, Seq[SingleDenotation]])(using Context): List[Completion]

Return the list of code completions with descriptions based on a mapping from names to the denotations they refer to. If several denotations share the same name, the type denotations appear before term denotations inside the same Completion.

Return the list of code completions with descriptions based on a mapping from names to the denotations they refer to. If several denotations share the same name, the type denotations appear before term denotations inside the same Completion.

def label(name: Name): String