From 03bb340314c0046473e8f862884095776f108f06 Mon Sep 17 00:00:00 2001 From: wangtianlun Date: Mon, 22 Apr 2019 18:11:38 +0800 Subject: [PATCH] style: format code --- .vscode/tasks.json | 34 +++++++++---------- README.md | 8 ++--- package.json | 84 +++++++++++++++++++++++----------------------- src/extension.ts | 27 +++------------ src/test/index.ts | 6 ++-- tsconfig.json | 39 ++++++++++----------- tslint.json | 25 ++++++-------- 7 files changed, 99 insertions(+), 124 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 604e38f..078ff7e 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -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 - } - } - ] -} \ No newline at end of file + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "watch", + "problemMatcher": "$tsc-watch", + "isBackground": true, + "presentation": { + "reveal": "never" + }, + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/README.md b/README.md index 737528e..154cb14 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,10 @@ ## Keyboard Shortcuts -| Key | Command | -| ------------------------------------------------- | ---------------------------- | -| cmd + m(mac) / ctrl + m(windows) | open a webview of textDocument | -| cmd + s(mac) / ctrl + s(windows) | save mindmap file | +| Key | Command | +| -------------------------------- | ------------------------------ | +| cmd + m(mac) / ctrl + m(windows) | open a webview of textDocument | +| cmd + s(mac) / ctrl + s(windows) | save mindmap file | ## FAQ - **File parsed incorrectly, the current webview only show initial mindmap** diff --git a/package.json b/package.json index 6c8eab0..0118148 100644 --- a/package.json +++ b/package.json @@ -1,44 +1,44 @@ { - "name": "vscode-mindmap", - "displayName": "vscode-mindmap", - "icon": "resources/icon.png", - "description": "mindmap for vscode", - "version": "0.0.1", - "publisher": "Souche", - "repository": { - "type": "git", - "url": "https://github.com/souche-rdc/vscode-mindmap.git" - }, - "engines": { - "vscode": "^1.33.0" - }, - "categories": [ - "Other" - ], - "activationEvents": [ - "onCommand:extension.sayHello" - ], - "main": "./out/extension", - "contributes": { - "commands": [ - { - "command": "extension.sayHello", - "title": "Hello World" - } - ] - }, - "scripts": { - "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", - "watch": "tsc -watch -p ./", - "postinstall": "node ./node_modules/vscode/bin/install", - "test": "npm run compile && node ./node_modules/vscode/bin/test" - }, - "devDependencies": { - "typescript": "^2.6.1", - "vscode": "^1.1.21", - "tslint": "^5.8.0", - "@types/node": "^8.10.25", - "@types/mocha": "^2.2.42" - } + "name": "vscode-mindmap", + "displayName": "vscode-mindmap", + "icon": "resources/icon.png", + "description": "mindmap for vscode", + "version": "0.0.1", + "publisher": "Souche", + "repository": { + "type": "git", + "url": "https://github.com/souche/vscode-mindmap.git" + }, + "engines": { + "vscode": "^1.33.0" + }, + "categories": [ + "Other" + ], + "activationEvents": [ + "onCommand:extension.sayHello" + ], + "main": "./out/extension", + "contributes": { + "commands": [ + { + "command": "extension.sayHello", + "title": "Hello World" + } + ] + }, + "scripts": { + "vscode:prepublish": "npm run compile", + "compile": "tsc -p ./", + "watch": "tsc -watch -p ./", + "postinstall": "node ./node_modules/vscode/bin/install", + "test": "npm run compile && node ./node_modules/vscode/bin/test" + }, + "devDependencies": { + "typescript": "^2.6.1", + "vscode": "^1.1.21", + "tslint": "^5.8.0", + "@types/node": "^8.10.25", + "@types/mocha": "^2.2.42" + } } diff --git a/src/extension.ts b/src/extension.ts index 312152a..a8804ef 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,29 +1,12 @@ 'use strict'; -// The module 'vscode' contains the VS Code extensibility API -// Import the module and reference it with the alias vscode in your code below import * as vscode from 'vscode'; -// this method is called when your extension is activated -// your extension is activated the very first time the command is executed export function activate(context: vscode.ExtensionContext) { + let disposable = vscode.commands.registerCommand('extension.sayHello', () => { + vscode.window.showInformationMessage('Hello World!'); + }); - // Use the console to output diagnostic information (console.log) and errors (console.error) - // This line of code will only be executed once when your extension is activated - console.log('Congratulations, your extension "vscode-mindmap" is now active!'); - - // The command has been defined in the package.json file - // Now provide the implementation of the command with registerCommand - // The commandId parameter must match the command field in package.json - let disposable = vscode.commands.registerCommand('extension.sayHello', () => { - // The code you place here will be executed every time your command is executed - - // Display a message box to the user - vscode.window.showInformationMessage('Hello World!'); - }); - - context.subscriptions.push(disposable); + context.subscriptions.push(disposable); } -// this method is called when your extension is deactivated -export function deactivate() { -} \ No newline at end of file +export function deactivate() {} diff --git a/src/test/index.ts b/src/test/index.ts index 9fa2ea0..895f8a1 100644 --- a/src/test/index.ts +++ b/src/test/index.ts @@ -15,8 +15,8 @@ import * as testRunner from 'vscode/lib/testrunner'; // You can directly control Mocha options by uncommenting the following lines // See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info testRunner.configure({ - ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true // colored output from test results + ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) + useColors: true, // colored output from test results }); -module.exports = testRunner; \ No newline at end of file +module.exports = testRunner; diff --git a/tsconfig.json b/tsconfig.json index 8aa5312..ad3fb1f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,23 +1,18 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "outDir": "out", - "lib": [ - "es6" - ], - "sourceMap": true, - "rootDir": "src", - /* Strict Type-Checking Option */ - "strict": true, /* enable all strict type-checking options */ - /* Additional Checks */ - "noUnusedLocals": true /* Report errors on unused locals. */ - // "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" - ] -} \ No newline at end of file + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "outDir": "out", + "lib": ["es6"], + "sourceMap": true, + "rootDir": "src", + /* Strict Type-Checking Option */ + "strict": true /* enable all strict type-checking options */, + /* Additional Checks */ + "noUnusedLocals": true /* Report errors on unused locals. */ + // "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"] +} diff --git a/tslint.json b/tslint.json index 2bd680d..2407102 100644 --- a/tslint.json +++ b/tslint.json @@ -1,15 +1,12 @@ { - "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" -} \ No newline at end of file + "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" +}