generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite the Tailwind classes replacement & imports replacement engine…
…s, update configs (#37)
- Loading branch information
1 parent
3cf8340
commit bb51d83
Showing
78 changed files
with
1,756 additions
and
393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/kotlin/com/github/warningimhack3r/intellijshadcnplugin/backend/helpers/PsiHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.github.warningimhack3r.intellijshadcnplugin.backend.helpers | ||
|
||
import com.intellij.openapi.application.runReadAction | ||
import com.intellij.openapi.command.WriteCommandAction | ||
import com.intellij.openapi.fileTypes.FileTypeManager | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.psi.PsiFile | ||
import com.intellij.psi.PsiFileFactory | ||
|
||
object PsiHelper { | ||
|
||
fun createPsiFile(project: Project, fileName: String, text: String): PsiFile { | ||
assert(fileName.contains('.')) { "File name must contain an extension" } | ||
return runReadAction { | ||
PsiFileFactory.getInstance(project).createFileFromText( | ||
fileName, FileTypeManager.getInstance().getFileTypeByExtension( | ||
fileName.substringAfterLast('.') | ||
), text | ||
) | ||
} | ||
} | ||
|
||
fun writeAction(file: PsiFile, description: String? = null, action: () -> Unit) { | ||
WriteCommandAction.runWriteCommandAction( | ||
file.project, description, | ||
"com.github.warningimhack3r.intellijshadcnplugin", | ||
action, file | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.