-
Notifications
You must be signed in to change notification settings - Fork 12.8k
VS Community and TS: auto-import adds '.js' extension to the module name, while auto completion not #35926
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
Comments
So some context: for path completions, we currently we find the first existing import that's relative, and then figure out if it uses an extension. If so, we provide paths with However, there was talk of following up and making extensions for import paths configurable: #19019 (comment) |
Thank you @DanielRosenwasser for your reply. |
Mine is a typescript project. None of my imports use '.js' (they are all without any extension) yet new auto imports are created with '.js'. |
Lots of things around this have changed since this issue was opened. Certain compiler options indicate that extensions are required by the module system where the code is intended to run. Beyond that, there are editor preferences, and when not set and the compiler options allow multiple options, an attempt to match the style of the existing file is made. Given how many features have been added (and bugs fixed), I’m going to close this. Feel free to open a new one with complete repro steps if you’re still experiencing buggy or confusing behavior. |
visual studio 2019 community,
for the autocomplete during import the suggested modules are as expected (module name without extension), However, when typing ex. a class name and want to auto-import the incloser module it gets added with .js extension !! what's wrong
screenshot for autocomplete the import syntax

screenshot for auto import suggestions

The text was updated successfully, but these errors were encountered: