-
Notifications
You must be signed in to change notification settings - Fork 9
Notebooks
⚠️ ⚠️ ⚠️ NOTICE: This is a feature, which is currently under development!⚠️ ⚠️ ⚠️
Since version 1.57, Visual Studio Code supports an API for custom notebooks.
Power Tools uses the .egobook
extension for its own notebook files.
To create a new notebook, simple create a blank file with a .egobook
extension.
- JavaScript (default)
- CoffeeScript
Handles data as string and add a HTML tables of the data, if it returned.
// https://support.staffbase.com/hc/de/articles/360007108391-Beispiele-f%C3%BCr-CSV-Dateien
const csvData = `Username; Identifier;First name;Last name
booker12;9012;Rachel;Booker
grey07;2070;Laura;Grey
johnson81;4081;Craig;Johnson
jenkins46;9346;Mary;Jenkins
smith79;5079;Jamie;Smith`;
return $csv(csvData); // must be returned, if it should be displayed
Does a HTTP DELETE
request and returns the data directly, if status code is less than 400.
// body and headers are optional
const responseData = await $delete('https://api.example.com/getFoo', 'This is a string body', {
'x-my-header1': 'tm+mk'
});
Does a HTTP GET
request and returns the data directly, if status code is less than 400.
// headers are optional
const responseData = await $get('https://api.example.com/getFoo', {
'x-my-header1': 'tm+mk'
});
Does a HTTP PATCH
request and returns the data directly, if status code is less than 400.
// body and headers are optional
const responseData = await $patch('https://api.example.com/getFoo', 'This is a string body', {
'x-my-header1': 'tm+mk'
});
Does a HTTP POST
request and returns the data directly, if status code is less than 400.
// body and headers are optional
const responseData = await $post('https://api.example.com/getFoo',
Buffer.from('This is a binary body', 'utf8')
, {
'x-my-header1': 'tm+mk'
});
Does a HTTP PUT
request and returns the data directly, if status code is less than 400.
// body and headers are optional
const responseData = await $put('https://api.example.com/getFoo',
Buffer.from('This is a binary body', 'utf8')
, {
'x-my-header1': 'tm+mk'
});
Does a HTTP request and returns an AxiosResponse.
// headers are optional
const response1 = await $request('GET', 'https://api.example.com/getFoo', {
'x-my-header1': 'tm+mk'
});
// headers and body are optional
const response2 = await $request('POST', 'https://api.example.com/postBar', {
'bodyProp1': 5979,
'bodyProp2': '23979'
}, {
'x-my-header1': 'tm+mk'
});
Includes a module from the extension context, what means, that you can use any module, which is shipped with the extension.
const moment = $require('moment');
const now = moment();
Sets Markdown content, by converting it to HTML output.
$setMarkdown(`# My output
As GitHub markdown`);
Sets HTML output.
$setHtml('My output as <em><strong>HTML</strong></em>');
Sets text output.
$setText('My output as text');
Converts any value to a string, that is not (null)
and not (undefined)
.
$str(0); // '0'
$str(null); // ''
$str(undefined); // ''
Unsets a value, which is stored as metadata in the notebook.
$unset('myValue');
Gets or sets a value, which should be stored as metadata in the notebook.
// get value
const myValue = $val('myValue');
// set value
//
// (undefined) would unset the value
await $val('myValue', 5979);
Name | Description |
---|---|
_ |
lodash |
$axios |
axios |
$fs |
fs-extra |
$helpers |
vscode-helpers |
$moment |
Moment.js |
$vscode |
Visual Studio Code API |
licensed under GDFL 1.3 - © Next.e.GO Mobile SE