From 218206f6a6a3d36de8082c4d18639c7ed53947ae Mon Sep 17 00:00:00 2001 From: kerams Date: Fri, 21 Jul 2023 14:57:14 +0200 Subject: [PATCH 1/2] Suggest identifier names in patterns (#15530) Co-authored-by: Vlad Zarytovskii --- src/Compiler/Checking/ConstraintSolver.fs | 37 +--- src/Compiler/FSComp.txt | 1 + src/Compiler/Service/FSharpCheckerResults.fs | 135 +++++++++++++- .../Service/ServiceDeclarationLists.fs | 9 +- .../Service/ServiceDeclarationLists.fsi | 1 + src/Compiler/Service/ServiceParsedInputOps.fs | 166 +++++++++++++----- .../Service/ServiceParsedInputOps.fsi | 20 ++- src/Compiler/TypedTree/TypedTreeOps.fs | 31 ++++ src/Compiler/TypedTree/TypedTreeOps.fsi | 21 +++ src/Compiler/Utilities/illib.fs | 5 + src/Compiler/Utilities/illib.fsi | 2 + src/Compiler/xlf/FSComp.txt.cs.xlf | 5 + src/Compiler/xlf/FSComp.txt.de.xlf | 5 + src/Compiler/xlf/FSComp.txt.es.xlf | 5 + src/Compiler/xlf/FSComp.txt.fr.xlf | 5 + src/Compiler/xlf/FSComp.txt.it.xlf | 5 + src/Compiler/xlf/FSComp.txt.ja.xlf | 5 + src/Compiler/xlf/FSComp.txt.ko.xlf | 5 + src/Compiler/xlf/FSComp.txt.pl.xlf | 5 + src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 5 + src/Compiler/xlf/FSComp.txt.ru.xlf | 5 + src/Compiler/xlf/FSComp.txt.tr.xlf | 5 + src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 5 + src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 5 + ...ervice.SurfaceArea.netstandard20.debug.bsl | 54 +++++- ...vice.SurfaceArea.netstandard20.release.bsl | 54 +++++- .../Completion/CompletionUtils.fs | 1 + .../CompletionProviderTests.fs | 122 +++++++++++++ 28 files changed, 620 insertions(+), 104 deletions(-) diff --git a/src/Compiler/Checking/ConstraintSolver.fs b/src/Compiler/Checking/ConstraintSolver.fs index f80916c325e..34b25ba36a1 100644 --- a/src/Compiler/Checking/ConstraintSolver.fs +++ b/src/Compiler/Checking/ConstraintSolver.fs @@ -397,53 +397,22 @@ let rec isNativeIntegerTy g ty = typeEquivAux EraseMeasures g g.unativeint_ty ty || (isEnumTy g ty && isNativeIntegerTy g (underlyingTypeOfEnumTy g ty)) -let isSignedIntegerTy g ty = - typeEquivAux EraseMeasures g g.sbyte_ty ty || - typeEquivAux EraseMeasures g g.int16_ty ty || - typeEquivAux EraseMeasures g g.int32_ty ty || - typeEquivAux EraseMeasures g g.nativeint_ty ty || - typeEquivAux EraseMeasures g g.int64_ty ty - -let isUnsignedIntegerTy g ty = - typeEquivAux EraseMeasures g g.byte_ty ty || - typeEquivAux EraseMeasures g g.uint16_ty ty || - typeEquivAux EraseMeasures g g.uint32_ty ty || - typeEquivAux EraseMeasures g g.unativeint_ty ty || - typeEquivAux EraseMeasures g g.uint64_ty ty - let rec IsIntegerOrIntegerEnumTy g ty = isSignedIntegerTy g ty || isUnsignedIntegerTy g ty || (isEnumTy g ty && IsIntegerOrIntegerEnumTy g (underlyingTypeOfEnumTy g ty)) -let isIntegerTy g ty = - isSignedIntegerTy g ty || - isUnsignedIntegerTy g ty - let isStringTy g ty = typeEquiv g g.string_ty ty let isCharTy g ty = typeEquiv g g.char_ty ty let isBoolTy g ty = typeEquiv g g.bool_ty ty -/// float or float32 or float<_> or float32<_> -let isFpTy g ty = - typeEquivAux EraseMeasures g g.float_ty ty || - typeEquivAux EraseMeasures g g.float32_ty ty - -/// decimal or decimal<_> -let isDecimalTy g ty = - typeEquivAux EraseMeasures g g.decimal_ty ty - let IsNonDecimalNumericOrIntegralEnumType g ty = IsIntegerOrIntegerEnumTy g ty || isFpTy g ty let IsNumericOrIntegralEnumType g ty = IsNonDecimalNumericOrIntegralEnumType g ty || isDecimalTy g ty -let IsNonDecimalNumericType g ty = isIntegerTy g ty || isFpTy g ty - -let IsNumericType g ty = IsNonDecimalNumericType g ty || isDecimalTy g ty - -let IsRelationalType g ty = IsNumericType g ty || isStringTy g ty || isCharTy g ty || isBoolTy g ty +let IsRelationalType g ty = isNumericType g ty || isStringTy g ty || isCharTy g ty || isBoolTy g ty let IsCharOrStringType g ty = isCharTy g ty || isStringTy g ty @@ -1517,12 +1486,12 @@ and SolveMemberConstraint (csenv: ConstraintSolverEnv) ignoreUnresolvedOverload // We pretend for uniformity that the numeric types have a static property called Zero and One // As with constants, only zero is polymorphic in its units | [], [ty], false, "get_Zero", [] - when IsNumericType g ty || isCharTy g ty -> + when isNumericType g ty || isCharTy g ty -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ty return TTraitBuiltIn | [], [ty], false, "get_One", [] - when IsNumericType g ty || isCharTy g ty -> + when isNumericType g ty || isCharTy g ty -> do! SolveDimensionlessNumericType csenv ndeep m2 trace ty do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ty return TTraitBuiltIn diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index cb994d5cff8..ef346081cc8 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -962,6 +962,7 @@ typeInfoFromFirst,"from %s" typeInfoFromNext,"also from %s" typeInfoGeneratedProperty,"generated property" typeInfoGeneratedType,"generated type" +suggestedName,"(Suggested name)" 1089,recursiveClassHierarchy,"Recursive class hierarchy in type '%s'" 1090,InvalidRecursiveReferenceToAbstractSlot,"Invalid recursive reference to an abstract slot" 1091,eventHasNonStandardType,"The event '%s' has a non-standard type. If this event is declared in another CLI language, you may need to access this event using the explicit %s and %s methods for the event. If this event is declared in F#, make the type of the event an instantiation of either 'IDelegateEvent<_>' or 'IEvent<_,_>'." diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 12a0481ac83..b653834a1e2 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -49,11 +49,6 @@ open FSharp.Compiler.Text.Range open FSharp.Compiler.TypedTree open FSharp.Compiler.TypedTreeBasics open FSharp.Compiler.TypedTreeOps -open FSharp.Compiler.AbstractIL -open System.Reflection.PortableExecutable -open FSharp.Compiler.CreateILModule -open FSharp.Compiler.IlxGen -open FSharp.Compiler.BuildGraph open Internal.Utilities open Internal.Utilities.Collections @@ -934,6 +929,85 @@ type internal TypeCheckInfo let DefaultCompletionItem item = CompletionItem ValueNone ValueNone item + let CompletionItemSuggestedName displayName = + { + ItemWithInst = ItemWithNoInst(Item.NewDef(Ident(displayName, range0))) + MinorPriority = 0 + Type = None + Kind = CompletionItemKind.SuggestedName + IsOwnMember = false + Unresolved = None + } + + /// Checks whether the suggested name is unused. + /// In the future we could use an increasing numeric suffix for conflict resolution + let CreateCompletionItemForSuggestedPatternName (pos: pos) name = + if String.IsNullOrWhiteSpace name then + None + else + let name = String.lowerCaseFirstChar name + + let unused = + sResolutions.CapturedNameResolutions + |> ResizeArray.forall (fun r -> + match r.Item with + | Item.Value vref when r.Pos.Line = pos.Line -> vref.DisplayName <> name + | _ -> true) + + if unused then + Some(CompletionItemSuggestedName name) + else + None + + /// Suggest name based on type + let SuggestNameBasedOnType g pos ty = + if isNumericType g ty then + CreateCompletionItemForSuggestedPatternName pos "num" + else + match tryTcrefOfAppTy g ty with + | ValueSome tcref when not (tyconRefEq g g.system_Object_tcref tcref) -> + CreateCompletionItemForSuggestedPatternName pos tcref.DisplayName + | _ -> None + + /// Suggest names based on field name and type, add them to the list + let SuggestNameForUnionCaseFieldPattern g caseIdPos fieldPatternPos (uci: UnionCaseInfo) indexOrName completions = + let field = + match indexOrName with + | Choice1Of2 index -> + // Index is None when parentheses were not used, i.e. "| Some v ->" - suggest a name only when the case has a single field + match uci.UnionCase.RecdFieldsArray, index with + | [| field |], None -> Some field + | [| _ |], Some _ + | _, None -> None + | arr, Some index -> arr |> Array.tryItem index + | Choice2Of2 name -> uci.UnionCase.RecdFieldsArray |> Array.tryFind (fun x -> x.DisplayName = name) + + field + |> Option.map (fun field -> + let ty = + // If the field type is generic, suggest a name based on the solution + if isTyparTy g field.FormalType then + sResolutions.CapturedNameResolutions + |> ResizeArray.tryPick (fun r -> + match r.Item with + | Item.Value vref when r.Pos = fieldPatternPos -> Some(stripTyparEqns vref.Type) + | _ -> None) + |> Option.defaultValue field.FormalType + else + field.FormalType + + let fieldName = + // If the field has not been given an explicit name, do not suggest the generated one + if field.rfield_name_generated then + "" + else + field.DisplayName + + completions + |> List.prependIfSome (SuggestNameBasedOnType g caseIdPos ty) + |> List.prependIfSome (CreateCompletionItemForSuggestedPatternName caseIdPos fieldName)) + |> Option.defaultValue completions + let getItem (x: ItemWithInst) = x.Item let GetDeclaredItems @@ -1182,10 +1256,10 @@ type internal TypeCheckInfo | atStart when atStart = 0 -> 0 | otherwise -> otherwise - 1 + let pos = mkPos line colAtEndOfNamesAndResidue + // Look for a "special" completion context let completionContext = - let pos = mkPos line colAtEndOfNamesAndResidue - // If the completion context we have computed higher up the stack is for the same position, // reuse it, otherwise recompute match completionContextAtPos with @@ -1400,7 +1474,7 @@ type internal TypeCheckInfo m) // Completion at '(x: ...)" - | Some CompletionContext.PatternType + | Some CompletionContext.Type // Completion at '| Case1 of ...' | Some CompletionContext.UnionCaseFieldsDeclaration // Completion at 'type Long = int6...' or 'type SomeUnion = Abc...' @@ -1434,6 +1508,51 @@ type internal TypeCheckInfo denv, m) + | Some (CompletionContext.Pattern patternContext) -> + let declaredItems = + GetDeclaredItems( + parseResultsOpt, + lineStr, + origLongIdentOpt, + colAtEndOfNamesAndResidue, + residueOpt, + lastDotPos, + line, + loc, + filterCtors, + resolveOverloads, + false, + getAllSymbols + ) + |> Option.map (fun (items, denv, range) -> + let filtered = + items + |> List.filter (fun item -> + match item.Item with + | Item.Value v -> v.LiteralValue.IsSome + | _ -> true) + + filtered, denv, range) + + let indexOrName, caseIdRange = + match patternContext with + | PatternContext.PositionalUnionCaseField (index, m) -> Choice1Of2 index, m + | PatternContext.NamedUnionCaseField (name, m) -> Choice2Of2 name, m + | PatternContext.Other -> Choice1Of2 None, range0 + + // No special handling for PatternContext.Other other than filtering out non-literal values + if equals caseIdRange range0 then + declaredItems + else + GetCapturedNameResolutions caseIdRange.End ResolveOverloads.Yes + |> ResizeArray.tryPick (fun r -> + match r.Item with + | Item.UnionCase (uci, _) -> + let list = declaredItems |> Option.map p13 |> Option.defaultValue [] + Some(SuggestNameForUnionCaseFieldPattern g caseIdRange.End pos uci indexOrName list, r.DisplayEnv, r.Range) + | _ -> None) + |> Option.orElse declaredItems + // Other completions | cc -> match residueOpt |> Option.bind Seq.tryHead with diff --git a/src/Compiler/Service/ServiceDeclarationLists.fs b/src/Compiler/Service/ServiceDeclarationLists.fs index b8a98c0914c..104ae1da0ff 100644 --- a/src/Compiler/Service/ServiceDeclarationLists.fs +++ b/src/Compiler/Service/ServiceDeclarationLists.fs @@ -66,6 +66,7 @@ type ToolTipText = [] type CompletionItemKind = + | SuggestedName | Field | Property | Method of isExtension : bool @@ -1035,10 +1036,12 @@ type DeclarationListItem(textInDeclList: string, textInCode: string, fullName: s member _.NameInCode = textInCode member _.Description = - match info with - | Choice1Of2 (items: CompletionItem list, infoReader, ad, m, denv) -> + match kind, info with + | CompletionItemKind.SuggestedName, _ -> + ToolTipText [ ToolTipElement.Single ([| tagText (FSComp.SR.suggestedName()) |], FSharpXmlDoc.None) ] + | _, Choice1Of2 (items: CompletionItem list, infoReader, ad, m, denv) -> ToolTipText(items |> List.map (fun x -> FormatStructuredDescriptionOfItem true infoReader ad m denv x.ItemWithInst None None)) - | Choice2Of2 result -> + | _, Choice2Of2 result -> result member _.Glyph = glyph diff --git a/src/Compiler/Service/ServiceDeclarationLists.fsi b/src/Compiler/Service/ServiceDeclarationLists.fsi index c0de77f5251..4611ff86a16 100644 --- a/src/Compiler/Service/ServiceDeclarationLists.fsi +++ b/src/Compiler/Service/ServiceDeclarationLists.fsi @@ -60,6 +60,7 @@ type public ToolTipText = [] type public CompletionItemKind = + | SuggestedName | Field | Property | Method of isExtension: bool diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index 1ff76b9e857..77e29d3cbc5 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -49,6 +49,18 @@ type RecordContext = | New of path: CompletionPath * isFirstField: bool | Declaration of isInIdentifier: bool +[] +type PatternContext = + /// Completing union case field in a pattern (e.g. fun (Some v|) -> ) + /// fieldIndex None signifies that the case identifier is followed by a single field, outside of parentheses + | PositionalUnionCaseField of fieldIndex: int option * caseIdRange: range + + /// Completing union case field in a pattern (e.g. fun (Some (Value = v|) -> ) + | NamedUnionCaseField of fieldName: string * caseIdRange: range + + /// Any other position in a pattern that does not need special handling + | Other + [] type CompletionContext = /// Completion context cannot be determined due to errors @@ -71,8 +83,9 @@ type CompletionContext = | OpenDeclaration of isOpenType: bool - /// Completing pattern type (e.g. foo (x: |)) - | PatternType + /// Completing a type annotation (e.g. foo (x: |)) + /// Completing a type application (e.g. typeof) + | Type /// Completing union case fields declaration (e.g. 'A of stri|' but not 'B of tex|: string') | UnionCaseFieldsDeclaration @@ -81,6 +94,9 @@ type CompletionContext = /// or a single case union without a bar (type SomeUnion = Abc|) | TypeAbbreviationOrSingleCaseUnion + /// Completing a pattern in a match clause, member/let binding or lambda + | Pattern of context: PatternContext + type ShortIdent = string type ShortIdents = ShortIdent[] @@ -1181,11 +1197,6 @@ module ParsedInput = None | _ -> None - let (|SkipFromParseErrorPat|) pat = - match pat with - | SynPat.FromParseError (pat, _) -> pat - | _ -> pat - let rec parseLidAux pos plid (parts: Ident list) (dots: range list) = match parts, dots with | [], _ -> Some(plid, None) @@ -1268,6 +1279,81 @@ module ParsedInput = None | _ -> None + // In member, function and lambda definitions (but not in match clauses) we suppress completions on outer identifiers + // + // fun x| -> + // member _.X (a| ) = + // let f x| = + // + // As soon as union case deconstruction is used, we *do* want to see completions on identifiers, in particular to suggest identifier names + // + // fun (SingleCase (v1, v| )) -> + // member _.X (SingleCase (v1, v| )) = + // let f (SingleCase (v1, v| )) = + // + let rec TryGetCompletionContextInPattern suppressIdentifierCompletions (pat: SynPat) previousContext pos = + match pat with + | SynPat.LongIdent (argPats = SynArgPats.NamePatPairs (pats = pats); longDotId = id) -> + pats + |> List.tryPick (fun (patId, _, pat) -> + if rangeContainsPos patId.idRange pos then + Some CompletionContext.Invalid + else + let context = Some(PatternContext.NamedUnionCaseField(patId.idText, id.Range)) + TryGetCompletionContextInPattern suppressIdentifierCompletions pat context pos) + | SynPat.LongIdent (argPats = SynArgPats.Pats pats; longDotId = id) -> + match pats with + | [ SynPat.Named _ as pat ] -> + TryGetCompletionContextInPattern false pat (Some(PatternContext.PositionalUnionCaseField(None, id.Range))) pos + | [ SynPat.Paren (SynPat.Tuple _ | SynPat.Named _ as pat, _) ] -> + TryGetCompletionContextInPattern false pat (Some(PatternContext.PositionalUnionCaseField(Some 0, id.Range))) pos + | _ -> + pats + |> List.tryPick (fun pat -> TryGetCompletionContextInPattern false pat None pos) + | SynPat.Ands (pats = pats) + | SynPat.ArrayOrList (elementPats = pats) -> + pats + |> List.tryPick (fun pat -> TryGetCompletionContextInPattern suppressIdentifierCompletions pat None pos) + | SynPat.Tuple (elementPats = pats) -> + pats + |> List.indexed + |> List.tryPick (fun (i, pat) -> + let context = + match previousContext with + | Some (PatternContext.PositionalUnionCaseField (_, caseIdRange)) -> + Some(PatternContext.PositionalUnionCaseField(Some i, caseIdRange)) + | _ -> + // No preceding LongIdent => this is a tuple deconstruction + None + + TryGetCompletionContextInPattern suppressIdentifierCompletions pat context pos) + | SynPat.Named (range = m) when rangeContainsPos m pos -> + if suppressIdentifierCompletions then + Some CompletionContext.Invalid + else + previousContext + |> Option.defaultValue PatternContext.Other + |> CompletionContext.Pattern + |> Some + | SynPat.FromParseError (pat = pat) + | SynPat.Attrib (pat = pat) -> TryGetCompletionContextInPattern suppressIdentifierCompletions pat previousContext pos + | SynPat.Paren (pat, _) -> TryGetCompletionContextInPattern suppressIdentifierCompletions pat None pos + | SynPat.ListCons (lhsPat = pat1; rhsPat = pat2) + | SynPat.As (lhsPat = pat1; rhsPat = pat2) + | SynPat.Or (lhsPat = pat1; rhsPat = pat2) -> + TryGetCompletionContextInPattern suppressIdentifierCompletions pat1 None pos + |> Option.orElseWith (fun () -> TryGetCompletionContextInPattern suppressIdentifierCompletions pat2 None pos) + | SynPat.IsInst (_, m) when rangeContainsPos m pos -> Some CompletionContext.Type + | SynPat.Wild m when rangeContainsPos m pos -> Some CompletionContext.Invalid + | SynPat.Typed (pat = pat; targetType = synType) -> + if rangeContainsPos pat.Range pos then + TryGetCompletionContextInPattern suppressIdentifierCompletions pat previousContext pos + elif rangeContainsPos synType.Range pos then + Some CompletionContext.Type + else + None + | _ -> None + /// Try to determine completion context for the given pair (row, columns) let TryGetCompletionContext (pos, parsedInput: ParsedInput, lineStr: string) : CompletionContext option = @@ -1306,7 +1392,14 @@ module ParsedInput = | SynExpr.Record (None, None, [], _) -> Some(CompletionContext.RecordField RecordContext.Empty) // Unchecked.defaultof - | SynExpr.TypeApp (typeArgsRange = range) when rangeContainsPos range pos -> Some CompletionContext.PatternType + | SynExpr.TypeApp (typeArgsRange = range) when rangeContainsPos range pos -> Some CompletionContext.Type + + // fun (Some v$ ) -> + | SynExpr.Lambda(parsedData = Some (pats, _)) -> + pats + |> List.tryPick (fun pat -> TryGetCompletionContextInPattern true pat None pos) + |> Option.orElseWith (fun () -> defaultTraverse expr) + | _ -> defaultTraverse expr member _.VisitRecordField(path, copyOpt, field) = @@ -1359,37 +1452,15 @@ module ParsedInput = member _.VisitBinding(_, defaultTraverse, (SynBinding (headPat = headPat) as synBinding)) = - let visitParam (SkipFromParseErrorPat pat) = - match pat with - | SynPat.Named (range = range) - | SynPat.As (_, SynPat.Named (range = range), _) when rangeContainsPos range pos -> - // parameter without type hint, no completion - Some CompletionContext.Invalid - | SynPat.Typed (SynPat.Named (_, _, _, range), _, _) when rangeContainsPos range pos -> - // parameter with type hint, but we are on its name, no completion - Some CompletionContext.Invalid - | _ -> defaultTraverse synBinding - match headPat with - | SynPat.LongIdent (longDotId = lidwd) when rangeContainsPos lidwd.Range pos -> - // let fo|o x = () - Some CompletionContext.Invalid - | SynPat.LongIdent (argPats = ctorArgs; range = range) when rangeContainsPos range pos -> - match ctorArgs with - | SynArgPats.Pats pats -> + | SynPat.LongIdent (longDotId = lidwd; argPats = SynArgPats.Pats pats; range = m) when rangeContainsPos m pos -> + if rangeContainsPos lidwd.Range pos then + // let fo|o x = () + Some CompletionContext.Invalid + else pats - |> List.tryPick (fun (SkipFromParseErrorPat pat) -> - match pat with - | SynPat.Paren (pat, _) -> - match pat with - | SynPat.Tuple (elementPats = pats) -> pats |> List.tryPick visitParam - | _ -> visitParam pat - | SynPat.Wild range - | SynPat.FromParseError (SynPat.Named _, range) when rangeContainsPos range pos -> - // let foo (x| - Some CompletionContext.Invalid - | _ -> visitParam pat) - | _ -> defaultTraverse synBinding + |> List.tryPick (fun pat -> TryGetCompletionContextInPattern true pat None pos) + |> Option.orElseWith (fun () -> defaultTraverse synBinding) | SynPat.Named (range = range) | SynPat.As (_, SynPat.Named (range = range), _) when rangeContainsPos range pos -> // let fo|o = 1 @@ -1435,27 +1506,28 @@ module ParsedInput = | _ -> None member _.VisitSimplePats(_, pats) = + // Lambdas and their patterns are processed above in VisitExpr, + // so VisitSimplePats is only called for primary constructors + pats |> List.tryPick (fun pat -> - // No completions in an identifier in a pattern match pat with - // fun x| -> + // type C (x| ) | SynSimplePat.Id (range = range) when rangeContainsPos range pos -> Some CompletionContext.Invalid - | SynSimplePat.Typed (SynSimplePat.Id (range = idRange), synType, _) -> - // fun (x|: int) -> + | SynSimplePat.Typed (pat = SynSimplePat.Id (range = idRange); targetType = synType) -> + // type C (x|: int) -> if rangeContainsPos idRange pos then Some CompletionContext.Invalid - // fun (x: int|) -> + // type C (x: int|) -> elif rangeContainsPos synType.Range pos then - Some CompletionContext.PatternType + Some CompletionContext.Type else None | _ -> None) member _.VisitPat(_, defaultTraverse, pat) = - match pat with - | SynPat.IsInst (_, range) when rangeContainsPos range pos -> Some CompletionContext.PatternType - | _ -> defaultTraverse pat + TryGetCompletionContextInPattern false pat None pos + |> Option.orElseWith (fun () -> defaultTraverse pat) member _.VisitModuleDecl(_, defaultTraverse, decl) = match decl with @@ -1487,7 +1559,7 @@ module ParsedInput = member _.VisitType(_, defaultTraverse, ty) = match ty with - | SynType.LongIdent _ when rangeContainsPos ty.Range pos -> Some CompletionContext.PatternType + | SynType.LongIdent _ when rangeContainsPos ty.Range pos -> Some CompletionContext.Type | _ -> defaultTraverse ty member _.VisitRecordDefn(_, fields, _) = diff --git a/src/Compiler/Service/ServiceParsedInputOps.fsi b/src/Compiler/Service/ServiceParsedInputOps.fsi index 5fb5e85d8cd..0f70080f1ff 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fsi +++ b/src/Compiler/Service/ServiceParsedInputOps.fsi @@ -22,6 +22,18 @@ type public RecordContext = | New of path: CompletionPath * isFirstField: bool | Declaration of isInIdentifier: bool +[] +type public PatternContext = + /// Completing union case field in a pattern (e.g. fun (Some v|) -> ) + /// fieldIndex None signifies that the case identifier is followed by a single field, outside of parentheses + | PositionalUnionCaseField of fieldIndex: int option * caseIdRange: range + + /// Completing union case field in a pattern (e.g. fun (Some (Value = v|) -> ) + | NamedUnionCaseField of fieldName: string * caseIdRange: range + + /// Any other position in a pattern that does not need special handling + | Other + [] type public CompletionContext = /// Completion context cannot be determined due to errors @@ -44,8 +56,9 @@ type public CompletionContext = | OpenDeclaration of isOpenType: bool - /// Completing pattern type (e.g. foo (x: |)) - | PatternType + /// Completing a type annotation (e.g. foo (x: |)) + /// Completing a type application (e.g. typeof) + | Type /// Completing union case fields declaration (e.g. 'A of stri|' but not 'B of tex|: string') | UnionCaseFieldsDeclaration @@ -54,6 +67,9 @@ type public CompletionContext = /// or a single case union without a bar (type SomeUnion = Abc|) | TypeAbbreviationOrSingleCaseUnion + /// Completing a pattern in a match clause, member/let binding or lambda + | Pattern of context: PatternContext + type public ModuleKind = { IsAutoOpen: bool HasModuleSuffix: bool } diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index caf5230db20..8d555ba3ec7 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -2004,6 +2004,37 @@ let isEnumTy g ty = | ValueNone -> false | ValueSome tcref -> tcref.IsEnumTycon +let isSignedIntegerTy g ty = + typeEquivAux EraseMeasures g g.sbyte_ty ty || + typeEquivAux EraseMeasures g g.int16_ty ty || + typeEquivAux EraseMeasures g g.int32_ty ty || + typeEquivAux EraseMeasures g g.nativeint_ty ty || + typeEquivAux EraseMeasures g g.int64_ty ty + +let isUnsignedIntegerTy g ty = + typeEquivAux EraseMeasures g g.byte_ty ty || + typeEquivAux EraseMeasures g g.uint16_ty ty || + typeEquivAux EraseMeasures g g.uint32_ty ty || + typeEquivAux EraseMeasures g g.unativeint_ty ty || + typeEquivAux EraseMeasures g g.uint64_ty ty + +let isIntegerTy g ty = + isSignedIntegerTy g ty || + isUnsignedIntegerTy g ty + +/// float or float32 or float<_> or float32<_> +let isFpTy g ty = + typeEquivAux EraseMeasures g g.float_ty ty || + typeEquivAux EraseMeasures g g.float32_ty ty + +/// decimal or decimal<_> +let isDecimalTy g ty = + typeEquivAux EraseMeasures g g.decimal_ty ty + +let isNonDecimalNumericType g ty = isIntegerTy g ty || isFpTy g ty + +let isNumericType g ty = isNonDecimalNumericType g ty || isDecimalTy g ty + let actualReturnTyOfSlotSig parentTyInst methTyInst (TSlotSig(_, _, parentFormalTypars, methFormalTypars, _, formalRetTy)) = let methTyInst = mkTyparInst methFormalTypars methTyInst let parentTyInst = mkTyparInst parentFormalTypars parentTyInst diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi index b3e763f9d8a..8ba51ea5ee2 100755 --- a/src/Compiler/TypedTree/TypedTreeOps.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.fsi @@ -1698,6 +1698,27 @@ val isClassTy: TcGlobals -> TType -> bool /// Determine if a type is an enum type val isEnumTy: TcGlobals -> TType -> bool +/// Determine if a type is a signed integer type +val isSignedIntegerTy: TcGlobals -> TType -> bool + +/// Determine if a type is an unsigned integer type +val isUnsignedIntegerTy: TcGlobals -> TType -> bool + +/// Determine if a type is an integer type +val isIntegerTy: TcGlobals -> TType -> bool + +/// Determine if a type is a floating point type +val isFpTy: TcGlobals -> TType -> bool + +/// Determine if a type is a decimal type +val isDecimalTy: TcGlobals -> TType -> bool + +/// Determine if a type is a non-decimal numeric type type +val isNonDecimalNumericType: TcGlobals -> TType -> bool + +/// Determine if a type is a numeric type type +val isNumericType: TcGlobals -> TType -> bool + /// Determine if a type is a struct, record or union type val isStructRecordOrUnionTyconTy: TcGlobals -> TType -> bool diff --git a/src/Compiler/Utilities/illib.fs b/src/Compiler/Utilities/illib.fs index 244fd4608c1..fd59c3c24d9 100644 --- a/src/Compiler/Utilities/illib.fs +++ b/src/Compiler/Utilities/illib.fs @@ -571,6 +571,11 @@ module List = | [ _ ] -> true | _ -> false + let prependIfSome x l = + match x with + | Some x -> x :: l + | _ -> l + module ResizeArray = /// Split a ResizeArray into an array of smaller chunks. diff --git a/src/Compiler/Utilities/illib.fsi b/src/Compiler/Utilities/illib.fsi index 7272dace378..111bc0c8f77 100644 --- a/src/Compiler/Utilities/illib.fsi +++ b/src/Compiler/Utilities/illib.fsi @@ -211,6 +211,8 @@ module internal List = val isSingleton: xs: 'T list -> bool + val prependIfSome: x: 'a option -> l: 'a list -> 'a list + module internal ResizeArray = /// Split a ResizeArray into an array of smaller chunks. diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 43e00f16f1e..98f8fbb32e2 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -972,6 +972,11 @@ Sadu .NET SDK pro tento skript nešlo určit. Pokud se skript nachází v adresáři používajícím global.json, zkontrolujte, jestli je nainstalovaná odpovídající sada .NET SDK. Neočekávaná chyba {0}. + + (Suggested name) + (Suggested name) + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 509d5b6f7d1..dd69a9cb70c 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -972,6 +972,11 @@ Das .NET SDK für dieses Skript konnte nicht ermittelt werden. Wenn sich das Skript in einem Verzeichnis mit "global.json" befindet, stellen Sie sicher, dass das entsprechende .NET SDK installiert ist. Unerwarteter Fehler: {0}. + + (Suggested name) + (Suggested name) + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index f156ff9f0ee..995caf36f29 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -972,6 +972,11 @@ No se pudo determinar el SDK de .NET para este script. Si el script está en un directorio que usa una instancia de "global.json", asegúrese de que el SDK de .NET pertinente esté instalado. Error inesperado: "{0}". + + (Suggested name) + (Suggested name) + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index c9437409d33..81f2e387209 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -972,6 +972,11 @@ Le kit SDK .NET de ce script n'a pas pu être déterminé. Si le script se trouve dans un répertoire utilisant un fichier 'global.json', vérifiez que le kit SDK .NET approprié est installé. Erreur inattendue '{0}'. + + (Suggested name) + (Suggested name) + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index e6ccf36a9a5..9ea2c0749a0 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -972,6 +972,11 @@ Non è stato possibile determinare la versione di .NET SDK per questo script. Se lo script si trova in una directory che usa un file 'global.json', assicurarsi che sia installata la versione pertinente di .NET SDK. Errore imprevisto: '{0}'. + + (Suggested name) + (Suggested name) + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 5be7a1c72a5..67a1a83c4fb 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -972,6 +972,11 @@ このスクリプトの .NET SDK を特定できませんでした。このスクリプトが、'global.json' が使用されているディレクトリにある場合は、関連する .NET SDK がインストールされていることを確認してください。予期しないエラー '{0}'。 + + (Suggested name) + (Suggested name) + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 982f643df1c..1e2f1add74f 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -972,6 +972,11 @@ 이 스크립트에 대한 .NET SDK를 확인할 수 없습니다. 스크립트가 'global.json'을 사용하는 디렉터리에 있는 경우 관련 .NET SDK가 설치되어 있는지 확인하세요. 예기치 않은 오류 '{0}'. + + (Suggested name) + (Suggested name) + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index b12e5c1a1f2..b5d7037b1f5 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -972,6 +972,11 @@ Nie można określić zestawu .NET SDK dla tego skryptu. Jeśli skrypt znajduje się w katalogu korzystającym z pliku „global.json”, upewnij się, że zainstalowano odpowiedni zestaw .NET SDK. Nieoczekiwany błąd: „{0}”. + + (Suggested name) + (Suggested name) + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 691b1a7e34c..dadd8ddd49a 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -972,6 +972,11 @@ Não foi possível determinar o SDK do .NET deste script. Se o script estiver em um diretório que usa um 'global.json', verifique se o SDK do .NET relevante está instalado. Erro inesperado '{0}'. + + (Suggested name) + (Suggested name) + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 5f6be141766..c8d7d9aa5c8 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -972,6 +972,11 @@ Не удалось определить пакет SDK .NET для этого скрипта. Если сценарий находится в каталоге с использованием файла "global.json", убедитесь, что установлен соответствующий пакет SDK .NET. Непредвиденная ошибка "{0}". + + (Suggested name) + (Suggested name) + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index d433d4c9416..a55679f4cd5 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -972,6 +972,11 @@ Bu betik için .NET SDK belirlenemedi. Betik 'global.json' kullanan bir dizindeyse, ilgili .NET SDK'nın yüklü olduğundan emin olun. Beklenmeyen hata '{0}'. + + (Suggested name) + (Suggested name) + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index a6cde2b078b..aa75404b146 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -972,6 +972,11 @@ 无法确定此脚本的 .NET SDK。如果脚本在使用 "global.json" 的目录中,请确保已安装相关的 .NET SDK。出现意外错误“{0}”。 + + (Suggested name) + (Suggested name) + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 27c967818a2..f45c6e2154c 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -972,6 +972,11 @@ 無法判斷這個指令碼的 .NET SDK。如果指令碼位於使用 'global.json' 的目錄中,請確認已安裝相關的 .NET SDK。未預期的錯誤 '{0}'。 + + (Suggested name) + (Suggested name) + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 1c34b0feb50..0049ff2bae4 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -2542,6 +2542,8 @@ FSharp.Compiler.EditorServices.CompletionContext+ParameterList: FSharp.Compiler. FSharp.Compiler.EditorServices.CompletionContext+ParameterList: FSharp.Compiler.Text.Position get_Item1() FSharp.Compiler.EditorServices.CompletionContext+ParameterList: System.Collections.Generic.HashSet`1[System.String] Item2 FSharp.Compiler.EditorServices.CompletionContext+ParameterList: System.Collections.Generic.HashSet`1[System.String] get_Item2() +FSharp.Compiler.EditorServices.CompletionContext+Pattern: FSharp.Compiler.EditorServices.PatternContext context +FSharp.Compiler.EditorServices.CompletionContext+Pattern: FSharp.Compiler.EditorServices.PatternContext get_context() FSharp.Compiler.EditorServices.CompletionContext+RecordField: FSharp.Compiler.EditorServices.RecordContext context FSharp.Compiler.EditorServices.CompletionContext+RecordField: FSharp.Compiler.EditorServices.RecordContext get_context() FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 AttributeApplication @@ -2549,9 +2551,10 @@ FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 Inherit FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 Invalid FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 OpenDeclaration FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 ParameterList -FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 PatternType +FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 Pattern FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 RangeOperator FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 RecordField +FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 Type FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 TypeAbbreviationOrSingleCaseUnion FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 UnionCaseFieldsDeclaration FSharp.Compiler.EditorServices.CompletionContext: Boolean Equals(FSharp.Compiler.EditorServices.CompletionContext) @@ -2562,9 +2565,10 @@ FSharp.Compiler.EditorServices.CompletionContext: Boolean IsInherit FSharp.Compiler.EditorServices.CompletionContext: Boolean IsInvalid FSharp.Compiler.EditorServices.CompletionContext: Boolean IsOpenDeclaration FSharp.Compiler.EditorServices.CompletionContext: Boolean IsParameterList -FSharp.Compiler.EditorServices.CompletionContext: Boolean IsPatternType +FSharp.Compiler.EditorServices.CompletionContext: Boolean IsPattern FSharp.Compiler.EditorServices.CompletionContext: Boolean IsRangeOperator FSharp.Compiler.EditorServices.CompletionContext: Boolean IsRecordField +FSharp.Compiler.EditorServices.CompletionContext: Boolean IsType FSharp.Compiler.EditorServices.CompletionContext: Boolean IsTypeAbbreviationOrSingleCaseUnion FSharp.Compiler.EditorServices.CompletionContext: Boolean IsUnionCaseFieldsDeclaration FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsAttributeApplication() @@ -2572,9 +2576,10 @@ FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsInherit() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsInvalid() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsOpenDeclaration() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsParameterList() -FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsPatternType() +FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsPattern() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsRangeOperator() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsRecordField() +FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsType() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsTypeAbbreviationOrSingleCaseUnion() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsUnionCaseFieldsDeclaration() FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext AttributeApplication @@ -2582,20 +2587,22 @@ FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewInherit(FSharp.Compiler.EditorServices.InheritanceContext, System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[System.String],Microsoft.FSharp.Core.FSharpOption`1[System.String]]) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewOpenDeclaration(Boolean) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewParameterList(FSharp.Compiler.Text.Position, System.Collections.Generic.HashSet`1[System.String]) +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewPattern(FSharp.Compiler.EditorServices.PatternContext) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewRecordField(FSharp.Compiler.EditorServices.RecordContext) -FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext PatternType FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext RangeOperator +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext Type FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext TypeAbbreviationOrSingleCaseUnion FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext UnionCaseFieldsDeclaration FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_AttributeApplication() FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_Invalid() -FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_PatternType() FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_RangeOperator() +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_Type() FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_TypeAbbreviationOrSingleCaseUnion() FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_UnionCaseFieldsDeclaration() FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext+Inherit FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext+ParameterList +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext+Pattern FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext+RecordField FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext+Tags FSharp.Compiler.EditorServices.CompletionContext: Int32 GetHashCode() @@ -2612,6 +2619,7 @@ FSharp.Compiler.EditorServices.CompletionItemKind+Tags: Int32 Field FSharp.Compiler.EditorServices.CompletionItemKind+Tags: Int32 Method FSharp.Compiler.EditorServices.CompletionItemKind+Tags: Int32 Other FSharp.Compiler.EditorServices.CompletionItemKind+Tags: Int32 Property +FSharp.Compiler.EditorServices.CompletionItemKind+Tags: Int32 SuggestedName FSharp.Compiler.EditorServices.CompletionItemKind: Boolean Equals(FSharp.Compiler.EditorServices.CompletionItemKind) FSharp.Compiler.EditorServices.CompletionItemKind: Boolean Equals(System.Object) FSharp.Compiler.EditorServices.CompletionItemKind: Boolean Equals(System.Object, System.Collections.IEqualityComparer) @@ -2622,6 +2630,7 @@ FSharp.Compiler.EditorServices.CompletionItemKind: Boolean IsField FSharp.Compiler.EditorServices.CompletionItemKind: Boolean IsMethod FSharp.Compiler.EditorServices.CompletionItemKind: Boolean IsOther FSharp.Compiler.EditorServices.CompletionItemKind: Boolean IsProperty +FSharp.Compiler.EditorServices.CompletionItemKind: Boolean IsSuggestedName FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsArgument() FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsCustomOperation() FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsEvent() @@ -2629,6 +2638,7 @@ FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsField() FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsMethod() FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsOther() FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsProperty() +FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsSuggestedName() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind Argument FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind CustomOperation FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind Event @@ -2636,12 +2646,14 @@ FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorService FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind NewMethod(Boolean) FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind Other FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind Property +FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind SuggestedName FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_Argument() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_CustomOperation() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_Event() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_Field() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_Other() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_Property() +FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_SuggestedName() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind+Method FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind+Tags FSharp.Compiler.EditorServices.CompletionItemKind: Int32 CompareTo(FSharp.Compiler.EditorServices.CompletionItemKind) @@ -3553,6 +3565,38 @@ FSharp.Compiler.EditorServices.PartialLongName: System.String PartialIdent FSharp.Compiler.EditorServices.PartialLongName: System.String ToString() FSharp.Compiler.EditorServices.PartialLongName: System.String get_PartialIdent() FSharp.Compiler.EditorServices.PartialLongName: Void .ctor(Microsoft.FSharp.Collections.FSharpList`1[System.String], System.String, Int32, Microsoft.FSharp.Core.FSharpOption`1[System.Int32]) +FSharp.Compiler.EditorServices.PatternContext+NamedUnionCaseField: FSharp.Compiler.Text.Range caseIdRange +FSharp.Compiler.EditorServices.PatternContext+NamedUnionCaseField: FSharp.Compiler.Text.Range get_caseIdRange() +FSharp.Compiler.EditorServices.PatternContext+NamedUnionCaseField: System.String fieldName +FSharp.Compiler.EditorServices.PatternContext+NamedUnionCaseField: System.String get_fieldName() +FSharp.Compiler.EditorServices.PatternContext+PositionalUnionCaseField: FSharp.Compiler.Text.Range caseIdRange +FSharp.Compiler.EditorServices.PatternContext+PositionalUnionCaseField: FSharp.Compiler.Text.Range get_caseIdRange() +FSharp.Compiler.EditorServices.PatternContext+PositionalUnionCaseField: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] fieldIndex +FSharp.Compiler.EditorServices.PatternContext+PositionalUnionCaseField: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] get_fieldIndex() +FSharp.Compiler.EditorServices.PatternContext+Tags: Int32 NamedUnionCaseField +FSharp.Compiler.EditorServices.PatternContext+Tags: Int32 Other +FSharp.Compiler.EditorServices.PatternContext+Tags: Int32 PositionalUnionCaseField +FSharp.Compiler.EditorServices.PatternContext: Boolean Equals(FSharp.Compiler.EditorServices.PatternContext) +FSharp.Compiler.EditorServices.PatternContext: Boolean Equals(System.Object) +FSharp.Compiler.EditorServices.PatternContext: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +FSharp.Compiler.EditorServices.PatternContext: Boolean IsNamedUnionCaseField +FSharp.Compiler.EditorServices.PatternContext: Boolean IsOther +FSharp.Compiler.EditorServices.PatternContext: Boolean IsPositionalUnionCaseField +FSharp.Compiler.EditorServices.PatternContext: Boolean get_IsNamedUnionCaseField() +FSharp.Compiler.EditorServices.PatternContext: Boolean get_IsOther() +FSharp.Compiler.EditorServices.PatternContext: Boolean get_IsPositionalUnionCaseField() +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext NewNamedUnionCaseField(System.String, FSharp.Compiler.Text.Range) +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext NewPositionalUnionCaseField(Microsoft.FSharp.Core.FSharpOption`1[System.Int32], FSharp.Compiler.Text.Range) +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext Other +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext get_Other() +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext+NamedUnionCaseField +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext+PositionalUnionCaseField +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext+Tags +FSharp.Compiler.EditorServices.PatternContext: Int32 GetHashCode() +FSharp.Compiler.EditorServices.PatternContext: Int32 GetHashCode(System.Collections.IEqualityComparer) +FSharp.Compiler.EditorServices.PatternContext: Int32 Tag +FSharp.Compiler.EditorServices.PatternContext: Int32 get_Tag() +FSharp.Compiler.EditorServices.PatternContext: System.String ToString() FSharp.Compiler.EditorServices.QuickParse: Boolean TestMemberOrOverrideDeclaration(FSharp.Compiler.Tokenization.FSharpTokenInfo[]) FSharp.Compiler.EditorServices.QuickParse: FSharp.Compiler.EditorServices.PartialLongName GetPartialLongNameEx(System.String, Int32) FSharp.Compiler.EditorServices.QuickParse: Int32 CorrectIdentifierToken(System.String, Int32) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 5f4a43c99c5..ee4f6838520 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -2542,6 +2542,8 @@ FSharp.Compiler.EditorServices.CompletionContext+ParameterList: FSharp.Compiler. FSharp.Compiler.EditorServices.CompletionContext+ParameterList: FSharp.Compiler.Text.Position get_Item1() FSharp.Compiler.EditorServices.CompletionContext+ParameterList: System.Collections.Generic.HashSet`1[System.String] Item2 FSharp.Compiler.EditorServices.CompletionContext+ParameterList: System.Collections.Generic.HashSet`1[System.String] get_Item2() +FSharp.Compiler.EditorServices.CompletionContext+Pattern: FSharp.Compiler.EditorServices.PatternContext context +FSharp.Compiler.EditorServices.CompletionContext+Pattern: FSharp.Compiler.EditorServices.PatternContext get_context() FSharp.Compiler.EditorServices.CompletionContext+RecordField: FSharp.Compiler.EditorServices.RecordContext context FSharp.Compiler.EditorServices.CompletionContext+RecordField: FSharp.Compiler.EditorServices.RecordContext get_context() FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 AttributeApplication @@ -2549,9 +2551,10 @@ FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 Inherit FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 Invalid FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 OpenDeclaration FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 ParameterList -FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 PatternType +FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 Pattern FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 RangeOperator FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 RecordField +FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 Type FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 TypeAbbreviationOrSingleCaseUnion FSharp.Compiler.EditorServices.CompletionContext+Tags: Int32 UnionCaseFieldsDeclaration FSharp.Compiler.EditorServices.CompletionContext: Boolean Equals(FSharp.Compiler.EditorServices.CompletionContext) @@ -2562,9 +2565,10 @@ FSharp.Compiler.EditorServices.CompletionContext: Boolean IsInherit FSharp.Compiler.EditorServices.CompletionContext: Boolean IsInvalid FSharp.Compiler.EditorServices.CompletionContext: Boolean IsOpenDeclaration FSharp.Compiler.EditorServices.CompletionContext: Boolean IsParameterList -FSharp.Compiler.EditorServices.CompletionContext: Boolean IsPatternType +FSharp.Compiler.EditorServices.CompletionContext: Boolean IsPattern FSharp.Compiler.EditorServices.CompletionContext: Boolean IsRangeOperator FSharp.Compiler.EditorServices.CompletionContext: Boolean IsRecordField +FSharp.Compiler.EditorServices.CompletionContext: Boolean IsType FSharp.Compiler.EditorServices.CompletionContext: Boolean IsTypeAbbreviationOrSingleCaseUnion FSharp.Compiler.EditorServices.CompletionContext: Boolean IsUnionCaseFieldsDeclaration FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsAttributeApplication() @@ -2572,9 +2576,10 @@ FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsInherit() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsInvalid() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsOpenDeclaration() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsParameterList() -FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsPatternType() +FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsPattern() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsRangeOperator() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsRecordField() +FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsType() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsTypeAbbreviationOrSingleCaseUnion() FSharp.Compiler.EditorServices.CompletionContext: Boolean get_IsUnionCaseFieldsDeclaration() FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext AttributeApplication @@ -2582,20 +2587,22 @@ FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewInherit(FSharp.Compiler.EditorServices.InheritanceContext, System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[System.String],Microsoft.FSharp.Core.FSharpOption`1[System.String]]) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewOpenDeclaration(Boolean) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewParameterList(FSharp.Compiler.Text.Position, System.Collections.Generic.HashSet`1[System.String]) +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewPattern(FSharp.Compiler.EditorServices.PatternContext) FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext NewRecordField(FSharp.Compiler.EditorServices.RecordContext) -FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext PatternType FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext RangeOperator +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext Type FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext TypeAbbreviationOrSingleCaseUnion FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext UnionCaseFieldsDeclaration FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_AttributeApplication() FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_Invalid() -FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_PatternType() FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_RangeOperator() +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_Type() FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_TypeAbbreviationOrSingleCaseUnion() FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext get_UnionCaseFieldsDeclaration() FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext+Inherit FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext+OpenDeclaration FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext+ParameterList +FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext+Pattern FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext+RecordField FSharp.Compiler.EditorServices.CompletionContext: FSharp.Compiler.EditorServices.CompletionContext+Tags FSharp.Compiler.EditorServices.CompletionContext: Int32 GetHashCode() @@ -2612,6 +2619,7 @@ FSharp.Compiler.EditorServices.CompletionItemKind+Tags: Int32 Field FSharp.Compiler.EditorServices.CompletionItemKind+Tags: Int32 Method FSharp.Compiler.EditorServices.CompletionItemKind+Tags: Int32 Other FSharp.Compiler.EditorServices.CompletionItemKind+Tags: Int32 Property +FSharp.Compiler.EditorServices.CompletionItemKind+Tags: Int32 SuggestedName FSharp.Compiler.EditorServices.CompletionItemKind: Boolean Equals(FSharp.Compiler.EditorServices.CompletionItemKind) FSharp.Compiler.EditorServices.CompletionItemKind: Boolean Equals(System.Object) FSharp.Compiler.EditorServices.CompletionItemKind: Boolean Equals(System.Object, System.Collections.IEqualityComparer) @@ -2622,6 +2630,7 @@ FSharp.Compiler.EditorServices.CompletionItemKind: Boolean IsField FSharp.Compiler.EditorServices.CompletionItemKind: Boolean IsMethod FSharp.Compiler.EditorServices.CompletionItemKind: Boolean IsOther FSharp.Compiler.EditorServices.CompletionItemKind: Boolean IsProperty +FSharp.Compiler.EditorServices.CompletionItemKind: Boolean IsSuggestedName FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsArgument() FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsCustomOperation() FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsEvent() @@ -2629,6 +2638,7 @@ FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsField() FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsMethod() FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsOther() FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsProperty() +FSharp.Compiler.EditorServices.CompletionItemKind: Boolean get_IsSuggestedName() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind Argument FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind CustomOperation FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind Event @@ -2636,12 +2646,14 @@ FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorService FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind NewMethod(Boolean) FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind Other FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind Property +FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind SuggestedName FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_Argument() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_CustomOperation() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_Event() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_Field() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_Other() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_Property() +FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind get_SuggestedName() FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind+Method FSharp.Compiler.EditorServices.CompletionItemKind: FSharp.Compiler.EditorServices.CompletionItemKind+Tags FSharp.Compiler.EditorServices.CompletionItemKind: Int32 CompareTo(FSharp.Compiler.EditorServices.CompletionItemKind) @@ -3553,6 +3565,38 @@ FSharp.Compiler.EditorServices.PartialLongName: System.String PartialIdent FSharp.Compiler.EditorServices.PartialLongName: System.String ToString() FSharp.Compiler.EditorServices.PartialLongName: System.String get_PartialIdent() FSharp.Compiler.EditorServices.PartialLongName: Void .ctor(Microsoft.FSharp.Collections.FSharpList`1[System.String], System.String, Int32, Microsoft.FSharp.Core.FSharpOption`1[System.Int32]) +FSharp.Compiler.EditorServices.PatternContext+NamedUnionCaseField: FSharp.Compiler.Text.Range caseIdRange +FSharp.Compiler.EditorServices.PatternContext+NamedUnionCaseField: FSharp.Compiler.Text.Range get_caseIdRange() +FSharp.Compiler.EditorServices.PatternContext+NamedUnionCaseField: System.String fieldName +FSharp.Compiler.EditorServices.PatternContext+NamedUnionCaseField: System.String get_fieldName() +FSharp.Compiler.EditorServices.PatternContext+PositionalUnionCaseField: FSharp.Compiler.Text.Range caseIdRange +FSharp.Compiler.EditorServices.PatternContext+PositionalUnionCaseField: FSharp.Compiler.Text.Range get_caseIdRange() +FSharp.Compiler.EditorServices.PatternContext+PositionalUnionCaseField: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] fieldIndex +FSharp.Compiler.EditorServices.PatternContext+PositionalUnionCaseField: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] get_fieldIndex() +FSharp.Compiler.EditorServices.PatternContext+Tags: Int32 NamedUnionCaseField +FSharp.Compiler.EditorServices.PatternContext+Tags: Int32 Other +FSharp.Compiler.EditorServices.PatternContext+Tags: Int32 PositionalUnionCaseField +FSharp.Compiler.EditorServices.PatternContext: Boolean Equals(FSharp.Compiler.EditorServices.PatternContext) +FSharp.Compiler.EditorServices.PatternContext: Boolean Equals(System.Object) +FSharp.Compiler.EditorServices.PatternContext: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +FSharp.Compiler.EditorServices.PatternContext: Boolean IsNamedUnionCaseField +FSharp.Compiler.EditorServices.PatternContext: Boolean IsOther +FSharp.Compiler.EditorServices.PatternContext: Boolean IsPositionalUnionCaseField +FSharp.Compiler.EditorServices.PatternContext: Boolean get_IsNamedUnionCaseField() +FSharp.Compiler.EditorServices.PatternContext: Boolean get_IsOther() +FSharp.Compiler.EditorServices.PatternContext: Boolean get_IsPositionalUnionCaseField() +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext NewNamedUnionCaseField(System.String, FSharp.Compiler.Text.Range) +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext NewPositionalUnionCaseField(Microsoft.FSharp.Core.FSharpOption`1[System.Int32], FSharp.Compiler.Text.Range) +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext Other +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext get_Other() +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext+NamedUnionCaseField +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext+PositionalUnionCaseField +FSharp.Compiler.EditorServices.PatternContext: FSharp.Compiler.EditorServices.PatternContext+Tags +FSharp.Compiler.EditorServices.PatternContext: Int32 GetHashCode() +FSharp.Compiler.EditorServices.PatternContext: Int32 GetHashCode(System.Collections.IEqualityComparer) +FSharp.Compiler.EditorServices.PatternContext: Int32 Tag +FSharp.Compiler.EditorServices.PatternContext: Int32 get_Tag() +FSharp.Compiler.EditorServices.PatternContext: System.String ToString() FSharp.Compiler.EditorServices.QuickParse: Boolean TestMemberOrOverrideDeclaration(FSharp.Compiler.Tokenization.FSharpTokenInfo[]) FSharp.Compiler.EditorServices.QuickParse: FSharp.Compiler.EditorServices.PartialLongName GetPartialLongNameEx(System.String, Int32) FSharp.Compiler.EditorServices.QuickParse: Int32 CorrectIdentifierToken(System.String, Int32) diff --git a/vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs b/vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs index 0c823f0efc1..65a4d21e652 100644 --- a/vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs +++ b/vsintegration/src/FSharp.Editor/Completion/CompletionUtils.fs @@ -133,6 +133,7 @@ module internal CompletionUtils = let inline getKindPriority kind = match kind with + | CompletionItemKind.SuggestedName | CompletionItemKind.CustomOperation -> 0 | CompletionItemKind.Property -> 1 | CompletionItemKind.Field -> 2 diff --git a/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs index 87a8686bcec..7003a97b42a 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs @@ -885,6 +885,7 @@ type T() = """ VerifyNoCompletionList(fileContents, "member this.M(p:int, h") + VerifyNoCompletionList(fileContents, "member this.M(p") [] let ``Completion list on abstract member type signature contains modules and types but not keywords or functions`` = @@ -941,6 +942,7 @@ type T(p:int, h) = """ VerifyNoCompletionList(fileContents, "type T(p:int, h") + VerifyNoCompletionList(fileContents, "type T(p") [] let ``Provide completion on implicit constructor argument type hint`` () = @@ -1583,3 +1585,123 @@ x[0]. """ VerifyCompletionListExactly(fileContents, "x[0].", [ "Foo"; "Goo"; "Equals"; "GetHashCode"; "GetType"; "ToString" ]) + + [] + let ``Completion list contains suggested names for union case field pattern with one field, and no valrefs other than literals`` () = + let fileContents = + """ +let logV = 1 +let [] logLit = 1 + +type DU = A of logField: int + +match A 1 with +| A l -> () +""" + + VerifyCompletionList(fileContents, "| A l", [ "logField"; "logLit"; "num" ], [ "logV"; "log" ]) + + [] + let ``Completion list contains suggested names for union case field pattern in a match clause unless the field name is generated`` () = + let fileContents = + """ +type Du = + | C of first: Du * rest: Du list + | D of int + +let x du = + match du with + | C (f, [ D i; C (first = s) ]) -> () + | C (rest = r) -> () + | _ -> () +""" + + VerifyCompletionList(fileContents, "| C (f", [ "first"; "du" ], [ "rest"; "item"; "num" ]) + VerifyCompletionList(fileContents, "| C (f, [ D i", [ "num" ], [ "rest"; "first"; "du"; "item" ]) + VerifyCompletionList(fileContents, "| C (f, [ D i; C (first = s", [ "first"; "du" ], [ "rest"; "num" ]) + VerifyCompletionList(fileContents, "| C (rest = r", [ "rest"; "list" ], [ "first"; "du"; "item"; "num" ]) + + [] + let ``Completion list does not contain suggested names which are already used in the same pattern`` () = + let fileContents = + """ +type Du = + | C of first: string option * rest: Du list + +let x (du: Du list) = + match du with + | [ C (first = first); C (first = f) ] -> () + | [ C (first, rest); C (f, l) ] -> () + | _ -> () +""" + + VerifyCompletionList(fileContents, "| [ C (first = first); C (first = f", [ "option" ], [ "first" ]) + VerifyCompletionList(fileContents, "| [ C (first, rest); C (f", [ "option" ], [ "first" ]) + VerifyCompletionList(fileContents, "| [ C (first, rest); C (f, l", [ "list" ], [ "rest" ]) + + [] + let ``Completion list contains suggested names for union case field pattern in a let binding, lambda and member`` () = + let fileContents = + """ +type Ids = Ids of customerId: int * orderId: string option + +let x (Ids (c)) = () +let xy (Ids (c, o)) = () +let xyz (Ids c) = () + +fun (Ids (c, o)) -> () +fun (Some v) -> () + +type C = + member _.M (Ids (c, o)) = () +""" + + VerifyCompletionList(fileContents, "let x (Ids (c", [ "customerId"; "num" ], []) + VerifyCompletionList(fileContents, "let xy (Ids (c", [ "customerId"; "num" ], []) + VerifyCompletionList(fileContents, "let xy (Ids (c, o", [ "orderId"; "option" ], []) + VerifyCompletionList(fileContents, "let xyz (Ids c", [ "option" ], [ "customerId"; "orderId"; "num" ]) // option is on the list as a type + VerifyCompletionList(fileContents, "fun (Ids (c", [ "customerId"; "num" ], []) + VerifyCompletionList(fileContents, "fun (Ids (c, o", [ "orderId"; "option" ], []) + VerifyCompletionList(fileContents, "fun (Some v", [ "value" ], []) + VerifyCompletionList(fileContents, "member _.M (Ids (c", [ "customerId"; "num" ], [ "orderId" ]) + VerifyCompletionList(fileContents, "member _.M (Ids (c, o", [ "orderId"; "option" ], [ "customerId"; "num" ]) + + [] + let ``Completion list does not contain suggested names in tuple deconstruction`` () = + let fileContents = + """ +match Some (1, 2) with +| Some v -> () +| Some (a, b) -> () +| Some (c) -> () +""" + + VerifyCompletionList(fileContents, "| Some v", [ "value" ], []) + VerifyCompletionList(fileContents, "| Some (a", [], [ "value" ]) + VerifyCompletionList(fileContents, "| Some (a, b", [], [ "value" ]) + VerifyCompletionList(fileContents, "| Some (c", [], [ "value" ]) + + [] + let ``Completion list contains suggested names for union case field pattern based on the name of the generic type's solution`` () = + let fileContents = + """ +type Tab = + | A + | B + +match Some A with +| Some a -> () + +type G<'x, 'y> = + | U1 of xxx: 'x * yyy: 'y + | U2 of fff: string + +match U1 (1, A) with +| U2 s -> () +| U1 (x, y) -> () +""" + + VerifyCompletionList(fileContents, "| Some a", [ "value"; "tab" ], []) + VerifyCompletionList(fileContents, "| U2 s", [ "fff"; "string" ], [ "tab"; "xxx"; "yyy" ]) + VerifyCompletionList(fileContents, "| U1 (x", [ "xxx"; "num" ], [ "tab"; "yyy"; "fff" ]) + VerifyCompletionList(fileContents, "| U1 (x, y", [ "yyy"; "tab" ], [ "xxx"; "num"; "fff" ]) From 92ba60ee860d9ce61ecafd4a2afc8cd752f8df72 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 21 Jul 2023 15:43:08 +0200 Subject: [PATCH 2/2] [main] Update dependencies from dotnet/arcade (#15659) Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.23369.2 -> To Version 8.0.0-beta.23370.6 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/common/sdl/configure-sdl-tool.ps1 | 4 +++- global.json | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6ede2fe4782..1e409c20744 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -29,9 +29,9 @@ - + https://github.com/dotnet/arcade - 9fba71ca242ef84c4b7696c380cc00efe734adb3 + a2d7c72df5b2e36b0f69bbe12ad4d7c52793c745 diff --git a/eng/common/sdl/configure-sdl-tool.ps1 b/eng/common/sdl/configure-sdl-tool.ps1 index e4108e39d9a..27f5a4115fc 100644 --- a/eng/common/sdl/configure-sdl-tool.ps1 +++ b/eng/common/sdl/configure-sdl-tool.ps1 @@ -93,7 +93,9 @@ try { } 'binskim' { if ($targetDirectory) { - $tool.Args += "`"Target < $TargetDirectory\**`"" + # Binskim crashes due to specific PDBs. GitHub issue: https://github.com/microsoft/binskim/issues/924. + # We are excluding all `_.pdb` files from the scan. + $tool.Args += "`"Target < $TargetDirectory\**;-:file|$TargetDirectory\**\_.pdb`"" } $tool.Args += $BinskimAdditionalRunConfigParams } diff --git a/global.json b/global.json index 580f68b043a..4bee94e7d71 100644 --- a/global.json +++ b/global.json @@ -18,7 +18,7 @@ "perl": "5.32.1.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23369.2", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23370.6", "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2" } }