WEB-31099 Update documentation for Live Templates

This commit is contained in:
Alexander Zolotov
2018-02-09 14:17:16 +03:00
parent 16628671ca
commit 4169ea9ec6
@@ -1,21 +1,8 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.template.impl;
import com.intellij.lang.documentation.AbstractDocumentationProvider;
import com.intellij.lang.documentation.DocumentationMarkup;
import com.intellij.navigation.ItemPresentation;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
@@ -48,12 +35,9 @@ public class LiveTemplateDocumentationProvider extends AbstractDocumentationProv
}
TemplateImpl template = ((LiveTemplateElement)element).getTemplate();
StringBuilder doc = new StringBuilder("<h2>").append(template.getKey()).append("</h2>");
String description = template.getDescription();
if (StringUtil.isNotEmpty(description)) {
doc.append("<pre>").append(StringUtil.escapeXml(description)).append("</pre><h2>template text</h2>");
}
return doc.append("<pre>").append(StringUtil.escapeXml(template.getString())).append("</pre>").toString();
return DocumentationMarkup.DEFINITION_START + StringUtil.escapeXml(template.getString()) + DocumentationMarkup.DEFINITION_END +
DocumentationMarkup.CONTENT_START + StringUtil.escapeXml(StringUtil.notNullize(template.getDescription())) +
DocumentationMarkup.CONTENT_END;
}
private static class LiveTemplateElement extends FakePsiElement {