durkiewicz / elm-plugin

Elm language support plugin for IntelliJ IDEA.
MIT License
136 stars 15 forks source link

Add structure view support #65

Closed klazuka closed 7 years ago

klazuka commented 7 years ago

This enables:

  1. The Structure tool window (cmd-7)
  2. The Structure popup (cmd-F12)
  3. ctrl-up/down navigation between structure elements in the main text editor
structure window

Changes

Questions

One thing I was unsure about is where to put the logic to decide whether an ElmValueDeclarationBase is a function or a value. It seems like it should live on the Psi element itself, but I don't fully understand how GrammarKit does mixins.

Another problematic thing is that my solution for determining whether an ElmValueDeclaration is a value or a function will be incorrect when the function is written in point-free style. We could mitigate this by searching the Psi tree for its type annotation, but that would only work when the user added a type annotation. Solving it for all cases would require that we do the type inference in the plugin (a big job). One option would be to avoid distinguishing between functions and values in the first place--but it seems like a useful distinction when trying to orient yourself in a file.

reitzig commented 6 years ago

@durkiewicz I see that this was merged a while ago, but it doesn't seem functional in IDEA yet. Is something broken or has structure view not yet been released?

klazuka commented 6 years ago

@reitzig it hasn't been released yet. As best I can tell, Kamil isn't using Elm much these days. I've been working on my own re-write of this plugin. It's not yet usable for daily use, but it's getting close. I hope to have something ready to release in December or January.

reitzig commented 6 years ago

@klazuka I may be tempted to have a look, if/when you put in on Github.

klazuka commented 6 years ago

@reitzig I've released my re-write of the plugin, and it includes support for Structure View. It's available now through the JetBrains plugin repository under the name "Elm". You will have to un-install the old plugin before installing the new one.