test: improve language server test coverage (#10574)
This PR significantly improves the test coverage of the language server, providing at least a single basic test for every request that is used by the client. It also implements infrastructure for testing all of these requests, e.g. the ability to run interactive tests in a project context and refactors the interactive test runner to be more maintainable. Finally, it also fixes a small bug with the recently implemented unknown identifier code actions for auto-implicits (#10442) that was discovered in testing, where the "import all unambiguous unknown identifiers" code action didn't work correctly on auto-implicit identifiers.
This commit is contained in:
parent
7d55c033e1
commit
dfd3d18530
147 changed files with 7774 additions and 1136 deletions
|
|
@ -59,7 +59,7 @@ All these tests are included by [src/shell/CMakeLists.txt](https://github.com/le
|
|||
open Foo in
|
||||
theorem tst2 (h : a ≤ b) : a + 2 ≤ b + 2 :=
|
||||
Bla.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
```
|
||||
In this example, the test driver [`test_single.sh`](https://github.com/leanprover/lean4/tree/master/tests/lean/interactive/test_single.sh) will simulate an
|
||||
auto-completion request at `Bla.`. The expected output is stored in
|
||||
|
|
|
|||
|
|
@ -797,6 +797,9 @@ install(DIRECTORY "${CMAKE_BINARY_DIR}/lib/" DESTINATION lib
|
|||
|
||||
# symlink source into expected installation location for go-to-definition, if file system allows it
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src)
|
||||
# get rid of all files in `src/lean` that may have been loaded from the cache
|
||||
# (at the time of writing this, this is the case for some lake test .c files)
|
||||
file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/src/lean)
|
||||
if(${STAGE} EQUAL 0)
|
||||
file(CREATE_LINK ${CMAKE_SOURCE_DIR}/../../src ${CMAKE_BINARY_DIR}/src/lean RESULT _IGNORE_RES SYMBOLIC)
|
||||
else()
|
||||
|
|
|
|||
|
|
@ -643,7 +643,7 @@ applications of this function as `↑` when printing expressions.
|
|||
syntax (name := Attr.coe) "coe" : attr
|
||||
|
||||
/--
|
||||
This attribute marks a code action, which is used to suggest new tactics or replace existing ones.
|
||||
This attribute marks a code action that triggers on specific commands.
|
||||
|
||||
* `@[command_code_action kind]`: This is a code action which applies to applications of the command
|
||||
`kind` (a command syntax kind), which can replace the command or insert things before or after it.
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ public import Lean.Data.Lsp.Communication
|
|||
public import Lean.Data.Lsp.Diagnostics
|
||||
public import Lean.Data.Lsp.Extra
|
||||
import Init.Data.List.Sort.Basic
|
||||
public import Lean.Data.Lsp.LanguageFeatures
|
||||
|
||||
public section
|
||||
|
||||
|
|
@ -160,10 +161,191 @@ where
|
|||
| Except.error inner => throw $ userError s!"Cannot decode publishDiagnostics parameters\n{inner}"
|
||||
| _ => loop
|
||||
|
||||
def runWith (lean : System.FilePath) (args : Array String := #[]) (test : IpcM α) : IO α := do
|
||||
structure CallHierarchy where
|
||||
item : CallHierarchyItem
|
||||
fromRanges : Array Range
|
||||
children : Array CallHierarchy
|
||||
deriving FromJson, ToJson
|
||||
|
||||
partial def expandIncomingCallHierarchy (requestNo : Nat) (uri : DocumentUri) (pos : Lsp.Position) : IpcM (Array CallHierarchy × Nat) := do
|
||||
writeRequest {
|
||||
id := requestNo
|
||||
method := "textDocument/prepareCallHierarchy"
|
||||
param := {
|
||||
textDocument := { uri }
|
||||
position := pos
|
||||
: CallHierarchyPrepareParams
|
||||
}
|
||||
}
|
||||
let r ← readResponseAs requestNo (Option (Array CallHierarchyItem))
|
||||
let mut requestNo := requestNo + 1
|
||||
let roots := r.result.getD #[]
|
||||
let mut hierarchies := #[]
|
||||
for root in roots do
|
||||
let (hierarchy, rootRequestNo) ← go requestNo root #[] {}
|
||||
requestNo := rootRequestNo
|
||||
hierarchies := hierarchies.push hierarchy
|
||||
return (hierarchies, requestNo)
|
||||
where
|
||||
go (requestNo : Nat) (item : CallHierarchyItem) (fromRanges : Array Range) (visited : Std.TreeSet String) : IpcM (CallHierarchy × Nat) := do
|
||||
if visited.contains item.name then
|
||||
return ({ item, fromRanges := #[], children := #[] }, requestNo)
|
||||
writeRequest {
|
||||
id := requestNo
|
||||
method := "callHierarchy/incomingCalls"
|
||||
param := {
|
||||
item
|
||||
: CallHierarchyIncomingCallsParams
|
||||
}
|
||||
}
|
||||
let r ← readResponseAs requestNo (Option (Array CallHierarchyIncomingCall))
|
||||
let visited : Std.TreeSet String := visited.insert item.name
|
||||
let mut requestNo := requestNo + 1
|
||||
let children := r.result.getD #[]
|
||||
let mut childHierarchies := #[]
|
||||
for c in children do
|
||||
let (childHierarchy, childRequestNo) ← go requestNo c.from c.fromRanges visited
|
||||
childHierarchies := childHierarchies.push childHierarchy
|
||||
requestNo := childRequestNo
|
||||
return ({ item, fromRanges, children := childHierarchies }, requestNo)
|
||||
|
||||
partial def expandOutgoingCallHierarchy (requestNo : Nat) (uri : DocumentUri) (pos : Lsp.Position) : IpcM (Array CallHierarchy × Nat) := do
|
||||
writeRequest {
|
||||
id := requestNo
|
||||
method := "textDocument/prepareCallHierarchy"
|
||||
param := {
|
||||
textDocument := { uri }
|
||||
position := pos
|
||||
: CallHierarchyPrepareParams
|
||||
}
|
||||
}
|
||||
let r ← readResponseAs requestNo (Option (Array CallHierarchyItem))
|
||||
let mut requestNo := requestNo + 1
|
||||
let roots := r.result.getD #[]
|
||||
let mut hierarchies := #[]
|
||||
for root in roots do
|
||||
let (hierarchy, rootRequestNo) ← go requestNo root #[] {}
|
||||
requestNo := rootRequestNo
|
||||
hierarchies := hierarchies.push hierarchy
|
||||
return (hierarchies, requestNo)
|
||||
where
|
||||
go (requestNo : Nat) (item : CallHierarchyItem) (fromRanges : Array Range) (visited : Std.TreeSet String) : IpcM (CallHierarchy × Nat) := do
|
||||
if visited.contains item.name then
|
||||
return ({ item, fromRanges := #[], children := #[] }, requestNo)
|
||||
writeRequest {
|
||||
id := requestNo
|
||||
method := "callHierarchy/outgoingCalls"
|
||||
param := {
|
||||
item
|
||||
: CallHierarchyOutgoingCallsParams
|
||||
}
|
||||
}
|
||||
let r ← readResponseAs requestNo (Option (Array CallHierarchyOutgoingCall))
|
||||
let visited : Std.TreeSet String := visited.insert item.name
|
||||
let mut requestNo := requestNo + 1
|
||||
let children := r.result.getD #[]
|
||||
let mut childHierarchies := #[]
|
||||
for c in children do
|
||||
let (childHierarchy, childRequestNo) ← go requestNo c.to c.fromRanges visited
|
||||
childHierarchies := childHierarchies.push childHierarchy
|
||||
requestNo := childRequestNo
|
||||
return ({ item, fromRanges, children := childHierarchies }, requestNo)
|
||||
|
||||
structure ModuleHierarchy where
|
||||
item : LeanImport
|
||||
children : Array ModuleHierarchy
|
||||
deriving FromJson, ToJson
|
||||
|
||||
partial def expandModuleHierarchyImports (requestNo : Nat) (uri : DocumentUri) : IpcM (Option ModuleHierarchy × Nat) := do
|
||||
writeRequest {
|
||||
id := requestNo
|
||||
method := "$/lean/prepareModuleHierarchy"
|
||||
param := {
|
||||
textDocument := { uri }
|
||||
: LeanPrepareModuleHierarchyParams
|
||||
}
|
||||
}
|
||||
let r ← readResponseAs requestNo (Option LeanModule)
|
||||
let mut requestNo := requestNo + 1
|
||||
let some root := r.result
|
||||
| return (none, requestNo)
|
||||
let root := {
|
||||
module := root
|
||||
kind := { isAll := false, isPrivate := false, metaKind := .full }
|
||||
}
|
||||
let (hierarchy, rootRequestNo) ← go requestNo root {}
|
||||
requestNo := rootRequestNo
|
||||
return (hierarchy, requestNo)
|
||||
where
|
||||
go (requestNo : Nat) (item : LeanImport) (visited : Std.TreeSet String) : IpcM (ModuleHierarchy × Nat) := do
|
||||
if visited.contains item.module.name then
|
||||
return ({ item, children := #[] }, requestNo)
|
||||
writeRequest {
|
||||
id := requestNo
|
||||
method := "$/lean/moduleHierarchy/imports"
|
||||
param := {
|
||||
module := item.module
|
||||
: LeanModuleHierarchyImportsParams
|
||||
}
|
||||
}
|
||||
let r ← readResponseAs requestNo (Array LeanImport)
|
||||
let visited : Std.TreeSet String := visited.insert item.module.name
|
||||
let mut requestNo := requestNo + 1
|
||||
let children := r.result
|
||||
let mut childHierarchies := #[]
|
||||
for c in children do
|
||||
let (childHierarchy, childRequestNo) ← go requestNo c visited
|
||||
childHierarchies := childHierarchies.push childHierarchy
|
||||
requestNo := childRequestNo
|
||||
return ({ item, children := childHierarchies }, requestNo)
|
||||
|
||||
partial def expandModuleHierarchyImportedBy (requestNo : Nat) (uri : DocumentUri) : IpcM (Option ModuleHierarchy × Nat) := do
|
||||
writeRequest {
|
||||
id := requestNo
|
||||
method := "$/lean/prepareModuleHierarchy"
|
||||
param := {
|
||||
textDocument := { uri }
|
||||
: LeanPrepareModuleHierarchyParams
|
||||
}
|
||||
}
|
||||
let r ← readResponseAs requestNo (Option LeanModule)
|
||||
let mut requestNo := requestNo + 1
|
||||
let some root := r.result
|
||||
| return (none, requestNo)
|
||||
let root := {
|
||||
module := root
|
||||
kind := { isAll := false, isPrivate := false, metaKind := .full }
|
||||
}
|
||||
let (hierarchy, rootRequestNo) ← go requestNo root {}
|
||||
requestNo := rootRequestNo
|
||||
return (hierarchy, requestNo)
|
||||
where
|
||||
go (requestNo : Nat) (item : LeanImport) (visited : Std.TreeSet String) : IpcM (ModuleHierarchy × Nat) := do
|
||||
if visited.contains item.module.name then
|
||||
return ({ item, children := #[] }, requestNo)
|
||||
writeRequest {
|
||||
id := requestNo
|
||||
method := "$/lean/moduleHierarchy/importedBy"
|
||||
param := {
|
||||
module := item.module
|
||||
: LeanModuleHierarchyImportedByParams
|
||||
}
|
||||
}
|
||||
let r ← readResponseAs requestNo (Array LeanImport)
|
||||
let visited : Std.TreeSet String := visited.insert item.module.name
|
||||
let mut requestNo := requestNo + 1
|
||||
let children := r.result
|
||||
let mut childHierarchies := #[]
|
||||
for c in children do
|
||||
let (childHierarchy, childRequestNo) ← go requestNo c visited
|
||||
childHierarchies := childHierarchies.push childHierarchy
|
||||
requestNo := childRequestNo
|
||||
return ({ item, children := childHierarchies }, requestNo)
|
||||
|
||||
def runWith (lean : String) (args : Array String := #[]) (test : IpcM α) : IO α := do
|
||||
let proc ← Process.spawn {
|
||||
toStdioConfig := ipcStdioConfig
|
||||
cmd := lean.toString
|
||||
cmd := lean
|
||||
args := args }
|
||||
ReaderT.run test proc
|
||||
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ def guardMsgsCodeAction : CommandCodeAction := fun _ _ _ node => do
|
|||
let some (stx, res) := res | return #[]
|
||||
let doc ← readDoc
|
||||
let eager := {
|
||||
title := "Update #guard_msgs with tactic output"
|
||||
title := "Update #guard_msgs with generated message"
|
||||
kind? := "quickfix"
|
||||
isPreferred? := true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@ public section
|
|||
* Attribute `@[hole_code_action]` collects code actions which will be called
|
||||
on each occurrence of a hole (`_`, `?_` or `sorry`).
|
||||
|
||||
* Attribute `@[tactic_code_action]` collects code actions which will be called
|
||||
on each occurrence of a tactic.
|
||||
|
||||
* Attribute `@[command_code_action]` collects code actions which will be called
|
||||
on each occurrence of a command.
|
||||
-/
|
||||
|
|
|
|||
|
|
@ -20,6 +20,18 @@ namespace Lean.Server.FileWorker
|
|||
open Lean.Lsp
|
||||
open Lean.Server.Completion
|
||||
|
||||
private def compareRanges (r1 r2 : String.Range) : Ordering :=
|
||||
if r1.start < r2.start then
|
||||
.lt
|
||||
else if r1.start > r2.start then
|
||||
.gt
|
||||
else if r1.stop < r2.stop then
|
||||
.lt
|
||||
else if r1.stop > r2.stop then
|
||||
.gt
|
||||
else
|
||||
.eq
|
||||
|
||||
def waitUnknownIdentifierRanges (doc : EditableDocument) (requestedRange : String.Range)
|
||||
: BaseIO (Array String.Range × Bool) := do
|
||||
let text := doc.meta.text
|
||||
|
|
@ -37,32 +49,46 @@ def waitUnknownIdentifierRanges (doc : EditableDocument) (requestedRange : Strin
|
|||
continue
|
||||
ranges := ranges.push msgRange
|
||||
let isAnyUnknownIdentifierMessage := ! ranges.isEmpty
|
||||
let autoImplicitUsages := tree.foldInfosInRange requestedRange #[] fun ctx i acc => Id.run do
|
||||
let .ofTermInfo ti := i
|
||||
| return acc
|
||||
let some r := ti.stx.getRange? (canonicalOnly := true)
|
||||
| return acc
|
||||
if ! ti.expr.isFVar then
|
||||
return acc
|
||||
if ! ctx.autoImplicits.contains ti.expr then
|
||||
return acc
|
||||
return acc.push r
|
||||
let autoImplicitUsages := autoImplicitUsages.get
|
||||
let autoImplicitUsages : ServerTask (Std.TreeSet String.Range compareRanges) :=
|
||||
tree.foldInfosInRange requestedRange ∅ fun ctx i acc => Id.run do
|
||||
let .ofTermInfo ti := i
|
||||
| return acc
|
||||
let some r := ti.stx.getRange? (canonicalOnly := true)
|
||||
| return acc
|
||||
if ! ti.expr.isFVar then
|
||||
return acc
|
||||
if ! ctx.autoImplicits.contains ti.expr then
|
||||
return acc
|
||||
return acc.insert r
|
||||
let autoImplicitUsages := autoImplicitUsages.get.toArray
|
||||
ranges := ranges ++ autoImplicitUsages
|
||||
return (ranges, isAnyUnknownIdentifierMessage)
|
||||
|
||||
def waitAllUnknownIdentifierMessageRanges (doc : EditableDocument)
|
||||
: BaseIO (Array String.Range) := do
|
||||
let text := doc.meta.text
|
||||
let msgLog : MessageLog := Language.toSnapshotTree doc.initSnap
|
||||
|>.getAll.map (·.diagnostics.msgLog)
|
||||
|>.foldl (· ++ ·) {}
|
||||
let snaps := Language.toSnapshotTree doc.initSnap |>.getAll
|
||||
let msgLog : MessageLog := snaps.map (·.diagnostics.msgLog) |>.foldl (· ++ ·) {}
|
||||
let mut ranges := #[]
|
||||
for msg in msgLog.unreported do
|
||||
if ! msg.data.hasTag (· == unknownIdentifierMessageTag) then
|
||||
continue
|
||||
let msgRange : String.Range := ⟨text.ofPosition msg.pos, text.ofPosition <| msg.endPos.getD msg.pos⟩
|
||||
ranges := ranges.push msgRange
|
||||
let (cmdSnaps, _) := doc.cmdSnaps.waitAll.get
|
||||
for snap in cmdSnaps do
|
||||
let autoImplicitUsages : Std.TreeSet String.Range compareRanges :=
|
||||
snap.infoTree.foldInfo (init := ∅) fun ctx i acc => Id.run do
|
||||
let .ofTermInfo ti := i
|
||||
| return acc
|
||||
let some r := ti.stx.getRange? (canonicalOnly := true)
|
||||
| return acc
|
||||
if ! ti.expr.isFVar then
|
||||
return acc
|
||||
if ! ctx.autoImplicits.contains ti.expr then
|
||||
return acc
|
||||
return acc.insert r
|
||||
ranges := ranges ++ autoImplicitUsages.toArray
|
||||
return ranges
|
||||
|
||||
structure Insertion where
|
||||
|
|
|
|||
|
|
@ -9,5 +9,6 @@ module
|
|||
prelude
|
||||
public import Lean.Server.Test.Cancel
|
||||
public import Lean.Server.Test.Runner
|
||||
public import Lean.Server.Test.Refs
|
||||
|
||||
public section
|
||||
|
|
|
|||
27
src/Lean/Server/Test/Refs.lean
Normal file
27
src/Lean/Server/Test/Refs.lean
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/-
|
||||
Copyright (c) 2025 Lean FRO. All rights reserved.
|
||||
Released under Apache 2.0 license as described in the file LICENSE.
|
||||
|
||||
Authors: Marc Huisinga
|
||||
-/
|
||||
module
|
||||
|
||||
prelude
|
||||
import Init.Prelude
|
||||
|
||||
public def LeanServerTestRefsTest0 := Nat
|
||||
|
||||
namespace Lean.Server.Test.Refs
|
||||
|
||||
public def Test1 := Nat
|
||||
public def Test2 := Test1
|
||||
public def Test3 := Test1
|
||||
public def Test4 := Test2
|
||||
public def Test5 := Test2
|
||||
|
||||
public inductive Test6
|
||||
| mk
|
||||
public def test7 : Test6 := .mk
|
||||
public def test8 : Test6 := .mk
|
||||
public def test9 := test7
|
||||
public def test10 := test9
|
||||
|
|
@ -9,6 +9,8 @@ module
|
|||
prelude
|
||||
public import Lean.Data.Lsp
|
||||
public import Lean.Widget
|
||||
import Lean.Server.FileWorker.WidgetRequests
|
||||
public import Lean.Server.GoTo
|
||||
|
||||
public section
|
||||
open Lean
|
||||
|
|
@ -27,27 +29,155 @@ namespace Client
|
|||
/- Client-side types for showing interactive goals. -/
|
||||
|
||||
structure SubexprInfo where
|
||||
info : RpcRef
|
||||
subexprPos : String
|
||||
diffStatus? : Option String
|
||||
deriving FromJson, Repr
|
||||
deriving FromJson, ToJson
|
||||
|
||||
structure Hyp where
|
||||
type : Widget.TaggedText SubexprInfo
|
||||
names : Array String
|
||||
isInserted?: Option Bool
|
||||
isRemoved?: Option Bool
|
||||
deriving FromJson, Repr
|
||||
fvarIds : Array FVarId
|
||||
val? : Option (Widget.TaggedText SubexprInfo)
|
||||
isInstance? : Option Bool := none
|
||||
isType? : Option Bool := none
|
||||
isInserted? : Option Bool
|
||||
isRemoved? : Option Bool
|
||||
deriving FromJson, ToJson
|
||||
|
||||
structure InteractiveGoal where
|
||||
def Hyp.normalize (h : Hyp) : Hyp := { h with
|
||||
fvarIds := #[]
|
||||
}
|
||||
|
||||
structure InteractiveGoalCore where
|
||||
hyps : Array Hyp
|
||||
type : Widget.TaggedText SubexprInfo
|
||||
ctx : Lsp.RpcRef
|
||||
deriving FromJson, ToJson
|
||||
|
||||
def InteractiveGoalCore.normalize (g : InteractiveGoalCore) : InteractiveGoalCore := { g with
|
||||
hyps := g.hyps.map (·.normalize)
|
||||
}
|
||||
|
||||
structure InteractiveGoal extends InteractiveGoalCore where
|
||||
userName? : Option String
|
||||
goalPrefix : String
|
||||
mvarId : MVarId
|
||||
isInserted?: Option Bool := none
|
||||
isRemoved?: Option Bool := none
|
||||
hyps : Array Hyp
|
||||
deriving FromJson, Repr
|
||||
deriving FromJson, ToJson
|
||||
|
||||
def InteractiveGoal.normalize (goal : InteractiveGoal) : InteractiveGoal := { goal with
|
||||
mvarId := { name := .anonymous }
|
||||
toInteractiveGoalCore := goal.toInteractiveGoalCore.normalize
|
||||
}
|
||||
|
||||
structure InteractiveGoals where
|
||||
goals : Array InteractiveGoal
|
||||
deriving FromJson, Repr
|
||||
deriving FromJson, ToJson
|
||||
|
||||
def InteractiveGoals.normalize (gs : InteractiveGoals) : InteractiveGoals := {
|
||||
goals := gs.goals.map (·.normalize)
|
||||
}
|
||||
|
||||
structure InteractiveTermGoal extends InteractiveGoalCore where
|
||||
range : Lsp.Range
|
||||
term : Lsp.RpcRef
|
||||
deriving FromJson, ToJson
|
||||
|
||||
def InteractiveTermGoal.normalize (g : InteractiveTermGoal) : InteractiveTermGoal := { g with
|
||||
toInteractiveGoalCore := g.toInteractiveGoalCore.normalize
|
||||
}
|
||||
|
||||
structure WidgetInstance where
|
||||
id : Name
|
||||
javascriptHash : UInt64
|
||||
props : Json
|
||||
deriving FromJson, ToJson
|
||||
|
||||
inductive StrictOrLazy (α β : Type) : Type
|
||||
| strict : α → StrictOrLazy α β
|
||||
| lazy : β → StrictOrLazy α β
|
||||
deriving FromJson, ToJson
|
||||
|
||||
inductive MsgEmbed where
|
||||
| expr : Widget.TaggedText SubexprInfo → MsgEmbed
|
||||
| goal : InteractiveGoal → MsgEmbed
|
||||
| widget (wi : WidgetInstance) (alt : Widget.TaggedText MsgEmbed)
|
||||
| trace (indent : Nat) (cls : Name) (msg : Widget.TaggedText MsgEmbed) (collapsed : Bool)
|
||||
(children : StrictOrLazy (Array (Widget.TaggedText MsgEmbed)) Lsp.RpcRef)
|
||||
deriving FromJson, ToJson
|
||||
|
||||
partial def MsgEmbed.normalize : MsgEmbed → MsgEmbed
|
||||
| .expr e => .expr e
|
||||
| .goal g => .goal g.normalize
|
||||
| .widget wi alt => .widget wi <| alt.map (·.normalize)
|
||||
| .trace ident cls msg collapsed children =>
|
||||
let msg := msg.map (·.normalize)
|
||||
let children :=
|
||||
match children with
|
||||
| .lazy childrenRef => .lazy childrenRef
|
||||
| .strict children => .strict <| children.map fun child => child.map (·.normalize)
|
||||
.trace ident cls msg collapsed children
|
||||
|
||||
abbrev InteractiveDiagnostic := Lsp.DiagnosticWith (Widget.TaggedText MsgEmbed)
|
||||
|
||||
def InteractiveDiagnostic.normalize (d : InteractiveDiagnostic) : InteractiveDiagnostic := { d with
|
||||
message := d.message.map (·.normalize)
|
||||
}
|
||||
|
||||
def normalizeInteractiveDiagnostics (diags : Array InteractiveDiagnostic) :
|
||||
Array InteractiveDiagnostic :=
|
||||
-- Sort diagnostics by range and message to erase non-determinism in the order of diagnostics
|
||||
-- induced by parallelism. This isn't complete, but it will hopefully be plenty for all tests.
|
||||
let sorted := diags.map (·.normalize) |>.toList.mergeSort fun d1 d2 =>
|
||||
compare d1.fullRange d2.fullRange |>.then (compare d1.message.stripTags d2.message.stripTags) |>.isLE
|
||||
sorted.toArray
|
||||
|
||||
structure InfoPopup where
|
||||
type : Option (Widget.TaggedText SubexprInfo)
|
||||
exprExplicit : Option (Widget.TaggedText SubexprInfo)
|
||||
doc : Option String
|
||||
deriving FromJson, ToJson
|
||||
|
||||
structure GetGoToLocationParams where
|
||||
kind : GoToKind
|
||||
info : RpcRef
|
||||
deriving FromJson, ToJson
|
||||
|
||||
structure HighlightMatchesParams where
|
||||
query : String
|
||||
msg : Widget.TaggedText MsgEmbed
|
||||
deriving FromJson, ToJson
|
||||
|
||||
inductive HighlightedSubexprInfo where
|
||||
| subexpr (info : SubexprInfo)
|
||||
| highlighted
|
||||
deriving FromJson, ToJson
|
||||
|
||||
inductive HighlightedMsgEmbed where
|
||||
| expr : Widget.TaggedText HighlightedSubexprInfo → HighlightedMsgEmbed
|
||||
| goal : Client.InteractiveGoal → HighlightedMsgEmbed
|
||||
| widget (wi : Client.WidgetInstance) (alt : Widget.TaggedText HighlightedMsgEmbed)
|
||||
| trace (indent : Nat) (cls : Name) (msg : Widget.TaggedText HighlightedMsgEmbed) (collapsed : Bool)
|
||||
(children : StrictOrLazy
|
||||
(Array (Widget.TaggedText HighlightedMsgEmbed))
|
||||
Lsp.RpcRef)
|
||||
| highlighted
|
||||
deriving FromJson, ToJson
|
||||
|
||||
partial def HighlightedMsgEmbed.normalize : HighlightedMsgEmbed → HighlightedMsgEmbed
|
||||
| .expr e => .expr e
|
||||
| .goal g => .goal g.normalize
|
||||
| .widget wi alt => .widget wi <| alt.map (·.normalize)
|
||||
| .trace ident cls msg collapsed children =>
|
||||
let msg := msg.map (·.normalize)
|
||||
let children :=
|
||||
match children with
|
||||
| .lazy childrenRef => .lazy childrenRef
|
||||
| .strict children => .strict <| children.map fun child => child.map (·.normalize)
|
||||
.trace ident cls msg collapsed children
|
||||
| .highlighted => .highlighted
|
||||
|
||||
end Client
|
||||
|
||||
|
|
@ -87,10 +217,440 @@ def ident : Parser Name := do
|
|||
let xs ← many1 (pchar '.' *> word)
|
||||
return xs.foldl .str $ .mkSimple head
|
||||
|
||||
def patchUri (s : String) : IO String := do
|
||||
let some path := System.Uri.fileUriToPath? s
|
||||
| return s
|
||||
let path ←
|
||||
try
|
||||
IO.FS.realPath path
|
||||
catch _ =>
|
||||
return s
|
||||
let c := path.components.toArray
|
||||
if let some srcIdx := c.findIdx? (· == "src") then
|
||||
if ! c[srcIdx + 1]?.any (fun dir => dir == "Init" || dir == "Lean" || dir == "Std") then
|
||||
return s
|
||||
let c := c.drop <| srcIdx
|
||||
let path := System.mkFilePath c.toList
|
||||
return System.Uri.pathToUri path
|
||||
if let some testIdx := c.findIdx? (· == "tests") then
|
||||
let c := c.drop <| testIdx
|
||||
let path := System.mkFilePath c.toList
|
||||
return System.Uri.pathToUri path
|
||||
else
|
||||
return s
|
||||
|
||||
partial def patchUris : Json → IO Json
|
||||
| .null =>
|
||||
return .null
|
||||
| .bool b =>
|
||||
return .bool b
|
||||
| .num n =>
|
||||
return .num n
|
||||
| .arr elems =>
|
||||
return .arr <| ← elems.mapM patchUris
|
||||
| .obj kvPairs =>
|
||||
return .obj <| ← kvPairs.foldlM (init := ∅) fun acc k v =>
|
||||
return acc.insert k (← patchUris v)
|
||||
| .str s =>
|
||||
patchUri s
|
||||
|
||||
def printOutputLn (j : Json) : IO Unit := do
|
||||
IO.eprintln (← patchUris j)
|
||||
|
||||
structure RunnerState where
|
||||
uri : DocumentUri
|
||||
-- Whether we have waited for the server via `sync/collectDiagnostics/waitFor` since the last
|
||||
-- change; we should only send out further changes when we are in such a deterministic state.
|
||||
synced : Bool
|
||||
rpcSessionId : Option UInt64
|
||||
lineNo : Nat
|
||||
lastActualLineNo : Nat
|
||||
pos : Lsp.Position
|
||||
method : String
|
||||
params : String
|
||||
versionNo : Nat
|
||||
requestNo : Nat
|
||||
|
||||
abbrev RunnerM := StateT RunnerState Ipc.IpcM
|
||||
|
||||
def RunnerM.run (act : RunnerM α) (init : RunnerState) : Ipc.IpcM Unit :=
|
||||
discard <| StateT.run act init
|
||||
|
||||
def advanceRequestNo : RunnerM Unit :=
|
||||
modify fun s => { s with
|
||||
requestNo := s.requestNo + 1
|
||||
}
|
||||
|
||||
def advanceVersionNo : RunnerM Unit :=
|
||||
modify fun s => { s with
|
||||
versionNo := s.versionNo + 1
|
||||
}
|
||||
|
||||
def setSynced : RunnerM Unit :=
|
||||
modify fun s => { s with
|
||||
synced := true
|
||||
}
|
||||
|
||||
def setDesynced : RunnerM Unit :=
|
||||
modify fun s => { s with
|
||||
synced := false
|
||||
}
|
||||
|
||||
def request (method : String) [ToJson α] (p : α) (β : Type) [FromJson β] : RunnerM β := do
|
||||
let s ← get
|
||||
Ipc.writeRequest ⟨s.requestNo, method, p⟩
|
||||
advanceRequestNo
|
||||
let r ← Ipc.readResponseAs s.requestNo β
|
||||
return r.result
|
||||
|
||||
def requestWithLoggedResponse (method : String) [ToJson α] (p : α)
|
||||
(β : Type) [FromJson β] [ToJson β] (logParam := true) : RunnerM β := do
|
||||
if logParam then
|
||||
printOutputLn (toJson p)
|
||||
let r ← request method p β
|
||||
printOutputLn (toJson r)
|
||||
return r
|
||||
|
||||
def logResponse (method : String) [ToJson α] (p : α)
|
||||
(β : Type := Json) [FromJson β] [ToJson β] (logParam := true) : RunnerM Unit := do
|
||||
discard <| requestWithLoggedResponse method p β logParam
|
||||
|
||||
def rpcRequest (method : Name) [ToJson α] (p : α) (β : Type) [FromJson β] : RunnerM β := do
|
||||
if (← get).rpcSessionId.isNone then
|
||||
let connectParams := RpcConnectParams.mk (← get).uri
|
||||
let r ← request "$/lean/rpc/connect" connectParams RpcConnected
|
||||
modify fun s => { s with
|
||||
rpcSessionId := r.sessionId
|
||||
}
|
||||
let callParams : RpcCallParams := {
|
||||
params := toJson p
|
||||
textDocument := { uri := (← get).uri }
|
||||
position := (← get).pos,
|
||||
sessionId := (← get).rpcSessionId.get!,
|
||||
method := method
|
||||
}
|
||||
request "$/lean/rpc/call" callParams β
|
||||
|
||||
def rpcRequestWithLoggedResponse (method : Name) [ToJson α] (p : α)
|
||||
(β : Type) [FromJson β] [ToJson β] (logParam := true) (normalize : β → β := id) : RunnerM β := do
|
||||
if logParam then
|
||||
printOutputLn (toJson p)
|
||||
let r ← rpcRequest method p β
|
||||
printOutputLn (toJson (normalize r))
|
||||
return r
|
||||
|
||||
def logRpcResponse (method : Name) [ToJson α] (p : α)
|
||||
(β : Type := Json) [FromJson β] [ToJson β] (logParam := true) (normalize : β → β := id) : RunnerM Unit := do
|
||||
discard <| rpcRequestWithLoggedResponse method p β logParam normalize
|
||||
|
||||
def reset : RunnerM Unit := modify fun s => { s with
|
||||
synced := true
|
||||
lineNo := 0
|
||||
lastActualLineNo := 0
|
||||
versionNo := 2
|
||||
rpcSessionId := none
|
||||
}
|
||||
|
||||
def skipLineWithDirective : RunnerM Unit := modify fun s => { s with
|
||||
lineNo := s.lineNo + 1
|
||||
}
|
||||
|
||||
def skipLineWithoutDirective : RunnerM Unit := modify fun s => { s with
|
||||
lastActualLineNo := s.lineNo
|
||||
lineNo := s.lineNo + 1
|
||||
}
|
||||
|
||||
partial def expandTraces (msg : Client.MsgEmbed) : RunnerM Client.MsgEmbed := do
|
||||
match msg with
|
||||
| .trace indent cls msg _ children =>
|
||||
let children ←
|
||||
match children with
|
||||
| .lazy childrenRef =>
|
||||
rpcRequest `Lean.Widget.lazyTraceChildrenToInteractive childrenRef (Array (Widget.TaggedText Client.MsgEmbed))
|
||||
| .strict children =>
|
||||
pure children
|
||||
let children ← children.mapM fun child =>
|
||||
child.mapM expandTraces
|
||||
return .trace indent cls msg false (.strict children)
|
||||
| _ =>
|
||||
return msg
|
||||
|
||||
def processEdit : RunnerM Unit := do
|
||||
let s ← get
|
||||
if ! s.synced then
|
||||
throw <| IO.userError s!"cannot use '{s.method}' without syncing first"
|
||||
let (delete, insert) ←
|
||||
match s.method with
|
||||
| "delete" => pure (s.params, "\"\"")
|
||||
| "insert" => pure ("\"\"", s.params)
|
||||
| "change" =>
|
||||
-- TODO: allow spaces in strings
|
||||
let [delete, insert] := s.params.splitOn " "
|
||||
| throw <| IO.userError s!"expected two arguments in {s.params}"
|
||||
pure (delete, insert)
|
||||
| _ => unreachable!
|
||||
let some delete := Syntax.decodeStrLit delete
|
||||
| throw <| IO.userError s!"failed to parse {delete}"
|
||||
let some insert := Syntax.decodeStrLit insert
|
||||
| throw <| IO.userError s!"failed to parse {insert}"
|
||||
let params : DidChangeTextDocumentParams := {
|
||||
textDocument := {
|
||||
uri := s.uri
|
||||
version? := s.versionNo
|
||||
}
|
||||
contentChanges := #[
|
||||
TextDocumentContentChangeEvent.rangeChange {
|
||||
start := s.pos
|
||||
«end» := { s.pos with character := s.pos.character + delete.length }
|
||||
} insert
|
||||
]
|
||||
}
|
||||
let params := toJson params
|
||||
Ipc.writeNotification ⟨"textDocument/didChange", params⟩
|
||||
advanceVersionNo
|
||||
setDesynced
|
||||
|
||||
def processCollectDiagnostics : RunnerM Unit := do
|
||||
let s ← get
|
||||
if let some diags ← Ipc.collectDiagnostics s.requestNo s.uri (s.versionNo - 1) then
|
||||
printOutputLn (toJson diags.param)
|
||||
advanceRequestNo
|
||||
setSynced
|
||||
|
||||
def processWaitForILeans : RunnerM Unit := do
|
||||
let s ← get
|
||||
let _ ← Ipc.waitForILeans s.requestNo s.uri (s.versionNo - 1)
|
||||
advanceRequestNo
|
||||
|
||||
def processSync : RunnerM Unit := do
|
||||
let s ← get
|
||||
let _ ← Ipc.collectDiagnostics s.requestNo s.uri (s.versionNo - 1)
|
||||
advanceRequestNo
|
||||
setSynced
|
||||
|
||||
def processWaitFor : RunnerM Unit := do
|
||||
let s ← get
|
||||
let _ ← Ipc.waitForMessage s.params
|
||||
setSynced
|
||||
|
||||
def processCodeAction : RunnerM Unit := do
|
||||
let s ← get
|
||||
let params : CodeActionParams := {
|
||||
textDocument := { uri := s.uri },
|
||||
range := ⟨s.pos, s.pos⟩
|
||||
}
|
||||
let r ← requestWithLoggedResponse "textDocument/codeAction" params (Array CodeAction)
|
||||
for x in r do
|
||||
if x.data?.isNone then
|
||||
continue
|
||||
IO.eprintln s!"Resolution of {x.title}:"
|
||||
logResponse "codeAction/resolve" x (logParam := false)
|
||||
|
||||
def processInteractiveDiagnostics : RunnerM Unit := do
|
||||
let isExpandTraces := (← get).params == "expandTraces"
|
||||
let highlightMatchesQuery? := (← get).params.dropPrefix? "highlightMatches:"
|
||||
let params : Widget.GetInteractiveDiagnosticsParams := {
|
||||
lineRange? := some ⟨0, (← get).pos.line + 1⟩
|
||||
}
|
||||
printOutputLn (toJson params)
|
||||
let r ← rpcRequest `Lean.Widget.getInteractiveDiagnostics params (Array Client.InteractiveDiagnostic)
|
||||
let r := Client.normalizeInteractiveDiagnostics r
|
||||
if isExpandTraces then
|
||||
let r ← r.mapM fun diag => do
|
||||
return { diag with
|
||||
message := ← diag.message.mapM expandTraces
|
||||
}
|
||||
let r := r.map (fun d => { d with message := d.message.map Client.MsgEmbed.normalize })
|
||||
printOutputLn (toJson r)
|
||||
else if let some highlightMatchesQuery := highlightMatchesQuery? then
|
||||
for diag in r do
|
||||
let params := {
|
||||
query := highlightMatchesQuery.toString
|
||||
msg := diag.message
|
||||
: Client.HighlightMatchesParams
|
||||
}
|
||||
logRpcResponse `Lean.Widget.highlightMatches params (β := Widget.TaggedText Client.HighlightedMsgEmbed)
|
||||
(normalize := fun msg => msg.map (·.normalize))
|
||||
else
|
||||
printOutputLn (toJson (r.map (·.normalize)))
|
||||
|
||||
|
||||
def processGoals : RunnerM Unit := do
|
||||
let withPopups := (← get).params == "withPopups"
|
||||
let withGoToLoc := (← get).params == "withGoToLoc"
|
||||
let params : Lsp.PlainGoalParams := {
|
||||
textDocument := { uri := (← get).uri }
|
||||
position := (← get).pos,
|
||||
}
|
||||
let r ← rpcRequestWithLoggedResponse `Lean.Widget.getInteractiveGoals params Client.InteractiveGoals
|
||||
(normalize := Client.InteractiveGoals.normalize)
|
||||
if withPopups then
|
||||
let interactiveTerms := r.goals.flatMap fun goal =>
|
||||
goal.hyps.map (fun h => (" ".intercalate h.names.toList, h.type)) |>.push ("goal", goal.type)
|
||||
for (termName, interactiveTerm) in interactiveTerms do
|
||||
IO.eprintln s!"Popups for type of {termName}:"
|
||||
interactiveTerm.forM fun i subtree => do
|
||||
IO.eprintln s!"Popup for {subtree.stripTags}:"
|
||||
logRpcResponse `Lean.Widget.InteractiveDiagnostics.infoToInteractive i.info (β := Client.InfoPopup)
|
||||
if withGoToLoc then
|
||||
let interactiveTerms := r.goals.flatMap fun goal =>
|
||||
goal.hyps.map (fun h => (" ".intercalate h.names.toList, h.type)) |>.push ("goal", goal.type)
|
||||
for (termName, interactiveTerm) in interactiveTerms do
|
||||
IO.eprintln s!"GoToLoc responses for type of {termName}:"
|
||||
interactiveTerm.forM fun i subtree => do
|
||||
IO.eprintln s!"GoToLoc response for {subtree.stripTags}:"
|
||||
let params : Client.GetGoToLocationParams := {
|
||||
kind := .definition
|
||||
info := i.info
|
||||
}
|
||||
logRpcResponse `Lean.Widget.getGoToLocation params
|
||||
|
||||
def processTermGoal : RunnerM Unit := do
|
||||
let params : Lsp.PlainTermGoalParams := {
|
||||
textDocument := { uri := (← get).uri }
|
||||
position := (← get).pos,
|
||||
}
|
||||
logRpcResponse `Lean.Widget.getInteractiveTermGoal params (β := Option Client.InteractiveTermGoal)
|
||||
(normalize := fun g? => g?.map (·.normalize))
|
||||
|
||||
def processWidgets : RunnerM Unit := do
|
||||
let r ← rpcRequest `Lean.Widget.getWidgets (← get).pos Lean.Widget.GetWidgetsResponse
|
||||
printOutputLn r.debugJson
|
||||
for w in r.widgets do
|
||||
let params : Lean.Widget.GetWidgetSourceParams := { pos := (← get).pos, hash := w.javascriptHash }
|
||||
logRpcResponse `Lean.Widget.getWidgetSource params
|
||||
|
||||
def processCompletion : RunnerM Unit := do
|
||||
let p : CompletionParams := {
|
||||
textDocument := { uri := (← get).uri }
|
||||
position := (← get).pos
|
||||
}
|
||||
let r ← requestWithLoggedResponse "textDocument/completion" p CompletionList
|
||||
for i in r.items do
|
||||
if i.data?.isNone then
|
||||
continue
|
||||
IO.eprintln s!"Resolution of {i.label}:"
|
||||
logResponse "completionItem/resolve" i (logParam := false)
|
||||
|
||||
def processIncomingCallHierarchy : RunnerM Unit := do
|
||||
let s ← get
|
||||
let (callHierarchy?, callHierarchyRequestNo) ← Ipc.expandIncomingCallHierarchy s.requestNo s.uri s.pos
|
||||
printOutputLn (toJson callHierarchy?)
|
||||
set <| { s with requestNo := callHierarchyRequestNo }
|
||||
|
||||
def processOutgoingCallHierarchy : RunnerM Unit := do
|
||||
let s ← get
|
||||
let (callHierarchy?, callHierarchyRequestNo) ← Ipc.expandOutgoingCallHierarchy s.requestNo s.uri s.pos
|
||||
printOutputLn (toJson callHierarchy?)
|
||||
set <| { s with requestNo := callHierarchyRequestNo }
|
||||
|
||||
def processReferences : RunnerM Unit := do
|
||||
let p : ReferenceParams := {
|
||||
textDocument := { uri := (← get).uri }
|
||||
position := (← get).pos
|
||||
context := { includeDeclaration := true }
|
||||
}
|
||||
logResponse "textDocument/references" p
|
||||
|
||||
def processSymbols : RunnerM Unit := do
|
||||
let p : WorkspaceSymbolParams := {
|
||||
query := (← get).params
|
||||
}
|
||||
logResponse "workspace/symbol" p
|
||||
|
||||
def processModuleHierarchyImports : RunnerM Unit := do
|
||||
let s ← get
|
||||
let (moduleHierarchy?, moduleHierarchyRequestNo) ← Ipc.expandModuleHierarchyImports s.requestNo s.uri
|
||||
printOutputLn (toJson moduleHierarchy?)
|
||||
set <| { s with requestNo := moduleHierarchyRequestNo }
|
||||
|
||||
def processModuleHierarchyImportedBy : RunnerM Unit := do
|
||||
let s ← get
|
||||
let (moduleHierarchy?, moduleHierarchyRequestNo) ← Ipc.expandModuleHierarchyImportedBy s.requestNo s.uri
|
||||
printOutputLn (toJson moduleHierarchy?)
|
||||
set <| { s with requestNo := moduleHierarchyRequestNo }
|
||||
|
||||
def processInlayHints : RunnerM Unit := do
|
||||
let p : InlayHintParams := {
|
||||
textDocument := { uri := (← get).uri }
|
||||
range := { start := ⟨0, 0⟩, «end» := (← get).pos }
|
||||
}
|
||||
logResponse "textDocument/inlayHint" p
|
||||
|
||||
def processGenericRequest : RunnerM Unit := do
|
||||
let s ← get
|
||||
let Except.ok params := Json.parse s.params
|
||||
| throw <| IO.userError s!"failed to parse {s.params}"
|
||||
let params := params.setObjVal! "textDocument" (toJson { uri := s.uri : TextDocumentIdentifier })
|
||||
-- TODO: correctly compute in presence of Unicode
|
||||
let params := params.setObjVal! "position" (toJson s.pos)
|
||||
logResponse s.method params
|
||||
|
||||
def processDirective (ws directive : String) (directiveTargetLineNo : Nat) : RunnerM Unit := do
|
||||
let directive := directive.drop 1
|
||||
let colon := directive.posOf ':'
|
||||
let method := directive.extract 0 colon |>.trim
|
||||
-- TODO: correctly compute in presence of Unicode
|
||||
let directiveTargetColumn := ws.endPos + "--"
|
||||
let pos : Lsp.Position := { line := directiveTargetLineNo, character := directiveTargetColumn.byteIdx }
|
||||
let params := if colon < directive.endPos then directive.extract (colon + ':') directive.endPos |>.trim else "{}"
|
||||
modify fun s => { s with pos, method, params }
|
||||
match method with
|
||||
-- `delete: "foo"` deletes the given string's number of characters at the given position.
|
||||
-- We do NOT check currently that the text at this position is indeed that string.
|
||||
-- `insert: "foo"` inserts the given string at the given position.
|
||||
-- `change: "foo" "bar"` is like `delete: "foo"` followed by `insert: "bar"` in one atomic step.
|
||||
| "delete" | "insert" | "change" => processEdit
|
||||
| "collectDiagnostics" => processCollectDiagnostics
|
||||
| "waitForILeans" => processWaitForILeans
|
||||
| "sync" => processSync
|
||||
| "waitFor" => processWaitFor
|
||||
| "codeAction" => processCodeAction
|
||||
| "interactiveDiagnostics" => processInteractiveDiagnostics
|
||||
| "goals" => processGoals
|
||||
| "termGoal" => processTermGoal
|
||||
| "widgets" => processWidgets
|
||||
| "completion" => processCompletion
|
||||
| "incomingCallHierarchy" => processIncomingCallHierarchy
|
||||
| "outgoingCallHierarchy" => processOutgoingCallHierarchy
|
||||
| "references" => processReferences
|
||||
| "symbols" => processSymbols
|
||||
| "moduleHierarchyImports" => processModuleHierarchyImports
|
||||
| "moduleHierarchyImportedBy" => processModuleHierarchyImportedBy
|
||||
| "inlayHints" => processInlayHints
|
||||
| _ => processGenericRequest
|
||||
|
||||
def processLine (line : String) : RunnerM Unit := do
|
||||
let [ws, directive] := line.splitOn "--"
|
||||
| skipLineWithoutDirective
|
||||
return
|
||||
let directiveTargetLineNo ←
|
||||
match directive.front with
|
||||
| 'v' => pure <| (← get).lineNo + 1 -- TODO: support subsequent 'v'... or not
|
||||
| '^' => pure <| (← get).lastActualLineNo
|
||||
| _ =>
|
||||
skipLineWithoutDirective
|
||||
return
|
||||
processDirective ws directive directiveTargetLineNo
|
||||
skipLineWithDirective
|
||||
|
||||
|
||||
partial def main (args : List String) : IO Unit := do
|
||||
let uri := s!"file:///{args.head!}"
|
||||
let args := args.toArray
|
||||
let isProject := args[0]?.any (· == "-p")
|
||||
let (ipcCmd, ipcArgs) :=
|
||||
if isProject then
|
||||
("lake", #["serve", "--", "-DstderrAsMessages=false"])
|
||||
else
|
||||
("lean", #["--server", "-DstderrAsMessages=false"])
|
||||
let path := if args.size == 1 then args[0]! else args[1]!
|
||||
let uri := s!"file:///{path}"
|
||||
-- We want `dbg_trace` tactics to write directly to stderr instead of being caught in reuse
|
||||
Ipc.runWith (←IO.appPath) #["--server", "-DstderrAsMessages=false"] do
|
||||
Ipc.runWith ipcCmd ipcArgs do
|
||||
let initializationOptions? := some {
|
||||
editDelay? := none
|
||||
hasWidgets? := some true
|
||||
}
|
||||
let capabilities := {
|
||||
textDocument? := some {
|
||||
completion? := some {
|
||||
|
|
@ -103,180 +663,34 @@ partial def main (args : List String) : IO Unit := do
|
|||
silentDiagnosticSupport? := some true
|
||||
}
|
||||
}
|
||||
Ipc.writeRequest ⟨0, "initialize", { capabilities : InitializeParams }⟩
|
||||
Ipc.writeRequest ⟨0, "initialize", { initializationOptions?, capabilities : InitializeParams }⟩
|
||||
let _ ← Ipc.readResponseAs 0 InitializeResult
|
||||
Ipc.writeNotification ⟨"initialized", InitializedParams.mk⟩
|
||||
|
||||
let text ← IO.FS.readFile args.head!
|
||||
let mut requestNo : Nat := 1
|
||||
for text in text.splitOn "-- RESET" do
|
||||
Ipc.writeNotification ⟨"textDocument/didOpen", {
|
||||
textDocument := { uri := uri, languageId := "lean", version := 1, text := text } : DidOpenTextDocumentParams }⟩
|
||||
-- Whether we have waited for the server via `sync/collectDiagnostics/waitFor` since the last
|
||||
-- change; we should only send out further changes when we are in such a deterministic state.
|
||||
let mut synced := true
|
||||
let mut lineNo := 0
|
||||
let mut lastActualLineNo := 0
|
||||
let mut versionNo : Nat := 2
|
||||
let mut rpcSessionId : Option UInt64 := none
|
||||
for line in text.splitOn "\n" do
|
||||
match line.splitOn "--" with
|
||||
| [ws, directive] =>
|
||||
let line ← match directive.front with
|
||||
| 'v' => pure <| lineNo + 1 -- TODO: support subsequent 'v'... or not
|
||||
| '^' => pure <| lastActualLineNo
|
||||
| _ =>
|
||||
lastActualLineNo := lineNo
|
||||
lineNo := lineNo + 1
|
||||
continue
|
||||
let directive := directive.drop 1
|
||||
let colon := directive.posOf ':'
|
||||
let method := directive.extract 0 colon |>.trim
|
||||
-- TODO: correctly compute in presence of Unicode
|
||||
let column := ws.endPos + "--"
|
||||
let pos : Lsp.Position := { line := line, character := column.byteIdx }
|
||||
let params := if colon < directive.endPos then directive.extract (colon + ':') directive.endPos |>.trim else "{}"
|
||||
match method with
|
||||
-- `delete: "foo"` deletes the given string's number of characters at the given position.
|
||||
-- We do NOT check currently that the text at this position is indeed that string.
|
||||
| "delete"
|
||||
-- `insert: "foo"` inserts the given string at the given position.
|
||||
| "insert"
|
||||
-- `change: "foo" "bar"` is like `delete: "foo"` followed by `insert: "bar"` in one atomic step.
|
||||
| "change" =>
|
||||
if !synced then
|
||||
throw <| IO.userError s!"cannot use '{method}' without syncing first"
|
||||
let (delete, insert) ← match method with
|
||||
| "delete" => pure (params, "\"\"")
|
||||
| "insert" => pure ("\"\"", params)
|
||||
| "change" =>
|
||||
-- TODO: allow spaces in strings
|
||||
let [delete, insert] := params.splitOn " "
|
||||
| throw <| IO.userError s!"expected two arguments in {params}"
|
||||
pure (delete, insert)
|
||||
| _ => unreachable!
|
||||
let some delete := Syntax.decodeStrLit delete
|
||||
| throw <| IO.userError s!"failed to parse {delete}"
|
||||
let some insert := Syntax.decodeStrLit insert
|
||||
| throw <| IO.userError s!"failed to parse {insert}"
|
||||
let params : DidChangeTextDocumentParams := {
|
||||
textDocument := {
|
||||
uri := uri
|
||||
version? := versionNo
|
||||
}
|
||||
contentChanges := #[TextDocumentContentChangeEvent.rangeChange {
|
||||
start := pos
|
||||
«end» := { pos with character := pos.character + delete.length }
|
||||
} insert]
|
||||
}
|
||||
let params := toJson params
|
||||
Ipc.writeNotification ⟨"textDocument/didChange", params⟩
|
||||
synced := false
|
||||
-- We don't want to wait for changes to be processed so we can test concurrency
|
||||
--let _ ← Ipc.collectDiagnostics requestNo uri versionNo
|
||||
requestNo := requestNo + 1
|
||||
versionNo := versionNo + 1
|
||||
| "collectDiagnostics" =>
|
||||
if let some diags ← Ipc.collectDiagnostics requestNo uri (versionNo - 1) then
|
||||
IO.eprintln (toJson diags.param)
|
||||
synced := true
|
||||
requestNo := requestNo + 1
|
||||
| "waitForILeans" =>
|
||||
let _ ← Ipc.waitForILeans requestNo uri (versionNo - 1)
|
||||
requestNo := requestNo + 1
|
||||
| "sync" => -- wait for processing but do not print diagnostics
|
||||
let _ ← Ipc.collectDiagnostics requestNo uri (versionNo - 1)
|
||||
synced := true
|
||||
requestNo := requestNo + 1
|
||||
| "waitFor" => -- wait specific message text but do not print diagnostics
|
||||
let _ ← Ipc.waitForMessage params
|
||||
synced := true
|
||||
| "codeAction" =>
|
||||
let params : CodeActionParams := {
|
||||
textDocument := {uri := uri},
|
||||
range := ⟨pos, pos⟩
|
||||
}
|
||||
Ipc.writeRequest ⟨requestNo, "textDocument/codeAction", params⟩
|
||||
let r ← Ipc.readResponseAs requestNo (Array Json)
|
||||
for x in r.result do
|
||||
IO.eprintln x
|
||||
requestNo := requestNo + 1
|
||||
| "goals" =>
|
||||
if rpcSessionId.isNone then
|
||||
Ipc.writeRequest ⟨requestNo, "$/lean/rpc/connect", RpcConnectParams.mk uri⟩
|
||||
let r ← Ipc.readResponseAs requestNo RpcConnected
|
||||
rpcSessionId := some r.result.sessionId
|
||||
requestNo := requestNo + 1
|
||||
let params : Lsp.PlainGoalParams := {
|
||||
textDocument := { uri }
|
||||
position := pos,
|
||||
}
|
||||
let ps : RpcCallParams := {
|
||||
params := toJson params
|
||||
textDocument := { uri }
|
||||
position := pos,
|
||||
sessionId := rpcSessionId.get!,
|
||||
method := `Lean.Widget.getInteractiveGoals
|
||||
}
|
||||
Ipc.writeRequest ⟨requestNo, "$/lean/rpc/call", ps⟩
|
||||
let response ← Ipc.readResponseAs requestNo Client.InteractiveGoals
|
||||
requestNo := requestNo + 1
|
||||
IO.eprintln (repr response.result)
|
||||
IO.eprintln ""
|
||||
| "widgets" =>
|
||||
if rpcSessionId.isNone then
|
||||
Ipc.writeRequest ⟨requestNo, "$/lean/rpc/connect", RpcConnectParams.mk uri⟩
|
||||
let r ← Ipc.readResponseAs requestNo RpcConnected
|
||||
rpcSessionId := some r.result.sessionId
|
||||
requestNo := requestNo + 1
|
||||
let ps : RpcCallParams := {
|
||||
textDocument := {uri := uri},
|
||||
position := pos,
|
||||
sessionId := rpcSessionId.get!,
|
||||
method := `Lean.Widget.getWidgets,
|
||||
params := toJson pos,
|
||||
}
|
||||
Ipc.writeRequest ⟨requestNo, "$/lean/rpc/call", ps⟩
|
||||
let response ← Ipc.readResponseAs requestNo Lean.Widget.GetWidgetsResponse
|
||||
requestNo := requestNo + 1
|
||||
IO.eprintln response.result.debugJson
|
||||
for w in response.result.widgets do
|
||||
let params : Lean.Widget.GetWidgetSourceParams := { pos, hash := w.javascriptHash }
|
||||
let ps : RpcCallParams := {
|
||||
ps with
|
||||
method := `Lean.Widget.getWidgetSource,
|
||||
params := toJson params,
|
||||
}
|
||||
Ipc.writeRequest ⟨requestNo, "$/lean/rpc/call", ps⟩
|
||||
let resp ← Ipc.readResponseAs requestNo Lean.Widget.WidgetSource
|
||||
IO.eprintln (toJson resp.result)
|
||||
requestNo := requestNo + 1
|
||||
| _ =>
|
||||
let Except.ok params ← pure <| Json.parse params
|
||||
| throw <| IO.userError s!"failed to parse {params}"
|
||||
let params := params.setObjVal! "textDocument" (toJson { uri := uri : TextDocumentIdentifier })
|
||||
-- TODO: correctly compute in presence of Unicode
|
||||
let params := params.setObjVal! "position" (toJson pos)
|
||||
IO.eprintln params
|
||||
Ipc.writeRequest ⟨requestNo, method, params⟩
|
||||
let rec readFirstResponse := do
|
||||
match ← Ipc.readMessage with
|
||||
| Message.response id r =>
|
||||
assert! id == requestNo
|
||||
return r
|
||||
| Message.notification .. => readFirstResponse
|
||||
| Message.request .. => readFirstResponse
|
||||
| msg => throw <| IO.userError s!"unexpected message {toJson msg}"
|
||||
let resp ← readFirstResponse
|
||||
IO.eprintln resp
|
||||
requestNo := requestNo + 1
|
||||
| _ =>
|
||||
lastActualLineNo := lineNo
|
||||
lineNo := lineNo + 1
|
||||
let text ← IO.FS.readFile path
|
||||
let init : RunnerState := {
|
||||
uri
|
||||
synced := true
|
||||
versionNo := 2
|
||||
rpcSessionId := none
|
||||
lineNo := 0
|
||||
lastActualLineNo := 0
|
||||
pos := ⟨0, 0⟩
|
||||
method := ""
|
||||
params := ""
|
||||
requestNo := 1
|
||||
}
|
||||
RunnerM.run (init := init) do
|
||||
for text in text.splitOn "-- RESET" do
|
||||
Ipc.writeNotification ⟨"textDocument/didOpen", {
|
||||
textDocument := { uri := uri, languageId := "lean", version := 1, text := text } : DidOpenTextDocumentParams }⟩
|
||||
reset
|
||||
for line in text.splitOn "\n" do
|
||||
processLine line
|
||||
let _ ← Ipc.collectDiagnostics (← get).requestNo uri ((← get).versionNo - 1)
|
||||
advanceRequestNo
|
||||
Ipc.writeNotification ⟨"textDocument/didClose", {
|
||||
textDocument := { uri } : DidCloseTextDocumentParams }⟩
|
||||
|
||||
let _ ← Ipc.collectDiagnostics requestNo uri (versionNo - 1)
|
||||
Ipc.writeNotification ⟨"textDocument/didClose", {
|
||||
textDocument := { uri } : DidCloseTextDocumentParams }⟩
|
||||
|
||||
Ipc.shutdown requestNo
|
||||
discard <| Ipc.waitForExit
|
||||
Ipc.shutdown (← get).requestNo
|
||||
discard <| Ipc.waitForExit
|
||||
|
|
|
|||
|
|
@ -55,6 +55,14 @@ partial def mapM : TaggedText α → m (TaggedText β)
|
|||
| append as => return append (← as.mapM mapM)
|
||||
| tag t a => return tag (← f t) (← mapM a)
|
||||
|
||||
variable [Monad m] (f : α → TaggedText α → m Unit) in
|
||||
partial def forM : TaggedText α → m Unit
|
||||
| text _ => return
|
||||
| append as => as.forM forM
|
||||
| tag t a => do
|
||||
f t a
|
||||
forM a
|
||||
|
||||
variable (f : α → TaggedText α → TaggedText β) in
|
||||
partial def rewrite : TaggedText α → TaggedText β
|
||||
| text s => text s
|
||||
|
|
|
|||
|
|
@ -180,6 +180,17 @@ FOREACH(T ${LEANTESTS})
|
|||
endif()
|
||||
ENDFOREACH(T)
|
||||
|
||||
# LEAN INTERACTIVE PROJECT SERVER TESTS
|
||||
file(GLOB_RECURSE LEANTESTS "${LEAN_SOURCE_DIR}/../tests/lean/interactive/projects/*Test.lean")
|
||||
FOREACH(T ${LEANTESTS})
|
||||
if(NOT T MATCHES "\\.#")
|
||||
GET_FILENAME_COMPONENT(T_NAME ${T} NAME)
|
||||
add_test(NAME "leaninteractiveprojecttest_${T_NAME}"
|
||||
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lean/interactive/projects"
|
||||
COMMAND bash -c "${TEST_VARS} ./test_single.sh ${T}")
|
||||
endif()
|
||||
ENDFOREACH(T)
|
||||
|
||||
# LEAN DOCSTRING PARSER TESTS
|
||||
file(GLOB_RECURSE LEANTESTS "${LEAN_SOURCE_DIR}/../tests/lean/docparse/*_[0-9][0-9][0-9][0-9]")
|
||||
FOREACH(T ${LEANTESTS})
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ def mkCompletionRequest (id : Nat) : JsonRpc.Request Json :=
|
|||
{ id, method := "textDocument/completion", param }
|
||||
|
||||
def main : IO Unit := do
|
||||
Ipc.runWith (←IO.appPath) #["--server"] do
|
||||
Ipc.runWith "lean" #["--server"] do
|
||||
let hIn ← Ipc.stdin
|
||||
hIn.write (← FS.readBinFile "identifier_completion_initialization.log")
|
||||
hIn.flush
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import Lean.Data.Lsp
|
|||
open IO Lean Lsp
|
||||
|
||||
def main : IO Unit := do
|
||||
Ipc.runWith (←IO.appPath) #["--server"] do
|
||||
Ipc.runWith "lean" #["--server"] do
|
||||
let hIn ← Ipc.stdin
|
||||
hIn.write (←FS.readBinFile "server_startup.log")
|
||||
hIn.flush
|
||||
|
|
|
|||
|
|
@ -8,28 +8,28 @@ axiom Lean.Elab.Tactic.elabTermEnsuringType : Type
|
|||
-- adding full namespace
|
||||
|
||||
#check elabTermEnsuring
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
-- adding partial namespace
|
||||
|
||||
open Lean.Elab in
|
||||
#check elabTermEnsuring
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
-- direct + indirect match
|
||||
|
||||
open Lean.Elab.Term in
|
||||
#check elabTermEnsuring
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
-- same, on the top level
|
||||
|
||||
axiom elabTermEnsuringType : Type
|
||||
#check elabTermEnsuring
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
-- prioritize smaller prefixes
|
||||
|
||||
axiom Lean.Elab.elabTermEnsuringType : Type
|
||||
#check elabTermEnsuring
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -18,6 +18,26 @@
|
|||
0,
|
||||
"cLean.Elab.Tactic.elabTermEnsuringType"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of Lean.Elab.Term.elabTermEnsuringType:
|
||||
{"label": "Lean.Elab.Term.elabTermEnsuringType",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///1659.lean»",
|
||||
9,
|
||||
23,
|
||||
0,
|
||||
"cLean.Elab.Term.elabTermEnsuringType"]}
|
||||
Resolution of Lean.Elab.Tactic.elabTermEnsuringType:
|
||||
{"label": "Lean.Elab.Tactic.elabTermEnsuringType",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///1659.lean»",
|
||||
9,
|
||||
23,
|
||||
0,
|
||||
"cLean.Elab.Tactic.elabTermEnsuringType"]}
|
||||
{"textDocument": {"uri": "file:///1659.lean"},
|
||||
"position": {"line": 15, "character": 23}}
|
||||
{"items":
|
||||
|
|
@ -38,6 +58,26 @@
|
|||
0,
|
||||
"cLean.Elab.Tactic.elabTermEnsuringType"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of Term.elabTermEnsuringType:
|
||||
{"label": "Term.elabTermEnsuringType",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///1659.lean»",
|
||||
15,
|
||||
23,
|
||||
0,
|
||||
"cLean.Elab.Term.elabTermEnsuringType"]}
|
||||
Resolution of Tactic.elabTermEnsuringType:
|
||||
{"label": "Tactic.elabTermEnsuringType",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///1659.lean»",
|
||||
15,
|
||||
23,
|
||||
0,
|
||||
"cLean.Elab.Tactic.elabTermEnsuringType"]}
|
||||
{"textDocument": {"uri": "file:///1659.lean"},
|
||||
"position": {"line": 21, "character": 23}}
|
||||
{"items":
|
||||
|
|
@ -58,6 +98,26 @@
|
|||
0,
|
||||
"cLean.Elab.Tactic.elabTermEnsuringType"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of elabTermEnsuringType:
|
||||
{"label": "elabTermEnsuringType",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///1659.lean»",
|
||||
21,
|
||||
23,
|
||||
0,
|
||||
"cLean.Elab.Term.elabTermEnsuringType"]}
|
||||
Resolution of Lean.Elab.Tactic.elabTermEnsuringType:
|
||||
{"label": "Lean.Elab.Tactic.elabTermEnsuringType",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///1659.lean»",
|
||||
21,
|
||||
23,
|
||||
0,
|
||||
"cLean.Elab.Tactic.elabTermEnsuringType"]}
|
||||
{"textDocument": {"uri": "file:///1659.lean"},
|
||||
"position": {"line": 27, "character": 23}}
|
||||
{"items":
|
||||
|
|
@ -82,6 +142,31 @@
|
|||
0,
|
||||
"cLean.Elab.Tactic.elabTermEnsuringType"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of Lean.Elab.Term.elabTermEnsuringType:
|
||||
{"label": "Lean.Elab.Term.elabTermEnsuringType",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///1659.lean»",
|
||||
27,
|
||||
23,
|
||||
0,
|
||||
"cLean.Elab.Term.elabTermEnsuringType"]}
|
||||
Resolution of elabTermEnsuringType:
|
||||
{"label": "elabTermEnsuringType",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data": ["«external:file:///1659.lean»", 27, 23, 0, "celabTermEnsuringType"]}
|
||||
Resolution of Lean.Elab.Tactic.elabTermEnsuringType:
|
||||
{"label": "Lean.Elab.Tactic.elabTermEnsuringType",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///1659.lean»",
|
||||
27,
|
||||
23,
|
||||
0,
|
||||
"cLean.Elab.Tactic.elabTermEnsuringType"]}
|
||||
{"textDocument": {"uri": "file:///1659.lean"},
|
||||
"position": {"line": 33, "character": 23}}
|
||||
{"items":
|
||||
|
|
@ -114,3 +199,34 @@
|
|||
0,
|
||||
"cLean.Elab.Tactic.elabTermEnsuringType"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of Lean.Elab.Term.elabTermEnsuringType:
|
||||
{"label": "Lean.Elab.Term.elabTermEnsuringType",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///1659.lean»",
|
||||
33,
|
||||
23,
|
||||
0,
|
||||
"cLean.Elab.Term.elabTermEnsuringType"]}
|
||||
Resolution of Lean.Elab.elabTermEnsuringType:
|
||||
{"label": "Lean.Elab.elabTermEnsuringType",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///1659.lean»", 33, 23, 0, "cLean.Elab.elabTermEnsuringType"]}
|
||||
Resolution of elabTermEnsuringType:
|
||||
{"label": "elabTermEnsuringType",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data": ["«external:file:///1659.lean»", 33, 23, 0, "celabTermEnsuringType"]}
|
||||
Resolution of Lean.Elab.Tactic.elabTermEnsuringType:
|
||||
{"label": "Lean.Elab.Tactic.elabTermEnsuringType",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///1659.lean»",
|
||||
33,
|
||||
23,
|
||||
0,
|
||||
"cLean.Elab.Tactic.elabTermEnsuringType"]}
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ prelude
|
|||
set_option relaxedAutoImplicit false
|
||||
inductive Foo where
|
||||
| bar : F
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -8,3 +8,13 @@
|
|||
"kind": 6,
|
||||
"data": ["«external:file:///533.lean»", 4, 10, 0, "f_uniq.7"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of Foo:
|
||||
{"label": "Foo",
|
||||
"kind": 6,
|
||||
"detail": "Sort ?u",
|
||||
"data": ["«external:file:///533.lean»", 4, 10, 0, "f_uniq.3"]}
|
||||
Resolution of F:
|
||||
{"label": "F",
|
||||
"kind": 6,
|
||||
"detail": "Sort ?u",
|
||||
"data": ["«external:file:///533.lean»", 4, 10, 0, "f_uniq.7"]}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ end Lean
|
|||
|
||||
open Lean in
|
||||
#check getRe
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
namespace Lean
|
||||
#check getRe
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
end Lean
|
||||
|
|
|
|||
|
|
@ -8,6 +8,16 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///863.lean»", 9, 12, 0, "cLean.MonadRef.getRef"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of MonadRef.getRef:
|
||||
{"label": "MonadRef.getRef",
|
||||
"kind": 5,
|
||||
"detail": "[self : MonadRef] → Type",
|
||||
"data": ["«external:file:///863.lean»", 9, 12, 0, "cLean.MonadRef.getRef"]}
|
||||
Resolution of getRef:
|
||||
{"label": "getRef",
|
||||
"kind": 5,
|
||||
"detail": "[self : MonadRef] → Type",
|
||||
"data": ["«external:file:///863.lean»", 9, 12, 0, "cLean.MonadRef.getRef"]}
|
||||
{"textDocument": {"uri": "file:///863.lean"},
|
||||
"position": {"line": 13, "character": 12}}
|
||||
{"items":
|
||||
|
|
@ -19,3 +29,13 @@
|
|||
"data":
|
||||
["«external:file:///863.lean»", 13, 12, 0, "cLean.MonadRef.getRef"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of MonadRef.getRef:
|
||||
{"label": "MonadRef.getRef",
|
||||
"kind": 5,
|
||||
"detail": "[self : MonadRef] → Type",
|
||||
"data": ["«external:file:///863.lean»", 13, 12, 0, "cLean.MonadRef.getRef"]}
|
||||
Resolution of getRef:
|
||||
{"label": "getRef",
|
||||
"kind": 5,
|
||||
"detail": "[self : MonadRef] → Type",
|
||||
"data": ["«external:file:///863.lean»", 13, 12, 0, "cLean.MonadRef.getRef"]}
|
||||
|
|
|
|||
|
|
@ -1,277 +1,290 @@
|
|||
{ goals := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "x"),
|
||||
Lean.Widget.TaggedText.text " = ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "x")]),
|
||||
Lean.Widget.TaggedText.text " → ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "True")]),
|
||||
isInserted? := some false,
|
||||
isRemoved? := none,
|
||||
hyps := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "Nat"),
|
||||
names := #["x"],
|
||||
isInserted? := some true,
|
||||
isRemoved? := none }] }] }
|
||||
|
||||
{ goals := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0", diffStatus? := some "willDelete" }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "x"),
|
||||
Lean.Widget.TaggedText.text " = ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "x")]),
|
||||
Lean.Widget.TaggedText.text " → ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "True")]),
|
||||
isInserted? := some false,
|
||||
isRemoved? := none,
|
||||
hyps := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "Nat"),
|
||||
names := #["x"],
|
||||
isInserted? := none,
|
||||
isRemoved? := none }] }] }
|
||||
|
||||
{ goals := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.text "∀ (",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "x"),
|
||||
Lean.Widget.TaggedText.text " : ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0", diffStatus? := some "willDelete" }
|
||||
(Lean.Widget.TaggedText.text "Nat"),
|
||||
Lean.Widget.TaggedText.text "), ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1/0", diffStatus? := some "willDelete" }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1/0/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "x"),
|
||||
Lean.Widget.TaggedText.text " = ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "x")]),
|
||||
Lean.Widget.TaggedText.text " → ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "True")])]),
|
||||
isInserted? := some false,
|
||||
isRemoved? := none,
|
||||
hyps := #[] }] }
|
||||
|
||||
{ goals := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "True"),
|
||||
isInserted? := some false,
|
||||
isRemoved? := none,
|
||||
hyps := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "Sort u_1"),
|
||||
names := #["α"],
|
||||
isInserted? := none,
|
||||
isRemoved? := none },
|
||||
{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "Nat"),
|
||||
names := #["x", "y"],
|
||||
isInserted? := none,
|
||||
isRemoved? := none },
|
||||
{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.text "∀ (",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "a"),
|
||||
Lean.Widget.TaggedText.text " : ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "α"),
|
||||
Lean.Widget.TaggedText.text "), ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "x"),
|
||||
Lean.Widget.TaggedText.text " = ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1/1", diffStatus? := some "willChange" }
|
||||
(Lean.Widget.TaggedText.text "y")])]),
|
||||
names := #["f"],
|
||||
isInserted? := none,
|
||||
isRemoved? := none },
|
||||
{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "y"),
|
||||
Lean.Widget.TaggedText.text " = ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "x")]),
|
||||
names := #["h"],
|
||||
isInserted? := none,
|
||||
isRemoved? := none }] }] }
|
||||
|
||||
{ goals := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "True"),
|
||||
isInserted? := some false,
|
||||
isRemoved? := none,
|
||||
hyps := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "Sort u_1"),
|
||||
names := #["α"],
|
||||
isInserted? := none,
|
||||
isRemoved? := none },
|
||||
{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "Nat"),
|
||||
names := #["x", "y"],
|
||||
isInserted? := none,
|
||||
isRemoved? := none },
|
||||
{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.text "∀ (",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "a"),
|
||||
Lean.Widget.TaggedText.text " : ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "α"),
|
||||
Lean.Widget.TaggedText.text "), ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "x"),
|
||||
Lean.Widget.TaggedText.text " = ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1/1", diffStatus? := some "wasChanged" }
|
||||
(Lean.Widget.TaggedText.text "x")])]),
|
||||
names := #["f"],
|
||||
isInserted? := none,
|
||||
isRemoved? := none },
|
||||
{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "y"),
|
||||
Lean.Widget.TaggedText.text " = ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "x")]),
|
||||
names := #["h"],
|
||||
isInserted? := none,
|
||||
isRemoved? := none }] }] }
|
||||
|
||||
{ goals := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := some "willChange" }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "True"),
|
||||
Lean.Widget.TaggedText.text " ∧ ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "True")]),
|
||||
isInserted? := some false,
|
||||
isRemoved? := none,
|
||||
hyps := #[] }] }
|
||||
|
||||
{ goals := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "True"),
|
||||
isInserted? := none,
|
||||
isRemoved? := some true,
|
||||
hyps := #[] },
|
||||
{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "True"),
|
||||
isInserted? := none,
|
||||
isRemoved? := none,
|
||||
hyps := #[] }] }
|
||||
|
||||
{ goals := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "True"),
|
||||
isInserted? := none,
|
||||
isRemoved? := some true,
|
||||
hyps := #[] }] }
|
||||
|
||||
{ goals := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0/1/0/1", diffStatus? := some "willChange" }
|
||||
(Lean.Widget.TaggedText.text "x"),
|
||||
Lean.Widget.TaggedText.text " + ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0/1/1", diffStatus? := some "willChange" }
|
||||
(Lean.Widget.TaggedText.text "z")]),
|
||||
Lean.Widget.TaggedText.text " = ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "z"),
|
||||
Lean.Widget.TaggedText.text " + ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "y")])]),
|
||||
isInserted? := some false,
|
||||
isRemoved? := none,
|
||||
hyps := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "Nat"),
|
||||
names := #["x", "y", "z"],
|
||||
isInserted? := none,
|
||||
isRemoved? := none },
|
||||
{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.append
|
||||
#[Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/0/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "y"),
|
||||
Lean.Widget.TaggedText.text " = ",
|
||||
Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/1", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "x")]),
|
||||
names := #["h"],
|
||||
isInserted? := none,
|
||||
isRemoved? := none }] }] }
|
||||
|
||||
{"textDocument": {"uri": "file:///Diff.lean"},
|
||||
"position": {"line": 2, "character": 4}}
|
||||
{"goals":
|
||||
[{"type":
|
||||
{"tag":
|
||||
[{"subexprPos": "/", "info": {"p": "1"}},
|
||||
{"append":
|
||||
[{"tag":
|
||||
[{"subexprPos": "/0", "info": {"p": "2"}},
|
||||
{"append":
|
||||
[{"tag":
|
||||
[{"subexprPos": "/0/0/1", "info": {"p": "3"}}, {"text": "x"}]},
|
||||
{"text": " = "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/0/1", "info": {"p": "4"}}, {"text": "x"}]}]}]},
|
||||
{"text": " → "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1", "info": {"p": "5"}}, {"text": "True"}]}]}]},
|
||||
"mvarId": "[anonymous]",
|
||||
"isInserted": false,
|
||||
"hyps":
|
||||
[{"type":
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "0"}}, {"text": "Nat"}]},
|
||||
"names": ["x"],
|
||||
"isInserted": true,
|
||||
"fvarIds": []}],
|
||||
"goalPrefix": "⊢ ",
|
||||
"ctx": {"p": "6"}}]}
|
||||
{"textDocument": {"uri": "file:///Diff.lean"},
|
||||
"position": {"line": 4, "character": 2}}
|
||||
{"goals":
|
||||
[{"type":
|
||||
{"tag":
|
||||
[{"subexprPos": "/", "info": {"p": "8"}},
|
||||
{"append":
|
||||
[{"tag":
|
||||
[{"subexprPos": "/0", "info": {"p": "9"}, "diffStatus": "willDelete"},
|
||||
{"append":
|
||||
[{"tag":
|
||||
[{"subexprPos": "/0/0/1", "info": {"p": "10"}}, {"text": "x"}]},
|
||||
{"text": " = "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/0/1", "info": {"p": "11"}}, {"text": "x"}]}]}]},
|
||||
{"text": " → "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1", "info": {"p": "12"}}, {"text": "True"}]}]}]},
|
||||
"mvarId": "[anonymous]",
|
||||
"isInserted": false,
|
||||
"hyps":
|
||||
[{"type":
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "7"}}, {"text": "Nat"}]},
|
||||
"names": ["x"],
|
||||
"fvarIds": []}],
|
||||
"goalPrefix": "⊢ ",
|
||||
"ctx": {"p": "13"}}]}
|
||||
{"textDocument": {"uri": "file:///Diff.lean"},
|
||||
"position": {"line": 9, "character": 2}}
|
||||
{"goals":
|
||||
[{"type":
|
||||
{"tag":
|
||||
[{"subexprPos": "/", "info": {"p": "14"}},
|
||||
{"append":
|
||||
[{"text": "∀ ("},
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "15"}}, {"text": "x"}]},
|
||||
{"text": " : "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/0", "info": {"p": "16"}, "diffStatus": "willDelete"},
|
||||
{"text": "Nat"}]},
|
||||
{"text": "), "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1", "info": {"p": "17"}},
|
||||
{"append":
|
||||
[{"tag":
|
||||
[{"subexprPos": "/1/0",
|
||||
"info": {"p": "18"},
|
||||
"diffStatus": "willDelete"},
|
||||
{"append":
|
||||
[{"tag":
|
||||
[{"subexprPos": "/1/0/0/1", "info": {"p": "19"}},
|
||||
{"text": "x"}]},
|
||||
{"text": " = "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1/0/1", "info": {"p": "20"}},
|
||||
{"text": "x"}]}]}]},
|
||||
{"text": " → "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1/1", "info": {"p": "21"}},
|
||||
{"text": "True"}]}]}]}]}]},
|
||||
"mvarId": "[anonymous]",
|
||||
"isInserted": false,
|
||||
"hyps": [],
|
||||
"goalPrefix": "⊢ ",
|
||||
"ctx": {"p": "22"}}]}
|
||||
{"textDocument": {"uri": "file:///Diff.lean"},
|
||||
"position": {"line": 15, "character": 5}}
|
||||
{"goals":
|
||||
[{"type":
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "34"}}, {"text": "True"}]},
|
||||
"mvarId": "[anonymous]",
|
||||
"isInserted": false,
|
||||
"hyps":
|
||||
[{"type":
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "23"}}, {"text": "Sort u_1"}]},
|
||||
"names": ["α"],
|
||||
"isType": true,
|
||||
"fvarIds": []},
|
||||
{"type":
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "24"}}, {"text": "Nat"}]},
|
||||
"names": ["x", "y"],
|
||||
"fvarIds": []},
|
||||
{"type":
|
||||
{"tag":
|
||||
[{"subexprPos": "/", "info": {"p": "25"}},
|
||||
{"append":
|
||||
[{"text": "∀ ("},
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "26"}}, {"text": "a"}]},
|
||||
{"text": " : "},
|
||||
{"tag": [{"subexprPos": "/0", "info": {"p": "27"}}, {"text": "α"}]},
|
||||
{"text": "), "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1", "info": {"p": "28"}},
|
||||
{"append":
|
||||
[{"tag":
|
||||
[{"subexprPos": "/1/0/1", "info": {"p": "29"}}, {"text": "x"}]},
|
||||
{"text": " = "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1/1",
|
||||
"info": {"p": "30"},
|
||||
"diffStatus": "willChange"},
|
||||
{"text": "y"}]}]}]}]}]},
|
||||
"names": ["f"],
|
||||
"fvarIds": []},
|
||||
{"type":
|
||||
{"tag":
|
||||
[{"subexprPos": "/", "info": {"p": "31"}},
|
||||
{"append":
|
||||
[{"tag": [{"subexprPos": "/0/1", "info": {"p": "32"}}, {"text": "y"}]},
|
||||
{"text": " = "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1", "info": {"p": "33"}}, {"text": "x"}]}]}]},
|
||||
"names": ["h"],
|
||||
"fvarIds": []}],
|
||||
"goalPrefix": "⊢ ",
|
||||
"ctx": {"p": "35"}}]}
|
||||
{"textDocument": {"uri": "file:///Diff.lean"},
|
||||
"position": {"line": 20, "character": 9}}
|
||||
{"goals":
|
||||
[{"type":
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "47"}}, {"text": "True"}]},
|
||||
"mvarId": "[anonymous]",
|
||||
"isInserted": false,
|
||||
"hyps":
|
||||
[{"type":
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "36"}}, {"text": "Sort u_1"}]},
|
||||
"names": ["α"],
|
||||
"isType": true,
|
||||
"fvarIds": []},
|
||||
{"type":
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "37"}}, {"text": "Nat"}]},
|
||||
"names": ["x", "y"],
|
||||
"fvarIds": []},
|
||||
{"type":
|
||||
{"tag":
|
||||
[{"subexprPos": "/", "info": {"p": "38"}},
|
||||
{"append":
|
||||
[{"text": "∀ ("},
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "39"}}, {"text": "a"}]},
|
||||
{"text": " : "},
|
||||
{"tag": [{"subexprPos": "/0", "info": {"p": "40"}}, {"text": "α"}]},
|
||||
{"text": "), "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1", "info": {"p": "41"}},
|
||||
{"append":
|
||||
[{"tag":
|
||||
[{"subexprPos": "/1/0/1", "info": {"p": "42"}}, {"text": "x"}]},
|
||||
{"text": " = "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1/1",
|
||||
"info": {"p": "43"},
|
||||
"diffStatus": "wasChanged"},
|
||||
{"text": "x"}]}]}]}]}]},
|
||||
"names": ["f"],
|
||||
"fvarIds": []},
|
||||
{"type":
|
||||
{"tag":
|
||||
[{"subexprPos": "/", "info": {"p": "44"}},
|
||||
{"append":
|
||||
[{"tag": [{"subexprPos": "/0/1", "info": {"p": "45"}}, {"text": "y"}]},
|
||||
{"text": " = "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1", "info": {"p": "46"}}, {"text": "x"}]}]}]},
|
||||
"names": ["h"],
|
||||
"fvarIds": []}],
|
||||
"goalPrefix": "⊢ ",
|
||||
"ctx": {"p": "48"}}]}
|
||||
{"textDocument": {"uri": "file:///Diff.lean"},
|
||||
"position": {"line": 25, "character": 2}}
|
||||
{"goals":
|
||||
[{"type":
|
||||
{"tag":
|
||||
[{"subexprPos": "/", "info": {"p": "49"}, "diffStatus": "willChange"},
|
||||
{"append":
|
||||
[{"tag": [{"subexprPos": "/0/1", "info": {"p": "50"}}, {"text": "True"}]},
|
||||
{"text": " ∧ "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1", "info": {"p": "51"}}, {"text": "True"}]}]}]},
|
||||
"mvarId": "[anonymous]",
|
||||
"isInserted": false,
|
||||
"hyps": [],
|
||||
"goalPrefix": "⊢ ",
|
||||
"ctx": {"p": "52"}}]}
|
||||
{"textDocument": {"uri": "file:///Diff.lean"},
|
||||
"position": {"line": 27, "character": 2}}
|
||||
{"goals":
|
||||
[{"userName": "left",
|
||||
"type":
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "53"}}, {"text": "True"}]},
|
||||
"mvarId": "[anonymous]",
|
||||
"isRemoved": true,
|
||||
"hyps": [],
|
||||
"goalPrefix": "⊢ ",
|
||||
"ctx": {"p": "54"}},
|
||||
{"userName": "right",
|
||||
"type":
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "55"}}, {"text": "True"}]},
|
||||
"mvarId": "[anonymous]",
|
||||
"hyps": [],
|
||||
"goalPrefix": "⊢ ",
|
||||
"ctx": {"p": "56"}}]}
|
||||
{"textDocument": {"uri": "file:///Diff.lean"},
|
||||
"position": {"line": 29, "character": 2}}
|
||||
{"goals":
|
||||
[{"userName": "right",
|
||||
"type":
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "57"}}, {"text": "True"}]},
|
||||
"mvarId": "[anonymous]",
|
||||
"isRemoved": true,
|
||||
"hyps": [],
|
||||
"goalPrefix": "⊢ ",
|
||||
"ctx": {"p": "58"}}]}
|
||||
{"textDocument": {"uri": "file:///Diff.lean"},
|
||||
"position": {"line": 33, "character": 6}}
|
||||
{"goals":
|
||||
[{"type":
|
||||
{"tag":
|
||||
[{"subexprPos": "/", "info": {"p": "63"}},
|
||||
{"append":
|
||||
[{"tag":
|
||||
[{"subexprPos": "/0/1", "info": {"p": "64"}},
|
||||
{"append":
|
||||
[{"tag":
|
||||
[{"subexprPos": "/0/1/0/1",
|
||||
"info": {"p": "65"},
|
||||
"diffStatus": "willChange"},
|
||||
{"text": "x"}]},
|
||||
{"text": " + "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/0/1/1",
|
||||
"info": {"p": "66"},
|
||||
"diffStatus": "willChange"},
|
||||
{"text": "z"}]}]}]},
|
||||
{"text": " = "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1", "info": {"p": "67"}},
|
||||
{"append":
|
||||
[{"tag":
|
||||
[{"subexprPos": "/1/0/1", "info": {"p": "68"}}, {"text": "z"}]},
|
||||
{"text": " + "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1/1", "info": {"p": "69"}},
|
||||
{"text": "y"}]}]}]}]}]},
|
||||
"mvarId": "[anonymous]",
|
||||
"isInserted": false,
|
||||
"hyps":
|
||||
[{"type":
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "59"}}, {"text": "Nat"}]},
|
||||
"names": ["x", "y", "z"],
|
||||
"fvarIds": []},
|
||||
{"type":
|
||||
{"tag":
|
||||
[{"subexprPos": "/", "info": {"p": "60"}},
|
||||
{"append":
|
||||
[{"tag": [{"subexprPos": "/0/1", "info": {"p": "61"}}, {"text": "y"}]},
|
||||
{"text": " = "},
|
||||
{"tag":
|
||||
[{"subexprPos": "/1", "info": {"p": "62"}}, {"text": "x"}]}]}]},
|
||||
"names": ["h"],
|
||||
"fvarIds": []}],
|
||||
"goalPrefix": "⊢ ",
|
||||
"ctx": {"p": "70"}}]}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,17 @@
|
|||
{"title":
|
||||
"Try this: simp only [AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] at h",
|
||||
"kind": "quickfix",
|
||||
"isPreferred": true,
|
||||
"edit":
|
||||
{"documentChanges":
|
||||
[{"textDocument": {"version": 1, "uri": "file:///builtinCodeactions.lean"},
|
||||
"edits":
|
||||
[{"range":
|
||||
{"start": {"line": 5, "character": 2},
|
||||
"end": {"line": 5, "character": 97}},
|
||||
"newText":
|
||||
"simp only [AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] at h"}]}]}}
|
||||
{"textDocument": {"uri": "file:///builtinCodeactions.lean"},
|
||||
"range":
|
||||
{"start": {"line": 5, "character": 4}, "end": {"line": 5, "character": 4}},
|
||||
"context": {"diagnostics": []}}
|
||||
[{"title":
|
||||
"Try this: simp only [AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] at h",
|
||||
"kind": "quickfix",
|
||||
"isPreferred": true,
|
||||
"edit":
|
||||
{"documentChanges":
|
||||
[{"textDocument": {"version": 1, "uri": "file:///builtinCodeactions.lean"},
|
||||
"edits":
|
||||
[{"range":
|
||||
{"start": {"line": 5, "character": 2},
|
||||
"end": {"line": 5, "character": 97}},
|
||||
"newText":
|
||||
"simp only [AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] at h"}]}]}}]
|
||||
|
|
|
|||
64
tests/lean/interactive/codeActions.lean
Normal file
64
tests/lean/interactive/codeActions.lean
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import Lean.Server.CodeActions
|
||||
|
||||
open Lean.Server
|
||||
|
||||
@[code_action_provider] def foo : Lean.Server.CodeActionProvider := fun _ snap => do
|
||||
let doc ← RequestM.readDoc
|
||||
let some range := snap.stx.getRange?
|
||||
| return #[]
|
||||
return #[{
|
||||
eager := {
|
||||
title := "foo"
|
||||
kind? := "quickfix"
|
||||
edit? := some <| .ofTextEdit doc.versionedIdentifier {
|
||||
newText := "foo"
|
||||
range := doc.meta.text.utf8RangeToLspRange range
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
||||
syntax (name := barCmd) "#bar" : command
|
||||
|
||||
macro_rules
|
||||
| `(#bar) => `(#eval 0)
|
||||
|
||||
@[command_code_action barCmd] def bar : Lean.CodeAction.CommandCodeAction := fun _ _ _ i => do
|
||||
let doc ← RequestM.readDoc
|
||||
let some (.ofCommandInfo ci) := i.findInfo? (· matches .ofCommandInfo ..)
|
||||
| return #[]
|
||||
let some range := ci.stx.getRange?
|
||||
| return #[]
|
||||
return #[{
|
||||
eager := {
|
||||
title := "bar"
|
||||
kind? := "quickfix"
|
||||
edit? := some <| .ofTextEdit doc.versionedIdentifier {
|
||||
newText := "#eval 0"
|
||||
range := doc.meta.text.utf8RangeToLspRange range
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
||||
@[hole_code_action] def foobar : Lean.CodeAction.HoleCodeAction := fun _ _ _ hole => do
|
||||
let doc ← RequestM.readDoc
|
||||
let some range := hole.stx.getRange?
|
||||
| return #[]
|
||||
return #[{
|
||||
eager := {
|
||||
title := "foobar"
|
||||
kind? := "quickfix"
|
||||
edit? := some <| .ofTextEdit doc.versionedIdentifier {
|
||||
newText := "\"foobar\""
|
||||
range := doc.meta.text.utf8RangeToLspRange range
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
||||
def f : Nat := 0
|
||||
--^ codeAction
|
||||
|
||||
#bar
|
||||
--^ codeAction
|
||||
|
||||
example : Nat := _
|
||||
--^ codeAction
|
||||
62
tests/lean/interactive/codeActions.lean.expected.out
Normal file
62
tests/lean/interactive/codeActions.lean.expected.out
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{"textDocument": {"uri": "file:///codeActions.lean"},
|
||||
"range":
|
||||
{"start": {"line": 56, "character": 4}, "end": {"line": 56, "character": 4}},
|
||||
"context": {"diagnostics": []}}
|
||||
[{"title": "foo",
|
||||
"kind": "quickfix",
|
||||
"edit":
|
||||
{"documentChanges":
|
||||
[{"textDocument": {"version": 1, "uri": "file:///codeActions.lean"},
|
||||
"edits":
|
||||
[{"range":
|
||||
{"start": {"line": 56, "character": 0},
|
||||
"end": {"line": 56, "character": 16}},
|
||||
"newText": "foo"}]}]}}]
|
||||
{"textDocument": {"uri": "file:///codeActions.lean"},
|
||||
"range":
|
||||
{"start": {"line": 59, "character": 2}, "end": {"line": 59, "character": 2}},
|
||||
"context": {"diagnostics": []}}
|
||||
[{"title": "bar",
|
||||
"kind": "quickfix",
|
||||
"edit":
|
||||
{"documentChanges":
|
||||
[{"textDocument": {"version": 1, "uri": "file:///codeActions.lean"},
|
||||
"edits":
|
||||
[{"range":
|
||||
{"start": {"line": 59, "character": 0},
|
||||
"end": {"line": 59, "character": 4}},
|
||||
"newText": "#eval 0"}]}]}},
|
||||
{"title": "foo",
|
||||
"kind": "quickfix",
|
||||
"edit":
|
||||
{"documentChanges":
|
||||
[{"textDocument": {"version": 1, "uri": "file:///codeActions.lean"},
|
||||
"edits":
|
||||
[{"range":
|
||||
{"start": {"line": 59, "character": 0},
|
||||
"end": {"line": 59, "character": 4}},
|
||||
"newText": "foo"}]}]}}]
|
||||
{"textDocument": {"uri": "file:///codeActions.lean"},
|
||||
"range":
|
||||
{"start": {"line": 62, "character": 18}, "end": {"line": 62, "character": 18}},
|
||||
"context": {"diagnostics": []}}
|
||||
[{"title": "foobar",
|
||||
"kind": "quickfix",
|
||||
"edit":
|
||||
{"documentChanges":
|
||||
[{"textDocument": {"version": 1, "uri": "file:///codeActions.lean"},
|
||||
"edits":
|
||||
[{"range":
|
||||
{"start": {"line": 62, "character": 17},
|
||||
"end": {"line": 62, "character": 18}},
|
||||
"newText": "\"foobar\""}]}]}},
|
||||
{"title": "foo",
|
||||
"kind": "quickfix",
|
||||
"edit":
|
||||
{"documentChanges":
|
||||
[{"textDocument": {"version": 1, "uri": "file:///codeActions.lean"},
|
||||
"edits":
|
||||
[{"range":
|
||||
{"start": {"line": 62, "character": 0},
|
||||
"end": {"line": 62, "character": 18}},
|
||||
"newText": "foo"}]}]}}]
|
||||
|
|
@ -20,10 +20,8 @@ def helloProvider : CodeActionProvider := fun params _snap => do
|
|||
kind? := "refactor",
|
||||
}
|
||||
let lazyResult : IO CodeAction := do
|
||||
let v? ← IO.getEnv "PWD"
|
||||
let v := v?.getD "none"
|
||||
return { longRunner with
|
||||
edit? := WorkspaceEdit.ofTextEdit vi { range := params.range, newText := v}
|
||||
edit? := WorkspaceEdit.ofTextEdit vi { range := params.range, newText := "lazy result"}
|
||||
}
|
||||
return #[ca, {eager := longRunner, lazy? := lazyResult}]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,36 @@
|
|||
{"title": "hello world",
|
||||
"kind": "quickfix",
|
||||
{"textDocument": {"uri": "file:///codeaction.lean"},
|
||||
"range":
|
||||
{"start": {"line": 28, "character": 4}, "end": {"line": 28, "character": 4}},
|
||||
"context": {"diagnostics": []}}
|
||||
[{"title": "hello world",
|
||||
"kind": "quickfix",
|
||||
"edit":
|
||||
{"documentChanges":
|
||||
[{"textDocument": {"version": 1, "uri": "file:///codeaction.lean"},
|
||||
"edits":
|
||||
[{"range":
|
||||
{"start": {"line": 28, "character": 4},
|
||||
"end": {"line": 28, "character": 4}},
|
||||
"newText": "hello!!!"}]}]}},
|
||||
{"title": "a long-running action",
|
||||
"kind": "refactor",
|
||||
"data":
|
||||
{"providerResultIndex": 1,
|
||||
"providerName": "helloProvider",
|
||||
"params":
|
||||
{"textDocument": {"uri": "file:///codeaction.lean"},
|
||||
"range":
|
||||
{"start": {"line": 28, "character": 4},
|
||||
"end": {"line": 28, "character": 4}},
|
||||
"context": {"diagnostics": []}}}}]
|
||||
Resolution of a long-running action:
|
||||
{"title": "a long-running action",
|
||||
"kind": "refactor",
|
||||
"edit":
|
||||
{"documentChanges":
|
||||
[{"textDocument": {"version": 1, "uri": "file:///codeaction.lean"},
|
||||
"edits":
|
||||
[{"range":
|
||||
{"start": {"line": 30, "character": 4},
|
||||
"end": {"line": 30, "character": 4}},
|
||||
"newText": "hello!!!"}]}]}}
|
||||
{"title": "a long-running action",
|
||||
"kind": "refactor",
|
||||
"data":
|
||||
{"providerResultIndex": 1,
|
||||
"providerName": "helloProvider",
|
||||
"params":
|
||||
{"textDocument": {"uri": "file:///codeaction.lean"},
|
||||
"range":
|
||||
{"start": {"line": 30, "character": 4}, "end": {"line": 30, "character": 4}},
|
||||
"context": {"diagnostics": []}}}}
|
||||
{"start": {"line": 28, "character": 4},
|
||||
"end": {"line": 28, "character": 4}},
|
||||
"newText": "lazy result"}]}]}}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
def veryLongNameForCompletion := Nat
|
||||
--v textDocument/completion
|
||||
--v completion
|
||||
def f (x : veryLongNam) := x
|
||||
|
|
|
|||
|
|
@ -13,3 +13,14 @@
|
|||
0,
|
||||
"cveryLongNameForCompletion"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of veryLongNam:
|
||||
{"label": "veryLongNam",
|
||||
"kind": 6,
|
||||
"detail": "Sort u_1",
|
||||
"data": ["«external:file:///compHeader.lean»", 2, 22, 0, "f_uniq.7"]}
|
||||
Resolution of veryLongNameForCompletion:
|
||||
{"label": "veryLongNameForCompletion",
|
||||
"kind": 21,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///compHeader.lean»", 2, 22, 0, "cveryLongNameForCompletion"]}
|
||||
|
|
|
|||
|
|
@ -4,19 +4,19 @@ namespace LongNamespaceExample
|
|||
def x := 10
|
||||
|
||||
#check LongNam
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
end LongNamespaceExample
|
||||
|
||||
#check LongNam
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
end Foo
|
||||
|
||||
#check Foo.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
#check Foo.LongN
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
open Foo
|
||||
|
||||
#check LongNam
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@
|
|||
"detail": "namespace",
|
||||
"data": ["«external:file:///compNamespace.lean»", 5, 14, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of LongNamespaceExample:
|
||||
{"label": "LongNamespaceExample",
|
||||
"kind": 9,
|
||||
"detail": "namespace",
|
||||
"data": ["«external:file:///compNamespace.lean»", 5, 14, 0]}
|
||||
{"textDocument": {"uri": "file:///compNamespace.lean"},
|
||||
"position": {"line": 9, "character": 14}}
|
||||
{"items":
|
||||
|
|
@ -14,6 +19,11 @@
|
|||
"detail": "namespace",
|
||||
"data": ["«external:file:///compNamespace.lean»", 9, 14, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of LongNamespaceExample:
|
||||
{"label": "LongNamespaceExample",
|
||||
"kind": 9,
|
||||
"detail": "namespace",
|
||||
"data": ["«external:file:///compNamespace.lean»", 9, 14, 0]}
|
||||
{"textDocument": {"uri": "file:///compNamespace.lean"},
|
||||
"position": {"line": 13, "character": 11}}
|
||||
{"items":
|
||||
|
|
@ -22,6 +32,11 @@
|
|||
"detail": "namespace",
|
||||
"data": ["«external:file:///compNamespace.lean»", 13, 11, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of LongNamespaceExample:
|
||||
{"label": "LongNamespaceExample",
|
||||
"kind": 9,
|
||||
"detail": "namespace",
|
||||
"data": ["«external:file:///compNamespace.lean»", 13, 11, 0]}
|
||||
{"textDocument": {"uri": "file:///compNamespace.lean"},
|
||||
"position": {"line": 16, "character": 16}}
|
||||
{"items":
|
||||
|
|
@ -30,6 +45,11 @@
|
|||
"detail": "namespace",
|
||||
"data": ["«external:file:///compNamespace.lean»", 16, 16, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of LongNamespaceExample:
|
||||
{"label": "LongNamespaceExample",
|
||||
"kind": 9,
|
||||
"detail": "namespace",
|
||||
"data": ["«external:file:///compNamespace.lean»", 16, 16, 0]}
|
||||
{"textDocument": {"uri": "file:///compNamespace.lean"},
|
||||
"position": {"line": 20, "character": 14}}
|
||||
{"items":
|
||||
|
|
@ -38,3 +58,8 @@
|
|||
"detail": "namespace",
|
||||
"data": ["«external:file:///compNamespace.lean»", 20, 14, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of LongNamespaceExample:
|
||||
{"label": "LongNamespaceExample",
|
||||
"kind": 9,
|
||||
"detail": "namespace",
|
||||
"data": ["«external:file:///compNamespace.lean»", 20, 14, 0]}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ structure Foo where
|
|||
foo : Nat
|
||||
|
||||
example (f : Foo) : f.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
example (f : Foo) : f.f
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
example (f : Foo) : id f |>.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
example (f : Foo) : id f |>.f
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion.lean»", 3, 22, 1, "cFoo.foo"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "Foo → Nat",
|
||||
"data": ["«external:file:///completion.lean»", 3, 22, 1, "cFoo.foo"]}
|
||||
{"textDocument": {"uri": "file:///completion.lean"},
|
||||
"position": {"line": 5, "character": 23}}
|
||||
{"items":
|
||||
|
|
@ -12,6 +17,11 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion.lean»", 5, 23, 1, "cFoo.foo"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "Foo → Nat",
|
||||
"data": ["«external:file:///completion.lean»", 5, 23, 1, "cFoo.foo"]}
|
||||
{"textDocument": {"uri": "file:///completion.lean"},
|
||||
"position": {"line": 7, "character": 28}}
|
||||
{"items":
|
||||
|
|
@ -19,6 +29,11 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion.lean»", 7, 28, 0, "cFoo.foo"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "Foo → Nat",
|
||||
"data": ["«external:file:///completion.lean»", 7, 28, 0, "cFoo.foo"]}
|
||||
{"textDocument": {"uri": "file:///completion.lean"},
|
||||
"position": {"line": 9, "character": 29}}
|
||||
{"items":
|
||||
|
|
@ -26,3 +41,8 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion.lean»", 9, 29, 0, "cFoo.foo"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "Foo → Nat",
|
||||
"data": ["«external:file:///completion.lean»", 9, 29, 0, "cFoo.foo"]}
|
||||
|
|
|
|||
|
|
@ -18,23 +18,23 @@ end Foo
|
|||
|
||||
theorem tst1 (h : a ≤ b) : a + 2 ≤ b + 2 :=
|
||||
Foo.Bla.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
#print ""
|
||||
|
||||
open Foo in
|
||||
theorem tst2 (h : a ≤ b) : a + 2 ≤ b + 2 :=
|
||||
Bla.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
#print ""
|
||||
|
||||
theorem tst3 (h : a ≤ b) : a + 2 ≤ b + 2 :=
|
||||
let aux := Foo.Bla. -- we don't have the expected type here
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
aux
|
||||
|
||||
#print ""
|
||||
|
||||
theorem tst4 (h : a ≤ b) : a + 2 ≤ b + 2 :=
|
||||
let aux := Foo.Bla.e -- we don't have the expected type here
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
aux
|
||||
|
|
|
|||
|
|
@ -14,6 +14,26 @@
|
|||
"kind": 23,
|
||||
"data": ["«external:file:///completion2.lean»", 19, 10, 0, "cFoo.Bla.ax1"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of ex2:
|
||||
{"label": "ex2",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → a + 2 ≤ b + 2",
|
||||
"data": ["«external:file:///completion2.lean»", 19, 10, 0, "cFoo.Bla.ex2"]}
|
||||
Resolution of ex3:
|
||||
{"label": "ex3",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → c ≤ d → a + c ≤ b + d",
|
||||
"data": ["«external:file:///completion2.lean»", 19, 10, 0, "cFoo.Bla.ex3"]}
|
||||
Resolution of ex1:
|
||||
{"label": "ex1",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → a + a ≤ b + b",
|
||||
"data": ["«external:file:///completion2.lean»", 19, 10, 0, "cFoo.Bla.ex1"]}
|
||||
Resolution of ax1:
|
||||
{"label": "ax1",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → a - a ≤ b - b",
|
||||
"data": ["«external:file:///completion2.lean»", 19, 10, 0, "cFoo.Bla.ax1"]}
|
||||
{"textDocument": {"uri": "file:///completion2.lean"},
|
||||
"position": {"line": 25, "character": 6}}
|
||||
{"items":
|
||||
|
|
@ -30,6 +50,26 @@
|
|||
"kind": 23,
|
||||
"data": ["«external:file:///completion2.lean»", 25, 6, 0, "cFoo.Bla.ax1"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of ex2:
|
||||
{"label": "ex2",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → a + 2 ≤ b + 2",
|
||||
"data": ["«external:file:///completion2.lean»", 25, 6, 0, "cFoo.Bla.ex2"]}
|
||||
Resolution of ex3:
|
||||
{"label": "ex3",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → c ≤ d → a + c ≤ b + d",
|
||||
"data": ["«external:file:///completion2.lean»", 25, 6, 0, "cFoo.Bla.ex3"]}
|
||||
Resolution of ex1:
|
||||
{"label": "ex1",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → a + a ≤ b + b",
|
||||
"data": ["«external:file:///completion2.lean»", 25, 6, 0, "cFoo.Bla.ex1"]}
|
||||
Resolution of ax1:
|
||||
{"label": "ax1",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → a - a ≤ b - b",
|
||||
"data": ["«external:file:///completion2.lean»", 25, 6, 0, "cFoo.Bla.ax1"]}
|
||||
{"textDocument": {"uri": "file:///completion2.lean"},
|
||||
"position": {"line": 30, "character": 21}}
|
||||
{"items":
|
||||
|
|
@ -46,6 +86,26 @@
|
|||
"kind": 23,
|
||||
"data": ["«external:file:///completion2.lean»", 30, 21, 0, "cFoo.Bla.ax1"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of ex2:
|
||||
{"label": "ex2",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → a + 2 ≤ b + 2",
|
||||
"data": ["«external:file:///completion2.lean»", 30, 21, 0, "cFoo.Bla.ex2"]}
|
||||
Resolution of ex3:
|
||||
{"label": "ex3",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → c ≤ d → a + c ≤ b + d",
|
||||
"data": ["«external:file:///completion2.lean»", 30, 21, 0, "cFoo.Bla.ex3"]}
|
||||
Resolution of ex1:
|
||||
{"label": "ex1",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → a + a ≤ b + b",
|
||||
"data": ["«external:file:///completion2.lean»", 30, 21, 0, "cFoo.Bla.ex1"]}
|
||||
Resolution of ax1:
|
||||
{"label": "ax1",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → a - a ≤ b - b",
|
||||
"data": ["«external:file:///completion2.lean»", 30, 21, 0, "cFoo.Bla.ax1"]}
|
||||
{"textDocument": {"uri": "file:///completion2.lean"},
|
||||
"position": {"line": 37, "character": 22}}
|
||||
{"items":
|
||||
|
|
@ -59,3 +119,18 @@
|
|||
"kind": 23,
|
||||
"data": ["«external:file:///completion2.lean»", 37, 22, 0, "cFoo.Bla.ex1"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of ex2:
|
||||
{"label": "ex2",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → a + 2 ≤ b + 2",
|
||||
"data": ["«external:file:///completion2.lean»", 37, 22, 0, "cFoo.Bla.ex2"]}
|
||||
Resolution of ex3:
|
||||
{"label": "ex3",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → c ≤ d → a + c ≤ b + d",
|
||||
"data": ["«external:file:///completion2.lean»", 37, 22, 0, "cFoo.Bla.ex3"]}
|
||||
Resolution of ex1:
|
||||
{"label": "ex1",
|
||||
"kind": 23,
|
||||
"detail": "a ≤ b → a + a ≤ b + b",
|
||||
"data": ["«external:file:///completion2.lean»", 37, 22, 0, "cFoo.Bla.ex1"]}
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@ structure S where
|
|||
def f (s : S) : Nat :=
|
||||
let rec foo (s : S) :=
|
||||
if s. then 1 else 2
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
foo s
|
||||
|
||||
def g1 (s : S) : Nat × Nat :=
|
||||
(s. )
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
def g2 (s : S) : Nat × Nat :=
|
||||
(s.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
def g3 (s : S) : Nat × Nat :=
|
||||
(s. , 1, 2)
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -11,6 +11,21 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion3.lean»", 7, 9, 1, "cS.y"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of x:
|
||||
{"label": "x",
|
||||
"kind": 5,
|
||||
"detail": "S → Nat",
|
||||
"data": ["«external:file:///completion3.lean»", 7, 9, 1, "cS.x"]}
|
||||
Resolution of b:
|
||||
{"label": "b",
|
||||
"kind": 5,
|
||||
"detail": "S → Bool",
|
||||
"data": ["«external:file:///completion3.lean»", 7, 9, 1, "cS.b"]}
|
||||
Resolution of y:
|
||||
{"label": "y",
|
||||
"kind": 5,
|
||||
"detail": "S → String",
|
||||
"data": ["«external:file:///completion3.lean»", 7, 9, 1, "cS.y"]}
|
||||
{"textDocument": {"uri": "file:///completion3.lean"},
|
||||
"position": {"line": 12, "character": 5}}
|
||||
{"items":
|
||||
|
|
@ -24,6 +39,21 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion3.lean»", 12, 5, 1, "cS.y"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of x:
|
||||
{"label": "x",
|
||||
"kind": 5,
|
||||
"detail": "S → Nat",
|
||||
"data": ["«external:file:///completion3.lean»", 12, 5, 1, "cS.x"]}
|
||||
Resolution of b:
|
||||
{"label": "b",
|
||||
"kind": 5,
|
||||
"detail": "S → Bool",
|
||||
"data": ["«external:file:///completion3.lean»", 12, 5, 1, "cS.b"]}
|
||||
Resolution of y:
|
||||
{"label": "y",
|
||||
"kind": 5,
|
||||
"detail": "S → String",
|
||||
"data": ["«external:file:///completion3.lean»", 12, 5, 1, "cS.y"]}
|
||||
{"textDocument": {"uri": "file:///completion3.lean"},
|
||||
"position": {"line": 16, "character": 5}}
|
||||
{"items":
|
||||
|
|
@ -37,6 +67,21 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion3.lean»", 16, 5, 1, "cS.y"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of x:
|
||||
{"label": "x",
|
||||
"kind": 5,
|
||||
"detail": "S → Nat",
|
||||
"data": ["«external:file:///completion3.lean»", 16, 5, 1, "cS.x"]}
|
||||
Resolution of b:
|
||||
{"label": "b",
|
||||
"kind": 5,
|
||||
"detail": "S → Bool",
|
||||
"data": ["«external:file:///completion3.lean»", 16, 5, 1, "cS.b"]}
|
||||
Resolution of y:
|
||||
{"label": "y",
|
||||
"kind": 5,
|
||||
"detail": "S → String",
|
||||
"data": ["«external:file:///completion3.lean»", 16, 5, 1, "cS.y"]}
|
||||
{"textDocument": {"uri": "file:///completion3.lean"},
|
||||
"position": {"line": 20, "character": 5}}
|
||||
{"items":
|
||||
|
|
@ -50,3 +95,18 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion3.lean»", 20, 5, 1, "cS.y"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of x:
|
||||
{"label": "x",
|
||||
"kind": 5,
|
||||
"detail": "S → Nat",
|
||||
"data": ["«external:file:///completion3.lean»", 20, 5, 1, "cS.x"]}
|
||||
Resolution of b:
|
||||
{"label": "b",
|
||||
"kind": 5,
|
||||
"detail": "S → Bool",
|
||||
"data": ["«external:file:///completion3.lean»", 20, 5, 1, "cS.b"]}
|
||||
Resolution of y:
|
||||
{"label": "y",
|
||||
"kind": 5,
|
||||
"detail": "S → String",
|
||||
"data": ["«external:file:///completion3.lean»", 20, 5, 1, "cS.y"]}
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@ structure S where
|
|||
def f (s : S) : IO Unit := do
|
||||
s.fn1 10
|
||||
s.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
def g1 (s : S) : IO Unit := do
|
||||
if (← s.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
def g2 (s : S) : IO Unit := do
|
||||
s.fn1 10
|
||||
if (← s.f
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
def g3 (s : S) : IO String := do
|
||||
let mut x := 1 + s.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -11,6 +11,21 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion4.lean»", 7, 4, 1, "cS.pred"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of fn2:
|
||||
{"label": "fn2",
|
||||
"kind": 5,
|
||||
"detail": "S → Bool → IO Unit",
|
||||
"data": ["«external:file:///completion4.lean»", 7, 4, 1, "cS.fn2"]}
|
||||
Resolution of fn1:
|
||||
{"label": "fn1",
|
||||
"kind": 5,
|
||||
"detail": "S → Nat → IO Unit",
|
||||
"data": ["«external:file:///completion4.lean»", 7, 4, 1, "cS.fn1"]}
|
||||
Resolution of pred:
|
||||
{"label": "pred",
|
||||
"kind": 5,
|
||||
"detail": "S → String → Bool",
|
||||
"data": ["«external:file:///completion4.lean»", 7, 4, 1, "cS.pred"]}
|
||||
{"textDocument": {"uri": "file:///completion4.lean"},
|
||||
"position": {"line": 11, "character": 10}}
|
||||
{"items":
|
||||
|
|
@ -24,6 +39,21 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion4.lean»", 11, 10, 1, "cS.pred"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of fn2:
|
||||
{"label": "fn2",
|
||||
"kind": 5,
|
||||
"detail": "S → Bool → IO Unit",
|
||||
"data": ["«external:file:///completion4.lean»", 11, 10, 1, "cS.fn2"]}
|
||||
Resolution of fn1:
|
||||
{"label": "fn1",
|
||||
"kind": 5,
|
||||
"detail": "S → Nat → IO Unit",
|
||||
"data": ["«external:file:///completion4.lean»", 11, 10, 1, "cS.fn1"]}
|
||||
Resolution of pred:
|
||||
{"label": "pred",
|
||||
"kind": 5,
|
||||
"detail": "S → String → Bool",
|
||||
"data": ["«external:file:///completion4.lean»", 11, 10, 1, "cS.pred"]}
|
||||
{"textDocument": {"uri": "file:///completion4.lean"},
|
||||
"position": {"line": 16, "character": 11}}
|
||||
{"items":
|
||||
|
|
@ -37,6 +67,21 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion4.lean»", 16, 11, 1, "cS.pred"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of fn2:
|
||||
{"label": "fn2",
|
||||
"kind": 5,
|
||||
"detail": "S → Bool → IO Unit",
|
||||
"data": ["«external:file:///completion4.lean»", 16, 11, 1, "cS.fn2"]}
|
||||
Resolution of fn1:
|
||||
{"label": "fn1",
|
||||
"kind": 5,
|
||||
"detail": "S → Nat → IO Unit",
|
||||
"data": ["«external:file:///completion4.lean»", 16, 11, 1, "cS.fn1"]}
|
||||
Resolution of pred:
|
||||
{"label": "pred",
|
||||
"kind": 5,
|
||||
"detail": "S → String → Bool",
|
||||
"data": ["«external:file:///completion4.lean»", 16, 11, 1, "cS.pred"]}
|
||||
{"textDocument": {"uri": "file:///completion4.lean"},
|
||||
"position": {"line": 20, "character": 21}}
|
||||
{"items":
|
||||
|
|
@ -50,3 +95,18 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion4.lean»", 20, 21, 1, "cS.pred"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of fn2:
|
||||
{"label": "fn2",
|
||||
"kind": 5,
|
||||
"detail": "S → Bool → IO Unit",
|
||||
"data": ["«external:file:///completion4.lean»", 20, 21, 1, "cS.fn2"]}
|
||||
Resolution of fn1:
|
||||
{"label": "fn1",
|
||||
"kind": 5,
|
||||
"detail": "S → Nat → IO Unit",
|
||||
"data": ["«external:file:///completion4.lean»", 20, 21, 1, "cS.fn1"]}
|
||||
Resolution of pred:
|
||||
{"label": "pred",
|
||||
"kind": 5,
|
||||
"detail": "S → String → Bool",
|
||||
"data": ["«external:file:///completion4.lean»", 20, 21, 1, "cS.pred"]}
|
||||
|
|
|
|||
|
|
@ -8,4 +8,4 @@ def f (c : C) : IO Unit :=
|
|||
where
|
||||
visit (c : C) : IO Unit :=
|
||||
let x := c.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -11,3 +11,18 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion5.lean»", 9, 15, 1, "cC.f2"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of f1:
|
||||
{"label": "f1",
|
||||
"kind": 5,
|
||||
"detail": "C → Nat",
|
||||
"data": ["«external:file:///completion5.lean»", 9, 15, 1, "cC.f1"]}
|
||||
Resolution of b1:
|
||||
{"label": "b1",
|
||||
"kind": 5,
|
||||
"detail": "C → String",
|
||||
"data": ["«external:file:///completion5.lean»", 9, 15, 1, "cC.b1"]}
|
||||
Resolution of f2:
|
||||
{"label": "f2",
|
||||
"kind": 5,
|
||||
"detail": "C → Bool",
|
||||
"data": ["«external:file:///completion5.lean»", 9, 15, 1, "cC.f2"]}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ def f (c : D) : IO Unit :=
|
|||
where
|
||||
visit (c : D) : IO Unit :=
|
||||
let x := c.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
abbrev E := D
|
||||
|
||||
|
|
@ -20,4 +20,4 @@ def E.doubleF1 (e : E) :=
|
|||
|
||||
def g (e : E) :=
|
||||
e.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -17,6 +17,31 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion6.lean»", 12, 15, 1, "cC.f2"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of f1:
|
||||
{"label": "f1",
|
||||
"kind": 5,
|
||||
"detail": "C → Nat",
|
||||
"data": ["«external:file:///completion6.lean»", 12, 15, 1, "cC.f1"]}
|
||||
Resolution of f3:
|
||||
{"label": "f3",
|
||||
"kind": 5,
|
||||
"detail": "D → Bool",
|
||||
"data": ["«external:file:///completion6.lean»", 12, 15, 1, "cD.f3"]}
|
||||
Resolution of toC:
|
||||
{"label": "toC",
|
||||
"kind": 5,
|
||||
"detail": "D → C",
|
||||
"data": ["«external:file:///completion6.lean»", 12, 15, 1, "cD.toC"]}
|
||||
Resolution of b1:
|
||||
{"label": "b1",
|
||||
"kind": 5,
|
||||
"detail": "C → String",
|
||||
"data": ["«external:file:///completion6.lean»", 12, 15, 1, "cC.b1"]}
|
||||
Resolution of f2:
|
||||
{"label": "f2",
|
||||
"kind": 5,
|
||||
"detail": "C → Bool",
|
||||
"data": ["«external:file:///completion6.lean»", 12, 15, 1, "cC.f2"]}
|
||||
{"textDocument": {"uri": "file:///completion6.lean"},
|
||||
"position": {"line": 21, "character": 4}}
|
||||
{"items":
|
||||
|
|
@ -39,3 +64,33 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completion6.lean»", 21, 4, 1, "cC.f2"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of f1:
|
||||
{"label": "f1",
|
||||
"kind": 5,
|
||||
"detail": "C → Nat",
|
||||
"data": ["«external:file:///completion6.lean»", 21, 4, 1, "cC.f1"]}
|
||||
Resolution of f3:
|
||||
{"label": "f3",
|
||||
"kind": 5,
|
||||
"detail": "D → Bool",
|
||||
"data": ["«external:file:///completion6.lean»", 21, 4, 1, "cD.f3"]}
|
||||
Resolution of toC:
|
||||
{"label": "toC",
|
||||
"kind": 5,
|
||||
"detail": "D → C",
|
||||
"data": ["«external:file:///completion6.lean»", 21, 4, 1, "cD.toC"]}
|
||||
Resolution of b1:
|
||||
{"label": "b1",
|
||||
"kind": 5,
|
||||
"detail": "C → String",
|
||||
"data": ["«external:file:///completion6.lean»", 21, 4, 1, "cC.b1"]}
|
||||
Resolution of doubleF1:
|
||||
{"label": "doubleF1",
|
||||
"kind": 3,
|
||||
"detail": "E → Nat",
|
||||
"data": ["«external:file:///completion6.lean»", 21, 4, 1, "cE.doubleF1"]}
|
||||
Resolution of f2:
|
||||
{"label": "f2",
|
||||
"kind": 5,
|
||||
"detail": "C → Bool",
|
||||
"data": ["«external:file:///completion6.lean»", 21, 4, 1, "cC.f2"]}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ structure And where
|
|||
right : Type
|
||||
|
||||
#check And
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
#check And.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@
|
|||
"kind": 22,
|
||||
"data": ["«external:file:///completion7.lean»", 6, 10, 0, "cAnd"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of And:
|
||||
{"label": "And",
|
||||
"kind": 22,
|
||||
"detail": "Type 1",
|
||||
"data": ["«external:file:///completion7.lean»", 6, 10, 0, "cAnd"]}
|
||||
{"textDocument": {"uri": "file:///completion7.lean"},
|
||||
"position": {"line": 8, "character": 11}}
|
||||
{"items":
|
||||
|
|
@ -18,3 +23,18 @@
|
|||
"kind": 4,
|
||||
"data": ["«external:file:///completion7.lean»", 8, 11, 0, "cAnd.mk"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of left:
|
||||
{"label": "left",
|
||||
"kind": 5,
|
||||
"detail": "And → Type",
|
||||
"data": ["«external:file:///completion7.lean»", 8, 11, 0, "cAnd.left"]}
|
||||
Resolution of right:
|
||||
{"label": "right",
|
||||
"kind": 5,
|
||||
"detail": "And → Type",
|
||||
"data": ["«external:file:///completion7.lean»", 8, 11, 0, "cAnd.right"]}
|
||||
Resolution of mk:
|
||||
{"label": "mk",
|
||||
"kind": 4,
|
||||
"detail": "Type → Type → And",
|
||||
"data": ["«external:file:///completion7.lean»", 8, 11, 0, "cAnd.mk"]}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
def f.gg := 0
|
||||
|
||||
#print f.g
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -5,3 +5,8 @@
|
|||
"kind": 21,
|
||||
"data": ["«external:file:///completionAtPrint.lean»", 2, 10, 0, "cf.gg"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of gg:
|
||||
{"label": "gg",
|
||||
"kind": 21,
|
||||
"detail": "Nat",
|
||||
"data": ["«external:file:///completionAtPrint.lean»", 2, 10, 0, "cf.gg"]}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ inductive Direction where
|
|||
-- It would be nice if this actually provided `up`, `right`, `down` and `left` in the future
|
||||
def foo : Direction :=
|
||||
(.)
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@ structure AVerySpecificStructureName2 where
|
|||
x : Nat
|
||||
|
||||
#check AVerySpecificStructureName
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -18,3 +18,23 @@
|
|||
0,
|
||||
"cAVerySpecificStructureName"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of AVerySpecificStructureName2:
|
||||
{"label": "AVerySpecificStructureName2",
|
||||
"kind": 22,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///completionCheck.lean»",
|
||||
6,
|
||||
33,
|
||||
0,
|
||||
"cAVerySpecificStructureName2"]}
|
||||
Resolution of AVerySpecificStructureName:
|
||||
{"label": "AVerySpecificStructureName",
|
||||
"kind": 22,
|
||||
"detail": "Type",
|
||||
"data":
|
||||
["«external:file:///completionCheck.lean»",
|
||||
6,
|
||||
33,
|
||||
0,
|
||||
"cAVerySpecificStructureName"]}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
def foo : Unit :=
|
||||
x. -- No completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
def bar : Array Nat := Id.run do
|
||||
let mut x := sorry
|
||||
let foo := x. -- No completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
sorry
|
||||
|
|
|
|||
|
|
@ -24,4 +24,4 @@ def SomeStructure.foo7 (s : SomeStructure) : Nat := s.n
|
|||
def SomeStructure.foo8 (s : SomeStructure) : Nat := s.n
|
||||
|
||||
example := SomeStructure.foo -- Completion items with a deprecation tag and a deprecation message
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -72,3 +72,112 @@
|
|||
0,
|
||||
"cSomeStructure.foo2"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of foo4:
|
||||
{"tags": [1],
|
||||
"label": "foo4",
|
||||
"kind": 3,
|
||||
"documentation":
|
||||
{"value":
|
||||
"(some (`SomeStructure.foo4` has been deprecated.))\n\nA docstring. ",
|
||||
"kind": "markdown"},
|
||||
"detail": "SomeStructure → Nat",
|
||||
"data":
|
||||
["«external:file:///completionDeprecation.lean»",
|
||||
25,
|
||||
28,
|
||||
0,
|
||||
"cSomeStructure.foo4"]}
|
||||
Resolution of foo8:
|
||||
{"tags": [1],
|
||||
"label": "foo8",
|
||||
"kind": 3,
|
||||
"documentation":
|
||||
{"value":
|
||||
"(some (`SomeStructure.foo8` has been deprecated; please use `SomeStructure.foo1` instead.))\n\nA docstring. ",
|
||||
"kind": "markdown"},
|
||||
"detail": "SomeStructure → Nat",
|
||||
"data":
|
||||
["«external:file:///completionDeprecation.lean»",
|
||||
25,
|
||||
28,
|
||||
0,
|
||||
"cSomeStructure.foo8"]}
|
||||
Resolution of foo5:
|
||||
{"tags": [1],
|
||||
"label": "foo5",
|
||||
"kind": 3,
|
||||
"documentation":
|
||||
{"value":
|
||||
"`SomeStructure.foo5` has been deprecated, use `SomeStructure.foo1` instead.",
|
||||
"kind": "markdown"},
|
||||
"detail": "SomeStructure → Nat",
|
||||
"data":
|
||||
["«external:file:///completionDeprecation.lean»",
|
||||
25,
|
||||
28,
|
||||
0,
|
||||
"cSomeStructure.foo5"]}
|
||||
Resolution of foo7:
|
||||
{"tags": [1],
|
||||
"label": "foo7",
|
||||
"kind": 3,
|
||||
"documentation":
|
||||
{"value":
|
||||
"`SomeStructure.foo7` has been deprecated; please use `SomeStructure.foo1` instead.",
|
||||
"kind": "markdown"},
|
||||
"detail": "SomeStructure → Nat",
|
||||
"data":
|
||||
["«external:file:///completionDeprecation.lean»",
|
||||
25,
|
||||
28,
|
||||
0,
|
||||
"cSomeStructure.foo7"]}
|
||||
Resolution of foo1:
|
||||
{"label": "foo1",
|
||||
"kind": 3,
|
||||
"detail": "SomeStructure → Nat",
|
||||
"data":
|
||||
["«external:file:///completionDeprecation.lean»",
|
||||
25,
|
||||
28,
|
||||
0,
|
||||
"cSomeStructure.foo1"]}
|
||||
Resolution of foo6:
|
||||
{"tags": [1],
|
||||
"label": "foo6",
|
||||
"kind": 3,
|
||||
"documentation":
|
||||
{"value":
|
||||
"(some (`SomeStructure.foo6` has been deprecated, use `SomeStructure.foo1` instead.))\n\nA docstring. ",
|
||||
"kind": "markdown"},
|
||||
"detail": "SomeStructure → Nat",
|
||||
"data":
|
||||
["«external:file:///completionDeprecation.lean»",
|
||||
25,
|
||||
28,
|
||||
0,
|
||||
"cSomeStructure.foo6"]}
|
||||
Resolution of foo3:
|
||||
{"tags": [1],
|
||||
"label": "foo3",
|
||||
"kind": 3,
|
||||
"documentation":
|
||||
{"value": "`SomeStructure.foo3` has been deprecated.", "kind": "markdown"},
|
||||
"detail": "SomeStructure → Nat",
|
||||
"data":
|
||||
["«external:file:///completionDeprecation.lean»",
|
||||
25,
|
||||
28,
|
||||
0,
|
||||
"cSomeStructure.foo3"]}
|
||||
Resolution of foo2:
|
||||
{"label": "foo2",
|
||||
"kind": 3,
|
||||
"documentation": {"value": "A docstring. ", "kind": "markdown"},
|
||||
"detail": "SomeStructure → Nat",
|
||||
"data":
|
||||
["«external:file:///completionDeprecation.lean»",
|
||||
25,
|
||||
28,
|
||||
0,
|
||||
"cSomeStructure.foo2"]}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ deriving Repr
|
|||
def angle (d: Direction) :=
|
||||
match d with
|
||||
| Direction. => 90
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
| Direction.right => 0
|
||||
| Direction.down => 270
|
||||
| Direction.left => 180
|
||||
|
|
@ -27,5 +27,5 @@ example : p ∨ (q ∧ r) → CustomAnd (p ∨ q) (p ∨ r) := by
|
|||
intro h
|
||||
cases h with
|
||||
| inl hp => apply CustomAnd. (Or.intro_left q hp) (Or.intro_left r hp)
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
| inr hqr => apply CustomAnd.mk (Or.intro_right p hqr.left) (Or.intro_right p hqr.right)
|
||||
|
|
|
|||
|
|
@ -38,6 +38,40 @@
|
|||
0,
|
||||
"cDirection.right"]}],
|
||||
"isIncomplete": true}
|
||||
Resolution of up:
|
||||
{"label": "up",
|
||||
"kind": 4,
|
||||
"detail": "Direction",
|
||||
"data":
|
||||
["«external:file:///completionFallback.lean»", 14, 14, 0, "cDirection.up"]}
|
||||
Resolution of noConfusionType:
|
||||
{"label": "noConfusionType",
|
||||
"kind": 3,
|
||||
"detail": "Sort v✝ → Direction → Direction → Sort v✝",
|
||||
"data":
|
||||
["«external:file:///completionFallback.lean»",
|
||||
14,
|
||||
14,
|
||||
0,
|
||||
"cDirection.noConfusionType"]}
|
||||
Resolution of left:
|
||||
{"label": "left",
|
||||
"kind": 4,
|
||||
"detail": "Direction",
|
||||
"data":
|
||||
["«external:file:///completionFallback.lean»", 14, 14, 0, "cDirection.left"]}
|
||||
Resolution of down:
|
||||
{"label": "down",
|
||||
"kind": 4,
|
||||
"detail": "Direction",
|
||||
"data":
|
||||
["«external:file:///completionFallback.lean»", 14, 14, 0, "cDirection.down"]}
|
||||
Resolution of right:
|
||||
{"label": "right",
|
||||
"kind": 4,
|
||||
"detail": "Direction",
|
||||
"data":
|
||||
["«external:file:///completionFallback.lean»", 14, 14, 0, "cDirection.right"]}
|
||||
{"textDocument": {"uri": "file:///completionFallback.lean"},
|
||||
"position": {"line": 28, "character": 30}}
|
||||
{"items":
|
||||
|
|
@ -54,3 +88,21 @@
|
|||
"data":
|
||||
["«external:file:///completionFallback.lean»", 28, 30, 0, "cCustomAnd.hb"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of mk:
|
||||
{"label": "mk",
|
||||
"kind": 4,
|
||||
"detail": "a → b → CustomAnd a b",
|
||||
"data":
|
||||
["«external:file:///completionFallback.lean»", 28, 30, 0, "cCustomAnd.mk"]}
|
||||
Resolution of ha:
|
||||
{"label": "ha",
|
||||
"kind": 23,
|
||||
"detail": "CustomAnd a b → a",
|
||||
"data":
|
||||
["«external:file:///completionFallback.lean»", 28, 30, 0, "cCustomAnd.ha"]}
|
||||
Resolution of hb:
|
||||
{"label": "hb",
|
||||
"kind": 23,
|
||||
"detail": "CustomAnd a b → b",
|
||||
"data":
|
||||
["«external:file:///completionFallback.lean»", 28, 30, 0, "cCustomAnd.hb"]}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@ structure Foo where
|
|||
x : Nat
|
||||
|
||||
def foo : Foo := .
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -10,3 +10,9 @@
|
|||
0,
|
||||
"cFoo.mk"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of mk:
|
||||
{"label": "mk",
|
||||
"kind": 4,
|
||||
"detail": "Nat → Foo",
|
||||
"data":
|
||||
["«external:file:///completionFromExpectedType.lean»", 3, 18, 0, "cFoo.mk"]}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ structure C where
|
|||
b1 : String
|
||||
|
||||
#check fun c : C => s!"testing {c. "
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -11,3 +11,18 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completionIStr.lean»", 5, 34, 1, "cC.f2"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of f1:
|
||||
{"label": "f1",
|
||||
"kind": 5,
|
||||
"detail": "C → Nat",
|
||||
"data": ["«external:file:///completionIStr.lean»", 5, 34, 1, "cC.f1"]}
|
||||
Resolution of b1:
|
||||
{"label": "b1",
|
||||
"kind": 5,
|
||||
"detail": "C → String",
|
||||
"data": ["«external:file:///completionIStr.lean»", 5, 34, 1, "cC.b1"]}
|
||||
Resolution of f2:
|
||||
{"label": "f2",
|
||||
"kind": 5,
|
||||
"detail": "C → Bool",
|
||||
"data": ["«external:file:///completionIStr.lean»", 5, 34, 1, "cC.f2"]}
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ open A B1
|
|||
|
||||
namespace A
|
||||
def c2 : Nat := verySpecificDefinitionNameOfCompletionOpenNamespaces
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -10,3 +10,13 @@
|
|||
0,
|
||||
"cA.B1.verySpecificDefinitionNameOfCompletionOpenNamespaces"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of verySpecificDefinitionNameOfCompletionOpenNamespaces:
|
||||
{"label": "verySpecificDefinitionNameOfCompletionOpenNamespaces",
|
||||
"kind": 21,
|
||||
"detail": "Nat",
|
||||
"data":
|
||||
["«external:file:///completionOpenNamespaces.lean»",
|
||||
4,
|
||||
68,
|
||||
0,
|
||||
"cA.B1.verySpecificDefinitionNameOfCompletionOpenNamespaces"]}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
|
||||
set_option format
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
set_option format.in
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
set_option trace.pp.ana
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
set_option trace.pp.analyze
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
set_option format true
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
set_option format.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
#check false -- curiously completion with a trailing dot worked even before special casing if triggered on the last token
|
||||
|
|
|
|||
|
|
@ -89,6 +89,86 @@
|
|||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of format.unicode:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}},
|
||||
"newText": "format.unicode",
|
||||
"insert":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}}},
|
||||
"label": "format.unicode",
|
||||
"kind": 10,
|
||||
"detail": "(true), unicode characters",
|
||||
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]}
|
||||
Resolution of format.width:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}},
|
||||
"newText": "format.width",
|
||||
"insert":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}}},
|
||||
"label": "format.width",
|
||||
"kind": 10,
|
||||
"detail": "(120), indentation",
|
||||
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]}
|
||||
Resolution of format.inputWidth:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}},
|
||||
"newText": "format.inputWidth",
|
||||
"insert":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}}},
|
||||
"label": "format.inputWidth",
|
||||
"kind": 10,
|
||||
"detail": "(100), ideal input width",
|
||||
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]}
|
||||
Resolution of trace.PrettyPrinter.format.input:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}},
|
||||
"newText": "trace.PrettyPrinter.format.input",
|
||||
"insert":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}}},
|
||||
"label": "trace.PrettyPrinter.format.input",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]}
|
||||
Resolution of trace.PrettyPrinter.format:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}},
|
||||
"newText": "trace.PrettyPrinter.format",
|
||||
"insert":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}}},
|
||||
"label": "trace.PrettyPrinter.format",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]}
|
||||
Resolution of format.indent:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}},
|
||||
"newText": "format.indent",
|
||||
"insert":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}}},
|
||||
"label": "format.indent",
|
||||
"kind": 10,
|
||||
"detail": "(2), indentation",
|
||||
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]}
|
||||
Resolution of trace.PrettyPrinter.format.backtrack:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}},
|
||||
"newText": "trace.PrettyPrinter.format.backtrack",
|
||||
"insert":
|
||||
{"start": {"line": 1, "character": 11}, "end": {"line": 1, "character": 17}}},
|
||||
"label": "trace.PrettyPrinter.format.backtrack",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 1, 17, 0]}
|
||||
{"textDocument": {"uri": "file:///completionOption.lean"},
|
||||
"position": {"line": 4, "character": 20}}
|
||||
{"items":
|
||||
|
|
@ -130,6 +210,40 @@
|
|||
"detail": "(2), indentation",
|
||||
"data": ["«external:file:///completionOption.lean»", 4, 20, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of format.inputWidth:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 4, "character": 11}, "end": {"line": 4, "character": 20}},
|
||||
"newText": "format.inputWidth",
|
||||
"insert":
|
||||
{"start": {"line": 4, "character": 11}, "end": {"line": 4, "character": 20}}},
|
||||
"label": "format.inputWidth",
|
||||
"kind": 10,
|
||||
"detail": "(100), ideal input width",
|
||||
"data": ["«external:file:///completionOption.lean»", 4, 20, 0]}
|
||||
Resolution of trace.PrettyPrinter.format.input:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 4, "character": 11}, "end": {"line": 4, "character": 20}},
|
||||
"newText": "trace.PrettyPrinter.format.input",
|
||||
"insert":
|
||||
{"start": {"line": 4, "character": 11}, "end": {"line": 4, "character": 20}}},
|
||||
"label": "trace.PrettyPrinter.format.input",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 4, 20, 0]}
|
||||
Resolution of format.indent:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 4, "character": 11}, "end": {"line": 4, "character": 20}},
|
||||
"newText": "format.indent",
|
||||
"insert":
|
||||
{"start": {"line": 4, "character": 11}, "end": {"line": 4, "character": 20}}},
|
||||
"label": "format.indent",
|
||||
"kind": 10,
|
||||
"detail": "(2), indentation",
|
||||
"data": ["«external:file:///completionOption.lean»", 4, 20, 0]}
|
||||
{"textDocument": {"uri": "file:///completionOption.lean"},
|
||||
"position": {"line": 7, "character": 23}}
|
||||
{"items":
|
||||
|
|
@ -199,6 +313,66 @@
|
|||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 7, 23, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of trace.Compiler.specialize.candidate:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 7, "character": 11}, "end": {"line": 7, "character": 23}},
|
||||
"newText": "trace.Compiler.specialize.candidate",
|
||||
"insert":
|
||||
{"start": {"line": 7, "character": 11}, "end": {"line": 7, "character": 23}}},
|
||||
"label": "trace.Compiler.specialize.candidate",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 7, 23, 0]}
|
||||
Resolution of trace.pp.analyze.error:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 7, "character": 11}, "end": {"line": 7, "character": 23}},
|
||||
"newText": "trace.pp.analyze.error",
|
||||
"insert":
|
||||
{"start": {"line": 7, "character": 11}, "end": {"line": 7, "character": 23}}},
|
||||
"label": "trace.pp.analyze.error",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 7, 23, 0]}
|
||||
Resolution of trace.pp.analyze:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 7, "character": 11}, "end": {"line": 7, "character": 23}},
|
||||
"newText": "trace.pp.analyze",
|
||||
"insert":
|
||||
{"start": {"line": 7, "character": 11}, "end": {"line": 7, "character": 23}}},
|
||||
"label": "trace.pp.analyze",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 7, 23, 0]}
|
||||
Resolution of trace.pp.analyze.tryUnify:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 7, "character": 11}, "end": {"line": 7, "character": 23}},
|
||||
"newText": "trace.pp.analyze.tryUnify",
|
||||
"insert":
|
||||
{"start": {"line": 7, "character": 11}, "end": {"line": 7, "character": 23}}},
|
||||
"label": "trace.pp.analyze.tryUnify",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 7, 23, 0]}
|
||||
Resolution of trace.pp.analyze.annotate:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 7, "character": 11}, "end": {"line": 7, "character": 23}},
|
||||
"newText": "trace.pp.analyze.annotate",
|
||||
"insert":
|
||||
{"start": {"line": 7, "character": 11}, "end": {"line": 7, "character": 23}}},
|
||||
"label": "trace.pp.analyze.annotate",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 7, 23, 0]}
|
||||
{"textDocument": {"uri": "file:///completionOption.lean"},
|
||||
"position": {"line": 10, "character": 27}}
|
||||
{"items":
|
||||
|
|
@ -255,6 +429,62 @@
|
|||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 10, 27, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of trace.pp.analyze.error:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 10, "character": 11},
|
||||
"end": {"line": 10, "character": 27}},
|
||||
"newText": "trace.pp.analyze.error",
|
||||
"insert":
|
||||
{"start": {"line": 10, "character": 11},
|
||||
"end": {"line": 10, "character": 27}}},
|
||||
"label": "trace.pp.analyze.error",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 10, 27, 0]}
|
||||
Resolution of trace.pp.analyze:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 10, "character": 11},
|
||||
"end": {"line": 10, "character": 27}},
|
||||
"newText": "trace.pp.analyze",
|
||||
"insert":
|
||||
{"start": {"line": 10, "character": 11},
|
||||
"end": {"line": 10, "character": 27}}},
|
||||
"label": "trace.pp.analyze",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 10, 27, 0]}
|
||||
Resolution of trace.pp.analyze.tryUnify:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 10, "character": 11},
|
||||
"end": {"line": 10, "character": 27}},
|
||||
"newText": "trace.pp.analyze.tryUnify",
|
||||
"insert":
|
||||
{"start": {"line": 10, "character": 11},
|
||||
"end": {"line": 10, "character": 27}}},
|
||||
"label": "trace.pp.analyze.tryUnify",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 10, 27, 0]}
|
||||
Resolution of trace.pp.analyze.annotate:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 10, "character": 11},
|
||||
"end": {"line": 10, "character": 27}},
|
||||
"newText": "trace.pp.analyze.annotate",
|
||||
"insert":
|
||||
{"start": {"line": 10, "character": 11},
|
||||
"end": {"line": 10, "character": 27}}},
|
||||
"label": "trace.pp.analyze.annotate",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 10, 27, 0]}
|
||||
{"textDocument": {"uri": "file:///completionOption.lean"},
|
||||
"position": {"line": 13, "character": 17}}
|
||||
{"items":
|
||||
|
|
@ -346,6 +576,100 @@
|
|||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of format.unicode:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}},
|
||||
"newText": "format.unicode",
|
||||
"insert":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}}},
|
||||
"label": "format.unicode",
|
||||
"kind": 10,
|
||||
"detail": "(true), unicode characters",
|
||||
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]}
|
||||
Resolution of format.width:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}},
|
||||
"newText": "format.width",
|
||||
"insert":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}}},
|
||||
"label": "format.width",
|
||||
"kind": 10,
|
||||
"detail": "(120), indentation",
|
||||
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]}
|
||||
Resolution of format.inputWidth:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}},
|
||||
"newText": "format.inputWidth",
|
||||
"insert":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}}},
|
||||
"label": "format.inputWidth",
|
||||
"kind": 10,
|
||||
"detail": "(100), ideal input width",
|
||||
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]}
|
||||
Resolution of trace.PrettyPrinter.format.input:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}},
|
||||
"newText": "trace.PrettyPrinter.format.input",
|
||||
"insert":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}}},
|
||||
"label": "trace.PrettyPrinter.format.input",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]}
|
||||
Resolution of trace.PrettyPrinter.format:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}},
|
||||
"newText": "trace.PrettyPrinter.format",
|
||||
"insert":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}}},
|
||||
"label": "trace.PrettyPrinter.format",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]}
|
||||
Resolution of format.indent:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}},
|
||||
"newText": "format.indent",
|
||||
"insert":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}}},
|
||||
"label": "format.indent",
|
||||
"kind": 10,
|
||||
"detail": "(2), indentation",
|
||||
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]}
|
||||
Resolution of trace.PrettyPrinter.format.backtrack:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}},
|
||||
"newText": "trace.PrettyPrinter.format.backtrack",
|
||||
"insert":
|
||||
{"start": {"line": 13, "character": 11},
|
||||
"end": {"line": 13, "character": 17}}},
|
||||
"label": "trace.PrettyPrinter.format.backtrack",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 13, 17, 0]}
|
||||
{"textDocument": {"uri": "file:///completionOption.lean"},
|
||||
"position": {"line": 16, "character": 18}}
|
||||
{"items":
|
||||
|
|
@ -424,3 +748,83 @@
|
|||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 16, 18, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of format.unicode:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 16, "character": 11},
|
||||
"end": {"line": 16, "character": 18}},
|
||||
"newText": "format.unicode",
|
||||
"insert":
|
||||
{"start": {"line": 16, "character": 11},
|
||||
"end": {"line": 16, "character": 18}}},
|
||||
"label": "format.unicode",
|
||||
"kind": 10,
|
||||
"detail": "(true), unicode characters",
|
||||
"data": ["«external:file:///completionOption.lean»", 16, 18, 0]}
|
||||
Resolution of format.width:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 16, "character": 11},
|
||||
"end": {"line": 16, "character": 18}},
|
||||
"newText": "format.width",
|
||||
"insert":
|
||||
{"start": {"line": 16, "character": 11},
|
||||
"end": {"line": 16, "character": 18}}},
|
||||
"label": "format.width",
|
||||
"kind": 10,
|
||||
"detail": "(120), indentation",
|
||||
"data": ["«external:file:///completionOption.lean»", 16, 18, 0]}
|
||||
Resolution of format.inputWidth:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 16, "character": 11},
|
||||
"end": {"line": 16, "character": 18}},
|
||||
"newText": "format.inputWidth",
|
||||
"insert":
|
||||
{"start": {"line": 16, "character": 11},
|
||||
"end": {"line": 16, "character": 18}}},
|
||||
"label": "format.inputWidth",
|
||||
"kind": 10,
|
||||
"detail": "(100), ideal input width",
|
||||
"data": ["«external:file:///completionOption.lean»", 16, 18, 0]}
|
||||
Resolution of trace.PrettyPrinter.format.input:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 16, "character": 11},
|
||||
"end": {"line": 16, "character": 18}},
|
||||
"newText": "trace.PrettyPrinter.format.input",
|
||||
"insert":
|
||||
{"start": {"line": 16, "character": 11},
|
||||
"end": {"line": 16, "character": 18}}},
|
||||
"label": "trace.PrettyPrinter.format.input",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 16, 18, 0]}
|
||||
Resolution of format.indent:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 16, "character": 11},
|
||||
"end": {"line": 16, "character": 18}},
|
||||
"newText": "format.indent",
|
||||
"insert":
|
||||
{"start": {"line": 16, "character": 11},
|
||||
"end": {"line": 16, "character": 18}}},
|
||||
"label": "format.indent",
|
||||
"kind": 10,
|
||||
"detail": "(2), indentation",
|
||||
"data": ["«external:file:///completionOption.lean»", 16, 18, 0]}
|
||||
Resolution of trace.PrettyPrinter.format.backtrack:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 16, "character": 11},
|
||||
"end": {"line": 16, "character": 18}},
|
||||
"newText": "trace.PrettyPrinter.format.backtrack",
|
||||
"insert":
|
||||
{"start": {"line": 16, "character": 11},
|
||||
"end": {"line": 16, "character": 18}}},
|
||||
"label": "trace.PrettyPrinter.format.backtrack",
|
||||
"kind": 10,
|
||||
"detail":
|
||||
"(false), enable/disable tracing for the given module and submodules",
|
||||
"data": ["«external:file:///completionOption.lean»", 16, 18, 0]}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
def veryLongDefinitionNameVeryLongDefinitionName := 1
|
||||
def test (veryLongDefinitionName : Nat) := veryLongDefinitionName
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -14,3 +14,19 @@
|
|||
0,
|
||||
"cveryLongDefinitionNameVeryLongDefinitionName"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of veryLongDefinitionName:
|
||||
{"label": "veryLongDefinitionName",
|
||||
"kind": 6,
|
||||
"detail": "Nat",
|
||||
"data":
|
||||
["«external:file:///completionPrefixIssue.lean»", 1, 64, 0, "f_uniq.35"]}
|
||||
Resolution of veryLongDefinitionNameVeryLongDefinitionName:
|
||||
{"label": "veryLongDefinitionNameVeryLongDefinitionName",
|
||||
"kind": 21,
|
||||
"detail": "Nat",
|
||||
"data":
|
||||
["«external:file:///completionPrefixIssue.lean»",
|
||||
1,
|
||||
64,
|
||||
0,
|
||||
"cveryLongDefinitionNameVeryLongDefinitionName"]}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@ private structure Foo where
|
|||
x : Nat
|
||||
|
||||
def foobar (f : Foo) := f.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -10,3 +10,13 @@
|
|||
1,
|
||||
"c_private.«external:file:///completionPrivateTypes.lean».0.Foo.x"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of x:
|
||||
{"label": "x",
|
||||
"kind": 5,
|
||||
"detail": "Foo → Nat",
|
||||
"data":
|
||||
["«external:file:///completionPrivateTypes.lean»",
|
||||
3,
|
||||
26,
|
||||
1,
|
||||
"c_private.«external:file:///completionPrivateTypes.lean».0.Foo.x"]}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
private def longAndHopefullyUniqueBlaBlaBoo := 2
|
||||
|
||||
#check longAndHopefullyUniqueBlaB
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
namespace Foo
|
||||
|
||||
private def longAndHopefullyUniqueBooBoo := 3
|
||||
|
||||
#check longAndHopefullyUniqueBooB
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
end Foo
|
||||
|
||||
|
|
@ -20,8 +20,8 @@ private def S.getInc (s : S) : Nat :=
|
|||
|
||||
def tst1 (s : S) : Nat :=
|
||||
s.g
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
def tst2 (s : S) : Nat :=
|
||||
s.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -10,6 +10,16 @@
|
|||
0,
|
||||
"c_private.«external:file:///completionPrv.lean».0.longAndHopefullyUniqueBlaBlaBoo"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of longAndHopefullyUniqueBlaBlaBoo:
|
||||
{"label": "longAndHopefullyUniqueBlaBlaBoo",
|
||||
"kind": 21,
|
||||
"detail": "Nat",
|
||||
"data":
|
||||
["«external:file:///completionPrv.lean»",
|
||||
2,
|
||||
33,
|
||||
0,
|
||||
"c_private.«external:file:///completionPrv.lean».0.longAndHopefullyUniqueBlaBlaBoo"]}
|
||||
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
||||
"position": {"line": 9, "character": 33}}
|
||||
{"items":
|
||||
|
|
@ -22,6 +32,16 @@
|
|||
0,
|
||||
"c_private.«external:file:///completionPrv.lean».0.Foo.longAndHopefullyUniqueBooBoo"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of longAndHopefullyUniqueBooBoo:
|
||||
{"label": "longAndHopefullyUniqueBooBoo",
|
||||
"kind": 21,
|
||||
"detail": "Nat",
|
||||
"data":
|
||||
["«external:file:///completionPrv.lean»",
|
||||
9,
|
||||
33,
|
||||
0,
|
||||
"c_private.«external:file:///completionPrv.lean».0.Foo.longAndHopefullyUniqueBooBoo"]}
|
||||
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
||||
"position": {"line": 21, "character": 5}}
|
||||
{"items":
|
||||
|
|
@ -37,6 +57,21 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completionPrv.lean»", 21, 5, 1, "cS.field1"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of getInc:
|
||||
{"label": "getInc",
|
||||
"kind": 3,
|
||||
"detail": "S → Nat",
|
||||
"data":
|
||||
["«external:file:///completionPrv.lean»",
|
||||
21,
|
||||
5,
|
||||
1,
|
||||
"c_private.«external:file:///completionPrv.lean».0.S.getInc"]}
|
||||
Resolution of field1:
|
||||
{"label": "field1",
|
||||
"kind": 5,
|
||||
"detail": "S → Nat",
|
||||
"data": ["«external:file:///completionPrv.lean»", 21, 5, 1, "cS.field1"]}
|
||||
{"textDocument": {"uri": "file:///completionPrv.lean"},
|
||||
"position": {"line": 25, "character": 4}}
|
||||
{"items":
|
||||
|
|
@ -52,3 +87,18 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///completionPrv.lean»", 25, 4, 1, "cS.field1"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of getInc:
|
||||
{"label": "getInc",
|
||||
"kind": 3,
|
||||
"detail": "S → Nat",
|
||||
"data":
|
||||
["«external:file:///completionPrv.lean»",
|
||||
25,
|
||||
4,
|
||||
1,
|
||||
"c_private.«external:file:///completionPrv.lean».0.S.getInc"]}
|
||||
Resolution of field1:
|
||||
{"label": "field1",
|
||||
"kind": 5,
|
||||
"detail": "S → Nat",
|
||||
"data": ["«external:file:///completionPrv.lean»", 25, 4, 1, "cS.field1"]}
|
||||
|
|
|
|||
|
|
@ -9,90 +9,90 @@ structure S extends S' where
|
|||
barfoo : Nat
|
||||
|
||||
example : S where -- No completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : S where -- All field completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : S where
|
||||
-- All field completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : S where
|
||||
f -- All field completions matching `f` expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : S where
|
||||
foo -- All field completions matching `foo` expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : S where
|
||||
foo := -- No completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : S where
|
||||
foo :=
|
||||
-- No completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : S where
|
||||
foo := 1
|
||||
-- All field completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : S where
|
||||
foo := 1; -- All field completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : S := { } -- All field completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : S := {
|
||||
-- All field completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
}
|
||||
|
||||
example : S := {
|
||||
f -- All field completions matching `f` expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
}
|
||||
|
||||
example : S := {
|
||||
foo -- All field completions matching `foo` expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
}
|
||||
|
||||
example : S := {
|
||||
foo :=
|
||||
-- No completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
}
|
||||
|
||||
example : S := {
|
||||
foo := 1
|
||||
-- All field completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
}
|
||||
|
||||
example : S :=
|
||||
{ foo := 1
|
||||
} -- All field completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
|
||||
example : S := { foo := 1, } -- All field completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example (s : S) : S := { s with } -- All field completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example (s : S) : S := { s with : S } -- All field completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example (s : S) : S := { s with f } -- All field completions matching `f` expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
def aLongUniqueIdentifier := 0
|
||||
|
||||
example : Std.HashSet Nat := { aLongUniqueIdentifier } -- Identifier completion matching `aLongUniqueIdentifier`
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -18,6 +18,26 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 10, 17, 0]}],
|
||||
"isIncomplete": true}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 10, 17, 0]}
|
||||
Resolution of bar:
|
||||
{"label": "bar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 10, 17, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 10, 17, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 10, 17, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 13, "character": 18}}
|
||||
{"items":
|
||||
|
|
@ -38,6 +58,26 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 13, 18, 0]}],
|
||||
"isIncomplete": true}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 13, 18, 0]}
|
||||
Resolution of bar:
|
||||
{"label": "bar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 13, 18, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 13, 18, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 13, 18, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 17, "character": 2}}
|
||||
{"items":
|
||||
|
|
@ -58,6 +98,26 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 17, 2, 0]}],
|
||||
"isIncomplete": true}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 17, 2, 0]}
|
||||
Resolution of bar:
|
||||
{"label": "bar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 17, 2, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 17, 2, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 17, 2, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 21, "character": 3}}
|
||||
{"items":
|
||||
|
|
@ -74,6 +134,21 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 21, 3, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 21, 3, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 21, 3, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 21, 3, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 25, "character": 5}}
|
||||
{"items":
|
||||
|
|
@ -90,6 +165,21 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 25, 5, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 25, 5, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 25, 5, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 25, 5, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 29, "character": 9}}
|
||||
{"items": [], "isIncomplete": true}
|
||||
|
|
@ -116,6 +206,26 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 39, 2, 0]}],
|
||||
"isIncomplete": true}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 39, 2, 0]}
|
||||
Resolution of bar:
|
||||
{"label": "bar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 39, 2, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 39, 2, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 39, 2, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 43, "character": 12}}
|
||||
{"items":
|
||||
|
|
@ -136,6 +246,26 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 43, 12, 0]}],
|
||||
"isIncomplete": true}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 43, 12, 0]}
|
||||
Resolution of bar:
|
||||
{"label": "bar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 43, 12, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 43, 12, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 43, 12, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 46, "character": 17}}
|
||||
{"items":
|
||||
|
|
@ -156,6 +286,26 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 46, 17, 0]}],
|
||||
"isIncomplete": true}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 46, 17, 0]}
|
||||
Resolution of bar:
|
||||
{"label": "bar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 46, 17, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 46, 17, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 46, 17, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 50, "character": 2}}
|
||||
{"items":
|
||||
|
|
@ -176,6 +326,26 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 50, 2, 0]}],
|
||||
"isIncomplete": true}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 50, 2, 0]}
|
||||
Resolution of bar:
|
||||
{"label": "bar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 50, 2, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 50, 2, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 50, 2, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 55, "character": 3}}
|
||||
{"items":
|
||||
|
|
@ -192,6 +362,21 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 55, 3, 1]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 55, 3, 1]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 55, 3, 1]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 55, 3, 1]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 60, "character": 5}}
|
||||
{"items":
|
||||
|
|
@ -208,6 +393,21 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 60, 5, 1]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 60, 5, 1]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 60, 5, 1]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 60, 5, 1]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 66, "character": 4}}
|
||||
{"items": [], "isIncomplete": true}
|
||||
|
|
@ -231,6 +431,26 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 72, 2, 0]}],
|
||||
"isIncomplete": true}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 72, 2, 0]}
|
||||
Resolution of bar:
|
||||
{"label": "bar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 72, 2, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 72, 2, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 72, 2, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 78, "character": 4}}
|
||||
{"items":
|
||||
|
|
@ -251,6 +471,26 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 78, 4, 0]}],
|
||||
"isIncomplete": true}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 78, 4, 0]}
|
||||
Resolution of bar:
|
||||
{"label": "bar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 78, 4, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 78, 4, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 78, 4, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 82, "character": 27}}
|
||||
{"items":
|
||||
|
|
@ -271,6 +511,26 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 82, 27, 0]}],
|
||||
"isIncomplete": true}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 82, 27, 0]}
|
||||
Resolution of bar:
|
||||
{"label": "bar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 82, 27, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 82, 27, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 82, 27, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 85, "character": 32}}
|
||||
{"items":
|
||||
|
|
@ -291,6 +551,26 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 85, 32, 0]}],
|
||||
"isIncomplete": true}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 85, 32, 0]}
|
||||
Resolution of bar:
|
||||
{"label": "bar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 85, 32, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 85, 32, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 85, 32, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 88, "character": 32}}
|
||||
{"items":
|
||||
|
|
@ -311,6 +591,26 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 88, 32, 0]}],
|
||||
"isIncomplete": true}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 88, 32, 0]}
|
||||
Resolution of bar:
|
||||
{"label": "bar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 88, 32, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 88, 32, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 88, 32, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 91, "character": 33}}
|
||||
{"items":
|
||||
|
|
@ -327,6 +627,21 @@
|
|||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 91, 33, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 91, 33, 0]}
|
||||
Resolution of foobar:
|
||||
{"label": "foobar",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 91, 33, 0]}
|
||||
Resolution of barfoo:
|
||||
{"label": "barfoo",
|
||||
"kind": 5,
|
||||
"detail": "field",
|
||||
"data": ["«external:file:///completionStructureInstance.lean»", 91, 33, 0]}
|
||||
{"textDocument": {"uri": "file:///completionStructureInstance.lean"},
|
||||
"position": {"line": 96, "character": 52}}
|
||||
{"items":
|
||||
|
|
@ -339,3 +654,13 @@
|
|||
0,
|
||||
"caLongUniqueIdentifier"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of aLongUniqueIdentifier:
|
||||
{"label": "aLongUniqueIdentifier",
|
||||
"kind": 21,
|
||||
"detail": "Nat",
|
||||
"data":
|
||||
["«external:file:///completionStructureInstance.lean»",
|
||||
96,
|
||||
52,
|
||||
0,
|
||||
"caLongUniqueIdentifier"]}
|
||||
|
|
|
|||
|
|
@ -19,102 +19,102 @@ syntax (name := skip) "skip" : tactic
|
|||
syntax (name := exact) "exact " term : tactic
|
||||
|
||||
example : True := by -- No completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by -- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by ski -- Tactic completions matching `ski` expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by skip -- No completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by skip; -- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by skip; -- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by
|
||||
skip
|
||||
skip; -- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by
|
||||
-- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by
|
||||
skip
|
||||
-- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by
|
||||
-- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
skip
|
||||
|
||||
example : True := by
|
||||
exact by
|
||||
-- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by
|
||||
exact by
|
||||
-- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by
|
||||
exact by
|
||||
skip
|
||||
-- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by
|
||||
exact by
|
||||
skip
|
||||
-- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by
|
||||
exact
|
||||
-- No completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by
|
||||
exact
|
||||
-- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True :=
|
||||
let foo := by
|
||||
-- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True :=
|
||||
let foo := by
|
||||
-- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True :=
|
||||
let foo := by
|
||||
skip
|
||||
-- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True :=
|
||||
let foo := by
|
||||
skip
|
||||
-- No completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : True := by {
|
||||
-- All tactic completions expected
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
}
|
||||
|
||||
example : True := by
|
||||
{ skip -- All tactic completions expected
|
||||
}
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
25
tests/lean/interactive/documentSymbols.lean
Normal file
25
tests/lean/interactive/documentSymbols.lean
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
def a := 1
|
||||
|
||||
namespace Foo
|
||||
|
||||
def b := 2
|
||||
|
||||
section Foobar
|
||||
|
||||
def c := 3
|
||||
|
||||
end Foobar
|
||||
|
||||
def d := 4
|
||||
|
||||
end Foo
|
||||
|
||||
def e := 5
|
||||
|
||||
namespace Bar
|
||||
|
||||
def f := 6
|
||||
theorem g : True := True.intro
|
||||
instance : Coe Nat Nat := sorry
|
||||
|
||||
--^ textDocument/documentSymbol
|
||||
83
tests/lean/interactive/documentSymbols.lean.expected.out
Normal file
83
tests/lean/interactive/documentSymbols.lean.expected.out
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
{"textDocument": {"uri": "file:///documentSymbols.lean"},
|
||||
"position": {"line": 23, "character": 2}}
|
||||
[{"selectionRange":
|
||||
{"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 5}},
|
||||
"range":
|
||||
{"start": {"line": 0, "character": 0}, "end": {"line": 0, "character": 10}},
|
||||
"name": "a",
|
||||
"kind": 6},
|
||||
{"selectionRange":
|
||||
{"start": {"line": 2, "character": 10}, "end": {"line": 2, "character": 13}},
|
||||
"range":
|
||||
{"start": {"line": 2, "character": 0}, "end": {"line": 14, "character": 7}},
|
||||
"name": "Foo",
|
||||
"kind": 3,
|
||||
"children":
|
||||
[{"selectionRange":
|
||||
{"start": {"line": 4, "character": 4}, "end": {"line": 4, "character": 5}},
|
||||
"range":
|
||||
{"start": {"line": 4, "character": 0}, "end": {"line": 4, "character": 10}},
|
||||
"name": "b",
|
||||
"kind": 6},
|
||||
{"selectionRange":
|
||||
{"start": {"line": 6, "character": 8}, "end": {"line": 6, "character": 14}},
|
||||
"range":
|
||||
{"start": {"line": 6, "character": 0},
|
||||
"end": {"line": 10, "character": 10}},
|
||||
"name": "Foobar",
|
||||
"kind": 3,
|
||||
"children":
|
||||
[{"selectionRange":
|
||||
{"start": {"line": 8, "character": 4},
|
||||
"end": {"line": 8, "character": 5}},
|
||||
"range":
|
||||
{"start": {"line": 8, "character": 0},
|
||||
"end": {"line": 8, "character": 10}},
|
||||
"name": "c",
|
||||
"kind": 6}]},
|
||||
{"selectionRange":
|
||||
{"start": {"line": 12, "character": 4},
|
||||
"end": {"line": 12, "character": 5}},
|
||||
"range":
|
||||
{"start": {"line": 12, "character": 0},
|
||||
"end": {"line": 12, "character": 10}},
|
||||
"name": "d",
|
||||
"kind": 6}]},
|
||||
{"selectionRange":
|
||||
{"start": {"line": 16, "character": 4}, "end": {"line": 16, "character": 5}},
|
||||
"range":
|
||||
{"start": {"line": 16, "character": 0}, "end": {"line": 16, "character": 10}},
|
||||
"name": "e",
|
||||
"kind": 6},
|
||||
{"selectionRange":
|
||||
{"start": {"line": 18, "character": 10},
|
||||
"end": {"line": 18, "character": 13}},
|
||||
"range":
|
||||
{"start": {"line": 18, "character": 0}, "end": {"line": 25, "character": 0}},
|
||||
"name": "Bar",
|
||||
"kind": 3,
|
||||
"children":
|
||||
[{"selectionRange":
|
||||
{"start": {"line": 20, "character": 4},
|
||||
"end": {"line": 20, "character": 5}},
|
||||
"range":
|
||||
{"start": {"line": 20, "character": 0},
|
||||
"end": {"line": 20, "character": 10}},
|
||||
"name": "f",
|
||||
"kind": 6},
|
||||
{"selectionRange":
|
||||
{"start": {"line": 21, "character": 8},
|
||||
"end": {"line": 21, "character": 9}},
|
||||
"range":
|
||||
{"start": {"line": 21, "character": 0},
|
||||
"end": {"line": 21, "character": 30}},
|
||||
"name": "g",
|
||||
"kind": 6},
|
||||
{"selectionRange":
|
||||
{"start": {"line": 22, "character": 9},
|
||||
"end": {"line": 22, "character": 22}},
|
||||
"range":
|
||||
{"start": {"line": 22, "character": 0},
|
||||
"end": {"line": 22, "character": 31}},
|
||||
"name": "instance : Coe Nat Nat ",
|
||||
"kind": 6}]}]
|
||||
|
|
@ -3,4 +3,4 @@ inductive Boo where
|
|||
|
||||
def f : Boo :=
|
||||
.tr
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -8,3 +8,13 @@
|
|||
"kind": 4,
|
||||
"data": ["«external:file:///dotIdCompletion.lean»", 4, 5, 0, "cBoo.truth"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of true:
|
||||
{"label": "true",
|
||||
"kind": 4,
|
||||
"detail": "Boo",
|
||||
"data": ["«external:file:///dotIdCompletion.lean»", 4, 5, 0, "cBoo.true"]}
|
||||
Resolution of truth:
|
||||
{"label": "truth",
|
||||
"kind": 4,
|
||||
"detail": "Boo",
|
||||
"data": ["«external:file:///dotIdCompletion.lean»", 4, 5, 0, "cBoo.truth"]}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ inductive MyNat
|
|||
| zero | succ (n : MyNat)
|
||||
|
||||
example : MyNat := .ze
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : MyNat → MyNat := .su
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
/-!
|
||||
Unfolding a type
|
||||
|
|
@ -22,22 +22,22 @@ Unfolding a type
|
|||
def MyNat' := MyNat
|
||||
|
||||
example : MyNat' := .ze
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
example : MyNat' → MyNat' := .su
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
/-!
|
||||
Seeing through type annotations
|
||||
-/
|
||||
|
||||
example : outParam MyNat := .ze
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
-- Definitions that are in the annotation's namespace are *not* reported
|
||||
def outParam.baz : MyNat := .zero
|
||||
example : outParam MyNat := .ba
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
/-!
|
||||
Aliases are currently not supported
|
||||
|
|
@ -50,7 +50,7 @@ export MyLib.MyNat (zero')
|
|||
end MyNat
|
||||
|
||||
example : MyNat := .zero
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
example : MyNat := .zero' -- it successfully elaborates
|
||||
|
||||
/-!
|
||||
|
|
@ -63,6 +63,6 @@ end MyLib
|
|||
|
||||
open MyLib in
|
||||
example : MyNat → MyNat := .succ
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
open MyLib in
|
||||
example : MyNat → MyNat := .succ' -- it successfully elaborates
|
||||
|
|
|
|||
|
|
@ -6,6 +6,12 @@
|
|||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 11, 22, 0, "cMyNat.zero"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of zero:
|
||||
{"label": "zero",
|
||||
"kind": 4,
|
||||
"detail": "MyNat",
|
||||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 11, 22, 0, "cMyNat.zero"]}
|
||||
{"textDocument": {"uri": "file:///dottedIdentNotation.lean"},
|
||||
"position": {"line": 14, "character": 30}}
|
||||
{"items":
|
||||
|
|
@ -14,6 +20,12 @@
|
|||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 14, 30, 0, "cMyNat.succ"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of succ:
|
||||
{"label": "succ",
|
||||
"kind": 4,
|
||||
"detail": "MyNat → MyNat",
|
||||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 14, 30, 0, "cMyNat.succ"]}
|
||||
{"textDocument": {"uri": "file:///dottedIdentNotation.lean"},
|
||||
"position": {"line": 23, "character": 23}}
|
||||
{"items":
|
||||
|
|
@ -22,6 +34,12 @@
|
|||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 23, 23, 0, "cMyNat.zero"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of zero:
|
||||
{"label": "zero",
|
||||
"kind": 4,
|
||||
"detail": "MyNat",
|
||||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 23, 23, 0, "cMyNat.zero"]}
|
||||
{"textDocument": {"uri": "file:///dottedIdentNotation.lean"},
|
||||
"position": {"line": 26, "character": 32}}
|
||||
{"items":
|
||||
|
|
@ -30,6 +48,12 @@
|
|||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 26, 32, 0, "cMyNat.succ"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of succ:
|
||||
{"label": "succ",
|
||||
"kind": 4,
|
||||
"detail": "MyNat → MyNat",
|
||||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 26, 32, 0, "cMyNat.succ"]}
|
||||
{"textDocument": {"uri": "file:///dottedIdentNotation.lean"},
|
||||
"position": {"line": 33, "character": 31}}
|
||||
{"items":
|
||||
|
|
@ -38,6 +62,12 @@
|
|||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 33, 31, 0, "cMyNat.zero"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of zero:
|
||||
{"label": "zero",
|
||||
"kind": 4,
|
||||
"detail": "MyNat",
|
||||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 33, 31, 0, "cMyNat.zero"]}
|
||||
{"textDocument": {"uri": "file:///dottedIdentNotation.lean"},
|
||||
"position": {"line": 38, "character": 31}}
|
||||
{"items": [], "isIncomplete": false}
|
||||
|
|
@ -49,6 +79,12 @@
|
|||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 51, 24, 0, "cMyNat.zero"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of zero:
|
||||
{"label": "zero",
|
||||
"kind": 4,
|
||||
"detail": "MyNat",
|
||||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 51, 24, 0, "cMyNat.zero"]}
|
||||
{"textDocument": {"uri": "file:///dottedIdentNotation.lean"},
|
||||
"position": {"line": 64, "character": 32}}
|
||||
{"items":
|
||||
|
|
@ -57,3 +93,9 @@
|
|||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 64, 32, 0, "cMyNat.succ"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of succ:
|
||||
{"label": "succ",
|
||||
"kind": 4,
|
||||
"detail": "MyNat → MyNat",
|
||||
"data":
|
||||
["«external:file:///dottedIdentNotation.lean»", 64, 32, 0, "cMyNat.succ"]}
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ structure Foo where
|
|||
|
||||
example (f : Foo) : f
|
||||
--^ insert: "."
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -5,3 +5,8 @@
|
|||
"kind": 5,
|
||||
"data": ["«external:file:///editCompletion.lean»", 3, 22, 1, "cFoo.foo"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of foo:
|
||||
{"label": "foo",
|
||||
"kind": 5,
|
||||
"detail": "Foo → Nat",
|
||||
"data": ["«external:file:///editCompletion.lean»", 3, 22, 1, "cFoo.foo"]}
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ register_error_explanation testPkg.foo2 {
|
|||
}
|
||||
|
||||
#check throwNamedError testPkg
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
#check throwNamedError testPkg.
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
#check throwNamedError testPkg.f
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
#check throwNamedError testPkg.f "test"
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
#check throwNamedError testPkg.foo2
|
||||
--^ textDocument/hover
|
||||
|
|
|
|||
|
|
@ -41,6 +41,48 @@
|
|||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 28, 30, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of testPkg.foo2:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 28, "character": 23},
|
||||
"end": {"line": 28, "character": 30}},
|
||||
"newText": "testPkg.foo2",
|
||||
"insert":
|
||||
{"start": {"line": 28, "character": 23},
|
||||
"end": {"line": 28, "character": 30}}},
|
||||
"label": "testPkg.foo2",
|
||||
"kind": 10,
|
||||
"documentation": {"value": "(error) Error 2", "kind": "markdown"},
|
||||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 28, 30, 0]}
|
||||
Resolution of testPkg.bar:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 28, "character": 23},
|
||||
"end": {"line": 28, "character": 30}},
|
||||
"newText": "testPkg.bar",
|
||||
"insert":
|
||||
{"start": {"line": 28, "character": 23},
|
||||
"end": {"line": 28, "character": 30}}},
|
||||
"label": "testPkg.bar",
|
||||
"kind": 10,
|
||||
"documentation": {"value": "(error) Error 0", "kind": "markdown"},
|
||||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 28, 30, 0]}
|
||||
Resolution of testPkg.foo1:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 28, "character": 23},
|
||||
"end": {"line": 28, "character": 30}},
|
||||
"newText": "testPkg.foo1",
|
||||
"insert":
|
||||
{"start": {"line": 28, "character": 23},
|
||||
"end": {"line": 28, "character": 30}}},
|
||||
"label": "testPkg.foo1",
|
||||
"kind": 10,
|
||||
"documentation": {"value": "(error) Error 1", "kind": "markdown"},
|
||||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 28, 30, 0]}
|
||||
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
||||
"position": {"line": 30, "character": 31}}
|
||||
{"items":
|
||||
|
|
@ -84,6 +126,48 @@
|
|||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 30, 31, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of testPkg.foo2:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 30, "character": 23},
|
||||
"end": {"line": 30, "character": 31}},
|
||||
"newText": "testPkg.foo2",
|
||||
"insert":
|
||||
{"start": {"line": 30, "character": 23},
|
||||
"end": {"line": 30, "character": 31}}},
|
||||
"label": "testPkg.foo2",
|
||||
"kind": 10,
|
||||
"documentation": {"value": "(error) Error 2", "kind": "markdown"},
|
||||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 30, 31, 0]}
|
||||
Resolution of testPkg.bar:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 30, "character": 23},
|
||||
"end": {"line": 30, "character": 31}},
|
||||
"newText": "testPkg.bar",
|
||||
"insert":
|
||||
{"start": {"line": 30, "character": 23},
|
||||
"end": {"line": 30, "character": 31}}},
|
||||
"label": "testPkg.bar",
|
||||
"kind": 10,
|
||||
"documentation": {"value": "(error) Error 0", "kind": "markdown"},
|
||||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 30, 31, 0]}
|
||||
Resolution of testPkg.foo1:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 30, "character": 23},
|
||||
"end": {"line": 30, "character": 31}},
|
||||
"newText": "testPkg.foo1",
|
||||
"insert":
|
||||
{"start": {"line": 30, "character": 23},
|
||||
"end": {"line": 30, "character": 31}}},
|
||||
"label": "testPkg.foo1",
|
||||
"kind": 10,
|
||||
"documentation": {"value": "(error) Error 1", "kind": "markdown"},
|
||||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 30, 31, 0]}
|
||||
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
||||
"position": {"line": 32, "character": 32}}
|
||||
{"items":
|
||||
|
|
@ -114,6 +198,34 @@
|
|||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 32, 32, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of testPkg.foo2:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 32, "character": 23},
|
||||
"end": {"line": 32, "character": 32}},
|
||||
"newText": "testPkg.foo2",
|
||||
"insert":
|
||||
{"start": {"line": 32, "character": 23},
|
||||
"end": {"line": 32, "character": 32}}},
|
||||
"label": "testPkg.foo2",
|
||||
"kind": 10,
|
||||
"documentation": {"value": "(error) Error 2", "kind": "markdown"},
|
||||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 32, 32, 0]}
|
||||
Resolution of testPkg.foo1:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 32, "character": 23},
|
||||
"end": {"line": 32, "character": 32}},
|
||||
"newText": "testPkg.foo1",
|
||||
"insert":
|
||||
{"start": {"line": 32, "character": 23},
|
||||
"end": {"line": 32, "character": 32}}},
|
||||
"label": "testPkg.foo1",
|
||||
"kind": 10,
|
||||
"documentation": {"value": "(error) Error 1", "kind": "markdown"},
|
||||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 32, 32, 0]}
|
||||
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
||||
"position": {"line": 34, "character": 32}}
|
||||
{"items":
|
||||
|
|
@ -144,6 +256,34 @@
|
|||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 34, 32, 0]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of testPkg.foo2:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 34, "character": 23},
|
||||
"end": {"line": 34, "character": 32}},
|
||||
"newText": "testPkg.foo2",
|
||||
"insert":
|
||||
{"start": {"line": 34, "character": 23},
|
||||
"end": {"line": 34, "character": 32}}},
|
||||
"label": "testPkg.foo2",
|
||||
"kind": 10,
|
||||
"documentation": {"value": "(error) Error 2", "kind": "markdown"},
|
||||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 34, 32, 0]}
|
||||
Resolution of testPkg.foo1:
|
||||
{"textEdit":
|
||||
{"replace":
|
||||
{"start": {"line": 34, "character": 23},
|
||||
"end": {"line": 34, "character": 32}},
|
||||
"newText": "testPkg.foo1",
|
||||
"insert":
|
||||
{"start": {"line": 34, "character": 23},
|
||||
"end": {"line": 34, "character": 32}}},
|
||||
"label": "testPkg.foo1",
|
||||
"kind": 10,
|
||||
"documentation": {"value": "(error) Error 1", "kind": "markdown"},
|
||||
"detail": "error name",
|
||||
"data": ["«external:file:///errorExplanationInteractive.lean»", 34, 32, 0]}
|
||||
{"textDocument": {"uri": "file:///errorExplanationInteractive.lean"},
|
||||
"position": {"line": 37, "character": 31}}
|
||||
{"range":
|
||||
|
|
|
|||
11
tests/lean/interactive/findReferences.lean
Normal file
11
tests/lean/interactive/findReferences.lean
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import Lean.Server.Test.Refs
|
||||
--^ waitForILeans
|
||||
|
||||
def foo := 0
|
||||
--^ references
|
||||
|
||||
def bar1 := foo
|
||||
def bar2 := foo
|
||||
|
||||
def foobar : Lean.Server.Test.Refs.Test1 := sorry
|
||||
--^ references
|
||||
30
tests/lean/interactive/findReferences.lean.expected.out
Normal file
30
tests/lean/interactive/findReferences.lean.expected.out
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{"textDocument": {"uri": "file:///findReferences.lean"},
|
||||
"position": {"line": 3, "character": 5},
|
||||
"context": {"includeDeclaration": true}}
|
||||
[{"uri": "file:///findReferences.lean",
|
||||
"range":
|
||||
{"start": {"line": 3, "character": 4}, "end": {"line": 3, "character": 7}}},
|
||||
{"uri": "file:///findReferences.lean",
|
||||
"range":
|
||||
{"start": {"line": 6, "character": 12}, "end": {"line": 6, "character": 15}}},
|
||||
{"uri": "file:///findReferences.lean",
|
||||
"range":
|
||||
{"start": {"line": 7, "character": 12}, "end": {"line": 7, "character": 15}}}]
|
||||
{"textDocument": {"uri": "file:///findReferences.lean"},
|
||||
"position": {"line": 9, "character": 16},
|
||||
"context": {"includeDeclaration": true}}
|
||||
[{"uri": "file:///findReferences.lean",
|
||||
"range":
|
||||
{"start": {"line": 9, "character": 13}, "end": {"line": 9, "character": 40}}},
|
||||
{"uri": "file:///src/Lean/Server/Test/Refs.lean",
|
||||
"range":
|
||||
{"start": {"line": 15, "character": 11},
|
||||
"end": {"line": 15, "character": 16}}},
|
||||
{"uri": "file:///src/Lean/Server/Test/Refs.lean",
|
||||
"range":
|
||||
{"start": {"line": 16, "character": 20},
|
||||
"end": {"line": 16, "character": 25}}},
|
||||
{"uri": "file:///src/Lean/Server/Test/Refs.lean",
|
||||
"range":
|
||||
{"start": {"line": 17, "character": 20},
|
||||
"end": {"line": 17, "character": 25}}}]
|
||||
3
tests/lean/interactive/guardMsgsCodeAction.lean
Normal file
3
tests/lean/interactive/guardMsgsCodeAction.lean
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#guard_msgs in
|
||||
--^ codeAction
|
||||
#eval 0
|
||||
27
tests/lean/interactive/guardMsgsCodeAction.lean.expected.out
Normal file
27
tests/lean/interactive/guardMsgsCodeAction.lean.expected.out
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{"textDocument": {"uri": "file:///guardMsgsCodeAction.lean"},
|
||||
"range":
|
||||
{"start": {"line": 0, "character": 2}, "end": {"line": 0, "character": 2}},
|
||||
"context": {"diagnostics": []}}
|
||||
[{"title": "Update #guard_msgs with generated message",
|
||||
"kind": "quickfix",
|
||||
"isPreferred": true,
|
||||
"data":
|
||||
{"providerResultIndex": 0,
|
||||
"providerName": "Lean.CodeAction.cmdCodeActionProvider",
|
||||
"params":
|
||||
{"textDocument": {"uri": "file:///guardMsgsCodeAction.lean"},
|
||||
"range":
|
||||
{"start": {"line": 0, "character": 2}, "end": {"line": 0, "character": 2}},
|
||||
"context": {"diagnostics": []}}}}]
|
||||
Resolution of Update #guard_msgs with generated message:
|
||||
{"title": "Update #guard_msgs with generated message",
|
||||
"kind": "quickfix",
|
||||
"isPreferred": true,
|
||||
"edit":
|
||||
{"documentChanges":
|
||||
[{"textDocument": {"version": 1, "uri": "file:///guardMsgsCodeAction.lean"},
|
||||
"edits":
|
||||
[{"range":
|
||||
{"start": {"line": 0, "character": 0},
|
||||
"end": {"line": 0, "character": 0}},
|
||||
"newText": "/-- info: 0 -/\n"}]}]}}
|
||||
23
tests/lean/interactive/highlightMatches.lean
Normal file
23
tests/lean/interactive/highlightMatches.lean
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import Lean.Meta.Basic
|
||||
|
||||
open Lean.Meta
|
||||
|
||||
def traceIt : MetaM Unit := do
|
||||
Lean.withTraceNode `Meta.debug (fun _ => return m!"root") do
|
||||
Lean.withTraceNode `Meta.debug (fun _ => return m!"child1") do
|
||||
trace[Meta.debug] "child11"
|
||||
trace[Meta.debug] "child12"
|
||||
trace[Meta.debug] "child13"
|
||||
Lean.withTraceNode `Meta.debug (fun _ => return m!"child2") do
|
||||
trace[Meta.debug] "child21"
|
||||
trace[Meta.debug] "child22"
|
||||
Lean.withTraceNode `Meta.debug (fun _ => return m!"child3") do
|
||||
trace[Meta.debug] "child31"
|
||||
trace[Meta.debug] "child4"
|
||||
|
||||
set_option trace.Meta.debug true
|
||||
|
||||
#eval traceIt
|
||||
|
||||
--^ collectDiagnostics
|
||||
--^ interactiveDiagnostics:highlightMatches:child1
|
||||
109
tests/lean/interactive/highlightMatches.lean.expected.out
Normal file
109
tests/lean/interactive/highlightMatches.lean.expected.out
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
{"version": 1,
|
||||
"uri": "file:///highlightMatches.lean",
|
||||
"diagnostics":
|
||||
[{"source": "Lean 4",
|
||||
"severity": 3,
|
||||
"range":
|
||||
{"start": {"line": 19, "character": 0}, "end": {"line": 19, "character": 5}},
|
||||
"message": "(trace)",
|
||||
"fullRange":
|
||||
{"start": {"line": 19, "character": 0},
|
||||
"end": {"line": 19, "character": 5}}}]}
|
||||
{"lineRange": {"start": 0, "end": 21}}
|
||||
{"query": "child1",
|
||||
"msg":
|
||||
{"tag":
|
||||
[{"trace":
|
||||
{"msg": {"tag": [{"expr": {"text": "root"}}, {"text": ""}]},
|
||||
"indent": 0,
|
||||
"collapsed": true,
|
||||
"cls": "Meta.debug",
|
||||
"children": {"lazy": {"p": "0"}}}},
|
||||
{"text": ""}]}}
|
||||
{"tag":
|
||||
[{"trace":
|
||||
{"msg": {"tag": [{"expr": {"text": "root"}}, {"text": ""}]},
|
||||
"indent": 0,
|
||||
"collapsed": false,
|
||||
"cls": "Meta.debug",
|
||||
"children":
|
||||
{"strict":
|
||||
[{"tag":
|
||||
[{"trace":
|
||||
{"msg":
|
||||
{"tag":
|
||||
[{"expr": {"tag": ["highlighted", {"text": "child1"}]}},
|
||||
{"text": ""}]},
|
||||
"indent": 2,
|
||||
"collapsed": false,
|
||||
"cls": "Meta.debug",
|
||||
"children":
|
||||
{"strict":
|
||||
[{"tag":
|
||||
[{"trace":
|
||||
{"msg":
|
||||
{"tag":
|
||||
[{"expr":
|
||||
{"append":
|
||||
[{"tag": ["highlighted", {"text": "child1"}]},
|
||||
{"text": "1"}]}},
|
||||
{"text": ""}]},
|
||||
"indent": 4,
|
||||
"collapsed": false,
|
||||
"cls": "Meta.debug",
|
||||
"children": {"strict": []}}},
|
||||
{"text": ""}]},
|
||||
{"tag":
|
||||
[{"trace":
|
||||
{"msg":
|
||||
{"tag":
|
||||
[{"expr":
|
||||
{"append":
|
||||
[{"tag": ["highlighted", {"text": "child1"}]},
|
||||
{"text": "2"}]}},
|
||||
{"text": ""}]},
|
||||
"indent": 4,
|
||||
"collapsed": false,
|
||||
"cls": "Meta.debug",
|
||||
"children": {"strict": []}}},
|
||||
{"text": ""}]},
|
||||
{"tag":
|
||||
[{"trace":
|
||||
{"msg":
|
||||
{"tag":
|
||||
[{"expr":
|
||||
{"append":
|
||||
[{"tag": ["highlighted", {"text": "child1"}]},
|
||||
{"text": "3"}]}},
|
||||
{"text": ""}]},
|
||||
"indent": 4,
|
||||
"collapsed": false,
|
||||
"cls": "Meta.debug",
|
||||
"children": {"strict": []}}},
|
||||
{"text": ""}]}]}}},
|
||||
{"text": ""}]},
|
||||
{"tag":
|
||||
[{"trace":
|
||||
{"msg": {"tag": [{"expr": {"text": "child2"}}, {"text": ""}]},
|
||||
"indent": 2,
|
||||
"collapsed": true,
|
||||
"cls": "Meta.debug",
|
||||
"children": {"lazy": {"p": "1"}}}},
|
||||
{"text": ""}]},
|
||||
{"tag":
|
||||
[{"trace":
|
||||
{"msg": {"tag": [{"expr": {"text": "child3"}}, {"text": ""}]},
|
||||
"indent": 2,
|
||||
"collapsed": true,
|
||||
"cls": "Meta.debug",
|
||||
"children": {"lazy": {"p": "2"}}}},
|
||||
{"text": ""}]},
|
||||
{"tag":
|
||||
[{"trace":
|
||||
{"msg": {"tag": [{"expr": {"text": "child4"}}, {"text": ""}]},
|
||||
"indent": 2,
|
||||
"collapsed": false,
|
||||
"cls": "Meta.debug",
|
||||
"children": {"strict": []}}},
|
||||
{"text": ""}]}]}}},
|
||||
{"text": ""}]}
|
||||
4
tests/lean/interactive/importCompletion.lean
Normal file
4
tests/lean/interactive/importCompletion.lean
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import Lean.Server.Test
|
||||
--^ textDocument/completion
|
||||
import Lean.Server.Test.
|
||||
--^ textDocument/completion
|
||||
22
tests/lean/interactive/importCompletion.lean.expected.out
Normal file
22
tests/lean/interactive/importCompletion.lean.expected.out
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{"textDocument": {"uri": "file:///importCompletion.lean"},
|
||||
"position": {"line": 0, "character": 23}}
|
||||
{"items":
|
||||
[{"label": "Test.Cancel",
|
||||
"data": ["«external:file:///importCompletion.lean»", 0, 23]},
|
||||
{"label": "Test.Runner",
|
||||
"data": ["«external:file:///importCompletion.lean»", 0, 23]},
|
||||
{"label": "Test",
|
||||
"data": ["«external:file:///importCompletion.lean»", 0, 23]},
|
||||
{"label": "Test.Refs",
|
||||
"data": ["«external:file:///importCompletion.lean»", 0, 23]}],
|
||||
"isIncomplete": false}
|
||||
{"textDocument": {"uri": "file:///importCompletion.lean"},
|
||||
"position": {"line": 2, "character": 24}}
|
||||
{"items":
|
||||
[{"label": "Runner",
|
||||
"data": ["«external:file:///importCompletion.lean»", 2, 24]},
|
||||
{"label": "Cancel",
|
||||
"data": ["«external:file:///importCompletion.lean»", 2, 24]},
|
||||
{"label": "Refs",
|
||||
"data": ["«external:file:///importCompletion.lean»", 2, 24]}],
|
||||
"isIncomplete": false}
|
||||
|
|
@ -5,7 +5,7 @@ def gfxacc (x : Nat) := x
|
|||
def gfxadc (x : Nat) := x
|
||||
def gfxbbc (x : Nat) := x
|
||||
#check gfxabc
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
||||
def Boo.gfxabc (x : Nat) := x
|
||||
def Boo.gfxacc (x : Nat) := x
|
||||
|
|
@ -13,4 +13,4 @@ def Boo.gfxadc (x : Nat) := x
|
|||
def Boo.gfxbbc (x : Nat) := x
|
||||
|
||||
#check Boo.gfxabc
|
||||
--^ textDocument/completion
|
||||
--^ completion
|
||||
|
|
|
|||
|
|
@ -11,6 +11,21 @@
|
|||
"kind": 3,
|
||||
"data": ["«external:file:///inWordCompletion.lean»", 6, 11, 0, "cgfxabc"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of gfxadc:
|
||||
{"label": "gfxadc",
|
||||
"kind": 3,
|
||||
"detail": "Nat → Nat",
|
||||
"data": ["«external:file:///inWordCompletion.lean»", 6, 11, 0, "cgfxadc"]}
|
||||
Resolution of gfxacc:
|
||||
{"label": "gfxacc",
|
||||
"kind": 3,
|
||||
"detail": "Nat → Nat",
|
||||
"data": ["«external:file:///inWordCompletion.lean»", 6, 11, 0, "cgfxacc"]}
|
||||
Resolution of gfxabc:
|
||||
{"label": "gfxabc",
|
||||
"kind": 3,
|
||||
"detail": "Nat → Nat",
|
||||
"data": ["«external:file:///inWordCompletion.lean»", 6, 11, 0, "cgfxabc"]}
|
||||
{"textDocument": {"uri": "file:///inWordCompletion.lean"},
|
||||
"position": {"line": 14, "character": 15}}
|
||||
{"items":
|
||||
|
|
@ -27,3 +42,18 @@
|
|||
"data":
|
||||
["«external:file:///inWordCompletion.lean»", 14, 15, 0, "cBoo.gfxacc"]}],
|
||||
"isIncomplete": false}
|
||||
Resolution of gfxabc:
|
||||
{"label": "gfxabc",
|
||||
"kind": 3,
|
||||
"detail": "Nat → Nat",
|
||||
"data": ["«external:file:///inWordCompletion.lean»", 14, 15, 0, "cBoo.gfxabc"]}
|
||||
Resolution of gfxadc:
|
||||
{"label": "gfxadc",
|
||||
"kind": 3,
|
||||
"detail": "Nat → Nat",
|
||||
"data": ["«external:file:///inWordCompletion.lean»", 14, 15, 0, "cBoo.gfxadc"]}
|
||||
Resolution of gfxacc:
|
||||
{"label": "gfxacc",
|
||||
"kind": 3,
|
||||
"detail": "Nat → Nat",
|
||||
"data": ["«external:file:///inWordCompletion.lean»", 14, 15, 0, "cBoo.gfxacc"]}
|
||||
|
|
|
|||
12
tests/lean/interactive/incomingCallHierarchy.lean
Normal file
12
tests/lean/interactive/incomingCallHierarchy.lean
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import Lean.Server.Test.Refs
|
||||
--^ waitForILeans
|
||||
|
||||
def foo := 0
|
||||
--^ incomingCallHierarchy
|
||||
|
||||
def bar1 := foo
|
||||
def bar2 := foo
|
||||
|
||||
def foobar : Lean.Server.Test.Refs.Test1 := sorry
|
||||
--^ incomingCallHierarchy
|
||||
def barfoo := foobar
|
||||
160
tests/lean/interactive/incomingCallHierarchy.lean.expected.out
Normal file
160
tests/lean/interactive/incomingCallHierarchy.lean.expected.out
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
[{"item":
|
||||
{"uri": "file:///incomingCallHierarchy.lean",
|
||||
"selectionRange":
|
||||
{"start": {"line": 3, "character": 4}, "end": {"line": 3, "character": 7}},
|
||||
"range":
|
||||
{"start": {"line": 3, "character": 4}, "end": {"line": 3, "character": 7}},
|
||||
"name": "foo",
|
||||
"kind": 14,
|
||||
"data":
|
||||
{"name": "foo", "module": "«external:file:///incomingCallHierarchy.lean»"}},
|
||||
"fromRanges": [],
|
||||
"children":
|
||||
[{"item":
|
||||
{"uri": "file:///incomingCallHierarchy.lean",
|
||||
"selectionRange":
|
||||
{"start": {"line": 6, "character": 4}, "end": {"line": 6, "character": 8}},
|
||||
"range":
|
||||
{"start": {"line": 6, "character": 0},
|
||||
"end": {"line": 6, "character": 15}},
|
||||
"name": "bar1",
|
||||
"kind": 14,
|
||||
"data":
|
||||
{"name": "bar1",
|
||||
"module": "«external:file:///incomingCallHierarchy.lean»"}},
|
||||
"fromRanges":
|
||||
[{"start": {"line": 6, "character": 12},
|
||||
"end": {"line": 6, "character": 15}}],
|
||||
"children": []},
|
||||
{"item":
|
||||
{"uri": "file:///incomingCallHierarchy.lean",
|
||||
"selectionRange":
|
||||
{"start": {"line": 7, "character": 4}, "end": {"line": 7, "character": 8}},
|
||||
"range":
|
||||
{"start": {"line": 7, "character": 0},
|
||||
"end": {"line": 7, "character": 15}},
|
||||
"name": "bar2",
|
||||
"kind": 14,
|
||||
"data":
|
||||
{"name": "bar2",
|
||||
"module": "«external:file:///incomingCallHierarchy.lean»"}},
|
||||
"fromRanges":
|
||||
[{"start": {"line": 7, "character": 12},
|
||||
"end": {"line": 7, "character": 15}}],
|
||||
"children": []}]}]
|
||||
[{"item":
|
||||
{"uri": "file:///src/Lean/Server/Test/Refs.lean",
|
||||
"selectionRange":
|
||||
{"start": {"line": 15, "character": 11},
|
||||
"end": {"line": 15, "character": 16}},
|
||||
"range":
|
||||
{"start": {"line": 15, "character": 11},
|
||||
"end": {"line": 15, "character": 16}},
|
||||
"name": "Lean.Server.Test.Refs.Test1",
|
||||
"kind": 14,
|
||||
"data":
|
||||
{"name": "Lean.Server.Test.Refs.Test1", "module": "Lean.Server.Test.Refs"}},
|
||||
"fromRanges": [],
|
||||
"children":
|
||||
[{"item":
|
||||
{"uri": "file:///src/Lean/Server/Test/Refs.lean",
|
||||
"selectionRange":
|
||||
{"start": {"line": 16, "character": 11},
|
||||
"end": {"line": 16, "character": 16}},
|
||||
"range":
|
||||
{"start": {"line": 16, "character": 0},
|
||||
"end": {"line": 16, "character": 25}},
|
||||
"name": "Lean.Server.Test.Refs.Test2",
|
||||
"kind": 14,
|
||||
"data":
|
||||
{"name": "Lean.Server.Test.Refs.Test2",
|
||||
"module": "Lean.Server.Test.Refs"}},
|
||||
"fromRanges":
|
||||
[{"start": {"line": 16, "character": 20},
|
||||
"end": {"line": 16, "character": 25}}],
|
||||
"children":
|
||||
[{"item":
|
||||
{"uri": "file:///src/Lean/Server/Test/Refs.lean",
|
||||
"selectionRange":
|
||||
{"start": {"line": 18, "character": 11},
|
||||
"end": {"line": 18, "character": 16}},
|
||||
"range":
|
||||
{"start": {"line": 18, "character": 0},
|
||||
"end": {"line": 18, "character": 25}},
|
||||
"name": "Lean.Server.Test.Refs.Test4",
|
||||
"kind": 14,
|
||||
"data":
|
||||
{"name": "Lean.Server.Test.Refs.Test4",
|
||||
"module": "Lean.Server.Test.Refs"}},
|
||||
"fromRanges":
|
||||
[{"start": {"line": 18, "character": 20},
|
||||
"end": {"line": 18, "character": 25}}],
|
||||
"children": []},
|
||||
{"item":
|
||||
{"uri": "file:///src/Lean/Server/Test/Refs.lean",
|
||||
"selectionRange":
|
||||
{"start": {"line": 19, "character": 11},
|
||||
"end": {"line": 19, "character": 16}},
|
||||
"range":
|
||||
{"start": {"line": 19, "character": 0},
|
||||
"end": {"line": 19, "character": 25}},
|
||||
"name": "Lean.Server.Test.Refs.Test5",
|
||||
"kind": 14,
|
||||
"data":
|
||||
{"name": "Lean.Server.Test.Refs.Test5",
|
||||
"module": "Lean.Server.Test.Refs"}},
|
||||
"fromRanges":
|
||||
[{"start": {"line": 19, "character": 20},
|
||||
"end": {"line": 19, "character": 25}}],
|
||||
"children": []}]},
|
||||
{"item":
|
||||
{"uri": "file:///src/Lean/Server/Test/Refs.lean",
|
||||
"selectionRange":
|
||||
{"start": {"line": 17, "character": 11},
|
||||
"end": {"line": 17, "character": 16}},
|
||||
"range":
|
||||
{"start": {"line": 17, "character": 0},
|
||||
"end": {"line": 17, "character": 25}},
|
||||
"name": "Lean.Server.Test.Refs.Test3",
|
||||
"kind": 14,
|
||||
"data":
|
||||
{"name": "Lean.Server.Test.Refs.Test3",
|
||||
"module": "Lean.Server.Test.Refs"}},
|
||||
"fromRanges":
|
||||
[{"start": {"line": 17, "character": 20},
|
||||
"end": {"line": 17, "character": 25}}],
|
||||
"children": []},
|
||||
{"item":
|
||||
{"uri": "file:///incomingCallHierarchy.lean",
|
||||
"selectionRange":
|
||||
{"start": {"line": 9, "character": 4},
|
||||
"end": {"line": 9, "character": 10}},
|
||||
"range":
|
||||
{"start": {"line": 9, "character": 0},
|
||||
"end": {"line": 9, "character": 49}},
|
||||
"name": "foobar",
|
||||
"kind": 14,
|
||||
"data":
|
||||
{"name": "foobar",
|
||||
"module": "«external:file:///incomingCallHierarchy.lean»"}},
|
||||
"fromRanges":
|
||||
[{"start": {"line": 9, "character": 13},
|
||||
"end": {"line": 9, "character": 40}}],
|
||||
"children":
|
||||
[{"item":
|
||||
{"uri": "file:///incomingCallHierarchy.lean",
|
||||
"selectionRange":
|
||||
{"start": {"line": 11, "character": 4},
|
||||
"end": {"line": 11, "character": 10}},
|
||||
"range":
|
||||
{"start": {"line": 11, "character": 0},
|
||||
"end": {"line": 11, "character": 20}},
|
||||
"name": "barfoo",
|
||||
"kind": 14,
|
||||
"data":
|
||||
{"name": "barfoo",
|
||||
"module": "«external:file:///incomingCallHierarchy.lean»"}},
|
||||
"fromRanges":
|
||||
[{"start": {"line": 11, "character": 14},
|
||||
"end": {"line": 11, "character": 20}}],
|
||||
"children": []}]}]}]
|
||||
|
|
@ -59,13 +59,14 @@ t 2
|
|||
{"start": {"line": 3, "character": 9},
|
||||
"end": {"line": 3, "character": 16}}}]}
|
||||
s
|
||||
{ goals := #[{ type := Lean.Widget.TaggedText.tag
|
||||
{ subexprPos := "/", diffStatus? := none }
|
||||
(Lean.Widget.TaggedText.text "True"),
|
||||
isInserted? := none,
|
||||
isRemoved? := none,
|
||||
hyps := #[] }] }
|
||||
|
||||
{"textDocument": {"uri": "file:///incrementalTactic.lean"},
|
||||
"position": {"line": 5, "character": 2}}
|
||||
{"goals":
|
||||
[{"type": {"tag": [{"subexprPos": "/", "info": {"p": "0"}}, {"text": "True"}]},
|
||||
"mvarId": "[anonymous]",
|
||||
"hyps": [],
|
||||
"goalPrefix": "⊢ ",
|
||||
"ctx": {"p": "1"}}]}
|
||||
{"version": 1,
|
||||
"uri": "file:///incrementalTactic.lean",
|
||||
"diagnostics":
|
||||
|
|
|
|||
17
tests/lean/interactive/inlayHints.lean
Normal file
17
tests/lean/interactive/inlayHints.lean
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
inductive Foo (x : α) : β → β → Prop where
|
||||
| foo : Foo x a a
|
||||
|
||||
structure Bar (x : α) where
|
||||
bar (a : α) (b : β) : γ → Bar x
|
||||
|
||||
def f (a : α) : β := sorry
|
||||
|
||||
variable (f : Foo x b b) in
|
||||
theorem g (_ : α) : n = 0 := sorry
|
||||
|
||||
example : α → α := id
|
||||
|
||||
axiom refl : x = x
|
||||
|
||||
--^ collectDiagnostics
|
||||
--^ inlayHints
|
||||
155
tests/lean/interactive/inlayHints.lean.expected.out
Normal file
155
tests/lean/interactive/inlayHints.lean.expected.out
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
{"version": 1,
|
||||
"uri": "file:///inlayHints.lean",
|
||||
"diagnostics":
|
||||
[{"source": "Lean 4",
|
||||
"severity": 2,
|
||||
"range":
|
||||
{"start": {"line": 6, "character": 4}, "end": {"line": 6, "character": 5}},
|
||||
"message": "declaration uses 'sorry'",
|
||||
"fullRange":
|
||||
{"start": {"line": 6, "character": 4}, "end": {"line": 6, "character": 5}}},
|
||||
{"source": "Lean 4",
|
||||
"severity": 2,
|
||||
"range":
|
||||
{"start": {"line": 9, "character": 8}, "end": {"line": 9, "character": 9}},
|
||||
"message": "declaration uses 'sorry'",
|
||||
"fullRange":
|
||||
{"start": {"line": 9, "character": 8}, "end": {"line": 9, "character": 9}}}]}
|
||||
{"textDocument": {"uri": "file:///inlayHints.lean"},
|
||||
"range":
|
||||
{"start": {"line": 0, "character": 0}, "end": {"line": 14, "character": 2}}}
|
||||
[{"tooltip":
|
||||
{"value":
|
||||
"Automatically-inserted implicit parameters:\n```lean\nβ : Sort u_2\n```",
|
||||
"kind": "markdown"},
|
||||
"textEdits":
|
||||
[{"range":
|
||||
{"start": {"line": 0, "character": 21},
|
||||
"end": {"line": 0, "character": 21}},
|
||||
"newText": " {β}"}],
|
||||
"position": {"line": 0, "character": 21},
|
||||
"paddingRight": false,
|
||||
"paddingLeft": false,
|
||||
"label": " {β}",
|
||||
"kind": 2},
|
||||
{"tooltip":
|
||||
{"value":
|
||||
"Automatically-inserted implicit parameters:\n```lean\nα : Sort u_1\n```",
|
||||
"kind": "markdown"},
|
||||
"textEdits":
|
||||
[{"range":
|
||||
{"start": {"line": 0, "character": 13},
|
||||
"end": {"line": 0, "character": 13}},
|
||||
"newText": " {α}"}],
|
||||
"position": {"line": 0, "character": 13},
|
||||
"paddingRight": false,
|
||||
"paddingLeft": false,
|
||||
"label": " {α}",
|
||||
"kind": 2},
|
||||
{"tooltip":
|
||||
{"value":
|
||||
"Automatically-inserted implicit parameters:\n```lean\na : ?m\n```",
|
||||
"kind": "markdown"},
|
||||
"textEdits":
|
||||
[{"range":
|
||||
{"start": {"line": 1, "character": 7}, "end": {"line": 1, "character": 7}},
|
||||
"newText": " {a}"}],
|
||||
"position": {"line": 1, "character": 7},
|
||||
"paddingRight": false,
|
||||
"paddingLeft": false,
|
||||
"label": " {a}",
|
||||
"kind": 2},
|
||||
{"tooltip":
|
||||
{"value":
|
||||
"Automatically-inserted implicit parameters:\n```lean\nα : Sort u_1\n```",
|
||||
"kind": "markdown"},
|
||||
"textEdits":
|
||||
[{"range":
|
||||
{"start": {"line": 3, "character": 13},
|
||||
"end": {"line": 3, "character": 13}},
|
||||
"newText": " {α}"}],
|
||||
"position": {"line": 3, "character": 13},
|
||||
"paddingRight": false,
|
||||
"paddingLeft": false,
|
||||
"label": " {α}",
|
||||
"kind": 2},
|
||||
{"tooltip":
|
||||
{"value":
|
||||
"Automatically-inserted implicit parameters:\n```lean\nβ : Sort u_2\nγ : Sort u_3\n```",
|
||||
"kind": "markdown"},
|
||||
"textEdits":
|
||||
[{"range":
|
||||
{"start": {"line": 4, "character": 5}, "end": {"line": 4, "character": 5}},
|
||||
"newText": " {β γ}"}],
|
||||
"position": {"line": 4, "character": 5},
|
||||
"paddingRight": false,
|
||||
"paddingLeft": false,
|
||||
"label": " {β γ}",
|
||||
"kind": 2},
|
||||
{"tooltip":
|
||||
{"value":
|
||||
"Automatically-inserted implicit parameters:\n```lean\nα : Sort u_1\nβ : Sort u_2\n```",
|
||||
"kind": "markdown"},
|
||||
"textEdits":
|
||||
[{"range":
|
||||
{"start": {"line": 6, "character": 5}, "end": {"line": 6, "character": 5}},
|
||||
"newText": " {α β}"}],
|
||||
"position": {"line": 6, "character": 5},
|
||||
"paddingRight": false,
|
||||
"paddingLeft": false,
|
||||
"label": " {α β}",
|
||||
"kind": 2},
|
||||
{"tooltip":
|
||||
{"value":
|
||||
"Automatically-inserted implicit parameters:\n```lean\nx : ?m\nb : ?m\n```",
|
||||
"kind": "markdown"},
|
||||
"textEdits":
|
||||
[{"range":
|
||||
{"start": {"line": 8, "character": 8}, "end": {"line": 8, "character": 8}},
|
||||
"newText": " {x b}"}],
|
||||
"position": {"line": 8, "character": 8},
|
||||
"paddingRight": false,
|
||||
"paddingLeft": false,
|
||||
"label": " {x b}",
|
||||
"kind": 2},
|
||||
{"tooltip":
|
||||
{"value":
|
||||
"Automatically-inserted implicit parameters:\n```lean\nα : Sort u_1\nn : Nat\n```",
|
||||
"kind": "markdown"},
|
||||
"textEdits":
|
||||
[{"range":
|
||||
{"start": {"line": 9, "character": 9}, "end": {"line": 9, "character": 9}},
|
||||
"newText": " {α n}"}],
|
||||
"position": {"line": 9, "character": 9},
|
||||
"paddingRight": false,
|
||||
"paddingLeft": false,
|
||||
"label": " {α n}",
|
||||
"kind": 2},
|
||||
{"tooltip":
|
||||
{"value":
|
||||
"Automatically-inserted implicit parameters:\n```lean\nα : Sort u_1\n```",
|
||||
"kind": "markdown"},
|
||||
"textEdits":
|
||||
[{"range":
|
||||
{"start": {"line": 11, "character": 7},
|
||||
"end": {"line": 11, "character": 7}},
|
||||
"newText": " {α}"}],
|
||||
"position": {"line": 11, "character": 7},
|
||||
"paddingRight": false,
|
||||
"paddingLeft": false,
|
||||
"label": " {α}",
|
||||
"kind": 2},
|
||||
{"tooltip":
|
||||
{"value":
|
||||
"Automatically-inserted implicit parameters:\n```lean\nx : ?m\n```",
|
||||
"kind": "markdown"},
|
||||
"textEdits":
|
||||
[{"range":
|
||||
{"start": {"line": 13, "character": 10},
|
||||
"end": {"line": 13, "character": 10}},
|
||||
"newText": " {x}"}],
|
||||
"position": {"line": 13, "character": 10},
|
||||
"paddingRight": false,
|
||||
"paddingLeft": false,
|
||||
"label": " {x}",
|
||||
"kind": 2}]
|
||||
10
tests/lean/interactive/interactiveDiagnostics.lean
Normal file
10
tests/lean/interactive/interactiveDiagnostics.lean
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
def foo (x : Nat) : Nat := sorry
|
||||
|
||||
def bar := sorry
|
||||
|
||||
#eval 1
|
||||
|
||||
#check Nat
|
||||
|
||||
--^ collectDiagnostics
|
||||
--^ interactiveDiagnostics
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
{"version": 1,
|
||||
"uri": "file:///interactiveDiagnostics.lean",
|
||||
"diagnostics":
|
||||
[{"source": "Lean 4",
|
||||
"severity": 2,
|
||||
"range":
|
||||
{"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 7}},
|
||||
"message": "declaration uses 'sorry'",
|
||||
"fullRange":
|
||||
{"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 7}}},
|
||||
{"source": "Lean 4",
|
||||
"severity": 1,
|
||||
"range":
|
||||
{"start": {"line": 2, "character": 4}, "end": {"line": 2, "character": 7}},
|
||||
"message": "Failed to infer type of definition `bar`",
|
||||
"fullRange":
|
||||
{"start": {"line": 2, "character": 4}, "end": {"line": 2, "character": 7}},
|
||||
"code": "lean.inferDefTypeFailed"},
|
||||
{"source": "Lean 4",
|
||||
"severity": 3,
|
||||
"range":
|
||||
{"start": {"line": 4, "character": 0}, "end": {"line": 4, "character": 5}},
|
||||
"message": "1",
|
||||
"fullRange":
|
||||
{"start": {"line": 4, "character": 0}, "end": {"line": 4, "character": 5}}},
|
||||
{"source": "Lean 4",
|
||||
"severity": 3,
|
||||
"range":
|
||||
{"start": {"line": 6, "character": 0}, "end": {"line": 6, "character": 6}},
|
||||
"message": "Nat : Type",
|
||||
"fullRange":
|
||||
{"start": {"line": 6, "character": 0}, "end": {"line": 6, "character": 6}}}]}
|
||||
{"lineRange": {"start": 0, "end": 8}}
|
||||
[{"source": "Lean 4",
|
||||
"severity": 2,
|
||||
"range":
|
||||
{"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 7}},
|
||||
"message":
|
||||
{"append":
|
||||
[{"tag": [{"expr": {"text": "declaration uses '"}}, {"text": ""}]},
|
||||
{"tag":
|
||||
[{"expr":
|
||||
{"tag": [{"subexprPos": "/", "info": {"p": "0"}}, {"text": "sorry"}]}},
|
||||
{"text": ""}]},
|
||||
{"tag": [{"expr": {"text": "'"}}, {"text": ""}]}]},
|
||||
"fullRange":
|
||||
{"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 7}}},
|
||||
{"source": "Lean 4",
|
||||
"severity": 1,
|
||||
"range":
|
||||
{"start": {"line": 2, "character": 4}, "end": {"line": 2, "character": 7}},
|
||||
"message":
|
||||
{"append":
|
||||
[{"tag": [{"expr": {"text": "Failed to infer type of "}}, {"text": ""}]},
|
||||
{"tag": [{"expr": {"text": "definition `"}}, {"text": ""}]},
|
||||
{"tag": [{"expr": {"text": "bar"}}, {"text": ""}]},
|
||||
{"tag": [{"expr": {"text": "`"}}, {"text": ""}]},
|
||||
{"tag":
|
||||
[{"widget":
|
||||
{"wi":
|
||||
{"props":
|
||||
{"explanationUrl":
|
||||
"REFERENCE/find/?domain=Manual.errorExplanation&name=lean.inferDefTypeFailed",
|
||||
"code": "lean.inferDefTypeFailed"},
|
||||
"javascriptHash": "14043757810349425459",
|
||||
"id": "Lean.errorDescriptionWidget"},
|
||||
"alt": {"tag": [{"expr": {"text": ""}}, {"text": ""}]}}},
|
||||
{"text": ""}]}]},
|
||||
"fullRange":
|
||||
{"start": {"line": 2, "character": 4}, "end": {"line": 2, "character": 7}},
|
||||
"code": "lean.inferDefTypeFailed"},
|
||||
{"source": "Lean 4",
|
||||
"severity": 3,
|
||||
"range":
|
||||
{"start": {"line": 4, "character": 0}, "end": {"line": 4, "character": 5}},
|
||||
"message": {"tag": [{"expr": {"text": "1"}}, {"text": ""}]},
|
||||
"fullRange":
|
||||
{"start": {"line": 4, "character": 0}, "end": {"line": 4, "character": 5}}},
|
||||
{"source": "Lean 4",
|
||||
"severity": 3,
|
||||
"range":
|
||||
{"start": {"line": 6, "character": 0}, "end": {"line": 6, "character": 6}},
|
||||
"message":
|
||||
{"tag":
|
||||
[{"expr":
|
||||
{"append":
|
||||
[{"text": "Nat : "},
|
||||
{"tag": [{"subexprPos": "/1", "info": {"p": "1"}}, {"text": "Type"}]}]}},
|
||||
{"text": ""}]},
|
||||
"fullRange":
|
||||
{"start": {"line": 6, "character": 0}, "end": {"line": 6, "character": 6}}}]
|
||||
16
tests/lean/interactive/interactiveGoalGoToLoc.lean
Normal file
16
tests/lean/interactive/interactiveGoalGoToLoc.lean
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/-- MyNat doc -/
|
||||
inductive MyNat where
|
||||
| zero : MyNat
|
||||
| succ : MyNat → MyNat
|
||||
|
||||
/-- MyTrue doc -/
|
||||
structure MyTrue : Prop where
|
||||
|
||||
/-- MyEq doc -/
|
||||
inductive MyEq : α → α → Prop where
|
||||
| refl (a : α) : MyEq a a
|
||||
|
||||
theorem foo : (x : MyNat) → (h : MyEq x x) → MyTrue := by
|
||||
intro x h
|
||||
exact MyTrue.mk
|
||||
--^ goals:withGoToLoc
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue