Support for showing rendered doc comments in editor
Fixed #KT-37361
This commit is contained in:
@@ -1,30 +1,20 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.kdoc.psi.api
|
||||
|
||||
import com.intellij.psi.PsiComment
|
||||
import com.intellij.psi.PsiDocCommentBase
|
||||
import org.jetbrains.kotlin.kdoc.psi.impl.KDocSection
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.kdoc.parser.KDocKnownTag
|
||||
|
||||
// Don't implement JetElement (or it will be treated as statement)
|
||||
interface KDoc : PsiComment, KDocElement {
|
||||
fun getOwner(): KtDeclaration?
|
||||
// Don't implement KtElement (or it will be treated as statement)
|
||||
interface KDoc : PsiDocCommentBase, KDocElement {
|
||||
override fun getOwner(): KtDeclaration?
|
||||
fun getDefaultSection(): KDocSection
|
||||
fun getAllSections(): List<KDocSection>
|
||||
fun findSectionByName(name: String): KDocSection?
|
||||
fun findSectionByTag(tag: KDocKnownTag): KDocSection?
|
||||
fun findSectionByTag(tag: KDocKnownTag, subjectName: String): KDocSection?
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.kdoc.psi.impl
|
||||
@@ -37,9 +26,12 @@ class KDocImpl(buffer: CharSequence?) : LazyParseablePsiElement(KDocTokens.KDOC,
|
||||
|
||||
override fun getTokenType(): IElementType = KtTokens.DOC_COMMENT
|
||||
|
||||
override fun getOwner(): KtDeclaration? = getParentOfType<KtDeclaration>(true)
|
||||
override fun getOwner(): KtDeclaration? = getParentOfType(true)
|
||||
|
||||
override fun getDefaultSection(): KDocSection = getChildOfType<KDocSection>()!!
|
||||
override fun getDefaultSection(): KDocSection = getChildOfType()!!
|
||||
|
||||
override fun getAllSections(): List<KDocSection> =
|
||||
getChildrenOfType<KDocSection>().toList()
|
||||
|
||||
override fun findSectionByName(name: String): KDocSection? =
|
||||
getChildrenOfType<KDocSection>().firstOrNull { it.name == name }
|
||||
|
||||
Reference in New Issue
Block a user