Skip to content

Conversation

@ijklam
Copy link
Contributor

@ijklam ijklam commented Dec 7, 2025

Make semantic tokens with modifier can map more specifically.

F# grammar Sematic token Corresponding TextMate rule scope
Values
Value variable variable.other.readonly.fsharp
Literal variable.readonly variable.other.constant.fsharp
Mutable value variable.mutable entity.name.function.mutable_variable.fsharp
Disposible value variable.disposable entity.name.function.disposable_variable.fsharp
Property
Object property property variable.other.property.may_mutable.fsharp
Record field property.readonly variable.other.constant.property.fsharp
Mutable record field property.mutable entity.name.function.mutable_property.fsharp
Method
Extension method method.extension entity.name.function.extension_method.fsharp

Here I set methods to bold, and properties to bold + italic. Let's see some pictures.
Before:
image

With this and ionide/FsAutoComplete#1434
image

User can custom their own style in settings.json using editor.tokenColorCustomizations. For example

  "editor.tokenColorCustomizations": {
    "textMateRules": [
      {
        "scope": "entity.name.function.disposable_variable.fsharp",
        "settings": {
          "foreground": "#009688"
        }
      },
    ]
  }

We can get
image

Copy link
Member

@TheAngryByrd TheAngryByrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Thank you!

@TheAngryByrd TheAngryByrd merged commit 1d75010 into ionide:main Dec 7, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants