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

Commitb3f6501

Browse files
dungpaKevinRansom
authored andcommitted
Color built-in types as keywords in signature help and quick info (dotnet#2162)
1 parent43dc891 commitb3f6501

File tree

6 files changed

+40
-34
lines changed

6 files changed

+40
-34
lines changed

‎src/fsharp/TastOps.fs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2517,7 +2517,8 @@ let fullNameOfEntityRef nmF xref =
25172517
| Some pathText-> pathText+.+ nmF xref
25182518

25192519
lettagEntityRefName(xref:EntityRef)name=
2520-
if xref.IsNamespacethen tagNamespace name
2520+
if Set.contains name Lexhelp.Keywords.keywordTypesthen tagKeyword name
2521+
elseif xref.IsNamespacethen tagNamespace name
25212522
elseif xref.IsModulethen tagModule name
25222523
elseif xref.IsTypeAbbrevthen tagAlias name
25232524
elseif xref.IsFSharpDelegateTyconthen tagDelegate name

‎src/fsharp/lexhelp.fs‎

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

301+
letkeywordTypes= StructuredFormat.TaggedTextOps.keywordTypes
302+
301303
letkeywordTable=
302304
lettab= System.Collections.Generic.Dictionary<string,token>(100)
303305
for_,keyword,tokenin keywordListdo

‎src/fsharp/lexhelp.fsi‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ module Keywords =
6868
valIdentifierToken:lexargs->UnicodeLexing.Lexbuf->string->Parser.token
6969
valQuoteIdentifierIfNeeded:string->string
7070
valkeywordNames:string list
71+
valkeywordTypes:Set<string>

‎src/fsharp/vs/service.fs‎

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,36 +1112,7 @@ type TypeCheckInfo
11121112
else
11131113
items
11141114

1115-
letkeywordTypes=
1116-
[
1117-
"array";
1118-
"bigint";
1119-
"bool";
1120-
"byref";
1121-
"byte";
1122-
"char";
1123-
"decimal";
1124-
"double";
1125-
"float";
1126-
"float32";
1127-
"int";
1128-
"int16";
1129-
"int32";
1130-
"int64";
1131-
"list";
1132-
"nativeint";
1133-
"obj";
1134-
"sbyte";
1135-
"seq";
1136-
"single";
1137-
"string";
1138-
"unit";
1139-
"uint";
1140-
"uint16";
1141-
"uint32";
1142-
"uint64";
1143-
"unativeint"
1144-
]|> Set.ofSeq
1115+
static letkeywordTypes= Lexhelp.Keywords.keywordTypes
11451116

11461117
/// Get the auto-complete items at a location
11471118
memberx.GetDeclarations(parseResultsOpt,line,lineStr,colAtEndOfNamesAndResidue,qualifyingNames,partialName,hasTextChangedSinceLastTypecheck)=

‎src/utils/sformat.fs‎

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,37 @@ namespace Microsoft.FSharp.Text.StructuredFormat
194194
moduleTaggedTextOps=
195195
#endif
196196
lettagAlias= TaggedText.Alias
197-
lettagClass= TaggedText.Class
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
198228
lettagUnionCase= TaggedText.UnionCase
199229
lettagDelegate= TaggedText.Delegate
200230
lettagEnum= TaggedText.Enum
@@ -216,7 +246,7 @@ namespace Microsoft.FSharp.Text.StructuredFormat
216246
lettagProperty= TaggedText.Property
217247
lettagSpace= TaggedText.Space
218248
lettagStringLiteral= TaggedText.StringLiteral
219-
lettagStruct=TaggedText.Struct
249+
lettagStructname=if Set.contains name keywordTypesthenTaggedText.Keyword nameelse TaggedText.Struct name
220250
lettagTypeParameter= TaggedText.TypeParameter
221251
lettagText= TaggedText.Text
222252
lettagPunctuation= TaggedText.Punctuation
@@ -1390,5 +1420,5 @@ namespace Microsoft.FSharp.Text.StructuredFormat
13901420

13911421
#if COMPILER
13921422
/// Called
1393-
letfsi_any_to_layout opts x= anyL ShowTopLevelBinding BindingFlags.Public opts x
1423+
letfsi_any_to_layout opts x= anyL ShowTopLevelBinding BindingFlags.Public opts x
13941424
#endif

‎src/utils/sformat.fsi‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ namespace Microsoft.FSharp.Text.StructuredFormat
126126
#else
127127
#endif
128128
TaggedTextOps=
129+
valkeywordTypes:Set<string>
129130
valtagAlias:string->TaggedText
130131
valtagClass:string->TaggedText
131132
valtagUnionCase:string->TaggedText

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp