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

No completion for enum methods or associated values #110

Closed
PgBiel opened this issue Jan 26, 2025 · 1 comment · Fixed by #111
Closed

No completion for enum methods or associated values #110

PgBiel opened this issue Jan 26, 2025 · 1 comment · Fixed by #111

Comments

@PgBiel
Copy link
Contributor

PgBiel commented Jan 26, 2025

Describe the bug
Autocomplete doesn't work for enum instances' methods or associated values.

I suspect this is due to the lack of special handling similar to that of structs in the enum branch of isCompletingAChain, below.

case *symbols.Enum:
enum := prevIndexable.(*symbols.Enum)
for _, enumerator := range enum.GetEnumerators() {
if !filterMembers || strings.HasPrefix(enumerator.GetName(), symbolInPosition.Text()) {
items = append(items, protocol.CompletionItem{
Label: enumerator.GetName(),
Kind: &enumerator.Kind,
// No documentation for enumerators at this time
Documentation: nil,
})
}
}

To Reproduce
Steps to reproduce the behavior:

  1. Open a project with an enum, say CoolEnum with a constant ENUM_A, and a method, say fn int CoolEnum.give(self)
  2. Type CoolEnum.ENUM_A.g somewhere
  3. No completion appears
  4. Try the same by adding an associated value, e.g. enum CoolEnum : (int name) and then ENUM_A = 5
  5. Type CoolEnum.ENUM_A.nam
  6. No completion appears

Expected behavior
Should have suggested the give method and the name fields respectively

Screenshots

.g isn't completed to give

associated value .bbb has no completion from .bb

Desktop (please complete the following information):

  • OS: Linux
  • Editor: VSCode, Zed
  • Version: 0.3.3+
@pherrymason
Copy link
Owner

This will also be more easy to fix/implement in the next version ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants