-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Causing 99% CPU usage #32
Comments
Also getting this problem. Its a bit different though: For some reason, typing inside of the VS Code version: 1.18.0 |
This probably has to do with the typing to fast issue. I'd suggest what the guy said and only checking tags when the cursor moves out of the tag encapsulation area ( /, <> for example) This is just a theory though |
Same here. I would argue this has nothing to do with typing too fast as Visual Studio Code would lock up from this issue after a single character. Disabled just this extension and the problem stopped. Disabled all extensions and enabled just Auto Rename Tag and the problem resurfaced. I was editing a ruby .erb file at the time. Mac OS 10.11.6, El Capitan |
Same problem with *.svg files. Mac OS 10.11.6, El Capitan |
Same problem with .vue files |
Was able to reproduce. Here's some sample code: <path strokeWidth="0" fill="white" transform="translate(-1, -1)" d="M11.3 4.7l1.4 1.4L6.8 12 3.3 8.s6l1.4-1.4 2.1 2z" /> The above example might not freeze your editor (because it's short) but you will see extensionHost hit 100%. Note: we could change See VSCodeVim/Vim#2003 (comment) for more info. |
The issue is with the regex on this line: let regex = /<(\/?)([a-zA-Z][a-zA-Z0-9-_:.]*)?(?:\s[^\s<>]*?[^\s/<>]+?)*?>/g; Trying it out with the sample code above results in a timeout: However, changing the tags to |
It seems that the regex execution time grows exponentially with the amount of text in the non-capturing group. Here's a basic example: <foo className="asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf" /> The more "asdf" groups you add the longer it takes. The inverse is also true; the less "asdf" groups, the faster it runs. Still investigating (I wish my regex skills were better). Update: going to give up on this for now since I don't really understand the code and I'm busy with other things. |
<(?>(/?))(?>([a-zA-Z][a-zA-Z0-9-_:.])?)(?:\s[^\s\/<>]+?)?> |
Problem:
When a .ejs file is saved, the CPU usage rises to 99%.
How to reproduce:
Evidence that this extension has something to do with it: I disabled all the other VSCode extensions and the issue does not happen, enabling only this one causes the problem, enabling any other plugin does not.
Running ps aux | grep 32942 returns:
/Downloads/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Downloads/Visual Studio Code.app/Contents/Resources/app/out/bootstrap --type=extensionHost
(being 32942 the PID of a Code Helper task is using 99% of the CPU)
VSCode version: 1.15.1
Extension version: 0.0.14
File is attached.
index.ejs.zip
The text was updated successfully, but these errors were encountered: