Open pakoito opened 5 years ago
What would an Arrow plugin for IDEA provide in terms of features?
I'm not sure. Some visualization for debugging, same as the one for Streams and Observables.
Code snippets and hints? Hoogle-like search?
@pakoito If you have more idea's post them here !
Ordered by complexity and implementation groups: Pithy actions:
Code Actions/ Global or Local QuickFixes:
Try-Arrow.kt integration for the IDE:
Various Debug Features:
Type-driven search engine:
val a: IO<List<Int>> = myIOList.
<-- postfix template/dropdown that looks up which functions can, in one step, generate something of the correct typereferences:
The latter is not a plugin, more like a search engine.
The whole project is building a type-directed search engine.
And then uses a fast lookup algorithm like [A*](https://en.wikipedia.org/wiki/A*_search_algorithm) that can tell what’s the shortest way of getting from current shape to target shape.
The Ank idea plugin runs Ank snippets and can be executed by a RunLineMarker as we know them for Tests and Main Methods. Interestingly, enough we can simplify creating a RunLineMarker to creating an Action, which runs the Snippet and displays the output in a window.
The aforementioned plugin should facilitate these features:
Props to @nomisRev idea :)
References:
org.jetbrains.kotlin.idea.highlighter.KotlinRunLineMarkerContributor
com.intellij.execution.lineMarker.RunLineMarkerProvider
LanguageInjectionSyntax
NavigationSyntax
We're currently unable to see IR generated directly with the Kotlin compiler. The only evidence we have of what that generated IR looks like is through the Kotlin text files in Github via kotlin/compiler/testData/ir/irText, where there are sample Kotlin files written accompanied by the generated text files.
We're working with IR a little blind - it'd be nice to have an IDE plugin for generating IR text on the spot.
Example: equality.kt
fun test1(a: Int, b: Int) = a == b
equality.txt
FILE fqName:<root> fileName:/equality.kt
FUN name:test1 visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.Boolean
VALUE_PARAMETER name:a index:0 type:kotlin.Int
VALUE_PARAMETER name:b index:1 type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test1 (a: kotlin.Int, b: kotlin.Int): kotlin.Boolean declared in <root>'
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'a: kotlin.Int declared in <root>.test1' type=kotlin.Int origin=null
arg1: GET_VAR 'b: kotlin.Int declared in <root>.test1' type=kotlin.Int origin=null
FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.Boolean
VALUE_PARAMETER name:a index:0 type:kotlin.Int
VALUE_PARAMETER name:b index:1 type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test2 (a: kotlin.Int, b: kotlin.Int): kotlin.Boolean declared in <root>'
CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_VAR 'a: kotlin.Int declared in <root>.test2' type=kotlin.Int origin=null
arg1: GET_VAR 'b: kotlin.Int declared in <root>.test2' type=kotlin.Int origin=null
@ahinchman1 there is already an IR Generator within the functionality of the Decompile to Kotlin Bytecode
Action.
Please, correct me if that is not what you were proposing.
@i-walker yes, I found out mine is just not working hahah - I'm sure I can figure out what's wrong with it eventually
Some validation received on an idea I had after giving an internal talk on AST parsing:
It would be amazing to write an IDE plugin that displays an actual tree for AST parsing unlike the PSIViewer. It's better than nothing but one day it would be amazing to see trees that look closer to this:
There is an existing AST viewer I'd like to take inspiration from as well, but it exists only on Eclipse as a plugin and only for Java: https://www.eclipse.org/jdt/ui/astview/index.php but it would still be nice to have a more visual item that at least displays a tree vertically like the drawing above.
This is a proposal issue for Ide features we might want to consider for Arrow.
Comment below for suggestions and Feedback.