Skip to content

Commit

Permalink
Add info type for completion-item-selected events (#239)
Browse files Browse the repository at this point in the history
* Add info type for completion-item-selected events

* Update keyname

* update keyname
  • Loading branch information
Eskibear authored Jan 29, 2019
1 parent a294046 commit eb69748
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/completion/centralProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/completion/constants.ts
Original file line number Diff line number Diff line change
@@ -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";
8 changes: 4 additions & 4 deletions src/completion/localProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit eb69748

Please sign in to comment.