From 2a02c121cfcb586fe64cfdf3a6b2a88d68c861e7 Mon Sep 17 00:00:00 2001 From: Marc Huisinga Date: Tue, 22 Oct 2024 18:10:57 +0200 Subject: [PATCH] feat: structure auto-completion & partial `InfoTree`s --- src/Init/Meta.lean | 28 + src/Init/Prelude.lean | 25 +- src/Lean/Data/Lsp/Basic.lean | 3 +- src/Lean/Data/Lsp/LanguageFeatures.lean | 8 +- src/Lean/Elab/App.lean | 16 +- src/Lean/Elab/BuiltinTerm.lean | 13 +- src/Lean/Elab/Extra.lean | 28 +- src/Lean/Elab/InfoTree/Main.lean | 59 +- src/Lean/Elab/InfoTree/Types.lean | 23 +- src/Lean/Elab/LetRec.lean | 9 +- src/Lean/Elab/Match.lean | 2 +- src/Lean/Elab/MutualDef.lean | 44 +- src/Lean/Elab/Term.lean | 60 +- src/Lean/Linter/UnusedVariables.lean | 21 +- src/Lean/Server/Completion.lean | 605 ++++++++++++----- .../Server/FileWorker/RequestHandling.lean | 13 +- src/Lean/Server/InfoUtils.lean | 2 + .../1018unknowMVarIssue.lean.expected.out | 1 + tests/lean/instance1.lean.expected.out | 2 +- tests/lean/interactive/1265.lean.expected.out | 60 +- tests/lean/interactive/1659.lean.expected.out | 39 +- tests/lean/interactive/4880.lean.expected.out | 12 +- tests/lean/interactive/533.lean.expected.out | 6 +- tests/lean/interactive/863.lean.expected.out | 12 +- .../interactive/compHeader.lean.expected.out | 6 +- .../compNamespace.lean.expected.out | 15 +- .../interactive/completion.lean.expected.out | 12 +- .../interactive/completion2.lean.expected.out | 45 +- .../interactive/completion3.lean.expected.out | 36 +- .../interactive/completion4.lean.expected.out | 36 +- .../interactive/completion5.lean.expected.out | 9 +- .../interactive/completion6.lean.expected.out | 33 +- .../interactive/completion7.lean.expected.out | 12 +- .../completionAtPrint.lean.expected.out | 6 +- .../completionCheck.lean.expected.out | 6 +- .../completionDeprecation.lean.expected.out | 24 +- .../completionDocString.lean.expected.out | 6 +- .../completionEOF.lean.expected.out | 3 +- .../completionFallback.lean.expected.out | 27 +- ...mpletionFromExpectedType.lean.expected.out | 3 +- .../completionIStr.lean.expected.out | 9 +- ...completionOpenNamespaces.lean.expected.out | 4 +- .../completionOption.lean.expected.out | 93 ++- .../completionPrefixIssue.lean.expected.out | 6 +- .../completionPrivateTypes.lean.expected.out | 3 +- .../completionPrv.lean.expected.out | 42 +- .../completionStructureInstance.lean | 96 +++ ...pletionStructureInstance.lean.expected.out | 612 ++++++++++++++++++ .../completionTactics.lean.expected.out | 408 ++++++++---- .../dotIdCompletion.lean.expected.out | 6 +- .../editCompletion.lean.expected.out | 3 +- .../inWordCompletion.lean.expected.out | 18 +- .../internalNamesIssue.lean.expected.out | 6 +- .../keywordCompletion.lean.expected.out | 21 +- .../lean/interactive/match.lean.expected.out | 18 +- .../matchStxCompletion.lean.expected.out | 9 +- .../travellingCompletions.lean.expected.out | 18 +- 57 files changed, 2117 insertions(+), 625 deletions(-) create mode 100644 tests/lean/interactive/completionStructureInstance.lean create mode 100644 tests/lean/interactive/completionStructureInstance.lean.expected.out diff --git a/src/Init/Meta.lean b/src/Init/Meta.lean index 146b068820..4b25a919e8 100644 --- a/src/Init/Meta.lean +++ b/src/Init/Meta.lean @@ -374,6 +374,9 @@ partial def structEq : Syntax → Syntax → Bool instance : BEq Lean.Syntax := ⟨structEq⟩ instance : BEq (Lean.TSyntax k) := ⟨(·.raw == ·.raw)⟩ +/-- +Finds the first `SourceInfo` from the back of `stx` or `none` if no `SourceInfo` can be found. +-/ partial def getTailInfo? : Syntax → Option SourceInfo | atom info _ => info | ident info .. => info @@ -382,14 +385,39 @@ partial def getTailInfo? : Syntax → Option SourceInfo | node info _ _ => info | _ => none +/-- +Finds the first `SourceInfo` from the back of `stx` or `SourceInfo.none` +if no `SourceInfo` can be found. +-/ def getTailInfo (stx : Syntax) : SourceInfo := stx.getTailInfo?.getD SourceInfo.none +/-- +Finds the trailing size of the first `SourceInfo` from the back of `stx`. +If no `SourceInfo` can be found or the first `SourceInfo` from the back of `stx` contains no +trailing whitespace, the result is `0`. +-/ def getTrailingSize (stx : Syntax) : Nat := match stx.getTailInfo? with | some (SourceInfo.original (trailing := trailing) ..) => trailing.bsize | _ => 0 +/-- +Finds the trailing whitespace substring of the first `SourceInfo` from the back of `stx`. +If no `SourceInfo` can be found or the first `SourceInfo` from the back of `stx` contains +no trailing whitespace, the result is `none`. +-/ +def getTrailing? (stx : Syntax) : Option Substring := + stx.getTailInfo.getTrailing? + +/-- +Finds the tail position of the trailing whitespace of the first `SourceInfo` from the back of `stx`. +If no `SourceInfo` can be found or the first `SourceInfo` from the back of `stx` contains +no trailing whitespace and lacks a tail position, the result is `none`. +-/ +def getTrailingTailPos? (stx : Syntax) (canonicalOnly := false) : Option String.Pos := + stx.getTailInfo.getTrailingTailPos? canonicalOnly + /-- Return substring of original input covering `stx`. Result is meaningful only if all involved `SourceInfo.original`s refer to the same string (as is the case after parsing). -/ diff --git a/src/Init/Prelude.lean b/src/Init/Prelude.lean index 39618b16d1..35fd5c7ca4 100644 --- a/src/Init/Prelude.lean +++ b/src/Init/Prelude.lean @@ -3654,7 +3654,8 @@ namespace SourceInfo /-- Gets the position information from a `SourceInfo`, if available. -If `originalOnly` is true, then `.synthetic` syntax will also return `none`. +If `canonicalOnly` is true, then `.synthetic` syntax with `canonical := false` +will also return `none`. -/ def getPos? (info : SourceInfo) (canonicalOnly := false) : Option String.Pos := match info, canonicalOnly with @@ -3665,7 +3666,8 @@ def getPos? (info : SourceInfo) (canonicalOnly := false) : Option String.Pos := /-- Gets the end position information from a `SourceInfo`, if available. -If `originalOnly` is true, then `.synthetic` syntax will also return `none`. +If `canonicalOnly` is true, then `.synthetic` syntax with `canonical := false` +will also return `none`. -/ def getTailPos? (info : SourceInfo) (canonicalOnly := false) : Option String.Pos := match info, canonicalOnly with @@ -3674,6 +3676,24 @@ def getTailPos? (info : SourceInfo) (canonicalOnly := false) : Option String.Pos | synthetic (endPos := endPos) .., false => some endPos | _, _ => none +/-- +Gets the substring representing the trailing whitespace of a `SourceInfo`, if available. +-/ +def getTrailing? (info : SourceInfo) : Option Substring := + match info with + | original (trailing := trailing) .. => some trailing + | _ => none + +/-- +Gets the end position information of the trailing whitespace of a `SourceInfo`, if available. +If `canonicalOnly` is true, then `.synthetic` syntax with `canonical := false` +will also return `none`. +-/ +def getTrailingTailPos? (info : SourceInfo) (canonicalOnly := false) : Option String.Pos := + match info.getTrailing? with + | some trailing => some trailing.stopPos + | none => info.getTailPos? canonicalOnly + end SourceInfo /-- @@ -3972,7 +3992,6 @@ position information. def getPos? (stx : Syntax) (canonicalOnly := false) : Option String.Pos := stx.getHeadInfo.getPos? canonicalOnly - /-- Get the ending position of the syntax, if possible. If `canonicalOnly` is true, non-canonical `synthetic` nodes are treated as not carrying diff --git a/src/Lean/Data/Lsp/Basic.lean b/src/Lean/Data/Lsp/Basic.lean index 2403101173..55fb5dd8ab 100644 --- a/src/Lean/Data/Lsp/Basic.lean +++ b/src/Lean/Data/Lsp/Basic.lean @@ -365,6 +365,7 @@ structure TextDocumentRegistrationOptions where inductive MarkupKind where | plaintext | markdown + deriving DecidableEq, Hashable instance : FromJson MarkupKind := ⟨fun | str "plaintext" => Except.ok MarkupKind.plaintext @@ -378,7 +379,7 @@ instance : ToJson MarkupKind := ⟨fun structure MarkupContent where kind : MarkupKind value : String - deriving ToJson, FromJson + deriving ToJson, FromJson, DecidableEq, Hashable /-- Reference to the progress of some in-flight piece of work. diff --git a/src/Lean/Data/Lsp/LanguageFeatures.lean b/src/Lean/Data/Lsp/LanguageFeatures.lean index f5c46a13d6..038d200e4d 100644 --- a/src/Lean/Data/Lsp/LanguageFeatures.lean +++ b/src/Lean/Data/Lsp/LanguageFeatures.lean @@ -25,7 +25,7 @@ inductive CompletionItemKind where | unit | value | enum | keyword | snippet | color | file | reference | folder | enumMember | constant | struct | event | operator | typeParameter - deriving Inhabited, DecidableEq, Repr + deriving Inhabited, DecidableEq, Repr, Hashable instance : ToJson CompletionItemKind where toJson a := toJson (a.toCtorIdx + 1) @@ -39,11 +39,11 @@ structure InsertReplaceEdit where newText : String insert : Range replace : Range - deriving FromJson, ToJson + deriving FromJson, ToJson, BEq, Hashable inductive CompletionItemTag where | deprecated - deriving Inhabited, DecidableEq, Repr + deriving Inhabited, DecidableEq, Repr, Hashable instance : ToJson CompletionItemTag where toJson t := toJson (t.toCtorIdx + 1) @@ -73,7 +73,7 @@ structure CompletionItem where commitCharacters? : string[] command? : Command -/ - deriving FromJson, ToJson, Inhabited + deriving FromJson, ToJson, Inhabited, BEq, Hashable structure CompletionList where isIncomplete : Bool diff --git a/src/Lean/Elab/App.lean b/src/Lean/Elab/App.lean index e68ba7362b..cde308ac04 100644 --- a/src/Lean/Elab/App.lean +++ b/src/Lean/Elab/App.lean @@ -1399,8 +1399,8 @@ private def elabAppLValsAux (namedArgs : Array NamedArg) (args : Array Arg) (exp let rec loop : Expr → List LVal → TermElabM Expr | f, [] => elabAppArgs f namedArgs args expectedType? explicit ellipsis | f, lval::lvals => do - if let LVal.fieldName (fullRef := fullRef) .. := lval then - addDotCompletionInfo fullRef f expectedType? + if let LVal.fieldName (ref := ref) .. := lval then + addDotCompletionInfo ref f expectedType? let hasArgs := !namedArgs.isEmpty || !args.isEmpty let (f, lvalRes) ← resolveLVal f lval hasArgs match lvalRes with @@ -1648,8 +1648,16 @@ private def getSuccesses (candidates : Array (TermElabResult Expr)) : TermElabM Throw an error message that describes why each possible interpretation for the overloaded notation and symbols did not work. We use a nested error message to aggregate the exceptions produced by each failure. -/ -private def mergeFailures (failures : Array (TermElabResult Expr)) : TermElabM α := do +private def mergeFailures (f : Syntax) (failures : Array (TermElabResult Expr)) : TermElabM α := do let exs := failures.map fun | .error ex _ => ex | _ => unreachable! + let trees := failures.map (fun | .error _ s => s.meta.core.infoState.trees | _ => unreachable!) + |>.filterMap (·[0]?) + -- Retain partial `InfoTree` subtrees in an `.ofChoiceInfo` node in case of multiple failures. + -- This ensures that the language server still has `Info` to work with when multiple overloaded + -- elaborators fail. + withInfoContext (mkInfo := pure <| .ofChoiceInfo { elaborator := .anonymous, stx := f}) do + for tree in trees do + pushInfoTree tree throwErrorWithNestedErrors "overloaded" exs private def elabAppAux (f : Syntax) (namedArgs : Array NamedArg) (args : Array Arg) (ellipsis : Bool) (expectedType? : Option Expr) : TermElabM Expr := do @@ -1669,7 +1677,7 @@ private def elabAppAux (f : Syntax) (namedArgs : Array NamedArg) (args : Array A | _ => unreachable! throwErrorAt f "ambiguous, possible interpretations {toMessageList msgs}" else - withRef f <| mergeFailures candidates + withRef f <| mergeFailures f candidates /-- We annotate recursive applications with their `Syntax` node to make sure we can produce error messages with diff --git a/src/Lean/Elab/BuiltinTerm.lean b/src/Lean/Elab/BuiltinTerm.lean index f9a225b9b6..3fd9fbae3a 100644 --- a/src/Lean/Elab/BuiltinTerm.lean +++ b/src/Lean/Elab/BuiltinTerm.lean @@ -42,16 +42,15 @@ private def elabOptLevel (stx : Syntax) : TermElabM Level := @[builtin_term_elab «completion»] def elabCompletion : TermElab := fun stx expectedType? => do /- `ident.` is ambiguous in Lean, we may try to be completing a declaration name or access a "field". -/ if stx[0].isIdent then - /- If we can elaborate the identifier successfully, we assume it is a dot-completion. Otherwise, we treat it as - identifier completion with a dangling `.`. - Recall that the server falls back to identifier completion when dot-completion fails. -/ + -- Add both an `id` and a `dot` `CompletionInfo` and have the language server figure out which + -- one to use. + addCompletionInfo <| CompletionInfo.id stx stx[0].getId (danglingDot := true) (← getLCtx) expectedType? let s ← saveState try let e ← elabTerm stx[0] none addDotCompletionInfo stx e expectedType? catch _ => s.restore - addCompletionInfo <| CompletionInfo.id stx stx[0].getId (danglingDot := true) (← getLCtx) expectedType? throwErrorAt stx[1] "invalid field notation, identifier or numeral expected" else elabPipeCompletion stx expectedType? @@ -328,7 +327,11 @@ private def mkSilentAnnotationIfHole (e : Expr) : TermElabM Expr := do @[builtin_term_elab withAnnotateTerm] def elabWithAnnotateTerm : TermElab := fun stx expectedType? => do match stx with | `(with_annotate_term $stx $e) => - withInfoContext' stx (elabTerm e expectedType?) (mkTermInfo .anonymous (expectedType? := expectedType?) stx) + withInfoContext' + stx + (elabTerm e expectedType?) + (mkTermInfo .anonymous (expectedType? := expectedType?) stx) + (mkPartialTermInfo .anonymous (expectedType? := expectedType?) stx) | _ => throwUnsupportedSyntax private unsafe def evalFilePathUnsafe (stx : Syntax) : TermElabM System.FilePath := diff --git a/src/Lean/Elab/Extra.lean b/src/Lean/Elab/Extra.lean index 38372ebae9..2000936cb3 100644 --- a/src/Lean/Elab/Extra.lean +++ b/src/Lean/Elab/Extra.lean @@ -327,15 +327,29 @@ private def toExprCore (t : Tree) : TermElabM Expr := do | .term _ trees e => modifyInfoState (fun s => { s with trees := s.trees ++ trees }); return e | .binop ref kind f lhs rhs => - withRef ref <| withInfoContext' ref (mkInfo := mkTermInfo .anonymous ref) do - mkBinOp (kind == .lazy) f (← toExprCore lhs) (← toExprCore rhs) + withRef ref <| + withInfoContext' + ref + (mkInfo := mkTermInfo .anonymous ref) + (mkInfoOnError := mkPartialTermInfo .anonymous ref) + do + mkBinOp (kind == .lazy) f (← toExprCore lhs) (← toExprCore rhs) | .unop ref f arg => - withRef ref <| withInfoContext' ref (mkInfo := mkTermInfo .anonymous ref) do - mkUnOp f (← toExprCore arg) + withRef ref <| + withInfoContext' + ref + (mkInfo := mkTermInfo .anonymous ref) + (mkInfoOnError := mkPartialTermInfo .anonymous ref) + do + mkUnOp f (← toExprCore arg) | .macroExpansion macroName stx stx' nested => - withRef stx <| withInfoContext' stx (mkInfo := mkTermInfo macroName stx) do - withMacroExpansion stx stx' do - toExprCore nested + withRef stx <| + withInfoContext' + stx + (mkInfo := mkTermInfo macroName stx) + (mkInfoOnError := mkPartialTermInfo macroName stx) <| + withMacroExpansion stx stx' <| + toExprCore nested /-- Auxiliary function to decide whether we should coerce `f`'s argument to `maxType` or not. diff --git a/src/Lean/Elab/InfoTree/Main.lean b/src/Lean/Elab/InfoTree/Main.lean index 5ba988886f..eb129079d4 100644 --- a/src/Lean/Elab/InfoTree/Main.lean +++ b/src/Lean/Elab/InfoTree/Main.lean @@ -139,12 +139,16 @@ def TermInfo.runMetaM (info : TermInfo) (ctx : ContextInfo) (x : MetaM α) : IO def TermInfo.format (ctx : ContextInfo) (info : TermInfo) : IO Format := do info.runMetaM ctx do - let ty : Format ← try - Meta.ppExpr (← Meta.inferType info.expr) - catch _ => - pure "" + let ty : Format ← + try + Meta.ppExpr (← Meta.inferType info.expr) + catch _ => + pure "" return f!"{← Meta.ppExpr info.expr} {if info.isBinder then "(isBinder := true) " else ""}: {ty} @ {formatElabInfo ctx info.toElabInfo}" +def PartialTermInfo.format (ctx : ContextInfo) (info : PartialTermInfo) : Format := + f!"Partial term @ {formatElabInfo ctx info.toElabInfo}" + def CompletionInfo.format (ctx : ContextInfo) (info : CompletionInfo) : IO Format := match info with | .dot i (expectedType? := expectedType?) .. => return f!"[.] {← i.format ctx} : {expectedType?}" @@ -191,9 +195,13 @@ def FieldRedeclInfo.format (ctx : ContextInfo) (info : FieldRedeclInfo) : Format def OmissionInfo.format (ctx : ContextInfo) (info : OmissionInfo) : IO Format := do return f!"Omission @ {← TermInfo.format ctx info.toTermInfo}\nReason: {info.reason}" +def ChoiceInfo.format (ctx : ContextInfo) (info : ChoiceInfo) : Format := + f!"Choice @ {formatElabInfo ctx info.toElabInfo}" + def Info.format (ctx : ContextInfo) : Info → IO Format | ofTacticInfo i => i.format ctx | ofTermInfo i => i.format ctx + | ofPartialTermInfo i => pure <| i.format ctx | ofCommandInfo i => i.format ctx | ofMacroExpansionInfo i => i.format ctx | ofOptionInfo i => i.format ctx @@ -204,10 +212,12 @@ def Info.format (ctx : ContextInfo) : Info → IO Format | ofFVarAliasInfo i => pure <| i.format | ofFieldRedeclInfo i => pure <| i.format ctx | ofOmissionInfo i => i.format ctx + | ofChoiceInfo i => pure <| i.format ctx def Info.toElabInfo? : Info → Option ElabInfo | ofTacticInfo i => some i.toElabInfo | ofTermInfo i => some i.toElabInfo + | ofPartialTermInfo i => some i.toElabInfo | ofCommandInfo i => some i.toElabInfo | ofMacroExpansionInfo _ => none | ofOptionInfo _ => none @@ -218,6 +228,7 @@ def Info.toElabInfo? : Info → Option ElabInfo | ofFVarAliasInfo _ => none | ofFieldRedeclInfo _ => none | ofOmissionInfo i => some i.toElabInfo + | ofChoiceInfo i => some i.toElabInfo /-- Helper function for propagating the tactic metavariable context to its children nodes. @@ -311,24 +322,36 @@ def realizeGlobalNameWithInfos (ref : Syntax) (id : Name) : CoreM (List (Name × addConstInfo ref n return ns -/-- Use this to descend a node on the infotree that is being built. +/-- +Adds a node containing the `InfoTree`s generated by `x` to the `InfoTree`s in `m`. -It saves the current list of trees `t₀` and resets it and then runs `x >>= mkInfo`, producing either an `i : Info` or a hole id. -Running `x >>= mkInfo` will modify the trees state and produce a new list of trees `t₁`. -In the `i : Info` case, `t₁` become the children of a node `node i t₁` that is appended to `t₀`. - -/ -def withInfoContext' [MonadFinally m] (x : m α) (mkInfo : α → m (Sum Info MVarId)) : m α := do +If `x` succeeds and `mkInfo` yields an `Info`, the `InfoTree`s of `x` become subtrees of a node +containing the `Info` produced by `mkInfo`, which is then added to the `InfoTree`s in `m`. +If `x` succeeds and `mkInfo` yields an `MVarId`, the `InfoTree`s of `x` are discarded and a `hole` +node is added to the `InfoTree`s in `m`. +If `x` fails, the `InfoTree`s of `x` become subtrees of a node containing the `Info` produced by +`mkInfoOnError`, which is then added to the `InfoTree`s in `m`. + +The `InfoTree`s in `m` are reset before `x` is executed and restored with the addition of a new tree +after `x` is executed. +-/ +def withInfoContext' + [MonadFinally m] + (x : m α) + (mkInfo : α → m (Sum Info MVarId)) + (mkInfoOnError : m Info) : + m α := do if (← getInfoState).enabled then let treesSaved ← getResetInfoTrees Prod.fst <$> MonadFinally.tryFinally' x fun a? => do - match a? with - | none => modifyInfoTrees fun _ => treesSaved - | some a => - let info ← mkInfo a - modifyInfoTrees fun trees => - match info with - | Sum.inl info => treesSaved.push <| InfoTree.node info trees - | Sum.inr mvarId => treesSaved.push <| InfoTree.hole mvarId + let info ← do + match a? with + | none => pure <| .inl <| ← mkInfoOnError + | some a => mkInfo a + modifyInfoTrees fun trees => + match info with + | Sum.inl info => treesSaved.push <| InfoTree.node info trees + | Sum.inr mvarId => treesSaved.push <| InfoTree.hole mvarId else x diff --git a/src/Lean/Elab/InfoTree/Types.lean b/src/Lean/Elab/InfoTree/Types.lean index 02a189bb28..5ecdd7dde9 100644 --- a/src/Lean/Elab/InfoTree/Types.lean +++ b/src/Lean/Elab/InfoTree/Types.lean @@ -70,6 +70,18 @@ structure TermInfo extends ElabInfo where isBinder : Bool := false deriving Inhabited +/-- +Used instead of `TermInfo` when a term couldn't successfully be elaborated, +and so there is no complete expression available. + +The main purpose of `PartialTermInfo` is to ensure that the sub-`InfoTree`s of a failed elaborator +are retained so that they can still be used in the language server. +-/ +structure PartialTermInfo extends ElabInfo where + lctx : LocalContext -- The local context when the term was elaborated. + expectedType? : Option Expr + deriving Inhabited + structure CommandInfo extends ElabInfo where deriving Inhabited @@ -79,7 +91,7 @@ inductive CompletionInfo where | dot (termInfo : TermInfo) (expectedType? : Option Expr) | id (stx : Syntax) (id : Name) (danglingDot : Bool) (lctx : LocalContext) (expectedType? : Option Expr) | dotId (stx : Syntax) (id : Name) (lctx : LocalContext) (expectedType? : Option Expr) - | fieldId (stx : Syntax) (id : Name) (lctx : LocalContext) (structName : Name) + | fieldId (stx : Syntax) (id : Option Name) (lctx : LocalContext) (structName : Name) | namespaceId (stx : Syntax) | option (stx : Syntax) | endSection (stx : Syntax) (scopeNames : List String) @@ -165,10 +177,18 @@ regular delaboration settings. structure OmissionInfo extends TermInfo where reason : String +/-- +Indicates that all overloaded elaborators failed. The subtrees of a `ChoiceInfo` node are the +partial `InfoTree`s of those failed elaborators. Retaining these partial `InfoTree`s helps +the language server provide interactivity even when all overloaded elaborators failed. +-/ +structure ChoiceInfo extends ElabInfo where + /-- Header information for a node in `InfoTree`. -/ inductive Info where | ofTacticInfo (i : TacticInfo) | ofTermInfo (i : TermInfo) + | ofPartialTermInfo (i : PartialTermInfo) | ofCommandInfo (i : CommandInfo) | ofMacroExpansionInfo (i : MacroExpansionInfo) | ofOptionInfo (i : OptionInfo) @@ -179,6 +199,7 @@ inductive Info where | ofFVarAliasInfo (i : FVarAliasInfo) | ofFieldRedeclInfo (i : FieldRedeclInfo) | ofOmissionInfo (i : OmissionInfo) + | ofChoiceInfo (i : ChoiceInfo) deriving Inhabited /-- The InfoTree is a structure that is generated during elaboration and used diff --git a/src/Lean/Elab/LetRec.lean b/src/Lean/Elab/LetRec.lean index 03c2adc497..22663d0055 100644 --- a/src/Lean/Elab/LetRec.lean +++ b/src/Lean/Elab/LetRec.lean @@ -90,9 +90,12 @@ private def elabLetRecDeclValues (view : LetRecView) : TermElabM (Array Expr) := for i in [0:view.binderIds.size] do addLocalVarInfo view.binderIds[i]! xs[i]! withDeclName view.declName do - withInfoContext' view.valStx (mkInfo := (pure <| .inl <| mkBodyInfo view.valStx ·)) do - let value ← elabTermEnsuringType view.valStx type - mkLambdaFVars xs value + withInfoContext' view.valStx + (mkInfo := (pure <| .inl <| mkBodyInfo view.valStx ·)) + (mkInfoOnError := (pure <| mkBodyInfo view.valStx none)) + do + let value ← elabTermEnsuringType view.valStx type + mkLambdaFVars xs value private def registerLetRecsToLift (views : Array LetRecDeclView) (fvars : Array Expr) (values : Array Expr) : TermElabM Unit := do let letRecsToLiftCurr := (← get).letRecsToLift diff --git a/src/Lean/Elab/Match.lean b/src/Lean/Elab/Match.lean index e9e1085a94..3fb9c33c86 100644 --- a/src/Lean/Elab/Match.lean +++ b/src/Lean/Elab/Match.lean @@ -644,7 +644,7 @@ where if inaccessible? p |>.isSome then return mkMData k (← withReader (fun _ => true) (go b)) else if let some (stx, p) := patternWithRef? p then - Elab.withInfoContext' (go p) fun p => do + Elab.withInfoContext' (go p) (mkInfoOnError := mkPartialTermInfo .anonymous stx) fun p => do /- If `p` is a free variable and we are not inside of an "inaccessible" pattern, this `p` is a binder. -/ mkTermInfo Name.anonymous stx p (isBinder := p.isFVar && !(← read)) else diff --git a/src/Lean/Elab/MutualDef.lean b/src/Lean/Elab/MutualDef.lean index d31248655b..098b015256 100644 --- a/src/Lean/Elab/MutualDef.lean +++ b/src/Lean/Elab/MutualDef.lean @@ -283,7 +283,7 @@ private partial def withFunLocalDecls {α} (headers : Array DefViewElabHeader) ( loop 0 #[] private def expandWhereStructInst : Macro - | `(Parser.Command.whereStructInst|where $[$decls:letDecl];* $[$whereDecls?:whereDecls]?) => do + | whereStx@`(Parser.Command.whereStructInst|where%$whereTk $[$decls:letDecl];* $[$whereDecls?:whereDecls]?) => do let letIdDecls ← decls.mapM fun stx => match stx with | `(letDecl|$_decl:letPatDecl) => Macro.throwErrorAt stx "patterns are not allowed here" | `(letDecl|$decl:letEqnsDecl) => expandLetEqnsDecl decl (useExplicit := false) @@ -300,7 +300,32 @@ private def expandWhereStructInst : Macro `(structInstField|$id:ident := $val) | stx@`(letIdDecl|_ $_* $[: $_]? := $_) => Macro.throwErrorAt stx "'_' is not allowed here" | _ => Macro.throwUnsupported - let body ← `(structInst| { $structInstFields,* }) + + let startOfStructureTkInfo : SourceInfo := + match whereTk.getPos? with + | some pos => .synthetic pos ⟨pos.byteIdx + 1⟩ true + | none => .none + let startOfStructureTk : Syntax := .atom startOfStructureTkInfo "{" + + -- Position the closing `}` at the end of the trailing whitespace of `where $[$_:letDecl];*`. + -- We need an accurate range of the generated structure instance for structure field completion. + let structureStxTailInfo := + whereStx[1].getTailInfo? + <|> whereStx[0].getTailInfo? + let endOfStructureTkInfo : SourceInfo := + match structureStxTailInfo with + | some (SourceInfo.original _ _ trailing _) => + let tokenPos := trailing.str.prev trailing.stopPos + let tokenEndPos := trailing.stopPos + .synthetic tokenPos tokenEndPos true + | _ => .none + let endOfStructureTk : Syntax := .atom endOfStructureTkInfo "}" + + let body ← `(structInst| {%$startOfStructureTk $structInstFields,* }%$endOfStructureTk) + let body := body.raw.setInfo <| + match startOfStructureTkInfo.getPos?, endOfStructureTkInfo.getTailPos? with + | some startPos, some endPos => .synthetic startPos endPos true + | _, _ => .none match whereDecls? with | some whereDecls => expandWhereDecls whereDecls body | none => return body @@ -417,12 +442,15 @@ private def elabFunValues (headers : Array DefViewElabHeader) (vars : Array Expr -- Store instantiated body in info tree for the benefit of the unused variables linter -- and other metaprograms that may want to inspect it without paying for the instantiation -- again - withInfoContext' valStx (mkInfo := (pure <| .inl <| mkBodyInfo valStx ·)) do - -- synthesize mvars here to force the top-level tactic block (if any) to run - let val ← elabTermEnsuringType valStx type <* synthesizeSyntheticMVarsNoPostponing - -- NOTE: without this `instantiatedMVars`, `mkLambdaFVars` may leave around a redex that - -- leads to more section variables being included than necessary - instantiateMVarsProfiling val + withInfoContext' valStx + (mkInfo := (pure <| .inl <| mkBodyInfo valStx ·)) + (mkInfoOnError := (pure <| mkBodyInfo valStx none)) + do + -- synthesize mvars here to force the top-level tactic block (if any) to run + let val ← elabTermEnsuringType valStx type <* synthesizeSyntheticMVarsNoPostponing + -- NOTE: without this `instantiatedMVars`, `mkLambdaFVars` may leave around a redex that + -- leads to more section variables being included than necessary + instantiateMVarsProfiling val let val ← mkLambdaFVars xs val if linter.unusedSectionVars.get (← getOptions) && !header.type.hasSorry && !val.hasSorry then let unusedVars ← vars.filterMapM fun var => do diff --git a/src/Lean/Elab/Term.lean b/src/Lean/Elab/Term.lean index 62e688d215..5bc29658bf 100644 --- a/src/Lean/Elab/Term.lean +++ b/src/Lean/Elab/Term.lean @@ -1298,13 +1298,28 @@ def isTacticOrPostponedHole? (e : Expr) : TermElabM (Option MVarId) := do | _ => return none | _ => pure none -def mkTermInfo (elaborator : Name) (stx : Syntax) (e : Expr) (expectedType? : Option Expr := none) (lctx? : Option LocalContext := none) (isBinder := false) : TermElabM (Sum Info MVarId) := do +def mkTermInfo + (elaborator : Name) + (stx : Syntax) + (e : Expr) + (expectedType? : Option Expr := none) + (lctx? : Option LocalContext := none) + (isBinder := false) : + TermElabM (Sum Info MVarId) := do match (← isTacticOrPostponedHole? e) with | some mvarId => return Sum.inr mvarId | none => let e := removeSaveInfoAnnotation e return Sum.inl <| Info.ofTermInfo { elaborator, lctx := lctx?.getD (← getLCtx), expr := e, stx, expectedType?, isBinder } +def mkPartialTermInfo + (elaborator : Name) + (stx : Syntax) + (expectedType? : Option Expr := none) + (lctx? : Option LocalContext := none) : + TermElabM Info := do + return Info.ofPartialTermInfo { elaborator, lctx := lctx?.getD (← getLCtx), stx, expectedType? } + /-- Pushes a new leaf node to the info tree associating the expression `e` to the syntax `stx`. As a result, when the user hovers over `stx` they will see the type of `e`, and if `e` @@ -1326,28 +1341,36 @@ def addTermInfo (stx : Syntax) (e : Expr) (expectedType? : Option Expr := none) if (← read).inPattern && !force then return mkPatternWithRef e stx else - withInfoContext' (pure ()) (fun _ => mkTermInfo elaborator stx e expectedType? lctx? isBinder) |> discard + discard <| withInfoContext' + (pure ()) + (fun _ => mkTermInfo elaborator stx e expectedType? lctx? isBinder) + (mkPartialTermInfo elaborator stx expectedType? lctx?) return e def addTermInfo' (stx : Syntax) (e : Expr) (expectedType? : Option Expr := none) (lctx? : Option LocalContext := none) (elaborator := Name.anonymous) (isBinder := false) : TermElabM Unit := discard <| addTermInfo stx e expectedType? lctx? elaborator isBinder -def withInfoContext' (stx : Syntax) (x : TermElabM Expr) (mkInfo : Expr → TermElabM (Sum Info MVarId)) : TermElabM Expr := do +def withInfoContext' + (stx : Syntax) + (x : TermElabM Expr) + (mkInfo : Expr → TermElabM (Sum Info MVarId)) + (mkInfoOnError : TermElabM Info) : + TermElabM Expr := do if (← read).inPattern then let e ← x return mkPatternWithRef e stx else - Elab.withInfoContext' x mkInfo + Elab.withInfoContext' x mkInfo mkInfoOnError /-- Info node capturing `def/let rec` bodies, used by the unused variables linter. -/ structure BodyInfo where - /-- The body as a fully elaborated term. -/ - value : Expr + /-- The body as a fully elaborated term. `none` if the body failed to elaborate. -/ + value? : Option Expr deriving TypeName /-- Creates an `Info.ofCustomInfo` node backed by a `BodyInfo`. -/ -def mkBodyInfo (stx : Syntax) (value : Expr) : Info := - .ofCustomInfo { stx, value := .mk { value : BodyInfo } } +def mkBodyInfo (stx : Syntax) (value? : Option Expr) : Info := + .ofCustomInfo { stx, value := .mk { value? : BodyInfo } } /-- Extracts a `BodyInfo` custom info. -/ def getBodyInfo? : Info → Option BodyInfo @@ -1360,8 +1383,11 @@ ensures the info tree is updated and a hole id is introduced. When `stx` is elaborated, new info nodes are created and attached to the new hole id in the info tree. -/ def postponeElabTerm (stx : Syntax) (expectedType? : Option Expr) : TermElabM Expr := do - withInfoContext' stx (mkInfo := mkTermInfo .anonymous (expectedType? := expectedType?) stx) do - postponeElabTermCore stx expectedType? + withInfoContext' stx + (mkInfo := mkTermInfo .anonymous (expectedType? := expectedType?) stx) + (mkInfoOnError := mkPartialTermInfo .anonymous (expectedType? := expectedType?) stx) + do + postponeElabTermCore stx expectedType? /-- Helper function for `elabTerm` that tries the registered elaboration functions for `stxNode` kind until it finds one that supports the syntax or @@ -1372,7 +1398,9 @@ private def elabUsingElabFnsAux (s : SavedState) (stx : Syntax) (expectedType? : | (elabFn::elabFns) => try -- record elaborator in info tree, but only when not backtracking to other elaborators (outer `try`) - withInfoContext' stx (mkInfo := mkTermInfo elabFn.declName (expectedType? := expectedType?) stx) + withInfoContext' stx + (mkInfo := mkTermInfo elabFn.declName (expectedType? := expectedType?) stx) + (mkInfoOnError := mkPartialTermInfo elabFn.declName (expectedType? := expectedType?) stx) (try elabFn.value stx expectedType? catch ex => match ex with @@ -1755,10 +1783,12 @@ private partial def elabTermAux (expectedType? : Option Expr) (catchExPostpone : let result ← match (← liftMacroM (expandMacroImpl? env stx)) with | some (decl, stxNew?) => let stxNew ← liftMacroM <| liftExcept stxNew? - withInfoContext' stx (mkInfo := mkTermInfo decl (expectedType? := expectedType?) stx) <| - withMacroExpansion stx stxNew <| - withRef stxNew <| - elabTermAux expectedType? catchExPostpone implicitLambda stxNew + withInfoContext' stx + (mkInfo := mkTermInfo decl (expectedType? := expectedType?) stx) + (mkInfoOnError := mkPartialTermInfo decl (expectedType? := expectedType?) stx) <| + withMacroExpansion stx stxNew <| + withRef stxNew <| + elabTermAux expectedType? catchExPostpone implicitLambda stxNew | _ => let useImplicitResult ← if implicitLambda && (← read).implicitLambda then useImplicitLambda stx expectedType? else pure .no match useImplicitResult with diff --git a/src/Lean/Linter/UnusedVariables.lean b/src/Lean/Linter/UnusedVariables.lean index 5cefd948e5..74bcb7260e 100644 --- a/src/Lean/Linter/UnusedVariables.lean +++ b/src/Lean/Linter/UnusedVariables.lean @@ -393,16 +393,17 @@ where | .ofCustomInfo ti => if !linter.unusedVariables.analyzeTactics.get ci.options then if let some bodyInfo := ti.value.get? Elab.Term.BodyInfo then - -- the body is the only `Expr` we will analyze in this case - -- NOTE: we include it even if no tactics are present as at least for parameters we want - -- to lint only truly unused binders - let (e, _) := instantiateMVarsCore ci.mctx bodyInfo.value - modify fun s => { s with - assignments := s.assignments.push (.insert {} ⟨.anonymous⟩ e) } - let tacticsPresent := children.any (·.findInfo? (· matches .ofTacticInfo ..) |>.isSome) - withReader (· || tacticsPresent) do - go children.toArray ci - return false + if let some value := bodyInfo.value? then + -- the body is the only `Expr` we will analyze in this case + -- NOTE: we include it even if no tactics are present as at least for parameters we want + -- to lint only truly unused binders + let (e, _) := instantiateMVarsCore ci.mctx value + modify fun s => { s with + assignments := s.assignments.push (.insert {} ⟨.anonymous⟩ e) } + let tacticsPresent := children.any (·.findInfo? (· matches .ofTacticInfo ..) |>.isSome) + withReader (· || tacticsPresent) do + go children.toArray ci + return false | .ofTermInfo ti => if ignored then return true match ti.expr with diff --git a/src/Lean/Server/Completion.lean b/src/Lean/Server/Completion.lean index 0312a11714..0135bbe417 100644 --- a/src/Lean/Server/Completion.lean +++ b/src/Lean/Server/Completion.lean @@ -43,11 +43,13 @@ inductive CompletionIdentifier where deriving FromJson, ToJson /-- -`CompletionItemData` that also contains a `CompletionIdentifier`. -See the documentation of`CompletionItemData` and `CompletionIdentifier`. +`CompletionItemData` that contains additional information to identify the item +in order to resolve it. -/ -structure CompletionItemDataWithId extends CompletionItemData where - id? : Option CompletionIdentifier +structure ResolvableCompletionItemData extends CompletionItemData where + /-- Position of the completion info that this completion item was created from. -/ + cPos : Nat + id? : Option CompletionIdentifier deriving FromJson, ToJson /-- @@ -74,6 +76,8 @@ def CompletionItem.resolve return item +def CompletionList.empty : CompletionList := { items := #[], isIncomplete := true } + end Lean.Lsp namespace Lean.Server.Completion @@ -123,28 +127,26 @@ private def allowCompletion (eligibleHeaderDecls : EligibleHeaderDecls) (env : E eligibleHeaderDecls.contains declName || env.constants.map₂.contains declName && Lean.Meta.allowCompletion env declName -/-- -Sorts `items` descendingly according to their score and ascendingly according to their label -for equal scores. --/ -private def sortCompletionItems (items : Array (CompletionItem × Float)) : Array CompletionItem := - let items := items.qsort fun (i1, s1) (i2, s2) => - if s1 != s2 then - s1 > s2 - else - i1.label.map (·.toLower) < i2.label.map (·.toLower) - items.map (·.1) +structure ScoredCompletionItem where + item : CompletionItem + score : Float + deriving Inhabited + +structure Context where + params : CompletionParams + completionInfoPos : Nat + /-- Intermediate state while completions are being computed. -/ structure State where /-- All completion items and their fuzzy match scores so far. -/ - items : Array (CompletionItem × Float) := #[] + items : Array ScoredCompletionItem := #[] /-- Monad used for completion computation that allows modifying a completion `State` and reading `CompletionParams`. -/ -abbrev M := OptionT $ ReaderT CompletionParams $ StateRefT State MetaM +abbrev M := ReaderT Context $ StateRefT State MetaM /-- Adds a new completion item to the state in `M`. -/ private def addItem @@ -152,10 +154,15 @@ private def addItem (score : Float) (id? : Option CompletionIdentifier := none) : M Unit := do - let params ← read - let data := { params, id? : CompletionItemDataWithId } + let ctx ← read + let data := { + params := ctx.params, + cPos := ctx.completionInfoPos, + id? + : ResolvableCompletionItemData + } let item := { item with data? := toJson data } - modify fun s => { s with items := s.items.push (item, score) } + modify fun s => { s with items := s.items.push ⟨item, score⟩ } /-- Adds a new completion item with the given `label`, `id`, `kind` and `score` to the state in `M`. @@ -231,13 +238,16 @@ private def addNamespaceCompletionItem (ns : Name) (score : Float) : M Unit := d let item := { label := ns.toString, detail? := "namespace", documentation? := none, kind? := CompletionItemKind.module } addItem item score -private def runM (params : CompletionParams) (ctx : ContextInfo) (lctx : LocalContext) (x : M Unit) - : IO (Option CompletionList) := +private def runM + (params : CompletionParams) + (completionInfoPos : Nat) + (ctx : ContextInfo) + (lctx : LocalContext) + (x : M Unit) + : IO (Array ScoredCompletionItem) := ctx.runMetaM lctx do - match (← x.run |>.run params |>.run {}) with - | (none, _) => return none - | (some _, s) => - return some { items := sortCompletionItems s.items, isIncomplete := true } + let (_, s) ← x.run ⟨params, completionInfoPos⟩ |>.run {} + return s.items private def matchAtomic (id : Name) (declName : Name) : Option Float := match id, declName with @@ -448,15 +458,16 @@ private def idCompletionCore completeNamespaces ctx id danglingDot private def idCompletion - (params : CompletionParams) - (ctx : ContextInfo) - (lctx : LocalContext) - (stx : Syntax) - (id : Name) - (hoverInfo : HoverInfo) - (danglingDot : Bool) - : IO (Option CompletionList) := - runM params ctx lctx do + (params : CompletionParams) + (completionInfoPos : Nat) + (ctx : ContextInfo) + (lctx : LocalContext) + (stx : Syntax) + (id : Name) + (hoverInfo : HoverInfo) + (danglingDot : Bool) + : IO (Array ScoredCompletionItem) := + runM params completionInfoPos ctx lctx do idCompletionCore ctx stx id hoverInfo danglingDot private def unfoldeDefinitionGuarded? (e : Expr) : MetaM (Option Expr) := @@ -544,26 +555,17 @@ where visit type private def dotCompletion - (params : CompletionParams) - (ctx : ContextInfo) - (info : TermInfo) - (hoverInfo : HoverInfo) - : IO (Option CompletionList) := - runM params ctx info.lctx do + (params : CompletionParams) + (completionInfoPos : Nat) + (ctx : ContextInfo) + (info : TermInfo) + : IO (Array ScoredCompletionItem) := + runM params completionInfoPos ctx info.lctx do let nameSet ← try getDotCompletionTypeNames (← instantiateMVars (← inferType info.expr)) catch _ => pure RBTree.empty - if nameSet.isEmpty then - let stx := info.stx - if stx.isIdent then - idCompletionCore ctx stx stx.getId hoverInfo (danglingDot := false) - else if stx.getKind == ``Lean.Parser.Term.completion && stx[0].isIdent then - -- TODO: truncation when there is a dangling dot - idCompletionCore ctx stx stx[0].getId HoverInfo.after (danglingDot := true) - else - failure return forEligibleDeclsM fun declName c => do @@ -579,13 +581,14 @@ private def dotCompletion addUnresolvedCompletionItem (.mkSimple c.name.getString!) (.const c.name) (kind := completionKind) 1 private def dotIdCompletion - (params : CompletionParams) - (ctx : ContextInfo) - (lctx : LocalContext) - (id : Name) - (expectedType? : Option Expr) - : IO (Option CompletionList) := - runM params ctx lctx do + (params : CompletionParams) + (completionInfoPos : Nat) + (ctx : ContextInfo) + (lctx : LocalContext) + (id : Name) + (expectedType? : Option Expr) + : IO (Array ScoredCompletionItem) := + runM params completionInfoPos ctx lctx do let some expectedType := expectedType? | return () @@ -620,14 +623,15 @@ private def dotIdCompletion addUnresolvedCompletionItem label (.const c.name) completionKind score private def fieldIdCompletion - (params : CompletionParams) - (ctx : ContextInfo) - (lctx : LocalContext) - (id : Name) - (structName : Name) - : IO (Option CompletionList) := - runM params ctx lctx do - let idStr := id.toString + (params : CompletionParams) + (completionInfoPos : Nat) + (ctx : ContextInfo) + (lctx : LocalContext) + (id : Option Name) + (structName : Name) + : IO (Array ScoredCompletionItem) := + runM params completionInfoPos ctx lctx do + let idStr := id.map (·.toString) |>.getD "" let fieldNames := getStructureFieldsFlattened (← getEnv) structName (includeSubobjectFields := false) for fieldName in fieldNames do let .str _ fieldName := fieldName | continue @@ -636,11 +640,12 @@ private def fieldIdCompletion addItem item score private def optionCompletion - (params : CompletionParams) - (ctx : ContextInfo) - (stx : Syntax) - (caps : ClientCapabilities) - : IO (Option CompletionList) := + (params : CompletionParams) + (completionInfoPos : Nat) + (ctx : ContextInfo) + (stx : Syntax) + (caps : ClientCapabilities) + : IO (Array ScoredCompletionItem) := ctx.runMetaM {} do let (partialName, trailingDot) := -- `stx` is from `"set_option" >> ident` @@ -667,28 +672,36 @@ private def optionCompletion some { newText := name.toString, insert := range, replace := range : InsertReplaceEdit } else none - items := items.push - ({ label := name.toString - detail? := s!"({opts.get name decl.defValue}), {decl.descr}" - documentation? := none, - kind? := CompletionItemKind.property -- TODO: investigate whether this is the best kind for options. - textEdit? := textEdit - data? := toJson { params, id? := none : CompletionItemDataWithId } }, score) - return some { items := sortCompletionItems items, isIncomplete := true } + items := items.push ⟨{ + label := name.toString + detail? := s!"({opts.get name decl.defValue}), {decl.descr}" + documentation? := none, + kind? := CompletionItemKind.property -- TODO: investigate whether this is the best kind for options. + textEdit? := textEdit + data? := toJson { + params, + cPos := completionInfoPos, + id? := none : ResolvableCompletionItemData + } + }, score⟩ + return items -private def tacticCompletion (params : CompletionParams) (ctx : ContextInfo) - : IO (Option CompletionList) := ctx.runMetaM .empty do +private def tacticCompletion + (params : CompletionParams) + (completionInfoPos : Nat) + (ctx : ContextInfo) + : IO (Array ScoredCompletionItem) := ctx.runMetaM .empty do let allTacticDocs ← Tactic.Doc.allTacticDocs - let items : Array (CompletionItem × Float) := allTacticDocs.map fun tacticDoc => - ({ + let items : Array ScoredCompletionItem := allTacticDocs.map fun tacticDoc => + ⟨{ label := tacticDoc.userName detail? := none documentation? := tacticDoc.docString.map fun docString => { value := docString, kind := MarkupKind.markdown : MarkupContent } kind? := CompletionItemKind.keyword - data? := toJson { params, id? := none : CompletionItemDataWithId } - }, 1) - return some { items := sortCompletionItems items, isIncomplete := true } + data? := toJson { params, cPos := completionInfoPos, id? := none : ResolvableCompletionItemData } + }, 1⟩ + return items private def findBest? (infoTree : InfoTree) @@ -794,6 +807,13 @@ private partial def getIndentationAmount (fileMap : FileMap) (line : Nat) : Nat it := it.next return indentationAmount +private partial def isCursorOnWhitespace (fileMap : FileMap) (hoverPos : String.Pos) : Bool := + fileMap.source.atEnd hoverPos || (fileMap.source.get hoverPos).isWhitespace + +private partial def isCursorInProperWhitespace (fileMap : FileMap) (hoverPos : String.Pos) : Bool := + (fileMap.source.atEnd hoverPos || (fileMap.source.get hoverPos).isWhitespace) + && (fileMap.source.get (hoverPos - ⟨1⟩)).isWhitespace + private partial def isSyntheticTacticCompletion (fileMap : FileMap) (hoverPos : String.Pos) @@ -860,7 +880,7 @@ where -- tactic completions are only provided at the same indentation level as the other tactics in -- that tactic block. let isCursorInTacticBlock := hoverLineIndentation == firstTacticIndentation - return isCursorInProperWhitespace && isCursorInTacticBlock + return isCursorInProperWhitespace fileMap hoverPos && isCursorInTacticBlock isCompletionAfterSemicolon (stx : Syntax) : Bool := Id.run do let some tacticsNode := getTacticsNode? stx @@ -868,7 +888,7 @@ where let tactics := tacticsNode.getArgs -- We want to provide completions in the case of `skip;`, so the cursor must only be on -- whitespace, not in proper whitespace. - return isCursorOnWhitspace && tactics.any fun tactic => Id.run do + return isCursorOnWhitespace fileMap hoverPos && tactics.any fun tactic => Id.run do let some tailPos := tactic.getTailPos? | return false let isCursorAfterSemicolon := @@ -886,14 +906,7 @@ where none isCompletionInEmptyTacticBlock (stx : Syntax) : Bool := - isCursorInProperWhitespace && isEmptyTacticBlock stx - - isCursorOnWhitspace : Bool := - fileMap.source.atEnd hoverPos || (fileMap.source.get hoverPos).isWhitespace - - isCursorInProperWhitespace : Bool := - (fileMap.source.atEnd hoverPos || (fileMap.source.get hoverPos).isWhitespace) - && (fileMap.source.get (hoverPos - ⟨1⟩)).isWhitespace + isCursorInProperWhitespace fileMap hoverPos && isEmptyTacticBlock stx isEmptyTacticBlock (stx : Syntax) : Bool := stx.getKind == `Lean.Parser.Tactic.tacticSeq && isEmpty stx @@ -936,86 +949,300 @@ private def findSyntheticTacticCompletion? -- Neither `HoverInfo` nor the syntax in `.tactic` are important for tactic completion. return (HoverInfo.after, ctx, .tactic .missing) -private def findCompletionInfoAt? +private def findExpectedTypeAt (infoTree : InfoTree) (hoverPos : String.Pos) : Option (ContextInfo × Expr) := do + let (ctx, .ofTermInfo i) ← infoTree.smallestInfo? fun i => Id.run do + let some pos := i.pos? + | return false + let some tailPos := i.tailPos? + | return false + let .ofTermInfo ti := i + | return false + return ti.expectedType?.isSome && pos <= hoverPos && hoverPos <= tailPos + | none + (ctx, i.expectedType?.get!) + +private structure HoverData where + fileMap : FileMap + hoverPos : String.Pos + hoverFilePos : Position + hoverLineIndentation : Nat + isCursorOnWhitespace : Bool + isCursorInProperWhitespace : Bool + +private def HoverData.ofPosInFile + (fileMap : FileMap) + (hoverPos : String.Pos) + : HoverData := Id.run do + let hoverFilePos := fileMap.toPosition hoverPos + let mut hoverLineIndentation := getIndentationAmount fileMap hoverFilePos.line + if hoverFilePos.column < hoverLineIndentation then + -- Ignore trailing whitespace after the cursor + hoverLineIndentation := hoverFilePos.column + let isCursorOnWhitespace := Completion.isCursorOnWhitespace fileMap hoverPos + let isCursorInProperWhitespace := Completion.isCursorInProperWhitespace fileMap hoverPos + return { + fileMap, + hoverPos, + hoverFilePos, + hoverLineIndentation + isCursorOnWhitespace, + isCursorInProperWhitespace + } + +private structure SepBy1Data (ks : SyntaxNodeKinds) (sep : String) where + sepBy1Stx : Syntax.TSepArray ks sep + outerBounds : String.Range + +private def isCompletionInSepBy1 + {ks : SyntaxNodeKinds} + {sep : String} + (hd : HoverData) + (sd : SepBy1Data ks sep) + : Bool := Id.run do + if ! hd.isCursorOnWhitespace then + return false + + let isCompletionInEmptyBlock := + sd.sepBy1Stx.elemsAndSeps.isEmpty && sd.outerBounds.contains hd.hoverPos (includeStop := true) + if isCompletionInEmptyBlock then + return true + + let isCompletionAfterSep := sd.sepBy1Stx.elemsAndSeps.any fun fieldOrSep => Id.run do + if ! fieldOrSep.isToken sep then + return false + let some sepTailPos := fieldOrSep.getTailPos? + | return false + return sepTailPos <= hd.hoverPos + && hd.hoverPos.byteIdx <= sepTailPos.byteIdx + fieldOrSep.getTrailingSize + if isCompletionAfterSep then + return true + + let isCompletionOnIndentation := Id.run do + if ! hd.isCursorInProperWhitespace then + return false + let isCursorInIndentation := hd.hoverFilePos.column <= hd.hoverLineIndentation + if ! isCursorInIndentation then + return false + let some firstFieldPos := sd.sepBy1Stx.elemsAndSeps[0]?.getD Syntax.missing |>.getPos? + | return false + let firstFieldLine := hd.fileMap.toPosition firstFieldPos |>.line + let firstFieldIndentation := getIndentationAmount hd.fileMap firstFieldLine + let isCursorInBlock := hd.hoverLineIndentation == firstFieldIndentation + return isCursorInBlock + return isCompletionOnIndentation + +private def isSyntheticWhereBlockFieldCompletion + (fileMap : FileMap) + (hoverPos : String.Pos) + (cmdStx : Syntax) + : Bool := + let hd := HoverData.ofPosInFile fileMap hoverPos + Option.isSome <| cmdStx.find? fun stx => Id.run do + let `(Parser.Command.whereStructInst|where $structFields:whereStructField;* $[$_:whereDecls]?) := + stx + | return false + let some outerBoundStart := stx[0].getTailPos? (canonicalOnly := true) + | return false + let some outerBoundStop := + stx[2].getPos? (canonicalOnly := true) + <|> stx[1].getTrailingTailPos? (canonicalOnly := true) + <|> stx[0].getTrailingTailPos? (canonicalOnly := true) + | return false + let sd : SepBy1Data _ _ := { + sepBy1Stx := structFields + outerBounds := { + start := outerBoundStart + stop := outerBoundStop + } + } + return isCompletionInSepBy1 hd sd + +private def isSyntheticStructInstFieldCompletion + (fileMap : FileMap) + (hoverPos : String.Pos) + (cmdStx : Syntax) + : Bool := + let hd := HoverData.ofPosInFile fileMap hoverPos + Option.isSome <| cmdStx.find? fun stx => Id.run do + let `(Lean.Parser.Term.structInst| { $[$srcs,* with]? $fields,* $[..%$ell]? $[: $ty]? }) := + stx + | return false + let some outerBoundStart := + stx[1].getTailPos? (canonicalOnly := true) + <|> stx[0].getTailPos? (canonicalOnly := true) + | return false + let some outerBoundStop := + stx[3].getPos? (canonicalOnly := true) + <|> stx[4].getPos? (canonicalOnly := true) + <|> stx[5].getPos? (canonicalOnly := true) + | return false + let sd : SepBy1Data _ _ := { + sepBy1Stx := fields + outerBounds := { + start := outerBoundStart + stop := outerBoundStop + } + } + return isCompletionInSepBy1 hd sd + +private def findSyntheticFieldCompletion? + (fileMap : FileMap) + (hoverPos : String.Pos) + (cmdStx : Syntax) + (infoTree : InfoTree) + : Option (HoverInfo × ContextInfo × CompletionInfo) := do + if ! isSyntheticWhereBlockFieldCompletion fileMap hoverPos cmdStx + && ! isSyntheticStructInstFieldCompletion fileMap hoverPos cmdStx then + none + let (ctx, expectedType) ← findExpectedTypeAt infoTree hoverPos + let .const typeName _ := expectedType.getAppFn + | none + if ! isStructure ctx.env typeName then + none + return (HoverInfo.after, ctx, .fieldId .missing none .empty typeName) + +private def findCompletionInfosAt (fileMap : FileMap) (hoverPos : String.Pos) (cmdStx : Syntax) (infoTree : InfoTree) - : Option (HoverInfo × ContextInfo × CompletionInfo) := + : Array (HoverInfo × ContextInfo × CompletionInfo) := let ⟨hoverLine, _⟩ := fileMap.toPosition hoverPos - match infoTree.foldInfo (init := none) (choose hoverLine) with - | some (hoverInfo, ctx, Info.ofCompletionInfo info) => - some (hoverInfo, ctx, info) - | _ => - findSyntheticTacticCompletion? fileMap hoverPos cmdStx infoTree <|> - findSyntheticIdentifierCompletion? hoverPos infoTree + let completionInfoCandidates := infoTree.foldInfo (init := #[]) (choose hoverLine) + if ! completionInfoCandidates.isEmpty then + completionInfoCandidates + else + let syntheticCompletionData? := + findSyntheticTacticCompletion? fileMap hoverPos cmdStx infoTree <|> + findSyntheticFieldCompletion? fileMap hoverPos cmdStx infoTree <|> + findSyntheticIdentifierCompletion? hoverPos infoTree + syntheticCompletionData?.map (#[·]) |>.getD #[] + where + choose (hoverLine : Nat) (ctx : ContextInfo) (info : Info) - (best? : Option (HoverInfo × ContextInfo × Info)) - : Option (HoverInfo × ContextInfo × Info) := - if !info.isCompletion then - best? - else if info.occursInOrOnBoundary hoverPos then - let headPos := info.pos?.get! - let tailPos := info.tailPos?.get! - let hoverInfo := - if hoverPos < tailPos then - HoverInfo.inside (hoverPos - headPos).byteIdx - else - HoverInfo.after - let ⟨headPosLine, _⟩ := fileMap.toPosition headPos - let ⟨tailPosLine, _⟩ := fileMap.toPosition info.tailPos?.get! - if headPosLine != hoverLine || headPosLine != tailPosLine then - best? - else match best? with - | none => (hoverInfo, ctx, info) - | some (_, _, best) => - if isBetter info best then - (hoverInfo, ctx, info) - else - best? - else - best? - - isBetter : Info → Info → Bool - | i₁@(.ofCompletionInfo ci₁), i₂@(.ofCompletionInfo ci₂) => - -- Use the smallest info available and prefer non-id completion over id completions as a - -- tie-breaker. - -- This is necessary because the elaborator sometimes generates both for the same range. - -- If two infos are equivalent, always prefer the first one. - if i₁.isSmaller i₂ then - true - else if i₂.isSmaller i₁ then - false - else if !(ci₁ matches .id ..) && ci₂ matches .id .. then - true - else if ci₁ matches .id .. && !(ci₂ matches .id ..) then - false + (best : Array (HoverInfo × ContextInfo × CompletionInfo)) + : Array (HoverInfo × ContextInfo × CompletionInfo) := Id.run do + let .ofCompletionInfo completionInfo := info + | return best + if ! info.occursInOrOnBoundary hoverPos then + return best + let headPos := info.pos?.get! + let tailPos := info.tailPos?.get! + let hoverInfo := + if hoverPos < tailPos then + HoverInfo.inside (hoverPos - headPos).byteIdx else - true - | .ofCompletionInfo _, _ => true - | _, .ofCompletionInfo _ => false - | _, _ => true + HoverInfo.after + let ⟨headPosLine, _⟩ := fileMap.toPosition headPos + let ⟨tailPosLine, _⟩ := fileMap.toPosition info.tailPos?.get! + if headPosLine != hoverLine || headPosLine != tailPosLine then + return best + return best.push (hoverInfo, ctx, completionInfo) + +private def filterDuplicateCompletionInfos + (infos : Array (HoverInfo × ContextInfo × CompletionInfo)) + : Array (HoverInfo × ContextInfo × CompletionInfo) := Id.run do + -- We don't expect there to be too many duplicate completion infos, + -- so it's fine if this is quadratic (we don't need to implement `Hashable` / `LT` this way). + let mut deduplicatedInfos : Array (HoverInfo × ContextInfo × CompletionInfo) := #[] + for i@⟨_, _, ci⟩ in infos do + if deduplicatedInfos.any (fun ⟨_, _, di⟩ => eq di ci) then + continue + deduplicatedInfos := deduplicatedInfos.push i + deduplicatedInfos +where + eq : CompletionInfo → CompletionInfo → Bool + | .dot ti₁ .., .dot ti₂ .. => + ti₁.stx.eqWithInfo ti₂.stx && ti₁.expr == ti₂.expr + | .id stx₁ id₁ .., .id stx₂ id₂ .. => + stx₁.eqWithInfo stx₂ && id₁ == id₂ + | .dotId stx₁ id₁ .., .id stx₂ id₂ .. => + stx₁.eqWithInfo stx₂ && id₁ == id₂ + | .fieldId stx₁ id₁? _ structName₁, .fieldId stx₂ id₂? _ structName₂ => + stx₁.eqWithInfo stx₂ && id₁? == id₂? && structName₁ == structName₂ + | .namespaceId stx₁, .namespaceId stx₂ => + stx₁.eqWithInfo stx₂ + | .option stx₁, .option stx₂ => + stx₁.eqWithInfo stx₂ + | .endSection stx₁ scopeNames₁, .endSection stx₂ scopeNames₂ => + stx₁.eqWithInfo stx₂ && scopeNames₁ == scopeNames₂ + | .tactic stx₁, .tactic stx₂ => + stx₁.eqWithInfo stx₂ + | _, _ => + false + +private def computePrioritizedCompletionPartitions + (items : Array ((HoverInfo × ContextInfo × CompletionInfo) × Nat)) + : Array (Array ((HoverInfo × ContextInfo × CompletionInfo) × Nat)) := + let partitions := items.groupByKey fun ((_, _, info), _) => + let isId := info matches .id .. + let size? := Info.ofCompletionInfo info |>.size? + (isId, size?) + -- Sort partitions so that non-id completions infos come before id completion infos and + -- within those two groups, smaller sizes come before larger sizes. + let partitionsByPriority := partitions.toArray.qsort + fun ((isId₁, size₁?), _) ((isId₂, size₂?), _) => + match size₁?, size₂? with + | some _, none => true + | none, some _ => false + | _, _ => + match isId₁, isId₂ with + | false, true => true + | true, false => false + | _, _ => Id.run do + let some size₁ := size₁? + | return false + let some size₂ := size₂? + | return false + return size₁ < size₂ + partitionsByPriority.map (·.2) + +private def filterDuplicateCompletionItems + (items : Array ScoredCompletionItem) + : Array ScoredCompletionItem := + let duplicationGroups := items.groupByKey fun s => ( + s.item.label, + s.item.textEdit?, + s.item.detail?, + s.item.kind?, + s.item.tags?, + s.item.documentation?, + ) + duplicationGroups.map (fun _ duplicateItems => duplicateItems.getMax? (·.score < ·.score) |>.get!) + |>.valuesArray + +/-- +Sorts `items` descendingly according to their score and ascendingly according to their label +for equal scores. +-/ +private def sortCompletionItems (items : Array ScoredCompletionItem) : Array CompletionItem := + let items := items.qsort fun ⟨i1, s1⟩ ⟨i2, s2⟩ => + if s1 != s2 then + s1 > s2 + else + i1.label.map (·.toLower) < i2.label.map (·.toLower) + items.map (·.1) /-- Assigns the `CompletionItem.sortText?` for all items in `completions` according to their order in `completions`. This is necessary because clients will use their own sort order if the server does not set it. -/ -private def assignSortTexts (completions : CompletionList) : CompletionList := Id.run do - if completions.items.isEmpty then - return completions - let items := completions.items.mapIdx fun i item => +private def assignSortTexts (completions : Array CompletionItem) : Array CompletionItem := Id.run do + if completions.isEmpty then + return #[] + let items := completions.mapIdx fun i item => { item with sortText? := toString i } let maxDigits := items[items.size - 1]!.sortText?.get!.length let items := items.map fun item => let sortText := item.sortText?.get! let pad := List.replicate (maxDigits - sortText.length) '0' |>.asString { item with sortText? := pad ++ sortText } - { completions with items := items } + items partial def find? (params : CompletionParams) @@ -1024,39 +1251,61 @@ partial def find? (cmdStx : Syntax) (infoTree : InfoTree) (caps : ClientCapabilities) - : IO (Option CompletionList) := do - let some (hoverInfo, ctx, info) := findCompletionInfoAt? fileMap hoverPos cmdStx infoTree - | return none - let completionList? ← - match info with - | .dot info .. => - dotCompletion params ctx info hoverInfo - | .id stx id danglingDot lctx .. => - idCompletion params ctx lctx stx id hoverInfo danglingDot - | .dotId _ id lctx expectedType? => - dotIdCompletion params ctx lctx id expectedType? - | .fieldId _ id lctx structName => - fieldIdCompletion params ctx lctx id structName - | .option stx => - optionCompletion params ctx stx caps - | .tactic .. => - tacticCompletion params ctx - | _ => return none - return completionList?.map assignSortTexts + : IO CompletionList := do + let completionInfos := findCompletionInfosAt fileMap hoverPos cmdStx infoTree + |> filterDuplicateCompletionInfos + |>.zipWithIndex + if completionInfos.isEmpty then + return .empty + + let prioritizedPartitions := computePrioritizedCompletionPartitions completionInfos + let mut allCompletions := #[] + for partition in prioritizedPartitions do + for ((hoverInfo, ctx, info), completionInfoPos) in partition do + let completions : Array ScoredCompletionItem ← + match info with + | .id stx id danglingDot lctx .. => + idCompletion params completionInfoPos ctx lctx stx id hoverInfo danglingDot + | .dot info .. => + dotCompletion params completionInfoPos ctx info + | .dotId _ id lctx expectedType? => + dotIdCompletion params completionInfoPos ctx lctx id expectedType? + | .fieldId _ id lctx structName => + fieldIdCompletion params completionInfoPos ctx lctx id structName + | .option stx => + optionCompletion params completionInfoPos ctx stx caps + | .tactic .. => + tacticCompletion params completionInfoPos ctx + | _ => + pure #[] + allCompletions := allCompletions ++ completions + if ! allCompletions.isEmpty then + -- Stop accumulating completions with lower priority if we found completions for a higher + -- priority. + break + + let finalCompletions := allCompletions + |> filterDuplicateCompletionItems + |> sortCompletionItems + |> assignSortTexts + return { items := finalCompletions, isIncomplete := true } /-- Fills the `CompletionItem.detail?` field of `item` using the pretty-printed type identified by `id` in the context found at `hoverPos` in `infoTree`. -/ def resolveCompletionItem? - (fileMap : FileMap) - (hoverPos : String.Pos) - (cmdStx : Syntax) - (infoTree : InfoTree) - (item : CompletionItem) - (id : CompletionIdentifier) + (fileMap : FileMap) + (hoverPos : String.Pos) + (cmdStx : Syntax) + (infoTree : InfoTree) + (item : CompletionItem) + (id : CompletionIdentifier) + (completionInfoPos : Nat) : IO CompletionItem := do - let some (_, ctx, info) := findCompletionInfoAt? fileMap hoverPos cmdStx infoTree + let completionInfos := filterDuplicateCompletionInfos <| + findCompletionInfosAt fileMap hoverPos cmdStx infoTree + let some (_, ctx, info) := completionInfos.get? completionInfoPos | return item ctx.runMetaM info.lctx (item.resolve id) diff --git a/src/Lean/Server/FileWorker/RequestHandling.lean b/src/Lean/Server/FileWorker/RequestHandling.lean index 57418b4fa1..424b475ad2 100644 --- a/src/Lean/Server/FileWorker/RequestHandling.lean +++ b/src/Lean/Server/FileWorker/RequestHandling.lean @@ -46,10 +46,11 @@ def handleCompletion (p : CompletionParams) mapTask (findCompletionCmdDataAtPos doc pos) fun cmdData? => do let some (cmdStx, infoTree) := cmdData? -- work around https://github.com/microsoft/vscode/issues/155738 - | return { items := #[{label := "-"}], isIncomplete := true } - if let some r ← Completion.find? p doc.meta.text pos cmdStx infoTree caps then - return r - return { items := #[ ], isIncomplete := true } + | return { + items := #[{label := "-", data? := toJson { params := p : Lean.Lsp.CompletionItemData }}], + isIncomplete := true + } + Completion.find? p doc.meta.text pos cmdStx infoTree caps /-- Handles `completionItem/resolve` requests that are sent by the client after the user selects @@ -62,7 +63,7 @@ def handleCompletionItemResolve (item : CompletionItem) : RequestM (RequestTask CompletionItem) := do let doc ← readDoc let text := doc.meta.text - let some (data : CompletionItemDataWithId) := item.data?.bind fun data => (fromJson? data).toOption + let some (data : ResolvableCompletionItemData) := item.data?.bind fun data => (fromJson? data).toOption | return .pure item let some id := data.id? | return .pure item @@ -70,7 +71,7 @@ def handleCompletionItemResolve (item : CompletionItem) mapTask (findCompletionCmdDataAtPos doc pos) fun cmdData? => do let some (cmdStx, infoTree) := cmdData? | return item - Completion.resolveCompletionItem? text pos cmdStx infoTree item id + Completion.resolveCompletionItem? text pos cmdStx infoTree item id data.cPos open Elab in def handleHover (p : HoverParams) diff --git a/src/Lean/Server/InfoUtils.lean b/src/Lean/Server/InfoUtils.lean index 2f3fba3969..b642d73849 100644 --- a/src/Lean/Server/InfoUtils.lean +++ b/src/Lean/Server/InfoUtils.lean @@ -136,6 +136,7 @@ def InfoTree.getCompletionInfos (infoTree : InfoTree) : Array (ContextInfo × Co def Info.stx : Info → Syntax | ofTacticInfo i => i.stx | ofTermInfo i => i.stx + | ofPartialTermInfo i => i.stx | ofCommandInfo i => i.stx | ofMacroExpansionInfo i => i.stx | ofOptionInfo i => i.stx @@ -146,6 +147,7 @@ def Info.stx : Info → Syntax | ofFVarAliasInfo _ => .missing | ofFieldRedeclInfo i => i.stx | ofOmissionInfo i => i.stx + | ofChoiceInfo i => i.stx def Info.lctx : Info → LocalContext | .ofTermInfo i => i.lctx diff --git a/tests/lean/1018unknowMVarIssue.lean.expected.out b/tests/lean/1018unknowMVarIssue.lean.expected.out index 63c1b033f9..5029613281 100644 --- a/tests/lean/1018unknowMVarIssue.lean.expected.out +++ b/tests/lean/1018unknowMVarIssue.lean.expected.out @@ -30,6 +30,7 @@ a : α • a (isBinder := true) : α @ ⟨7, 9⟩-⟨7, 10⟩ • x (isBinder := true) : Fam2 α β @ ⟨7, 17⟩-⟨7, 18⟩ • CustomInfo(Lean.Elab.Term.BodyInfo) + • Partial term @ ⟨8, 2⟩-⟨10, 19⟩ @ Lean.Elab.Term.Quotation.elabMatchSyntax • match α, β, x, a with | α_1, .(α_1), Fam2.any, a => ?m x α_1 a | .(Nat), .(Nat), Fam2.nat n, a => n : β @ ⟨8, 2⟩-⟨10, 19⟩ @ Lean.Elab.Term.elabMatch diff --git a/tests/lean/instance1.lean.expected.out b/tests/lean/instance1.lean.expected.out index f09ccac7f6..174df89903 100644 --- a/tests/lean/instance1.lean.expected.out +++ b/tests/lean/instance1.lean.expected.out @@ -1 +1 @@ -instance1.lean:6:24-6:29: error: fields missing: 'pure', 'bind' +instance1.lean:6:24-10:0: error: fields missing: 'pure', 'bind' diff --git a/tests/lean/interactive/1265.lean.expected.out b/tests/lean/interactive/1265.lean.expected.out index abe2bf402d..0f91b29507 100644 --- a/tests/lean/interactive/1265.lean.expected.out +++ b/tests/lean/interactive/1265.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 0, "character": 51}}, - "id": {"const": {"declName": "Lean.TSyntax.expandInterpolatedStr"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.expandInterpolatedStr"}}, + "cPos": 1}}, {"sortText": "1", "label": "getChar", "kind": 3, @@ -16,7 +17,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 0, "character": 51}}, - "id": {"const": {"declName": "Lean.TSyntax.getChar"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getChar"}}, + "cPos": 1}}, {"sortText": "2", "label": "getDocString", "kind": 3, @@ -24,7 +26,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 0, "character": 51}}, - "id": {"const": {"declName": "Lean.TSyntax.getDocString"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getDocString"}}, + "cPos": 1}}, {"sortText": "3", "label": "getHygieneInfo", "kind": 3, @@ -32,7 +35,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 0, "character": 51}}, - "id": {"const": {"declName": "Lean.TSyntax.getHygieneInfo"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getHygieneInfo"}}, + "cPos": 1}}, {"sortText": "4", "label": "getId", "kind": 3, @@ -40,7 +44,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 0, "character": 51}}, - "id": {"const": {"declName": "Lean.TSyntax.getId"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getId"}}, + "cPos": 1}}, {"sortText": "5", "label": "getName", "kind": 3, @@ -48,7 +53,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 0, "character": 51}}, - "id": {"const": {"declName": "Lean.TSyntax.getName"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getName"}}, + "cPos": 1}}, {"sortText": "6", "label": "getNat", "kind": 3, @@ -56,7 +62,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 0, "character": 51}}, - "id": {"const": {"declName": "Lean.TSyntax.getNat"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getNat"}}, + "cPos": 1}}, {"sortText": "7", "label": "getScientific", "kind": 3, @@ -64,7 +71,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 0, "character": 51}}, - "id": {"const": {"declName": "Lean.TSyntax.getScientific"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getScientific"}}, + "cPos": 1}}, {"sortText": "8", "label": "getString", "kind": 3, @@ -72,7 +80,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 0, "character": 51}}, - "id": {"const": {"declName": "Lean.TSyntax.getString"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getString"}}, + "cPos": 1}}, {"sortText": "9", "label": "raw", "kind": 5, @@ -82,7 +91,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 0, "character": 51}}, - "id": {"const": {"declName": "Lean.TSyntax.raw"}}}}], + "id": {"const": {"declName": "Lean.TSyntax.raw"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 2, "character": 53}} @@ -94,7 +104,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 2, "character": 53}}, - "id": {"const": {"declName": "Lean.TSyntax.expandInterpolatedStr"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.expandInterpolatedStr"}}, + "cPos": 1}}, {"sortText": "1", "label": "getChar", "kind": 3, @@ -102,7 +113,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 2, "character": 53}}, - "id": {"const": {"declName": "Lean.TSyntax.getChar"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getChar"}}, + "cPos": 1}}, {"sortText": "2", "label": "getDocString", "kind": 3, @@ -110,7 +122,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 2, "character": 53}}, - "id": {"const": {"declName": "Lean.TSyntax.getDocString"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getDocString"}}, + "cPos": 1}}, {"sortText": "3", "label": "getHygieneInfo", "kind": 3, @@ -118,7 +131,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 2, "character": 53}}, - "id": {"const": {"declName": "Lean.TSyntax.getHygieneInfo"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getHygieneInfo"}}, + "cPos": 1}}, {"sortText": "4", "label": "getId", "kind": 3, @@ -126,7 +140,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 2, "character": 53}}, - "id": {"const": {"declName": "Lean.TSyntax.getId"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getId"}}, + "cPos": 1}}, {"sortText": "5", "label": "getName", "kind": 3, @@ -134,7 +149,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 2, "character": 53}}, - "id": {"const": {"declName": "Lean.TSyntax.getName"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getName"}}, + "cPos": 1}}, {"sortText": "6", "label": "getNat", "kind": 3, @@ -142,7 +158,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 2, "character": 53}}, - "id": {"const": {"declName": "Lean.TSyntax.getNat"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getNat"}}, + "cPos": 1}}, {"sortText": "7", "label": "getScientific", "kind": 3, @@ -150,7 +167,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 2, "character": 53}}, - "id": {"const": {"declName": "Lean.TSyntax.getScientific"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getScientific"}}, + "cPos": 1}}, {"sortText": "8", "label": "getString", "kind": 3, @@ -158,7 +176,8 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 2, "character": 53}}, - "id": {"const": {"declName": "Lean.TSyntax.getString"}}}}, + "id": {"const": {"declName": "Lean.TSyntax.getString"}}, + "cPos": 1}}, {"sortText": "9", "label": "raw", "kind": 5, @@ -168,5 +187,6 @@ {"params": {"textDocument": {"uri": "file:///1265.lean"}, "position": {"line": 2, "character": 53}}, - "id": {"const": {"declName": "Lean.TSyntax.raw"}}}}], + "id": {"const": {"declName": "Lean.TSyntax.raw"}}, + "cPos": 1}}], "isIncomplete": true} diff --git a/tests/lean/interactive/1659.lean.expected.out b/tests/lean/interactive/1659.lean.expected.out index dc26f41f1c..e98343098f 100644 --- a/tests/lean/interactive/1659.lean.expected.out +++ b/tests/lean/interactive/1659.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 9, "character": 23}}, - "id": {"const": {"declName": "Lean.Elab.Tactic.elabTermEnsuringType"}}}}, + "id": {"const": {"declName": "Lean.Elab.Tactic.elabTermEnsuringType"}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Elab.Term.elabTermEnsuringType", "kind": 21, @@ -16,7 +17,8 @@ {"params": {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 9, "character": 23}}, - "id": {"const": {"declName": "Lean.Elab.Term.elabTermEnsuringType"}}}}], + "id": {"const": {"declName": "Lean.Elab.Term.elabTermEnsuringType"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 15, "character": 23}} @@ -28,7 +30,8 @@ {"params": {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 15, "character": 23}}, - "id": {"const": {"declName": "Lean.Elab.Tactic.elabTermEnsuringType"}}}}, + "id": {"const": {"declName": "Lean.Elab.Tactic.elabTermEnsuringType"}}, + "cPos": 0}}, {"sortText": "1", "label": "Term.elabTermEnsuringType", "kind": 21, @@ -36,7 +39,8 @@ {"params": {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 15, "character": 23}}, - "id": {"const": {"declName": "Lean.Elab.Term.elabTermEnsuringType"}}}}], + "id": {"const": {"declName": "Lean.Elab.Term.elabTermEnsuringType"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 21, "character": 23}} @@ -48,7 +52,8 @@ {"params": {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 21, "character": 23}}, - "id": {"const": {"declName": "Lean.Elab.Term.elabTermEnsuringType"}}}}, + "id": {"const": {"declName": "Lean.Elab.Term.elabTermEnsuringType"}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Elab.Tactic.elabTermEnsuringType", "kind": 21, @@ -56,7 +61,8 @@ {"params": {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 21, "character": 23}}, - "id": {"const": {"declName": "Lean.Elab.Tactic.elabTermEnsuringType"}}}}], + "id": {"const": {"declName": "Lean.Elab.Tactic.elabTermEnsuringType"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 27, "character": 23}} @@ -68,7 +74,8 @@ {"params": {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 27, "character": 23}}, - "id": {"const": {"declName": "elabTermEnsuringType"}}}}, + "id": {"const": {"declName": "elabTermEnsuringType"}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Elab.Tactic.elabTermEnsuringType", "kind": 21, @@ -76,7 +83,8 @@ {"params": {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 27, "character": 23}}, - "id": {"const": {"declName": "Lean.Elab.Tactic.elabTermEnsuringType"}}}}, + "id": {"const": {"declName": "Lean.Elab.Tactic.elabTermEnsuringType"}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Elab.Term.elabTermEnsuringType", "kind": 21, @@ -84,7 +92,8 @@ {"params": {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 27, "character": 23}}, - "id": {"const": {"declName": "Lean.Elab.Term.elabTermEnsuringType"}}}}], + "id": {"const": {"declName": "Lean.Elab.Term.elabTermEnsuringType"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 33, "character": 23}} @@ -96,7 +105,8 @@ {"params": {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 33, "character": 23}}, - "id": {"const": {"declName": "elabTermEnsuringType"}}}}, + "id": {"const": {"declName": "elabTermEnsuringType"}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Elab.elabTermEnsuringType", "kind": 21, @@ -104,7 +114,8 @@ {"params": {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 33, "character": 23}}, - "id": {"const": {"declName": "Lean.Elab.elabTermEnsuringType"}}}}, + "id": {"const": {"declName": "Lean.Elab.elabTermEnsuringType"}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Elab.Tactic.elabTermEnsuringType", "kind": 21, @@ -112,7 +123,8 @@ {"params": {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 33, "character": 23}}, - "id": {"const": {"declName": "Lean.Elab.Tactic.elabTermEnsuringType"}}}}, + "id": {"const": {"declName": "Lean.Elab.Tactic.elabTermEnsuringType"}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Elab.Term.elabTermEnsuringType", "kind": 21, @@ -120,5 +132,6 @@ {"params": {"textDocument": {"uri": "file:///1659.lean"}, "position": {"line": 33, "character": 23}}, - "id": {"const": {"declName": "Lean.Elab.Term.elabTermEnsuringType"}}}}], + "id": {"const": {"declName": "Lean.Elab.Term.elabTermEnsuringType"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/4880.lean.expected.out b/tests/lean/interactive/4880.lean.expected.out index 88d320c447..de96f1cf48 100644 --- a/tests/lean/interactive/4880.lean.expected.out +++ b/tests/lean/interactive/4880.lean.expected.out @@ -5,22 +5,22 @@ "severity": 1, "range": {"start": {"line": 16, "character": 12}, - "end": {"line": 16, "character": 17}}, + "end": {"line": 17, "character": 0}}, "message": "could not synthesize default value for field 'h1' of 'B' using tactics", "fullRange": {"start": {"line": 16, "character": 12}, - "end": {"line": 16, "character": 17}}}, + "end": {"line": 20, "character": 0}}}, {"source": "Lean 4", "severity": 1, "range": {"start": {"line": 16, "character": 12}, - "end": {"line": 16, "character": 17}}, + "end": {"line": 17, "character": 0}}, "message": "failed to synthesize\n A\nAdditional diagnostic information may be available using the `set_option diagnostics true` command.", "fullRange": {"start": {"line": 16, "character": 12}, - "end": {"line": 16, "character": 17}}}, + "end": {"line": 20, "character": 0}}}, {"source": "Lean 4", "severity": 1, "range": @@ -45,8 +45,8 @@ "severity": 1, "range": {"start": {"line": 34, "character": 13}, - "end": {"line": 34, "character": 18}}, + "end": {"line": 35, "character": 0}}, "message": "unsolved goals\n⊢ A", "fullRange": {"start": {"line": 34, "character": 13}, - "end": {"line": 34, "character": 18}}}]} + "end": {"line": 36, "character": 0}}}]} diff --git a/tests/lean/interactive/533.lean.expected.out b/tests/lean/interactive/533.lean.expected.out index 72e7be4fb9..db615b1739 100644 --- a/tests/lean/interactive/533.lean.expected.out +++ b/tests/lean/interactive/533.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///533.lean"}, "position": {"line": 4, "character": 10}}, - "id": {"fvar": {"id": "_uniq.6"}}}}, + "id": {"fvar": {"id": "_uniq.6"}}, + "cPos": 0}}, {"sortText": "1", "label": "Foo", "kind": 6, @@ -16,5 +17,6 @@ {"params": {"textDocument": {"uri": "file:///533.lean"}, "position": {"line": 4, "character": 10}}, - "id": {"fvar": {"id": "_uniq.2"}}}}], + "id": {"fvar": {"id": "_uniq.2"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/863.lean.expected.out b/tests/lean/interactive/863.lean.expected.out index 6843b01e86..7ec3d09d6a 100644 --- a/tests/lean/interactive/863.lean.expected.out +++ b/tests/lean/interactive/863.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///863.lean"}, "position": {"line": 9, "character": 12}}, - "id": {"const": {"declName": "Lean.MonadRef.getRef"}}}}, + "id": {"const": {"declName": "Lean.MonadRef.getRef"}}, + "cPos": 0}}, {"sortText": "1", "label": "MonadRef.getRef", "kind": 5, @@ -16,7 +17,8 @@ {"params": {"textDocument": {"uri": "file:///863.lean"}, "position": {"line": 9, "character": 12}}, - "id": {"const": {"declName": "Lean.MonadRef.getRef"}}}}], + "id": {"const": {"declName": "Lean.MonadRef.getRef"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///863.lean"}, "position": {"line": 13, "character": 12}} @@ -28,7 +30,8 @@ {"params": {"textDocument": {"uri": "file:///863.lean"}, "position": {"line": 13, "character": 12}}, - "id": {"const": {"declName": "Lean.MonadRef.getRef"}}}}, + "id": {"const": {"declName": "Lean.MonadRef.getRef"}}, + "cPos": 0}}, {"sortText": "1", "label": "MonadRef.getRef", "kind": 5, @@ -36,5 +39,6 @@ {"params": {"textDocument": {"uri": "file:///863.lean"}, "position": {"line": 13, "character": 12}}, - "id": {"const": {"declName": "Lean.MonadRef.getRef"}}}}], + "id": {"const": {"declName": "Lean.MonadRef.getRef"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/compHeader.lean.expected.out b/tests/lean/interactive/compHeader.lean.expected.out index d4ca54fdbf..e2418fe0a4 100644 --- a/tests/lean/interactive/compHeader.lean.expected.out +++ b/tests/lean/interactive/compHeader.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///compHeader.lean"}, "position": {"line": 2, "character": 22}}, - "id": {"fvar": {"id": "_uniq.7"}}}}, + "id": {"fvar": {"id": "_uniq.7"}}, + "cPos": 0}}, {"sortText": "1", "label": "veryLongNameForCompletion", "kind": 21, @@ -16,5 +17,6 @@ {"params": {"textDocument": {"uri": "file:///compHeader.lean"}, "position": {"line": 2, "character": 22}}, - "id": {"const": {"declName": "veryLongNameForCompletion"}}}}], + "id": {"const": {"declName": "veryLongNameForCompletion"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/compNamespace.lean.expected.out b/tests/lean/interactive/compNamespace.lean.expected.out index ba2b53585e..46bce389fd 100644 --- a/tests/lean/interactive/compNamespace.lean.expected.out +++ b/tests/lean/interactive/compNamespace.lean.expected.out @@ -8,7 +8,8 @@ "data": {"params": {"textDocument": {"uri": "file:///compNamespace.lean"}, - "position": {"line": 5, "character": 12}}}}], + "position": {"line": 5, "character": 12}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///compNamespace.lean"}, "position": {"line": 9, "character": 12}} @@ -20,7 +21,8 @@ "data": {"params": {"textDocument": {"uri": "file:///compNamespace.lean"}, - "position": {"line": 9, "character": 12}}}}], + "position": {"line": 9, "character": 12}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///compNamespace.lean"}, "position": {"line": 13, "character": 11}} @@ -32,7 +34,8 @@ "data": {"params": {"textDocument": {"uri": "file:///compNamespace.lean"}, - "position": {"line": 13, "character": 11}}}}], + "position": {"line": 13, "character": 11}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///compNamespace.lean"}, "position": {"line": 16, "character": 16}} @@ -44,7 +47,8 @@ "data": {"params": {"textDocument": {"uri": "file:///compNamespace.lean"}, - "position": {"line": 16, "character": 16}}}}], + "position": {"line": 16, "character": 16}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///compNamespace.lean"}, "position": {"line": 20, "character": 12}} @@ -56,5 +60,6 @@ "data": {"params": {"textDocument": {"uri": "file:///compNamespace.lean"}, - "position": {"line": 20, "character": 12}}}}], + "position": {"line": 20, "character": 12}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completion.lean.expected.out b/tests/lean/interactive/completion.lean.expected.out index 09db651354..70876007ea 100644 --- a/tests/lean/interactive/completion.lean.expected.out +++ b/tests/lean/interactive/completion.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completion.lean"}, "position": {"line": 3, "character": 22}}, - "id": {"const": {"declName": "Foo.foo"}}}}], + "id": {"const": {"declName": "Foo.foo"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion.lean"}, "position": {"line": 5, "character": 23}} @@ -20,7 +21,8 @@ {"params": {"textDocument": {"uri": "file:///completion.lean"}, "position": {"line": 5, "character": 23}}, - "id": {"const": {"declName": "Foo.foo"}}}}], + "id": {"const": {"declName": "Foo.foo"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion.lean"}, "position": {"line": 7, "character": 28}} @@ -32,7 +34,8 @@ {"params": {"textDocument": {"uri": "file:///completion.lean"}, "position": {"line": 7, "character": 28}}, - "id": {"const": {"declName": "Foo.foo"}}}}], + "id": {"const": {"declName": "Foo.foo"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion.lean"}, "position": {"line": 9, "character": 29}} @@ -44,5 +47,6 @@ {"params": {"textDocument": {"uri": "file:///completion.lean"}, "position": {"line": 9, "character": 29}}, - "id": {"const": {"declName": "Foo.foo"}}}}], + "id": {"const": {"declName": "Foo.foo"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completion2.lean.expected.out b/tests/lean/interactive/completion2.lean.expected.out index 3f9aafd094..8788a4bbf7 100644 --- a/tests/lean/interactive/completion2.lean.expected.out +++ b/tests/lean/interactive/completion2.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 19, "character": 10}}, - "id": {"const": {"declName": "Foo.Bla.ax1"}}}}, + "id": {"const": {"declName": "Foo.Bla.ax1"}}, + "cPos": 0}}, {"sortText": "1", "label": "ex1", "kind": 23, @@ -16,7 +17,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 19, "character": 10}}, - "id": {"const": {"declName": "Foo.Bla.ex1"}}}}, + "id": {"const": {"declName": "Foo.Bla.ex1"}}, + "cPos": 0}}, {"sortText": "2", "label": "ex2", "kind": 23, @@ -24,7 +26,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 19, "character": 10}}, - "id": {"const": {"declName": "Foo.Bla.ex2"}}}}, + "id": {"const": {"declName": "Foo.Bla.ex2"}}, + "cPos": 0}}, {"sortText": "3", "label": "ex3", "kind": 23, @@ -32,7 +35,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 19, "character": 10}}, - "id": {"const": {"declName": "Foo.Bla.ex3"}}}}], + "id": {"const": {"declName": "Foo.Bla.ex3"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 25, "character": 6}} @@ -44,7 +48,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 25, "character": 6}}, - "id": {"const": {"declName": "Foo.Bla.ax1"}}}}, + "id": {"const": {"declName": "Foo.Bla.ax1"}}, + "cPos": 0}}, {"sortText": "1", "label": "ex1", "kind": 23, @@ -52,7 +57,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 25, "character": 6}}, - "id": {"const": {"declName": "Foo.Bla.ex1"}}}}, + "id": {"const": {"declName": "Foo.Bla.ex1"}}, + "cPos": 0}}, {"sortText": "2", "label": "ex2", "kind": 23, @@ -60,7 +66,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 25, "character": 6}}, - "id": {"const": {"declName": "Foo.Bla.ex2"}}}}, + "id": {"const": {"declName": "Foo.Bla.ex2"}}, + "cPos": 0}}, {"sortText": "3", "label": "ex3", "kind": 23, @@ -68,7 +75,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 25, "character": 6}}, - "id": {"const": {"declName": "Foo.Bla.ex3"}}}}], + "id": {"const": {"declName": "Foo.Bla.ex3"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 30, "character": 21}} @@ -80,7 +88,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 30, "character": 21}}, - "id": {"const": {"declName": "Foo.Bla.ax1"}}}}, + "id": {"const": {"declName": "Foo.Bla.ax1"}}, + "cPos": 0}}, {"sortText": "1", "label": "ex1", "kind": 23, @@ -88,7 +97,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 30, "character": 21}}, - "id": {"const": {"declName": "Foo.Bla.ex1"}}}}, + "id": {"const": {"declName": "Foo.Bla.ex1"}}, + "cPos": 0}}, {"sortText": "2", "label": "ex2", "kind": 23, @@ -96,7 +106,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 30, "character": 21}}, - "id": {"const": {"declName": "Foo.Bla.ex2"}}}}, + "id": {"const": {"declName": "Foo.Bla.ex2"}}, + "cPos": 0}}, {"sortText": "3", "label": "ex3", "kind": 23, @@ -104,7 +115,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 30, "character": 21}}, - "id": {"const": {"declName": "Foo.Bla.ex3"}}}}], + "id": {"const": {"declName": "Foo.Bla.ex3"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 37, "character": 22}} @@ -116,7 +128,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 37, "character": 22}}, - "id": {"const": {"declName": "Foo.Bla.ex1"}}}}, + "id": {"const": {"declName": "Foo.Bla.ex1"}}, + "cPos": 0}}, {"sortText": "1", "label": "ex2", "kind": 23, @@ -124,7 +137,8 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 37, "character": 22}}, - "id": {"const": {"declName": "Foo.Bla.ex2"}}}}, + "id": {"const": {"declName": "Foo.Bla.ex2"}}, + "cPos": 0}}, {"sortText": "2", "label": "ex3", "kind": 23, @@ -132,5 +146,6 @@ {"params": {"textDocument": {"uri": "file:///completion2.lean"}, "position": {"line": 37, "character": 22}}, - "id": {"const": {"declName": "Foo.Bla.ex3"}}}}], + "id": {"const": {"declName": "Foo.Bla.ex3"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completion3.lean.expected.out b/tests/lean/interactive/completion3.lean.expected.out index e3f61c586b..bca23dfea8 100644 --- a/tests/lean/interactive/completion3.lean.expected.out +++ b/tests/lean/interactive/completion3.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 7, "character": 9}}, - "id": {"const": {"declName": "S.b"}}}}, + "id": {"const": {"declName": "S.b"}}, + "cPos": 1}}, {"sortText": "1", "label": "x", "kind": 5, @@ -16,7 +17,8 @@ {"params": {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 7, "character": 9}}, - "id": {"const": {"declName": "S.x"}}}}, + "id": {"const": {"declName": "S.x"}}, + "cPos": 1}}, {"sortText": "2", "label": "y", "kind": 5, @@ -24,7 +26,8 @@ {"params": {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 7, "character": 9}}, - "id": {"const": {"declName": "S.y"}}}}], + "id": {"const": {"declName": "S.y"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 12, "character": 5}} @@ -36,7 +39,8 @@ {"params": {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 12, "character": 5}}, - "id": {"const": {"declName": "S.b"}}}}, + "id": {"const": {"declName": "S.b"}}, + "cPos": 1}}, {"sortText": "1", "label": "x", "kind": 5, @@ -44,7 +48,8 @@ {"params": {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 12, "character": 5}}, - "id": {"const": {"declName": "S.x"}}}}, + "id": {"const": {"declName": "S.x"}}, + "cPos": 1}}, {"sortText": "2", "label": "y", "kind": 5, @@ -52,7 +57,8 @@ {"params": {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 12, "character": 5}}, - "id": {"const": {"declName": "S.y"}}}}], + "id": {"const": {"declName": "S.y"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 16, "character": 5}} @@ -64,7 +70,8 @@ {"params": {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 16, "character": 5}}, - "id": {"const": {"declName": "S.b"}}}}, + "id": {"const": {"declName": "S.b"}}, + "cPos": 1}}, {"sortText": "1", "label": "x", "kind": 5, @@ -72,7 +79,8 @@ {"params": {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 16, "character": 5}}, - "id": {"const": {"declName": "S.x"}}}}, + "id": {"const": {"declName": "S.x"}}, + "cPos": 1}}, {"sortText": "2", "label": "y", "kind": 5, @@ -80,7 +88,8 @@ {"params": {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 16, "character": 5}}, - "id": {"const": {"declName": "S.y"}}}}], + "id": {"const": {"declName": "S.y"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 20, "character": 5}} @@ -92,7 +101,8 @@ {"params": {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 20, "character": 5}}, - "id": {"const": {"declName": "S.b"}}}}, + "id": {"const": {"declName": "S.b"}}, + "cPos": 1}}, {"sortText": "1", "label": "x", "kind": 5, @@ -100,7 +110,8 @@ {"params": {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 20, "character": 5}}, - "id": {"const": {"declName": "S.x"}}}}, + "id": {"const": {"declName": "S.x"}}, + "cPos": 1}}, {"sortText": "2", "label": "y", "kind": 5, @@ -108,5 +119,6 @@ {"params": {"textDocument": {"uri": "file:///completion3.lean"}, "position": {"line": 20, "character": 5}}, - "id": {"const": {"declName": "S.y"}}}}], + "id": {"const": {"declName": "S.y"}}, + "cPos": 1}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completion4.lean.expected.out b/tests/lean/interactive/completion4.lean.expected.out index f135609126..822a7de2f4 100644 --- a/tests/lean/interactive/completion4.lean.expected.out +++ b/tests/lean/interactive/completion4.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 7, "character": 4}}, - "id": {"const": {"declName": "S.fn1"}}}}, + "id": {"const": {"declName": "S.fn1"}}, + "cPos": 1}}, {"sortText": "1", "label": "fn2", "kind": 5, @@ -16,7 +17,8 @@ {"params": {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 7, "character": 4}}, - "id": {"const": {"declName": "S.fn2"}}}}, + "id": {"const": {"declName": "S.fn2"}}, + "cPos": 1}}, {"sortText": "2", "label": "pred", "kind": 5, @@ -24,7 +26,8 @@ {"params": {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 7, "character": 4}}, - "id": {"const": {"declName": "S.pred"}}}}], + "id": {"const": {"declName": "S.pred"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 11, "character": 10}} @@ -36,7 +39,8 @@ {"params": {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 11, "character": 10}}, - "id": {"const": {"declName": "S.fn1"}}}}, + "id": {"const": {"declName": "S.fn1"}}, + "cPos": 1}}, {"sortText": "1", "label": "fn2", "kind": 5, @@ -44,7 +48,8 @@ {"params": {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 11, "character": 10}}, - "id": {"const": {"declName": "S.fn2"}}}}, + "id": {"const": {"declName": "S.fn2"}}, + "cPos": 1}}, {"sortText": "2", "label": "pred", "kind": 5, @@ -52,7 +57,8 @@ {"params": {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 11, "character": 10}}, - "id": {"const": {"declName": "S.pred"}}}}], + "id": {"const": {"declName": "S.pred"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 16, "character": 11}} @@ -64,7 +70,8 @@ {"params": {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 16, "character": 11}}, - "id": {"const": {"declName": "S.fn1"}}}}, + "id": {"const": {"declName": "S.fn1"}}, + "cPos": 1}}, {"sortText": "1", "label": "fn2", "kind": 5, @@ -72,7 +79,8 @@ {"params": {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 16, "character": 11}}, - "id": {"const": {"declName": "S.fn2"}}}}, + "id": {"const": {"declName": "S.fn2"}}, + "cPos": 1}}, {"sortText": "2", "label": "pred", "kind": 5, @@ -80,7 +88,8 @@ {"params": {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 16, "character": 11}}, - "id": {"const": {"declName": "S.pred"}}}}], + "id": {"const": {"declName": "S.pred"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 20, "character": 21}} @@ -92,7 +101,8 @@ {"params": {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 20, "character": 21}}, - "id": {"const": {"declName": "S.fn1"}}}}, + "id": {"const": {"declName": "S.fn1"}}, + "cPos": 1}}, {"sortText": "1", "label": "fn2", "kind": 5, @@ -100,7 +110,8 @@ {"params": {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 20, "character": 21}}, - "id": {"const": {"declName": "S.fn2"}}}}, + "id": {"const": {"declName": "S.fn2"}}, + "cPos": 1}}, {"sortText": "2", "label": "pred", "kind": 5, @@ -108,5 +119,6 @@ {"params": {"textDocument": {"uri": "file:///completion4.lean"}, "position": {"line": 20, "character": 21}}, - "id": {"const": {"declName": "S.pred"}}}}], + "id": {"const": {"declName": "S.pred"}}, + "cPos": 1}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completion5.lean.expected.out b/tests/lean/interactive/completion5.lean.expected.out index 152236a17a..91ea7851e6 100644 --- a/tests/lean/interactive/completion5.lean.expected.out +++ b/tests/lean/interactive/completion5.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completion5.lean"}, "position": {"line": 9, "character": 15}}, - "id": {"const": {"declName": "C.b1"}}}}, + "id": {"const": {"declName": "C.b1"}}, + "cPos": 1}}, {"sortText": "1", "label": "f1", "kind": 5, @@ -16,7 +17,8 @@ {"params": {"textDocument": {"uri": "file:///completion5.lean"}, "position": {"line": 9, "character": 15}}, - "id": {"const": {"declName": "C.f1"}}}}, + "id": {"const": {"declName": "C.f1"}}, + "cPos": 1}}, {"sortText": "2", "label": "f2", "kind": 5, @@ -24,5 +26,6 @@ {"params": {"textDocument": {"uri": "file:///completion5.lean"}, "position": {"line": 9, "character": 15}}, - "id": {"const": {"declName": "C.f2"}}}}], + "id": {"const": {"declName": "C.f2"}}, + "cPos": 1}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completion6.lean.expected.out b/tests/lean/interactive/completion6.lean.expected.out index f6cb7e7c4f..17fdb83289 100644 --- a/tests/lean/interactive/completion6.lean.expected.out +++ b/tests/lean/interactive/completion6.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completion6.lean"}, "position": {"line": 12, "character": 15}}, - "id": {"const": {"declName": "C.b1"}}}}, + "id": {"const": {"declName": "C.b1"}}, + "cPos": 1}}, {"sortText": "1", "label": "f1", "kind": 5, @@ -16,7 +17,8 @@ {"params": {"textDocument": {"uri": "file:///completion6.lean"}, "position": {"line": 12, "character": 15}}, - "id": {"const": {"declName": "C.f1"}}}}, + "id": {"const": {"declName": "C.f1"}}, + "cPos": 1}}, {"sortText": "2", "label": "f2", "kind": 5, @@ -24,7 +26,8 @@ {"params": {"textDocument": {"uri": "file:///completion6.lean"}, "position": {"line": 12, "character": 15}}, - "id": {"const": {"declName": "C.f2"}}}}, + "id": {"const": {"declName": "C.f2"}}, + "cPos": 1}}, {"sortText": "3", "label": "f3", "kind": 5, @@ -32,7 +35,8 @@ {"params": {"textDocument": {"uri": "file:///completion6.lean"}, "position": {"line": 12, "character": 15}}, - "id": {"const": {"declName": "D.f3"}}}}, + "id": {"const": {"declName": "D.f3"}}, + "cPos": 1}}, {"sortText": "4", "label": "toC", "kind": 5, @@ -40,7 +44,8 @@ {"params": {"textDocument": {"uri": "file:///completion6.lean"}, "position": {"line": 12, "character": 15}}, - "id": {"const": {"declName": "D.toC"}}}}], + "id": {"const": {"declName": "D.toC"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion6.lean"}, "position": {"line": 21, "character": 4}} @@ -52,7 +57,8 @@ {"params": {"textDocument": {"uri": "file:///completion6.lean"}, "position": {"line": 21, "character": 4}}, - "id": {"const": {"declName": "C.b1"}}}}, + "id": {"const": {"declName": "C.b1"}}, + "cPos": 1}}, {"sortText": "1", "label": "doubleF1", "kind": 3, @@ -60,7 +66,8 @@ {"params": {"textDocument": {"uri": "file:///completion6.lean"}, "position": {"line": 21, "character": 4}}, - "id": {"const": {"declName": "E.doubleF1"}}}}, + "id": {"const": {"declName": "E.doubleF1"}}, + "cPos": 1}}, {"sortText": "2", "label": "f1", "kind": 5, @@ -68,7 +75,8 @@ {"params": {"textDocument": {"uri": "file:///completion6.lean"}, "position": {"line": 21, "character": 4}}, - "id": {"const": {"declName": "C.f1"}}}}, + "id": {"const": {"declName": "C.f1"}}, + "cPos": 1}}, {"sortText": "3", "label": "f2", "kind": 5, @@ -76,7 +84,8 @@ {"params": {"textDocument": {"uri": "file:///completion6.lean"}, "position": {"line": 21, "character": 4}}, - "id": {"const": {"declName": "C.f2"}}}}, + "id": {"const": {"declName": "C.f2"}}, + "cPos": 1}}, {"sortText": "4", "label": "f3", "kind": 5, @@ -84,7 +93,8 @@ {"params": {"textDocument": {"uri": "file:///completion6.lean"}, "position": {"line": 21, "character": 4}}, - "id": {"const": {"declName": "D.f3"}}}}, + "id": {"const": {"declName": "D.f3"}}, + "cPos": 1}}, {"sortText": "5", "label": "toC", "kind": 5, @@ -92,5 +102,6 @@ {"params": {"textDocument": {"uri": "file:///completion6.lean"}, "position": {"line": 21, "character": 4}}, - "id": {"const": {"declName": "D.toC"}}}}], + "id": {"const": {"declName": "D.toC"}}, + "cPos": 1}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completion7.lean.expected.out b/tests/lean/interactive/completion7.lean.expected.out index 8b6d13ec7f..0538b9a0b4 100644 --- a/tests/lean/interactive/completion7.lean.expected.out +++ b/tests/lean/interactive/completion7.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completion7.lean"}, "position": {"line": 6, "character": 10}}, - "id": {"const": {"declName": "And"}}}}], + "id": {"const": {"declName": "And"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completion7.lean"}, "position": {"line": 8, "character": 11}} @@ -20,7 +21,8 @@ {"params": {"textDocument": {"uri": "file:///completion7.lean"}, "position": {"line": 8, "character": 11}}, - "id": {"const": {"declName": "And.left"}}}}, + "id": {"const": {"declName": "And.left"}}, + "cPos": 0}}, {"sortText": "1", "label": "mk", "kind": 4, @@ -28,7 +30,8 @@ {"params": {"textDocument": {"uri": "file:///completion7.lean"}, "position": {"line": 8, "character": 11}}, - "id": {"const": {"declName": "And.mk"}}}}, + "id": {"const": {"declName": "And.mk"}}, + "cPos": 0}}, {"sortText": "2", "label": "right", "kind": 5, @@ -36,5 +39,6 @@ {"params": {"textDocument": {"uri": "file:///completion7.lean"}, "position": {"line": 8, "character": 11}}, - "id": {"const": {"declName": "And.right"}}}}], + "id": {"const": {"declName": "And.right"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionAtPrint.lean.expected.out b/tests/lean/interactive/completionAtPrint.lean.expected.out index bb2fc2b59e..61ce71e1ed 100644 --- a/tests/lean/interactive/completionAtPrint.lean.expected.out +++ b/tests/lean/interactive/completionAtPrint.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completionAtPrint.lean"}, "position": {"line": 2, "character": 25}}, - "id": {"const": {"declName": "Lean.Environment.find?"}}}}, + "id": {"const": {"declName": "Lean.Environment.find?"}}, + "cPos": 0}}, {"sortText": "1", "label": "freeRegions", "kind": 3, @@ -20,5 +21,6 @@ {"params": {"textDocument": {"uri": "file:///completionAtPrint.lean"}, "position": {"line": 2, "character": 25}}, - "id": {"const": {"declName": "Lean.Environment.freeRegions"}}}}], + "id": {"const": {"declName": "Lean.Environment.freeRegions"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionCheck.lean.expected.out b/tests/lean/interactive/completionCheck.lean.expected.out index af03d40b5f..8c799d1af3 100644 --- a/tests/lean/interactive/completionCheck.lean.expected.out +++ b/tests/lean/interactive/completionCheck.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completionCheck.lean"}, "position": {"line": 6, "character": 33}}, - "id": {"const": {"declName": "AVerySpecificStructureName"}}}}, + "id": {"const": {"declName": "AVerySpecificStructureName"}}, + "cPos": 0}}, {"sortText": "1", "label": "AVerySpecificStructureName2", "kind": 22, @@ -16,5 +17,6 @@ {"params": {"textDocument": {"uri": "file:///completionCheck.lean"}, "position": {"line": 6, "character": 33}}, - "id": {"const": {"declName": "AVerySpecificStructureName2"}}}}], + "id": {"const": {"declName": "AVerySpecificStructureName2"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionDeprecation.lean.expected.out b/tests/lean/interactive/completionDeprecation.lean.expected.out index 9c36ff48db..1550a8f6ea 100644 --- a/tests/lean/interactive/completionDeprecation.lean.expected.out +++ b/tests/lean/interactive/completionDeprecation.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completionDeprecation.lean"}, "position": {"line": 25, "character": 28}}, - "id": {"const": {"declName": "SomeStructure.foo1"}}}}, + "id": {"const": {"declName": "SomeStructure.foo1"}}, + "cPos": 0}}, {"sortText": "1", "label": "foo2", "kind": 3, @@ -17,7 +18,8 @@ {"params": {"textDocument": {"uri": "file:///completionDeprecation.lean"}, "position": {"line": 25, "character": 28}}, - "id": {"const": {"declName": "SomeStructure.foo2"}}}}, + "id": {"const": {"declName": "SomeStructure.foo2"}}, + "cPos": 0}}, {"tags": [1], "sortText": "2", "label": "foo3", @@ -28,7 +30,8 @@ {"params": {"textDocument": {"uri": "file:///completionDeprecation.lean"}, "position": {"line": 25, "character": 28}}, - "id": {"const": {"declName": "SomeStructure.foo3"}}}}, + "id": {"const": {"declName": "SomeStructure.foo3"}}, + "cPos": 0}}, {"tags": [1], "sortText": "3", "label": "foo4", @@ -40,7 +43,8 @@ {"params": {"textDocument": {"uri": "file:///completionDeprecation.lean"}, "position": {"line": 25, "character": 28}}, - "id": {"const": {"declName": "SomeStructure.foo4"}}}}, + "id": {"const": {"declName": "SomeStructure.foo4"}}, + "cPos": 0}}, {"tags": [1], "sortText": "4", "label": "foo5", @@ -53,7 +57,8 @@ {"params": {"textDocument": {"uri": "file:///completionDeprecation.lean"}, "position": {"line": 25, "character": 28}}, - "id": {"const": {"declName": "SomeStructure.foo5"}}}}, + "id": {"const": {"declName": "SomeStructure.foo5"}}, + "cPos": 0}}, {"tags": [1], "sortText": "5", "label": "foo6", @@ -66,7 +71,8 @@ {"params": {"textDocument": {"uri": "file:///completionDeprecation.lean"}, "position": {"line": 25, "character": 28}}, - "id": {"const": {"declName": "SomeStructure.foo6"}}}}, + "id": {"const": {"declName": "SomeStructure.foo6"}}, + "cPos": 0}}, {"tags": [1], "sortText": "6", "label": "foo7", @@ -79,7 +85,8 @@ {"params": {"textDocument": {"uri": "file:///completionDeprecation.lean"}, "position": {"line": 25, "character": 28}}, - "id": {"const": {"declName": "SomeStructure.foo7"}}}}, + "id": {"const": {"declName": "SomeStructure.foo7"}}, + "cPos": 0}}, {"tags": [1], "sortText": "7", "label": "foo8", @@ -92,5 +99,6 @@ {"params": {"textDocument": {"uri": "file:///completionDeprecation.lean"}, "position": {"line": 25, "character": 28}}, - "id": {"const": {"declName": "SomeStructure.foo8"}}}}], + "id": {"const": {"declName": "SomeStructure.foo8"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionDocString.lean.expected.out b/tests/lean/interactive/completionDocString.lean.expected.out index 87577cd094..90ef754cdc 100644 --- a/tests/lean/interactive/completionDocString.lean.expected.out +++ b/tests/lean/interactive/completionDocString.lean.expected.out @@ -10,7 +10,8 @@ {"params": {"textDocument": {"uri": "file:///completionDocString.lean"}, "position": {"line": 0, "character": 20}}, - "id": {"const": {"declName": "Array.insertAt"}}}}, + "id": {"const": {"declName": "Array.insertAt"}}, + "cPos": 0}}, {"sortText": "1", "label": "insertAt!", "kind": 3, @@ -22,5 +23,6 @@ {"params": {"textDocument": {"uri": "file:///completionDocString.lean"}, "position": {"line": 0, "character": 20}}, - "id": {"const": {"declName": "Array.insertAt!"}}}}], + "id": {"const": {"declName": "Array.insertAt!"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionEOF.lean.expected.out b/tests/lean/interactive/completionEOF.lean.expected.out index bffabbbf79..d03cf05aa2 100644 --- a/tests/lean/interactive/completionEOF.lean.expected.out +++ b/tests/lean/interactive/completionEOF.lean.expected.out @@ -8,5 +8,6 @@ {"params": {"textDocument": {"uri": "file:///completionEOF.lean"}, "position": {"line": 8, "character": 9}}, - "id": {"const": {"declName": "And"}}}}], + "id": {"const": {"declName": "And"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionFallback.lean.expected.out b/tests/lean/interactive/completionFallback.lean.expected.out index 0d524243dc..a8841a0ad3 100644 --- a/tests/lean/interactive/completionFallback.lean.expected.out +++ b/tests/lean/interactive/completionFallback.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completionFallback.lean"}, "position": {"line": 14, "character": 14}}, - "id": {"const": {"declName": "Direction.down"}}}}, + "id": {"const": {"declName": "Direction.down"}}, + "cPos": 0}}, {"sortText": "1", "label": "left", "kind": 4, @@ -16,7 +17,8 @@ {"params": {"textDocument": {"uri": "file:///completionFallback.lean"}, "position": {"line": 14, "character": 14}}, - "id": {"const": {"declName": "Direction.left"}}}}, + "id": {"const": {"declName": "Direction.left"}}, + "cPos": 0}}, {"sortText": "2", "label": "noConfusionType", "kind": 3, @@ -24,7 +26,8 @@ {"params": {"textDocument": {"uri": "file:///completionFallback.lean"}, "position": {"line": 14, "character": 14}}, - "id": {"const": {"declName": "Direction.noConfusionType"}}}}, + "id": {"const": {"declName": "Direction.noConfusionType"}}, + "cPos": 0}}, {"sortText": "3", "label": "right", "kind": 4, @@ -32,7 +35,8 @@ {"params": {"textDocument": {"uri": "file:///completionFallback.lean"}, "position": {"line": 14, "character": 14}}, - "id": {"const": {"declName": "Direction.right"}}}}, + "id": {"const": {"declName": "Direction.right"}}, + "cPos": 0}}, {"sortText": "4", "label": "toCtorIdx", "kind": 3, @@ -40,7 +44,8 @@ {"params": {"textDocument": {"uri": "file:///completionFallback.lean"}, "position": {"line": 14, "character": 14}}, - "id": {"const": {"declName": "Direction.toCtorIdx"}}}}, + "id": {"const": {"declName": "Direction.toCtorIdx"}}, + "cPos": 0}}, {"sortText": "5", "label": "up", "kind": 4, @@ -48,7 +53,8 @@ {"params": {"textDocument": {"uri": "file:///completionFallback.lean"}, "position": {"line": 14, "character": 14}}, - "id": {"const": {"declName": "Direction.up"}}}}], + "id": {"const": {"declName": "Direction.up"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionFallback.lean"}, "position": {"line": 28, "character": 30}} @@ -60,7 +66,8 @@ {"params": {"textDocument": {"uri": "file:///completionFallback.lean"}, "position": {"line": 28, "character": 30}}, - "id": {"const": {"declName": "CustomAnd.ha"}}}}, + "id": {"const": {"declName": "CustomAnd.ha"}}, + "cPos": 0}}, {"sortText": "1", "label": "hb", "kind": 23, @@ -68,7 +75,8 @@ {"params": {"textDocument": {"uri": "file:///completionFallback.lean"}, "position": {"line": 28, "character": 30}}, - "id": {"const": {"declName": "CustomAnd.hb"}}}}, + "id": {"const": {"declName": "CustomAnd.hb"}}, + "cPos": 0}}, {"sortText": "2", "label": "mk", "kind": 4, @@ -76,5 +84,6 @@ {"params": {"textDocument": {"uri": "file:///completionFallback.lean"}, "position": {"line": 28, "character": 30}}, - "id": {"const": {"declName": "CustomAnd.mk"}}}}], + "id": {"const": {"declName": "CustomAnd.mk"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionFromExpectedType.lean.expected.out b/tests/lean/interactive/completionFromExpectedType.lean.expected.out index 938821b1d3..14df3b78f6 100644 --- a/tests/lean/interactive/completionFromExpectedType.lean.expected.out +++ b/tests/lean/interactive/completionFromExpectedType.lean.expected.out @@ -8,5 +8,6 @@ {"params": {"textDocument": {"uri": "file:///completionFromExpectedType.lean"}, "position": {"line": 3, "character": 18}}, - "id": {"const": {"declName": "Foo.mk"}}}}], + "id": {"const": {"declName": "Foo.mk"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionIStr.lean.expected.out b/tests/lean/interactive/completionIStr.lean.expected.out index 2da7e5d5b6..7869a2c34d 100644 --- a/tests/lean/interactive/completionIStr.lean.expected.out +++ b/tests/lean/interactive/completionIStr.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completionIStr.lean"}, "position": {"line": 5, "character": 34}}, - "id": {"const": {"declName": "C.b1"}}}}, + "id": {"const": {"declName": "C.b1"}}, + "cPos": 1}}, {"sortText": "1", "label": "f1", "kind": 5, @@ -16,7 +17,8 @@ {"params": {"textDocument": {"uri": "file:///completionIStr.lean"}, "position": {"line": 5, "character": 34}}, - "id": {"const": {"declName": "C.f1"}}}}, + "id": {"const": {"declName": "C.f1"}}, + "cPos": 1}}, {"sortText": "2", "label": "f2", "kind": 5, @@ -24,5 +26,6 @@ {"params": {"textDocument": {"uri": "file:///completionIStr.lean"}, "position": {"line": 5, "character": 34}}, - "id": {"const": {"declName": "C.f2"}}}}], + "id": {"const": {"declName": "C.f2"}}, + "cPos": 1}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionOpenNamespaces.lean.expected.out b/tests/lean/interactive/completionOpenNamespaces.lean.expected.out index 468aaf3ced..7fdbd1f930 100644 --- a/tests/lean/interactive/completionOpenNamespaces.lean.expected.out +++ b/tests/lean/interactive/completionOpenNamespaces.lean.expected.out @@ -10,6 +10,6 @@ "position": {"line": 4, "character": 68}}, "id": {"const": - {"declName": - "A.B1.verySpecificDefinitionNameOfCompletionOpenNamespaces"}}}}], + {"declName": "A.B1.verySpecificDefinitionNameOfCompletionOpenNamespaces"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionOption.lean.expected.out b/tests/lean/interactive/completionOption.lean.expected.out index 31d9a27f4b..ffda8804a4 100644 --- a/tests/lean/interactive/completionOption.lean.expected.out +++ b/tests/lean/interactive/completionOption.lean.expected.out @@ -17,7 +17,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 1, "character": 17}}}}, + "position": {"line": 1, "character": 17}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 1, "character": 11}, @@ -33,7 +34,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 1, "character": 17}}}}, + "position": {"line": 1, "character": 17}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 1, "character": 11}, @@ -49,7 +51,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 1, "character": 17}}}}, + "position": {"line": 1, "character": 17}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 1, "character": 11}, @@ -65,7 +68,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 1, "character": 17}}}}, + "position": {"line": 1, "character": 17}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 1, "character": 11}, @@ -81,7 +85,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 1, "character": 17}}}}, + "position": {"line": 1, "character": 17}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 1, "character": 11}, @@ -98,7 +103,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 1, "character": 17}}}}, + "position": {"line": 1, "character": 17}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 1, "character": 11}, @@ -115,7 +121,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 1, "character": 17}}}}], + "position": {"line": 1, "character": 17}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionOption.lean"}, "position": {"line": 4, "character": 20}} @@ -135,7 +142,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 4, "character": 20}}}}, + "position": {"line": 4, "character": 20}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 4, "character": 11}, @@ -151,7 +159,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 4, "character": 20}}}}, + "position": {"line": 4, "character": 20}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 4, "character": 11}, @@ -168,7 +177,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 4, "character": 20}}}}], + "position": {"line": 4, "character": 20}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionOption.lean"}, "position": {"line": 7, "character": 23}} @@ -189,7 +199,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 7, "character": 23}}}}, + "position": {"line": 7, "character": 23}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 7, "character": 11}, @@ -206,7 +217,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 7, "character": 23}}}}, + "position": {"line": 7, "character": 23}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 7, "character": 11}, @@ -223,7 +235,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 7, "character": 23}}}}, + "position": {"line": 7, "character": 23}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 7, "character": 11}, @@ -240,7 +253,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 7, "character": 23}}}}], + "position": {"line": 7, "character": 23}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionOption.lean"}, "position": {"line": 10, "character": 27}} @@ -261,7 +275,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 10, "character": 27}}}}, + "position": {"line": 10, "character": 27}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 10, "character": 11}, @@ -278,7 +293,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 10, "character": 27}}}}, + "position": {"line": 10, "character": 27}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 10, "character": 11}, @@ -295,7 +311,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 10, "character": 27}}}}, + "position": {"line": 10, "character": 27}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 10, "character": 11}, @@ -312,7 +329,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 10, "character": 27}}}}], + "position": {"line": 10, "character": 27}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionOption.lean"}, "position": {"line": 13, "character": 17}} @@ -333,7 +351,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 13, "character": 17}}}}, + "position": {"line": 13, "character": 17}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 13, "character": 11}, @@ -349,7 +368,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 13, "character": 17}}}}, + "position": {"line": 13, "character": 17}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 13, "character": 11}, @@ -365,7 +385,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 13, "character": 17}}}}, + "position": {"line": 13, "character": 17}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 13, "character": 11}, @@ -381,7 +402,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 13, "character": 17}}}}, + "position": {"line": 13, "character": 17}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 13, "character": 11}, @@ -397,7 +419,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 13, "character": 17}}}}, + "position": {"line": 13, "character": 17}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 13, "character": 11}, @@ -414,7 +437,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 13, "character": 17}}}}, + "position": {"line": 13, "character": 17}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 13, "character": 11}, @@ -431,7 +455,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 13, "character": 17}}}}], + "position": {"line": 13, "character": 17}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionOption.lean"}, "position": {"line": 16, "character": 18}} @@ -451,7 +476,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 16, "character": 18}}}}, + "position": {"line": 16, "character": 18}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 16, "character": 11}, @@ -467,7 +493,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 16, "character": 18}}}}, + "position": {"line": 16, "character": 18}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 16, "character": 11}, @@ -483,7 +510,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 16, "character": 18}}}}, + "position": {"line": 16, "character": 18}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 16, "character": 11}, @@ -499,7 +527,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 16, "character": 18}}}}, + "position": {"line": 16, "character": 18}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 16, "character": 11}, @@ -516,7 +545,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 16, "character": 18}}}}, + "position": {"line": 16, "character": 18}}, + "cPos": 0}}, {"textEdit": {"replace": {"start": {"line": 16, "character": 11}, @@ -533,5 +563,6 @@ "data": {"params": {"textDocument": {"uri": "file:///completionOption.lean"}, - "position": {"line": 16, "character": 18}}}}], + "position": {"line": 16, "character": 18}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionPrefixIssue.lean.expected.out b/tests/lean/interactive/completionPrefixIssue.lean.expected.out index b56a773a16..8496fe5d79 100644 --- a/tests/lean/interactive/completionPrefixIssue.lean.expected.out +++ b/tests/lean/interactive/completionPrefixIssue.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrefixIssue.lean"}, "position": {"line": 1, "character": 64}}, - "id": {"fvar": {"id": "_uniq.29"}}}}, + "id": {"fvar": {"id": "_uniq.29"}}, + "cPos": 0}}, {"sortText": "1", "label": "veryLongDefinitionNameVeryLongDefinitionName", "kind": 21, @@ -17,5 +18,6 @@ {"textDocument": {"uri": "file:///completionPrefixIssue.lean"}, "position": {"line": 1, "character": 64}}, "id": - {"const": {"declName": "veryLongDefinitionNameVeryLongDefinitionName"}}}}], + {"const": {"declName": "veryLongDefinitionNameVeryLongDefinitionName"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionPrivateTypes.lean.expected.out b/tests/lean/interactive/completionPrivateTypes.lean.expected.out index 1500487155..e364ff1f7a 100644 --- a/tests/lean/interactive/completionPrivateTypes.lean.expected.out +++ b/tests/lean/interactive/completionPrivateTypes.lean.expected.out @@ -8,5 +8,6 @@ {"params": {"textDocument": {"uri": "file:///completionPrivateTypes.lean"}, "position": {"line": 3, "character": 26}}, - "id": {"const": {"declName": "_private.0.Foo.x"}}}}], + "id": {"const": {"declName": "_private.0.Foo.x"}}, + "cPos": 1}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionPrv.lean.expected.out b/tests/lean/interactive/completionPrv.lean.expected.out index ac03b62acc..319c5da1fd 100644 --- a/tests/lean/interactive/completionPrv.lean.expected.out +++ b/tests/lean/interactive/completionPrv.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 2, "character": 11}}, - "id": {"const": {"declName": "_private.0.blaBlaBoo"}}}}], + "id": {"const": {"declName": "_private.0.blaBlaBoo"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 9, "character": 11}} @@ -20,7 +21,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 9, "character": 11}}, - "id": {"const": {"declName": "_private.0.Foo.booBoo"}}}}, + "id": {"const": {"declName": "_private.0.Foo.booBoo"}}, + "cPos": 0}}, {"sortText": "1", "label": "instToBoolBool", "kind": 21, @@ -28,7 +30,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 9, "character": 11}}, - "id": {"const": {"declName": "instToBoolBool"}}}}, + "id": {"const": {"declName": "instToBoolBool"}}, + "cPos": 0}}, {"sortText": "2", "label": "BitVec.getElem_ofBoolListBE", "kind": 23, @@ -36,7 +39,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 9, "character": 11}}, - "id": {"const": {"declName": "BitVec.getElem_ofBoolListBE"}}}}, + "id": {"const": {"declName": "BitVec.getElem_ofBoolListBE"}}, + "cPos": 0}}, {"sortText": "3", "label": "BitVec.getLsbD_ofBoolListBE", "kind": 23, @@ -44,7 +48,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 9, "character": 11}}, - "id": {"const": {"declName": "BitVec.getLsbD_ofBoolListBE"}}}}, + "id": {"const": {"declName": "BitVec.getLsbD_ofBoolListBE"}}, + "cPos": 0}}, {"sortText": "4", "label": "BitVec.getMsbD_ofBoolListBE", "kind": 23, @@ -52,7 +57,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 9, "character": 11}}, - "id": {"const": {"declName": "BitVec.getMsbD_ofBoolListBE"}}}}, + "id": {"const": {"declName": "BitVec.getMsbD_ofBoolListBE"}}, + "cPos": 0}}, {"sortText": "5", "label": "BitVec.ofBool_and_ofBool", "kind": 23, @@ -60,7 +66,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 9, "character": 11}}, - "id": {"const": {"declName": "BitVec.ofBool_and_ofBool"}}}}, + "id": {"const": {"declName": "BitVec.ofBool_and_ofBool"}}, + "cPos": 0}}, {"sortText": "6", "label": "BitVec.ofBool_or_ofBool", "kind": 23, @@ -68,7 +75,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 9, "character": 11}}, - "id": {"const": {"declName": "BitVec.ofBool_or_ofBool"}}}}, + "id": {"const": {"declName": "BitVec.ofBool_or_ofBool"}}, + "cPos": 0}}, {"sortText": "7", "label": "BitVec.ofBool_xor_ofBool", "kind": 23, @@ -76,7 +84,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 9, "character": 11}}, - "id": {"const": {"declName": "BitVec.ofBool_xor_ofBool"}}}}, + "id": {"const": {"declName": "BitVec.ofBool_xor_ofBool"}}, + "cPos": 0}}, {"sortText": "8", "label": "BitVec.ofBoolListBE", "kind": 3, @@ -87,7 +96,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 9, "character": 11}}, - "id": {"const": {"declName": "BitVec.ofBoolListBE"}}}}], + "id": {"const": {"declName": "BitVec.ofBoolListBE"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 21, "character": 5}} @@ -99,7 +109,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 21, "character": 5}}, - "id": {"const": {"declName": "S.field1"}}}}, + "id": {"const": {"declName": "S.field1"}}, + "cPos": 1}}, {"sortText": "1", "label": "getInc", "kind": 3, @@ -107,7 +118,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 21, "character": 5}}, - "id": {"const": {"declName": "_private.0.S.getInc"}}}}], + "id": {"const": {"declName": "_private.0.S.getInc"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 25, "character": 4}} @@ -119,7 +131,8 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 25, "character": 4}}, - "id": {"const": {"declName": "S.field1"}}}}, + "id": {"const": {"declName": "S.field1"}}, + "cPos": 1}}, {"sortText": "1", "label": "getInc", "kind": 3, @@ -127,5 +140,6 @@ {"params": {"textDocument": {"uri": "file:///completionPrv.lean"}, "position": {"line": 25, "character": 4}}, - "id": {"const": {"declName": "_private.0.S.getInc"}}}}], + "id": {"const": {"declName": "_private.0.S.getInc"}}, + "cPos": 1}}], "isIncomplete": true} diff --git a/tests/lean/interactive/completionStructureInstance.lean b/tests/lean/interactive/completionStructureInstance.lean new file mode 100644 index 0000000000..ff79f641c6 --- /dev/null +++ b/tests/lean/interactive/completionStructureInstance.lean @@ -0,0 +1,96 @@ +import Std.Data.HashSet + +structure S' where + foo : Nat + bar : Nat + +structure S extends S' where + foobar : Nat + barfoo : Nat + +example : S where -- No completions expected + --^ textDocument/completion + +example : S where -- All field completions expected + --^ textDocument/completion + +example : S where + -- All field completions expected +--^ textDocument/completion + +example : S where + f -- All field completions matching `f` expected + --^ textDocument/completion + +example : S where + foo -- All field completions matching `foo` expected + --^ textDocument/completion + +example : S where + foo := -- No completions expected + --^ textDocument/completion + +example : S where + foo := + -- No completions expected + --^ textDocument/completion + +example : S where + foo := 1 + -- All field completions expected +--^ textDocument/completion + +example : S where + foo := 1; -- All field completions expected + --^ textDocument/completion + +example : S := { } -- All field completions expected + --^ textDocument/completion + +example : S := { + -- All field completions expected +--^ textDocument/completion +} + +example : S := { + f -- All field completions matching `f` expected + --^ textDocument/completion +} + +example : S := { + foo -- All field completions matching `foo` expected + --^ textDocument/completion +} + +example : S := { + foo := + -- No completions expected + --^ textDocument/completion +} + +example : S := { + foo := 1 + -- All field completions expected +--^ textDocument/completion +} + +example : S := { + foo := 1 + -- All field completions expected +--^ textDocument/completion +} + +example : S := { foo := 1, } -- All field completions expected + --^ textDocument/completion + +example (s : S) : S := { s with } -- All field completions expected + --^ textDocument/completion + +example (s : S) : S := { s with : S } -- All field completions expected + --^ textDocument/completion + +example (s : S) : S := { s with f } -- All field completions matching `f` expected + --^ textDocument/completion + +example (aLongUniqueIdentifier : Nat) : Std.HashSet Nat := { aLongUniqueIdentifier } -- Identifier completion matching `aLongUniqueIdentifier` + --^ textDocument/completion diff --git a/tests/lean/interactive/completionStructureInstance.lean.expected.out b/tests/lean/interactive/completionStructureInstance.lean.expected.out new file mode 100644 index 0000000000..50f5be772f --- /dev/null +++ b/tests/lean/interactive/completionStructureInstance.lean.expected.out @@ -0,0 +1,612 @@ +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 10, "character": 17}} +{"items": + [{"sortText": "0", + "label": "bar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 10, "character": 17}}, + "cPos": 0}}, + {"sortText": "1", + "label": "barfoo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 10, "character": 17}}, + "cPos": 0}}, + {"sortText": "2", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 10, "character": 17}}, + "cPos": 0}}, + {"sortText": "3", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 10, "character": 17}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 13, "character": 18}} +{"items": + [{"sortText": "0", + "label": "bar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 13, "character": 18}}, + "cPos": 0}}, + {"sortText": "1", + "label": "barfoo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 13, "character": 18}}, + "cPos": 0}}, + {"sortText": "2", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 13, "character": 18}}, + "cPos": 0}}, + {"sortText": "3", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 13, "character": 18}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 17, "character": 2}} +{"items": + [{"sortText": "0", + "label": "bar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 17, "character": 2}}, + "cPos": 0}}, + {"sortText": "1", + "label": "barfoo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 17, "character": 2}}, + "cPos": 0}}, + {"sortText": "2", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 17, "character": 2}}, + "cPos": 0}}, + {"sortText": "3", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 17, "character": 2}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 21, "character": 3}} +{"items": + [{"sortText": "0", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 21, "character": 3}}, + "cPos": 0}}, + {"sortText": "1", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 21, "character": 3}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 25, "character": 5}} +{"items": + [{"sortText": "0", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 25, "character": 5}}, + "cPos": 0}}, + {"sortText": "1", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 25, "character": 5}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 29, "character": 9}} +{"items": [], "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 34, "character": 4}} +{"items": [], "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 39, "character": 2}} +{"items": + [{"sortText": "0", + "label": "bar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 39, "character": 2}}, + "cPos": 0}}, + {"sortText": "1", + "label": "barfoo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 39, "character": 2}}, + "cPos": 0}}, + {"sortText": "2", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 39, "character": 2}}, + "cPos": 0}}, + {"sortText": "3", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 39, "character": 2}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 43, "character": 12}} +{"items": + [{"sortText": "0", + "label": "bar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 43, "character": 12}}, + "cPos": 0}}, + {"sortText": "1", + "label": "barfoo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 43, "character": 12}}, + "cPos": 0}}, + {"sortText": "2", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 43, "character": 12}}, + "cPos": 0}}, + {"sortText": "3", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 43, "character": 12}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 46, "character": 17}} +{"items": + [{"sortText": "0", + "label": "bar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 46, "character": 17}}, + "cPos": 0}}, + {"sortText": "1", + "label": "barfoo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 46, "character": 17}}, + "cPos": 0}}, + {"sortText": "2", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 46, "character": 17}}, + "cPos": 0}}, + {"sortText": "3", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 46, "character": 17}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 50, "character": 2}} +{"items": + [{"sortText": "0", + "label": "bar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 50, "character": 2}}, + "cPos": 0}}, + {"sortText": "1", + "label": "barfoo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 50, "character": 2}}, + "cPos": 0}}, + {"sortText": "2", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 50, "character": 2}}, + "cPos": 0}}, + {"sortText": "3", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 50, "character": 2}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 55, "character": 3}} +{"items": + [{"sortText": "0", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 55, "character": 3}}, + "cPos": 1}}, + {"sortText": "1", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 55, "character": 3}}, + "cPos": 1}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 60, "character": 5}} +{"items": + [{"sortText": "0", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 60, "character": 5}}, + "cPos": 1}}, + {"sortText": "1", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 60, "character": 5}}, + "cPos": 1}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 66, "character": 4}} +{"items": [], "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 72, "character": 2}} +{"items": + [{"sortText": "0", + "label": "bar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 72, "character": 2}}, + "cPos": 0}}, + {"sortText": "1", + "label": "barfoo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 72, "character": 2}}, + "cPos": 0}}, + {"sortText": "2", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 72, "character": 2}}, + "cPos": 0}}, + {"sortText": "3", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 72, "character": 2}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 78, "character": 2}} +{"items": + [{"sortText": "0", + "label": "bar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 78, "character": 2}}, + "cPos": 0}}, + {"sortText": "1", + "label": "barfoo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 78, "character": 2}}, + "cPos": 0}}, + {"sortText": "2", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 78, "character": 2}}, + "cPos": 0}}, + {"sortText": "3", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 78, "character": 2}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 82, "character": 27}} +{"items": + [{"sortText": "0", + "label": "bar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 82, "character": 27}}, + "cPos": 0}}, + {"sortText": "1", + "label": "barfoo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 82, "character": 27}}, + "cPos": 0}}, + {"sortText": "2", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 82, "character": 27}}, + "cPos": 0}}, + {"sortText": "3", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 82, "character": 27}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 85, "character": 32}} +{"items": + [{"sortText": "0", + "label": "bar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 85, "character": 32}}, + "cPos": 0}}, + {"sortText": "1", + "label": "barfoo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 85, "character": 32}}, + "cPos": 0}}, + {"sortText": "2", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 85, "character": 32}}, + "cPos": 0}}, + {"sortText": "3", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 85, "character": 32}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 88, "character": 32}} +{"items": + [{"sortText": "0", + "label": "bar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 88, "character": 32}}, + "cPos": 0}}, + {"sortText": "1", + "label": "barfoo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 88, "character": 32}}, + "cPos": 0}}, + {"sortText": "2", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 88, "character": 32}}, + "cPos": 0}}, + {"sortText": "3", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 88, "character": 32}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 91, "character": 33}} +{"items": + [{"sortText": "0", + "label": "foo", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 91, "character": 33}}, + "cPos": 0}}, + {"sortText": "1", + "label": "foobar", + "kind": 5, + "detail": "field", + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 91, "character": 33}}, + "cPos": 0}}], + "isIncomplete": true} +{"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 94, "character": 82}} +{"items": + [{"sortText": "0", + "label": "aLongUniqueIdentifier", + "kind": 6, + "data": + {"params": + {"textDocument": {"uri": "file:///completionStructureInstance.lean"}, + "position": {"line": 94, "character": 82}}, + "id": {"fvar": {"id": "_uniq.1024"}}, + "cPos": 0}}], + "isIncomplete": true} diff --git a/tests/lean/interactive/completionTactics.lean.expected.out b/tests/lean/interactive/completionTactics.lean.expected.out index f68e2e2f77..dbe081fa57 100644 --- a/tests/lean/interactive/completionTactics.lean.expected.out +++ b/tests/lean/interactive/completionTactics.lean.expected.out @@ -11,7 +11,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 23, "character": 21}}}}, + "position": {"line": 23, "character": 21}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -22,7 +23,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 23, "character": 21}}}}, + "position": {"line": 23, "character": 21}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -33,14 +35,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 23, "character": 21}}}}, + "position": {"line": 23, "character": 21}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 23, "character": 21}}}}, + "position": {"line": 23, "character": 21}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -51,7 +55,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 23, "character": 21}}}}, + "position": {"line": 23, "character": 21}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -62,14 +67,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 23, "character": 21}}}}, + "position": {"line": 23, "character": 21}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 23, "character": 21}}}}, + "position": {"line": 23, "character": 21}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -77,7 +84,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 23, "character": 21}}}}], + "position": {"line": 23, "character": 21}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 26, "character": 24}} @@ -89,7 +97,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 26, "character": 24}}}}, + "position": {"line": 26, "character": 24}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -100,7 +109,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 26, "character": 24}}}}, + "position": {"line": 26, "character": 24}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -111,14 +121,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 26, "character": 24}}}}, + "position": {"line": 26, "character": 24}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 26, "character": 24}}}}, + "position": {"line": 26, "character": 24}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -129,7 +141,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 26, "character": 24}}}}, + "position": {"line": 26, "character": 24}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -140,14 +153,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 26, "character": 24}}}}, + "position": {"line": 26, "character": 24}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 26, "character": 24}}}}, + "position": {"line": 26, "character": 24}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -155,7 +170,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 26, "character": 24}}}}], + "position": {"line": 26, "character": 24}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 29, "character": 25}} @@ -170,7 +186,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 32, "character": 26}}}}, + "position": {"line": 32, "character": 26}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -181,7 +198,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 32, "character": 26}}}}, + "position": {"line": 32, "character": 26}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -192,14 +210,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 32, "character": 26}}}}, + "position": {"line": 32, "character": 26}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 32, "character": 26}}}}, + "position": {"line": 32, "character": 26}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -210,7 +230,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 32, "character": 26}}}}, + "position": {"line": 32, "character": 26}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -221,14 +242,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 32, "character": 26}}}}, + "position": {"line": 32, "character": 26}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 32, "character": 26}}}}, + "position": {"line": 32, "character": 26}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -236,7 +259,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 32, "character": 26}}}}], + "position": {"line": 32, "character": 26}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 35, "character": 27}} @@ -248,7 +272,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 35, "character": 27}}}}, + "position": {"line": 35, "character": 27}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -259,7 +284,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 35, "character": 27}}}}, + "position": {"line": 35, "character": 27}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -270,14 +296,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 35, "character": 27}}}}, + "position": {"line": 35, "character": 27}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 35, "character": 27}}}}, + "position": {"line": 35, "character": 27}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -288,7 +316,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 35, "character": 27}}}}, + "position": {"line": 35, "character": 27}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -299,14 +328,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 35, "character": 27}}}}, + "position": {"line": 35, "character": 27}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 35, "character": 27}}}}, + "position": {"line": 35, "character": 27}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -314,7 +345,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 35, "character": 27}}}}], + "position": {"line": 35, "character": 27}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 40, "character": 7}} @@ -326,7 +358,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 40, "character": 7}}}}, + "position": {"line": 40, "character": 7}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -337,7 +370,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 40, "character": 7}}}}, + "position": {"line": 40, "character": 7}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -348,14 +382,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 40, "character": 7}}}}, + "position": {"line": 40, "character": 7}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 40, "character": 7}}}}, + "position": {"line": 40, "character": 7}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -366,7 +402,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 40, "character": 7}}}}, + "position": {"line": 40, "character": 7}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -377,14 +414,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 40, "character": 7}}}}, + "position": {"line": 40, "character": 7}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 40, "character": 7}}}}, + "position": {"line": 40, "character": 7}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -392,7 +431,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 40, "character": 7}}}}], + "position": {"line": 40, "character": 7}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 44, "character": 2}} @@ -404,7 +444,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 44, "character": 2}}}}, + "position": {"line": 44, "character": 2}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -415,7 +456,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 44, "character": 2}}}}, + "position": {"line": 44, "character": 2}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -426,14 +468,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 44, "character": 2}}}}, + "position": {"line": 44, "character": 2}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 44, "character": 2}}}}, + "position": {"line": 44, "character": 2}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -444,7 +488,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 44, "character": 2}}}}, + "position": {"line": 44, "character": 2}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -455,14 +500,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 44, "character": 2}}}}, + "position": {"line": 44, "character": 2}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 44, "character": 2}}}}, + "position": {"line": 44, "character": 2}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -470,7 +517,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 44, "character": 2}}}}], + "position": {"line": 44, "character": 2}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 49, "character": 2}} @@ -482,7 +530,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 49, "character": 2}}}}, + "position": {"line": 49, "character": 2}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -493,7 +542,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 49, "character": 2}}}}, + "position": {"line": 49, "character": 2}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -504,14 +554,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 49, "character": 2}}}}, + "position": {"line": 49, "character": 2}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 49, "character": 2}}}}, + "position": {"line": 49, "character": 2}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -522,7 +574,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 49, "character": 2}}}}, + "position": {"line": 49, "character": 2}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -533,14 +586,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 49, "character": 2}}}}, + "position": {"line": 49, "character": 2}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 49, "character": 2}}}}, + "position": {"line": 49, "character": 2}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -548,7 +603,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 49, "character": 2}}}}], + "position": {"line": 49, "character": 2}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 53, "character": 2}} @@ -560,7 +616,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 53, "character": 2}}}}, + "position": {"line": 53, "character": 2}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -571,7 +628,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 53, "character": 2}}}}, + "position": {"line": 53, "character": 2}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -582,14 +640,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 53, "character": 2}}}}, + "position": {"line": 53, "character": 2}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 53, "character": 2}}}}, + "position": {"line": 53, "character": 2}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -600,7 +660,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 53, "character": 2}}}}, + "position": {"line": 53, "character": 2}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -611,14 +672,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 53, "character": 2}}}}, + "position": {"line": 53, "character": 2}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 53, "character": 2}}}}, + "position": {"line": 53, "character": 2}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -626,7 +689,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 53, "character": 2}}}}], + "position": {"line": 53, "character": 2}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 59, "character": 4}} @@ -638,7 +702,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 59, "character": 4}}}}, + "position": {"line": 59, "character": 4}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -649,7 +714,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 59, "character": 4}}}}, + "position": {"line": 59, "character": 4}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -660,14 +726,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 59, "character": 4}}}}, + "position": {"line": 59, "character": 4}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 59, "character": 4}}}}, + "position": {"line": 59, "character": 4}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -678,7 +746,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 59, "character": 4}}}}, + "position": {"line": 59, "character": 4}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -689,14 +758,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 59, "character": 4}}}}, + "position": {"line": 59, "character": 4}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 59, "character": 4}}}}, + "position": {"line": 59, "character": 4}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -704,7 +775,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 59, "character": 4}}}}], + "position": {"line": 59, "character": 4}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 64, "character": 2}} @@ -716,7 +788,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 64, "character": 2}}}}, + "position": {"line": 64, "character": 2}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -727,7 +800,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 64, "character": 2}}}}, + "position": {"line": 64, "character": 2}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -738,14 +812,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 64, "character": 2}}}}, + "position": {"line": 64, "character": 2}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 64, "character": 2}}}}, + "position": {"line": 64, "character": 2}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -756,7 +832,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 64, "character": 2}}}}, + "position": {"line": 64, "character": 2}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -767,14 +844,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 64, "character": 2}}}}, + "position": {"line": 64, "character": 2}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 64, "character": 2}}}}, + "position": {"line": 64, "character": 2}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -782,7 +861,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 64, "character": 2}}}}], + "position": {"line": 64, "character": 2}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 70, "character": 4}} @@ -794,7 +874,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 70, "character": 4}}}}, + "position": {"line": 70, "character": 4}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -805,7 +886,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 70, "character": 4}}}}, + "position": {"line": 70, "character": 4}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -816,14 +898,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 70, "character": 4}}}}, + "position": {"line": 70, "character": 4}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 70, "character": 4}}}}, + "position": {"line": 70, "character": 4}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -834,7 +918,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 70, "character": 4}}}}, + "position": {"line": 70, "character": 4}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -845,14 +930,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 70, "character": 4}}}}, + "position": {"line": 70, "character": 4}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 70, "character": 4}}}}, + "position": {"line": 70, "character": 4}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -860,7 +947,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 70, "character": 4}}}}], + "position": {"line": 70, "character": 4}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 76, "character": 2}} @@ -872,7 +960,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 76, "character": 2}}}}, + "position": {"line": 76, "character": 2}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -883,7 +972,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 76, "character": 2}}}}, + "position": {"line": 76, "character": 2}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -894,14 +984,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 76, "character": 2}}}}, + "position": {"line": 76, "character": 2}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 76, "character": 2}}}}, + "position": {"line": 76, "character": 2}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -912,7 +1004,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 76, "character": 2}}}}, + "position": {"line": 76, "character": 2}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -923,14 +1016,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 76, "character": 2}}}}, + "position": {"line": 76, "character": 2}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 76, "character": 2}}}}, + "position": {"line": 76, "character": 2}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -938,7 +1033,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 76, "character": 2}}}}], + "position": {"line": 76, "character": 2}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 81, "character": 4}} @@ -953,7 +1049,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 86, "character": 2}}}}, + "position": {"line": 86, "character": 2}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -964,7 +1061,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 86, "character": 2}}}}, + "position": {"line": 86, "character": 2}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -975,14 +1073,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 86, "character": 2}}}}, + "position": {"line": 86, "character": 2}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 86, "character": 2}}}}, + "position": {"line": 86, "character": 2}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -993,7 +1093,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 86, "character": 2}}}}, + "position": {"line": 86, "character": 2}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -1004,14 +1105,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 86, "character": 2}}}}, + "position": {"line": 86, "character": 2}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 86, "character": 2}}}}, + "position": {"line": 86, "character": 2}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -1019,7 +1122,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 86, "character": 2}}}}], + "position": {"line": 86, "character": 2}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 91, "character": 4}} @@ -1031,7 +1135,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 91, "character": 4}}}}, + "position": {"line": 91, "character": 4}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -1042,7 +1147,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 91, "character": 4}}}}, + "position": {"line": 91, "character": 4}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -1053,14 +1159,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 91, "character": 4}}}}, + "position": {"line": 91, "character": 4}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 91, "character": 4}}}}, + "position": {"line": 91, "character": 4}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -1071,7 +1179,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 91, "character": 4}}}}, + "position": {"line": 91, "character": 4}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -1082,14 +1191,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 91, "character": 4}}}}, + "position": {"line": 91, "character": 4}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 91, "character": 4}}}}, + "position": {"line": 91, "character": 4}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -1097,7 +1208,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 91, "character": 4}}}}], + "position": {"line": 91, "character": 4}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 96, "character": 2}} @@ -1109,7 +1221,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 96, "character": 2}}}}, + "position": {"line": 96, "character": 2}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -1120,7 +1233,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 96, "character": 2}}}}, + "position": {"line": 96, "character": 2}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -1131,14 +1245,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 96, "character": 2}}}}, + "position": {"line": 96, "character": 2}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 96, "character": 2}}}}, + "position": {"line": 96, "character": 2}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -1149,7 +1265,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 96, "character": 2}}}}, + "position": {"line": 96, "character": 2}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -1160,14 +1277,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 96, "character": 2}}}}, + "position": {"line": 96, "character": 2}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 96, "character": 2}}}}, + "position": {"line": 96, "character": 2}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -1175,7 +1294,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 96, "character": 2}}}}], + "position": {"line": 96, "character": 2}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 102, "character": 4}} @@ -1187,7 +1307,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 102, "character": 4}}}}, + "position": {"line": 102, "character": 4}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -1198,7 +1319,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 102, "character": 4}}}}, + "position": {"line": 102, "character": 4}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -1209,14 +1331,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 102, "character": 4}}}}, + "position": {"line": 102, "character": 4}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 102, "character": 4}}}}, + "position": {"line": 102, "character": 4}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -1227,7 +1351,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 102, "character": 4}}}}, + "position": {"line": 102, "character": 4}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -1238,14 +1363,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 102, "character": 4}}}}, + "position": {"line": 102, "character": 4}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 102, "character": 4}}}}, + "position": {"line": 102, "character": 4}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -1253,7 +1380,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 102, "character": 4}}}}], + "position": {"line": 102, "character": 4}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///completionTactics.lean"}, "position": {"line": 108, "character": 2}} @@ -1268,7 +1396,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 112, "character": 2}}}}, + "position": {"line": 112, "character": 2}}, + "cPos": 0}}, {"sortText": "1", "label": "Lean.Parser.Tactic.introMatch", "kind": 14, @@ -1279,7 +1408,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 112, "character": 2}}}}, + "position": {"line": 112, "character": 2}}, + "cPos": 0}}, {"sortText": "2", "label": "Lean.Parser.Tactic.match", "kind": 14, @@ -1290,14 +1420,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 112, "character": 2}}}}, + "position": {"line": 112, "character": 2}}, + "cPos": 0}}, {"sortText": "3", "label": "Lean.Parser.Tactic.nestedTactic", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 112, "character": 2}}}}, + "position": {"line": 112, "character": 2}}, + "cPos": 0}}, {"sortText": "4", "label": "Lean.Parser.Tactic.open", "kind": 14, @@ -1308,7 +1440,8 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 112, "character": 2}}}}, + "position": {"line": 112, "character": 2}}, + "cPos": 0}}, {"sortText": "5", "label": "Lean.Parser.Tactic.set_option", "kind": 14, @@ -1319,14 +1452,16 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 112, "character": 2}}}}, + "position": {"line": 112, "character": 2}}, + "cPos": 0}}, {"sortText": "6", "label": "Lean.Parser.Tactic.unknown", "kind": 14, "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 112, "character": 2}}}}, + "position": {"line": 112, "character": 2}}, + "cPos": 0}}, {"sortText": "7", "label": "skip", "kind": 14, @@ -1334,5 +1469,6 @@ "data": {"params": {"textDocument": {"uri": "file:///completionTactics.lean"}, - "position": {"line": 112, "character": 2}}}}], + "position": {"line": 112, "character": 2}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/dotIdCompletion.lean.expected.out b/tests/lean/interactive/dotIdCompletion.lean.expected.out index 1cca64cc65..75efda6613 100644 --- a/tests/lean/interactive/dotIdCompletion.lean.expected.out +++ b/tests/lean/interactive/dotIdCompletion.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///dotIdCompletion.lean"}, "position": {"line": 4, "character": 5}}, - "id": {"const": {"declName": "Boo.true"}}}}, + "id": {"const": {"declName": "Boo.true"}}, + "cPos": 0}}, {"sortText": "1", "label": "truth", "kind": 4, @@ -16,5 +17,6 @@ {"params": {"textDocument": {"uri": "file:///dotIdCompletion.lean"}, "position": {"line": 4, "character": 5}}, - "id": {"const": {"declName": "Boo.truth"}}}}], + "id": {"const": {"declName": "Boo.truth"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/editCompletion.lean.expected.out b/tests/lean/interactive/editCompletion.lean.expected.out index 104ba7b4bf..56deb0a4c0 100644 --- a/tests/lean/interactive/editCompletion.lean.expected.out +++ b/tests/lean/interactive/editCompletion.lean.expected.out @@ -8,5 +8,6 @@ {"params": {"textDocument": {"uri": "file:///editCompletion.lean"}, "position": {"line": 3, "character": 22}}, - "id": {"const": {"declName": "Foo.foo"}}}}], + "id": {"const": {"declName": "Foo.foo"}}, + "cPos": 1}}], "isIncomplete": true} diff --git a/tests/lean/interactive/inWordCompletion.lean.expected.out b/tests/lean/interactive/inWordCompletion.lean.expected.out index 0c61f227a9..4859dcb72f 100644 --- a/tests/lean/interactive/inWordCompletion.lean.expected.out +++ b/tests/lean/interactive/inWordCompletion.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///inWordCompletion.lean"}, "position": {"line": 4, "character": 11}}, - "id": {"const": {"declName": "gfxabc"}}}}, + "id": {"const": {"declName": "gfxabc"}}, + "cPos": 0}}, {"sortText": "1", "label": "gfxacc", "kind": 3, @@ -16,7 +17,8 @@ {"params": {"textDocument": {"uri": "file:///inWordCompletion.lean"}, "position": {"line": 4, "character": 11}}, - "id": {"const": {"declName": "gfxacc"}}}}, + "id": {"const": {"declName": "gfxacc"}}, + "cPos": 0}}, {"sortText": "2", "label": "gfxadc", "kind": 3, @@ -24,7 +26,8 @@ {"params": {"textDocument": {"uri": "file:///inWordCompletion.lean"}, "position": {"line": 4, "character": 11}}, - "id": {"const": {"declName": "gfxadc"}}}}], + "id": {"const": {"declName": "gfxadc"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///inWordCompletion.lean"}, "position": {"line": 12, "character": 15}} @@ -36,7 +39,8 @@ {"params": {"textDocument": {"uri": "file:///inWordCompletion.lean"}, "position": {"line": 12, "character": 15}}, - "id": {"const": {"declName": "Boo.gfxabc"}}}}, + "id": {"const": {"declName": "Boo.gfxabc"}}, + "cPos": 0}}, {"sortText": "1", "label": "gfxacc", "kind": 3, @@ -44,7 +48,8 @@ {"params": {"textDocument": {"uri": "file:///inWordCompletion.lean"}, "position": {"line": 12, "character": 15}}, - "id": {"const": {"declName": "Boo.gfxacc"}}}}, + "id": {"const": {"declName": "Boo.gfxacc"}}, + "cPos": 0}}, {"sortText": "2", "label": "gfxadc", "kind": 3, @@ -52,5 +57,6 @@ {"params": {"textDocument": {"uri": "file:///inWordCompletion.lean"}, "position": {"line": 12, "character": 15}}, - "id": {"const": {"declName": "Boo.gfxadc"}}}}], + "id": {"const": {"declName": "Boo.gfxadc"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/internalNamesIssue.lean.expected.out b/tests/lean/interactive/internalNamesIssue.lean.expected.out index d2e2dd36fd..36d36c565f 100644 --- a/tests/lean/interactive/internalNamesIssue.lean.expected.out +++ b/tests/lean/interactive/internalNamesIssue.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///internalNamesIssue.lean"}, "position": {"line": 9, "character": 11}}, - "id": {"const": {"declName": "Foo.bla"}}}}, + "id": {"const": {"declName": "Foo.bla"}}, + "cPos": 0}}, {"sortText": "1", "label": "foo", "kind": 3, @@ -16,5 +17,6 @@ {"params": {"textDocument": {"uri": "file:///internalNamesIssue.lean"}, "position": {"line": 9, "character": 11}}, - "id": {"const": {"declName": "Foo.foo"}}}}], + "id": {"const": {"declName": "Foo.foo"}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/keywordCompletion.lean.expected.out b/tests/lean/interactive/keywordCompletion.lean.expected.out index 19498180d6..ca9f2d2217 100644 --- a/tests/lean/interactive/keywordCompletion.lean.expected.out +++ b/tests/lean/interactive/keywordCompletion.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///keywordCompletion.lean"}, "position": {"line": 4, "character": 10}}, - "id": {"const": {"declName": "bin"}}}}, + "id": {"const": {"declName": "bin"}}, + "cPos": 0}}, {"sortText": "1", "label": "binder_predicate", "kind": 14, @@ -16,7 +17,8 @@ "data": {"params": {"textDocument": {"uri": "file:///keywordCompletion.lean"}, - "position": {"line": 4, "character": 10}}}}, + "position": {"line": 4, "character": 10}}, + "cPos": 0}}, {"sortText": "2", "label": "binop%", "kind": 14, @@ -24,7 +26,8 @@ "data": {"params": {"textDocument": {"uri": "file:///keywordCompletion.lean"}, - "position": {"line": 4, "character": 10}}}}, + "position": {"line": 4, "character": 10}}, + "cPos": 0}}, {"sortText": "3", "label": "binop_lazy%", "kind": 14, @@ -32,7 +35,8 @@ "data": {"params": {"textDocument": {"uri": "file:///keywordCompletion.lean"}, - "position": {"line": 4, "character": 10}}}}, + "position": {"line": 4, "character": 10}}, + "cPos": 0}}, {"sortText": "4", "label": "binrel%", "kind": 14, @@ -40,7 +44,8 @@ "data": {"params": {"textDocument": {"uri": "file:///keywordCompletion.lean"}, - "position": {"line": 4, "character": 10}}}}, + "position": {"line": 4, "character": 10}}, + "cPos": 0}}, {"sortText": "5", "label": "binrel_no_prop%", "kind": 14, @@ -48,7 +53,8 @@ "data": {"params": {"textDocument": {"uri": "file:///keywordCompletion.lean"}, - "position": {"line": 4, "character": 10}}}}], + "position": {"line": 4, "character": 10}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///keywordCompletion.lean"}, "position": {"line": 4, "character": 13}} @@ -60,5 +66,6 @@ "data": {"params": {"textDocument": {"uri": "file:///keywordCompletion.lean"}, - "position": {"line": 4, "character": 13}}}}], + "position": {"line": 4, "character": 13}}, + "cPos": 0}}], "isIncomplete": true} diff --git a/tests/lean/interactive/match.lean.expected.out b/tests/lean/interactive/match.lean.expected.out index 4965eee71f..3c149c1dd5 100644 --- a/tests/lean/interactive/match.lean.expected.out +++ b/tests/lean/interactive/match.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///match.lean"}, "position": {"line": 6, "character": 11}}, - "id": {"const": {"declName": "S.fn1"}}}}, + "id": {"const": {"declName": "S.fn1"}}, + "cPos": 1}}, {"sortText": "1", "label": "name", "kind": 5, @@ -16,7 +17,8 @@ {"params": {"textDocument": {"uri": "file:///match.lean"}, "position": {"line": 6, "character": 11}}, - "id": {"const": {"declName": "S.name"}}}}, + "id": {"const": {"declName": "S.name"}}, + "cPos": 1}}, {"sortText": "2", "label": "value", "kind": 5, @@ -24,7 +26,8 @@ {"params": {"textDocument": {"uri": "file:///match.lean"}, "position": {"line": 6, "character": 11}}, - "id": {"const": {"declName": "S.value"}}}}], + "id": {"const": {"declName": "S.value"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///match.lean"}, "position": {"line": 10, "character": 10}} @@ -36,7 +39,8 @@ {"params": {"textDocument": {"uri": "file:///match.lean"}, "position": {"line": 10, "character": 10}}, - "id": {"const": {"declName": "S.fn1"}}}}, + "id": {"const": {"declName": "S.fn1"}}, + "cPos": 1}}, {"sortText": "1", "label": "name", "kind": 5, @@ -44,7 +48,8 @@ {"params": {"textDocument": {"uri": "file:///match.lean"}, "position": {"line": 10, "character": 10}}, - "id": {"const": {"declName": "S.name"}}}}, + "id": {"const": {"declName": "S.name"}}, + "cPos": 1}}, {"sortText": "2", "label": "value", "kind": 5, @@ -52,7 +57,8 @@ {"params": {"textDocument": {"uri": "file:///match.lean"}, "position": {"line": 10, "character": 10}}, - "id": {"const": {"declName": "S.value"}}}}], + "id": {"const": {"declName": "S.value"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///match.lean"}, "position": {"line": 14, "character": 2}} diff --git a/tests/lean/interactive/matchStxCompletion.lean.expected.out b/tests/lean/interactive/matchStxCompletion.lean.expected.out index 6e9e15b097..86d0747ddd 100644 --- a/tests/lean/interactive/matchStxCompletion.lean.expected.out +++ b/tests/lean/interactive/matchStxCompletion.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///matchStxCompletion.lean"}, "position": {"line": 8, "character": 9}}, - "id": {"const": {"declName": "C.b1"}}}}, + "id": {"const": {"declName": "C.b1"}}, + "cPos": 1}}, {"sortText": "1", "label": "f1", "kind": 5, @@ -16,7 +17,8 @@ {"params": {"textDocument": {"uri": "file:///matchStxCompletion.lean"}, "position": {"line": 8, "character": 9}}, - "id": {"const": {"declName": "C.f1"}}}}, + "id": {"const": {"declName": "C.f1"}}, + "cPos": 1}}, {"sortText": "2", "label": "f2", "kind": 5, @@ -24,5 +26,6 @@ {"params": {"textDocument": {"uri": "file:///matchStxCompletion.lean"}, "position": {"line": 8, "character": 9}}, - "id": {"const": {"declName": "C.f2"}}}}], + "id": {"const": {"declName": "C.f2"}}, + "cPos": 1}}], "isIncomplete": true} diff --git a/tests/lean/interactive/travellingCompletions.lean.expected.out b/tests/lean/interactive/travellingCompletions.lean.expected.out index 15c1f442e7..b04e4b81cd 100644 --- a/tests/lean/interactive/travellingCompletions.lean.expected.out +++ b/tests/lean/interactive/travellingCompletions.lean.expected.out @@ -8,7 +8,8 @@ {"params": {"textDocument": {"uri": "file:///travellingCompletions.lean"}, "position": {"line": 7, "character": 33}}, - "id": {"const": {"declName": "aaaaaaaa"}}}}], + "id": {"const": {"declName": "aaaaaaaa"}}, + "cPos": 0}}], "isIncomplete": true} {"textDocument": {"uri": "file:///travellingCompletions.lean"}, "position": {"line": 20, "character": 20}} @@ -20,7 +21,8 @@ {"params": {"textDocument": {"uri": "file:///travellingCompletions.lean"}, "position": {"line": 20, "character": 20}}, - "id": {"const": {"declName": "Bar.foobar"}}}}], + "id": {"const": {"declName": "Bar.foobar"}}, + "cPos": 2}}], "isIncomplete": true} {"textDocument": {"uri": "file:///travellingCompletions.lean"}, "position": {"line": 24, "character": 16}} @@ -32,7 +34,8 @@ {"params": {"textDocument": {"uri": "file:///travellingCompletions.lean"}, "position": {"line": 24, "character": 16}}, - "id": {"const": {"declName": "Bar.foobar"}}}}], + "id": {"const": {"declName": "Bar.foobar"}}, + "cPos": 2}}], "isIncomplete": true} {"textDocument": {"uri": "file:///travellingCompletions.lean"}, "position": {"line": 38, "character": 45}} @@ -44,7 +47,8 @@ {"params": {"textDocument": {"uri": "file:///travellingCompletions.lean"}, "position": {"line": 38, "character": 45}}, - "id": {"const": {"declName": "Prod.continuousAdd"}}}}, + "id": {"const": {"declName": "Prod.continuousAdd"}}, + "cPos": 1}}, {"sortText": "1", "label": "continuousSMul", "kind": 23, @@ -52,7 +56,8 @@ {"params": {"textDocument": {"uri": "file:///travellingCompletions.lean"}, "position": {"line": 38, "character": 45}}, - "id": {"const": {"declName": "Prod.continuousSMul"}}}}], + "id": {"const": {"declName": "Prod.continuousSMul"}}, + "cPos": 1}}], "isIncomplete": true} {"textDocument": {"uri": "file:///travellingCompletions.lean"}, "position": {"line": 42, "character": 25}} @@ -68,5 +73,6 @@ {"params": {"textDocument": {"uri": "file:///travellingCompletions.lean"}, "position": {"line": 42, "character": 25}}, - "id": {"const": {"declName": "True.intro"}}}}], + "id": {"const": {"declName": "True.intro"}}, + "cPos": 1}}], "isIncomplete": true}