add welcome view content sample

fixes #402
This commit is contained in:
João Moreno
2021-07-19 16:09:29 +02:00
parent 547dd0bb35
commit 6fcbb099a2
10 changed files with 2100 additions and 0 deletions

View File

@ -0,0 +1,19 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
}
}

View File

@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint"
]
}

View File

@ -0,0 +1,28 @@
// 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.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
}
]
}

View File

@ -0,0 +1,11 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}

View File

@ -0,0 +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
}
}
]
}

View File

@ -0,0 +1,14 @@
# Welcome view content
This sample demonstrates how to implement welcome view content, which gets displayed in certain views whenever they are empty.
Run the sample and run `Close Workspace`. In the _no workspace_ window, go to the Explorer. You'll see the content contributed via the `package.json` declaration.
## Running the Sample
- Open this example in VS Code Insiders
- `npm install`
- `npm run watch`
- `F5` to start debugging
- Run the `Workspaces: Close Workspace` command
- Open the Explorer view

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,51 @@
{
"name": "welcome-view-content-sample",
"publisher": "vscode-samples",
"description": "Uri Handler Sample",
"version": "0.0.1",
"engines": {
"vscode": "^1.46.0"
},
"categories": [
"Other"
],
"activationEvents": [
"onCommand:welcome-view-content-sample.hello"
],
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "welcome-view-content-sample.hello",
"title": "Hello World!"
}
],
"viewsWelcome": [
{
"view": "workbench.explorer.emptyView",
"contents": "You can have paragraphs of text here. You can have [links](https://code.visualstudio.com) to external sources or [internal commands](command:welcome-view-content-sample.hello).\nUse new lines to have new paragraphs.\nPlace a link alone in a paragraph to make it a button\n[Hello](command:welcome-view-content-sample.hello)"
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js"
},
"devDependencies": {
"@types/glob": "^7.1.3",
"@types/mocha": "^8.0.4",
"@types/node": "^12.11.7",
"@types/vscode": "^1.46.0",
"@typescript-eslint/eslint-plugin": "^4.9.0",
"@typescript-eslint/parser": "^4.9.0",
"@vscode/test-electron": "^1.6.1",
"eslint": "^7.15.0",
"glob": "^7.1.6",
"mocha": "^8.1.3",
"typescript": "^4.1.2"
}
}

View File

@ -0,0 +1,14 @@
import * as vscode from 'vscode';
export function activate(context: vscode.ExtensionContext) {
let disposable = vscode.commands.registerCommand(
'welcome-view-content-sample.hello',
async () => {
vscode.window.showInformationMessage('Hello world!');
}
);
context.subscriptions.push(disposable);
}
export function deactivate() {}

View File

@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "out",
"lib": [
"es6"
],
"sourceMap": true,
"rootDir": "src",
"strict": true /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
},
"exclude": [
"node_modules",
".vscode-test"
]
}