0

When I am in the middle of the line, I can press Command + Enter to go to the next line. How can I do that it also automatically was adding commas if I do this in arrays?

For example, I want to add two plugins in the following ESLint config:

extends: [
    'airbnb',
    'plugin:@typescript-eslint/recommended',
    'airbnb/hooks',
    'plugin:import/typescript',
    'import/no-unresolved',
    'plugin:react/recommended',
    'plugin:prettier/recommended',
  ],

I add first plugin:

extends: [
    ...
    'prettier(I am here)'
  ],

and I want to add another I press Command + Enter it creates a new line, but I still need to add a comma:

extends: [
    ...
    'prettier'
    (I am here)
  ],

I also use ideaVim, but I still haven't found anything that worked like this. Do you have any ideas?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Demian
  • 121
  • 3
  • 11
  • Try the `Complete Current Statement` -- at very least in PHP it does that; may work a bit differently in another language/depending on some settings. Here on Windows it's `Ctrl+Shift+Enter`. You can check what shortcut you have there on `Settings/Preferences | Keymap" -- use the local search field there. – LazyOne Mar 03 '23 at 13:58
  • P.S. It works fine in `.json` files for me (e.g. `eslint.json`) so **should** also work in TypeScript files. – LazyOne Mar 03 '23 at 14:01
  • P.P.S. Your `Command + Enter` -- that looks like an ordinary "Start New Line" action to me .. which does not add any commas (as it's a simple action). Check what action that is using the aforementioned Keymap Settings screen (it has a button that allows locating an action by the assigned shortcut). – LazyOne Mar 03 '23 at 14:03

0 Answers0