mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-06-13 07:10:26 +08:00
Merge pull request #111 from Microsoft/ext-docs-webview
Update webview sample for Sample Guideline for #110
This commit is contained in:
5
webview-sample/.prettierrc.json
Normal file
5
webview-sample/.prettierrc.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"useTabs": true,
|
||||
"printWidth": 120,
|
||||
"singleQuote": true
|
||||
}
|
||||
8
webview-sample/.vscode/extensions.json
vendored
Normal file
8
webview-sample/.vscode/extensions.json
vendored
Normal file
@ -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"
|
||||
]
|
||||
}
|
||||
33
webview-sample/.vscode/launch.json
vendored
33
webview-sample/.vscode/launch.json
vendored
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Run Extension",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
|
||||
"outFiles": ["${workspaceFolder}/out/**/*.js"],
|
||||
"preLaunchTask": "npm: watch"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
2
webview-sample/.vscode/settings.json
vendored
2
webview-sample/.vscode/settings.json
vendored
@ -1,3 +1,3 @@
|
||||
{
|
||||
"typescript.tsc.autoDetect": "off"
|
||||
"editor.insertSpaces": false
|
||||
}
|
||||
34
webview-sample/.vscode/tasks.json
vendored
34
webview-sample/.vscode/tasks.json
vendored
@ -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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch",
|
||||
"problemMatcher": "$tsc-watch",
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||

|
||||
|
||||
## 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+
|
||||
|
||||
BIN
webview-sample/demo.gif
Normal file
BIN
webview-sample/demo.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 MiB |
@ -5,8 +5,7 @@
|
||||
"outDir": "out",
|
||||
"lib": ["es6"],
|
||||
"sourceMap": true,
|
||||
"rootDir": ".",
|
||||
"strict": true
|
||||
"rootDir": "src"
|
||||
},
|
||||
"exclude": ["node_modules", ".vscode-test"]
|
||||
}
|
||||
|
||||
7
webview-sample/tslint.json
Normal file
7
webview-sample/tslint.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"rules": {
|
||||
"indent": [true, "tabs"],
|
||||
"quotemark": [true, "single"],
|
||||
"semicolon": [true, "always"]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user