FsAutoComplete icon indicating copy to clipboard operation
FsAutoComplete copied to clipboard

Discussion/Feature Request: expand the range of `textDocument/codeAction`

Open Gastove opened this issue 4 years ago • 0 comments

First: this is an amazing project, and I thank y'all for it. Especially LSP support; that has made my development life worlds better :D

I want to raise a point of ergonomics; if this has already been discussed somewhere I'm just not finding, I do apologize! I tried to be thorough in my search of history, but there's... a lot of history.

It goes like this. Say I've got this type:

type SomeRecord = 
    {Name: string
     Quality: string
     Quantity: int}

Great, now I go to instantiate it:

let aRecord = 
    {Name = "some name"
    }

At this point, a code action becomes available (if enabled); I can stub out the remaining fields on this struct. The thing is, this code action is only available at a single point: between the opening curly brace and the first letter of the first field name. I'll use | for point:

let aRecord = 
    {|Name = "some name"
    }

This is a little awkward. It's hard to notice, and one must stop filling out record fields and jump back to a precise point at the start of the record, then descend back in to replace the fields with real values.

I'd like to propose -- or at least, discuss -- a possible ergonomic enhancement to this. Would it be possible to mark the entire form with the code action? Fire the "stub out record" even from anywhere in the braces?

Likewise, the README says there's a code action for implementing FSLint suggestions, but I cannot figure out how to fire it. It strikes me that those rather apply to the whole document, from a code-action perspective. Maybe not?

In any case. Thanks for the wonderful project, the time, and the consideration.

Gastove avatar Oct 11 '19 22:10 Gastove