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

Make default API VS Code API #10199

Merged
merged 1 commit into from
Oct 19, 2021

Conversation

tsmaeder
Copy link
Contributor

@tsmaeder tsmaeder commented Sep 30, 2021

Signed-off-by: Thomas Mäder [email protected]

What it does

Fixes VSCode default API is Theia API #10190

How to test

  1. Clone https://github.com/tsmaeder/extension-tests-runner and check out branch "remove_che_references"
  2. yarn compile the package to create the compiled test files
  3. add the precompiled vsix to your theia installation
  4. Start Theia and invoke the command "Run VSCode Extension's Tests from extension"
  5. Observe: some tests run and a results file opens in an editor
  6. Invoke the command "Run VSCode Extension's Tests from folder"
  7. A folder selection dialog opens: select the cloned folder from step 1)
  8. Observe: you should get the same result as in step 4). Without this fix, an exception occurs:
root ERROR [hosted-plugin: 10360] Could not identify plugin for 'Theia' require call from C:\Users\thomas\code\chedev\extension-tests-runner\out\test\suite\extension.test.js
root INFO [hosted-plugin: 10360] --------------------------------
root INFO [hosted-plugin: 10360] FAILURE: Extension Test Suite Sample test -- error: Cannot read property 'getExtension' of undefined
root INFO [hosted-plugin: 10360] FINISH: 0/1
root INFO [hosted-plugin: 10360] Error: 1 tests failed.
    at c:\Users\thomas\AppData\Local\Temp\vscode-unpacked\test-runner-0.0.1.vsix\extension\out\extension.js:56:23
    at done (c:\Users\thomas\AppData\Local\Temp\vscode-unpacked\test-runner-0.0.1.vsix\extension\node_modules\mocha\lib\mocha.js:843:7)
...

Review checklist

Reminder for reviewers

Signed-off-by: Thomas Mäder <[email protected]>
@vinokurig
Copy link
Contributor

When I run the "Run VSCode Extension's Tests from extension" command, an error appears:

root INFO [hosted-plugin: 67500] Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at doWrite (_stream_writable.js:399:19)
    at writeOrBuffer (_stream_writable.js:387:5)
    at WriteStream.Writable.write (_stream_writable.js:318:11)
    at Runner.<anonymous> (/Users/ivinokur/projects/theia/plugins/extension-tests-runner/out/test-reporter.js:40:25)
    at Runner.emit (events.js:326:22)
    at /Users/ivinokur/projects/theia/plugins/extension-tests-runner/node_modules/mocha/lib/runner.js:903:12
    at Runner.runSuite (/Users/ivinokur/projects/theia/plugins/extension-tests-runner/node_modules/mocha/lib/runner.js:717:12)
    at start (/Users/ivinokur/projects/theia/plugins/extension-tests-runner/node_modules/mocha/lib/runner.js:901:10)
    at Runner.run (/Users/ivinokur/projects/theia/plugins/extension-tests-runner/node_modules/mocha/lib/runner.js:930:5)
    at Mocha.run (/Users/ivinokur/projects/theia/plugins/extension-tests-runner/node_modules/mocha/lib/mocha.js:847:17) {
  code: 'ERR_STREAM_DESTROYED'
}

@tsmaeder
Copy link
Contributor Author

tsmaeder commented Oct 6, 2021

@vinokurig it's entirely possible that the test reporter stuff is bogus: it's not production quality and not meant to be: what this PR is fixing is that the plugin test can obtain a vscode namespace and that it is indeed a vscode API, not a Theia API.

Copy link
Contributor

@vinokurig vinokurig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I managed to see some output from the test plugin, which means that the API works.

@tsmaeder tsmaeder merged commit 8bf1697 into eclipse-theia:master Oct 19, 2021
@vince-fugnitto vince-fugnitto added this to the 1.19.0 milestone Oct 19, 2021
@vince-fugnitto vince-fugnitto added the vscode issues related to VSCode compatibility label Oct 19, 2021
@colin-grant-work
Copy link
Contributor

Thanks, @tsmaeder - we've recently seen a case of this problem, as well, and you've saved us having to fix it ourselves :-).

@tsmaeder
Copy link
Contributor Author

tsmaeder commented Oct 27, 2021

@colin-grant-work I live to serve ;-). Would be interested to know in what context the problem occurred.

@colin-grant-work
Copy link
Contributor

@tsmaeder, it occurred when one of our users had symlinked their user settings / plugins folder to somewhere else in their file system. I think that must have created a mismatch between the filename stored in the API map and the filename that was seen when the extension actually tried to load vscode, so the plugin was sent down the fallback API path.

federicobozzini pushed a commit to ARMmbed/theia that referenced this pull request Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants