Skip to content

Commit 5fc0eb8

Browse files
#149 added data.preview.remote command shortcut
for loading remote data files (http only for now)
1 parent 7f1d88e commit 5fc0eb8

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,16 @@ Data Preview 🈸 example using `dark` UI theme with `d3fc` Charts 📊 Data Vie
7171

7272
## Data Preview 🈸 Launch Tips
7373

74-
1. Run `View -> Command Palette...>Data: Preview Data 🈸` command or `Ctrl+Shift+D` in an open
74+
1. Run `View -> Command Palette...>Data: Preview Data` command or `Ctrl+Shift+D` in an open
7575
`.json` `.config` `.env` `.properties` `.ini` `.yml` or `.csv/.tsv` text data file document to launch Data Preview panel.
7676
2. `File -> Save` (`Ctrl+S`) your text data file for immediate updates in an open Data Preview 🈸 panel.
7777
3. Right-click on a Binary `.xlsx/.xlsb`, `.arrow` or `.avro` data file in VSCode File Explorer to launch Data Preview panel.
7878
4. Use exposed `explorer/context`, `editor/title` or `editor/title/context` Preview Data 🈸 or Preview Data on Side context menu options to preview your data files.
7979
5. Click on the Data View Filename toolbar link to Load saved Data View Grid || Chart 📊 `.config`.
8080
6. Click on the Data View 🈸 icon to Launch new Data Preview Panel for new view config changes.
8181
7. Use Open Data File or URL 📤 option from Data View toolbar to launch new Data Preview 🈸.
82+
8. Run `View -> Command Palette...>Data: Preview Remote Data` command or `Ctrl+Shift+R`
83+
to launch Data Preview for remote `http(s)` data files.
8284

8385
![Data Preview Open Data File](https://github.com/RandomFractals/vscode-data-preview/blob/master/images/vscode-data-preview-open-file.png?raw=true
8486
"Data Preview Open Data File")

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@
246246
"light": "./images/data-preview-side.svg",
247247
"dark": "./images/data-preview-side-dark.svg"
248248
}
249+
},
250+
{
251+
"command": "data.preview.remote",
252+
"title": "Preview Remote Data",
253+
"category": "Data"
249254
}
250255
],
251256
"keybindings": [
@@ -256,6 +261,10 @@
256261
{
257262
"command": "data.preview.on.side",
258263
"key": "ctrl+alt+s d"
264+
},
265+
{
266+
"command": "data.preview.remote",
267+
"key": "ctrl+shift+r"
259268
}
260269
],
261270
"menus": {

src/extension.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ export function activate(context: ExtensionContext) {
5555
createDataPreviewCommand('data.preview.on.side', 'data.preview', extensionPath, dataViewTemplate);
5656
context.subscriptions.push(dataWebviewOnSide);
5757

58+
// add Preview Remote data command
59+
const dataWebviewRemote: Disposable = commands.registerCommand('data.preview.remote', () => {
60+
window.showInputBox({
61+
ignoreFocusOut: true,
62+
placeHolder: 'https://',
63+
prompt: 'Enter remote data url'
64+
}).then((dataUrl: string) => {
65+
if (dataUrl && dataUrl !== undefined && dataUrl.length > 0) {
66+
const dataUri: Uri = Uri.parse(dataUrl);
67+
// launch new data preview
68+
commands.executeCommand('data.preview', dataUri);
69+
}
70+
});
71+
});
72+
context.subscriptions.push(dataWebviewRemote);
73+
5874
// refresh associated preview on data file save
5975
workspace.onDidSaveTextDocument((document: TextDocument) => {
6076
if (isDataFile(document)) {

0 commit comments

Comments
 (0)