windicss / windicss-intellisense

Intelligent WindiCSS tooling for VS Code
https://marketplace.visualstudio.com/items?itemName=voorjaar.windicss-intellisense
MIT License
194 stars 16 forks source link

This extension blocks the outline view of large markdown files #464

Open vibl opened 1 year ago

vibl commented 1 year ago

This extension blocks the outline view of large markdown files.

I have no idea why...

All I can say is that the Extension Bisect feature of VSCode proved that this extension was the culprit.

alexanderniebuhr commented 1 year ago

Please add more information.

vibl commented 1 year ago

To recap the issue: when this extension is the only one activated (all others are deactivated), the Outline View becomes excessively slow for large markdown files: the VSCode threads goes 100% CPU (core) for a few minutes and the Outline View is stuck displaying "Loading document symbols..."

Here are some more information below.

Feel free to ask for more specific information.

Extension version: WindiCSS Intellisense v0.21.6

VSCode About page

Version: 1.73.1 Commit: 6261075646f055b99068d3688932416f2346dd3b Date: 2022-11-09T03:54:53.913Z Electron: 19.0.17 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Linux x64 5.15.0-52-generic Sandboxed: No

vibl commented 1 year ago

Here is an example of a big markdown file (with many headings): https://gist.github.com/vibl/3f5a98990c7155669d98de36a2724bb7

mrm007 commented 1 year ago

I can share my own experience, with a large JavaScript file. I went a step further and recorded a profile of the extension. The biggest culprit seems to be this RegExp:

https://github.com/windicss/windicss-intellisense/blob/5c0adbdcf083efad5e6da8775dde841b4b4b8db5/src/utils/parser.ts#L87

image

You can download the CPU profile I recorded, extract it from zip and load it in VS Code or any Chrome DevTools: extension host.zip

alexanderniebuhr commented 1 year ago

@mrm007 thank you so much. I hope to get the token issue sorted soon. If that is an option for you, could you share the JavaScript file with me, you can also do this privately in Discord. I could use to test an update.

mrm007 commented 1 year ago

@alexanderniebuhr I certainly can — it's the biggest of the Vite 4 chunks and it's around 2MB in size.

You can install vite@4.0.1 locally or you can clone this repo and navigate to node_modules/.pnpm/vite@4.0.1/node_modules/vite/dist/node/chunks/dep-2285ba4f.js. That's actually how I encountered the issue: it was making the CodeTour I recorded very slow/unresponsive.

mrm007 commented 1 year ago

Somewhat related, if you or anyone knows a way to disable extensions based on path (e.g. node_modules) that would be great. This StackOverflow answer from 5 years ago suggests there isn't such a mechanism in VS Code (and it's up to extensions to provide a way to deactivate), but things might have changed in the mean time.