Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete suggestions after dot (".") not appearing in some contexts #5172

Closed
LacombeJ opened this issue Aug 11, 2024 · 0 comments · Fixed by #5299
Closed

Autocomplete suggestions after dot (".") not appearing in some contexts #5172

LacombeJ opened this issue Aug 11, 2024 · 0 comments · Fixed by #5299
Labels
bug Something isn't working P-high We will work on this issue server Affects the Lean server code

Comments

@LacombeJ
Copy link

Description

When typing in "." after a type or namespace in match and some tactics, the autocomplete suggestions are not appearing.

Context

I have noticed it in:

  • Match expressions (in the terms right after the "|" guards)
  • Tactic mode (in "apply" expressions or in "cases" guards)

Steps to Reproduce

Match Expression

  1. Start with empty file (.lean) file in a lean/lake project
  2. Add the following code:
inductive Direction where
  | up
  | right
  | down
  | left
deriving Repr

def angle (d: Direction) :=
  match d with
  | Direction.up => 90
  | Direction.right => 0
  | Direction.down => 270
  | Direction.left => 180
  1. Delete the ".up" and try re-adding a period "." after Direction

Expected behavior:
I expect to see the same dropdown that appears after typing the dot in #eval Direction.

Actual behavior:
No suggestions dropdown, red squiggly error line appears under text and hovering shows "invalid pattern Lean 4"

Versions

VS Code Extension: v0.0.176
Lean: version 4.10.0, x86_64-w64-windows-gnu, commit c375e19, Release
OS: Windows 10

Additional Information

Similar issue found in all of the "." operators in this example

example : p ∨ (q ∧ r) → (p ∨ q) ∧ (p ∨ r) := by
  intro h
  cases h with
  | inl hp => apply And.intro (Or.intro_left q hp) (Or.intro_left r hp)
  | inr hqr => apply And.intro (Or.intro_right p hqr.left) (Or.intro_right p hqr.right)

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@LacombeJ LacombeJ added the bug Something isn't working label Aug 11, 2024
@mhuisi mhuisi transferred this issue from leanprover/vscode-lean4 Aug 26, 2024
@mhuisi mhuisi added the server Affects the Lean server code label Aug 26, 2024
@leanprover-bot leanprover-bot added the P-high We will work on this issue label Aug 30, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 12, 2024
When the elaborator doesn't provide us with any `CompletionInfo`, we
currently provide no completions whatsoever. But in many cases, we can
still provide some helpful identifier completions without elaborator
information. This PR adds a fallback mode for this situation.

There is more potential here, but this should be a good start.

In principle, this issue alleviates #5172 (since we now provide
completions in these contexts). I'll leave it up to an elaboration
maintainer whether we also want to ensure that the completion infos are
provided correctly in these cases.
tobiasgrosser pushed a commit to opencompl/lean4 that referenced this issue Sep 16, 2024
When the elaborator doesn't provide us with any `CompletionInfo`, we
currently provide no completions whatsoever. But in many cases, we can
still provide some helpful identifier completions without elaborator
information. This PR adds a fallback mode for this situation.

There is more potential here, but this should be a good start.

In principle, this issue alleviates leanprover#5172 (since we now provide
completions in these contexts). I'll leave it up to an elaboration
maintainer whether we also want to ensure that the completion infos are
provided correctly in these cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P-high We will work on this issue server Affects the Lean server code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants