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

Commit7220094

Browse files
vasily-kirichenkoKevinRansom
authored andcommitted
filter out OptionalArgumentAttribute from type highlighting (dotnet#2148)
1 parent954a3e1 commit7220094

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

‎src/fsharp/vs/service.fs‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,19 @@ type TypeCheckInfo
14071407

14081408
// Not, this does not have to be a SyncOp, it can be called from any thread
14091409
memberscope.GetExtraColorizations()=
1410+
let(|LegitTypeOccurence|_|)=function
1411+
| ItemOccurence.UseInType
1412+
| ItemOccurence.UseInAttribute
1413+
| ItemOccurence.Use_
1414+
| ItemOccurence.Binding_
1415+
| ItemOccurence.Pattern_-> Some()
1416+
|_-> None
1417+
1418+
let inline(|OptionalArgumentAttribute|_|)ttype=
1419+
match ttypewith
1420+
| TType.TType_app(tref,_)when tref.Stamp= g.attrib_OptionalArgumentAttribute.TyconRef.Stamp-> Some()
1421+
|_-> None
1422+
14101423
sResolutions.CapturedNameResolutions
14111424
|> Seq.choose(fun cnr->
14121425
match cnrwith
@@ -1421,22 +1434,13 @@ type TypeCheckInfo
14211434
Some(m, FSharpTokenColorKind.Keyword)
14221435
// types get colored as types when they occur in syntactic types or custom attributes
14231436
// typevariables get colored as types when they occur in syntactic types custom builders, custom operations get colored as keywords
1424-
| CNR(_,( Item.TypeVar_
1425-
| Item.Types_
1426-
| Item.UnqualifiedType_
1427-
| Item.CtorGroup_),
1428-
( ItemOccurence.UseInType
1429-
| ItemOccurence.UseInAttribute
1430-
| ItemOccurence.Use_
1431-
| ItemOccurence.Binding_
1432-
| ItemOccurence.Pattern_),_,_,_, m)->
1437+
| CNR(_, Item.Types(_,[OptionalArgumentAttribute]), LegitTypeOccurence,_,_,_,_)-> None
1438+
| CNR(_, Item.CtorGroup(_,[MethInfo.FSMeth(_, OptionalArgumentAttribute,_,_)]), LegitTypeOccurence,_,_,_,_)-> None
1439+
| CNR(_, Item.Types_, LegitTypeOccurence,_,_,_, m)->
1440+
Some(m, FSharpTokenColorKind.TypeName)
1441+
| CNR(_,(Item.TypeVar_| Item.UnqualifiedType_| Item.CtorGroup_), LegitTypeOccurence,_,_,_, m)->
14331442
Some(m, FSharpTokenColorKind.TypeName)
1434-
| CNR(_, Item.ModuleOrNamespaces refs,
1435-
( ItemOccurence.UseInType
1436-
| ItemOccurence.UseInAttribute
1437-
| ItemOccurence.Use_
1438-
| ItemOccurence.Binding_
1439-
| ItemOccurence.Pattern_),_,_,_, m)when refs|> List.exists(fun x-> x.IsModule)->
1443+
| CNR(_, Item.ModuleOrNamespaces refs, LegitTypeOccurence,_,_,_, m)when refs|> List.exists(fun x-> x.IsModule)->
14401444
Some(m, FSharpTokenColorKind.TypeName)
14411445
|_-> None)
14421446
|> Seq.toArray

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp