public final class SignatureInformation extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SignatureInformation.Context
Additional information about the context in which a signature help request
was triggered.
|
static class |
SignatureInformation.ParameterInformation
Represents a parameter of a callable-signature.
|
static class |
SignatureInformation.TriggerKind
Specifies how a signature help was triggered.
|
Modifier and Type | Method and Description |
---|---|
static void |
collect(Document doc,
int offset,
SignatureInformation.Context context,
java.util.function.Consumer<SignatureInformation> consumer)
Computes and collects signature information for a document at a given offset.
|
String |
getDocumentation()
A human-readable string that represents a doc-comment.
|
String |
getLabel()
The label of this signature information.
|
List<SignatureInformation.ParameterInformation> |
getParameters()
The parameters of this signature.
|
boolean |
isActive()
Returns true if the signature is active.
|
@NonNull public List<SignatureInformation.ParameterInformation> getParameters()
public boolean isActive()
@CheckForNull public String getDocumentation()
public static void collect(@NonNull Document doc, int offset, @NullAllowed SignatureInformation.Context context, @NonNull java.util.function.Consumer<SignatureInformation> consumer)
// Compute and collect signature information for a document at a given offsetSignatureInformation
.collect(doc, offset, null, signature -> { // signature should never be 'null' assertNotNull(signature); // getting signature 'label'String
label = signature.getLabel(); assertEquals("label", label); // check if the signature is active assertTrue(signature.isActive()); // getting signature 'parameters'List
<SignatureInformation
.ParameterInformation> params = signature.getParameters(); // check number of parameters assertEquals(2, params.size()); for (int i = 0; i < params.size(); i++) {SignatureInformation
.ParameterInformation param = params.get(i); // getting parameter 'label'String
paramLabel = param.getLabel(); assertEquals("param" + i, paramLabel); // check if the parameter is active if (i == 1) { assertTrue(param.isActive()); } else { assertFalse(param.isActive()); } // getting optional parameter 'documentation'String
paramDocumentation = param.getDocumentation(); assertEquals("param" + i + " documentation", paramDocumentation); } // getting optional signature 'documentation'String
documentation = signature.getDocumentation(); assertEquals("documentation", documentation); });
doc
- a text documentoffset
- an offset inside the text documentcontext
- an optional signature help contextconsumer
- an operation accepting collected signature information