atishay / vscode-allautocomplete

Autocomplete from open files for VSCode
MIT License
105 stars 25 forks source link

Getting "Unexpected Active Doc. Parsing broken" #9

Closed NimaiMalle closed 7 years ago

NimaiMalle commented 7 years ago

First of all, thank you for your work on this extension! I'm trying it with JavaScript files, and have just two files open. One is a small file of 250 lines or so. The other is a large min.js file with over 14,000 lines. When I switch between these two open files, the allaotocomplete extension logs "Unexpected Active Doc. Parsing broken". I also notice that some words in the large min.js file don't come up for suggestion. I'm able to compile and debug your extension, but I'm not sure what to try next. Please let me know if you have any suggestions.

atishay commented 7 years ago

That message occurs when changes occur in non-active documents, normally happens when the file changes outside of VSCode, like say a git revert or branch change. That case is currently not handled in all-autocomplete. I can work on fixing that for a future version.

There is a parameter: AllAutocomplete.maxLines, which defines how many lines to cutoff the search for a file. It defaults to 9999. You can increase this in settings if you want more lines from the minified file.

NimaiMalle commented 7 years ago

I see. I'm not sure why the file would have been changed externally. It would report this every time I switch between the two tabs. When I had it in the debugger, it looked like the fileName property was actually different in the window.activeTextEditor.document and e.document objects.

atishay commented 7 years ago

I will try out the case and report back to you with the findings.

atishay commented 7 years ago

I figures out the cause of the exception. When a document is switched to a "dirty" document (One that has not been saved), before sending the event for document switch, vscode send the changed event blank changes. I don't know why that event is sent. I have added code to not forward in the special case. I am not publishing an update to the extension as this is not a user impacting bug (it recovers when the actual switch event is received).

@NimaiMalle Did you face any other issue that prompted you to get into this code?

atishay commented 7 years ago

Closing as there is no response.