Skip to content

Fix CustomViews by switching to WebViews #1919

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

Merged

Conversation

TylerLeonhardt
Copy link
Member

PR Summary

I'm going to try to see if I can add a test or two... but this fixes the *-VSCodeHtmlContentView cmdlets. You are still able to pass in stylesheets and javascript and it will inline them.

Then, in order to refresh your view to get any js or css updates, just run the Show-VSCodeHtmlContentView cmdlet again and your changes will be reflected.

This also enables the persistent pages so if you click away from a view and come back, the state remains!

P.S. there seems to be some weird behavior when you close out of a view - we must not be cleaning up properly. This bug existed before this change... I might try to tackle it now.

PR Checklist

Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets.
Please mark anything not applicable to this PR NA.

  • PR has a meaningful title
  • Summarized changes
  • PR has tests
  • This PR is ready to merge and is not work in progress
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready

Copy link
Contributor

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

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

Don't know much about this, but the code looks good

Copy link
Contributor

@rkeithhill rkeithhill left a comment

Choose a reason for hiding this comment

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

LGTM.

@TylerLeonhardt TylerLeonhardt force-pushed the fix-vscode-custom-views branch from cae4fb4 to 0185ff6 Compare April 24, 2019 20:43
@TylerLeonhardt
Copy link
Member Author

Ok rewire is back but with it, comes 3 tests!

@TylerLeonhardt
Copy link
Member Author

Implementation has changed a bit - re-requested reviews

Copy link
Contributor

@rkeithhill rkeithhill left a comment

Choose a reason for hiding this comment

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

LGTM. Simpler. cleaner and now with tests!

// Setup types that are not exported.
const customViews = rewire("../../src/features/CustomViews");
const htmlContentViewClass = customViews.__get__("HtmlContentView");
const HtmlContentView: typeof htmlContentViewClass = htmlContentViewClass;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, this is cool!

Copy link
Member Author

Choose a reason for hiding this comment

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

It's like reflection but much more convoluted lol

Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

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

LGTM ❤️

@TylerLeonhardt TylerLeonhardt merged commit 82dbb16 into PowerShell:master Apr 26, 2019
@TylerLeonhardt TylerLeonhardt deleted the fix-vscode-custom-views branch April 26, 2019 19:48
TylerLeonhardt added a commit to TylerLeonhardt/vscode-powershell that referenced this pull request Apr 26, 2019
TylerLeonhardt added a commit to TylerLeonhardt/vscode-powershell that referenced this pull request Apr 26, 2019
TylerLeonhardt added a commit that referenced this pull request Apr 29, 2019
* Cherry Pick #1919: Fix CustomViews by switching to WebViews

* Fix error in HtmlContentView.ShowContent when no JS/CSS provided (#1925)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants