Typescript file with NodeJS shebang gets detected as Javascript
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
I'm building a CLI with Typescript, but the resulting transpiled JS files will have to be executed by Node.
Shebang language detection is a feature (as per https://github.com/zed-industries/zed/issues/6089), but in that case it leaves me with plenty of linter errors and no autocompletion '^^
I'd argue that special-casing .ts file that have a javascript-matching shebang as typescript files would be the solution
Environment
Zed: v0.142.6 (Zed) OS: Linux Wayland endeavouros unknown Memory: 15.6 GiB Architecture: x86_64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your Zed.log file to this issue.
No response
Hey, thanks for filling out this issue. For what it's worth, we always treat files with node shebang as JS files; see: https://github.com/zed-industries/zed/blob/main/crates/languages/src/javascript/config.toml#L4 I wonder if it's as easy as adding the same detection in TS config.toml (that currently doesn't specify any shebang: https://github.com/zed-industries/zed/blob/main/crates/languages/src/typescript/config.toml).
I came here to report this same issue. Is there anything I can do to help move this forward?
Ran into this again. The workaround is to manually switch to TypeScript (by clicking the language selector down in the bottom right corner) and then restarting the language server.
This is still an issue
Yep, still an issue in 0.181.6. Run into this commonly with AWS CDK projects which use this pattern by default.
Here to report that this is still an issue with preview 0.188.2. Inconvenient problem that I didn't know the cause of. After about 30 mins of combing my settings.json, trying different things, comparing neovim... led me here.
While we wait for a permanent resolution what is a temporary solution we can apply to avoid this problem at the moment?
While we wait for a permanent resolution what is a temporary solution we can apply to avoid this problem at the moment?
you can see what I did in the commit that got referenced in this PR (scroll up), i basically added a (ugly) sed call in my package.json build script that adds the shebang to the compiled JS file