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

Fix Converting circular structure to JSON Error in tree-view #5661

Merged
merged 2 commits into from
Jul 17, 2019
Merged

Conversation

vinokurig
Copy link
Contributor

@vinokurig vinokurig commented Jul 8, 2019

What it does

Pass id to tree item command arguments like in vscode:

https://github.com/microsoft/vscode/blob/c5cdf50e1708b962382821e782746b06c4cdf53b/src/vs/workbench/api/common/extHostTreeViews.ts#L455

https://github.com/microsoft/vscode/blob/c5cdf50e1708b962382821e782746b06c4cdf53b/src/vs/workbench/api/common/extHostCommands.ts#L236

fixes eclipse-che/che#13790

How to test

  1. Download vscode github pull-request plugin to the theia's plugins directory (create the directory in the root if not present)
  2. Download vscode git extension to the theia's plugins directory (create the directory in the root if not present)
  3. Remove theia's git extension in the examples/browser/package.json
  4. build and start theia
  5. Open a workspace with project cloned from github and contains pull requests
    WRONG: pull request items don't expand

Review checklist

  • as an author, I have thoroughly tested my changes and carefully reviewed in accordance with the review guideline

Reminder for reviewers

  • each approve has supporting comments in accordance with the review guideline
  • the approve without a comment should be dismissed

@akosyakov
Copy link
Member

Please rewrite the description with the following template:

<!--
Thank you for your Pull Request. Please provide a description and review
the requirements below.

Contributors guide: https://github.com/theia-ide/theia/blob/master/CONTRIBUTING.md
-->

#### What it does
<!-- Include relevant issues and describe how they are addressed. -->

#### How to test
<!-- Explain how a reviewer can reproduce a bug, test new functionality or verify perf improvements.  -->

#### Review checklist

- [ ] as an author, I have thoroughly tested my changes and carefully reviewed in accordance with [the review guideline](https://github.com/theia-ide/theia/pull/5616/files#diff-195a635ad245ded9076330e31134bd80R18)

#### Reminder for reviewers

- each approve has supporting comments in accordance with [the review guideline](https://github.com/theia-ide/theia/pull/5616/files#diff-195a635ad245ded9076330e31134bd80R18)
- the approve without a comment should be dismissed

@akosyakov akosyakov added the vscode issues related to VSCode compatibility label Jul 9, 2019
@akosyakov
Copy link
Member

@tetchel does it address #5666? Could you verify?

@tetchel

This comment has been minimized.

@tetchel
Copy link
Contributor

tetchel commented Jul 9, 2019

This appears to resolve #5666, though the commands still don't work on-click (but that is a separate issue).

@akosyakov
Copy link
Member

I cannot get how to test section to work. I'm using this branch for testing. Also removed Theia git extension and installed vscode git extension. It should be necessary @vinokurig?

I'm getting following errors in the console:

Uncaught (in promise) TypeError: Cannot read property 'getAPI' of undefined
    at new t.BuiltinGitProvider (/tmp/vscode-unpacked/vscode-pull-request-github-0.8.0.vsix/extension/media/extension.js:36)
    at Object.t.registerBuiltinGitProvider (/tmp/vscode-unpacked/vscode-pull-request-github-0.8.0.vsix/extension/media/extension.js:36)
    at /tmp/vscode-unpacked/vscode-pull-request-github-0.8.0.vsix/extension/media/extension.js:36
    at Generator.next (<anonymous>)
    at /tmp/vscode-unpacked/vscode-pull-request-github-0.8.0.vsix/extension/media/extension.js:36
    at new Promise (<anonymous>)
    at n (/tmp/vscode-unpacked/vscode-pull-request-github-0.8.0.vsix/extension/media/extension.js:36)
    at t.activate (/tmp/vscode-unpacked/vscode-pull-request-github-0.8.0.vsix/extension/media/extension.js:36)
    at PluginManagerExtImpl.<anonymous> (/workspace/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:328)
    at step (/workspace/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:47)

Should I do something else?

@vinokurig
Copy link
Contributor Author

@akosyakov Yes, you are right, I forgot to say about the vscode git extension, updated the description.
Looks like the error that you have mentioned is occurred with latest changes, it is not reproduced before 906c4fe. I'll investigate and create an issue.

@akosyakov
Copy link
Member

@vinokurig looking as well, can be that git extension is not activated before pr review extension

@akosyakov
Copy link
Member

akosyakov commented Jul 12, 2019

There is a mismatch between vscode and theia plugin APIs: - no see #5661 (comment)

With activation events vscode extensions are getting promises instead of extensions. Where are 2 ways to go about it:

  • either align API which is a breaking change for theia plugins
  • or activate plugins only when its dependencies are activated

cc @benoitf @evidolob what will be better?

@akosyakov
Copy link
Member

Sorry there is no mismatch, confused Plugin with Promise. We need to activate dependencies as well when activation of an extension happens. I will push a commit to this PR.

@akosyakov
Copy link
Member

@vinokurig please try again, i've pushed a fix to activate dependencies before activating a plugin

@akosyakov
Copy link
Member

I cannot make this extension work in Gitpod. It asked for authentication but bogus GitHub page is opening. Trying locally...

@akosyakov
Copy link
Member

Locally I'm getting a new error:

hosted-plugin.ts:20 Uncaught (in promise) TypeError: Cannot read property 'packageJSON' of undefined
    at new t.Telemetry (:3000/private/var/folders/5w/jw7jf9m97mb17ygz25fr1rd40000gp/T/vscode-unpacked/vscode-pull-request-github-0.8.0.vsix/extension/media/extension.js:36)
    at :3000/private/var/folders/5w/jw7jf9m97mb17ygz25fr1rd40000gp/T/vscode-unpacked/vscode-pull-request-github-0.8.0.vsix/extension/media/extension.js:36
    at Generator.next (<anonymous>)
    at :3000/private/var/folders/5w/jw7jf9m97mb17ygz25fr1rd40000gp/T/vscode-unpacked/vscode-pull-request-github-0.8.0.vsix/extension/media/extension.js:36
    at new Promise (<anonymous>)
    at n (:3000/private/var/folders/5w/jw7jf9m97mb17ygz25fr1rd40000gp/T/vscode-unpacked/vscode-pull-request-github-0.8.0.vsix/extension/media/extension.js:36)
    at t.activate (:3000/private/var/folders/5w/jw7jf9m97mb17ygz25fr1rd40000gp/T/vscode-unpacked/vscode-pull-request-github-0.8.0.vsix/extension/media/extension.js:36)
    at PluginManagerExtImpl.<anonymous> (:3000/Users/kosyakov/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:362)
    at step (:3000/Users/kosyakov/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:47)
    at Object.next (:3000/Users/kosyakov/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:28)

@akosyakov
Copy link
Member

akosyakov commented Jul 12, 2019

Is there a simple plugin to verify a change? cc @vinokurig I cannot get it work, since it expect to sign in from VS Code and does not seem to allow from other IDE, i.e. we provide theia as env schema and the VS Code PR server does not seem to handle it well. I mean this code https://github.com/microsoft/vscode-pull-request-github/blob/08b9811ce54e8f225307398f6fb08128c53959dc/src/authentication/githubServer.ts#L16-L19

@akosyakov
Copy link
Member

@tetchel Could you provide how to you verify it? I would like to check it again, cannot do it with the PR extension.

@tetchel
Copy link
Contributor

tetchel commented Jul 15, 2019

I'm using my extension https://github.com/eclipse/codewind-vscode without the workaround I put in here eclipse-archived/codewind-vscode@92b5683

@vinokurig
Copy link
Contributor Author

@akosyakov Sorry for the late response

Is there a simple plugin to verify a change? cc @vinokurig

Unfortunately I don't now a simpler way to reproduce the bug.

I cannot get it work, since it expect to sign in from VS Code and does not seem to allow from other IDE, i.e. we provide theia as env schema and the VS Code PR server does not seem to handle it well. I mean this code https://github.com/microsoft/vscode-pull-request-github/blob/08b9811ce54e8f225307398f6fb08128c53959dc/src/authentication/githubServer.ts#L16-L19

You can authenticate via GitHub token, The plugin provides a command: GitHub Pull Requests: Manually Provide Authentication Response

@vinokurig please try again, i've pushed a fix to activate dependencies before activating a plugin

I've tested the latest changes with GitHub PR Plugin and the bug didn't reproduce.

@akosyakov
Copy link
Member

akosyakov commented Jul 16, 2019

@vinokurig ok

I've tried with GitHub Pull Requests: Manually Provide Authentication Response as well. Somehow did not work for me.

Anyway since @tetchel can confirm that it is gone i will approve your part.

We need to get rid of merge commits (rebase should be used to pick up changes), and add a comment in the code for #5661 (review).

@tetchel
Copy link
Contributor

tetchel commented Jul 16, 2019

It worries me that you can't verify the fix, I will put together a simple plugin for verification later today

@tetchel
Copy link
Contributor

tetchel commented Jul 16, 2019

I've put together a sample for reproducing this: https://github.com/tetchel/vscode-extension-samples/tree/theia-5561/tree-view-sample

there is a built vsix there you may use.

I edited the File Explorer sample to pass an object to its treeitems' command which contains circular references, which is what causes #5666. You can see that against master this breaks the treeview (the files don't appear when the directories are expanded).
image

In the logs:

root ERROR [hosted-plugin: 91137] Promise rejection not handled in one second: TypeError: Converting circular structure to JSON
root ERROR [hosted-plugin: 91137] With stack trace: TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at Function.MessageFactory.replyOK (/Users/tim/programs/clones/theia/packages/plugin-ext/lib/api/rpc-protocol.js:280:103)
    at /Users/tim/programs/clones/theia/packages/plugin-ext/lib/api/rpc-protocol.js:158:51
    at process._tickCallback (internal/process/next_tick.js:68:7)

After building from this PR, it works again.

image

So this does fix #5666 :)

@tetchel
Copy link
Contributor

tetchel commented Jul 16, 2019

I should clarify that clicking/double-clicking the tree items still does not invoke the command, but again that is a separate issue.

Signed-off-by: Igor Vinokur <ivinokur@redhat.com>
@vinokurig
Copy link
Contributor Author

Merged master, fixed conflicts.
GitHub plugin works fine now:
screenshot-localhost-3000-2019 07 17-09-46-57

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

I've verified that:

  • converting circular structure JSON error is gone with @tetchel example, thank you for an example ❤️
  • pull request extension is activated after git extension activation

@akosyakov
Copy link
Member

Let's merge it today if build is green and no one objects.

@akosyakov
Copy link
Member

Please merge

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.

Tree nodes don't expand in the GitHub plugin
5 participants