Skip to content

Commit

Permalink
[v0.2.4] fix #7
Browse files Browse the repository at this point in the history
  • Loading branch information
zxj5470 committed May 27, 2018
1 parent ad5a283 commit 60c7062
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
5 changes: 5 additions & 0 deletions changeNotes.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v0.2.4<br/>
<ul>
<li>Fix doc in function params with lambda</li>
</ul>

v0.2.3<br/>
<ul>
<li>Fix fatal bug!</li>
Expand Down
16 changes: 8 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# BugKotlinDocument
Plugin for **IntelliJ IDEA** / **Android Studio** / **CLion**.
And now **AppCode** is available!

- Generate document comments for Kotlin file.
- Just generate it as Java do.

[![JetBrains plugins](https://img.shields.io/jetbrains/plugin/v/9781-bugkotlindocument.svg?style=flat-square)](https://plugins.jetbrains.com/plugin/9781-bugkotlindocument)
[![JetBrains plugins](https://img.shields.io/jetbrains/plugin/d/9781-bugkotlindocument.svg?style=flat-square)](https://plugins.jetbrains.com/plugin/9781-bugkotlindocument)

Plugin for **IntelliJ IDEA** / **Android Studio** / **CLion**, and **AppCode** is available now!

- Generate document comments for Kotlin file.
- Just generate it as Java do.

# Usage

**Just press Enter key like in Java File !!!**
**Just press Enter key after `/**`, just like in Java File !!!**

![gif](images/pic01.gif)

# Screenshots
![png](images/pic02.png)

## AppCode and CLion support!
![png](images/pic04.png)
![png](images/pic04.png)

## Settings

Expand Down Expand Up @@ -53,4 +53,4 @@ A DevCpp-like cross-platform Kotlin IDE features in lightweight.
- [ice1000/julia-intellij](https://github.com/ice1000/julia-intellij)
Julia Plugin for IntelliJ IDEA
- [zxj5470/ktlext](https://github.com/zxj5470/ktlext)
A useless library for Kotlin extensions.
A **useless** library for Kotlin extensions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import com.intellij.notification.Notifications
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
import org.jetbrains.kotlin.psi.KtFile

class BugKtDocEditorTypedHandler : TypedHandlerDelegate() {
override fun charTyped(c: Char, project: Project, editor: Editor, file: PsiFile): Result {
if (file !is KtFile) return super.charTyped(c, project, editor, file)
// avoid NoClassDef if no Kotlin plugin
if (file.language.toString() != "Kotlin") return super.charTyped(c, project, editor, file)

if (isTheFirstTime && c == '*' && getCurrentLineToCurrentChar(editor).endsWith("/**")) {
Notifications.Bus.notify(Notification("com.github.zxj5470.bugktdoc.notification",
BugKtDocBundle.message("bugktdoc.notation.title"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ class BugKtDocumentationProvider : DocumentationProviderEx(), CodeDocumentationP

// @param
owner.valueParameters.forEach {
val param = it.nameIdentifier?.text
val type = it.itsType
val param = it.nameIdentifier?.text ?: ""
val type =
if (it.isVarArg) it.itsType
else it.text.substringAfter(param).substringBefore('=').trim(':', ' ')
appendDecorate(PARAM)
// add a space before `param` and after is no used
append("$param $type")
Expand Down
8 changes: 0 additions & 8 deletions src/main/kotlin/com/github/zxj5470/bugktdoc/util/dsl.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
package com.github.zxj5470.bugktdoc.util

fun StringBuilder.clear() = this.setLength(0)

fun String.log(tag: String = "") {
println("------$tag--------")
println(this)
println("--------------")
}

operator fun Boolean.invoke(block: () -> Unit): Boolean {
if (this) block()
return this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fun lambda(block: String.() -> Unit) {
*
* @param block [@kotlin.ExtensionFunctionType] Function1<Pair<String, Int>, Unit>
*/
fun lambda2(block: Pair<String, Int>.() -> Unit) {
fun lambda2(block: Pair<String, Int>.() -> Unit = {}) {

}

Expand Down

0 comments on commit 60c7062

Please sign in to comment.