Skip to content
Prev Previous commit
Next Next commit
src/goImpl: use quickpick description and handle symbol with .
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
commit b2f06cc602c756e40e2416b1183be72e8c722445
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