mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-03-28 17:42:40 +01:00
Initial commit
This commit is contained in:
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
out
|
||||||
|
node_modules
|
||||||
|
.vscode-test/
|
||||||
|
*.vsix
|
||||||
7
.vscode/extensions.json
vendored
Normal file
7
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||||
|
// for the documentation about the extensions.json format
|
||||||
|
"recommendations": [
|
||||||
|
"ms-vscode.vscode-typescript-tslint-plugin"
|
||||||
|
]
|
||||||
|
}
|
||||||
36
.vscode/launch.json
vendored
Normal file
36
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
// 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",
|
||||||
|
"runtimeExecutable": "${execPath}",
|
||||||
|
"args": [
|
||||||
|
"--extensionDevelopmentPath=${workspaceFolder}"
|
||||||
|
],
|
||||||
|
"outFiles": [
|
||||||
|
"${workspaceFolder}/out/**/*.js"
|
||||||
|
],
|
||||||
|
"preLaunchTask": "npm: watch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Extension Tests",
|
||||||
|
"type": "extensionHost",
|
||||||
|
"request": "launch",
|
||||||
|
"runtimeExecutable": "${execPath}",
|
||||||
|
"args": [
|
||||||
|
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||||
|
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
|
||||||
|
],
|
||||||
|
"outFiles": [
|
||||||
|
"${workspaceFolder}/out/test/**/*.js"
|
||||||
|
],
|
||||||
|
"preLaunchTask": "npm: watch"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
11
.vscode/settings.json
vendored
Normal file
11
.vscode/settings.json
vendored
Normal 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"
|
||||||
|
}
|
||||||
20
.vscode/tasks.json
vendored
Normal file
20
.vscode/tasks.json
vendored
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
10
.vscodeignore
Normal file
10
.vscodeignore
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
.vscode/**
|
||||||
|
.vscode-test/**
|
||||||
|
out/test/**
|
||||||
|
src/**
|
||||||
|
.gitignore
|
||||||
|
vsc-extension-quickstart.md
|
||||||
|
**/tsconfig.json
|
||||||
|
**/tslint.json
|
||||||
|
**/*.map
|
||||||
|
**/*.ts
|
||||||
9
CHANGELOG.md
Normal file
9
CHANGELOG.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to the "vscode-hugo-taxonomy" extension will be documented in this file.
|
||||||
|
|
||||||
|
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
- Initial release
|
||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 Elio Struyf
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
65
README.md
Normal file
65
README.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# vscode-hugo-taxonomy README
|
||||||
|
|
||||||
|
This is the README for your extension "vscode-hugo-taxonomy". After writing up a brief description, we recommend including the following sections.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
|
||||||
|
|
||||||
|
For example if there is an image subfolder under your extension project workspace:
|
||||||
|
|
||||||
|
\!\[feature X\]\(images/feature-x.png\)
|
||||||
|
|
||||||
|
> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
If you have any requirements or dependencies, add a section describing those and how to install and configure them.
|
||||||
|
|
||||||
|
## Extension Settings
|
||||||
|
|
||||||
|
Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
This extension contributes the following settings:
|
||||||
|
|
||||||
|
* `myExtension.enable`: enable/disable this extension
|
||||||
|
* `myExtension.thing`: set to `blah` to do something
|
||||||
|
|
||||||
|
## Known Issues
|
||||||
|
|
||||||
|
Calling out known issues can help limit users opening duplicate issues against your extension.
|
||||||
|
|
||||||
|
## Release Notes
|
||||||
|
|
||||||
|
Users appreciate release notes as you update your extension.
|
||||||
|
|
||||||
|
### 1.0.0
|
||||||
|
|
||||||
|
Initial release of ...
|
||||||
|
|
||||||
|
### 1.0.1
|
||||||
|
|
||||||
|
Fixed issue #.
|
||||||
|
|
||||||
|
### 1.1.0
|
||||||
|
|
||||||
|
Added features X, Y, and Z.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
## Working with Markdown
|
||||||
|
|
||||||
|
**Note:** You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
|
||||||
|
|
||||||
|
* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux)
|
||||||
|
* Toggle preview (`Shift+CMD+V` on macOS or `Shift+Ctrl+V` on Windows and Linux)
|
||||||
|
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (macOS) to see a list of Markdown snippets
|
||||||
|
|
||||||
|
### For more information
|
||||||
|
|
||||||
|
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
|
||||||
|
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
|
||||||
|
|
||||||
|
**Enjoy!**
|
||||||
1209
package-lock.json
generated
Normal file
1209
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
71
package.json
Normal file
71
package.json
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
"name": "vscode-hugo-helpers",
|
||||||
|
"displayName": "vscode-hugo-helpers",
|
||||||
|
"description": "",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"publisher": "eliostruyf",
|
||||||
|
"engines": {
|
||||||
|
"vscode": "^1.37.0"
|
||||||
|
},
|
||||||
|
"categories": [
|
||||||
|
"Other"
|
||||||
|
],
|
||||||
|
"activationEvents": [
|
||||||
|
"onCommand:hugo.insertTags",
|
||||||
|
"onCommand:hugo.insertCategories",
|
||||||
|
"onCommand:hugo.createTag",
|
||||||
|
"onCommand:hugo.createCategory"
|
||||||
|
],
|
||||||
|
"main": "./out/extension.js",
|
||||||
|
"contributes": {
|
||||||
|
"configuration": {
|
||||||
|
"title": "Hugo: Helpers Configuration",
|
||||||
|
"properties": {
|
||||||
|
"hugo.taxonomy.tags": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "Specifies the tags which can be used for Hugo"
|
||||||
|
},
|
||||||
|
"hugo.taxonomy.categories": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "Specifies the categories which can be used for Hugo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"commands": [
|
||||||
|
{
|
||||||
|
"command": "hugo.insertTags",
|
||||||
|
"title": "Hugo: Insert tags"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "hugo.insertCategories",
|
||||||
|
"title": "Hugo: Insert categories"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "hugo.createTag",
|
||||||
|
"title": "Hugo: Create tag"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "hugo.createCategory",
|
||||||
|
"title": "Hugo: Create category"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"vscode:prepublish": "npm run compile",
|
||||||
|
"compile": "tsc -p ./",
|
||||||
|
"watch": "tsc -watch -p ./",
|
||||||
|
"pretest": "npm run compile",
|
||||||
|
"test": "node ./out/test/runTest.js"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/glob": "^7.1.1",
|
||||||
|
"@types/mocha": "^5.2.6",
|
||||||
|
"@types/node": "^10.12.21",
|
||||||
|
"@types/vscode": "^1.37.0",
|
||||||
|
"glob": "^7.1.4",
|
||||||
|
"mocha": "^6.1.4",
|
||||||
|
"typescript": "^3.3.1",
|
||||||
|
"tslint": "^5.12.1",
|
||||||
|
"vscode-test": "^1.0.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
55
src/commands/Hugo.ts
Normal file
55
src/commands/Hugo.ts
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
import * as vscode from 'vscode';
|
||||||
|
import { TaxonomyType } from "../models";
|
||||||
|
import { CONFIG_KEY, ACTION_TAXONOMY_TAGS, ACTION_TAXONOMY_CATEGORIES } from "../constants/settings";
|
||||||
|
|
||||||
|
export class Hugo {
|
||||||
|
|
||||||
|
public static async insert(type: TaxonomyType) {
|
||||||
|
const config = vscode.workspace.getConfiguration(CONFIG_KEY);
|
||||||
|
|
||||||
|
let options: vscode.QuickPickItem[] = [];
|
||||||
|
const configSetting = type === TaxonomyType.Tag ? ACTION_TAXONOMY_TAGS : ACTION_TAXONOMY_CATEGORIES;
|
||||||
|
const crntOptions = config.get(configSetting) as string[];
|
||||||
|
if (crntOptions && crntOptions.length > 0) {
|
||||||
|
options = crntOptions.map(o => ({
|
||||||
|
label: o
|
||||||
|
}) as vscode.QuickPickItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.length === 0) {
|
||||||
|
vscode.window.showInformationMessage(`No ${type === TaxonomyType.Tag ? "tags" : "categories"} configured.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectedOptions = await vscode.window.showQuickPick(options, {
|
||||||
|
placeHolder: `Select your ${type === TaxonomyType.Tag ? "tags" : "categories"} to insert`,
|
||||||
|
canPickMany: true
|
||||||
|
});
|
||||||
|
if (selectedOptions && selectedOptions.length > 0) {
|
||||||
|
const editor = vscode.window.activeTextEditor;
|
||||||
|
if (editor) {
|
||||||
|
await editor.edit(builder => {
|
||||||
|
builder.insert(editor.selection.start, selectedOptions.map(o => `"${o.label}"`).join(`, `));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async create(type: TaxonomyType) {
|
||||||
|
const newOption = await vscode.window.showInputBox({
|
||||||
|
prompt: `Insert the value of the ${type === TaxonomyType.Tag ? "tag" : "category"} that you want to add to your configuration.`,
|
||||||
|
placeHolder: `Name of the ${type === TaxonomyType.Tag ? "tag" : "category"}`
|
||||||
|
});
|
||||||
|
|
||||||
|
if (newOption) {
|
||||||
|
const config = vscode.workspace.getConfiguration(CONFIG_KEY);
|
||||||
|
const configSetting = type === TaxonomyType.Tag ? ACTION_TAXONOMY_TAGS : ACTION_TAXONOMY_CATEGORIES;
|
||||||
|
let options = config.get(configSetting) as string[];
|
||||||
|
if (!options) {
|
||||||
|
options = [];
|
||||||
|
}
|
||||||
|
options.push(newOption);
|
||||||
|
config.update(configSetting, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
src/commands/index.ts
Normal file
1
src/commands/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from './Hugo';
|
||||||
1
src/constants/index.ts
Normal file
1
src/constants/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from './settings';
|
||||||
4
src/constants/settings.ts
Normal file
4
src/constants/settings.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export const CONFIG_KEY = "hugo";
|
||||||
|
|
||||||
|
export const ACTION_TAXONOMY_TAGS = "taxonomy.tags";
|
||||||
|
export const ACTION_TAXONOMY_CATEGORIES = "taxonomy.categories";
|
||||||
29
src/extension.ts
Normal file
29
src/extension.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import * as vscode from 'vscode';
|
||||||
|
import { Hugo } from './commands';
|
||||||
|
import { TaxonomyType } from './models';
|
||||||
|
|
||||||
|
export function activate(context: vscode.ExtensionContext) {
|
||||||
|
|
||||||
|
let insertTags = vscode.commands.registerCommand('hugo.insertTags', () => {
|
||||||
|
Hugo.insert(TaxonomyType.Tag);
|
||||||
|
});
|
||||||
|
|
||||||
|
let insertCategories = vscode.commands.registerCommand('hugo.insertCategories', () => {
|
||||||
|
Hugo.insert(TaxonomyType.Category);
|
||||||
|
});
|
||||||
|
|
||||||
|
let createTag = vscode.commands.registerCommand('hugo.createTag', () => {
|
||||||
|
Hugo.create(TaxonomyType.Tag);
|
||||||
|
});
|
||||||
|
|
||||||
|
let createCategory = vscode.commands.registerCommand('hugo.createCategory', () => {
|
||||||
|
Hugo.create(TaxonomyType.Category);
|
||||||
|
});
|
||||||
|
|
||||||
|
context.subscriptions.push(insertTags);
|
||||||
|
context.subscriptions.push(insertCategories);
|
||||||
|
context.subscriptions.push(createTag);
|
||||||
|
context.subscriptions.push(createCategory);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deactivate() {}
|
||||||
4
src/models/TaxonomyType.ts
Normal file
4
src/models/TaxonomyType.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export enum TaxonomyType {
|
||||||
|
Tag = 1,
|
||||||
|
Category
|
||||||
|
}
|
||||||
1
src/models/index.ts
Normal file
1
src/models/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from './TaxonomyType';
|
||||||
23
src/test/runTest.ts
Normal file
23
src/test/runTest.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
|
import { runTests } from 'vscode-test';
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
try {
|
||||||
|
// The folder containing the Extension Manifest package.json
|
||||||
|
// Passed to `--extensionDevelopmentPath`
|
||||||
|
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
|
||||||
|
|
||||||
|
// The path to test runner
|
||||||
|
// Passed to --extensionTestsPath
|
||||||
|
const extensionTestsPath = path.resolve(__dirname, './suite/index');
|
||||||
|
|
||||||
|
// Download VS Code, unzip it and run the integration test
|
||||||
|
await runTests({ extensionDevelopmentPath, extensionTestsPath });
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to run tests');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
18
src/test/suite/extension.test.ts
Normal file
18
src/test/suite/extension.test.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import * as assert from 'assert';
|
||||||
|
import { before } from 'mocha';
|
||||||
|
|
||||||
|
// You can import and use all API from the 'vscode' module
|
||||||
|
// as well as import your extension to test it
|
||||||
|
import * as vscode from 'vscode';
|
||||||
|
// import * as myExtension from '../extension';
|
||||||
|
|
||||||
|
suite('Extension Test Suite', () => {
|
||||||
|
before(() => {
|
||||||
|
vscode.window.showInformationMessage('Start all tests.');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Sample test', () => {
|
||||||
|
assert.equal(-1, [1, 2, 3].indexOf(5));
|
||||||
|
assert.equal(-1, [1, 2, 3].indexOf(0));
|
||||||
|
});
|
||||||
|
});
|
||||||
37
src/test/suite/index.ts
Normal file
37
src/test/suite/index.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import * as path from 'path';
|
||||||
|
import * as Mocha from 'mocha';
|
||||||
|
import * as glob from 'glob';
|
||||||
|
|
||||||
|
export function run(): Promise<void> {
|
||||||
|
// Create the mocha test
|
||||||
|
const mocha = new Mocha({
|
||||||
|
ui: 'tdd',
|
||||||
|
});
|
||||||
|
mocha.useColors(true);
|
||||||
|
|
||||||
|
const testsRoot = path.resolve(__dirname, '..');
|
||||||
|
|
||||||
|
return new Promise((c, e) => {
|
||||||
|
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
|
||||||
|
if (err) {
|
||||||
|
return e(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add files to the test suite
|
||||||
|
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Run the mocha test
|
||||||
|
mocha.run(failures => {
|
||||||
|
if (failures > 0) {
|
||||||
|
e(new Error(`${failures} tests failed.`));
|
||||||
|
} else {
|
||||||
|
c();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
e(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
21
tsconfig.json
Normal file
21
tsconfig.json
Normal 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"
|
||||||
|
]
|
||||||
|
}
|
||||||
15
tslint.json
Normal file
15
tslint.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
"no-string-throw": true,
|
||||||
|
"no-unused-expression": true,
|
||||||
|
"no-duplicate-variable": true,
|
||||||
|
"curly": true,
|
||||||
|
"class-name": true,
|
||||||
|
"semicolon": [
|
||||||
|
true,
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"triple-equals": true
|
||||||
|
},
|
||||||
|
"defaultSeverity": "warning"
|
||||||
|
}
|
||||||
42
vsc-extension-quickstart.md
Normal file
42
vsc-extension-quickstart.md
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Welcome to your VS Code Extension
|
||||||
|
|
||||||
|
## What's in the folder
|
||||||
|
|
||||||
|
* This folder contains all of the files necessary for your extension.
|
||||||
|
* `package.json` - this is the manifest file in which you declare your extension and command.
|
||||||
|
* The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
|
||||||
|
* `src/extension.ts` - this is the main file where you will provide the implementation of your command.
|
||||||
|
* The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
|
||||||
|
* We pass the function containing the implementation of the command as the second parameter to `registerCommand`.
|
||||||
|
|
||||||
|
## Get up and running straight away
|
||||||
|
|
||||||
|
* Press `F5` to open a new window with your extension loaded.
|
||||||
|
* Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
|
||||||
|
* Set breakpoints in your code inside `src/extension.ts` to debug your extension.
|
||||||
|
* Find output from your extension in the debug console.
|
||||||
|
|
||||||
|
## Make changes
|
||||||
|
|
||||||
|
* You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
|
||||||
|
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
|
||||||
|
|
||||||
|
|
||||||
|
## Explore the API
|
||||||
|
|
||||||
|
* You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
|
||||||
|
|
||||||
|
## Run tests
|
||||||
|
|
||||||
|
* Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Extension Tests`.
|
||||||
|
* Press `F5` to run the tests in a new window with your extension loaded.
|
||||||
|
* See the output of the test result in the debug console.
|
||||||
|
* Make changes to `src/test/suite/extension.test.ts` or create new test files inside the `test/suite` folder.
|
||||||
|
* The provided test runner will only consider files matching the name pattern `**.test.ts`.
|
||||||
|
* You can create folders inside the `test` folder to structure your tests any way you want.
|
||||||
|
|
||||||
|
## Go further
|
||||||
|
|
||||||
|
* Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/testing-extension).
|
||||||
|
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VSCode extension marketplace.
|
||||||
|
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
|
||||||
Reference in New Issue
Block a user