ionide / ionide/FsAutoComplete

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

Open
#480 1 comment 1 reaction 0 assignees View on GitHub
enhancement help wanted
Dominant language
F#
Stars
486
Forks
169
Avg merge
2d 8h
Merged PRs (30d)
5

Description

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:
```fsharp
type SomeRecord =
{Name: string
Quality: string
Quantity: int}
```
Great, now I go to instantiate it:
```fsharp
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:

```fsharp
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.