language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

Declaration soucemap cannot link to correct position at source file

Open qmhc opened this issue 1 year ago • 3 comments

Vue - Official extension or vue-tsc version

vue-tsc 2.0.29

VSCode version

latest

Vue version

3.4.32

TypeScript version

5.5.3

System Info

System:
  OS: Windows 10 10.0.19045
  CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
  Memory: 15.34 GB / 31.95 GB
Binaries:
  Node: 18.16.0 - D:\nodejs\node.EXE
  Yarn: 1.22.19 - D:\yarn\bin\yarn.CMD
  npm: 9.5.1 - D:\nodejs\npm.CMD
Browsers:
  Chrome: 127.0.6533.73
  Edge: Chromium (127.0.2651.74), ChromiumDev (127.0.2610.3)
  Internet Explorer: 11.0.19041.4355

Steps to reproduce

Create some component like the following:

<script setup lang="ts">
defineProps({
  max: {
    type: Number,
    default: 1000
  }
})

const count = defineModel<number>('count', { default: 0 })

const emit = defineEmits(['on-add'])

const inc = () => {
  count.value++
  emit('on-add', count.value)
}
</script>

<template>
  <div
    class="setup"
    @click="inc"
  >
    {{ count }}
  </div>
</template>

Then run vue tsc --declaration --emitDeclarationOnly --declarationMap and check the result.

What is expected?

Click(alt/command) any line in declaration file can jump to the correct position at source file.

What is actually happening?

But not.

Link to minimal reproduction

No response

Any additional comments?

No response

qmhc avatar Jul 31 '24 16:07 qmhc

Can't reproduce. Please create a minimal example project that we can look into. Also seems more likely to be a tsconfig related issue.

davidmatter avatar Aug 05 '24 19:08 davidmatter

Refer to https://github.com/qmhc/vue-tsc-map.

Open ./types/Comp.vue.d.ts and Ctrl(Command) + Click the max or count or others, it will always jumps to the bottom of ./src/Comp.vue but not the correct position.

qmhc avatar Aug 07 '24 04:08 qmhc

Right, props don't seem to be mapped

davidmatter avatar Aug 08 '24 09:08 davidmatter