This PR enables tactic completion in the whitespace of a tactic proof and adds tactic docstrings to the completion menu. Future work: - A couple of broken tactic completions: This is due to tactic completion now using @david-christiansen's `Tactic.Doc.allTacticDocs` to obtain the tactic docstrings and should be fixed soon. - Whitespace tactic completion in tactic combinators: This requires changing the syntax of tactic combinators to produce a syntax node that makes it clear that a tactic is expected at the given position. Closes #1651.
115 lines
2.8 KiB
Text
115 lines
2.8 KiB
Text
prelude
|
|
import Init.Notation
|
|
|
|
/-
|
|
This test is a bit brittle because it checks that tactic completion works correctly for all
|
|
tactic completions that we get in `prelude` + `import Init.Notation`.
|
|
When changing the docstring of any of these tactics, this test will break.
|
|
|
|
If you didn't touch the elaboration infrastructure or the language server, then you can safely
|
|
assume that this test is still correct and unbreak it by overwriting
|
|
`completionTactics.lean.expected.out` with `completionTactics.lean.produced.out` after running
|
|
this test.
|
|
-/
|
|
|
|
/-- A docstring -/
|
|
syntax (name := skip) "skip" : tactic
|
|
|
|
/-- Another docstring -/
|
|
syntax (name := exact) "exact " term : tactic
|
|
|
|
example : True := by -- No completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by -- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by ski -- Tactic completions matching `ski` expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by skip -- No completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by skip; -- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by skip; -- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by
|
|
skip
|
|
skip; -- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by
|
|
-- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by
|
|
skip
|
|
-- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by
|
|
-- All tactic completions expected
|
|
--^ textDocument/completion
|
|
skip
|
|
|
|
example : True := by
|
|
exact by
|
|
-- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by
|
|
exact by
|
|
-- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by
|
|
exact by
|
|
skip
|
|
-- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by
|
|
exact by
|
|
skip
|
|
-- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by
|
|
exact
|
|
-- No completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by
|
|
exact
|
|
-- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True :=
|
|
let foo := by
|
|
-- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True :=
|
|
let foo := by
|
|
-- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True :=
|
|
let foo := by
|
|
skip
|
|
-- All tactic completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True :=
|
|
let foo := by
|
|
skip
|
|
-- No completions expected
|
|
--^ textDocument/completion
|
|
|
|
example : True := by {
|
|
-- All tactic completions expected
|
|
--^ textDocument/completion
|
|
}
|