Skip to content

Commit

Permalink
change: disable inline chat by default (#1797)
Browse files Browse the repository at this point in the history
PART OF #1796

Requested by product.

This PR updates to disable inline chat when chat panel is enabled.
Inline chat is also now disabled by default.

The inline chat feature is deprecated in favor of the experimental chat
panel. This change disables inline chat when the chat panel is enabled.

## Test plan

<!-- Required. See
https://docs.sourcegraph.com/dev/background-information/testing_principles.
-->

- Try to enable inline chat in new UI
- Try to disable new chat UI and enable Inline Chat again 
- etc

## Demo


https://github.com/sourcegraph/cody/assets/68532117/aab58017-f766-420d-88df-eb4f2ebd9f21
  • Loading branch information
abeatrix committed Nov 22, 2023
1 parent d074cde commit 776b072
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 21 deletions.
1 change: 1 addition & 0 deletions vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Starting from `0.2.0`, Cody is using `major.EVEN_NUMBER.patch` for release versi

### Changed

- Inline Chat will soon be deprecated in favor of the improved chat and command experience. It is now disabled by default and does not work when the new chat panel is enabled. [pull/1797](https://github.com/sourcegraph/cody/pull/1797)
- Chat: Updated the design and location for the `chat submit` button and `stop generating` button. [pull/1782](https://github.com/sourcegraph/cody/pull/1782)
- Commands: The Custom Commands Menu now closes on click outside of the menu. [pull/1854](https://github.com/sourcegraph/cody/pull/1854)

Expand Down
2 changes: 1 addition & 1 deletion vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@
"title": "Cody Inline Chat",
"type": "boolean",
"markdownDescription": "Enables asking questions and requesting code changes directly from within the code editor. Use the + button next to any line of code to start an inline chat.",
"default": true
"default": false
},
"cody.editorTitleCommandIcon": {
"order": 7,
Expand Down
4 changes: 2 additions & 2 deletions vscode/src/configuration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('getConfiguration', () => {
experimentalGuardrails: false,
experimentalLocalSymbols: false,
experimentalSearchPanel: false,
inlineChat: true,
inlineChat: false,
codeActions: true,
isRunningInsideAgent: false,
agentIDE: undefined,
Expand Down Expand Up @@ -151,7 +151,7 @@ describe('getConfiguration', () => {
editorTitleCommandIcon: true,
experimentalGuardrails: true,
experimentalLocalSymbols: true,
inlineChat: true,
inlineChat: false,
codeActions: true,
isRunningInsideAgent: false,
agentIDE: undefined,
Expand Down
7 changes: 5 additions & 2 deletions vscode/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ export function getConfiguration(config: ConfigGetter = vscode.workspace.getConf
experimentalChatPanel: config.get(CONFIG_KEY.experimentalChatPanel, isTesting),
experimentalChatPredictions: config.get(CONFIG_KEY.experimentalChatPredictions, isTesting),
experimentalSearchPanel: config.get(CONFIG_KEY.experimentalNewSearch, isTesting),
inlineChat: config.get(CONFIG_KEY.inlineChatEnabled, true),
codeActions: config.get(CONFIG_KEY.codeActionsEnabled, true),
chatPreInstruction: config.get(CONFIG_KEY.chatPreInstruction),
experimentalGuardrails: config.get(CONFIG_KEY.experimentalGuardrails, isTesting),
experimentalNonStop: config.get(CONFIG_KEY.experimentalNonStop, isTesting),
Expand All @@ -108,6 +106,11 @@ export function getConfiguration(config: ConfigGetter = vscode.workspace.getConf
),
autocompleteExperimentalGraphContext,

// NOTE: Inline Chat will be deprecated soon - Do not enable inline-chat when experimental.chatPanel is enabled
inlineChat:
config.get(CONFIG_KEY.inlineChatEnabled, false) !== config.get(CONFIG_KEY.experimentalChatPanel, isTesting),
codeActions: config.get(CONFIG_KEY.codeActionsEnabled, true),

/**
* UNDOCUMENTED FLAGS
*/
Expand Down
9 changes: 6 additions & 3 deletions vscode/src/editor/EditorCodeLenses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface EditorCodeLens {
*/
export class EditorCodeLenses implements vscode.CodeLensProvider {
private isEnabled = false
private isInlineChatEnabled = true
private isInlineChatEnabled = false

private _disposables: vscode.Disposable[] = []
private _onDidChangeCodeLenses: vscode.EventEmitter<void> = new vscode.EventEmitter<void>()
Expand Down Expand Up @@ -55,8 +55,11 @@ export class EditorCodeLenses implements vscode.CodeLensProvider {
private updateConfig(): void {
const config = vscode.workspace.getConfiguration('cody')
this.isEnabled = config.get('experimental.commandLenses') as boolean
this.isInlineChatEnabled =
(config.get('inlineChat.enabled') as boolean) && (config.get('inlineChat.codeLenses') as boolean)

// NOTE: Do not enable inline-chat when experimental.chatPanel is enabled
const isInlineChatEnabled =
(config.get('inlineChat.enabled') as boolean) && !(config.get('experimental.chatPanel') as boolean)
this.isInlineChatEnabled = isInlineChatEnabled && (config.get('inlineChat.codeLenses') as boolean)
if (this.isEnabled && !this._disposables.length) {
this.init()
}
Expand Down
10 changes: 6 additions & 4 deletions vscode/src/services/InlineController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,21 @@ export class InlineController implements VsCodeInlineController {
this.userIcon = getIconPath('user', this.extensionPath)

const config = vscode.workspace.getConfiguration('cody')
const enableInlineChat = config.get('inlineChat.enabled') as boolean

if (enableInlineChat) {
// NOTE: Do not enable inline-chat when experimental.chatPanel is enabled
const isNewChatUiEnabled = config.get('experimental.chatPanel') as boolean
const enableInlineChat = config.get('inlineChat.enabled') as boolean
if (!isNewChatUiEnabled && enableInlineChat) {
this.commentController = this.init()
}

// Toggle Inline Chat on Config Change
vscode.workspace.onDidChangeConfiguration(e => {
const config = vscode.workspace.getConfiguration('cody')
if (e.affectsConfiguration('cody')) {
// Inline Chat
const isNewChatUiEnabled = config.get('experimental.chatPanel') as boolean
const enableInlineChat = config.get('inlineChat.enabled') as boolean
if (enableInlineChat) {
if (!isNewChatUiEnabled && enableInlineChat) {
this.commentController = this.init()
return
}
Expand Down
7 changes: 0 additions & 7 deletions vscode/src/services/StatusBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,6 @@ export function createStatusBar(): CodyStatusBar {
'cody.editorTitleCommandIcon',
c => c.editorTitleCommandIcon
),
createFeatureToggle(
'Inline Chat',
undefined,
'Enable chatting and editing with Cody, directly in your code',
'cody.inlineChat.enabled',
c => c.inlineChat
),
createFeatureToggle(
'Code Actions',
undefined,
Expand Down
2 changes: 1 addition & 1 deletion vscode/test/e2e/inline-assist.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const expectedEvents = [
test.beforeEach(() => {
resetLoggedEvents()
})
test('start a fixup job from inline chat with valid auth', async ({ page, sidebar }) => {
test.skip('start a fixup job from inline chat with valid auth', async ({ page, sidebar }) => {
// Sign into Cody
await sidebarSignin(page, sidebar)

Expand Down
2 changes: 1 addition & 1 deletion vscode/test/e2e/inline-chat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const expectedEvents = [
test.beforeEach(() => {
resetLoggedEvents()
})
test('start a fixup job from inline chat with valid auth', async ({ page, sidebar }) => {
test.skip('start a fixup job from inline chat with valid auth', async ({ page, sidebar }) => {
// Sign into Cody
await sidebarSignin(page, sidebar)

Expand Down
2 changes: 2 additions & 0 deletions vscode/test/fixtures/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
"cody.codebase": "http://localhost:49300",
"cody.debug.enable": true,
"cody.debug.verbose": true,
"cody.inlineChat.enabled": true,
"cody.experimental.chatPanel": false,
}

0 comments on commit 776b072

Please sign in to comment.