Skip to content

Commit 4756dc7

Browse files
authored
Chat: fix welcome messages in chat view (#3155)
CLOSE #3085 The regex for allowed URIs in chat messages was updated to allow additional custom URI schemes like 'command:cody.*'. This allows linking directly to Cody guides and other custom VS Code commands from within the chat. Previously only the `_cody.vscode.open` command is allowed in the chat view, which blocked the `Cody Commands` and `Getting Started Guide` commands from working in the chat view. This PR adds the `command:cody.` prefix to fix the aforementioned issue. ![image](https://github.com/sourcegraph/cody/assets/68532117/08b5118d-a1d9-4238-aa20-ff963fbde935) ## Test plan <!-- Required. See https://sourcegraph.com/docs/dev/background-information/testing_principles. --> Click on the `Cody Commands` and `Getting Started Guide` links in a new chat to make sure they work: https://github.com/sourcegraph/cody/assets/68532117/bf12648f-1f05-48da-bdeb-8a52dfb57eca
1 parent 8e6278a commit 4756dc7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/shared/src/chat/markdown.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import {
1111
* - e.g. command:cody.welcome: VS Code command scheme exception we add to support directly linking to the welcome guide from within the chat.
1212
* {@link CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID}
1313
*/
14-
const ALLOWED_URI_REGEXP = /^((https?|vscode):\/\/[^\s#$./?].\S*|command:(_cody.vscode.open\?.*))$/i
14+
const ALLOWED_URI_REGEXP =
15+
/^((https?|vscode):\/\/[^\s#$./?].\S*|command:cody.*|command:(_cody.vscode.open\?.*))$/i
1516

1617
const DOMPURIFY_CONFIG = {
1718
ALLOWED_TAGS: [

vscode/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ This is a log of all notable changes to Cody for VS Code. [Unreleased] changes a
77
### Added
88

99
- Cody can now generate commit messages from your changes. Triggered through the input field in the VS Code "Source Control" sidebar. [pull/2306](https://github.com/sourcegraph/cody/pull/2306)
10+
- Chat: Displays warnings for large @-mentioned files during selection. [pull/3118](https://github.com/sourcegraph/cody/pull/3118)
1011

1112
### Fixed
1213

14+
- Chat: Fixed an issue where the links in the welcome message for chat are unclickable. [pull/3155](https://github.com/sourcegraph/cody/pull/3155)
15+
1316
### Changed
1417

1518
- Autocomplete: Removes the latency for cached completions. [https://github.com/sourcegraph/cody/pull/3138](https://github.com/sourcegraph/cody/pull/3138)

0 commit comments

Comments
 (0)