Class CompletionCandidate
- Namespace
- RDCore.SDK.Model.Symbols.Completion
- Assembly
- RDCore.SDK.dll
One item of a completion list: a name that can be written where the list was asked for, and what it names.
public sealed record CompletionCandidate : IEquatable<CompletionCandidate>
- Inheritance
-
CompletionCandidate
- Implements
- Inherited Members
Constructors
CompletionCandidate(string, CompletionItemKind, string?, string?, Symbol?, int)
One item of a completion list: a name that can be written where the list was asked for, and what it names.
public CompletionCandidate(string Label, CompletionItemKind Kind, string? Detail = null, string? Documentation = null, Symbol? Symbol = null, int Rank = 0)
Parameters
LabelstringThe name, as it is written.
KindCompletionItemKindWhat kind of thing it names, as a client shows it.
DetailstringWhat a client shows next to the name: the type of a variable, the signature of a procedure; null when there is nothing to say.
DocumentationstringWhat the name is, in a sentence or two: the doc string of a library member, chiefly.
SymbolSymbolThe symbol the name binds to; null for a keyword or an intrinsic type name.
RankintWhere the candidate ranks among the others, ahead of the alphabetical order of their names: what is declared nearer to where the list was asked for comes first, and the keywords last.
Properties
Detail
What a client shows next to the name: the type of a variable, the signature of a procedure; null when there is nothing to say.
public string? Detail { get; init; }
Property Value
Documentation
What the name is, in a sentence or two: the doc string of a library member, chiefly.
public string? Documentation { get; init; }
Property Value
InsertText
What is inserted in place of the word when it is not the label: the name alone of a named argument whose := is written already
(Send "a", Cop|:=2); null for the label.
public string? InsertText { get; init; }
Property Value
Kind
What kind of thing it names, as a client shows it.
public CompletionItemKind Kind { get; init; }
Property Value
Label
The name, as it is written.
public string Label { get; init; }
Property Value
Rank
Where the candidate ranks among the others, ahead of the alphabetical order of their names: what is declared nearer to where the list was asked for comes first, and the keywords last.
public int Rank { get; init; }
Property Value
ReplacedAfter
How many characters after the cursor the candidate replaces, with the word typed before it: the rest of the name the cursor is in the middle of, for a
named argument (Send "a", Co|pies:=2), so that no part of the name is written twice; 0 for a candidate written at the cursor.
public int ReplacedAfter { get; init; }
Property Value
Symbol
The symbol the name binds to; null for a keyword or an intrinsic type name.
public Symbol? Symbol { get; init; }
Property Value
Methods
ToCompletionItem(CompletionMatch)
The candidate as an item of an LSP completion list (LSP 3.17 §Completion Request).
public CompletionItem ToCompletionItem(CompletionMatch match = CompletionMatch.Prefix)
Parameters
matchCompletionMatchHow the label matches the word typed (MatchOf(string, string)).
Returns
Remarks
What is filtered by is the label, which is what a client takes when an item has no filterText, and so is what is inserted unless
InsertText says otherwise: neither is written for an item that does not need it, since a list can have a thousand items, and each travels.
The sortText orders a label the word starts before one whose humps it matches, and both before one it does not match; then by
Rank, then by the label in any case: by the name it writes, so a name in brackets ([My Field]) sorts among the others by
My Field.