avh4 / avh4/elm-format

provide a way to maintain cursor locations across formats

Open
#149 2 comments 2 reactions 0 assignees View on GitHub
discussion feature for build tool authors
Dominant language
Haskell
Stars
1.3k
Forks
148
PR merge metrics
No merged PRs in 30d

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:

``` json
{ "cursors": [ [11,4], [107, 36] ], "content": "module ..." }
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing elm-format's existing --stdin command path and how it formats input. The proposed --cursor arguments and JSON response define the interface to investigate; done means cursor locations are transformed and the formatted content is returned in the specified JSON structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
elm, haskell
Domain
cli, developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.