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

Commitdd710a0

Browse files
do not highlight any types as keywords
highlight a number of intrinsic functions as keywords
1 parentc693d8c commitdd710a0

File tree

8 files changed

+18
-49
lines changed

8 files changed

+18
-49
lines changed

‎src/fsharp/TastOps.fs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2505,8 +2505,7 @@ let fullNameOfEntityRef nmF xref =
25052505
| Some pathText-> pathText+.+ nmF xref
25062506

25072507
lettagEntityRefName(xref:EntityRef)name=
2508-
if Set.contains name Lexhelp.Keywords.keywordTypesthen tagKeyword name
2509-
elif xref.IsNamespacethen tagNamespace name
2508+
if xref.IsNamespacethen tagNamespace name
25102509
elif xref.IsModulethen tagModule name
25112510
elif xref.IsTypeAbbrevthen tagAlias name
25122511
elif xref.IsFSharpDelegateTyconthen tagDelegate name

‎src/fsharp/lexhelp.fs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,6 @@ module Keywords =
298298
letkeywordNames=
299299
keywordList|> List.map(fun(_,w,_)-> w)
300300

301-
letkeywordTypes= StructuredFormat.TaggedTextOps.keywordTypes
302-
303301
letkeywordTable=
304302
lettab= System.Collections.Generic.Dictionary<string,token>(100)
305303
for_,keyword,tokenin keywordListdo

‎src/fsharp/lexhelp.fsi‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,5 @@ module Keywords =
7070
valQuoteIdentifierIfNeeded:string->string
7171
valNormalizeIdentifierBackticks:string->string
7272
valkeywordNames:string list
73-
valkeywordTypes:Set<string>
7473
/// Keywords paired with their descriptions. Used in completion and quick info.
7574
valkeywordsWithDescription:(string* string)list

‎src/fsharp/vs/service.fs‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ type SemanticClassificationType =
498498
| Module
499499
| Printf
500500
| ComputationExpression
501-
|IntrinsicType
501+
|IntrinsicFunction
502502
| Enumeration
503503
| Interface
504504
| TypeArgument
@@ -1139,9 +1139,6 @@ type TypeCheckInfo
11391139
else
11401140
items
11411141

1142-
1143-
static letkeywordTypes= Lexhelp.Keywords.keywordTypes
1144-
11451142
memberx.IsRelativeNameResolvable(cursorPos:pos,plid:string list,item:Item):bool=
11461143
/// Determines if a long ident is resolvable at a specific point.
11471144
ErrorScope.Protect
@@ -1442,6 +1439,13 @@ type TypeCheckInfo
14421439
| TType.TType_app(tref,_)when tref.Stamp= g.attrib_OptionalArgumentAttribute.TyconRef.Stamp-> Some()
14431440
|_-> None
14441441

1442+
let(|KeywordIntrinsicValue|_|)(vref:ValRef)=
1443+
if valRefEq g g.raise_vref vref||
1444+
valRefEq g g.reraise_vref vref||
1445+
valRefEq g g.typeof_vref vref||
1446+
valRefEq g g.typedefof_vref vrefthen Some()
1447+
else None
1448+
14451449
letresolutions=
14461450
match rangewith
14471451
| Some range->
@@ -1456,7 +1460,8 @@ type TypeCheckInfo
14561460
// 'seq' in 'seq { ... }' gets colored as keywords
14571461
| CNR(_,(Item.Value vref), ItemOccurence.Use,_,_,_, m)when valRefEq g g.seq_vref vref->
14581462
Some(m, SemanticClassificationType.ComputationExpression)
1459-
1463+
| CNR(_, Item.Value KeywordIntrinsicValue, ItemOccurence.Use,_,_,_, m)->
1464+
Some(m, SemanticClassificationType.IntrinsicFunction)
14601465
| CNR(_,(Item.Value vref),_,_,_,_, m)when isFunction g vref.Type->
14611466
if vref.IsPropertyGetterMethod|| vref.IsPropertySetterMethodthen
14621467
Some(m, SemanticClassificationType.Property)
@@ -1482,9 +1487,6 @@ type TypeCheckInfo
14821487
// custom builders, custom operations get colored as keywords
14831488
| CNR(_,(Item.CustomBuilder_| Item.CustomOperation_), ItemOccurence.Use,_,_,_, m)->
14841489
Some(m, SemanticClassificationType.ComputationExpression)
1485-
// well known type aliases get colored as keywords
1486-
| CNR(_,(Item.Types(n,_)),_,_,_,_, m)when keywordTypes.Contains(n)->
1487-
Some(m, SemanticClassificationType.IntrinsicType)
14881490
// types get colored as types when they occur in syntactic types or custom attributes
14891491
// typevariables get colored as types when they occur in syntactic types custom builders, custom operations get colored as keywords
14901492
| CNR(_, Item.Types(_,[OptionalArgumentAttribute]), LegitTypeOccurence,_,_,_,_)-> None

‎src/fsharp/vs/service.fsi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ type internal SemanticClassificationType =
159159
| Module
160160
| Printf
161161
| ComputationExpression
162-
|IntrinsicType
162+
|IntrinsicFunction
163163
| Enumeration
164164
| Interface
165165
| TypeArgument

‎src/utils/sformat.fs‎

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -194,37 +194,8 @@ namespace Microsoft.FSharp.Text.StructuredFormat
194194
moduleTaggedTextOps=
195195
#endif
196196
lettagAlias= TaggedText.Alias
197-
letkeywordTypes=
198-
[
199-
"array";
200-
"bigint";
201-
"bool";
202-
"byref";
203-
"byte";
204-
"char";
205-
"decimal";
206-
"double";
207-
"float";
208-
"float32";
209-
"int";
210-
"int16";
211-
"int32";
212-
"int64";
213-
"list";
214-
"nativeint";
215-
"obj";
216-
"sbyte";
217-
"seq";
218-
"single";
219-
"string";
220-
"unit";
221-
"uint";
222-
"uint16";
223-
"uint32";
224-
"uint64";
225-
"unativeint";
226-
]|> Set.ofList
227-
lettagClass name=if Set.contains name keywordTypesthen TaggedText.Keyword nameelse TaggedText.Class name
197+
letkeywordFunctions= set["raise";"reraise";"typeof";"typedefof"]
198+
lettagClass= TaggedText.Class
228199
lettagUnionCase= TaggedText.UnionCase
229200
lettagDelegate= TaggedText.Delegate
230201
lettagEnum= TaggedText.Enum
@@ -238,15 +209,15 @@ namespace Microsoft.FSharp.Text.StructuredFormat
238209
lettagRecordField= TaggedText.RecordField
239210
lettagMethod= TaggedText.Method
240211
lettagModule= TaggedText.Module
241-
lettagModuleBinding=TaggedText.ModuleBinding
212+
lettagModuleBindingname=if keywordFunctions.Contains namethenTaggedText.Keyword nameelse TaggedText.ModuleBinding name
242213
lettagNamespace= TaggedText.Namespace
243214
lettagNumericLiteral= TaggedText.NumericLiteral
244215
lettagOperator= TaggedText.Operator
245216
lettagParameter= TaggedText.Parameter
246217
lettagProperty= TaggedText.Property
247218
lettagSpace= TaggedText.Space
248219
lettagStringLiteral= TaggedText.StringLiteral
249-
lettagStructname=if Set.contains name keywordTypesthenTaggedText.Keyword nameelse TaggedText.Struct name
220+
lettagStruct=TaggedText.Struct
250221
lettagTypeParameter= TaggedText.TypeParameter
251222
lettagText= TaggedText.Text
252223
lettagPunctuation= TaggedText.Punctuation

‎src/utils/sformat.fsi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ namespace Microsoft.FSharp.Text.StructuredFormat
126126
#else
127127
#endif
128128
TaggedTextOps=
129-
valkeywordTypes:Set<string>
129+
valkeywordFunctions:Set<string>
130130
valtagAlias:string->TaggedText
131131
valtagClass:string->TaggedText
132132
valtagUnionCase:string->TaggedText

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module internal FSharpClassificationTypes =
3535
| SemanticClassificationType.MutableVar-> MutableVar
3636
| SemanticClassificationType.Printf-> Printf
3737
| SemanticClassificationType.ComputationExpression
38-
| SemanticClassificationType.IntrinsicType-> Keyword
38+
| SemanticClassificationType.IntrinsicFunction-> Keyword
3939
| SemanticClassificationType.UnionCase
4040
| SemanticClassificationType.Enumeration-> Enum
4141
| SemanticClassificationType.Property-> Property

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp