Skip to content

Commit abe95c8

Browse files
committed
2 parents af9cba7 + b45728d commit abe95c8

File tree

10 files changed

+4738
-0
lines changed

10 files changed

+4738
-0
lines changed

uri-handler-sample/.eslintrc.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"ecmaVersion": 6,
6+
"sourceType": "module"
7+
},
8+
"plugins": [
9+
"@typescript-eslint"
10+
],
11+
"rules": {
12+
"@typescript-eslint/naming-convention": "warn",
13+
"@typescript-eslint/semi": "warn",
14+
"curly": "warn",
15+
"eqeqeq": "warn",
16+
"no-throw-literal": "warn",
17+
"semi": "off"
18+
}
19+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"dbaeumer.vscode-eslint"
6+
]
7+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": [
13+
"--extensionDevelopmentPath=${workspaceFolder}"
14+
],
15+
"outFiles": [
16+
"${workspaceFolder}/out/**/*.js"
17+
],
18+
"preLaunchTask": "${defaultBuildTask}"
19+
},
20+
{
21+
"name": "Extension Tests",
22+
"type": "extensionHost",
23+
"request": "launch",
24+
"args": [
25+
"--extensionDevelopmentPath=${workspaceFolder}",
26+
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
27+
],
28+
"outFiles": [
29+
"${workspaceFolder}/out/test/**/*.js"
30+
],
31+
"preLaunchTask": "${defaultBuildTask}"
32+
}
33+
]
34+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": false // set this to true to hide the "out" folder with the compiled JS files
5+
},
6+
"search.exclude": {
7+
"out": true // set this to false to include "out" folder in search results
8+
},
9+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10+
"typescript.tsc.autoDetect": "off"
11+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "watch",
9+
"problemMatcher": "$tsc-watch",
10+
"isBackground": true,
11+
"presentation": {
12+
"reveal": "never"
13+
},
14+
"group": {
15+
"kind": "build",
16+
"isDefault": true
17+
}
18+
}
19+
]
20+
}

uri-handler-sample/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Uri Handlers
2+
3+
This sample demonstrates how to implement a Uri handler in VS Code.
4+
A Uri handler is run when a browser redirects to VS Code with a specific extension id as the authority.
5+
6+
Examples:
7+
8+
* `vscode://vscode-samples.uri-handler-sample`
9+
* `vscode-insiders://vscode-samples.uri-handler-sample`
10+
11+
If you paste these Uris into your browser, they will open VS Code and VS Code insiders, respectively.
12+
13+
This sample provides a simple Uri handler that shows an information message when a Uri is handled.
14+
Additionally, if a query string was included in the Uri, it will include that in the message.
15+
16+
Run the sample and try opening the following Uris in your browser:
17+
18+
* `vscode://vscode-samples.uri-handler-sample`
19+
* `vscode://vscode-samples.uri-handler-sample?q=hello`
20+
21+
> Note: use `vscode-insiders://` if you ran the sample in insiders.
22+
23+
## VS Code API
24+
25+
This sample uses following APIs
26+
27+
### APIs
28+
29+
- `window.registerUriHandler`
30+
- `env.uriScheme`
31+
- `env.asExternalUri`
32+
- `UriHandler`
33+
34+
> Be sure to look at the [API Docs](https://code.visualstudio.com/api/references/vscode-api) for usage.
35+
36+
## Running the Sample
37+
38+
- Open this example in VS Code Insiders
39+
- `npm install`
40+
- `npm run watch`
41+
- `F5` to start debugging
42+
- Run the `Start handling Uris` command

0 commit comments

Comments
 (0)