add history entry in context menu (#61)

* add history entry in context menu

* update changelog

* update image in README
This commit is contained in:
Yan Zhang 2018-06-05 12:50:13 +08:00 коммит произвёл GitHub
Родитель b9c0b1da9d
Коммит 530ef7d4ed
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 31 добавлений и 23 удалений

Просмотреть файл

@ -27,6 +27,9 @@ All notable changes to the "vscode-maven" extension will be documented in this f
- [0.0.1](#001) - [0.0.1](#001)
## Unreleased ## Unreleased
- Fixed vulnerabilities in package dependencies.
- Formatted filepath for WSL Bash.
- Added entry for historical commands in context menu.
## Released ## Released
### 0.8.0 ### 0.8.0

Двоичные данные
images/view_context.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 49 KiB

После

Ширина:  |  Высота:  |  Размер: 49 KiB

14
package-lock.json сгенерированный
Просмотреть файл

@ -115,7 +115,7 @@
"arr-flatten": { "arr-flatten": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
"integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=",
"dev": true "dev": true
}, },
"arr-union": { "arr-union": {
@ -413,7 +413,7 @@
"debug": { "debug": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=",
"dev": true, "dev": true,
"requires": { "requires": {
"ms": "2.0.0" "ms": "2.0.0"
@ -822,7 +822,7 @@
"growl": { "growl": {
"version": "1.10.3", "version": "1.10.3",
"resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz",
"integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", "integrity": "sha1-GSa6kM8+3+KttJJ/WIC8IsZseQ8=",
"dev": true "dev": true
}, },
"gulp-chmod": { "gulp-chmod": {
@ -1052,7 +1052,7 @@
"queue": { "queue": {
"version": "4.4.2", "version": "4.4.2",
"resolved": "https://registry.npmjs.org/queue/-/queue-4.4.2.tgz", "resolved": "https://registry.npmjs.org/queue/-/queue-4.4.2.tgz",
"integrity": "sha512-fSMRXbwhMwipcDZ08enW2vl+YDmAmhcNcr43sCJL8DIg+CFOsoRLG23ctxA+fwNk1w55SePSiS7oqQQSgQoVJQ==", "integrity": "sha1-Wpcz2ai4vRs26TS8nFWribKOKcc=",
"dev": true, "dev": true,
"requires": { "requires": {
"inherits": "~2.0.0" "inherits": "~2.0.0"
@ -1749,7 +1749,7 @@
"regex-cache": { "regex-cache": {
"version": "0.4.4", "version": "0.4.4",
"resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz",
"integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", "integrity": "sha1-db3FiioUls7EihKDW8VMjVYjNt0=",
"dev": true, "dev": true,
"requires": { "requires": {
"is-equal-shallow": "^0.1.3" "is-equal-shallow": "^0.1.3"
@ -1825,7 +1825,7 @@
"rimraf": { "rimraf": {
"version": "2.6.2", "version": "2.6.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
"integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "integrity": "sha1-LtgVDSShbqhlHm1u8PR8QVjOejY=",
"dev": true, "dev": true,
"requires": { "requires": {
"glob": "^7.0.5" "glob": "^7.0.5"
@ -1855,7 +1855,7 @@
"source-map": { "source-map": {
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
"dev": true "dev": true
}, },
"source-map-support": { "source-map-support": {

Просмотреть файл

@ -126,7 +126,7 @@
}, },
{ {
"command": "maven.history", "command": "maven.history",
"title": "Command history", "title": "History ...",
"category": "Maven" "category": "Maven"
}, },
{ {
@ -220,52 +220,57 @@
{ {
"command": "maven.goal.custom", "command": "maven.goal.custom",
"when": "view == mavenProjects && viewItem == ProjectItem", "when": "view == mavenProjects && viewItem == ProjectItem",
"group": "1-lifecycle@5"
},
{
"command": "maven.history",
"when": "view == mavenProjects && viewItem == ProjectItem",
"group": "1-lifecycle@0" "group": "1-lifecycle@0"
}, },
{ {
"command": "maven.goal.clean", "command": "maven.goal.clean",
"when": "view == mavenProjects && viewItem == ProjectItem", "when": "view == mavenProjects && viewItem == ProjectItem",
"group": "1-lifecycle@1" "group": "1-lifecycle@10"
}, },
{ {
"command": "maven.goal.package", "command": "maven.goal.package",
"when": "view == mavenProjects && viewItem == ProjectItem", "when": "view == mavenProjects && viewItem == ProjectItem",
"group": "1-lifecycle@2" "group": "1-lifecycle@20"
}, },
{ {
"command": "maven.goal.install", "command": "maven.goal.install",
"when": "view == mavenProjects && viewItem == ProjectItem", "when": "view == mavenProjects && viewItem == ProjectItem",
"group": "1-lifecycle@3" "group": "1-lifecycle@30"
}, },
{ {
"command": "maven.goal.compile", "command": "maven.goal.compile",
"when": "view == mavenProjects && viewItem == ProjectItem", "when": "view == mavenProjects && viewItem == ProjectItem",
"group": "1-lifecycle@4" "group": "1-lifecycle@40"
}, },
{ {
"command": "maven.goal.validate", "command": "maven.goal.validate",
"when": "view == mavenProjects && viewItem == ProjectItem", "when": "view == mavenProjects && viewItem == ProjectItem",
"group": "1-lifecycle@5" "group": "1-lifecycle@50"
}, },
{ {
"command": "maven.goal.verify", "command": "maven.goal.verify",
"when": "view == mavenProjects && viewItem == ProjectItem", "when": "view == mavenProjects && viewItem == ProjectItem",
"group": "1-lifecycle@6" "group": "1-lifecycle@60"
}, },
{ {
"command": "maven.goal.test", "command": "maven.goal.test",
"when": "view == mavenProjects && viewItem == ProjectItem", "when": "view == mavenProjects && viewItem == ProjectItem",
"group": "1-lifecycle@7" "group": "1-lifecycle@70"
}, },
{ {
"command": "maven.goal.site", "command": "maven.goal.site",
"when": "view == mavenProjects && viewItem == ProjectItem", "when": "view == mavenProjects && viewItem == ProjectItem",
"group": "1-lifecycle@8" "group": "1-lifecycle@80"
}, },
{ {
"command": "maven.goal.deploy", "command": "maven.goal.deploy",
"when": "view == mavenProjects && viewItem == ProjectItem", "when": "view == mavenProjects && viewItem == ProjectItem",
"group": "1-lifecycle@9" "group": "1-lifecycle@90"
}, },
{ {
"command": "maven.project.openPom", "command": "maven.project.openPom",

Просмотреть файл

@ -158,9 +158,9 @@ export class ProjectDataProvider implements TreeDataProvider<TreeItem> {
} }
} }
public async historicalGoals(): Promise<void> { public async historicalGoals(projectPomPath?: string): Promise<void> {
const selected: IHistory = await VSCodeUI.getQuickPick( const selected: IHistory = await VSCodeUI.getQuickPick(
Utils.getLRUCommands(), Utils.getLRUCommands(projectPomPath),
(x: IHistory) => x.command, (x: IHistory) => x.command,
null, null,
(x: IHistory) => x.pomfile, (x: IHistory) => x.pomfile,

Просмотреть файл

@ -230,7 +230,7 @@ export namespace Utils {
updateLRUCommands(command, pomfile); updateLRUCommands(command, pomfile);
} }
export async function getLRUCommands(): Promise<{ command: string, pomfile: string }[]> { export async function getLRUCommands(pomfile?: string): Promise<{ command: string, pomfile: string }[]> {
const filepath: string = getCommandHistoryCachePath(); const filepath: string = getCommandHistoryCachePath();
if (await fse.pathExists(filepath)) { if (await fse.pathExists(filepath)) {
const content: string = (await fse.readFile(filepath)).toString().trim(); const content: string = (await fse.readFile(filepath)).toString().trim();
@ -240,7 +240,7 @@ export namespace Utils {
const items: string[] = line.split(","); const items: string[] = line.split(",");
return { command: items[0], pomfile: items[1] }; return { command: items[0], pomfile: items[1] };
} }
); ).filter((item: { command: string, pomfile: string }) => !pomfile || pomfile === item.pomfile);
} }
} }
return []; return [];

Просмотреть файл

@ -64,8 +64,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
}); });
})); }));
context.subscriptions.push(TelemetryWrapper.registerCommand("maven.history", async () => { context.subscriptions.push(TelemetryWrapper.registerCommand("maven.history", async (item: ProjectItem | undefined) => {
await mavenProjectsTreeDataProvider.historicalGoals(); await mavenProjectsTreeDataProvider.historicalGoals(item && item.abosolutePath);
})); }));
context.subscriptions.push(TelemetryWrapper.registerCommand("maven.goal.execute", async () => { context.subscriptions.push(TelemetryWrapper.registerCommand("maven.goal.execute", async () => {