Skip to content
Merged
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
38 changes: 24 additions & 14 deletions src/fsharp/vs/service.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1359,20 +1359,30 @@ type TypeCheckInfo

// Not, this does not have to be a SyncOp, it can be called from any thread
member scope.GetExtraColorizations() =
[| for cnr in sResolutions.CapturedNameResolutions do
match cnr with
// 'seq' in 'seq { ... }' gets colored as keywords
| CNR(_, (Item.Value vref), ItemOccurence.Use, _, _, _, m) when valRefEq g g.seq_vref vref ->
yield (m, FSharpTokenColorKind.Keyword)
// custom builders, custom operations get colored as keywords
| CNR(_, (Item.CustomBuilder _ | Item.CustomOperation _), ItemOccurence.Use, _, _, _, m) ->
yield (m, FSharpTokenColorKind.Keyword)
// types get colored as types when they occur in syntactic types or custom attributes
// typevariables get colored as types when they occur in syntactic types custom builders, custom operations get colored as keywords
| CNR(_, (Item.TypeVar _ | Item.Types _ | Item.UnqualifiedType _) , (ItemOccurence.UseInType | ItemOccurence.UseInAttribute), _, _, _, m) ->
yield (m, FSharpTokenColorKind.TypeName)
| _ -> ()
|]
sResolutions.CapturedNameResolutions
|> Seq.choose (fun cnr ->
match cnr with
// 'seq' in 'seq { ... }' gets colored as keywords
| CNR(_, (Item.Value vref), ItemOccurence.Use, _, _, _, m) when valRefEq g g.seq_vref vref ->
Some (m, FSharpTokenColorKind.Keyword)
// custom builders, custom operations get colored as keywords
| CNR(_, (Item.CustomBuilder _ | Item.CustomOperation _), ItemOccurence.Use, _, _, _, m) ->
Some (m, FSharpTokenColorKind.Keyword)
// types get colored as types when they occur in syntactic types or custom attributes
// typevariables get colored as types when they occur in syntactic types custom builders, custom operations get colored as keywords
| CNR(_, ( Item.TypeVar _
| Item.Types _
| Item.UnqualifiedType _
| Item.CtorGroup _),
( ItemOccurence.UseInType
| ItemOccurence.UseInAttribute
| ItemOccurence.Use _
| ItemOccurence.Binding _
| ItemOccurence.Pattern _), _, _, _, m) ->
Some (m, FSharpTokenColorKind.TypeName)
| _ -> None)
|> Seq.toArray

member x.ScopeResolutions = sResolutions
member x.ScopeSymbolUses = sSymbolUses
member x.TcGlobals = g
Expand Down