Skip to content

Supporting creating a new document virtually #272

Closed

Description

Extensions should be able to create a new panel/document and open it in the editor, much like how markdown preview does.

Activity

  1. added
    feature-request
    on Nov 24, 2015
  2. jrieken commented on Nov 24, 2015

    @jrieken
    Contributor

    Raymond Camden (@cfjedimaster) The idea is that you can register for a URI-scheme, like foo and that someone will ask you provide the contents for foo://something/anotherthing when a corresponding call to openTextDocument is made.

    Those document must not be able to be saved and can be readonly by some mechanism (TBD). Will that be enough for your needs?

  3. cfjedimaster commented on Nov 24, 2015

    @cfjedimaster
    Author

    Sure.

  4. jrieken commented on Dec 22, 2015

    @jrieken
    Contributor

    Idea is to allow to contribute content (?) provider, like so

    interface TextDocumentContentProvider {
      open(uri:Uri):Thenable<string|Buffer>;
      close(uri:Uri):Thenable<any>;
    }
    
    registerTextDocumentProvider(scheme | pattern, provider);
    
  5. cfjedimaster commented on Dec 22, 2015

    @cfjedimaster
    Author

    Open would require a uri? Does that mean I'd need to save the text locally first?

  6. jrieken commented on Dec 22, 2015

    @jrieken
    Contributor

    no, it's more to allow to define your own space using a scheme, like so myextension://project1/path/to/fake/resource would be a valid Uri and it would be up to you to resolve that somehow, like deriving info from a dll-file or generated markup.

  7. cfjedimaster commented on Dec 22, 2015

    @cfjedimaster
    Author

    Ok... I kinda get it. :) I'd love to test this when possible. Let me know.

  8. jrieken commented on Dec 23, 2015

    @jrieken
    Contributor

    I will keep you in the loop once we sketch out the API for this.

  9. DickvdBrink commented on Dec 29, 2015

    @DickvdBrink
    Contributor

    I would love this feature as well :)

  10. 33 remaining items

  11. egamma commented on Feb 9, 2016

    @egamma
    Member

    I've added a sample that illustrates how to use TextContentProviders and the vscode.previewHtml commands.

    Pls see: https://github.com/Microsoft/vscode-extension-samples/blob/master/textdocumentprovider-sample/README.md

  12. cfjedimaster commented on Feb 10, 2016

    @cfjedimaster
    Author

    Thank you - will give this a shot!

    On Tue, Feb 9, 2016 at 4:30 PM, Erich Gamma [email protected]
    wrote:

    I've added a sample that illustrates how to use TextContentProviders and
    the vscode.previewHtml commands.

    Pls see:
    https://github.com/Microsoft/vscode-extension-samples/blob/master/textdocumentprovider-sample/README.md

    —
    Reply to this email directly or view it on GitHub
    #272 (comment).

    Raymond Camden, Developer Advocate for MobileFirst at IBM

    Email : [email protected]
    Blog : www.raymondcamden.com
    Twitter: raymondcamden

  13. cfjedimaster commented on Feb 10, 2016

    @cfjedimaster
    Author

    Should this work in the most recent mainline release? I'm getting errors
    when I try it:

    Activating extension eg2.vscode-css-properties failed: Cannot find module
    '/Users/raymondcamden/Downloads/vscode-extension-samples-master/textdocumentprovider-sample/out/src/extension'.
    Activating extension eg2.vscode-css-properties failed: Cannot find
    module
    '/Users/raymondcamden/Downloads/vscode-extension-samples-master/textdocumentprovider-sample/out/src/extension'

    On Wed, Feb 10, 2016 at 7:17 AM, Raymond Camden [email protected]
    wrote:

    Thank you - will give this a shot!

    On Tue, Feb 9, 2016 at 4:30 PM, Erich Gamma [email protected]
    wrote:

    I've added a sample that illustrates how to use TextContentProviders and
    the vscode.previewHtml commands.

    Pls see:
    https://github.com/Microsoft/vscode-extension-samples/blob/master/textdocumentprovider-sample/README.md

    —
    Reply to this email directly or view it on GitHub
    #272 (comment).

    Raymond Camden, Developer Advocate for MobileFirst at IBM

    Email : [email protected]
    Blog : www.raymondcamden.com
    Twitter: raymondcamden

    Raymond Camden, Developer Advocate for MobileFirst at IBM

    Email : [email protected]
    Blog : www.raymondcamden.com
    Twitter: raymondcamden

  14. cfjedimaster commented on Feb 10, 2016

    @cfjedimaster
    Author

    Forgot to run npm install - sorry about that.

    On Wed, Feb 10, 2016 at 7:49 AM, Raymond Camden [email protected]
    wrote:

    Should this work in the most recent mainline release? I'm getting errors
    when I try it:

    Raymond Camden, Developer Advocate for MobileFirst at IBM

    Email : [email protected]
    Blog : www.raymondcamden.com
    Twitter: raymondcamden

  15. egamma commented on Feb 10, 2016

    @egamma
    Member

    I've also published the sample to the market place just in case.

  16. cfjedimaster commented on Feb 10, 2016

    @cfjedimaster
    Author

    WOOT! I have it working. I'm kinda guessing at a few things and it is 99%
    your code still, but it is there. I literally just need to polish it up a
    bit and then I can publish mine too. :) Thank you so much.

    Quick question. This line:

    var previewUri =
    

    vscode.Uri.parse('css-preview://authority/css-preview');

    How would you describe that URI? This is what I went with but I was just
    guessing:

    let previewUri =
    

    vscode.Uri.parse('html-escape://cfjedimaster/html-escape');

    On Wed, Feb 10, 2016 at 8:04 AM, Erich Gamma [email protected]
    wrote:

    I've also published the sample to the market place just in case.

    —
    Reply to this email directly or view it on GitHub
    #272 (comment).

    Raymond Camden, Developer Advocate for MobileFirst at IBM

    Email : [email protected]
    Blog : www.raymondcamden.com
    Twitter: raymondcamden

  17. egamma commented on Feb 10, 2016

    @egamma
    Member

    Cool that it worked for you.

    vscode.Uri.parse('html-escape://cfjedimaster/html-escape');

    This looks good to me, you define your own URI scheme html-escape and all the rest is yours.

  18. cfjedimaster commented on Feb 10, 2016

    @cfjedimaster
    Author

    So 100% of the string is - basically - whatever we want? Well, within reason, and named something at least similar to what it is doing?

  19. egamma commented on Feb 10, 2016

    @egamma
    Member

    Yes, as long as it properly identifies the resource and conforms to an URI.

  20. dfinke commented on Feb 10, 2016

    @dfinke

    Raymond Camden (@cfjedimaster) I ran yo code and updated the package devDependencies for ^0.11.x, also added a "postinstall": "node ./node_modules/vscode/bin/install". Ran npm install.

    My extension stills says here is no exported member TextDocumentContentProvider.

    I'm missing a step somewhere

  21. egamma commented on Feb 11, 2016

    @egamma
    Member

    Emphasized the missing step to update the engines field in the release notes.

  22. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apifeature-request

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions