How to configure VS Code Auto import?
Asked Answered
M

1

14

Is there a way of tweaking TypeScript Auto import feature in Visual Studio Code?

As an example, observe the following attempt:

enter image description here

The added line by the Auto import was the following:

import { Pins } from '../types/index';

I would like it to be added straight away without the comma, in respect to TSLint, and without the /index path, due to my subject sense of aesthetics, like the following:

import { Pins } from '../types'

Is there a way of saving those few "extra" keyboard hits?

Maliamalice answered 1/2, 2018 at 3:57 Comment(1)
You could install the TypeScript-Hero extension for VSCode and configure it to remove the semicolon on save. It has many possible configurations for setting up clean import statements. Though I can't find the documentation anymore since it migrated to GitLab.Pique
P
2
  1. Download TypeScript Hero extension.

  2. Go to settings (Ctrl + ,).

  3. In settings go to User (selected default) >> Extensions >> TypeScript Hero


TypeScript Hero > Imports: Insert Semicolons

[x] Defines if there should be a semicolon at the end of the statement.

Porscheporsena answered 13/7, 2019 at 11:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.