lort
lort

Reputation: 1457

VSCode import path intellisense for custom files extensions

When writing a code that will be later pushed through webpack, it is possible to use custom loaders for non-standard files. In effect it is possible to write

import image from './assets/image.png';

and it will be properly handled. The problem is VSCode doesn't provide autocompletion for files like .png, .svg, .scss and so on.

Is it possible to do so by some settings or an extension?

Upvotes: 7

Views: 4977

Answers (1)

Kirill Zinovjev
Kirill Zinovjev

Reputation: 141

I was able to fix it using Path Autocomplete extension. By default it does not include file extensions and suggests the .js files in addition to the default suggestions by VS Code. It can be changed by adding the following lines to the User Settings:

"path-autocomplete.extensionOnImport": true,
"path-autocomplete.excludedItems": {
    "**/*.js": {"when": "**"}
}

Upvotes: 10

Related Questions