Skip to content

Commit

Permalink
Added registry entry for disabling custom expectation generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver committed Jun 7, 2022
1 parent 5ba2d22 commit 2975dbb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## [Unreleased]
### Added
- Added `uses->in` folder reference
- Added registry entry for disabling expectation file generation

### Changed
- Changed goto and completion contributor to reference provider
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pluginGroup = com.pestphp
pluginName = PEST PHP
pluginVersion = 1.7.0-EAP.2
pluginVersion = 1.7.0-EAP.3

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.components.Service
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.registry.Registry
import com.intellij.psi.PsiManager
import com.intellij.util.SlowOperations
import com.jetbrains.php.composer.lib.ComposerLibraryManager
Expand Down Expand Up @@ -47,6 +48,10 @@ class ExpectationFileService(val project: Project) {
}

fun generateFile(afterGenerationRunnable: () -> Unit) {
if (! Registry.`is`("pestphp.custom-expectations", true)) {
return
}

val generator = ExpectationGenerator()

// Add all methods to the generator
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@
<psi.referenceContributor
implementation="com.pestphp.pest.features.uses.UsesReferenceContributor"
/>
<registryKey defaultValue="true"
description="Whether custom expectation file generation should happen."
key="pestphp.custom-expectations"
/>
</extensions>

<projectListeners>
Expand Down

0 comments on commit 2975dbb

Please sign in to comment.