Skip to content

Commit acdd584

Browse files
committed
Proposed API sample. Fix microsoft/vscode#33358
1 parent c6afbbb commit acdd584

File tree

10 files changed

+3648
-0
lines changed

10 files changed

+3648
-0
lines changed

proposed-api-sample/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
out
2+
node_modules
3+
.vscode-test/
4+
*.vsix
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
"name": "Run Extension",
9+
"type": "extensionHost",
10+
"request": "launch",
11+
"runtimeExecutable": "${execPath}",
12+
"args": [
13+
// "--enable-proposed-api",
14+
"--extensionDevelopmentPath=${workspaceFolder}"
15+
],
16+
"outFiles": [
17+
"${workspaceFolder}/out/**/*.js"
18+
],
19+
"preLaunchTask": "npm: watch"
20+
}
21+
]
22+
}
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+
}

proposed-api-sample/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Proposed API Sample
2+
3+
This is a sample illustrating how to use [Proposed API](https://vscode-ext-docs.azurewebsites.net/api/advanced-topics/using-proposed-api) in VS Code. It is adapted from the [Hello Code Sample](/hellocode-sample).
4+
5+
The proposed API being used is `vscode.env.clipboard.readText()`. See details here: https://github.com/Microsoft/vscode/issues/217#issuecomment-433963587.
6+
7+
## VS Code API
8+
9+
### Proposed API
10+
11+
- [`env.clipboard`](https://github.com/Microsoft/vscode/blob/master/src/vs/vscode.proposed.d.ts#L49)
12+
- [`Clipboard.readText`](https://github.com/Microsoft/vscode/blob/master/src/vs/vscode.proposed.d.ts#L44)
13+
14+
## Running the Sample
15+
16+
This sample runs on VS Code Insider with commit [4626bc0e1b679d555dd6f034ece35ffc394b3bb7](https://github.com/Microsoft/vscode/commit/4626bc0e1b679d555dd6f034ece35ffc394b3bb7). If VS Code updated the Clipboard API in the future, you must re-download [`vscode.proposed.d.ts`](https://github.com/Microsoft/vscode/blob/master/src/vs/vscode.proposed.d.ts) to `src/vscode.proposed.d.ts` and update your API usage accordingly.
17+
18+
- Run `npm install` in terminal to install dependencies
19+
- Run the `Run Extension` target in the Debug View. This will:
20+
- Start a task `npm: watch` to compile the code
21+
- Run the extension in a new VS Code window

proposed-api-sample/demo.gif

846 KB
Loading

0 commit comments

Comments
 (0)