ionide-vscode-fsharp icon indicating copy to clipboard operation
ionide-vscode-fsharp copied to clipboard

Broken syntax highlighting when splitting constructs over multiple lines

Open mattgallagher92 opened this issue 3 years ago • 2 comments

The bug

When splitting some F# code over multiple lines in a way that the F# compiler permits, Ionide syntax highlighting stops working correctly. It is particularly noticeable because syntax highlighting breaks throughout the entire file.

In particular, I'm facing issues when:

  1. Splitting a qualified function reference over two lines:

    Module
        .f
    

    rather than

    Module.f
    
  2. Splitting a record pattern-match in a function parameter over two lines:

    let f ({ X = x
             Y = y }) =
    

    rather than

    let f ({ X = x; Y = y }) =
    

Reproduction steps

  1. Clone https://github.com/mattgallagher92/fsharp-syntax-highlighting-bugs.git: git clone https://github.com/mattgallagher92/fsharp-syntax-highlighting-bugs.git
  2. Open the repo: cd fsharp-syntax-highlighting-bugs/
  3. Check out the initial commit: git checkout 44ee9c4f8aaf07cb5facc035581052b32c99e6fc
  4. Open the repo in VS Code: code .
  5. Open MultilinePatternMatch.fs and SplitModuleAndFunctionName.fs and inspect the contents
  6. Notice the syntax highlighting is broken as described in the comments
  7. Close VS Code
  8. Remove generated files: git clean -d -f
  9. Check out the next commit: git checkout e074b183a43513f434ee3f652a711d0ed06d9821
  10. Open the repo in VS Code: code .
  11. Open MultilinePatternMatch.fs and SplitModuleAndFunctionName.fs and inspect the contents
  12. Notice the syntax highlighting works correctly

Expected behaviour

I expected syntax highlighting in the entire file to work when these constructs are split across multiple lines, in the same way that it works when the constructs are on one line.

Screenshots

Qualified function over two lines

1

Qualified function on one line

1b

Pattern match over two lines

2

Pattern match on one line

2b

Environment

  • OS: Windows 10 Pro version 2004
  • Ionide version: 4.17.0
  • VSCode version: 1.49.1
  • dotnet SDK version: 3.1.201
  • mono / .Net Framework version: n/a

mattgallagher92 avatar Sep 27 '20 09:09 mattgallagher92

Hey @mattgallagher92 :wave:,

Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our OpenCollective and consider backing us.

https://opencollective.com/ionide

PS.: We offer backer support for all backers. Don't forget to add backer label when you start backing us :smile:

It didn't fit into the nice concise bug report template you gave, but I just want to take the chance to note how awesome this VS Code extension is! The reason I'm raising the bug report is that writing F# with Ionide's lovely syntax highlighting is so much better 😊

mattgallagher92 avatar Sep 27 '20 09:09 mattgallagher92