File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
src/main/kotlin/wu/seal/jsontokotlin Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -79,12 +79,12 @@ object ImportClassWriter : IImportClassWriter {
7979 if (importClassLineString !in text) {
8080
8181 val packageIndex = try {
82- " ^[\\ s]*package" .toRegex(RegexOption .MULTILINE ).find(text)!! .range.endInclusive
82+ " ^[\\ s]*package\\ s.+ \n $ " .toRegex(RegexOption .MULTILINE ).find(text)!! .range.endInclusive
8383 } catch (e: Exception ) {
8484 - 1
8585 }
8686 val lastImportKeywordIndex = try {
87- " ^[\\ s]*import" .toRegex(RegexOption .MULTILINE ).findAll(text).last().range.endInclusive
87+ " ^[\\ s]*import\\ s.+ \n $ " .toRegex(RegexOption .MULTILINE ).findAll(text).last().range.endInclusive
8888 } catch (e: Exception ) {
8989 - 1
9090 }
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ import wu.seal.jsontokotlin.feedback.sendActionInfo
1616import wu.seal.jsontokotlin.ui.JsonInputDialog
1717import wu.seal.jsontokotlin.utils.ClassCodeFilter
1818import wu.seal.jsontokotlin.utils.executeCouldRollBackAction
19- import java.awt.SystemColor.text
2019import java.net.URL
2120import java.util.*
2221
@@ -146,12 +145,12 @@ class MakeKotlinClassAction : AnAction("MakeKotlinClass") {
146145 offset = document.textLength
147146 }
148147 val lastPackageKeywordLineEndIndex = try {
149- " ^[\\ s]*package.+\n $" .toRegex(RegexOption .MULTILINE ).findAll(document.text).last().range.endInclusive
148+ " ^[\\ s]*package\\ s .+\n $" .toRegex(RegexOption .MULTILINE ).findAll(document.text).last().range.endInclusive
150149 } catch (e: Exception ) {
151150 - 1
152151 }
153152 val lastImportKeywordLineEndIndex = try {
154- " ^[\\ s]*import.+\n $" .toRegex(RegexOption .MULTILINE ).findAll(document.text).last().range.endInclusive
153+ " ^[\\ s]*import\\ s .+\n $" .toRegex(RegexOption .MULTILINE ).findAll(document.text).last().range.endInclusive
155154 } catch (e: Exception ) {
156155 - 1
157156 }
You can’t perform that action at this time.
0 commit comments