Java Code Examples for org.eclipse.lsp4j.MarkupKind#PLAINTEXT
The following examples show how to use
org.eclipse.lsp4j.MarkupKind#PLAINTEXT .
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: SnippetRegistry.java From lemminx with Eclipse Public License 2.0 | 6 votes |
private static MarkupContent createDocumentation(Snippet snippet, Map<String, String> model, boolean canSupportMarkdown, String lineDelimiter) { StringBuilder doc = new StringBuilder(); if (canSupportMarkdown) { doc.append(System.lineSeparator()); doc.append("```"); String scope = snippet.getScope(); if (scope != null) { doc.append(scope); } doc.append(System.lineSeparator()); } String insertText = getInsertText(snippet, model, true, lineDelimiter); doc.append(insertText); if (canSupportMarkdown) { doc.append(System.lineSeparator()); doc.append("```"); doc.append(System.lineSeparator()); } return new MarkupContent(canSupportMarkdown ? MarkupKind.MARKDOWN : MarkupKind.PLAINTEXT, doc.toString()); }
Example 2
Source File: MarkupContentFactory.java From lemminx with Eclipse Public License 2.0 | 6 votes |
/** * Create the hover from the given markup content list and range. * * @param values the list of documentation values * @param defaultRange the default range. * @return the hover from the given markup content list and range. */ public static Hover createHover(List<MarkupContent> values, Range defaultRange) { if (values.isEmpty()) { return null; } if (values.size() == 1) { return new Hover(values.get(0), defaultRange); } // Markup kind boolean hasMarkdown = values.stream() // .anyMatch(contents -> MarkupKind.MARKDOWN.equals(contents.getKind())); String markupKind = hasMarkdown ? MarkupKind.MARKDOWN : MarkupKind.PLAINTEXT; // Contents String content = createContent(values, markupKind); // Range Range range = defaultRange; return new Hover(new MarkupContent(markupKind, content), range); }
Example 3
Source File: MicroProfileConfigHoverParticipant.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
/** * Returns documentation about the provided <code>propertyKey</code>'s value, * <code>propertyValue</code> * * @param propertyKey the property key * @param propertyValue the property key's value * @param documentFormat documentation format (markdown/text) * @param insertSpacing true if spacing should be inserted around the equals * sign and false otherwise * @return */ public static MarkupContent getDocumentation(String propertyKey, String propertyValue, DocumentFormat documentFormat, boolean insertSpacing) { boolean markdown = DocumentFormat.Markdown.equals(documentFormat); StringBuilder content = new StringBuilder(); if (markdown) { content.append("`"); } content.append(propertyKey); if (propertyValue == null) { if (markdown) { content.append("`"); } content.append(" is not set."); } else { if (insertSpacing) { content.append(" = "); } else { content.append("="); } content.append(propertyValue); if (markdown) { content.append("`"); } } return new MarkupContent(markdown ? MarkupKind.MARKDOWN : MarkupKind.PLAINTEXT, content.toString()); }
Example 4
Source File: EntitiesDocumentationUtils.java From lemminx with Eclipse Public License 2.0 | 5 votes |
/** * Returns the entity documentation. * * @param entityName the entity name. * @param entityValue the entity value. * @param type the entity type (local, external or predefined) * @param markdown true if the documentation can be formatted as markdown and * false otherwise. * @return the entity documentation. */ public static MarkupContent getDocumentation(String entityName, String entityValue, String systemID, String publicID, String targetURI, EntityOriginType type, boolean markdown) { StringBuilder documentation = new StringBuilder(); // Title if (markdown) { documentation.append("**"); } documentation.append("Entity "); documentation.append(entityName); if (markdown) { documentation.append("**"); } addParameter("Value", entityValue, documentation, markdown); addParameter("Type", type.getLabel(), documentation, markdown); addParameter("Public ID", publicID, documentation, markdown); addParameter("System ID", systemID, documentation, markdown); if (targetURI != null) { documentation.append(System.lineSeparator()); if (markdown) { documentation.append(" * "); } documentation.append("Source: "); if (markdown) { documentation.append("["); documentation.append(getFileName(targetURI)); documentation.append("]"); documentation.append("("); } documentation.append(targetURI); if (markdown) { documentation.append(")"); } } return new MarkupContent(markdown ? MarkupKind.MARKDOWN : MarkupKind.PLAINTEXT, documentation.toString()); }
Example 5
Source File: HTMLHoverExtensionsTest.java From lemminx with Eclipse Public License 2.0 | 4 votes |
private Hover createHover(String value) { if (value == null) { return null; } return new Hover(new MarkupContent(MarkupKind.PLAINTEXT, value)); }
Example 6
Source File: AggregetedHoverValuesTest.java From lemminx with Eclipse Public License 2.0 | 4 votes |
private Hover createHover(String value) { return new Hover(new MarkupContent(MarkupKind.PLAINTEXT, value)); }