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

Allow setting a custom tsconfig to the Svelte for VS Code extension #2673

Open
jsbravoc opened this issue Jan 23, 2025 · 3 comments
Open

Allow setting a custom tsconfig to the Svelte for VS Code extension #2673

jsbravoc opened this issue Jan 23, 2025 · 3 comments

Comments

@jsbravoc
Copy link

Description

  • I use svelte-check with a custom --tsconfig path. However, the VSCode extension uses the default one (tsconfig.json)

Proposed solution

Add an extension configuration to set the tsconfig path.

"svelte.plugin.typescript.tsconfigPath": "./tsconfig.json"

Alternatives

No response

Additional Information, eg. Screenshots

No response

@jasonlyu123
Copy link
Member

This has been proposed in TypeScript before but was rejected(microsoft/vscode#12463, microsoft/TypeScript#11224). While the tsconfig searching in svelte-language-server is currently not entirely controlled by TypeScript, it is better to stay consistent with TypeScript as It'll introduce inconsistencies between js/ts files and svelte files. Can you share why you can't use tsconfig.json? Alternatively, you can create multiple tsconfig in different directories with different include configs. Or use a solution style tsconfig to reference a tsconfig with a name other than "tsconfig.json".

@jsbravoc
Copy link
Author

jsbravoc commented Jan 31, 2025

Can you share why you can't use tsconfig.json?

I’m encountering issues with TypeScript imports when using project references. If I remove the project references, everything works correctly.

Here's a minimal reproducible example: https://github.com/jsbravoc/min-repo-svelte-ts

In this setup, there are two TSConfigs:

  • One includes the project references.

  • Another extends the first but removes the references.

In CI, I'm using the second TSConfig, and I’d like the VSCode extension to use it as well.


Edit: I want to keep the TSConfig with project references because I'm using Nx with the TypeScript plugin. This plugin automatically updates all TSConfig files in the monorepo and sets project references based on package dependencies https://nx.dev/nx-api/js/generators/typescript-sync

@jasonlyu123
Copy link
Member

The import issue is a bug so I'll fix it instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants