Java Code Examples for org.eclipse.lsp4j.CompletionItem#setInsertTextFormat()
The following examples show how to use
org.eclipse.lsp4j.CompletionItem#setInsertTextFormat() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContentModelCompletionParticipant.java From lemminx with Eclipse Public License 2.0 | 6 votes |
private static void addCompletionItem(CMElementDeclaration elementDeclaration, DOMElement parentElement, String defaultPrefix, boolean forceUseOfPrefix, ICompletionRequest request, ICompletionResponse response, XMLGenerator generator, Set<String> tags) { String prefix = forceUseOfPrefix ? defaultPrefix : (parentElement != null ? parentElement.getPrefix(elementDeclaration.getNamespace()) : null); String label = elementDeclaration.getName(prefix); if (tags != null) { if (tags.contains(label)) { return; } else { tags.add(label); } } CompletionItem item = new CompletionItem(label); item.setFilterText(request.getFilterForStartTagName(label)); item.setKind(CompletionItemKind.Property); MarkupContent documentation = XMLGenerator.createMarkupContent(elementDeclaration, request); item.setDocumentation(documentation); String xml = generator.generate(elementDeclaration, prefix, isGenerateEndTag(request.getNode(), request.getOffset(), label)); item.setTextEdit(new TextEdit(request.getReplaceRange(), xml)); item.setInsertTextFormat(InsertTextFormat.Snippet); response.addCompletionItem(item, true); }
Example 2
Source File: DdlCompletionItemLoader.java From syndesis with Apache License 2.0 | 6 votes |
/** * Clones a {@link CompletionItem} for the given label from the supplied items * * @param targetLabel * @return a completion item */ private static CompletionItem cloneCompletionItem(List<CompletionItem> items, String targetLabel) { for (CompletionItem item : items) { if (item.getLabel().equalsIgnoreCase(targetLabel)) { CompletionItem clone = new CompletionItem(targetLabel); clone.setAdditionalTextEdits(item.getAdditionalTextEdits()); clone.setCommand(item.getCommand()); clone.setData(item.getData()); clone.setDetail(item.getDetail()); clone.setFilterText(item.getFilterText()); clone.setInsertText(item.getInsertText()); clone.setInsertTextFormat(item.getInsertTextFormat()); clone.setDocumentation(item.getDocumentation()); clone.setDeprecated(item.getDeprecated()); clone.setKind(item.getKind()); clone.setSortText(item.getSortText()); clone.setPreselect(item.getPreselect()); clone.setTextEdit(item.getTextEdit()); return clone; } } return null; }
Example 3
Source File: CompletionItemBuilder.java From syndesis with Apache License 2.0 | 6 votes |
public CompletionItem createSnippetItem(String label, String detail, String documentation, String insertText) { CompletionItem ci = new CompletionItem(); ci.setLabel(label); ci.setKind(CompletionItemKind.Snippet); ci.setInsertTextFormat(InsertTextFormat.Snippet); ci.setInsertText(insertText); if (documentation != null) { ci.setDocumentation(documentation); } else { ci.setDocumentation(CompletionItemBuilder.beautifyDocument(ci.getInsertText())); } if (detail != null) { ci.setDetail(detail); } return ci; }
Example 4
Source File: TableBodyCompletionProvider.java From syndesis with Apache License 2.0 | 5 votes |
public CompletionItem getColumnCompletionItem(int data) { CompletionItem ci = new CompletionItem(); ci.setLabel("column definition"); ci.setInsertText("${1:column_name} ${2:datatype}"); ci.setKind(CompletionItemKind.Snippet); ci.setInsertTextFormat(InsertTextFormat.Snippet); ci.setDocumentation(CompletionItemBuilder.beautifyDocument(ci.getInsertText())); ci.setData(data); ci.setPreselect(true); ci.setSortText("1100"); return ci; }
Example 5
Source File: DdlCompletionItemLoader.java From syndesis with Apache License 2.0 | 5 votes |
public CompletionItem getCreateViewUnionCompletionItem(int data, String sortValue) { CompletionItem ci = new CompletionItem(); ci.setLabel("CREATE VIEW with UNION"); ci.setInsertText(QueryExpressionHelper.CREATE_VIEW_UNION_INSERT_TEXT); ci.setKind(CompletionItemKind.Snippet); ci.setInsertTextFormat(InsertTextFormat.Snippet); ci.setDetail(" Union of two tables from single source"); ci.setDocumentation(CompletionItemBuilder.beautifyDocument(ci.getInsertText())); ci.setData(data); ci.setPreselect(true); ci.setSortText(sortValue); return ci; }
Example 6
Source File: DdlCompletionItemLoader.java From syndesis with Apache License 2.0 | 5 votes |
public CompletionItem getCreateViewJoinCompletionItem(int data, String sortValue) { CompletionItem ci = new CompletionItem(); ci.setLabel("CREATE VIEW with JOIN"); ci.setInsertText(QueryExpressionHelper.CREATE_VIEW_LEFT_OUTER_JOIN_INSERT_TEXT); ci.setKind(CompletionItemKind.Snippet); ci.setInsertTextFormat(InsertTextFormat.Snippet); ci.setDetail(" CREATE VIEW with left join"); ci.setDocumentation(CompletionItemBuilder.beautifyDocument(ci.getInsertText())); ci.setData(data); ci.setPreselect(true); ci.setSortText(sortValue); return ci; }
Example 7
Source File: DdlCompletionItemLoader.java From syndesis with Apache License 2.0 | 5 votes |
public CompletionItem getCreateViewInnerJoinCompletionItem(int data, String sortValue) { CompletionItem ci = new CompletionItem(); ci.setLabel("CREATE VIEW with INNER JOIN"); ci.setInsertText(QueryExpressionHelper.CREATE_VIEW_INNER_JOIN_INSERT_TEXT); ci.setKind(CompletionItemKind.Snippet); ci.setInsertTextFormat(InsertTextFormat.Snippet); ci.setDetail(" CREATE VIEW with inner join"); ci.setDocumentation(CompletionItemBuilder.beautifyDocument(ci.getInsertText())); ci.setData(data); ci.setPreselect(true); ci.setSortText(sortValue); return ci; }
Example 8
Source File: Snippet.java From corrosion with Eclipse Public License 2.0 | 5 votes |
public ICompletionProposal convertToCompletionProposal(int offset, LSPDocumentInfo info, String prefix, String lineIndentation, Range textRange) { CompletionItem item = new CompletionItem(); item.setLabel(display); item.setKind(kind); item.setInsertTextFormat(InsertTextFormat.Snippet); IDocument document = info.getDocument(); // if there is a text selection, take it, since snippets with $TM_SELECTED_TEXT // will want to wrap the selection. item.setTextEdit(new TextEdit(textRange, createReplacement(lineIndentation))); return new LSCompletionProposal(document, offset, item, getLanguageClient(info)); }
Example 9
Source File: XMLCompletions.java From lemminx with Eclipse Public License 2.0 | 5 votes |
private void collectionRegionProposals(ICompletionRequest request, ICompletionResponse response) { // Completion for #region try { int offset = request.getOffset(); TextDocument document = request.getXMLDocument().getTextDocument(); Position pos = document.positionAt(offset); String lineText = document.lineText(pos.getLine()); String lineUntilPos = lineText.substring(0, pos.getCharacter()); Matcher match = regionCompletionRegExpr.matcher(lineUntilPos); if (match.find()) { InsertTextFormat insertFormat = request.getInsertTextFormat(); Range range = new Range(new Position(pos.getLine(), pos.getCharacter() + match.regionStart()), pos); String text = request.isCompletionSnippetsSupported() ? "<!-- #region $1-->" : "<!-- #region -->"; CompletionItem beginProposal = new CompletionItem("#region"); beginProposal.setTextEdit(new TextEdit(range, text)); beginProposal.setDocumentation("Insert Folding Region Start"); beginProposal.setFilterText(match.group()); beginProposal.setSortText("za"); beginProposal.setKind(CompletionItemKind.Snippet); beginProposal.setInsertTextFormat(insertFormat); response.addCompletionAttribute(beginProposal); CompletionItem endProposal = new CompletionItem("#endregion"); endProposal.setTextEdit(new TextEdit(range, "<!-- #endregion-->")); endProposal.setDocumentation("Insert Folding Region End"); endProposal.setFilterText(match.group()); endProposal.setSortText("zb"); endProposal.setKind(CompletionItemKind.Snippet); endProposal.setInsertTextFormat(InsertTextFormat.PlainText); response.addCompletionAttribute(endProposal); } } catch (BadLocationException e) { LOGGER.log(Level.SEVERE, "While performing collectRegionCompletion", e); } }
Example 10
Source File: TableBodyCompletionProvider.java From syndesis with Apache License 2.0 | 5 votes |
public CompletionItem getPrimaryKeyCompletionItem(int data) { CompletionItem ci = new CompletionItem(); ci.setLabel("PRIMARY KEY (column, ...)"); ci.setInsertText("PRIMARY KEY (${1:column})"); ci.setKind(CompletionItemKind.Snippet); ci.setInsertTextFormat(InsertTextFormat.Snippet); ci.setDocumentation(CompletionItemBuilder.beautifyDocument(ci.getInsertText())); ci.setData(data); ci.setPreselect(true); ci.setSortText("1120"); return ci; }
Example 11
Source File: PatchedContentAssistService.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override protected CompletionItem toCompletionItem(ContentAssistEntry entry, int caretOffset, Position caretPosition, Document document) { CompletionItem result = super.toCompletionItem(entry, caretOffset, caretPosition, document); if (entry.getKind().startsWith(ContentAssistEntry.KIND_SNIPPET + ":")) { result.setInsertTextFormat(InsertTextFormat.Snippet); entry.setKind(entry.getKind().substring(ContentAssistEntry.KIND_SNIPPET.length() + 1)); } else if (Objects.equal(entry.getKind(), ContentAssistEntry.KIND_SNIPPET)) { result.setInsertTextFormat(InsertTextFormat.Snippet); } result.setKind(translateKind(entry)); return result; }
Example 12
Source File: XContentAssistService.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Convert to a completion item. */ protected CompletionItem toCompletionItem(ContentAssistEntry entry, int caretOffset, Position caretPosition, Document document) { CompletionItem result = new CompletionItem(); String label = null; if (entry.getLabel() != null) { label = entry.getLabel(); } else { label = entry.getProposal(); } result.setLabel(label); result.setDetail(entry.getDescription()); result.setDocumentation(entry.getDocumentation()); String prefix = null; if (entry.getPrefix() != null) { prefix = entry.getPrefix(); } else { prefix = ""; } Position prefixPosition = document.getPosition(caretOffset - prefix.length()); result.setTextEdit(new TextEdit(new Range(prefixPosition, caretPosition), entry.getProposal())); if (!entry.getTextReplacements().isEmpty()) { if (result.getAdditionalTextEdits() == null) { result.setAdditionalTextEdits(new ArrayList<>(entry.getTextReplacements().size())); } entry.getTextReplacements().forEach(it -> { result.getAdditionalTextEdits().add(toTextEdit(it, document)); }); } if (entry.getKind().startsWith(ContentAssistEntry.KIND_SNIPPET + ":")) { result.setInsertTextFormat(InsertTextFormat.Snippet); entry.setKind(entry.getKind().substring(ContentAssistEntry.KIND_SNIPPET.length() + 1)); } else if (Objects.equal(entry.getKind(), ContentAssistEntry.KIND_SNIPPET)) { result.setInsertTextFormat(InsertTextFormat.Snippet); } result.setKind(translateKind(entry)); return result; }
Example 13
Source File: HTMLCompletionExtensionsTest.java From lemminx with Eclipse Public License 2.0 | 5 votes |
@Override public void onAttributeValue(String valuePrefix, ICompletionRequest completionRequest, ICompletionResponse completionResponse) { String tag = completionRequest.getCurrentTag(); String attributeName = completionRequest.getCurrentAttributeName(); HTMLTag htmlTag = HTMLTag.getHTMLTag(tag); if (htmlTag != null) { String[] attributes = htmlTag.getAttributes(); if (attributes != null) { for (String attribute : attributes) { String attrName = attribute; String attrType = null; int index = attribute.indexOf(":"); if (index != -1) { attrName = attribute.substring(0, index); attrType = attribute.substring(index + 1, attribute.length()); } if (attrType != null && attributeName.equals(attrName)) { Range fullRange = completionRequest.getReplaceRange(); String[] values = HTMLTag.getAttributeValues(attrType); for (String value : values) { String insertText = completionRequest.getInsertAttrValue(value); CompletionItem item = new CompletionItem(); item.setLabel(value); item.setFilterText(insertText); item.setKind(CompletionItemKind.Unit); item.setTextEdit(new TextEdit(fullRange, insertText)); item.setInsertTextFormat(InsertTextFormat.PlainText); completionResponse.addCompletionAttribute(item); } break; } } } } }
Example 14
Source File: HTMLCompletionExtensionsTest.java From lemminx with Eclipse Public License 2.0 | 5 votes |
@Override public void onAttributeName(boolean generateValue, ICompletionRequest completionRequest, ICompletionResponse completionResponse) { String tag = completionRequest.getCurrentTag(); HTMLTag htmlTag = HTMLTag.getHTMLTag(tag); if (htmlTag != null) { String[] attributes = htmlTag.getAttributes(); if (attributes != null) { Range replaceRange = completionRequest.getReplaceRange(); for (String attribute : attributes) { int index = attribute.indexOf(":"); if (index != -1) { attribute = attribute.substring(0, index); } if (!completionResponse.hasAttribute(attribute)) { CompletionItem item = new CompletionItem(); item.setLabel(attribute); item.setKind(CompletionItemKind.Value); String value = generateValue ? "=\"$1\"" : ""; item.setTextEdit(new TextEdit(replaceRange, attribute + value)); item.setInsertTextFormat(InsertTextFormat.Snippet); completionResponse.addCompletionAttribute(item); } } } } }
Example 15
Source File: SnippetCompletionProposal.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private static void setFields(CompletionItem ci, ICompilationUnit cu) { ci.setKind(CompletionItemKind.Snippet); ci.setInsertTextFormat(InsertTextFormat.Snippet); ci.setDocumentation(SnippetUtils.beautifyDocument(ci.getInsertText())); Map<String, String> data = new HashMap<>(3); data.put(CompletionResolveHandler.DATA_FIELD_URI, JDTUtils.toURI(cu)); data.put(CompletionResolveHandler.DATA_FIELD_REQUEST_ID, "0"); data.put(CompletionResolveHandler.DATA_FIELD_PROPOSAL_ID, "0"); ci.setData(data); }
Example 16
Source File: CompletionProvider.java From vscode-as3mxml with Apache License 2.0 | 4 votes |
private void addDefinitionAutoCompleteActionScript(IDefinition definition, IASNode offsetNode, char nextChar, AddImportData addImportData, ILspProject project, CompletionList result) { String definitionBaseName = definition.getBaseName(); if (definitionBaseName.length() == 0) { //vscode expects all items to have a name return; } if (definitionBaseName.startsWith(VECTOR_HIDDEN_PREFIX)) { return; } if (isDuplicateTypeDefinition(definition)) { return; } if (definition instanceof ITypeDefinition) { String qualifiedName = definition.getQualifiedName(); completionTypes.add(qualifiedName); } CompletionItem item = CompletionItemUtils.createDefinitionItem(definition, project); if (definition instanceof IFunctionDefinition && !(definition instanceof IAccessorDefinition) && nextChar != '(' && completionSupportsSnippets) { IFunctionDefinition functionDefinition = (IFunctionDefinition) definition; if (functionDefinition.getParameters().length == 0) { item.setInsertText(definition.getBaseName() + "()"); } else { item.setInsertTextFormat(InsertTextFormat.Snippet); item.setInsertText(definition.getBaseName() + "($0)"); Command showParamsCommand = new Command(); showParamsCommand.setCommand("editor.action.triggerParameterHints"); item.setCommand(showParamsCommand); } } if (ASTUtils.needsImport(offsetNode, definition.getQualifiedName())) { TextEdit textEdit = CodeActionsUtils.createTextEditForAddImport(definition, addImportData); if(textEdit != null) { item.setAdditionalTextEdits(Collections.singletonList(textEdit)); } } IDeprecationInfo deprecationInfo = definition.getDeprecationInfo(); if (deprecationInfo != null) { item.setDeprecated(true); } result.getItems().add(item); }
Example 17
Source File: CompletionProvider.java From vscode-as3mxml with Apache License 2.0 | 4 votes |
private void addEventMetadataToAutoCompleteMXML(TypeScope typeScope, boolean isAttribute, String prefix, boolean includeOpenTagBracket, boolean includeOpenTagPrefix, char nextChar, ILspProject project, CompletionList result) { ArrayList<String> eventNames = new ArrayList<>(); IDefinition definition = typeScope.getDefinition(); while (definition instanceof IClassDefinition) { IClassDefinition classDefinition = (IClassDefinition) definition; IMetaTag[] eventMetaTags = definition.getMetaTagsByName(IMetaAttributeConstants.ATTRIBUTE_EVENT); for (IMetaTag eventMetaTag : eventMetaTags) { String eventName = eventMetaTag.getAttributeValue(IMetaAttributeConstants.NAME_EVENT_NAME); if (eventName == null || eventName.length() == 0) { //vscode expects all items to have a name continue; } if (eventNames.contains(eventName)) { //avoid duplicates! continue; } eventNames.add(eventName); IDefinition eventDefinition = project.resolveSpecifier(classDefinition, eventName); if (eventDefinition == null) { continue; } CompletionItem item = CompletionItemUtils.createDefinitionItem(eventDefinition, project); if (isAttribute && completionSupportsSnippets && nextChar != '=') { item.setInsertTextFormat(InsertTextFormat.Snippet); item.setInsertText(eventName + "=\"$0\""); } else if (!isAttribute) { StringBuilder builder = new StringBuilder(); if (includeOpenTagBracket) { builder.append("<"); } if(includeOpenTagPrefix && prefix != null && prefix.length() > 0) { builder.append(prefix); builder.append(IMXMLCoreConstants.colon); } builder.append(eventName); if (completionSupportsSnippets) { item.setInsertTextFormat(InsertTextFormat.Snippet); builder.append(">"); builder.append("$0"); builder.append("</"); if(prefix != null && prefix.length() > 0) { builder.append(prefix); builder.append(IMXMLCoreConstants.colon); } builder.append(eventName); builder.append(">"); } item.setInsertText(builder.toString()); } result.getItems().add(item); } definition = classDefinition.resolveBaseClass(project); } }
Example 18
Source File: CompletionProvider.java From vscode-as3mxml with Apache License 2.0 | 4 votes |
private void addLanguageAttributesToAutoCompleteMXML(TypeScope typeScope, ASScope otherScope, char nextChar, ILspProject project, CompletionList result) { List<CompletionItem> items = result.getItems(); CompletionItem includeInItem = new CompletionItem(); includeInItem.setKind(CompletionItemKind.Keyword); includeInItem.setLabel(IMXMLLanguageConstants.ATTRIBUTE_INCLUDE_IN); if (completionSupportsSnippets && nextChar != '=') { includeInItem.setInsertTextFormat(InsertTextFormat.Snippet); includeInItem.setInsertText(IMXMLLanguageConstants.ATTRIBUTE_INCLUDE_IN + "=\"$0\""); } items.add(includeInItem); CompletionItem excludeFromItem = new CompletionItem(); excludeFromItem.setKind(CompletionItemKind.Keyword); excludeFromItem.setLabel(IMXMLLanguageConstants.ATTRIBUTE_EXCLUDE_FROM); if (completionSupportsSnippets && nextChar != '=') { excludeFromItem.setInsertTextFormat(InsertTextFormat.Snippet); excludeFromItem.setInsertText(IMXMLLanguageConstants.ATTRIBUTE_EXCLUDE_FROM + "=\"$0\""); } items.add(excludeFromItem); Set<INamespaceDefinition> namespaceSet = ScopeUtils.getNamespaceSetForScopes(typeScope, otherScope, project); IDefinition idPropertyDefinition = typeScope.getPropertyByNameForMemberAccess((CompilerProject) project, IMXMLLanguageConstants.ATTRIBUTE_ID, namespaceSet); if (idPropertyDefinition == null) { CompletionItem idItem = new CompletionItem(); idItem.setKind(CompletionItemKind.Keyword); idItem.setLabel(IMXMLLanguageConstants.ATTRIBUTE_ID); if (completionSupportsSnippets && nextChar != '=') { idItem.setInsertTextFormat(InsertTextFormat.Snippet); idItem.setInsertText(IMXMLLanguageConstants.ATTRIBUTE_ID + "=\"$0\""); } items.add(idItem); } if (frameworkSDKIsRoyale) { IDefinition localIdPropertyDefinition = typeScope.getPropertyByNameForMemberAccess((CompilerProject) project, IMXMLLanguageConstants.ATTRIBUTE_LOCAL_ID, namespaceSet); if (localIdPropertyDefinition == null) { CompletionItem localIdItem = new CompletionItem(); localIdItem.setKind(CompletionItemKind.Keyword); localIdItem.setLabel(IMXMLLanguageConstants.ATTRIBUTE_LOCAL_ID); if (completionSupportsSnippets && nextChar != '=') { localIdItem.setInsertTextFormat(InsertTextFormat.Snippet); localIdItem.setInsertText(IMXMLLanguageConstants.ATTRIBUTE_LOCAL_ID + "=\"$0\""); } items.add(localIdItem); } } }
Example 19
Source File: DdlCompletionItemLoader.java From syndesis with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") private List<CompletionItem> loadItemsFromFile(String fileName) { List<CompletionItem> items = new ArrayList<CompletionItem>(); try (InputStream stream = this.getClass().getResourceAsStream(fileName)) { JSONParser parser = new JSONParser(stream); // A JSON object. Key value pairs are unordered. JSONObject supports // java.util.Map interface. LinkedHashMap<String, Object> jsonObject = parser.object(); // A JSON array. JSONObject supports java.util.List interface. ArrayList<?> completionItemArray = (ArrayList<?>) jsonObject.get("items"); if (completionItemArray != null) { for (Object item : completionItemArray) { LinkedHashMap<String, Object> itemInfo = (LinkedHashMap<String, Object>) item; CompletionItem newItem = new CompletionItem(); newItem.setLabel((String) itemInfo.get("label")); newItem.setKind(STRING_TO_KIND_MAP.get(((String) itemInfo.get("kind")).toUpperCase(Locale.US))); String detail = (String) itemInfo.get("detail"); if (detail != null) { newItem.setDetail(detail); } String documentation = (String) itemInfo.get("documentation"); if (documentation != null) { newItem.setDocumentation(documentation); } newItem.setDeprecated(Boolean.parseBoolean((String) itemInfo.get("deprecated"))); newItem.setPreselect(Boolean.parseBoolean((String) itemInfo.get("preselect"))); String sortText = (String) itemInfo.get("sortText"); if (sortText != null) { newItem.setSortText(sortText); } String insertText = (String) itemInfo.get("insertText"); if (insertText != null) { insertText = insertText.replaceAll("\\n", "\n"); insertText = insertText.replaceAll("\\t", "\t"); newItem.setInsertText(insertText); } String insertTextFormat = (String) itemInfo.get("insertTextFormat"); if (insertTextFormat != null) { if (newItem.getKind().equals(CompletionItemKind.Snippet)) { newItem.setInsertTextFormat(InsertTextFormat.Snippet); } else { newItem.setInsertTextFormat(InsertTextFormat.PlainText); } } // TODO: Implement quick fixes // newItem.setTextEdit((TextEdit)itemInfo.get("textEdit")); // newItem.setAdditionalTextEdits((List<TextEdit>)itemInfo.get("additionalTextEdits")); // newItem.setCommitCharacters((List<String>)itemInfo.get("commitCharacters")); String category = (String) itemInfo.get("category"); if (category != null && !category.isEmpty()) { addItemByCategory(category, newItem); } else { items.add(newItem); } } } } catch (IOException | ParseException e) { throw new IllegalArgumentException("Unable to parse given file: " + fileName, e); } return items; }
Example 20
Source File: CompletionProvider.java From vscode-as3mxml with Apache License 2.0 | 4 votes |
private void addRootMXMLLanguageTagsToAutoComplete(IMXMLTagData offsetTag, String prefix, boolean includeOpenTagPrefix, boolean includeOpenTagBracket, CompletionList result) { List<CompletionItem> items = result.getItems(); CompletionItem item = new CompletionItem(); item.setKind(CompletionItemKind.Keyword); item.setLabel("fx:" + IMXMLLanguageConstants.SCRIPT); if (completionSupportsSnippets) { item.setInsertTextFormat(InsertTextFormat.Snippet); } item.setFilterText(IMXMLLanguageConstants.SCRIPT); item.setSortText(IMXMLLanguageConstants.SCRIPT); StringBuilder builder = new StringBuilder(); if (includeOpenTagBracket) { builder.append("<"); } if (includeOpenTagPrefix) { builder.append(prefix); builder.append(IMXMLCoreConstants.colon); } builder.append(IMXMLLanguageConstants.SCRIPT); builder.append(">"); builder.append("\n"); builder.append("\t"); builder.append(IMXMLCoreConstants.cDataStart); builder.append("\n"); builder.append("\t\t"); if (completionSupportsSnippets) { builder.append("$0"); } builder.append("\n"); builder.append("\t"); builder.append(IMXMLCoreConstants.cDataEnd); builder.append("\n"); builder.append("<"); builder.append(IMXMLCoreConstants.slash); builder.append(prefix); builder.append(IMXMLCoreConstants.colon); builder.append(IMXMLLanguageConstants.SCRIPT); builder.append(">"); item.setInsertText(builder.toString()); items.add(item); addMXMLLanguageTagToAutoComplete(IMXMLLanguageConstants.BINDING, prefix, includeOpenTagBracket, includeOpenTagPrefix, result); addMXMLLanguageTagToAutoComplete(IMXMLLanguageConstants.DECLARATIONS, prefix, includeOpenTagBracket, includeOpenTagPrefix, result); addMXMLLanguageTagToAutoComplete(IMXMLLanguageConstants.METADATA, prefix, includeOpenTagBracket, includeOpenTagPrefix, result); addMXMLLanguageTagToAutoComplete(IMXMLLanguageConstants.STYLE, prefix, includeOpenTagBracket, includeOpenTagPrefix, result); }