Autocomplete doesn't add a file extention

Hello!

When I try to add some js-file import, WebStorm doesn't add the ".js" or ".jsx" extention at the end of string.

Somewhen I found a solution on StackOverflow, smth like to use "Find Action" menu and change some checkbox. But now I can't find this solution and can't configure this parameter.

Does some way exist for this? Thanks!

1
14 comments

To complete imported filename with extension, set registry key commonjs.complete.required.filename.with.extension to true :

  • Open "Help | Find Action..." dialog
  • Type Registry, find Registry item in dropdown list and press Enter
  • Find commonjs.complete.required.filename.with.extension there, tick the checkbox
0

Thank you very much! 

0

Добрый день!

Пытаюсь повторить вашу инструкцию - не находит такой раздел в настройках


WebStorm 2017.2.5
Build #WS-172.4343.25, built on October 20, 2017
Subscription is active until May 11, 2018
JRE: 1.8.0_152-release-915-b12 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows Server 2008 R2 6.1

0

Здравствуйте!

 

он там определенно есть:

0

Подскажите пожалуйста, как вы открыли диалог Registry

0

Из меню Help > Find Action (Ctrl+Shift+A), там ввести сначала Registry..., а потом уже, в открывшемся окне, найти чекбокс

0

Как написано выше:

 

  • Open "Help | Find Action..." dialog
  • Type Registry, find Registry item in dropdown list and press Enter

Вы в "Help | Find Action..." ищете непосредственно ключ, а надо искать Registry и уже в нем искать

 

0

Спасибо - пропустил пункт с поиском реестра )

0

Hello.

Is there any way to fix this in IntelliJ IDEA 2020.1.1 (Ultimate Edition)? There is no such registry setting.

Very annoying when you have to manually fix every single import or webpack build will error and stop compiling.

0

Please try enabling Use file extension in module name in Settings | Editor | Code Style | JavaScript | Imports

4

Why isn't this the default? Firefox gives an error when I import without .js extension.

0

Since 2021.3, the IDE tries to guess if the extension required or prohibited, see https://youtrack.jetbrains.com/issue/WEB-53257/Add-advanced-configuration-for-using-file-extensions-in-module-imports#focus=Comments-27-5335233.0-0. But there is no reliable way to know this in each and every case

1

But is there actually a case where the .js extension is prohibited when importing a local js file? Or maybe it is the auto setting (which I was using originally) that should add it?

0

Please sign in to leave a comment.