Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in the transcript context list, omit needless '@' prefix #3439

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 4 additions & 4 deletions vscode/test/e2e/chat-atFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ test('@-mention file range', async ({ page, sidebar }) => {
await chatPanelFrame.getByText('✨ Context: 3 lines from 1 file').hover()
await chatPanelFrame.getByText('✨ Context: 3 lines from 1 file').click()
const chatContext = chatPanelFrame.locator('details').last()
await chatContext.getByRole('link', { name: '@buzz.ts:2-4' }).hover()
await chatContext.getByRole('link', { name: '@buzz.ts:2-4' }).click()
await chatContext.getByRole('link', { name: 'buzz.ts:2-4' }).hover()
await chatContext.getByRole('link', { name: 'buzz.ts:2-4' }).click()
const previewTab = page.getByRole('tab', { name: /buzz.ts, preview, Editor Group/ })
await previewTab.hover()
await expect(previewTab).toBeVisible()
Expand Down Expand Up @@ -341,8 +341,8 @@ test.extend<ExpectedEvents>({
await chatPanelFrame.getByText('✨ Context: 15 lines from 1 file').hover()
await chatPanelFrame.getByText('✨ Context: 15 lines from 1 file').click()
const chatContext = chatPanelFrame.locator('details').last()
await chatContext.getByRole('link', { name: '@buzz.ts:1-15' }).hover()
await chatContext.getByRole('link', { name: '@buzz.ts:1-15' }).click()
await chatContext.getByRole('link', { name: 'buzz.ts:1-15' }).hover()
await chatContext.getByRole('link', { name: 'buzz.ts:1-15' }).click()
const previewTab = page.getByRole('tab', { name: /buzz.ts, preview, Editor Group/ })
await previewTab.hover()
await expect(previewTab).toBeVisible()
Expand Down
6 changes: 3 additions & 3 deletions vscode/test/e2e/command-core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test.extend<ExpectedEvents>({

// Click on the file link in chat
const chatContext = chatPanel.locator('details').last()
await chatContext.getByRole('link', { name: '@index.html' }).click()
await chatContext.getByRole('link', { name: 'index.html' }).click()

// Check if the file is opened
await expect(page.getByRole('list').getByText('index.html')).toBeVisible()
Expand All @@ -66,7 +66,7 @@ test.extend<ExpectedEvents>({
await expect(page.getByText('Explain Code')).toBeVisible()
await page.getByText('Explain Code').click()
await chatPanel.getByText('Context: 20 lines from 1 file').click()
await expect(chatPanel.locator('span').filter({ hasText: '@index.html:2-10' })).toBeVisible()
await expect(chatPanel.locator('details').filter({ hasText: 'index.html:2-10' })).toBeVisible()
const disabledEditButtons = chatPanel.getByTitle('Cannot Edit Command').locator('i')
const editLastMessageButton = chatPanel.getByRole('button', { name: /^Edit Last Message/ })
// Edit button and Edit Last Message are shown on all command messages.
Expand All @@ -79,7 +79,7 @@ test.extend<ExpectedEvents>({
await page.getByText('Find Code Smells').click()
await expect(chatPanel.getByText('Context: 9 lines from 1 file')).toBeVisible()
await chatPanel.getByText('Context: 9 lines from 1 file').click()
await expect(chatPanel.locator('span').filter({ hasText: '@index.html:2-10' })).toBeVisible()
await expect(chatPanel.locator('details').filter({ hasText: 'index.html:2-10' })).toBeVisible()
await expect(disabledEditButtons).toHaveCount(0)
await expect(editLastMessageButton).toBeVisible()
})
Expand Down
22 changes: 11 additions & 11 deletions vscode/test/e2e/command-custom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ test.extend<ExpectedEvents>({
await expect(chatPanel.getByText('✨ Context: 56 lines from 5 files')).toBeVisible()
await chatPanel.getByText('✨ Context: 56 lines from 5 files').click()
// Display the context files to confirm no hidden files are included
await expect(chatPanel.locator('span').filter({ hasText: '@.mydotfile:1-2' })).not.toBeVisible()
await expect(chatPanel.locator('span').filter({ hasText: '@error.ts:1-9' })).toBeVisible()
await expect(chatPanel.locator('span').filter({ hasText: '@Main.java:1-9' })).toBeVisible()
await expect(chatPanel.locator('span').filter({ hasText: '@buzz.test.ts:1-12' })).toBeVisible()
await expect(chatPanel.locator('span').filter({ hasText: '@buzz.ts:1-15' })).toBeVisible()
await expect(chatPanel.locator('span').filter({ hasText: '@index.html:1-11' })).toBeVisible()
await expect(chatPanel.locator('details').filter({ hasText: '.mydotfile:1-2' })).not.toBeVisible()
await expect(chatPanel.locator('details').filter({ hasText: 'error.ts:1-9' })).toBeVisible()
await expect(chatPanel.locator('details').filter({ hasText: 'Main.java:1-9' })).toBeVisible()
await expect(chatPanel.locator('details').filter({ hasText: 'buzz.test.ts:1-12' })).toBeVisible()
await expect(chatPanel.locator('details').filter({ hasText: 'buzz.ts:1-15' })).toBeVisible()
await expect(chatPanel.locator('details').filter({ hasText: 'index.html:1-11' })).toBeVisible()

/* Test: context.filePath with filePath command */

Expand All @@ -204,12 +204,12 @@ test.extend<ExpectedEvents>({
await expect(chatPanel.getByText('✨ Context: 12 lines from 2 file')).toBeVisible()
await chatPanel.getByText('✨ Context: 12 lines from 2 file').click()
await expect(
chatPanel.locator('span').filter({ hasText: withPlatformSlashes('@lib/batches/env/var.go:1') })
chatPanel.locator('details').filter({ hasText: withPlatformSlashes('lib/batches/env/var.go:1') })
).toBeVisible()
// Click on the file link should open the 'var.go file in the editor
const chatContext = chatPanel.locator('details').last()
await chatContext
.getByRole('link', { name: withPlatformSlashes('@lib/batches/env/var.go:1') })
.getByRole('link', { name: withPlatformSlashes('lib/batches/env/var.go:1') })
.click()
await expect(page.getByRole('tab', { name: 'var.go' })).toBeVisible()

Expand All @@ -224,9 +224,9 @@ test.extend<ExpectedEvents>({
// The files from the open tabs should be added as context
await expect(chatPanel.getByText('✨ Context: 12 lines from 2 files')).toBeVisible()
await chatPanel.getByText('✨ Context: 12 lines from 2 files').click()
await expect(chatContext.getByRole('link', { name: '@index.html:1-11' })).toBeVisible()
await expect(chatContext.getByRole('link', { name: 'index.html:1-11' })).toBeVisible()
await expect(
chatContext.getByRole('link', { name: withPlatformSlashes('@lib/batches/env/var.go:1') })
chatContext.getByRole('link', { name: withPlatformSlashes('lib/batches/env/var.go:1') })
).toBeVisible()
})

Expand Down Expand Up @@ -325,6 +325,6 @@ testGitWorkspace('use terminal output as context', async ({ page, sidebar }) =>
await panel.getByText('✨ Context: 1 line from 2 files').click()
const chatContext = panel.locator('details').last()
await expect(
chatContext.getByRole('link', { name: withPlatformSlashes('@/terminal-output') })
chatContext.getByRole('link', { name: withPlatformSlashes('/terminal-output') })
).toBeVisible()
})
2 changes: 1 addition & 1 deletion vscode/webviews/Components/FileLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const FileLink: React.FunctionComponent<FileLinkProps> = ({
)
}

const pathToDisplay = `@${displayPath(uri)}`
const pathToDisplay = displayPath(uri)
const pathWithRange = range ? `${pathToDisplay}:${displayLineRange(range)}` : pathToDisplay
const tooltip = source ? `${pathWithRange} included via ${source}` : pathWithRange
const { href, target } = webviewOpenURIForContextItem({ uri, range })
Expand Down
Loading