Skip to content

Commit d0c2903

Browse files
committed
Improves AI search query feature UX and messaging
- Enables AI search by default on the Graph
1 parent 9892c0e commit d0c2903

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

src/features.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export function isAdvancedFeature(feature: PlusFeatures): feature is AdvancedFea
113113
case 'generate-create-codeSuggestion':
114114
case 'generate-create-pullRequest':
115115
case 'generate-rebase':
116-
case 'generate-searchQuery':
116+
// case 'generate-searchQuery':
117117
return true;
118118
default:
119119
return false;

src/plus/ai/aiProviderService.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -541,16 +541,20 @@ export class AIProviderService implements Disposable {
541541
if (!(await ensureAccess())) return false;
542542

543543
if (feature === 'generate-commitMessage') return true;
544-
if (
545-
!(await ensureFeatureAccess(
546-
this.container,
547-
isAdvancedFeature(feature)
548-
? 'This AI feature requires GitLens Advanced or a Pro trial'
549-
: 'This AI feature requires GitLens Pro or a Pro trial',
550-
feature,
551-
source,
552-
))
553-
) {
544+
const suffix = isAdvancedFeature(feature)
545+
? 'requires GitLens Advanced or a trial'
546+
: 'requires GitLens Pro or a trial';
547+
let label;
548+
switch (feature) {
549+
case 'generate-searchQuery':
550+
label = `AI-powered search (preview) ${suffix}`;
551+
break;
552+
553+
default:
554+
label = isAdvancedFeature(feature) ? `This AI preview feature ${suffix}` : `This AI feature ${suffix}`;
555+
}
556+
557+
if (!(await ensureFeatureAccess(this.container, label, feature, source))) {
554558
return false;
555559
}
556560

src/webviews/apps/shared/components/search/search-input.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ export class GlSearchInput extends GlElement {
138138
display: none;
139139
}
140140
141-
input[aria-describedby='help-text'] {
142-
border-color: var(--vscode-inputValidation-infoBorder);
143-
}
144141
input[aria-describedby='help-text']:focus {
145142
outline-color: var(--vscode-inputValidation-infoBorder);
146143
border-bottom-left-radius: 0;
@@ -329,6 +326,7 @@ export class GlSearchInput extends GlElement {
329326
private handleClear(_e: Event) {
330327
this.focus();
331328
this._value = '';
329+
this.errorMessage = '';
332330
this.processedQuery = undefined;
333331
this.debouncedOnSearchChanged();
334332
}
@@ -367,6 +365,7 @@ export class GlSearchInput extends GlElement {
367365
}
368366

369367
private handleInput(e: InputEvent) {
368+
this.errorMessage = '';
370369
this.processedQuery = undefined;
371370

372371
const value = (e.target as HTMLInputElement)?.value;
@@ -619,7 +618,10 @@ export class GlSearchInput extends GlElement {
619618
if (this.searching) {
620619
return html`<span>Query: <code-icon icon="loading" modifier="spin"></code-icon></span>`;
621620
}
622-
return html`<span>Type your natural language query and press Enter</span>`;
621+
return html`<span
622+
>Type your natural language query and press Enter. Click
623+
<code-icon icon="sparkle"></code-icon> to toggle modes.</span
624+
>`;
623625
}
624626

625627
return html`<span> Query: <code>${this.processedQuery}</code></span>`;

src/webviews/plus/graph/graphWebview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,8 +2693,8 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
26932693
});
26942694
}
26952695

2696-
const defaultSearchMode = this.container.storage.get('graph:searchMode') ?? 'normal';
2697-
const useNaturalLanguageSearch = this.container.storage.get('graph:useNaturalLanguageSearch') ?? false;
2696+
const defaultSearchMode = this.container.storage.get('graph:searchMode', 'normal');
2697+
const useNaturalLanguageSearch = this.container.storage.get('graph:useNaturalLanguageSearch', true);
26982698
const featurePreview = this.getFeaturePreview();
26992699

27002700
return {

0 commit comments

Comments
 (0)