Skip to content

Signature files (.fsi) syntax highlighting for class definitions using verbose syntax doesn't work correctly #226

@vovatrykoz

Description

@vovatrykoz

Describe the bug

The syntax highlighting gets confused in the .fsi files and does not highlight the relevant keywords correctly. The textual description of the issues is provided below. There are also screenshots to help understand what the problem is, but it comes down to the following class definition form (verbose syntax):

type Example =
    class
        member Property: int with get, set
    end
  1. Auto properties are not highlighted correctly in the .fsi files. with get gets highlighted as if it is part of the type, while set is, for some reason, highlighted as Set<'T>. It is worth noting that the Set<'T> issue is also present in Visual Studio, so it is unclear if the issue is fixable (see screenshots)
  2. The end keyword is not highlighted the same way as the preceding class keyword
  3. When defining two or more types in the same .fsi files, the type keywords are not highlighted correctly after the first type keyword. Seemingly connected to issue no. 2, as this happens after the end keyword (see screenshots)

Steps to reproduce

  1. Create a simple F# project
  2. Create a .fsi file
  3. Define a class using the verbose syntax (class ... end )
  4. Define an auto property inside the class
  5. Define other types, classes, or records in the same file

Link to sample reproduction

Sample repo

Expected behaviour

  1. with get should not be highlighted as part of the type, and set should not reference Set<'T>
  2. The end keyword should be highlighted the same way as the preceding class keyword
  3. Each type declaration should be highlighted the same way

Screenshots

VS Code with Ionide:
Image

Visual Studio:
Image

The Set<'T> issue:

VS Code:
Image

Visual Studio:
Image

Machine infos

Tested on WIndows 11 with .NET 9.0 and on WSL with .NET 8.0. More specifically:

  • OS: [ Windows 11; WSL with Ubuntu 22.04 ]
  • .NET SDK version: [ 9.0.201; 8.0.115 ]
  • Ionide version: 7.25.7

Additional context

N/A

EDIT: several edits for better readability

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions