提交 eab0815a 编写于 作者: V Vasily Kirichenko 提交者: Kevin Ransom (msft)

highlight reference cells as mutables (#2470)

上级 53d92fb9
......@@ -1467,6 +1467,8 @@ type TypeCheckInfo
// 'seq' in 'seq { ... }' gets colored as keywords
| CNR(_, (Item.Value vref), ItemOccurence.Use, _, _, _, m) when valRefEq g g.seq_vref vref ->
Some (m, SemanticClassificationType.ComputationExpression)
| CNR(_, (Item.Value vref), _, _, _, _, m) when vref.IsMutable || Tastops.isRefCellTy g vref.Type ->
Some (m, SemanticClassificationType.MutableVar)
| CNR(_, Item.Value KeywordIntrinsicValue, ItemOccurence.Use, _, _, _, m) ->
Some (m, SemanticClassificationType.IntrinsicFunction)
| CNR(_, (Item.Value vref), _, _, _, _, m) when isFunction g vref.Type ->
......@@ -1475,18 +1477,6 @@ type TypeCheckInfo
elif not (IsOperatorName vref.DisplayName) then
Some (m, SemanticClassificationType.Function)
else None
| CNR(_, (Item.Value vref), _, _, _, _, m) when vref.IsMutable ->
Some (m, SemanticClassificationType.MutableVar)
// todo here we should check if a `vref` is of type `ref`1`
// (the commented code does not work)
//| CNR(_, (Item.Value vref), _, _, _, _, m) ->
// match vref.TauType with
// | TType.TType_app(tref, _) -> // g.refcell_tcr_canon.t _refcell_tcr_canon canon.Deref.type vref ->
// if g.refcell_tcr_canon.Deref.Stamp = tref.Deref.Stamp then
// Some (m, SemanticClassificationType.MutableVar)
// else None
// | _ -> None
| CNR(_, Item.RecdField rfinfo, _, _, _, _, m) when rfinfo.RecdField.IsMutable && rfinfo.LiteralValue.IsNone ->
Some (m, SemanticClassificationType.MutableVar)
| CNR(_, Item.MethodGroup(_, _, _), _, _, _, _, m) ->
......
......@@ -145,7 +145,7 @@
<value>F# Functions / Methods</value>
</data>
<data name="FSharpMutableVarsClassificationType" xml:space="preserve">
<value>F# Mutable Variables</value>
<value>F# Mutable Variables / Reference Cells</value>
</data>
<data name="FSharpPrintfFormatClassificationType" xml:space="preserve">
<value>F# Printf Format</value>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册