How to make VSCode open file by clicking on it's path in Vue template or style src attribute?

199 views Asked by At

I use VSCode and Volar extension, Nuxt 2 app. My jsconfig.json:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "~/*": [
        "./*"
      ],
      "@/*": [
        "./*"
      ],
    }
  },
  "exclude": [
    "node_modules",
    ".nuxt",
    ".vscode",
    ".github",
    "dist"
  ]
}

I have a component:

<template>
  <img src="/assets/images/image.webp">
<template>

<script>
import AnotherComponent from '@/components/common/another-component'

export default {
  name: 'Comp',
  components: {
    AnotherComponent
  },
</script>

<style src="static/assets/css/styles.css">
</style>

So I'm trying to open a file by "command (ctrl) + click" on a path. It works for the import line, but doesn't work for src attribute neither in template img tag nor in style tag. Note that click on img src should open "/static/assets/images/image.webp". How can I fix it?

I tried to add this to jsconfig.json:

"/assets/*": [
  "static/assets/*"
]

but it didn't help.

0

There are 0 answers