Skip to content

Commit

Permalink
improve message
Browse files Browse the repository at this point in the history
  • Loading branch information
hitesh-1997 committed Jan 4, 2025
1 parent 8d8ccdf commit b08f12a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@
"cody.experimental.autoedits.enabled": {
"order": 99,
"type": "boolean",
"markdownDescription": "Enable Autoedit, an experimental feature that automatically applies suggested edits.",
"markdownDescription": "Enable Autoedit, an experimental feature which suggest smarter code edits as you type.",
"default": false
},
"cody.experimental.tracing": {
Expand Down
4 changes: 2 additions & 2 deletions vscode/src/autoedits/autoedit-onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import {
import * as vscode from 'vscode'
import { isRunningInsideAgent } from './../jsonrpc/isRunningInsideAgent'

export async function showAutoeditOnboarding(): Promise<void> {
export async function showAutoeditOnboardingIfEligible(): Promise<void> {
// Determine if we should show the onboarding popup
if (!shouldShowAutoeditsOnboardingPopup()) {
return
}

const selection = await vscode.window.showInformationMessage(
'✨ Try Cody Autoedits - An alternative to autocomplete that helps you edit code more efficiently',
'✨ Try Cody Autoedits - experimental feature which suggest smarter code edits as you type.',
'Enable Autoedits'
)

Expand Down
7 changes: 4 additions & 3 deletions vscode/src/completions/inline-completion-item-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { autocompleteStageCounterLogger } from '../services/autocomplete-stage-c
import { recordExposedExperimentsToSpan } from '../services/open-telemetry/utils'
import { isInTutorial } from '../tutorial/helpers'

import { showAutoeditOnboarding } from '../autoedits/autoedit-onboarding'
import { showAutoeditOnboardingIfEligible } from '../autoedits/autoedit-onboarding'
import { ContextRankingStrategy } from '../completions/context/completions-context-ranker'
import type { CompletionBookkeepingEvent, CompletionItemID, CompletionLogID } from './analytics-logger'
import * as CompletionAnalyticsLogger from './analytics-logger'
Expand Down Expand Up @@ -139,8 +139,9 @@ export class InlineCompletionItemProvider
tracer = null,
...config
}: CodyCompletionItemProviderConfig) {
// Show the onboarding if the user has not enabled autoedits and want to use that instead of autocomplete
showAutoeditOnboarding()
// Show the autoedits onboarding message if the user hasn't enabled autoedits
// but is eligible to use them as an alternative to autocomplete
showAutoeditOnboardingIfEligible()

// This is a static field to allow for easy access in the static `configuration` getter.
// There must only be one instance of this class at a time.
Expand Down
10 changes: 8 additions & 2 deletions vscode/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,14 @@ function registerAutoEdits(chatClient: ChatClient, disposables: vscode.Disposabl
)
)
.pipe(
map(([config, authStatus, autoeditEnabled]) => {
if (shouldEnableExperimentalAutoedits(config, autoeditEnabled, authStatus)) {
map(([config, authStatus, autoeditFeatureFlagEnabled]) => {
if (
shouldEnableExperimentalAutoedits(
config,
autoeditFeatureFlagEnabled,
authStatus
)
) {
const provider = new AutoeditsProvider(chatClient)
const completionRegistration =
vscode.languages.registerInlineCompletionItemProvider(
Expand Down

0 comments on commit b08f12a

Please sign in to comment.