arrow-kt / arrow-meta

Functional companion to Kotlin's Compiler
https://meta.arrow-kt.io
Apache License 2.0
396 stars 42 forks source link

Arrow Meta Text #131

Open i-walker opened 4 years ago

i-walker commented 4 years ago

As the Test's for the existing LM is about to be merged in #129, we may discuss what Text or GoTo actions we want to implement for Meta, wether Users click on the Icon, which then directs them on their default browser to Doc's and tutorials or display the Text.

Interestingly enough, LineMarkers have in most cases short messages. If we do want to present more such as we do in the PolyLineMarker or much more, I'll work on API's which opens up TextDisplays on the right-hand side with Content we want to communicate, similar to the Toolbar on the right-hand side for Gradle or the Markdown ide plugin. The same API could also be used for the AnkIdePlugin to render the Docs. cc @raulraja @franciscodr @nomisRev

raulraja commented 4 years ago

We need a table that looks like this for all plugins and involve several people to fill this in.

Plugin Action Icon Description Expanded Description
Purity Inspection [pic here] This function is impure... This function is impure..., Docs to IO, suspend, Fx etc
i-walker commented 4 years ago
Plugin Feature Icon Description Expanded Description
Comprehensions LineMarker arrow-meta-bind arrow-meta-bind.svg "Bind" -
Nothing LineMarker arrow-meta-nothing arrow-meta-nothing.svg "Bottom Type" -
HigherKinds LineMarker arrow-meta-higher arrow-meta-higher.svg ${class.name} is a Higher Kinded Type that may be used in polymorphic functions expressed over [Kind<F, A>] and with the type classes. For more info visit https://arrow-kt.io/docs/patterns/glossary/#type-constructors -
HigherKinds LineMarker arrow-meta-polymorphic arrow-meta-polymorphic.svg here is an example -
Purity Inspection arrow-meta-pure "Function should be suspended" -
Optics LineMarker arrow-meta-optics arrow-meta-optics.svg "Optics" -
i-walker commented 4 years ago

One proposal is to add a costume QuickDocumentProvider, where we can display the text. I'll link a small PR down below, on how it may look like.

This may clash with the existing KotlinQuickDocumentProvider, that does the same job you see down below for Kotlin. We would need to suppress it for special KtElements, but I haven't find API's who do that.

one example

If we solely care about the Text we would add it as a KDoc on the descriptor and facilitate the existing Kotlin implementation. Bare with me I am adding more suggestions as I discover them. Screenshot 2019-11-20 at 16 30 37

i-walker commented 4 years ago

Another way to present Text using Side Panels like the one we see with Kotlin Bytcode This is feature is a composition of AnActionand a ToolWindow.

Here Kotlin Bytecode is triggered through the Tools Panel and opens a Toolwindow on the left side.

Screenshot 2019-11-21 at 15 15 23 Screenshot 2019-11-21 at 14 56 39

it allows us to focus on the Content and how it is displayed rather than to create separate UI elements on top of Idea.

The advantage here is that we can move this Action to different places, e.g.: wrap it into a LineMarker and whenever a user clicks on it, it triggers the action. Toolwindows can be persistent as we see with Gradle.

Screenshot 2019-11-21 at 14 59 56

Example impl for Show Kotlin Bytecode is here

addAnAction(
        "ExampleEmptyToolWindow",
        anAction(
          icon = ArrowIcons.PURE,
          actionPerformed = {e ->
            /**
             * creates Toolwindow with [e]
             * set's the icon
             * ContentManager adds our Content
             * This Content can be composed of [EditorTextField], which is IntelliJ's promoted editor component with syntax highlighting support, code completion, code folding and more.
             */
          }
        )
      )
raulraja commented 4 years ago

Both approaches are things we can use for different purposes. What about embedded media like gifs or videos. Is that possible or does that require some other kind of panel?

i-walker commented 4 years ago

Gifs should be possible, but I can not confidently confirm whether videos are possible. There might be a workaround to do that.

raulraja commented 4 years ago

Can we have the above linked icons rendered on the markdown table to see what they look like?

i-walker commented 4 years ago

The editor defines it's UI with an initial wrapper, which holds it's Content.

We can use 4 existing UI wrappers/ templates from the editor:

Or start from scratch with our own workflows. This requires us to maintain the lifecycle of the wrapper in the application in addition to the Content.

The initial four elements wrap our Content in templates, where we can focus on the Content.

Regardless of a design choice, the UI is based on Swing Components wether for the Content or the wrapper. Interestingly enough, we could facilitate the existing wrapper, but still, have the freedom to define our own workflows in the Content element.

raulraja commented 4 years ago

I see on the table we are missing unions and type classes extensions. Also type proofs which even if not merged yet will be there by KC

i-walker commented 4 years ago

This PR provides drafts over the aforementioned UI wrappers https://github.com/arrow-kt/arrow-meta/pull/214