Skip to content

Commit

Permalink
src/goImpl: use quickpick description and handle symbol with .
Browse files Browse the repository at this point in the history
If user searches with 'io.Reader' for more specific workspace
symbol search, the new interface returns 'io.Reader' as the
symbol name. Passing it to impl as it is will cause an error.
Use only the part after '.' as a heuristic.

Change-Id: I7935ad9ef59be50db0bc09890b9532c8e0ba32b6
  • Loading branch information
hyangah committed Dec 30, 2021
1 parent 6994d90 commit b2f06cc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/goImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import vscode = require('vscode');

class InterfaceItem implements vscode.QuickPickItem {
public label: string;
public description: string;
public name: string;
public package: string;
public location: vscode.Location;

constructor(public symbol: vscode.SymbolInformation) {
this.label = symbol.name + ' ' + symbol.containerName;
this.name = symbol.name;
constructor(symbol: vscode.SymbolInformation) {
this.label = symbol.name;
this.description = symbol.containerName;
this.name = symbol.name.split('.').pop(); // in case, symbol contains package name.
this.package = symbol.containerName;
this.location = symbol.location;
}
}

Expand All @@ -37,7 +37,7 @@ export function implCursor() {
}
const cursor = editor.selection;
const quickPick = vscode.window.createQuickPick();
quickPick.placeholder = 'Input interface name (e.g. client)';
quickPick.placeholder = 'Input interface name (e.g. Client)';

const search = function (keyword: string) {
quickPick.busy = true;
Expand Down

0 comments on commit b2f06cc

Please sign in to comment.