As a Vim and Elm enthousiast, I'd like to improve the quality of the tools available for writing Elm in Vim. This repo is the home of my experiments.
- ElmJutsu
- Uses regexes.
- Elm Oracle
- Written in Elm
- Emacs Elm-Mode
- Generates tags
- Elm-Oracle is used for auto-completion
- Elm Light
- Uses its own AST
- Elm Reflection
- Vim Ctags
- Parser and AST
- Node
- Haskell
- Elm
- Vimscript
These are ordered in decreasing priority for me personally.
- Jump to file
- Requires file resolving
- Jump to definition
- Requires definition parsing
- Jump to documentation (optionally inline like a vim help file)
- Find usages
- Requires project crawling (use tool like ag or pt for finding candidates?)
- Fix case statements after expanding a union type
- Requires some type inference (if I'm casing on
foo.bar
, I need to be able to know the type ofbar
)
- Requires some type inference (if I'm casing on
- Add documentation comments to current module
- Autocompletion (based on types)
- Requires type inference
- Show type of variable
- Requires type inference
- Sort imports
- (Un)expose a declaration from a module
- Already did this once in Vimscript
Multiple options:
- Parse elm interface files
- Does this work for local (
let, in
) or unexported definitions? - Requires a recent compilation for best results.
- Probably faster though.
- Does this work for local (
- Selectively parse all definitions out of a file
foo = ...
,type Foo = A | B
,type alias Foo = ...
- ignore other constructs for speed, and to succeed even if the surrounding code is invalid.
- Fully qualify definitions:
foo
toMy.Module.foo
- Parse what's imported and exposed
- Determine the scope of a definition (exported, top level or
let, in
) - If easy, extract the full code of the definition unparsed for later analysis.
- Perhaps use a tool like ag or pt to create an initial pool of candidates?
- Given a fully quaifified definition
My.Module.foo
, any candidate file will always contain both the namespaceMy.Module
and the unqualified definitionfoo
.
- Given a fully quaifified definition
- Check if each candidate file actually exposes the definition.
- Do not forget module including definition itself.
- Let's start with looking at definitions