Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug #83 #95

Merged
merged 2 commits into from
Dec 24, 2018
Merged

Fix bug #83 #95

merged 2 commits into from
Dec 24, 2018

Conversation

wuseal
Copy link
Owner

@wuseal wuseal commented Dec 23, 2018

(cherry picked from commit 79b22d7)

(cherry picked from commit 79b22d7)
@wuseal wuseal self-assigned this Dec 23, 2018
Copy link
Collaborator

@kezhenxu94 kezhenxu94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job and I've added minor comment

@@ -16,6 +16,7 @@ import wu.seal.jsontokotlin.feedback.sendActionInfo
import wu.seal.jsontokotlin.ui.JsonInputDialog
import wu.seal.jsontokotlin.utils.ClassCodeFilter
import wu.seal.jsontokotlin.utils.executeCouldRollBackAction
import java.awt.SystemColor.text
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import

@@ -144,6 +145,23 @@ class MakeKotlinClassAction : AnAction("MakeKotlinClass") {
if (offset == 0) {
offset = document.textLength
}
val lastPackageKeywordLineEndIndex = try {
"^[\\s]*package.+\n$".toRegex(RegexOption.MULTILINE).findAll(document.text).last().range.endInclusive
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a space after package in the regex in case that other statement starts with package? i.e. "^\\s*package\\s+.+\n$"

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right.

-1
}
val lastImportKeywordLineEndIndex = try {
"^[\\s]*import.+\n$".toRegex(RegexOption.MULTILINE).findAll(document.text).last().range.endInclusive
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here with import, "^\\s*import\\s+.+\n$"

add space into  regex for  `package and import declaration` matcher
@kezhenxu94 kezhenxu94 merged commit 1650628 into master Dec 24, 2018
@wuseal wuseal deleted the fix/issue/83 branch January 19, 2019 07:39
wuseal pushed a commit that referenced this pull request Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants