From 5e24827152fc863b706ecc7fefc7ef9f44f2a837 Mon Sep 17 00:00:00 2001 From: Junv Zhao Date: Thu, 9 Mar 2017 15:10:13 +0800 Subject: [PATCH] update to 0.4 --- .gitignore | 3 +- README.md | 59 ++++----------------------------------- extension.js | 35 ++++++++++++----------- package.json | 78 ++++++++++++++++++++++++++-------------------------- 4 files changed, 65 insertions(+), 110 deletions(-) diff --git a/.gitignore b/.gitignore index b512c09..bed4b87 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -node_modules \ No newline at end of file +node_modules +npm-debug.* \ No newline at end of file diff --git a/README.md b/README.md index 8588189..f55aa81 100644 --- a/README.md +++ b/README.md @@ -1,65 +1,16 @@ -# recent-files README - -This is the README for your extension "recent-files". 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 + This plugin is just like when you do `cmd` or `ctrl` + `E` in Intellij idea, to help you to see the recently opened files in a list. ## 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. +### 0.3.0 -### 1.0.0 + Allow you to see recently opened files and choose one of them of open it. -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 OSX or `Ctrl+\` on Windows and Linux) -* Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux) -* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) 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!** \ No newline at end of file +------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/extension.js b/extension.js index e6b3c05..5d13b11 100644 --- a/extension.js +++ b/extension.js @@ -11,7 +11,7 @@ function activate(context) { // 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 "recent-files" is now active!'); + console.log('"recent-files" is now active!'); // The command has been defined in the package.json file // Now provide the implementation of the command with registerCommand @@ -19,21 +19,8 @@ function activate(context) { var disposable = vscode.commands.registerCommand('extension.openRecentlyFiles', function () { // 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!'); vscode.window.showQuickPick(map.keys()).then((item) => { - if(!item || item.trim === "") { - return - } - let uri = map.get(item); - if(uri === null) { - vscode.window.showWarningMessage("Can't find the file you choosed.") - return; - } - let targetDocument = vscode.workspace.openTextDocument(map.get(item)); - targetDocument.then(function (document) { - vscode.window.showTextDocument(document); - }); + handleUserInput(item); }); }); @@ -52,5 +39,21 @@ exports.activate = activate; // this method is called when your extension is deactivated function deactivate() { + map.clear(); } -exports.deactivate = deactivate; \ No newline at end of file +exports.deactivate = deactivate; + +function handleUserInput(item) { + if (!item || item.trim === "") { + return + } + let uri = map.get(item); + if (uri === null) { + vscode.window.showWarningMessage("Can't find the file you choosed.") + return; + } + let targetDocument = vscode.workspace.openTextDocument(map.get(item)); + targetDocument.then(function (document) { + vscode.window.showTextDocument(document); + }); +} \ No newline at end of file diff --git a/package.json b/package.json index 219e09b..e0c1dbd 100644 --- a/package.json +++ b/package.json @@ -1,47 +1,47 @@ { - "name": "recent-files", - "displayName": "Recent files", - "description": "Open recent files like Intellij idea.", - "version": "0.2.0", - "publisher": "junv", - "engines": { - "vscode": "^1.10.0" - }, - "categories": [ - "Other" - ], - "activationEvents": [ - "*" - ], - "main": "./extension", - "contributes": { - "commands": [ - { - "command": "extension.openRecentlyFiles", - "title": "Recently Files" - } + "name": "recent-files", + "displayName": "Recent files", + "description": "Open recent files like you do in Intellij idea.", + "version": "0.4.0", + "publisher": "junv", + "engines": { + "vscode": "^1.10.0" + }, + "categories": [ + "Other" ], - "keybindings": [ + "activationEvents": [ + "*" + ], + "main": "./extension", + "contributes": { + "commands": [ + { + "command": "extension.openRecentlyFiles", + "title": "Recently Files" + } + ], + "keybindings": [ { "command": "extension.openRecentlyFiles", "key": "ctrl+e", "mac": "cmd+e" } ] - }, - "scripts": { - "postinstall": "node ./node_modules/vscode/bin/install", - "test": "node ./node_modules/vscode/bin/test" - }, - "devDependencies": { - "typescript": "^2.0.3", - "vscode": "^1.0.0", - "mocha": "^2.3.3", - "eslint": "^3.6.0", - "@types/node": "^6.0.40", - "@types/mocha": "^2.2.32" - }, - "dependencies": { - "linked-map": "^2.2.2" - } -} + }, + "scripts": { + "postinstall": "node ./node_modules/vscode/bin/install", + "test": "node ./node_modules/vscode/bin/test" + }, + "devDependencies": { + "typescript": "^2.0.3", + "vscode": "^1.0.0", + "mocha": "^2.3.3", + "eslint": "^3.6.0", + "@types/node": "^6.0.40", + "@types/mocha": "^2.2.32" + }, + "dependencies": { + "linked-map": "^2.2.2" + } +} \ No newline at end of file