You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suggestions for misspelled values, namespaces, attributes, functions and more - fixesdotnet#1909 (dotnet#1911)
* Suggestions for mispelled values, namespaces and co - fixesdotnet#1909
* Do not discard specialized errors for undefined message - fixesdotnet#1933
* fix tests
* Test for suggestion in generic type
* Flatten predictions in ErrorLogger when in IDE
* Fix ranges
* Fix tests
* Regularize all undefined name messages
* Suggest type parameters
* Suggest attributes
* Suggest Methods
* fix tests
* Optimize perf
* Calculate all predictions lazily
* Be more careful with error allocations
* Remove one a string comparision per Resolver call
* fix merge error
// 1178,tcNoComparisonNeeded1,"The struct, record or union type '%s' is not structurally comparable because the type parameter %s does not satisfy the 'comparison' constraint. Consider adding the 'NoComparison' attribute to this type to clarify that the type is not comparable"
392
395
// 1178,tcNoComparisonNeeded2,"The struct, record or union type '%s' is not structurally comparable because the type '%s' does not satisfy the 'comparison' constraint. Consider adding the 'NoComparison' attribute to this type to clarify that the type is not comparable"
@@ -606,7 +609,7 @@ let getErrorString key = SR.GetString key
606
609
607
610
let(|InvalidArgument|_|)(exn:exn)=match exn with:? ArgumentException as e -> Some e.Message |_-> None
/// Represents the style being used to format errros
18
+
[<RequireQualifiedAccess>]
19
+
typeErrorStyle=
20
+
| DefaultErrors
21
+
| EmacsErrors
22
+
| TestErrors
23
+
| VSErrors
24
+
| GccErrors
25
+
17
26
/// Thrown when we want to add some range information to a .NET exception
18
27
exception WrappedError ofexn*range
19
28
@@ -37,6 +46,10 @@ let rec findOriginalException err =
37
46
|_-> err
38
47
39
48
49
+
typePredictions= unit -> Set<string>
50
+
51
+
letNoPredictions:Predictions =fun()-> Set.empty
52
+
40
53
/// Thrown when we stop processing the F# Interactive entry or #load.
41
54
exception StopProcessingExn ofexnoption
42
55
let(|StopProcessing|_|)exn =match exn with StopProcessingExn _-> Some ()|_-> None
@@ -48,11 +61,20 @@ exception NumberedError of (int * string) * range with // int is e.g. 191 in F
48
61
match this :> exn with
49
62
| NumberedError((_,msg),_)-> msg
50
63
|_->"impossible"
64
+
51
65
exception Error of(int*string)*rangewith// int is e.g. 191 in FS0191 // eventually remove this type, it is a transitional artifact of the old unnumbered error style
52
66
overridethis.Message=
53
67
match this :> exn with
54
68
| Error((_,msg),_)-> msg
55
69
|_->"impossible"
70
+
71
+
72
+
exception ErrorWithPredictions of(int*string)*range*string*Predictionswith// int is e.g. 191 in FS0191
73
+
overridethis.Message=
74
+
match this :> exn with
75
+
| ErrorWithPredictions((_,msg),_,_,_)-> msg
76
+
|_->"impossible"
77
+
56
78
exception InternalError ofstring*range
57
79
exception UserCompilerMessage ofstring*int*range
58
80
exception LibraryUseOnly ofrange
@@ -517,7 +539,7 @@ let NewlineifyErrorString (message:string) = message.Replace(stringThatIsAProxyF
517
539
/// fixes given string by replacing all control chars with spaces.
518
540
/// NOTE: newlines are recognized and replaced with stringThatIsAProxyForANewlineInFlatErrors (ASCII 29, the 'group separator'),
519
541
/// which is decoded by the IDE with 'NewlineifyErrorString' back into newlines, so that multi-line errors can be displayed in QuickInfo
520
-
letNormalizeErrorString(text :string)=
542
+
letNormalizeErrorString(text :string)=
521
543
if isNull text then nullArg "text"
522
544
lettext= text.Trim()
523
545
@@ -530,7 +552,7 @@ let NormalizeErrorString (text : string) =
530
552
// handle \r\n sequence - replace it with one single space
0 commit comments