Skip to content

Commit 7b5e4a4

Browse files
committed
Rename setRange command to setRanges and update related descriptions to support multiple line ranges
1 parent 1240247 commit 7b5e4a4

6 files changed

Lines changed: 24 additions & 28 deletions

File tree

‎README.md‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ Code Web Chat (CWC) is a free and open-source, independent AI coding toolkit for
2121
<img src="https://github.com/robertpiosik/CodeWebChat/raw/HEAD/packages/shared/src/media/screenshot.png" alt="Screenshot" />
2222
</p>
2323

24-
## Introduction
25-
26-
Pick all the necessary files, including useful examples, for a lean, task-focused context. Such steered model is easy to prompt, for edits you're looking for. CWC is a perfect companion for all kinds of coding tasks; from tedious refactors to complex features.
27-
2824
## Enabling autofill in chatbots
2925

3026
Got tired with copy and paste? Simplify the workflow with the browser extension:

‎apps/editor/package.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "gemini-coder",
33
"displayName": "Code Web Chat",
4-
"description": "AI coding in free chatbots (CWC)",
4+
"description": "Fast AI coding in free chatbots (CWC)",
55
"version": "1.809.0",
66
"scripts": {
77
"build": "npx vsce package --no-dependencies",
@@ -315,8 +315,8 @@
315315
"category": "Code Web Chat"
316316
},
317317
{
318-
"command": "codeWebChat.setRange",
319-
"title": "Set Range",
318+
"command": "codeWebChat.setRanges",
319+
"title": "Set Ranges",
320320
"category": "Code Web Chat"
321321
},
322322
{
@@ -486,7 +486,7 @@
486486
"when": "false"
487487
},
488488
{
489-
"command": "codeWebChat.setRange",
489+
"command": "codeWebChat.setRanges",
490490
"when": "false"
491491
},
492492
{
@@ -652,7 +652,7 @@
652652
"group": "2_modification@3"
653653
},
654654
{
655-
"command": "codeWebChat.setRange",
655+
"command": "codeWebChat.setRanges",
656656
"when": "view == codeWebChatViewOpenEditors && viewItem == openEditor",
657657
"group": "2_modification@4"
658658
},
@@ -702,7 +702,7 @@
702702
"group": "1_modification@5"
703703
},
704704
{
705-
"command": "codeWebChat.setRange",
705+
"command": "codeWebChat.setRanges",
706706
"when": "(view == codeWebChatViewWorkspace || view == codeWebChatViewContext) && viewItem == file",
707707
"group": "1_modification@6"
708708
}

‎apps/editor/src/commands/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export * from './reference-in-prompt-command'
1616
export * from './rename-command'
1717
export * from './save-all-command'
1818
export * from './apply-context-command'
19-
export * from './set-range-command'
19+
export * from './set-ranges-command'
2020
export * from './check-parent-folder-command'
2121
export * from './uncheck-parent-folder-command'
2222
export * from './check-all-with-keywords'

apps/editor/src/commands/set-range-command.ts renamed to apps/editor/src/commands/set-ranges-command.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import {
77
} from '../context/providers/workspace/workspace-provider'
88
import {
99
RANGES_STATE_KEY,
10-
LAST_RANGE_SAVE_LOCATION_STATE_KEY
10+
LAST_RANGES_SAVE_LOCATION_STATE_KEY
1111
} from '../constants/state-keys'
1212

13-
export const set_range_command = (
13+
export const set_ranges_command = (
1414
workspace_provider: WorkspaceProvider,
1515
context: vscode.ExtensionContext
1616
) => {
1717
return vscode.commands.registerCommand(
18-
'codeWebChat.setRange',
18+
'codeWebChat.setRanges',
1919
async (item: FileItem) => {
2020
if (!item || !item.resourceUri) {
2121
return
@@ -70,9 +70,9 @@ export const set_range_command = (
7070
const state_range_value = state_ranges[state_key]
7171
const current_range = file_range_value || state_range_value
7272

73-
const new_range = await vscode.window.showInputBox({
74-
prompt: `Set a range of lines to include in the context`,
75-
title: 'Range',
73+
const new_ranges = await vscode.window.showInputBox({
74+
prompt: `Set ranges of lines to include in the context`,
75+
title: 'Ranges',
7676
placeHolder: 'e.g., 100-300 400- -500 or empty to clear',
7777
value: current_range,
7878
validateInput: (value) => {
@@ -135,12 +135,12 @@ export const set_range_command = (
135135
}
136136
})
137137

138-
if (new_range === undefined) {
138+
if (new_ranges === undefined) {
139139
return
140140
}
141141

142142
// If range is cleared, remove from both locations
143-
if (!new_range) {
143+
if (!new_ranges) {
144144
let changed = false
145145
if (file_ranges[relative_path]) {
146146
delete file_ranges[relative_path]
@@ -182,7 +182,7 @@ export const set_range_command = (
182182
else {
183183
const last_location = context.workspaceState.get<
184184
'file' | 'state' | undefined
185-
>(LAST_RANGE_SAVE_LOCATION_STATE_KEY)
185+
>(LAST_RANGES_SAVE_LOCATION_STATE_KEY)
186186

187187
const choice = await vscode.window.showQuickPick(
188188
[
@@ -197,19 +197,19 @@ export const set_range_command = (
197197
picked: last_location == 'state'
198198
}
199199
],
200-
{ placeHolder: 'Where do you want to save this range?' }
200+
{ placeHolder: 'Where do you want to save these ranges?' }
201201
)
202202

203203
if (!choice) return
204204
save_location = choice.label == 'JSON File' ? 'file' : 'state'
205205
await context.workspaceState.update(
206-
LAST_RANGE_SAVE_LOCATION_STATE_KEY,
206+
LAST_RANGES_SAVE_LOCATION_STATE_KEY,
207207
save_location
208208
)
209209
}
210210

211-
if (new_range) {
212-
const formatted_range = new_range.trim().split(/\s+/).join(' ')
211+
if (new_ranges) {
212+
const formatted_range = new_ranges.trim().split(/\s+/).join(' ')
213213

214214
if (save_location == 'file') {
215215
file_ranges[relative_path] = formatted_range
@@ -231,7 +231,7 @@ export const set_range_command = (
231231
}
232232
} catch (error: any) {
233233
vscode.window.showErrorMessage(
234-
`Failed to save range to file: ${error.message}`
234+
`Failed to save ranges to file: ${error.message}`
235235
)
236236
}
237237
} else {

‎apps/editor/src/constants/state-keys.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const LAST_APPLIED_CLIPBOARD_CONTENT_STATE_KEY =
66
export const QUICK_SAVES_STATE_KEY = 'quick-saves'
77
export const LAST_CONTEXT_SAVE_LOCATION_STATE_KEY = 'last-save-location'
88
export const RANGES_STATE_KEY = 'ranges'
9-
export const LAST_RANGE_SAVE_LOCATION_STATE_KEY = 'last-range-save-location'
9+
export const LAST_RANGES_SAVE_LOCATION_STATE_KEY = 'last-ranges-save-location'
1010
export const LAST_APPLY_CONTEXT_OPTION_STATE_KEY = 'last-apply-context-option'
1111
export const CONTEXT_CHECKED_PATHS_STATE_KEY = 'context-checked-paths'
1212
export const CONTEXT_CHECKED_TIMESTAMPS_STATE_KEY = 'context-checked-timestamps'

‎apps/editor/src/extension.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
reference_in_prompt_command,
3131
open_url_command,
3232
generate_commit_message_command,
33-
set_range_command,
33+
set_ranges_command,
3434
check_parent_folder_command,
3535
uncheck_parent_folder_command,
3636
check_all_with_keywords_command,
@@ -133,7 +133,7 @@ export async function activate(context: vscode.ExtensionContext) {
133133
delete_command(),
134134
add_file_to_context_command(workspace_provider),
135135
remove_file_from_context_command(workspace_provider),
136-
set_range_command(workspace_provider, context),
136+
set_ranges_command(workspace_provider, context),
137137
check_parent_folder_command(workspace_provider),
138138
uncheck_parent_folder_command(workspace_provider),
139139
duplicate_workspace_command(workspace_provider, context),

0 commit comments

Comments
 (0)