Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ jobs:

# Run Qodana inspections
- name: Qodana - Code Inspection
uses: JetBrains/qodana-action@v2025.1.1
uses: JetBrains/qodana-action@v2025.2
with:
cache-default-branch-only: true

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## [Unreleased]

### Added

- Compatibility with IntelliJ 2026.1

## [0.0.15] - 2025-12-27

### Added
Expand Down
56 changes: 56 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Build and verification

- `./gradlew build` — full build.
- `./gradlew check` — main local verification task used by the shared run configuration; runs tests and coverage checks.
- `./gradlew verifyPlugin` — JetBrains plugin verification against recommended IDE builds.
- `./gradlew runIde` — launch a development IDE with the plugin installed.
- `./gradlew runIdeForUiTests` — launch the IDE with the robot server enabled for UI tests.
- `./gradlew test --tests 'fully.qualified.TestName'` — run a single test class or method when tests exist.

## Project setup

- Gradle wrapper uses Gradle 9.2.1.
- Kotlin JVM toolchain is pinned to Java 21.
- The plugin targets IntelliJ Platform `2025.3` and depends on the Ruby plugin (`org.jetbrains.plugins.ruby`).
- Plugin versioning, target build range, Marketplace metadata, and platform dependency versions live in `gradle.properties`.

## Architecture

This is a small IntelliJ Platform plugin that adds RubyMine/RSpec PSI integrations for RSpec `let`-style declarations.

### Integration points

The plugin is wired through `src/main/resources/META-INF/plugin.xml`:

- a Ruby `psi.referenceContributor` registers references for potential `let` reads and overrides
- custom find-usages handler/provider and usage-type provider replace Ruby defaults for supported targets
- a `referencesSearch` extension makes rename/find-usages work from the root declaration
- custom `elementManipulator`, `renamePsiElementProcessor`, and `elementDescriptionProvider` make rename/navigation behave like a first-class language feature

### Core model

Most logic revolves around identifying RSpec symbol-defining calls (`let`, `let!`, and `subject`) and mapping Ruby PSI back to the defining `RCall`.

- `util/LetRCallPsiUtil.java` converts different PSI shapes (`RCall`, `RBlockCall`, `RSymbol`, `RIdentifier`, etc.) into the enclosing RSpec declaration call.
- `util/LetDeclarationPsiUtil.java` handles declaration names, matching, equivalence, and usage classification.
- `util/FindLetDeclarationsUtil.java` walks outward through nested RSpec example groups to find upstream declarations, overridden declarations, and the root declaration for a name.

That upstream-scope walk is the key behavior in this repo: nested example groups can shadow `let` declarations, so navigation and rename must distinguish between the nearest declaration and the root declaration.

### Feature flow

- `referencecontributor/*` attaches references directly to Ruby PSI nodes in RSpec files, separating read references from override references.
- `referencesearch/LetVariableReferencesSearch.java` limits searches to the containing file, searches by declaration name, then filters candidate occurrences back down to RSpector reference types.
- `findusages/*` customizes which elements support Find Usages and how they are labeled in the IDE.
- `refactoring/LetVariableRenameProcessor.java` redirects rename operations to the identifying symbol of the enclosing declaration and filters results to RSpector references only.

## Repository conventions

- Plugin description for Marketplace publishing is extracted from the `<!-- Plugin description -->` block in `README.md`; keep that block in sync with plugin capabilities.
- Changelog HTML for the plugin manifest is generated from `CHANGELOG.md` by the Gradle changelog plugin.
- There are currently shared IDE run configurations for `runIde`, `check`, and `verifyPlugin` under `.run/`.
- There are no committed tests under `src/test` right now, even though the build is configured for JUnit 4 and `check`/`test` tasks are available.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ pluginRepositoryUrl = https://github.com/srizzo/rspector-rubymine-plugin
pluginVersion = 0.0.15

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 252
pluginSinceBuild = 261

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformVersion = 2025.3
platformVersion = 2026.1

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
# Check latest Ruby versions: https://plugins.jetbrains.com/plugin/1293-ruby/versions
platformPlugins = org.jetbrains.plugins.ruby:253.29346.138
platformPlugins = org.jetbrains.plugins.ruby:261.22158.274
# Example: platformBundledPlugins = com.intellij.java
platformBundledPlugins =
# Example: platformBundledModules = intellij.spellchecker
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ opentest4j = "1.3.0"

# plugins
changelog = "2.5.0"
intelliJPlatform = "2.10.5"
intelliJPlatform = "2.13.1"
kotlin = "2.2.21"
kover = "0.9.3"
qodana = "2025.2.2"
qodana = "2025.2.1"

[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
Expand Down
Loading