Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteab0815

Browse files
vasily-kirichenkoKevinRansom
authored andcommitted
highlight reference cells as mutables (dotnet#2470)
1 parent53d92fb commiteab0815

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

‎src/fsharp/vs/service.fs‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,8 @@ type TypeCheckInfo
14671467
// 'seq' in 'seq { ... }' gets colored as keywords
14681468
| CNR(_,(Item.Value vref), ItemOccurence.Use,_,_,_, m)when valRefEq g g.seq_vref vref->
14691469
Some(m, SemanticClassificationType.ComputationExpression)
1470+
| CNR(_,(Item.Value vref),_,_,_,_, m)when vref.IsMutable|| Tastops.isRefCellTy g vref.Type->
1471+
Some(m, SemanticClassificationType.MutableVar)
14701472
| CNR(_, Item.Value KeywordIntrinsicValue, ItemOccurence.Use,_,_,_, m)->
14711473
Some(m, SemanticClassificationType.IntrinsicFunction)
14721474
| CNR(_,(Item.Value vref),_,_,_,_, m)when isFunction g vref.Type->
@@ -1475,18 +1477,6 @@ type TypeCheckInfo
14751477
elifnot(IsOperatorName vref.DisplayName)then
14761478
Some(m, SemanticClassificationType.Function)
14771479
else None
1478-
| CNR(_,(Item.Value vref),_,_,_,_, m)when vref.IsMutable->
1479-
Some(m, SemanticClassificationType.MutableVar)
1480-
// todo here we should check if a `vref` is of type `ref`1`
1481-
// (the commented code does not work)
1482-
1483-
//| CNR(_, (Item.Value vref), _, _, _, _, m) ->
1484-
// match vref.TauType with
1485-
// | TType.TType_app(tref, _) -> // g.refcell_tcr_canon.t _refcell_tcr_canon canon.Deref.type vref ->
1486-
// if g.refcell_tcr_canon.Deref.Stamp = tref.Deref.Stamp then
1487-
// Some (m, SemanticClassificationType.MutableVar)
1488-
// else None
1489-
// | _ -> None
14901480
| CNR(_, Item.RecdField rfinfo,_,_,_,_, m)when rfinfo.RecdField.IsMutable&& rfinfo.LiteralValue.IsNone->
14911481
Some(m, SemanticClassificationType.MutableVar)
14921482
| CNR(_, Item.MethodGroup(_,_,_),_,_,_,_, m)->

‎vsintegration/src/FSharp.Editor/FSharp.Editor.resx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
<value>F# Functions / Methods</value>
146146
</data>
147147
<dataname="FSharpMutableVarsClassificationType"xml:space="preserve">
148-
<value>F# Mutable Variables</value>
148+
<value>F# Mutable Variables / Reference Cells</value>
149149
</data>
150150
<dataname="FSharpPrintfFormatClassificationType"xml:space="preserve">
151151
<value>F# Printf Format</value>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp