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

Commit331dde6

Browse files
vasily-kirichenkoKevinRansom
authored andcommitted
proper structs and interfaces colorization in editor (dotnet#2421)
1 parent6efa3b3 commit331dde6

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

‎src/fsharp/vs/service.fs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ type SemanticClassificationType =
500500
| ComputationExpression
501501
| IntrinsicType
502502
| Enumeration
503+
| Interface
503504

504505
// A scope represents everything we get back from the typecheck of a file.
505506
// It acts like an in-memory database about the file.
@@ -1487,6 +1488,10 @@ type TypeCheckInfo
14871488
// typevariables get colored as types when they occur in syntactic types custom builders, custom operations get colored as keywords
14881489
| CNR(_, Item.Types(_,[OptionalArgumentAttribute]), LegitTypeOccurence,_,_,_,_)-> None
14891490
| CNR(_, Item.CtorGroup(_,[MethInfo.FSMeth(_, OptionalArgumentAttribute,_,_)]), LegitTypeOccurence,_,_,_,_)-> None
1491+
| CNR(_, Item.Types(_, types), LegitTypeOccurence,_,_,_, m)when types|> List.exists(isInterfaceTy g)->
1492+
Some(m, SemanticClassificationType.Interface)
1493+
| CNR(_, Item.Types(_, types), LegitTypeOccurence,_,_,_, m)when types|> List.exists(isStructTy g)->
1494+
Some(m, SemanticClassificationType.ValueType)
14901495
| CNR(_, Item.Types_, LegitTypeOccurence,_,_,_, m)->
14911496
Some(m, SemanticClassificationType.ReferenceType)
14921497
| CNR(_,(Item.TypeVar_| Item.UnqualifiedType_| Item.CtorGroup_), LegitTypeOccurence,_,_,_, m)->

‎src/fsharp/vs/service.fsi‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ type internal SemanticClassificationType =
161161
| ComputationExpression
162162
| IntrinsicType
163163
| Enumeration
164+
| Interface
164165

165166
/// A handle to the results of CheckFileInProject.
166167
[<Sealed>]

‎vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ module internal FSharpClassificationTypes =
2424
let [<Literal>]Keyword= ClassificationTypeNames.Keyword
2525
let [<Literal>]Enum= ClassificationTypeNames.EnumName
2626
let [<Literal>]Property="FSharp.Property"
27+
let [<Literal>]Interface= ClassificationTypeNames.InterfaceName
2728

2829
letgetClassificationTypeName=function
29-
| SemanticClassificationType.ReferenceType
30+
| SemanticClassificationType.ReferenceType-> ReferenceType
3031
| SemanticClassificationType.Module-> Module
3132
| SemanticClassificationType.ValueType-> ValueType
3233
| SemanticClassificationType.Function-> Function
@@ -37,6 +38,7 @@ module internal FSharpClassificationTypes =
3738
| SemanticClassificationType.UnionCase
3839
| SemanticClassificationType.Enumeration-> Enum
3940
| SemanticClassificationType.Property-> Property
41+
| SemanticClassificationType.Interface-> Interface
4042

4143
moduleinternalClassificationDefinitions=
4244
[<Export; Name(FSharpClassificationTypes.Function); BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)>]

‎vsintegration/src/FSharp.Editor/Classification/ColorizationService.fs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type internal FSharpColorizationService
2424
checkerProvider: FSharpCheckerProvider,
2525
projectInfoManager: ProjectInfoManager
2626
)=
27+
2728
interface IEditorClassificationServicewith
2829
// Do not perform classification if we don't have project options (#defines matter)
2930
memberthis.AddLexicalClassifications(_:SourceText,_:TextSpan,_:List<ClassifiedSpan>,_:CancellationToken)=()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp