Skip to content

FCS 43.7.200 has odd behavior for modules with errors #14757

@baronfel

Description

@baronfel

While updating FsAutoComplete to support F# 7 I found that something fundamental has changed in the way at least anonymous modules are parsed in the presence of errors. This leads to a large number of parse-tree-based helper methods for powering codefixes no longer functioning, and so many of the tests FSAC has validating codefix behavior are now permanently broken. For the codefixes I've directly investigated that have parallels in the VS tooling in this repo, I saw the same behavior using a VS 17.5 preview (to ensure I was on a similar FCS). Let's dig into one CodeFix in particular - the one that converts erroring single-quote string interpolation into triple-quoted interpolation.

Repro steps

Provide the steps required to reproduce the problem:

  1. Load up an .fsx file with the following content: let a = $":^) {if true then "y" else "n"} d"
  2. Note that a diagnostic 3373 is triggered at the " next to the y.
  3. Attempt to fire a codefix - none is found.
  4. The code that should trigger the codefix is TryRangeOfStringInterpolationContainingPos
  5. TryRangeOfStringInterpolationContainingPos isn't finding an interpolated string expression, why?
  6. There are no decls in the SynModuleOrNamespace:
    image

This is the case for many other codefixes, and they present the same way in VS as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions