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

First auto-import is added on same line as <script> #916

Closed
Akryum opened this issue Jan 29, 2022 · 5 comments
Closed

First auto-import is added on same line as <script> #916

Akryum opened this issue Jan 29, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@Akryum
Copy link
Member

Akryum commented Jan 29, 2022

When I auto import something in a .vue file, the first time it add the code on the same line as the opening <script> tag.

Actual:

<script lang="ts" setup>import { PropType } from 'vue'
import { Story } from '../types'
import StoryListItem from './StoryListItem.vue'

const props = defineProps({
  stories: {
    type: Array as PropType<Story[]>,
    required: true,
  },
})
</script>

Expected:

<script lang="ts" setup>
import { PropType } from 'vue'
import { Story } from '../types'
import StoryListItem from './StoryListItem.vue'

const props = defineProps({
  stories: {
    type: Array as PropType<Story[]>,
    required: true,
  },
})
</script>

Reproduction steps:

  • Create an empty .vue file
  • Add a script section
  • Auto import something using the intellisense popover

Volar v0.31.1

@johnsoncodehk
Copy link
Member

Hi @Akryum, thanks for the report! But unfortunately even this is a simple problem, we don't have a suitable solution to resolve. Unless we have to prohibit any code at first line in script block.

@johnsoncodehk johnsoncodehk added the wontfix This will not be worked on label Feb 12, 2022
@Akryum
Copy link
Member Author

Akryum commented Feb 12, 2022

So there is no possible solution either from Volar, VS Code or another part of the stack?

@johnsoncodehk
Copy link
Member

Just have a idea to fix. :)

@johnsoncodehk johnsoncodehk added enhancement New feature or request and removed wontfix This will not be worked on labels Feb 12, 2022
@Akryum
Copy link
Member Author

Akryum commented Feb 12, 2022

Awesome! 😻

@Akryum
Copy link
Member Author

Akryum commented Mar 29, 2022

Looks like the issue is back @johnsoncodehk

image

image

image

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

No branches or pull requests

2 participants