Skip to content

Auto import does not works for JS project (even after recent fixes) #61452

@blikblum

Description

@blikblum

Issue Type: Bug

Auto Import is not working for a JavaScript project.

When i type the start of a identifier exported in the project like:

cont -> Ctrl + Space

It appears the identifier name (container) in the suggestion list and is expended when clicked but no import is added

In the developer tools, an error occurs as soon as i type Ctrl + Space:

ERR An unknown error occurred. Please consult the log for more details.

In the call stack, the error seems to be triggered by the below code in suggestWidget.ts:

this.currentSuggestionDetails.then(() => {
				if (this.list.length < index) {
					return;
				}
				// item can have extra information, so re-render
				this.ignoreFocusEvents = true;
				this.list.splice(index, 1, [item]);
				this.list.setFocus([index]);
				this.ignoreFocusEvents = false;

				if (this.expandDocsSettingFromStorage()) {
					this.showDetails();
				} else {
					removeClass(this.element, 'docs-side');
				}

				this._ariaAlert(this._getSuggestionAriaAlertLabel(item));
			}).catch(onUnexpectedError).then(() => {
				if (this.focusedItem === item) {
					this.currentSuggestionDetails = null;
				}
			});

I'm using vscode 1.28.2 which some Auto Import bugs where fixed, but unfortunately not this.
The feature was working previously.

This error occurs in two medium sized projects, with JSX

In a third smaller project, a js library, the Auto Import works and no error is triggered in dev tools console

VS Code version: Code 1.28.2 (7f3ce96, 2018-10-17T00:23:51.859Z)
OS version: Windows_NT x64 10.0.17134

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz (8 x 3600)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 7.91GB (1.99GB free)
Process Argv
Screen Reader no
VM 67%
Extensions (14)
Extension Author (truncated) Version
html-snippets abu 0.2.1
numbered-bookmarks ale 0.12.0
snapshot-tools asv 0.2.2
vscode-standardjs che 1.2.3
path-intellisense chr 1.4.2
open-html-in-browser cod 0.1.21
vscode-eslint dba 1.6.1
auto-close-tag for 0.5.6
debugger-for-chrome msj 4.10.2
LiveServer rit 5.1.1
code-settings-sync Sha 3.2.0
bootstrap4-vscode the 4.3.0
JavaScriptSnippets xab 1.7.1
markdown-all-in-one yzh 1.6.2

(1 theme extensions excluded)

Metadata

Metadata

Assignees

Labels

javascriptJavaScript support issuesupstreamIssue identified as 'upstream' component related (exists outside of VS Code)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions