|
|
|
@ -114,10 +114,11 @@ def evalHintMessage : Expr → MetaM (Array Expr → MessageData) := fun _ => pu
|
|
|
|
open Meta in
|
|
|
|
open Meta in
|
|
|
|
/-- Find all hints whose trigger matches the current goal -/
|
|
|
|
/-- Find all hints whose trigger matches the current goal -/
|
|
|
|
def findHints (goal : MVarId) (doc : FileWorker.EditableDocument) (initParams : Lsp.InitializeParams) : MetaM (Array GameHint) := do
|
|
|
|
def findHints (goal : MVarId) (doc : FileWorker.EditableDocument) (initParams : Lsp.InitializeParams) : MetaM (Array GameHint) := do
|
|
|
|
|
|
|
|
goal.withContext do
|
|
|
|
let some level ← getLevelByFileName? initParams doc.meta.mkInputContext.fileName
|
|
|
|
let some level ← getLevelByFileName? initParams doc.meta.mkInputContext.fileName
|
|
|
|
| throwError "Level not found: {doc.meta.mkInputContext.fileName}"
|
|
|
|
| throwError "Level not found: {doc.meta.mkInputContext.fileName}"
|
|
|
|
let hints ← level.hints.filterMapM fun hint => do
|
|
|
|
let hints ← level.hints.filterMapM fun hint => do
|
|
|
|
openAbstractCtxResult hint.goal fun hintFVars hintGoal => goal.withContext do
|
|
|
|
openAbstractCtxResult hint.goal fun hintFVars hintGoal => do
|
|
|
|
if let some fvarBij := matchExpr (← instantiateMVars $ hintGoal) (← instantiateMVars $ ← inferType $ mkMVar goal)
|
|
|
|
if let some fvarBij := matchExpr (← instantiateMVars $ hintGoal) (← instantiateMVars $ ← inferType $ mkMVar goal)
|
|
|
|
then
|
|
|
|
then
|
|
|
|
let lctx := (← goal.getDecl).lctx
|
|
|
|
let lctx := (← goal.getDecl).lctx
|
|
|
|
|