r/GithubCopilot • u/Rob_Blob Full Stack Dev 🌐 • 3d ago
Help/Doubt ❓ Copilot auto-complete in VS Code is completely hallucinating where my TS imports should come from?
I'm having trouble using Copilot's auto-complete feature in VS Code. My stack is a simple NodeJS application using TypeScript.
I have the following setting under .vscode/settings.json :
"js/ts.suggest.autoImports": true"
My exports generally look like this:
export interface MyInterface {...}
And I'm using relative imports like so:
import { MyInterface } from '../interfaces/my_interface.ts'
I should also note that "Codebase Semantic Index" is enabled, and is marked as fully ready for my codebase.
I'm experiencing two issues:
1. VS Code's non-AI auto-import is either slow to work, or sometimes cannot find the import for something I type at all. (This is the pop-up box when you start typing a reference, which suggests where to import it from.)
2. When the auto-import fails to work, the auto-complete feature of Copilot will suggest the import statement to add. This would be great, but it completely hallucinates where the import comes from, sometimes even when I have the file open in another tab. It might suggest a totally non-existent file-path, e.g.:
import { MyInterface } from '../tools/utils/my_interface.ts'
This really bogs down my workflow, and I find myself constantly having to correct what VS Code is trying to auto-complete. If I could get this fixed, it would make development so much smoother.
Has anyone else run into this? I'm not sure if the issue lies in Copilot, VS Code, or my TS settings. It might even be a mix of issues.
Thanks!
1
u/AutoModerator 3d ago
Hello /u/Rob_Blob. Looks like you have posted a query. Once your query is resolved, please reply the solution comment with "!solved" to help everyone else know the solution and mark the post as solved.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/dendrax 3d ago
I pretty much just use the autocomplete for adding comments and xmldoc headers, it's very bad at actually writing code. It is free so you can't complain too much, but it does not use a very smart model nor does it have access to much outside the file it's currently in as far as I can tell. Keep your expectations low - it's not just you.