-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Autocomplete failing with "Cannot read property 'document' of undefined" #584
Comments
TextEditorSelectionChangeEvent.textEditor is undefined for some reason. It shouldn't happen. You could modify the javascript to check for undefined as a workaround. It would be nice to know how you're reproing this. We could change our code to protect against the undefined textEditor in a future update. Or maybe vscode.window.activeTextEditor is undefined ...looks like it could repro if the selection changes without a text editor active? |
The repro case here is pretty straightforward, just opening any given C file breaks the autocomplete feature. Regular autocomplete/quick suggestions works after updating to 0.10.5 though, seems like it works when that setting is set to the "Disabled" flag now; makes me think this might be related to #572? That said, I now get a second stack trace in my console, seen below:
|
We're not able to repro the bug, so it sounds like another extension could be interfering. Can you show the results of |
Here's the output of that command:
|
That list seems good enough. I can repro a similar error message when I run our extension under the "Toggle Developer Tools": 6 months ago this was "by design" as a workaround to get VS Code to skip our completion results (which have nothing when disabled) and show other completion providers instead of a blank completion list. However, it's possible there is a better way to deal with this now via unregistering ourselves as a completion provider. But normal users should not be seeing this internal error, so I suspect one of your extensions is exposing it. You should be able to safely ignore it. Do you experience any other functionality not working as a result? |
I don't run in to any issues with that specific bug, no. I needed to add |
Okay, I couldn't get the original issue to repro even with all your extensions -- I assume I have to configure one of the extensions a particular way to cause the undefined textEditor. Although this doesn't seem like expected behavior, we can just add undefined checks in a future update to be safe. If you disabled your extensions, maybe you could find the one that is causing the repro. |
...okay, so here's where things get weird. First off, this snippet made its way into my user settings file by what I identified after experimentation to be the install script for "[cpp]": {
"editor.quickSuggestions": false
},
"[c]": {
"editor.quickSuggestions": false
} That totally disables code suggestions, which obviously would break the feature. Whoo. After deleting the new setting entries things worked fine with no console errors. Either way, the problem is resolved now, but that still leaves open the question about where the console error was coming from... |
If If you are using the Clang extension for autocomplete, you should set the |
Okay so as @bobbrow says above adding |
This issue should be fixed with v0.11.0. Please let us know if it is not. |
Running into this issue that seems to be breaking all forms of autocomplete in C files, even with autocomplete set to "Disabled"
The text was updated successfully, but these errors were encountered: