diff --git a/webview-sample/.prettierrc.json b/webview-sample/.prettierrc.json new file mode 100644 index 00000000..c090136a --- /dev/null +++ b/webview-sample/.prettierrc.json @@ -0,0 +1,5 @@ +{ + "useTabs": true, + "printWidth": 120, + "singleQuote": true +} \ No newline at end of file diff --git a/webview-sample/.vscode/extensions.json b/webview-sample/.vscode/extensions.json new file mode 100644 index 00000000..438b19d0 --- /dev/null +++ b/webview-sample/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "eg2.tslint", + "esbenp.prettier-vscode" + ] +} \ No newline at end of file diff --git a/webview-sample/.vscode/launch.json b/webview-sample/.vscode/launch.json index 8e89e0e7..461f3da0 100644 --- a/webview-sample/.vscode/launch.json +++ b/webview-sample/.vscode/launch.json @@ -1,19 +1,18 @@ // A launch configuration that compiles the extension and then opens it inside a new window +// Use IntelliSense to learn about possible attributes. +// Hover to view descriptions of existing attributes. +// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 { - "version": "0.1.0", - "configurations": [ - { - "name": "Launch Extension", - "type": "extensionHost", - "request": "launch", - "runtimeExecutable": "${execPath}", - "args": [ - "--extensionDevelopmentPath=${workspaceRoot}" - ], - "stopOnEntry": false, - "sourceMaps": true, - "outDir": "${workspaceRoot}/out/src", - "preLaunchTask": "npm: watch" - } - ] -} \ No newline at end of file + "version": "0.2.0", + "configurations": [ + { + "name": "Run Extension", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": ["--extensionDevelopmentPath=${workspaceRoot}"], + "outFiles": ["${workspaceFolder}/out/**/*.js"], + "preLaunchTask": "npm: watch" + } + ] +} diff --git a/webview-sample/.vscode/settings.json b/webview-sample/.vscode/settings.json index fe4def97..8d047dad 100644 --- a/webview-sample/.vscode/settings.json +++ b/webview-sample/.vscode/settings.json @@ -1,3 +1,3 @@ { - "typescript.tsc.autoDetect": "off" + "editor.insertSpaces": false } \ No newline at end of file diff --git a/webview-sample/.vscode/tasks.json b/webview-sample/.vscode/tasks.json index 604e38f5..3b17e53b 100644 --- a/webview-sample/.vscode/tasks.json +++ b/webview-sample/.vscode/tasks.json @@ -1,20 +1,20 @@ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format { - "version": "2.0.0", - "tasks": [ - { - "type": "npm", - "script": "watch", - "problemMatcher": "$tsc-watch", - "isBackground": true, - "presentation": { - "reveal": "never" - }, - "group": { - "kind": "build", - "isDefault": true - } - } - ] -} \ No newline at end of file + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "watch", + "problemMatcher": "$tsc-watch", + "isBackground": true, + "presentation": { + "reveal": "never" + }, + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/webview-sample/README.md b/webview-sample/README.md index cd112016..ae3bccd0 100644 --- a/webview-sample/README.md +++ b/webview-sample/README.md @@ -13,6 +13,17 @@ Demonstrates VS Code's [webview API](https://code.visualstudio.com/docs/extensio - Saving and restoring state when the panel goes into the background. - Serialization and persistence across VS Code reboots. +## Demo + +![demo](demo.gif) + +## VS Code API + +### `vscode` module + +- [`window.createWebviewPanel`](https://code.visualstudio.com/docs/extensionAPI/vscode-api#window.createWebviewPanel) +- [`window.registerWebviewPanelSerializer`](https://code.visualstudio.com/docs/extensionAPI/vscode-api#window.registerWebviewPanelSerializer) + ## Running the example - Open this example in VS Code 1.25+ diff --git a/webview-sample/demo.gif b/webview-sample/demo.gif new file mode 100644 index 00000000..13b39b44 Binary files /dev/null and b/webview-sample/demo.gif differ diff --git a/webview-sample/tsconfig.json b/webview-sample/tsconfig.json index 67641a1d..a374c9aa 100644 --- a/webview-sample/tsconfig.json +++ b/webview-sample/tsconfig.json @@ -5,8 +5,7 @@ "outDir": "out", "lib": ["es6"], "sourceMap": true, - "rootDir": ".", - "strict": true + "rootDir": "src" }, "exclude": ["node_modules", ".vscode-test"] } diff --git a/webview-sample/tslint.json b/webview-sample/tslint.json new file mode 100644 index 00000000..f10fd18c --- /dev/null +++ b/webview-sample/tslint.json @@ -0,0 +1,7 @@ +{ + "rules": { + "indent": [true, "tabs"], + "quotemark": [true, "single"], + "semicolon": [true, "always"] + } +} \ No newline at end of file