Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/FsAutoComplete/LspHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -553,30 +553,31 @@ module ClassificationUtils =
(* custom modifiers *)
| Mutable = 0b100_0000_0000
| Disposable = 0b1000_0000_0000
| Extension = 0b1_0000_0000_0000


let map (t: SemanticClassificationType) : SemanticTokenTypes * SemanticTokenModifier list =
match t with
| SemanticClassificationType.Operator -> SemanticTokenTypes.Operator, []
| SemanticClassificationType.ReferenceType
| SemanticClassificationType.ConstructorForReferenceType -> SemanticTokenTypes.Class, []
| SemanticClassificationType.Type
| SemanticClassificationType.TypeDef
| SemanticClassificationType.ConstructorForReferenceType -> SemanticTokenTypes.Type, []
| SemanticClassificationType.TypeDef -> SemanticTokenTypes.Type, []
| SemanticClassificationType.ValueType
| SemanticClassificationType.ConstructorForValueType -> SemanticTokenTypes.Struct, []
| SemanticClassificationType.UnionCase
| SemanticClassificationType.UnionCaseField -> SemanticTokenTypes.EnumMember, []
| SemanticClassificationType.UnionCase -> SemanticTokenTypes.EnumMember, []
| SemanticClassificationType.UnionCaseField -> SemanticTokenTypes.Parameter, []
| SemanticClassificationType.Function
| SemanticClassificationType.Method
| SemanticClassificationType.ExtensionMethod -> SemanticTokenTypes.Function, []
| SemanticClassificationType.IntrinsicFunction -> SemanticTokenTypes.Function, []
| SemanticClassificationType.Method -> SemanticTokenTypes.Method, []
| SemanticClassificationType.ExtensionMethod -> SemanticTokenTypes.Method, [ SemanticTokenModifier.Extension ]
| SemanticClassificationType.Property -> SemanticTokenTypes.Property, []
| SemanticClassificationType.MutableVar
| SemanticClassificationType.MutableRecordField -> SemanticTokenTypes.Member, [ SemanticTokenModifier.Mutable ]
| SemanticClassificationType.MutableVar -> SemanticTokenTypes.Variable, [ SemanticTokenModifier.Mutable ]
| SemanticClassificationType.MutableRecordField -> SemanticTokenTypes.Property, [ SemanticTokenModifier.Mutable ]
| SemanticClassificationType.Module -> SemanticTokenTypes.Module, []
| SemanticClassificationType.Namespace -> SemanticTokenTypes.Namespace, []
| SemanticClassificationType.Printf -> SemanticTokenTypes.Regexp, []
| SemanticClassificationType.ComputationExpression -> SemanticTokenTypes.Cexpr, []
| SemanticClassificationType.IntrinsicFunction -> SemanticTokenTypes.Function, []
| SemanticClassificationType.Enumeration -> SemanticTokenTypes.Enum, []
| SemanticClassificationType.Interface -> SemanticTokenTypes.Interface, []
| SemanticClassificationType.TypeArgument -> SemanticTokenTypes.TypeParameter, []
Expand Down
4 changes: 2 additions & 2 deletions test/FsAutoComplete.Tests.Lsp/HighlightingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ let tests state =
"tests"
[ tokenIsOfType (0u, 29u) ClassificationUtils.SemanticTokenTypes.TypeParameter fullHighlights // the `^a` type parameter in the SRTP constraint
tokenIsOfType (0u, 44u) ClassificationUtils.SemanticTokenTypes.Member fullHighlights // the `PeePee` member in the SRTP constraint
tokenIsOfType (3u, 52u) ClassificationUtils.SemanticTokenTypes.Type fullHighlights // the `string` type annotation in the PooPoo srtp member
tokenIsOfType (3u, 52u) ClassificationUtils.SemanticTokenTypes.Class fullHighlights // the `string` type annotation in the PooPoo srtp member
tokenIsOfType (6u, 21u) ClassificationUtils.SemanticTokenTypes.EnumMember fullHighlights // the `PeePee` AP application in the `yeet` function definition
tokenIsOfType (9u, 10u) ClassificationUtils.SemanticTokenTypes.Type fullHighlights //the `SomeJson` type alias should be a type
tokenIsOfType (9u, 10u) ClassificationUtils.SemanticTokenTypes.Class fullHighlights //the `SomeJson` type alias should be a type
tokenIsOfType (15u, 2u) ClassificationUtils.SemanticTokenTypes.Module fullHighlights ] ] // tests that module coloration isn't overwritten by function coloration when a module function is used, so Foo in Foo.x should be module-colored