-
Notifications
You must be signed in to change notification settings - Fork 148
Open
Description
When an IDE plugin runs elm-format, it ideally wants to maintain the cursor and scroll position of the buffer. The plugin could perform some kind of estimation of where the cursor and scroll should be placed after the file is formatted, but it would be more appropriate for elm-format to calculate how cursor locations in the input correspond to cursor locations in the output.
Here is a possible API:
- a command line argument is added allowing plugins to provide buffer locations
- when given buffer locations to transform, elm-format will produce JSON containing the transformed locations
elm-format --cursor 10,4 --cursor 104,32 --stdin
output:
{ "cursors": [ [11,4], [107, 36] ], "content": "module ..." }
benjick and rundis