Class DataEntryField
java.lang.Object
org.eclipse.lemminx.services.data.DataEntryField
Data entry field support used to resolve :
- resolve completion : https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItem
- resolve codeAction : https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeAction
{
"title": "Generate 'content.dtd' and bind with xml-model",
"kind": "quickfix",
...
],
"data": {
"uri": "file:///.../content.xml",
"participantId": "org.eclipse.lemminx.extensions.contentmodel.participants.codeactions.NoGrammarConstraintsCodeAction#xml-model@dtd",
"file": "file:///.../content.dtd"
}
}
The two required data field for any resolve (codeAction, completion, etc) are:
- "uri" : the URI of the document XML where completion, codeAction, etc must be resolved (when user clicks on this quickfix).
- "participantId" : the participant ID which must be used to process the resolve of the completion, codeAction, etc.
- extra fields (in the below sample "file" is the file URI of the grammar file which must be generated).
- Author:
- Angelo ZERR
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.gson.JsonObjectcreateCompletionData(ICompletionRequest request, String participantId) Returns the minimal data to resolve a completion item.static com.google.gson.JsonObjectcreateData(String uri, String participantId) Create a JSON data entry field with the two required information:static StringgetParticipantId(Object data) Returns the participant ID which must be used to process the resolve of the completion, codeAction, etc and null otherwise.static StringgetProperty(Object data, String fieldName) Returns the property value of the givenfieldNameif the givendataand null otherwise.static BooleangetPropertyAsBoolean(Object data, String fieldName) Returns the value of the field as an boolean or null if the field is empty.static IntegergetPropertyAsInt(Object data, String fieldName) Returns the value of the field as an integer or null if the field is empty.static StringReturns the URI of the document XML where completion, codeAction, etc must be resolved (when user clicks on this quickfix) and null otherwise.
-
Field Details
-
OFFSET_FIELD
- See Also:
-
-
Constructor Details
-
DataEntryField
public DataEntryField()
-
-
Method Details
-
createData
Create a JSON data entry field with the two required information:- Parameters:
uri- the URI of the document XML where completion, codeAction, etc must be resolved (when user clicks on this quickfix).participantId- the participant ID which must be used to process the resolve of the completion, codeAction, etc.- Returns:
- the JSON data entry field.
-
getUri
Returns the URI of the document XML where completion, codeAction, etc must be resolved (when user clicks on this quickfix) and null otherwise.- Parameters:
data- the data entry field comings from the CompletionItem, CodeAction, etc.- Returns:
- the URI of the document XML where completion, codeAction, etc must be resolved (when user clicks on this quickfix) and null otherwise.
-
getParticipantId
Returns the participant ID which must be used to process the resolve of the completion, codeAction, etc and null otherwise.- Parameters:
data- the data entry field comings from the CompletionItem, CodeAction, etc.- Returns:
- the participant ID which must be used to process the resolve of the completion, codeAction, etc and null otherwise.
-
getProperty
Returns the property value of the givenfieldNameif the givendataand null otherwise.- Parameters:
data- the data entry field comings from the CompletionItem, CodeAction, etc.fieldName- the entry field name (ex : "uri", "participantId").- Returns:
- the property value of the given
fieldNameif the givendataand null otherwise.
-
getPropertyAsInt
Returns the value of the field as an integer or null if the field is empty.- Parameters:
data- the object to read the field offieldName- the field to read- Returns:
- the value of the field as an integer or null if the field is empty
- Throws:
ClassCastException- if the field is not an integer
-
getPropertyAsBoolean
Returns the value of the field as an boolean or null if the field is empty.- Parameters:
data- the object to read the field offieldName- the field to read- Returns:
- the value of the field as an boolean or null if the field is empty
- Throws:
ClassCastException- if the field is not an boolean
-
createCompletionData
public static com.google.gson.JsonObject createCompletionData(ICompletionRequest request, String participantId) Returns the minimal data to resolve a completion item.- Parameters:
request- the completion request.participantId- the participant id to retrieve the resolver.- Returns:
- the minimal data to resolve a completion item.
-