-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Supporting creating a new document virtually #272
Comments
@cfjedimaster The idea is that you can register for a URI-scheme, like Those document must not be able to be saved and can be readonly by some mechanism (TBD). Will that be enough for your needs? |
Sure. |
Idea is to allow to contribute content (?) provider, like so
|
Open would require a uri? Does that mean I'd need to save the text locally first? |
no, it's more to allow to define your own space using a scheme, like so |
Ok... I kinda get it. :) I'd love to test this when possible. Let me know. |
I will keep you in the loop once we sketch out the API for this. |
I would love this feature as well :) |
Optimistically scheduling this for Jan ;-) |
I'd love to see this feature happen! Since the Markdown preview is being used as an example, does this mean we'd be able to return HTML as content and have it be rendered correctly for rich output? cc @dfinke |
Unsure what you mean by output, but a goal is to allow others to generate markdown and have it shown/previewed in VS Code |
Sorry, the term 'output' was a little vague :) To rephrase, I'm asking if this would allow a content provider to return arbitrary (within reason) HTML to be rendered. For example, if I create a mode for editing TODO list files with a special text format, it'd be nice if I could register a content provider that can render some nicely-formatted overview details for the user's TODO items. Returning Markdown to be rendered could also work but would be less flexible. |
Hmm, I'd keep it "agnostic". Make the "view" a HTML view so I can send Basically - make it a web view and I can send whatever I want. On Tue, Jan 5, 2016 at 9:25 AM, Johannes Rieken notifications@github.com
Raymond Camden, Developer Advocate for MobileFirst at IBM Email : raymondcamden@gmail.com |
One possibility could be someone editing a CSV file and the VS Code extension would take it as input, render it through d3.js creating a visual and displaying the resulting HTML in the view |
Great ideas. I will spin it around with the team. We do have a Markdown_Editor_ and a HTML_Editor_ so it shouldn't be too hard. |
It allows things like |
|
Being able to pass the view HTML to render would be great, as I'd like to make a extension similar to the Markdown one, which would render ReStructuredText in the preview mode just like parkdown does. |
One potential requirement for this feature is that the content provider should be able to get notifications to refresh itself. @jrieken's proposed API doesn't include that yet, but is it possible that this could be enabled as well? |
@daviwil that or the other way around where the provider emits an event to tell the editor to refresh. That would cover the case of |
The mechanics to create a virtual document are in, the preview/render html command is tracked in #1946 |
Feature request: API support for making a virtual document preview-only. This would allow extensions an easy way to provide a mostly-seamless GUI using an HTML preview and web sockets. (Allowing javascript calls directly between the HTML preview and extension might also be nice...) |
@siegebell If you mean 'readonly' by preview then you are ok |
@jrieken no, I mean preview-only: there is a "preview" button at the top-right of a document that allows the user to toggle between preview or code view. I am requesting that this button and its keybinding optionally be disabled so that a [virtual] document is stuck in preview mode. Use case I am developing a vscode extension for the Coq Proof Assistant, which allows the user to manually step through each line of their proof scipt and see how their hypotheses and proof obligations change. Such interaction falls outside the debug and compilation metaphor that vscode supports in its interface, so I need to write a custom interface to display this information. Ideally, vscode would provide me an API to write my own interface extensions. Until it does, I've found a nearly sufficient alternative: display an HTML document in preview mode that interacts with my extension using web sockets to display information as the user steps through their proof. It is even interactive. Virtual read-only documents will make this easier. But if "toggle preview" is still enabled, the user may accidentally switch to the HTML code and become confused. Since viewing the underlying code is of no use to the user, I am requesting that the API provide me a way of:
|
no worries, with the new html preview part there is no toggle botton but it will show the path of the URI. having said that, the preview mechanism isn't designed to be a UI extension API. While you can render html and run scripts you should not go crazy in there. The updating (when a document emits a change event) is not built/tested for high frequency of changes |
I believe that this is now implemented in the Insider build. By any chance is there a sample extension that demonstrates this? |
@jrieken suggest to add a sample in https://github.com/Microsoft/vscode-extension-samples |
@cfjedimaster As long as we don't have a sample you should check with our api-test: https://github.com/Microsoft/vscode/blob/master/extensions/vscode-api-tests/src/commands.test.ts#L42 |
Hmm, I appreciate the link, but it doesn't make much sense to me yet how I On Fri, Feb 5, 2016 at 3:01 AM, Johannes Rieken notifications@github.com
Raymond Camden, Developer Advocate for MobileFirst at IBM Email : raymondcamden@gmail.com |
I've added a sample that illustrates how to use |
Thank you - will give this a shot! On Tue, Feb 9, 2016 at 4:30 PM, Erich Gamma notifications@github.com
Raymond Camden, Developer Advocate for MobileFirst at IBM Email : raymondcamden@gmail.com |
Should this work in the most recent mainline release? I'm getting errors Activating extension On Wed, Feb 10, 2016 at 7:17 AM, Raymond Camden raymondcamden@gmail.com
Raymond Camden, Developer Advocate for MobileFirst at IBM Email : raymondcamden@gmail.com |
Forgot to run npm install - sorry about that. On Wed, Feb 10, 2016 at 7:49 AM, Raymond Camden raymondcamden@gmail.com
Raymond Camden, Developer Advocate for MobileFirst at IBM Email : raymondcamden@gmail.com |
I've also published the sample to the market place just in case. |
WOOT! I have it working. I'm kinda guessing at a few things and it is 99% Quick question. This line:
vscode.Uri.parse('css-preview://authority/css-preview'); How would you describe that URI? This is what I went with but I was just
vscode.Uri.parse('html-escape://cfjedimaster/html-escape'); On Wed, Feb 10, 2016 at 8:04 AM, Erich Gamma notifications@github.com
Raymond Camden, Developer Advocate for MobileFirst at IBM Email : raymondcamden@gmail.com |
Cool that it worked for you.
This looks good to me, you define your own URI scheme |
So 100% of the string is - basically - whatever we want? Well, within reason, and named something at least similar to what it is doing? |
Yes, as long as it properly identifies the resource and conforms to an URI. |
@cfjedimaster I ran My extension stills says here is no exported member I'm missing a step somewhere |
Emphasized the missing step to update the engines field in the release notes. |
Extensions should be able to create a new panel/document and open it in the editor, much like how markdown preview does.
The text was updated successfully, but these errors were encountered: