Skip to content

Tab key is extremely slow on medium-large files when emmet.triggerExpansionOnTab is enabled #71996

@xak2000

Description

@xak2000

Issue Type: Bug

When I open a large file (tried on .php and .html) and emmet.triggerExpansionOnTab option is enabled, then each pressing on TAB key (even on blank line) make my computer hung for about 1-2 seconds (depends on file size) with high CPU load.

This is true with current 1.33 version of VS CODE, with or without extensions (tried with code --disable-extensions), with or without project open. I also tried to download 1.34 insiders build and the behavior is still the same.

Steps to Reproduce:

  1. Download a fresh 1.34 insiders build (or use 1.33 current).

  2. Create new HTML file tmp.html with any content. Make sure it is 2000+ lines. Better 5000+ - the hang is more obvious when the file is more large. I attached an example file here.

  3. Set cursor on any line and press TAB. You can press it many times in a row or press and hold - all should be fine.

  4. Open preferences and enable Emmet: Trigger Expansion on Tab option (emmet.triggerExpansionOnTab).

  5. Return to opened file and try to press TAB again. You should see a very notable delay between pressing the key and moving the cursor (you can enable Toggle render whitespace option to see this better).

    If you press and hold the TAB key for about 5 seconds, then you should see no spaces/tabs characters entered (but notice high CPU load), you then can move cursor to anoter place in the editor, and after another 10-30 seconds have been passed (all that time with high CPU load), the delayed space characters will appear at the current cursor position (not where the cursor been when you actually pressed the TAB key).

So here is two problems:

  1. A high CPU load and delay between pressing TAB key and appearing of spaces/tab characters.
  2. The space/tab characters appears after the delay not where the cursor was when TAB key was pressed, but at the current position of the cursor.

I notice this problem only recently. I'm not sure with which build this comes in (not used VS Code recently), but 1-2 month ago there were no this problem.


VS Code version: Code - Insiders 1.34.0-insider (56f1b47, 2019-04-09T05:19:45.294Z)
OS version: Windows_NT x64 6.1.7601

System Info
Item Value
CPUs Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz (4 x 3400)
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
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 23.93GB (1.39GB free)
Process Argv
Screen Reader no
VM 0%
Extensions: none

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugemmetEmmet related issuesinsiders-releasedPatch has been released in VS Code InsidersperfverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions