Visual Studio Code extension that includes offline HTML - visual-studio-code

Is it possible for a VSCode extension to include HTML that are written to disk somewhere (doesn't matter where) when the extension is installed, so that I can then open that HTML from links?
E.g. I want a link to the offline documentation for a function in its tooltip.

Yes, your extension can use the standard node apis to download the files. Then you can:
Use the standard VS Code apis to open the file as a text document
Use the markdown.showPreview command to open the file as a html preview in VS Code:
import * as vscode from 'vscode';
vscode.commands.executeCommand('markdown.showPreview', vscode.Uri.parse('file:///Users/you/path/to/file.html'));
Use node apis to open the file in the user's standard web browser (again using the file: uri)

Related

VS Code: Deep Linking Extensions

I'm working on a VS code extension and would like to create a deep link which opens a file side-by-side with an extension. Let's take the JSON editor extension as an example. Is it possible to create a link which opens a JSON file side-by-side with the editor window?
I'm aware of the following deep link pattern:
vscode://file/Users/d070350/test.process.json
Can I extend it somehow to open the JSON editor alongside the file?

Is it possible to write a binary file import extension for vs code?

I want to display some informations of a binary file in vs code.
Is it possible to write an extension for vs code, such that when selecting that file in the Explorer (or opening it directly) you see some text extracted from the binary file by that extension?
So the core functionality of that extension would be (simplified) a binary to text converter.
Any suggestions?
The VS Code team member has confirmed they do not have support for registering content providers for binary files in my issue.
I've inspected the workspace.onDidOpenTextDocument and window.onDidChangeActiveTextEditor APIs, but neither seems to be called when opening binary files.
Is there a way to display fallback content using registerTextDocumentContentProvider (or otherwise) for binary files?
That's why these types all carry Text in their names, TextEditor, TextDocument, etc. They can only handle textual, not binary data ;-)
No explanation as to why this works for PDFs, probably special-cased.

What is the correct way to import/require "vscode" inside the developer tools inside VS Code? [duplicate]

Is there any way to use variable vscode to get editor content just like Atom without writing Extension.
After getting editor content, I can do more things like:
Use Javascript to modify text literally
Custom format
vscode image
atom image
No. This is not supported.
You can use the extension API to extend VS Code. This API lets you get and modify editor contents

How to use variable vscode in Developer tools?

Is there any way to use variable vscode to get editor content just like Atom without writing Extension.
After getting editor content, I can do more things like:
Use Javascript to modify text literally
Custom format
vscode image
atom image
No. This is not supported.
You can use the extension API to extend VS Code. This API lets you get and modify editor contents

Tumblr development tools

I want to create Tumblr theme and ineteresting is there any IDE (Netbeans, Eclipse, PHPStorm) plugins or tools for development? Ideal is to preview my theme in browser without uploading it to Tumblr.
Thanks.
I found my own way to develop tumblr themes using PhpStorm (or possibly any other IDE) and avoid the manual copy pasting to see my updates. I wrote a simple javascript to execute in your browsers console (MIT licensed).
setInterval(function() {
jQuery.ajax('YOUR-URL-TO-THE-THEME-FILE', {cache: false}).success(function(html) {
var btn = jQuery("div[data-action='update_preview']").first();
if (html!=ace.edit('editor').getValue()) {
ace.edit('editor').setValue(html);
if (!btn.hasClass('disabled'))
btn.click()
}
});
},1000);
Howto:
Use JetBrains PhpStorm to edit your html theme file ( It is possible to use other editors, the only important thing is that the file has to be hosted on a (local or public) server. )
Click Open in browser in PhpStorm while viewing the file.
Your browser should open with an url like this: http://localhost:63342/TumblrTheme/index.html.
Paste this URL in the snippet above.
Open http://www.tumblr.com/customize/YOUR-BLOG-NAME.
Click Edit html.
Open your browsers javascript console.
Paste in the snippet above (remember changing the path to your theme file).
The preview now is auto-updated every second if the source has changed.
Published at this gist: https://gist.github.com/cmfcmf/7154536
In terms of resources there's a few that I've found.
TumblrThemr
Thimble
Tumblr Boilerplate
There's also a TextMate bundle although it's a few years old.
Developing for Tumblr is a bit of a pain, the way I do it is by setting up a test tumblr to use, reblogging or posting each post type that I want (photo, photoset, audio, text, etc.). I work on the HTML locally and get it set up how I want it to, until I know I can do pretty much everything I need to achieve via CSS alone. I then host any assets (CSS/JS/etc.) on my server, use the theme editor on my test theme to update the HTML, and then anything I need to do can just be done on my remote assets. If I need to edit the HTML I do it locally then paste it back into the theme editor.
It's not the nicest way of working, but I've done about 4 themes that way and it works okay for me.