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

Completion for global directives #4988

Open
benedictleejh opened this issue Nov 5, 2024 · 2 comments · May be fixed by #4989
Open

Completion for global directives #4988

benedictleejh opened this issue Nov 5, 2024 · 2 comments · May be fixed by #4989
Labels
feature request Request new features

Comments

@benedictleejh
Copy link

benedictleejh commented Nov 5, 2024

What problem does this feature solve?

vuejs/core#3399 has landed in Vue 3.5, and the GlobalDirectives interface exists, but Volar does not seem to populate directive completions from the the GlobalDirectives interface.

On a fresh project created with pnpm create vue@latest, with VSCode, adding the module declaration

declare module 'vue' {
  interface GlobalDirectives{
    vHelloWorld: any;
  }
}

(in App.vue) enables type hints and jump to definition (at least to the module declaration) on the directive in Vue SFCs, but the completion popup when attempting to use the directive does not include v-hello-world.

I only managed to make the directive completion work when doing

declare module 'vue' {
  interface ComponentCustomProperties {
    vHelloWorld: any;
  }
}

What does the proposed solution look like?

Volar should provide completion for global directives declared in the GlobalDirectives interface.

@benedictleejh benedictleejh added the feature request Request new features label Nov 5, 2024
@KazariEX
Copy link
Collaborator

KazariEX commented Nov 6, 2024

Do you mean that only completion does not take effect? Can you jump to the type definition through F12 after completely typing the directives?

@benedictleejh
Copy link
Author

Yes, it's only completion that doesn't work. The jump to the type definition (whether ctrl+click or F12) works.

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

Successfully merging a pull request may close this issue.

2 participants