From eb697483f9acdbc3c64acb95566d9813b6ef1958 Mon Sep 17 00:00:00 2001 From: Yan Zhang Date: Tue, 29 Jan 2019 17:31:37 +0800 Subject: [PATCH] Add info type for completion-item-selected events (#239) * Add info type for completion-item-selected events * Update keyname * update keyname --- src/completion/centralProvider.ts | 8 ++++---- src/completion/constants.ts | 2 +- src/completion/localProvider.ts | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/completion/centralProvider.ts b/src/completion/centralProvider.ts index 1d24a0c8..34073012 100644 --- a/src/completion/centralProvider.ts +++ b/src/completion/centralProvider.ts @@ -3,7 +3,7 @@ import * as _ from "lodash"; import * as vscode from "vscode"; -import { COMMAND_COMPLETION_ITEM_SELECTED } from "./constants"; +import { COMMAND_COMPLETION_ITEM_SELECTED, INFO_COMPLETION_ITEM_SELECTED } from "./constants"; import { IMavenCompletionItemProvider } from "./IArtifactProvider"; import { getArtifacts, getVersions } from "./requestUtils"; import { getSortText } from "./versionUtils"; @@ -16,7 +16,7 @@ class CentralProvider implements IMavenCompletionItemProvider { const groupIds: string[] = Array.from(new Set(docs.map(doc => doc.g)).values()); const commandOnSelection: vscode.Command = { title: "selected", command: COMMAND_COMPLETION_ITEM_SELECTED, - arguments: [{ completeFor: "groupId", source: "maven-central" }] + arguments: [{ infoName: INFO_COMPLETION_ITEM_SELECTED, completeFor: "groupId", source: "maven-central" }] }; return groupIds.map(gid => { const item: vscode.CompletionItem = new vscode.CompletionItem(gid, vscode.CompletionItemKind.Module); @@ -33,7 +33,7 @@ class CentralProvider implements IMavenCompletionItemProvider { const docs: any[] = _.get(body, "response.docs", []); const commandOnSelection: vscode.Command = { title: "selected", command: COMMAND_COMPLETION_ITEM_SELECTED, - arguments: [{ completeFor: "artifactId", source: "maven-central" }] + arguments: [{ infoName: INFO_COMPLETION_ITEM_SELECTED, completeFor: "artifactId", source: "maven-central" }] }; return docs.map(doc => { const item: vscode.CompletionItem = new vscode.CompletionItem(doc.a, vscode.CompletionItemKind.Field); @@ -54,7 +54,7 @@ class CentralProvider implements IMavenCompletionItemProvider { const docs: any[] = _.get(body, "response.docs", []); const commandOnSelection: vscode.Command = { title: "selected", command: COMMAND_COMPLETION_ITEM_SELECTED, - arguments: [{ completeFor: "version", source: "maven-central" }] + arguments: [{ infoName: INFO_COMPLETION_ITEM_SELECTED, completeFor: "version", source: "maven-central" }] }; return docs.map((doc) => { const item: vscode.CompletionItem = new vscode.CompletionItem(doc.v, vscode.CompletionItemKind.Constant); diff --git a/src/completion/constants.ts b/src/completion/constants.ts index ecce4ad6..2af51fec 100644 --- a/src/completion/constants.ts +++ b/src/completion/constants.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -// tslint:disable-next-line:export-name export const COMMAND_COMPLETION_ITEM_SELECTED: string = "maven.completion.selected"; +export const INFO_COMPLETION_ITEM_SELECTED: string = "completion-item-selected"; diff --git a/src/completion/localProvider.ts b/src/completion/localProvider.ts index f12ada87..ff3e10f1 100644 --- a/src/completion/localProvider.ts +++ b/src/completion/localProvider.ts @@ -6,7 +6,7 @@ import * as _ from "lodash"; import * as os from "os"; import * as path from "path"; import * as vscode from "vscode"; -import { COMMAND_COMPLETION_ITEM_SELECTED } from "./constants"; +import { COMMAND_COMPLETION_ITEM_SELECTED, INFO_COMPLETION_ITEM_SELECTED } from "./constants"; import { IMavenCompletionItemProvider } from "./IArtifactProvider"; import { getSortText } from "./versionUtils"; @@ -19,7 +19,7 @@ class LocalProvider implements IMavenCompletionItemProvider { const validGroupIds: string[] = await this.searchForGroupIds(packageSegments) || []; const commandOnSelection: vscode.Command = { title: "selected", command: COMMAND_COMPLETION_ITEM_SELECTED, - arguments: [{ completeFor: "groupId", source: "maven-local" }] + arguments: [{ infoName: INFO_COMPLETION_ITEM_SELECTED, completeFor: "groupId", source: "maven-local" }] }; return validGroupIds.map(gid => { const item: vscode.CompletionItem = new vscode.CompletionItem(gid, vscode.CompletionItemKind.Module); @@ -38,7 +38,7 @@ class LocalProvider implements IMavenCompletionItemProvider { const validArtifactIds: string[] = await this.searchForArtifactIds(groupId); const commandOnSelection: vscode.Command = { title: "selected", command: COMMAND_COMPLETION_ITEM_SELECTED, - arguments: [{ completeFor: "artifactId", source: "maven-local" }] + arguments: [{ infoName: INFO_COMPLETION_ITEM_SELECTED, completeFor: "artifactId", source: "maven-local" }] }; return validArtifactIds.map(aid => { const item: vscode.CompletionItem = new vscode.CompletionItem(aid, vscode.CompletionItemKind.Field); @@ -57,7 +57,7 @@ class LocalProvider implements IMavenCompletionItemProvider { const validVersions: string[] = await this.searchForVersions(groupId, artifactId); const commandOnSelection: vscode.Command = { title: "selected", command: COMMAND_COMPLETION_ITEM_SELECTED, - arguments: [{ completeFor: "version", source: "maven-local" }] + arguments: [{ infoName: INFO_COMPLETION_ITEM_SELECTED, completeFor: "version", source: "maven-local" }] }; return validVersions.map(v => { const item: vscode.CompletionItem = new vscode.CompletionItem(v, vscode.CompletionItemKind.Constant);