fsprojects / fsprojects/FSharpLint

Quickfix for adding >> changing to much

Open
#261 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
F#
Stars
327
Forks
74
PR merge metrics
No merged PRs in 30d

Description

Reported by @ovatsus in https://github.com/ionide/ionide-vscode-fsharp/issues/738

Ionide-fsharp 3.17.3

If I have some code like this:

let array = [| "A"; "B"; "C"|]

let foo (s: string) = s

let bar = 
    array
    |> Array.map (sprintf "something %s")
    |> Array.map foo

There's a quick fix suggestion that turns it into this:

let bar = 
    Array.map ((sprintf "something %s") >> foo) array

However I think the correct fix should be to this to keep the existing style

let bar = 
    array
    |> Array.map ((sprintf "something %s") >> foo)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the quick-fix on the F# pipeline example from this issue and trace the quick-fix entry point that rewrites the chained Array.map calls. Done means the fix preserves the existing pipeline style while composing the two mappings as shown in the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.