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

Using IntelliSense suggestion to import a function does not work when using JSDoc import tag #5264

Open
twisterniq opened this issue Mar 10, 2025 · 0 comments
Labels
good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first 🔩 p2-edge-case

Comments

@twisterniq
Copy link

twisterniq commented Mar 10, 2025

Vue - Official extension or vue-tsc version

3.0.0-alpha.0

VSCode version

1.98.0

Vue version

3.5.13

TypeScript version

5.8.2

System Info

package.json dependencies

{
  "dependencies": {
    "vue": "^3.5.13"
  }
}

Steps to reproduce

  1. Create a new .vue file
  2. Copy and paste or write it:
<template>
    <div></div>
</template>
<script setup>
/** @import { PropType } from 'vue' */

const test = ref(null);
</script>
  1. Put the cursor after ref word and press CTRL+SPACE for suggestions. The vue suggestion should be shown but will not be applied if you try to apply it. No effect.

Image

  1. If you remove the JSDoc import line, and try the step 3 again, it works fine.

What is expected?

The import line should be added correctly as it does when JSDoc import tag is not being used.

What is actually happening?

The import line is not being added when JSDoc tag import tag is being used.

TS Server Log:

    Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isTypeKeywordToken'.

    Error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isTypeKeywordToken'.
        at cast (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:3350:16)
        at getTypeKeywordOfTypeOnlyImport (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:139958:10)
        at doAddExistingFix (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:158730:32)
        at codeActionForFixWorker (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:158516:7)
        at c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:158501:13
        at _ChangeTracker.with (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:178070:5)
        at codeActionForFix (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:158500:60)
        at Object.getImportCompletionAction (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:157888:43)
        at getCompletionEntryCodeActionsAndSourceDisplay (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:167777:62)
        at Object.getCompletionEntryDetails (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:167642:46)
        at getCompletionEntryDetails2 (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:152207:35)
        at c:\Users\twist\.vscode\extensions\vue.volar-3.0.0-alpha.0\node_modules\vue-typescript-plugin-pack\index.js:5:8230
        at Proxy.<anonymous> (c:\Users\twist\.vscode\extensions\vue.volar-3.0.0-alpha.0\node_modules\vue-typescript-plugin-pack\index.js:8:13714)
        at c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:194945:43
        at mapDefined (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:2606:22)
        at IpcIOSession.getCompletionEntryDetails (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:194943:20)
        at completionEntryDetails (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:193184:43)
        at c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:195676:15
        at IpcIOSession.executeWithRequestId (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:195665:14)
        at IpcIOSession.executeCommand (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:195674:29)
        at IpcIOSession.onMessage (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:195722:68)
        at process.<anonymous> (c:\Users\twist\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\_tsserver.js:519:14)
        at process.emit (node:events:518:28)
        at emit (node:internal/child_process:950:14)
        at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

Link to minimal reproduction

No response

Any additional comments?

The same behaviour for 2.2.8 version.

You can try to do the same in the Vue SFC Playground. The only difference is that there will be no suggestion to import from vue package.

Image

@twisterniq twisterniq changed the title IntelliSense suggestions broken when using JSDoc import tag Using IntelliSense suggestion to import a function does not work when using JSDoc import tag Mar 10, 2025
@KazariEX KazariEX added good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first 🔩 p2-edge-case and removed pending triage labels Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first 🔩 p2-edge-case
Projects
None yet
Development

No branches or pull requests

2 participants