Skip to content

Commit 495a380

Browse files
committed
Refactor the command to directly manage file check states via the
1 parent 1e70093 commit 495a380

2 files changed

Lines changed: 8 additions & 19 deletions

File tree

‎packages/vscode/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@
516516
"scope": "resource",
517517
"description": "Style of generated code blocks in \"Edit context\" mode.",
518518
"default": {
519-
"whole": "Whenever proposing a new or updated file use the Markdown Code Block syntax. It's very important to place a file path in a comment on the top of the code block. Please show me the full code of the changed files—I have a disability which means I can't type and need to be able to copy and paste the full code. Don't use XML for files.",
520-
"truncated": "Whenever proposing a new or updated file use the Markdown Code Block syntax. It's very important to place a file path in a comment on the top of the code block. Use ellipsis comments, e.g. \"// ...\", when appropriate. Don't use XML for files.",
519+
"whole": "Whenever proposing a new or updated file use the Markdown Code Block syntax. It's very important to place a file path in a comment on the top of the code block. Please show me the full code of the changed files because I have a disability which means I can't type and need to be able to copy and paste the full code. Don't use XML for files.",
520+
"truncated": "Whenever proposing a new or updated file use the Markdown Code Block syntax. It's very important to place a full file path in a comment on the top of the code block. Use ellipsis comments, e.g. \"// ...\", when appropriate. Don't use XML for files.",
521521
"diff": "Whenever proposing a new or updated file use the Markdown Code Block syntax. Each code block should be a diff patch. Don't use XML for files."
522522
},
523523
"properties": {

‎packages/vscode/src/commands/reference-in-chat-command.ts‎

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ import * as vscode from 'vscode'
22
import * as path from 'path'
33
import { WorkspaceProvider } from '../context/providers/workspace-provider'
44
import { FileItem } from '../context/providers/workspace-provider'
5-
import { SharedFileState } from '../context/shared-file-state'
65
import { dictionary } from '@shared/constants/dictionary'
76
import { ViewProvider } from '@/views/panel/backend/view-provider'
87

9-
export function reference_in_chat_command(
8+
export const reference_in_chat_command = (
109
view_provider: ViewProvider | undefined,
1110
workspace_provider: WorkspaceProvider | undefined
12-
) {
11+
) => {
1312
return vscode.commands.registerCommand(
1413
'codeWebChat.referenceInChat',
1514
async (uri: FileItem) => {
@@ -29,23 +28,13 @@ export function reference_in_chat_command(
2928
return
3029
}
3130

32-
const shared_state = SharedFileState.get_instance()
33-
const is_checked = shared_state.get_checked_files().includes(file_path)
31+
const is_checked = workspace_provider
32+
.get_all_checked_paths()
33+
.includes(file_path)
3434

3535
if (!is_checked) {
36-
const temp_item = new FileItem(
37-
path.basename(file_path),
38-
uri.resourceUri,
39-
vscode.TreeItemCollapsibleState.None,
40-
false,
41-
vscode.TreeItemCheckboxState.Checked,
42-
false,
43-
false,
44-
false
45-
)
46-
4736
await workspace_provider.update_check_state(
48-
temp_item,
37+
uri,
4938
vscode.TreeItemCheckboxState.Checked
5039
)
5140
}

0 commit comments

Comments
 (0)