Class AbstractElementCompletionItem<S,G>
java.lang.Object
org.eclipse.lsp4j.CompletionItem
org.eclipse.lemminx.services.extensions.completion.AbstractElementCompletionItem<S,G>
- Type Parameters:
S- the source element Java type.G- the generator Java type.
- Direct Known Subclasses:
ContentModelElementCompletionItem,DOMElementCompletionItem
public abstract class AbstractElementCompletionItem<S,G>
extends org.eclipse.lsp4j.CompletionItem
Abstract class of ) or only the start tag element (ex : <foo) if it
exists an orphan end tag (ex : ).
When it exists an orphan end tag, an aditional text edit is reported to
update this end tag with the start tag of the completion item.
// Samples with completion from Text node
// fo| ==>
// fo| ==>
// Samples with completion from element
// <fo| ==> foo attr="">
// <fo| ==> foo attr="">
// <fo|> ==> foo
// <fo|/> ==> foo
// <fo| attr="" ==> foo
CompletionItem to report an XML element completion
item. This class returns a TextEdit which contains the full element
content (ex : -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractElementCompletionItem(String tagName, S sourceElement, G generator, ICompletionRequest request) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.google.gson.JsonObjectaddResolveData(ICompletionRequest request, String participantId) Update completion item data for resolve support.protected abstract org.eclipse.lsp4j.MarkupContentReturns the completion item documentation and null otherwise.protected abstract StringgenerateFullElementContent(boolean generateEndTag) Returns the full element content (ex :). protected GReturns the generator to generate the full XML element content and null otherwise.protected ICompletionRequestReturns the completion request.protected StringReturns the resolver participant id.protected SReturns the source element (ex : a DOM element, a grammar element declaration, etc) used to generate the completion item.protected StringReturns the tag name of the XML element completion item (ex : 'foo', 'x:foo').protected static booleanhasContentAfterTagName(DOMElement element) static booleanisElementClosed(DOMElement element) static voidupdateEndTagName(DOMNode node, int offset, ISharedSettingsRequest request, String tagName, org.eclipse.lsp4j.CompletionItem completionItem) Methods inherited from class org.eclipse.lsp4j.CompletionItem
equals, getAdditionalTextEdits, getCommand, getCommitCharacters, getData, getDeprecated, getDetail, getDocumentation, getFilterText, getInsertText, getInsertTextFormat, getInsertTextMode, getKind, getLabel, getLabelDetails, getPreselect, getSortText, getTags, getTextEdit, getTextEditText, hashCode, setAdditionalTextEdits, setCommand, setCommitCharacters, setData, setDeprecated, setDetail, setDocumentation, setDocumentation, setDocumentation, setFilterText, setInsertText, setInsertTextFormat, setInsertTextMode, setKind, setLabel, setLabelDetails, setPreselect, setSortText, setTags, setTextEdit, setTextEditText, toString
-
Field Details
-
UPDATE_END_TAG_NAME_FIELD
- See Also:
-
-
Constructor Details
-
AbstractElementCompletionItem
public AbstractElementCompletionItem(String tagName, S sourceElement, G generator, ICompletionRequest request)
-
-
Method Details
-
getTagName
Returns the tag name of the XML element completion item (ex : 'foo', 'x:foo').- Returns:
- the tag name of the XML element completion item (ex : 'foo', 'x:foo').
-
getSourceElement
Returns the source element (ex : a DOM element, a grammar element declaration, etc) used to generate the completion item.- Returns:
- the source element (ex : a DOM element, a grammar element declaration, etc) used to generate the completion item.
-
getGenerator
Returns the generator to generate the full XML element content and null otherwise.- Returns:
- the generator to generate the full XML element content and null otherwise.
-
getRequest
Returns the completion request.- Returns:
- the completion request.
-
hasContentAfterTagName
-
isElementClosed
-
addResolveData
protected com.google.gson.JsonObject addResolveData(ICompletionRequest request, String participantId) Update completion item data for resolve support.- Parameters:
request- the completion request.participantId- the resolve participant id.- Returns:
-
generateFullElementContent
Returns the full element content (ex :). - Parameters:
generateEndTag- true if the element end tag must be generated and false otherwise.- Returns:
- the full element content (ex :
).
-
generateDocumentation
protected abstract org.eclipse.lsp4j.MarkupContent generateDocumentation()Returns the completion item documentation and null otherwise.- Returns:
- the completion item documentation and null otherwise.
-
getResolverParticipantId
Returns the resolver participant id.- Returns:
- the resolver participant id.
-