Skip to content
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

Exception in developer tools console #1245

Closed
dbaeumer opened this issue Nov 13, 2017 · 8 comments
Closed

Exception in developer tools console #1245

dbaeumer opened this issue Nov 13, 2017 · 8 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service

Comments

@dbaeumer
Copy link
Member

  • VSCode Version: Code - Insiders 1.19.0-insider (d6fbdcf19716910b26ea81efc95724f2fabe5aa6, 2017-11-10T05:17:03.030Z)
  • OS Version: Windows_NT x64 10.0.16299
  • Extensions:
Extension Author (truncated) Version
vscode-svgviewer css 1.4.3
vscode-eslint dba 1.4.3
githistory don 0.2.3
tslint eg2 1.0.21
vsc-travis-ci-status fel 1.1.0
azure-account ms- 0.2.2
cpptools ms- 0.14.2
csharp ms- 1.13.0
debugger-for-chrome msj 3.5.0
vscode-docker Pet 0.0.21
vscode-versionlens pfl 0.19.1
vscode-icons rob 7.17.0
vscode-open-in-github ziy 1.2.9

Found the following exception in the developer console editing C# files

[ms-vscode.cpptools] Cannot read property 'document' of undefined: TypeError: Cannot read property 'document' of undefined
	at onDidChangeTextEditorSelection (C:\Users\dirkb\.vscode-insiders\extensions\ms-vscode.cpptools-0.14.2\out\src\LanguageServer\extension.js:93:94)
	at e.invoke (c:\Program Files\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:84567)
	at e.fire (c:\Program Files\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:86289)
	at e.$acceptSelectionsChanged (c:\Program Files\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:481928)
	at t.e.invoke (c:\Program Files\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:509569)
	at e._invokeHandler (c:\Program Files\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:354716)
	at e._receiveOneMessage (c:\Program Files\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:354406)
	at c:\Program Files\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:353433
	at c:\Program Files\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:355352
	at c:\Program Files\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:85284
	at e.invoke (c:\Program Files\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:84567)
	at e.fire (c:\Program Files\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:86289)
	at Socket.<anonymous> (c:\Program Files\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:4:144597)
	at emitOne (events.js:96:13)
	at Socket.emit (events.js:191:7)
	at readableAddChunk (_stream_readable.js:178:18)
	at Socket.Readable.push (_stream_readable.js:136:10)
	at Pipe.onread (net.js:560:20)
@bobbrow
Copy link
Member

bobbrow commented Nov 13, 2017

Thanks. I have a fix for this. We expected the vscode.window.activeTextEditor to be valid at this point. For some reason it it not. Shouldn't the active text editor be valid before we are notified of selection changed events? You may also want to take this back to the VS Code team for an investigation.

@bobbrow bobbrow added bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service labels Nov 13, 2017
@dbaeumer
Copy link
Member Author

@jrieken can you please comment.

@jrieken
Copy link
Member

jrieken commented Nov 14, 2017

We expected the vscode.window.activeTextEditor to be valid at this point. For some reason it it not

@bobbrow Inside the event, are you using window.activeTextEditor or TextEditorSelectionChangeEvent.editor?

@bobbrow
Copy link
Member

bobbrow commented Nov 14, 2017

@jrieken, we use both. The code is doing an early exit if the editor in the event is not the active window.

    if (!event.textEditor || event.textEditor.document.uri !== vscode.window.activeTextEditor.document.uri ||
        (event.textEditor.document.languageId !== "cpp" && event.textEditor.document.languageId !== "c"))
        return;

@jrieken
Copy link
Member

jrieken commented Nov 14, 2017

@jrieken, we use both.

Please don't... Selections can change for any editor, not just the active editor.

@bobbrow
Copy link
Member

bobbrow commented Nov 14, 2017

How does one go about changing the selection if the editor is not active?

@jrieken
Copy link
Member

jrieken commented Nov 14, 2017

Programmatically, e.g window.visibleTextEditors[someIndexWhichIsNotActive].selection = someNewSelection and the equivalent thing on the main side

@bobbrow
Copy link
Member

bobbrow commented Nov 28, 2017

This should be fixed with version 0.14.3

@bobbrow bobbrow closed this as completed Nov 28, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

3 participants