refactor: Lint

This commit is contained in:
jstoobysmith 2025-01-23 14:31:03 +00:00
parent fca75098f1
commit 5a25cd0f5c
6 changed files with 15 additions and 6 deletions

View file

@ -123,6 +123,7 @@ def Name.hasDocString (c : Name) : MetaM Bool := do
| some _ => pure true
| none => pure false
/-- The doc string from a name. -/
def Name.getDocString (c : Name) : MetaM String := do
let env ← getEnv
let doc ← Lean.findDocString? env c

View file

@ -37,7 +37,7 @@ initialize remarkExtension : SimplePersistentEnvExtension RemarkInfo (Array Rema
}
/-- A remark is a string used for important information. -/
syntax (name := remark_syntax) "remark " ident ":=" str : command
syntax (name := remark_syntax) "remark " ident ":=" str : command
/-- Elaborator for the `note ...` command -/
@[command_elab remark_syntax]

View file

@ -12,17 +12,20 @@ import HepLean.Meta.Remark.Basic
namespace HepLean
open Lean System Meta
/-- All remarks in the enviroment. -/
def Name.allRemarkInfo : MetaM (List RemarkInfo) := do
let env ← getEnv
let allRemarks := (remarkExtension.getState env)
pure allRemarks.toList
def RemarkInfo.toFullName (r : RemarkInfo) : Name :=
/-- The full name of a remark (name and namespace). -/
def RemarkInfo.toFullName (r : RemarkInfo) : Name :=
if r.nameSpace != .anonymous then
(r.nameSpace.toString ++ "." ++ r.name.toString).toName
else
r.name
/-- A Bool which is true if a name correponds to a remark. -/
def RemarkInfo.IsRemark (n : Name) : MetaM Bool := do
let allRemarks ← Name.allRemarkInfo
let r := allRemarks.find? (fun r => r.toFullName = n)
@ -30,6 +33,7 @@ def RemarkInfo.IsRemark (n : Name) : MetaM Bool := do
| some _ => pure true
| none => pure false
/-- Gets the remarkInfo from a name corresponding to a remark.. -/
def RemarkInfo.getRemarkInfo (n : Name) : MetaM RemarkInfo := do
let allRemarks ← Name.allRemarkInfo
let r := allRemarks.find? (fun r => r.toFullName = n)