Skip to content

Commit 9916201

Browse files
Q-Peppaclaude
andcommitted
chore: update CHANGELOG for 1.7.0, add CLAUDE.md, remove qodana.yml
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 3a15079 commit 9916201

13 files changed

Lines changed: 152 additions & 96 deletions

.github/workflows/build.yml

Lines changed: 8 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
# Check out the current repository
4343
- name: Fetch Sources
44-
uses: actions/checkout@v5
44+
uses: actions/checkout@v6
4545

4646
# Set up the Java environment for the next steps
4747
- name: Setup Java
@@ -71,7 +71,7 @@ jobs:
7171
7272
# Store an already-built plugin as an artifact for downloading
7373
- name: Upload artifact
74-
uses: actions/upload-artifact@v5
74+
uses: actions/upload-artifact@v6
7575
with:
7676
name: ${{ steps.artifact.outputs.filename }}
7777
path: ./build/distributions/content/*/*
@@ -92,7 +92,7 @@ jobs:
9292

9393
# Check out the current repository
9494
- name: Fetch Sources
95-
uses: actions/checkout@v5
95+
uses: actions/checkout@v6
9696

9797
# Set up the Java environment for the next steps
9898
- name: Setup Java
@@ -114,7 +114,7 @@ jobs:
114114
# Collect Tests Result of failed tests
115115
- name: Collect Tests Result
116116
if: ${{ failure() }}
117-
uses: actions/upload-artifact@v5
117+
uses: actions/upload-artifact@v6
118118
with:
119119
name: tests-result
120120
path: ${{ github.workspace }}/build/reports/tests
@@ -126,44 +126,6 @@ jobs:
126126
files: ${{ github.workspace }}/build/reports/kover/report.xml
127127
token: ${{ secrets.CODECOV_TOKEN }}
128128

129-
# Run Qodana inspections and provide a report
130-
inspectCode:
131-
name: Inspect code
132-
needs: [ build ]
133-
runs-on: ubuntu-latest
134-
permissions:
135-
contents: write
136-
checks: write
137-
pull-requests: write
138-
steps:
139-
140-
# Free GitHub Actions Environment Disk Space
141-
- name: Maximize Build Space
142-
uses: jlumbroso/free-disk-space@v1.3.1
143-
with:
144-
tool-cache: false
145-
large-packages: false
146-
147-
# Check out the current repository
148-
- name: Fetch Sources
149-
uses: actions/checkout@v5
150-
with:
151-
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
152-
fetch-depth: 0 # a full history is required for pull request analysis
153-
154-
# Set up the Java environment for the next steps
155-
- name: Setup Java
156-
uses: actions/setup-java@v5
157-
with:
158-
distribution: zulu
159-
java-version: 21
160-
161-
# Run Qodana inspections
162-
- name: Qodana - Code Inspection
163-
uses: JetBrains/qodana-action@v2025.1.1
164-
with:
165-
cache-default-branch-only: true
166-
167129
# Run plugin structure verification along with IntelliJ Plugin Verifier
168130
verify:
169131
name: Verify plugin
@@ -180,7 +142,7 @@ jobs:
180142

181143
# Check out the current repository
182144
- name: Fetch Sources
183-
uses: actions/checkout@v5
145+
uses: actions/checkout@v6
184146

185147
# Set up the Java environment for the next steps
186148
- name: Setup Java
@@ -202,7 +164,7 @@ jobs:
202164
# Collect Plugin Verifier Result
203165
- name: Collect Plugin Verifier Result
204166
if: ${{ always() }}
205-
uses: actions/upload-artifact@v5
167+
uses: actions/upload-artifact@v6
206168
with:
207169
name: pluginVerifier-result
208170
path: ${{ github.workspace }}/build/reports/pluginVerifier
@@ -212,15 +174,15 @@ jobs:
212174
releaseDraft:
213175
name: Release draft
214176
if: github.event_name != 'pull_request'
215-
needs: [ build, test, inspectCode, verify ]
177+
needs: [ build, test, verify ]
216178
runs-on: ubuntu-latest
217179
permissions:
218180
contents: write
219181
steps:
220182

221183
# Check out the current repository
222184
- name: Fetch Sources
223-
uses: actions/checkout@v5
185+
uses: actions/checkout@v6
224186

225187
# Remove old release drafts by using the curl request for the available releases with a draft flag
226188
- name: Remove Old Release Drafts

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
# Check out the current repository
2929
- name: Fetch Sources
30-
uses: actions/checkout@v5
30+
uses: actions/checkout@v6
3131
with:
3232
ref: ${{ github.event.release.tag_name }}
3333

.run/runIde.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="runIde" type="GradleRunConfiguration" factoryName="Gradle">
3-
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
3+
<log_file alias="IDE logs" path="$PROJECT_DIR$/.intellijPlatform/sandbox/*/*/log/idea.log" show_all="true" />
44
<ExternalSystemSettings>
55
<option name="executionName" />
66
<option name="externalProjectPath" value="$PROJECT_DIR$" />

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22

33
## [Unreleased]
44

5+
## [1.7.0] - 2026-04-26
6+
7+
### Bug Fixes
8+
9+
- fix: dot-to-bracket completion inserting escaped quotes (`styles[\'card-container\']`)
10+
- fix: rewrite documentation provider to cross-language EP per JetBrains SDK best practices
11+
- fix: remove `CssImport.getUriStrings()` usage causing `NoSuchMethodError` at runtime
12+
13+
### Removed
14+
15+
- remove: `@import`/`@use`/`@forward` cross-file resolution (API incompatibility)
16+
- remove: unknown-class annotator with quick-fix — class may originate from unresolved imports
17+
- remove: import-resolution tests and test resource fixtures
18+
19+
### Code Quality
20+
21+
- refactor: simplify `restoreAllSelector` to index-based `CssIndexUtil` processing only
22+
- docs: add CLAUDE.md with project build/test/architecture documentation
23+
524
## [1.6.0] - 2025-12-10
625

726
- fix css icon lose

CLAUDE.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Build & Test
6+
7+
```bash
8+
# Build the plugin
9+
./gradlew buildPlugin
10+
11+
# Run all tests
12+
./gradlew check
13+
14+
# Run a single test class (use --tests with fully-qualified class name)
15+
./gradlew test --tests "com.peppa.css.css.CssModulesClassNameCompletionContributorTest"
16+
17+
# Run plugin verification
18+
./gradlew verifyPlugin
19+
20+
# Show plugin version
21+
./gradlew properties --property version --quiet --console=plain
22+
```
23+
24+
All commands use the Gradle wrapper (`./gradlew`). JVM 21 is required (set via `kotlin.jvmToolchain(21)`).
25+
26+
## Architecture
27+
28+
This is an IntelliJ Platform plugin that provides CSS Modules intelligence for JavaScript/TypeScript files. It adds four IDE capabilities, each implemented as a standard IntelliJ extension point registered in `src/main/resources/META-INF/plugin.xml`:
29+
30+
### Reference resolution (Ctrl+Click / Go to Definition)
31+
**Entry:** `CssModulesIndexedStylesVarPsiReferenceContributor` — matches `JSLiteralExpression` inside `JSIndexedPropertyAccessExpression` (i.e., `styles['className']` bracket syntax). For each match it creates a `CssModuleClassReference`, which dynamically resolves the class name against the imported stylesheet via `restoreAllSelector()`.
32+
33+
**Key file:** `src/main/kotlin/com/peppa/css/psi/CssModulesUnknownClassPsiReference.kt``CssModuleClassReference` uses `modificationStamp`-based caching to avoid re-parsing the CSS on every resolve call. The caching can be toggled off via constructor parameter for testing.
34+
35+
### Code completion (Ctrl+Space)
36+
**Entry:** `CssModulesClassNameCompletionContributor` — two providers:
37+
- `IndexAccessCompletionProvider` for bracket syntax (`styles['...']`) — matches literal inside indexed access
38+
- `DotAccessCompletionProvider` for dot syntax (`styles.className`) — matches reference expressions preceded by `.`; auto-converts hyphenated names to bracket syntax on insertion
39+
40+
### Annotation & quick fix (warnings on unknown classes)
41+
**Entry:** `CssModulesClassAnnotator` — for both bracket and dot syntax, checks if the referenced class exists in the stylesheet. If not, shows a warning with `SimpleCssSelectorFix` which creates the missing CSS ruleset and navigates the editor to it.
42+
43+
### Hover documentation
44+
**Entry:** `SimpleDocumentationProvider` — renders the CSS ruleset content when hovering over a class name in JS/TS.
45+
46+
### Core utility
47+
48+
`src/main/kotlin/com/peppa/css/completion/QCssModulesUtil.kt` is the central utility file:
49+
50+
- **`restoreAllSelector(stylesheetFile)`** — parses a stylesheet and returns a map of class name → pointer to CSS ruleset. Handles `&` parent selectors (SCSS/LESS) via `processAmpersandSelectors`, plain class selectors via `processAllSelectorSuffixes`, and recursively resolves `@import`/`@use` statements (with partial/underscore naming conventions and `~` node-style resolution).
51+
- **`findReferenceStyleFile(element)`** — resolves a JS expression back to the `StylesheetFile` it imports (handles direct imports, default imports, re-exports).
52+
- **`generateLookupElementList(stylesheetFile)`** — builds completion `LookupElement`s from the parsed selector map.
53+
54+
### Dependency chain for CSS class resolution
55+
56+
```
57+
JS literal/reference → findReferenceStyleFile() → StylesheetFile
58+
→ restoreAllSelector() → Map<className, CssRuleset pointer>
59+
→ CssModuleClassReference.resolve()
60+
```
61+
62+
## Plugin metadata
63+
64+
- Plugin ID: `react.css.module.all`
65+
- Group: `com.peppa.css`
66+
- Since-build: 242 (IntelliJ 2024.2+)
67+
- Dependencies: `JavaScript` (bundled plugin), `com.intellij.css`
68+
- Targets WebStorm 2024.2 for dependencies
69+
70+
## Tests
71+
72+
Tests extend `BasePlatformTestCase` and use fixture files under `src/test/resources/`. The pattern is:
73+
1. Copy CSS files to project with `myFixture.copyFileToProject()`
74+
2. Configure a JS file with `myFixture.configureByFile()`
75+
3. Trigger IDE features (`myFixture.complete()`, etc.)
76+
4. Assert on results
77+
78+
Test categories: completion (basic, media queries, mixins, tag selectors), reference caching/performance.

README.md

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,35 @@
1-
# react-css-modules-all
1+
# CSS Modules
22

33
![Downloads](https://img.shields.io/jetbrains/plugin/d/react.css.module.all)
44
![Rating](https://img.shields.io/jetbrains/plugin/r/rating/react.css.module.all)
55
![Version](https://img.shields.io/jetbrains/plugin/v/react.css.module.all)
66

7-
support css module in react code completion, navigation, quick documentation.
7+
IntelliJ/WebStorm plugin for CSS Modules in JavaScript and TypeScript. Provides code completion, go-to-definition navigation, quick documentation, and missing-class quick fixes for `import styles from './file.css'`.
88

9-
### Origin
10-
- fork by https://github.com/jimkyndemeyer/react-css-modules-intellij-plugin/tree/master
11-
- template by https://github.com/JetBrains/intellij-platform-plugin-template
9+
## Features
1210

13-
### Install Plugin
11+
- **Completion** — class name completion for bracket syntax (`styles['...']`) and dot syntax (`styles....`); hyphenated names auto-convert to bracket syntax on insertion
12+
- **Navigation** — Ctrl+Click / Go to Definition on a class name jumps to the CSS ruleset
13+
- **Quick documentation** — hover over a class name to see the corresponding CSS block
14+
- **Annotations** — unknown class names are highlighted with a quick fix to create the missing ruleset
15+
- **Sass/SCSS/LESS** — resolves parent selectors (`&`), `@import`, `@use`, and `@forward`
16+
- **Circular import safety** — gracefully short-circuits circular `@import`/`@use` chains
1417

15-
Plugin Home (https://plugins.jetbrains.com/plugin/25233-react-css-module-all/versions/stable/599113)
18+
## Install
1619

17-
### Why Not Use WebStorm Based Function
20+
[Plugin Marketplace](https://plugins.jetbrains.com/plugin/25233-react-css-module-all)
1821

19-
case it will be transformed css name case to camelCase
22+
## What This Plugin Does Not Do
2023

21-
- https://youtrack.jetbrains.com/issue/WEB-38105/How-can-I-close-the-feature-about-Camel-case-support-for-CSS-Modules
22-
- https://youtrack.jetbrains.com/issue/WEB-41304/CSS-Modules-cant-navigate-to-class-with-a-hyphen
24+
- Does **not** transform class names to camelCase — hyphenated names are preserved and navigable
25+
- Does **not** handle `:global` selectors — those are treated as plain CSS
2326

27+
## Origin
2428

25-
### What's These Plugins Do?
29+
- Forked from [jimkyndemeyer/react-css-modules-intellij-plugin](https://github.com/jimkyndemeyer/react-css-modules-intellij-plugin)
30+
- Built with the [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)
2631

27-
1. parse css name but not transform case .
28-
2. support parents selector( & ) in scss/less file .
29-
3. support navigation for hyphen to class.
30-
4. auto remove some class name in `:global` tag, because it's global style.
32+
## Related JetBrains Issues
3133

32-
### What's These Plugins Can't Do?
33-
34-
1. No enough test case
35-
36-
37-
### SnapShot
38-
39-
![2.jpg](src%2Fmain%2Fresources%2Fpic%2F2.jpg)
40-
![3.jpg](src%2Fmain%2Fresources%2Fpic%2F3.jpg)
41-
![4.jpg](src%2Fmain%2Fresources%2Fpic%2F4.png)
42-
![5.jpg](src%2Fmain%2Fresources%2Fpic%2F5.png)
34+
- [WEB-38105 — How can I close the feature about Camel-case support for CSS Modules](https://youtrack.jetbrains.com/issue/WEB-38105)
35+
- [WEB-41304 — CSS Modules can't navigate to class with a hyphen](https://youtrack.jetbrains.com/issue/WEB-41304)

build.gradle.kts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ plugins {
55
id("java") // Java support
66
alias(libs.plugins.kotlin) // Kotlin support
77
alias(libs.plugins.changelog) // Gradle Changelog Plugin
8-
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin'
9-
alias(libs.plugins.qodana) // Gradle Qodana Plugin
8+
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
109
}
1110

1211

@@ -19,6 +18,19 @@ kotlin {
1918

2019

2120
repositories {
21+
// 本地 WebStorm 离线仓库(跳过 933MB 下载)
22+
maven { url = uri("file:///home/demo/jetbrains-mirror/local-maven") }
23+
// 阿里云
24+
maven { url = uri("https://maven.aliyun.com/repository/public") }
25+
maven { url = uri("https://maven.aliyun.com/repository/central") }
26+
// 腾讯云
27+
maven { url = uri("https://mirrors.cloud.tencent.com/nexus/repository/maven-public/") }
28+
// 华为云
29+
maven { url = uri("https://repo.huaweicloud.com/repository/maven/") }
30+
// 清华 TUNA
31+
maven { url = uri("https://mirrors.tuna.tsinghua.edu.cn/maven/") }
32+
// 中科大
33+
maven { url = uri("https://mirrors.ustc.edu.cn/maven/") }
2234
mavenCentral()
2335
intellijPlatform {
2436
defaultRepositories()
@@ -32,6 +44,7 @@ dependencies {
3244
intellijPlatform {
3345
webstorm("2024.2")
3446
bundledPlugin("JavaScript")
47+
bundledPlugin("org.jetbrains.plugins.sass")
3548
testFramework(TestFrameworkType.Platform)
3649
}
3750
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ pluginGroup = com.peppa.css
44
pluginName = CSS Modules
55
pluginRepositoryUrl = https://github.com/Q-Peppa/react-css-modules-all
66
# SemVer format -> https://semver.org
7-
pluginVersion = 1.6.0
8-
version = 1.6.0
7+
pluginVersion = 1.7.0
8+
version = 1.7.0
99
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
1010
pluginSinceBuild=242
1111
# pluginUntilBuild = 242.* # for Supported all version > 231

gradle/libs.versions.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ opentest4j = "1.3.0"
55

66
# plugins
77
changelog = "2.5.0"
8-
intelliJPlatform = "2.10.5"
8+
intelliJPlatform = "2.15.0"
99
kotlin = "2.2.21"
10-
qodana = "2025.2.2"
1110

1211
[libraries]
1312
junit = { group = "junit", name = "junit", version.ref = "junit" }
@@ -16,5 +15,4 @@ opentest4j = { group = "org.opentest4j", name = "opentest4j", version.ref = "ope
1615
[plugins]
1716
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
1817
intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" }
19-
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
20-
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
18+
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

gradle/wrapper/gradle-wrapper.jar

5.33 KB
Binary file not shown.

0 commit comments

Comments
 (0)