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

Bug: Auto import from vue adds separate import statements in .vue files #17471

Closed
ddenev opened this issue Aug 30, 2024 · 2 comments
Closed

Bug: Auto import from vue adds separate import statements in .vue files #17471

ddenev opened this issue Aug 30, 2024 · 2 comments
Labels
area/cli bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-vite kind/bug 🐞 Qv2 🔝 Quasar v2 issues

Comments

@ddenev
Copy link
Contributor

ddenev commented Aug 30, 2024

What happened?

In VSCode, every time I use auto import from 'vue', the symbol I select is imported in a separate import statement (separate line), resulting in multiple import { ... } from 'vue' statements.

Here is the state before I auto-import the second symbol from vue:
image
And here is what happens immediately after I hit Enter on the computed symbol:
image

This happens only in .vue files, works ok in .js files.

Important: this also works in a pure Vue project (npm create vue@latest), only in Quasar project the problem exists. See reproduction.

Note: I already reported this issue to:

What did you expect to happen?

Expected result is to reuse the 1st import statement and add the symbol there.

Reproduction URL

https://codepen.io/ddenev/pen/QWXVNyL

How to reproduce?

This is only reproducible in VSCode.

  1. Install Quasar: yarn global add @quasar/cli
  2. Create a new Quasar project: yarn create quasar (accept all defaults)
  3. Open the new project folder in VSCode (only Volar extension is enabled)
  4. Create a new .vue file in src
  5. Try to reproduce the above behaviour

The result is:

<template>
  <div>A</div>
</template>

<script setup>
import { computed } from 'vue'
import { ref } from 'vue'

const t1 = ref()
const t2 = computed
</script>

<style lang="scss" scoped></style>

image

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite)

Platforms/Browsers

No response

Quasar info output

No response

Relevant log output

No response

Additional context

VSCode version 1.92.2
Volar version 2.1.2
Quasar version 2.16.9

@ddenev ddenev added kind/bug 🐞 Qv2 🔝 Quasar v2 issues labels Aug 30, 2024
@github-actions github-actions bot added area/cli bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-vite labels Aug 30, 2024
@Dtsiantaris
Copy link
Contributor

Dtsiantaris commented Sep 7, 2024

Doesn't this resolve the issue?

@rstoenescu
Copy link
Member

Hi,

This bug has nothing to do with Quasar itself, but rather with VSCode or Volar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-vite kind/bug 🐞 Qv2 🔝 Quasar v2 issues
Projects
None yet
Development

No branches or pull requests

3 participants