Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/groovymc/enhancedgroovy
An IntelliJ IDEA plugin for enhanced Groovy support
https://github.com/groovymc/enhancedgroovy
Last synced: about 19 hours ago
JSON representation
An IntelliJ IDEA plugin for enhanced Groovy support
- Host: GitHub
- URL: https://github.com/groovymc/enhancedgroovy
- Owner: GroovyMC
- License: mit
- Created: 2022-08-29T15:25:37.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2022-09-11T14:23:09.000Z (about 2 years ago)
- Last Synced: 2024-10-27T06:23:31.118Z (19 days ago)
- Language: Kotlin
- Size: 97.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
![Version](https://img.shields.io/jetbrains/plugin/v/com.matyrobbrt.enhancedgroovy)
![Downloads](https://img.shields.io/jetbrains/plugin/d/com.matyrobbrt.enhancedgroovy)# EnhancedGroovy
EnhancedGroovy is an IntelliJ plugin which allows Groovy annotations to add their fields to your IDE.
## Dev usage
First, add the DSL as a compileOnly dependency to the project adding the annotations and their transformer:
```groovy
repositories {
maven { url = 'https://maven.moddinginquisition.org/releases' }
}
dependencies {
compileOnly "com.matyrobbrt.enhancedgroovy:dsl:$dslVersion" // Each plugin version has its own dsl version with the same ID
}
```
Now, in order to add support for annotations, in your `resources` folder create a GroovyScript named `enhancedgroovy/_${annotationName}.groovy`,
where `annotationName` is the name of the annotation you're adding support to.
Example: given the annotation `testing.MyAnnotation`, the configuration script will be in `enhancedgroovy/_testing.MyAnnotation.groovy`.
You can ignore the package warning, adding this at the top of your script:
```groovy
//file:noinspection GrPackage
```
When found, the plugin will execute your script, by giving it the `transformer` as a `com.matyrobbrt.enhancedgroovy.dsl.ClassTransformer` and
the `annotation` in question as a `com.matyrobbrt.enhancedgroovy.dsl.members.Annotation`. Those properties can be accessed using the `this.`
syntax, and for better IDE support you may uselessly cast them to their respective types.
The example below will add a `private final java.lang.String testingField` field when applied to a class:
```groovy
import com.matyrobbrt.enhancedgroovy.dsl.ClassTransformerfinal transformer = ((ClassTransformer) this.transformer)
transformer.addField([
'name': 'testingField',
'type': 'java.lang.String',
'modifiers': ['private', 'final']
])
```