Skip to content

Commit

Permalink
Cody: Simplify command related UI (#53395)
Browse files Browse the repository at this point in the history
  • Loading branch information
umpox committed Jun 14, 2023
1 parent 4ccea90 commit 42a29ce
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 50 deletions.
2 changes: 2 additions & 0 deletions client/cody/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Starting from `0.2.0`, Cody is using `major.EVEN_NUMBER.patch` for release versi

### Changed

- Simplified the appearance of commands in various parts of the UI [pull/53395](https://github.com/sourcegraph/sourcegraph/pull/53395)

## [0.2.3]

### Added
Expand Down
111 changes: 73 additions & 38 deletions client/cody/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,117 +228,143 @@
"commands": [
{
"command": "cody.welcome",
"title": "Cody: Help & Getting Started",
"title": "Help & Getting Started",
"category": "Cody",
"group": "Cody",
"icon": "$(book)"
},
{
"command": "cody.feedback",
"title": "Cody: Feedback",
"title": "Feedback",
"category": "Cody",
"group": "Cody",
"icon": "$(feedback)"
},
{
"command": "cody.recipe.optimize-code",
"title": "Ask Cody: Optimize Code"
"category": "Ask Cody",
"title": "Optimize Code"
},
{
"command": "cody.recipe.explain-code",
"title": "Ask Cody: Explain Code in Detail"
"category": "Ask Cody",
"title": "Explain Code in Detail"
},
{
"command": "cody.recipe.explain-code-high-level",
"title": "Ask Cody: Explain Code at a High Level"
"category": "Ask Cody",
"title": "Explain Code at a High Level"
},
{
"command": "cody.recipe.generate-unit-test",
"title": "Ask Cody: Generate Unit Test"
"category": "Ask Cody",
"title": "Generate Unit Test"
},
{
"command": "cody.recipe.generate-docstring",
"title": "Ask Cody: Generate Docstring"
"category": "Ask Cody",
"title": "Generate Docstring"
},
{
"command": "cody.recipe.translate-to-language",
"title": "Ask Cody: Translate to Language"
"category": "Ask Cody",
"title": "Translate to Language"
},
{
"command": "cody.recipe.git-history",
"title": "Ask Cody: Summarize Recent Code Changes"
"category": "Ask Cody",
"title": "Summarize Recent Code Changes"
},
{
"command": "cody.recipe.improve-variable-names",
"title": "Ask Cody: Improve Variable Names"
"category": "Ask Cody",
"title": "Improve Variable Names"
},
{
"command": "cody.recipe.fixup",
"title": "Cody: Fixup"
"category": "Cody",
"title": "Fixup"
},
{
"command": "cody.recipe.context-search",
"title": "Ask Cody: Codebase Context Search"
"category": "Ask Cody",
"title": "Codebase Context Search"
},
{
"command": "cody.set-access-token",
"title": "Cody: Set Access Token"
"category": "Cody",
"title": "Set Access Token"
},
{
"command": "cody.delete-access-token",
"title": "Cody: Sign out"
"category": "Cody",
"title": "Sign out"
},
{
"command": "cody.clear-chat-history",
"title": "Cody: Clear chat history"
"category": "Cody",
"title": "Clear chat history"
},
{
"command": "cody.manual-completions",
"title": "Cody: Open Completions Panel"
"category": "Cody",
"title": "Open Completions Panel"
},
{
"command": "cody.settings",
"title": "Cody: Settings",
"category": "Cody",
"title": "Settings",
"group": "Cody",
"icon": "$(gear)"
},
{
"command": "cody.focus",
"title": "Cody: Sign In"
"category": "Cody",
"title": "Sign In"
},
{
"command": "cody.interactive.clear",
"title": "Cody: Start a New Chat Session",
"category": "Cody",
"title": "Start a New Chat Session",
"group": "Cody",
"icon": "$(add)"
},
{
"command": "cody.history",
"title": "Cody: Chat History",
"category": "Cody",
"title": "Chat History",
"group": "Cody",
"icon": "$(list-unordered)"
},
{
"command": "cody.walkthrough.showLogin",
"title": "Cody Walkthrough: Show Login"
"category": "Cody Walkthrough",
"title": "Show Login"
},
{
"command": "cody.walkthrough.showChat",
"title": "Cody Walkthrough: Show Chat"
"category": "Cody Walkthrough",
"title": "Show Chat"
},
{
"command": "cody.walkthrough.showFixup",
"title": "Cody Walkthrough: Show Fixup"
"category": "Cody Walkthrough",
"title": "Show Fixup"
},
{
"command": "cody.walkthrough.showExplain",
"title": "Cody Walkthrough: Show Explain"
"category": "Cody Walkthrough",
"title": "Show Explain"
},
{
"command": "cody.walkthrough.enableInlineAssist",
"title": "Cody Walkthrough: Show Inline Assist"
"category": "Cody Walkthrough",
"title": "Show Inline Assist"
},
{
"command": "cody.walkthrough.enableCodeCompletions",
"title": "Cody Walkthrough: Enable Code Completions"
"category": "Cody Walkthrough",
"title": "Enable Code Completions"
},
{
"command": "cody.comment.add",
Expand All @@ -349,71 +375,80 @@
},
{
"command": "cody.comment.delete",
"title": "Cody Inline Assist: Remove Comment",
"title": "Remove Comment",
"category": "Cody Inline Assist",
"when": "cody.activated && cody.inline-assist.enabled",
"enablement": "!commentThreadIsEmpty",
"icon": "$(trash)"
},
{
"command": "cody.comment.load",
"title": "Cody Inline Assist: Loading",
"title": "Loading",
"category": "Cody Inline Assist",
"when": "cody.activated && cody.inline-assist.enabled",
"enablement": "!commentThreadIsEmpty",
"icon": "$(sync~spin)"
},
{
"command": "cody.guardrails.debug",
"title": "Cody: Guardrails Debug Attribution",
"category": "Cody",
"title": "Guardrails Debug Attribution",
"enablement": "config.cody.experimental.guardrails && editorHasSelection"
},
{
"command": "cody.recipe.file-touch",
"title": "Cody: Touch"
"category": "Cody",
"title": "Touch"
},
{
"command": "cody.inline.insert",
"title": "Cody: Insert text at the current cursor position"
"category": "Cody",
"title": "Insert text at the current cursor position"
},
{
"command": "cody.recipe.non-stop",
"title": "Cody: Fixup (Experimental)",
"category": "Cody",
"title": "Fixup (Experimental)",
"icon": "resources/cody.png",
"when": "cody.nonstop.fixups.enabled",
"enablement": "cody.nonstop.fixups.enabled && editorHasSelection"
},
{
"command": "cody.fixup.open",
"title": "Cody: Go to Fixup",
"category": "Cody",
"title": "Go to Fixup",
"when": "cody.nonstop.fixups.enabled",
"enablement": "cody.nonstop.fixups.enabled",
"icon": "$(file-code)"
},
{
"command": "cody.fixup.apply",
"title": "Cody: Apply fixup",
"category": "Cody",
"title": "Apply fixup",
"when": "cody.nonstop.fixups.enabled",
"enablement": "!cody.fixup.view.isEmpty",
"icon": "$(check)"
},
{
"command": "cody.fixup.apply-all",
"title": "Cody: Apply all fixups",
"category": "Cody",
"title": "Apply all fixups",
"when": "cody.nonstop.fixups.enabled",
"enablement": "!cody.fixup.view.isEmpty",
"icon": "$(check-all)"
},
{
"command": "cody.fixup.apply-by-file",
"title": "Cody: Apply fixups to selected directory",
"category": "Cody",
"title": "Apply fixups to selected directory",
"when": "cody.nonstop.fixups.enabled",
"enablement": "!cody.fixup.view.isEmpty",
"icon": "$(check-all)"
},
{
"command": "cody.fixup.diff",
"title": "Cody: Show diff for fixup",
"category": "Cody",
"title": "Show diff for fixup",
"when": "cody.nonstop.fixups.enabled",
"enablement": "!cody.fixup.view.isEmpty",
"icon": "$(diff)"
Expand Down Expand Up @@ -444,7 +479,7 @@
],
"submenus": [
{
"label": "Ask Cody",
"label": "Cody",
"id": "cody.submenu"
}
],
Expand Down
2 changes: 1 addition & 1 deletion client/cody/test/e2e/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test('requires a valid auth token and allows logouts', async ({ page, sidebar })

await page.getByRole('button', { name: 'Chat Section' }).hover()

await page.click('[aria-label="Cody: Settings"]')
await page.click('[aria-label="Settings"]')
await sidebar.getByRole('button', { name: 'Logout' }).click()

await expect(sidebar.getByRole('button', { name: 'Sign In' })).toBeVisible()
Expand Down
2 changes: 1 addition & 1 deletion client/cody/test/e2e/fixup-decorator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test('decorations from un-applied Cody changes appear', async ({ page, sidebar }
await page.keyboard.press('ArrowDown')

// Open the command palette by clicking on the Cody Icon
await page.getByRole('button', { name: /Cody: Fixup.*/ }).click()
await page.getByRole('button', { name: 'Fixup (Experimental)' }).click()

// Wait for the input box to appear
await page.getByPlaceholder('Ask Cody to edit your code, or use /chat to ask a question.').click()
Expand Down
4 changes: 2 additions & 2 deletions client/cody/test/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export const test = base
// Ensure we're logged out
// TODO(philipp-spiess): Find a way to access the extension host via the injected
// electron process so we can run the hidden command instead.
if (await page.isVisible('[aria-label="Cody: Settings"]')) {
await page.click('[aria-label="Cody: Settings"]')
if (await page.isVisible('[aria-label="Settings"]')) {
await page.click('[aria-label="Settings"]')
await sidebar.getByRole('button', { name: 'Logout' }).click()
}

Expand Down
8 changes: 4 additions & 4 deletions client/cody/test/e2e/history.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ test('checks for the chat history and new session', async ({ page, sidebar }) =>

await page.getByRole('button', { name: 'Chat Section' }).hover()

await page.click('[aria-label="Cody: Chat History"]')
await page.click('[aria-label="Chat History"]')
await expect(sidebar.getByText('Chat History')).toBeVisible()

// start a new chat session and check history

await page.click('[aria-label="Cody: Start a New Chat Session"]')
await page.click('[aria-label="Start a New Chat Session"]')
await expect(sidebar.getByText("Hello! I'm Cody. I can write code and answer questions for you.")).toBeVisible()

await sidebar.getByRole('textbox', { name: 'Text area' }).fill('Hello')
await sidebar.locator('vscode-button').getByRole('img').click()
await expect(sidebar.getByText('Hello')).toBeVisible()
await page.getByRole('button', { name: 'Cody: Chat History' }).click()
await page.getByRole('button', { name: 'Chat History' }).click()
await sidebar.locator('vscode-button').filter({ hasText: 'Hello' }).click()
await page.getByRole('button', { name: 'Cody: Chat History' }).click()
await page.getByRole('button', { name: 'Chat History' }).click()
await sidebar.locator('vscode-button').filter({ hasText: 'Hello' }).locator('i').click()
await expect(sidebar.getByText('Hello')).not.toBeVisible()
})
8 changes: 4 additions & 4 deletions client/cody/test/e2e/task-controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('task tree view for non-stop cody', async ({ page, sidebar }) => {
await page.getByRole('button', { name: 'Fixups Section' }).click()

// Cody Fixup button should not be enabled if no text is selected.
await expect(page.getByRole('button', { name: /Cody: Fixup.*/, disabled: true })).toBeVisible()
await expect(page.getByRole('button', { name: 'Fixup (Experimental)', disabled: true })).toBeVisible()

// Find the text hello cody, and then highlight the text
await page.getByText('<title>Hello Cody</title>').click()
Expand All @@ -30,7 +30,7 @@ test('task tree view for non-stop cody', async ({ page, sidebar }) => {
await page.keyboard.press('ArrowDown')

// Open the command palette by clicking on the Cody Icon
await page.getByRole('button', { name: /Cody: Fixup.*/ }).click()
await page.getByRole('button', { name: 'Fixup (Experimental)' }).click()

// Wait for the input box to appear
await page.getByPlaceholder('Ask Cody to edit your code, or use /chat to ask a question.').click()
Expand All @@ -53,13 +53,13 @@ test('task tree view for non-stop cody', async ({ page, sidebar }) => {

// Diff view button
await page.locator('a').filter({ hasText: 'replace hello with goodbye' }).click()
await page.getByRole('button', { name: 'Cody: Show diff for fixup' }).click()
await page.getByRole('button', { name: 'Show diff for fixup' }).click()
await expect(page.getByText(/^Cody Fixup Diff View.*/)).toBeVisible()

// Apply fixup button on Click
await page.locator('a').filter({ hasText: 'replace hello with goodbye' }).click()
await expect(page.getByText('<title>Hello Cody</title>')).toBeVisible()
await page.getByRole('button', { name: 'Cody: Apply fixup' }).click()
await page.getByRole('button', { name: 'Apply fixup' }).click()
await expect(page.getByText('No pending Cody fixups')).toBeVisible()

// Close the diff view
Expand Down

0 comments on commit 42a29ce

Please sign in to comment.