arrow-meta icon indicating copy to clipboard operation
arrow-meta copied to clipboard

Feature Proposal for IntelliJ

Open pakoito opened this issue 5 years ago • 9 comments

This is a proposal issue for Ide features we might want to consider for Arrow.

Comment below for suggestions and Feedback.

pakoito avatar Dec 02 '18 22:12 pakoito

What would an Arrow plugin for IDEA provide in terms of features?

raulraja avatar Dec 02 '18 22:12 raulraja

I'm not sure. Some visualization for debugging, same as the one for Streams and Observables.

Code snippets and hints? Hoogle-like search?

pakoito avatar Dec 02 '18 22:12 pakoito

@pakoito If you have more idea's post them here !

i-walker avatar Oct 07 '19 15:10 i-walker

Ordered by complexity and implementation groups: Pithy actions:

  • [ ] Key bindings for HKT annotation

Code Actions/ Global or Local QuickFixes:

  • [ ] Transform function to use typeclasses + HKT
  • [ ] Convert IO to suspend and viceversa

Try-Arrow.kt integration for the IDE:

  • [ ] Copy snippet to try.arrow-kt
  • [ ] Load file/function into REPL
  • [ ] Copy last REPL input/result into file

Various Debug Features:

  • [ ] Evaluate operation under the mouse/selector in Debugger
  • [ ] Analyze operator chain and optimize (i.e. filter followed by map -> flatMap)

Type-driven search engine:

  • [ ] Hoogle-like search for type signatures, one proposal
  • [ ] Function suggestion, i.e. val a: IO<List<Int>> = myIOList.<-- postfix template/dropdown that looks up which functions can, in one step, generate something of the correct type

references:

  • https://github.com/cursive-ide/cursive/issues
  • https://hoogle.haskell.org/
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.
  • https://atom.io/packages/atom-pastebin-plus

pakoito avatar Oct 07 '19 20:10 pakoito

  • [ ] The Ank Idea Plugin

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:

  • Syntax-highlighting within Ank snippets
  • LanguageInjection, with TypeInference etc.
  • Navigation window for the Result
  • Extend the Navigation window for Typeclass Graphs

Props to @nomisRev idea :)

References: org.jetbrains.kotlin.idea.highlighter.KotlinRunLineMarkerContributor com.intellij.execution.lineMarker.RunLineMarkerProvider LanguageInjectionSyntax NavigationSyntax

i-walker avatar Oct 13 '19 02:10 i-walker

  • [ ] The IR Generator Idea Plugin

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 avatar Oct 16 '19 17:10 ahinchman1

@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. Screenshot 2019-11-21 at 12 58 23

i-walker avatar Nov 21 '19 11:11 i-walker

@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

ahinchman1 avatar Nov 22 '19 12:11 ahinchman1

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:

Screen Shot 2019-11-22 at 1 18 25 PM

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.

ahinchman1 avatar Nov 22 '19 12:11 ahinchman1