pucelle / vscode-css-navigation

Allowing Go to definition from HTML to CSS, or Find References from CSS to HTML.
https://marketplace.visualstudio.com/items?itemName=pucelle.vscode-css-navigation
MIT License
64 stars 8 forks source link

Request textDocument/completion failed - .asar files #38

Closed s4m0r4m4 closed 3 years ago

s4m0r4m4 commented 4 years ago

Hello, I use VS Code for electron development and I have this extension installed. Electron creates very large files in the "dist" directory that have the ".asar" extension.

Periodically, the extension will throw an error: [Error - 1:40:23 PM] Request textDocument/definition failed. Message: Request textDocument/definition failed with message: Invalid package c:...\dist...\app.asar (path truncated) Code: -32603

This seemed odd, as I'd like this extension to not care about anything in the "dist" folder. I made sure that the following setting was in my VS Code Workspace file:

  "CSSNavigation.excludeGlobPatterns": [
            "**/node_modules/**",
            "**/bower_components/**",
            "**/vendor/**",
            "**/coverage/**",
            "**/dist/**"
        ]

If I select a CSS style in an html file and do "Find All References", the extension throws the same error as above and does not return any results.

For some reason the extension is searching through the dist folder when it should not be, given my settings above. Is there a setting I'm missing or is this a bug?

pucelle commented 4 years ago

Hi, s4m0r4m4, would you mind to upload your code examples here? This plugin have a mechanism to load some files force, but it's hard to diagnose what's happening without codes.

pucelle commented 4 years ago

Try to removes sensitive codes and only leaves the minimum codes which can reproduce this issue.

s4m0r4m4 commented 4 years ago

Hi @pucelle, thanks for your response. The problem with creating a reproducible example is that the .asar files (created by electron) contain a ton of sensitive code that I cannot release. But at the end of the day, they're just really large text files.

I created a simple repo to get us started: https://github.com/s4m0r4m4/css-test. Note the CSS Extension exclude list in the VS code workspace file.

If I open the repo, the CSS extension works as expected: it provides F12 navigation for test-class but not this-should-not-appear (because it is in the workspace CSS extension exclude list). Now, if drop a large (~300 MB) text file in the dist folder (which is not in the git repo, you'll have to add one locally), the CSS extension doesn't even start up when I open VS code (or sometimes it just takes a really long time, >1 minute). I would expect that the CSS extension would completely ignore the dist folder (since it's in the exclude list) so it wouldn't care what I put in there, but clearly it has some impact. I believe this is the issue that is causing the bug - it seems that the extension still scans excluded folders for some purpose, and this scan bogs down the extension when large text files are present. The expected behavior is that the extension would completely ignore excluded directories and files.

pucelle commented 4 years ago

Thanks, s4m0r4m4, I'm a little busy these days, I will check it later.

pucelle commented 3 years ago

I just released v1.10.1, and this issue may be same with #44.

s4m0r4m4 commented 3 years ago

I haven't seen the issue since upgrading, so I imagine it is indeed fixed. I can reopen this if I see the issue again.