Skip to content

Commit

Permalink
0.9.3
Browse files Browse the repository at this point in the history
- Fix parsing of tsconfig.app.json
- Stop trying to remove /* */ comments
- Update Kotlin
Fixes #66
  • Loading branch information
WarningImHack3r committed Oct 23, 2024
1 parent 27e59f0 commit 29e4726
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@

## [Unreleased]

### Changed

- No longer try to remove `/* */` comments from the `tsconfig.json`/`jsconfig.json` files as they can break parsing (#66)

### Fixed

- [Vue] Fix parsing of `tsconfig.app.json` files (#66)

## [0.9.2] - 2024-09-24

### Added
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginGroup = com.github.warningimhack3r.intellijshadcnplugin
pluginName = intellij-shadcn-plugin
pluginRepositoryUrl = https://github.com/WarningImHack3r/intellij-shadcn-plugin
# SemVer format -> https://semver.org
pluginVersion = 0.9.2
pluginVersion = 0.9.3

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 223
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ serialization = "1.7.3"
# plugins
changelog = "2.2.1"
intellijPlatform = "2.1.0"
kotlin = "2.0.20"
kotlin = "2.0.21"
kover = "0.8.3"
qodana = "2024.2.3"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ abstract class Source<C : Config>(val project: Project, private val serializer:
protected fun parseTsConfig(config: String, fileName: String = "tsconfig.json"): JsonElement {
// Temporary workaround until kotlinx.serialization is upgraded
val cleanConfig = config
// Remove /* */ comments
.replace(Regex("/\\*.*?\\*/", RegexOption.DOT_MATCHES_ALL), "")
.split("\n").joinToString("\n") { line ->
// Remove // comments
line.substringBefore("//").trim()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ open class VueSource(project: Project) : Source<VueConfig>(project, VueConfig.se
val tsConfig = FileManager.getInstance(project).getFileContentsAtPath(tsConfigLocation)
?: throw NoSuchFileException("$tsConfigLocation not found")
val aliasPath = (resolvePath(tsConfig, tsConfigLocation) ?: if (config.typescript) {
resolvePath("tsconfig.app.json", "tsconfig.app.json")
val tsConfigAppLocation = "tsconfig.app.json"
val tsConfigApp = FileManager.getInstance(project).getFileContentsAtPath(tsConfigAppLocation)
?: throw NoSuchFileException("$tsConfigAppLocation not found")
resolvePath(tsConfigApp, tsConfigAppLocation)
} else null) ?: throw Exception("Cannot find alias $alias in $tsConfig")
return aliasPath.replace(Regex("^\\.+/"), "")
.replace(Regex("\\*$"), alias.substringAfter("/")).also {
Expand Down

0 comments on commit 29e4726

Please sign in to comment.