vscode-code-runner icon indicating copy to clipboard operation
vscode-code-runner copied to clipboard

'Run Code (Ctrl+Alt+N)' fails when the workspace has no folder opened

Open raphaelnova opened this issue 7 years ago • 2 comments

  • VS Code Version: 1.30.1
  • OS Version: Windows_NT x64 10.0.17134
  • Code Runner Version: 0.9.5

Describe the bug The command 'Run Code' fails when there's a workspace open, but it has no folders opened.

To Reproduce Steps to reproduce the behavior:

  1. Open VS Code
  2. Open or create a new Workspace, click on 'Add Folder' and add any folder to it.
  3. Close all folders by right-clicking them and selecting 'Remove Folder from Workspace'
  4. Try running any code with Ctrl+Alt+N

Actual behavior The command seems to fail silently, but it outputs a stacktrace to 'Log (Window)' in the Output tab of the terminal window

[2019-01-07 23:57:23.564] [renderer1] [error] Cannot read property 'uri' of undefined: TypeError: Cannot read property 'uri' of undefined
    at CodeManager.getWorkspaceFolder (C:\Users\raphaelnova\.vscode\extensions\formulahendry.code-runner-0.9.5\out\src\codeManager.js:149:57)
    at CodeManager.initialize (C:\Users\raphaelnova\.vscode\extensions\formulahendry.code-runner-0.9.5\out\src\codeManager.js:120:38)
    at CodeManager.<anonymous> (C:\Users\raphaelnova\.vscode\extensions\formulahendry.code-runner-0.9.5\out\src\codeManager.js:46:18)
    at Generator.next (<anonymous>)
    at __awaiter (C:\Users\raphaelnova\.vscode\extensions\formulahendry.code-runner-0.9.5\out\src\codeManager.js:7:71)
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\raphaelnova\.vscode\extensions\formulahendry.code-runner-0.9.5\out\src\codeManager.js:3:12)
    at CodeManager.run (C:\Users\raphaelnova\.vscode\extensions\formulahendry.code-runner-0.9.5\out\src\codeManager.js:27:16)
    at vscode.commands.registerCommand (C:\Users\raphaelnova\.vscode\extensions\formulahendry.code-runner-0.9.5\out\src\extension.js:11:21)
    at e._executeContributedCommand (c:\Users\raphaelnova\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:501:455)
    at e.$executeContributedCommand (c:\Users\raphaelnova\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:502:6)
    at t._doInvokeHandler (c:\Users\raphaelnova\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:658:837)
    at t._invokeHandler (c:\Users\raphaelnova\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:658:509)
    at t._receiveRequest (c:\Users\raphaelnova\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:657:126)
    at t._receiveOneMessage (c:\Users\raphaelnova\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:656:59)
    at c:\Users\raphaelnova\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:653:895
    at c:\Users\raphaelnova\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:130:793
    at e.fire (c:\Users\raphaelnova\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:133:218)
    at a (c:\Users\raphaelnova\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:186:147)
    at Socket.n._socketDataListener (c:\Users\raphaelnova\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:186:368)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:594:20)

raphaelnova avatar Jan 08 '19 02:01 raphaelnova

I've got the same issue.

jdemovic avatar Jun 28 '19 06:06 jdemovic

I've got the same issue. I'm running the latest versions of VS Code (1.52.1 at the moment) and Code-Runner (0.11.1). I am able to reproduce this issue with no other extensions installed and no customizations done to Code-Runner settings. Even the simple "Run Custom Command" fails with the configuration specified (when there is an open workspace with no folders opened).

caparkaya avatar Dec 21 '20 14:12 caparkaya