Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vscode-extension/src/command-indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class CommandIndexer {
threshold: -10000,
});

return results.map(r => ({
return results.map((r) => ({
item: r.obj.item,
score: r.score,
scope: SearchScope.COMMANDS,
Expand Down
7 changes: 4 additions & 3 deletions vscode-extension/src/reference-code-lens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ export class ReferenceCodeLensProvider implements vscode.CodeLensProvider {

try {
// Get document symbols using VSCode's built-in provider
const symbols = await vscode.commands.executeCommand<
vscode.DocumentSymbol[] | vscode.SymbolInformation[]
>('vscode.executeDocumentSymbolProvider', document.uri);
const symbols = await vscode.commands.executeCommand<vscode.DocumentSymbol[] | vscode.SymbolInformation[]>(
'vscode.executeDocumentSymbolProvider',
document.uri,
);

if (!symbols || token.isCancellationRequested) {
return [];
Expand Down
65 changes: 55 additions & 10 deletions vscode-extension/src/search-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ export class SearchProvider {
private readonly CMD_CLEAR_CACHE = 'command:clear-cache';
private readonly CMD_SETTINGS = 'command:open-settings';
private readonly ID_EMPTY_STATE = 'empty-state';
private readonly CMD_NEXT_TIP = 'command:next-tip';

private currentTipIndex = 0;
private readonly TIPS = [
"Type '/t' to search specifically for classes and types",
"Type '/f' to find files by name",
"Use '/s' to search for symbols",
"Double-press 'Shift' to open DeepLens anytime",
"Type '/cmd' to run VS Code commands",
'DeepLens learns from your activity to rank results',
"Use '/m' to see modified files",
"Use '/e' to find API endpoints",
"Type '/txt' for full text search across your workspace",
];

private static readonly CANCEL_BUTTON: vscode.QuickInputButton = {
iconPath: new vscode.ThemeIcon('stop-circle'),
Expand Down Expand Up @@ -524,6 +538,9 @@ export class SearchProvider {
items.push(this.getClearHistoryItem());
}

// Add Pro Tip
items.push(this.getTipItem());

quickPick.items = items;

// Update title with scope reference even in history
Expand Down Expand Up @@ -629,6 +646,14 @@ export class SearchProvider {
return;
}

// Handle Pro Tip cycling
if (selected.result.item.id === this.CMD_NEXT_TIP) {
this.currentTipIndex = (this.currentTipIndex + 1) % this.TIPS.length;
// Refresh the view to show new tip
await this.showRecentHistory(quickPick);
return;
}

const isSlashCommand = selected.result.item.id.startsWith('slash-cmd:');
if (!isSlashCommand) {
accepted = true;
Expand Down Expand Up @@ -987,10 +1012,7 @@ export class SearchProvider {
}
}

private trySuggestSlashCommands(
quickPick: vscode.QuickPick<SearchResultItem>,
query: string,
): boolean {
private trySuggestSlashCommands(quickPick: vscode.QuickPick<SearchResultItem>, query: string): boolean {
if (!query.startsWith('/') && !query.startsWith('#') && !query.startsWith('>')) {
return false;
}
Expand Down Expand Up @@ -1386,6 +1408,30 @@ export class SearchProvider {
};
}

/**
* Get Pro Tip item
*/
private getTipItem(): SearchResultItem {
const tip = this.TIPS[this.currentTipIndex];
return {
label: `💡 Pro Tip: ${tip}`,
description: 'Click for next tip',
iconPath: new vscode.ThemeIcon('lightbulb', new vscode.ThemeColor('textLink.foreground')),
alwaysShow: true,
result: {
item: {
id: this.CMD_NEXT_TIP,
name: 'Pro Tip',
type: SearchItemType.COMMAND,
filePath: '',
detail: '',
},
score: 0,
scope: SearchScope.COMMANDS,
},
};
}

private async handleEmptyStateAction(
selected: SearchResultItem,
quickPick: vscode.QuickPick<SearchResultItem>,
Expand Down Expand Up @@ -1577,6 +1623,9 @@ export class SearchProvider {
items.push(item);
}

// Add Pro Tip
items.push(this.getTipItem());

return items;
}

Expand Down Expand Up @@ -1915,8 +1964,7 @@ export class SearchProvider {
}

if (item.column !== undefined) {
const length =
highlights && highlights.length > 0 ? highlights[0][1] - highlights[0][0] : item.name.length;
const length = highlights && highlights.length > 0 ? highlights[0][1] - highlights[0][0] : item.name.length;

return new vscode.Range(
new vscode.Position(item.line || 0, item.column),
Expand Down Expand Up @@ -1994,10 +2042,7 @@ export class SearchProvider {
const startColumn = Math.min(index, lineText.length);
const endColumn = Math.min(startColumn + name.length, lineText.length);

return new vscode.Range(
new vscode.Position(item.line, startColumn),
new vscode.Position(item.line, endColumn),
);
return new vscode.Range(new vscode.Position(item.line, startColumn), new vscode.Position(item.line, endColumn));
}
}

Expand Down
6 changes: 3 additions & 3 deletions vscode-extension/src/slash-command-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ export class SlashCommandService {

getCommands(query?: string): SlashCommand[] {
if (!query) {
return Array.from(new Set(Array.from(this.commands.values()).map((c) => c.name)))
.map((name) => this.commands.get(name))
.filter((cmd): cmd is SlashCommand => cmd !== undefined);
return Array.from(new Set(Array.from(this.commands.values()).map((c) => c.name)))
.map((name) => this.commands.get(name))
.filter((cmd): cmd is SlashCommand => cmd !== undefined);
}

const lowerQuery = query.toLowerCase();
Expand Down
3 changes: 1 addition & 2 deletions vscode-extension/src/test/benchmark/memory.bench.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ suite('Extension Memory Benchmark', () => {
});

suiteTeardown(() => {
const baseOutput =
process.env.BENCHMARK_OUTPUT || path.resolve(__dirname, 'vscode-memory-benchmarks.json');
const baseOutput = process.env.BENCHMARK_OUTPUT || path.resolve(__dirname, 'vscode-memory-benchmarks.json');
const memoryOutputPath =
process.env.BENCHMARK_MEMORY_OUTPUT || path.join(path.dirname(baseOutput), 'vscode-extension-memory.json');
try {
Expand Down