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

Intellisense is not working for self-references and # imports of typescript files in vscode #57777

Closed
magnusriga opened this issue Mar 14, 2024 · 8 comments Β· Fixed by #57718
Closed
Labels
Duplicate An existing issue was already created

Comments

@magnusriga
Copy link

magnusriga commented Mar 14, 2024

πŸ”Ž Search Terms

"imports", "# imports"

πŸ•— Version & Regression Information

  • This is a bug
  • As far as I know, it has never worked

⏯ Playground Link

https://github.com/magnusriga/my-app

πŸ’» Code

// foo.tsx
import { Bar } from "#app/bar"; // Resolved by TS, but lacking Intellisense (ctrl+space suggestions).
import { Baz } from "my-app/baz"; // Resolved by TS, but lacking Intellisense (ctrl+space suggestions).
import { Qux } from "./qux"; // Resolved by TS and has full Intellisense.
export const Foo = () => {
  return (
    <>
      <Bar bar="bar" />
      <Baz baz="baz" />
      <Qux qux="qux" />
    </>
  );
};
// bar.tsx (baz.tsx and qux.tsx are similar)
export const Bar = ({bar}: {bar: string}) => {
  return <div>{bar}</div>
}
// package.json
{
...
 "name": "my-app",
  "imports": {
    "#app/*": "./src/app/*.js"
  },
  "exports": {
    "./*": "./src/app/*.js"
  },
...

I am using "typescript": "5.5.0-dev.20240314".

πŸ™ Actual behavior

The import specifiers do not provide Intellisense suggestions. TS is able to resolve the files however, so there is no TS error.

πŸ™‚ Expected behavior

The expected behavior is for Intellisense to understand the TS resolution and provide suggestions with ctrl+space.

Additional information about the issue

No response

@magnusriga
Copy link
Author

Probably your domain, @andrewbranch ? Or @sheetalkamat. Thank you very much for any/all help,

@Andarist
Copy link
Contributor

duplicate of #52460 , it is being worked on here: #57718

@magnusriga
Copy link
Author

magnusriga commented Mar 14, 2024

Thanks @Andarist . Shouldn't the self-referencing import work already (Baz in the OP)? That uses exports, not imports, in package.json.

@andrewbranch andrewbranch added the Duplicate An existing issue was already created label Mar 14, 2024
@Andarist
Copy link
Contributor

Self-references should also work. @andrewbranch has mentioned before that the code might not be best prepared for this at the moment though. I'm not sure but that might require some new preferences or considering how this would play out with the existing ones. Self-references are not that popular and might be surprising to many people. Suggesting this in import statements would be probably totally fine - but a question stays about how auto-imports should work with that.

@magnusriga
Copy link
Author

magnusriga commented Mar 14, 2024

@Andarist I am ok using # imports instead of self-references through exports. Intellisense works for neither of them, as of typescript 5.5.0-dev.20240314. Any thoughts on when this functionality might be merged into the next version of typescript?

@Andarist
Copy link
Contributor

I'll work on code-level improvements to my PR sometime soon. Other than that, it will require review (and merge) from the team - I can't say when that will happen.

@typescript-bot
Copy link
Collaborator

This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 17, 2024
@gracefullight
Copy link

Is there any plan to support this feature in version 5.6?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants