Kotlin / Kotlin/dataframe

IntelliJ plugin: "materialize compiler plugin DataFrame type" action

Open
#1,348 5 comments 0 reactions 2 assignees Claimed by @Jolanrensen View on GitHub
Compiler plugin enhancement IDEA Plugin
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

Let's say you have a function that reads a dataframe and performs some conversions on it:

```kt
fun getEnglishPenguins() /* : DataFrame */ =
DataFrame.read("").cast()
.rename { arter }.into("species")
.rename { � }.into("island")
.rename { n�bl�ngde_mm }.into("bill_length_mm")
.rename { n�bdybde_mm }.into("bill_depth_mm")
.rename { luffel�ngde_mm }.into("flipper_length_mm")
.rename { kropsmasse_g }.into("body_mass_g")
.rename { k�n }.into("sex")
.rename { m�ledato }.into("measurement_date")
```

So, imagine your inlay hint tells you you got a `DataFrame`. However, you want to define this type somewhere as a data schema (because you want to use it as input to a new function).
With an IntelliJ plugin, you could make it so that when hovering over this type (or when your cursor is at a variable of that type or touching a function call returning that type), a quick-fix could become available to "Create data schema interface/class".

What it would do:
- First, it would allow you to define in which scope to put it, like with the "extract to function" action.
- Then, when it is created with the information of the compiler plugin, it has the same name, so `DanishPenguins_123` and the result of the expression gets a `.cast()`
- Then a refactoring is started on the name of the interface, so the user can either rename it to something they want or press Enter to leave it like that.

So, for instance, the end-result could be:

```kt
@DataSchema
interface EngishPenguins {
val species: String?
val body_mass_g: Double?
val sex: String?
...
}

fun getEnglishPenguins() /* : DataFrame */ =
DataFrame.read("").cast()
...
.cast()
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.