Skip to content

Commit ab36d80

Browse files
[Repo Assist] fix: re-enable ImplementInterface tests by trimming FCS trailing whitespace (#1505)
* fix: re-enable ImplementInterface tests by trimming FCS trailing whitespace FCS (since 43.7.200) emits trailing spaces on lines ending with '=' before a line break in generated interface stubs. This caused all ImplementInterface tests to fail, so the entire test suite was wrapped in ptestList (pending/skipped). Fix: post-process the generated stub from FormatInterface to trim trailing whitespace on each line. Re-enable tests: change ptestList to testList so the 40 previously- skipped tests now run and pass. Two remaining pending tests: - 'cursor position' sub-list (still uses the disabled without-type- annotation fix path, pending FCS #14698) - 'can implement setter when existing getter' (FCS 43.10.x does not detect inline getter 'member _.X with get () = val' as already implemented, causing both getter and setter to be regenerated; marked ptestCaseAsync pending investigation) Partially addresses #1054. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci: trigger checks --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 34304ee commit ab36d80

2 files changed

Lines changed: 415 additions & 334 deletions

File tree

src/FsAutoComplete/CodeFixes/ImplementInterface.fs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,13 @@ let fix (getParseResultsForFile: GetParseResultsForFile) (config: unit -> Config
299299
entity
300300
withTypeAnnotation
301301

302+
// FCS may emit trailing spaces on lines ending with `=` followed by a line break.
303+
// Trim each line's trailing whitespace to produce clean output.
304+
let stub =
305+
stub.Split('\n')
306+
|> Array.map (fun line -> line.TrimEnd([| ' '; '\t'; '\r' |]))
307+
|> String.concat "\n"
308+
302309
stub.TrimEnd(System.Environment.NewLine.ToCharArray())
303310

304311
{ Range = fcsPosToProtocolRange insertionData.InsertAt

0 commit comments

Comments
 (0)