Skip to content

Commit 1befc8a

Browse files
committed
Merge branch 'dev'
2 parents 9ca8e9e + cc32ce1 commit 1befc8a

19 files changed

Lines changed: 197 additions & 189 deletions

File tree

‎README.md‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<a href="https://marketplace.visualstudio.com/items?itemName=robertpiosik.gemini-coder" target="_blank"><img src="https://img.shields.io/badge/Install-VS_Code_Marketplace-blue" alt="Get from Visual Studio Code Marketplace" /></a> <a href="https://open-vsx.org/extension/robertpiosik/gemini-coder" target="_blank"><img src="https://img.shields.io/badge/Install-Open_VSX_Registry-a60ee5" alt="Get from Open VSX Registry" /></a> <a href="https://github.com/robertpiosik/CodeWebChat/blob/dev/LICENSE" target="_blank"><img src="https://img.shields.io/badge/License-GPL--3.0-green.svg" alt="GPL-3.0 license" /></a>
44

5-
**The privacy AI coding without agents.** Guide the model to production-grade code with engineer-level control over context. Community-driven, free and open-source.
5+
**Meet Code Web Chat, the privacy AI coding without agents.** Guide the model to production-grade code with engineer-level control over context. Community-driven, free and open-source.
66

77
Works with VS Code, and forks like Cursor, Windsurf, and VSCodium.
88

@@ -35,14 +35,17 @@ Therefore, CWC is designed to align with LLMs' true capabilities—that is, code
3535

3636
🙋 **Guide the model with context**
3737

38-
Unlike coding agents that require detailed instructions to understand your intent and locate relevant files, CWC lets you provide context up front, making prompts simpler and responses faster and more accurate.
38+
Unlike coding agents that require detailed instructions to understand your intent and locate relevant files, CWC lets you provide full context up front allowing much simpler instructions. This saves money and time—the model doesn't have to make any tool calls, which are distracting "side quests".
3939

40-
Meet the non-agentic workflow—select folders and files, enter prompt, and send message via...
40+
> [!TIP]
41+
> LLMs are pattern matchers—they love examples! Include some you believe will help the model understand the goal better.
42+
43+
Meet the CWC's non-agentic workflow—select folders and files, enter instructions, and send message via...
4144

4245
- new chat—to continue in the connected browser
4346
- API call—to use a model provider of choice
4447

45-
Constructed message consists of the user's prompt, edit format instructions, and the selected context, as shown in the example:
48+
Constructed message looks like the following example:
4649

4750
```
4851
Implement a subtract function.

‎packages/shared/src/constants/dictionary.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const dictionary = {
8383
URL_OVERRIDE_DIFFERENT_DOMAIN: (preset_name: string) =>
8484
`URL override for preset "${preset_name}" was discarded because it uses a different domain.`,
8585
CONTEXT_SIZE_WARNING: (threshold: string, percentage: number) =>
86-
`Context exceeds threshold of ${threshold} tokens by ${percentage}%. Excessive context size degrades output quality and increase resource usage.`,
86+
`Context exceeds threshold of ${threshold} tokens by ${percentage}%. Excessive context size affects accuracy and cost-efficiency.`,
8787
FAILED_TO_CREATE_FILE: (file_path: string) =>
8888
`Failed to create file: ${file_path}`,
8989
FAILED_TO_APPLY_CHANGES_TO_FILE: (file_path: string) =>
Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,36 @@
11
.dropdown {
22
position: relative;
3-
width: 100%;
43
}
54

65
.button {
76
display: flex;
87
align-items: center;
98
justify-content: space-between;
10-
gap: var(--padding-8px);
119
background: var(--vscode-input-background);
1210
color: var(--vscode-input-foreground);
1311
border: 1px solid var(--cwc-border-color);
1412
padding: var(--padding-4px) var(--padding-8px);
1513
border-radius: var(--border-radius-4px);
1614
cursor: pointer;
1715
width: 100%;
18-
text-align: left;
1916

2017
&:hover {
21-
background: var(--vscode-list-hoverBackground);
18+
border-color: var(--cwc-border-color-hover);
2219
}
2320

24-
&[data-is-open='true'] {
21+
&--open {
2522
border-color: var(--vscode-focusBorder);
26-
outline: 1px solid var(--vscode-focusBorder);
27-
outline-offset: -1px;
23+
24+
&:hover {
25+
border-color: var(--vscode-focusBorder);
26+
}
2827
}
2928
}
3029

3130
.chevron {
32-
transition: transform 0.2s ease;
3331
color: var(--vscode-icon-foreground);
34-
}
3532

36-
.chevron_open {
37-
transform: rotate(180deg);
38-
}
39-
40-
.menu_override {
41-
left: 0;
42-
right: auto;
33+
&--open {
34+
transform: rotate(180deg);
35+
}
4336
}

‎packages/ui/src/components/editor/common/Dropdown/Dropdown.stories.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77

88
const sample_options: Dropdown.Option<string>[] = [
99
{ value: 'option1', label: 'Option 1' },
10-
{ value: 'option2', label: 'Option 2' },
10+
{ value: 'option2', label: 'This is a much longer option label' },
1111
{ value: 'option3', label: 'Option 3' }
1212
]
1313

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState, useRef, useEffect } from 'react'
1+
import { useState, useRef, useEffect, useLayoutEffect, useMemo } from 'react'
22
import cn from 'classnames'
33
import { DropdownMenu } from '../DropdownMenu'
44
import styles from './Dropdown.module.scss'
@@ -13,22 +13,39 @@ export namespace Dropdown {
1313
options: Option<T>[]
1414
value: T
1515
onChange: (value: T) => void
16-
className?: string
17-
max_width?: number
1816
}
1917
}
2018

21-
export const Dropdown = <T extends string>({
22-
options,
23-
value,
24-
onChange,
25-
className,
26-
max_width
27-
}: Dropdown.Props<T>) => {
19+
export const Dropdown = <T extends string>(props: Dropdown.Props<T>) => {
2820
const [is_open, set_is_open] = useState(false)
2921
const dropdown_ref = useRef<HTMLDivElement>(null)
22+
const button_ref = useRef<HTMLButtonElement>(null)
23+
const [width, set_width] = useState<number>()
3024

31-
const selected_option = options.find((opt) => opt.value === value)
25+
const longest_label = useMemo(
26+
() =>
27+
props.options.reduce(
28+
(longest, option) =>
29+
option.label.length > longest.length ? option.label : longest,
30+
''
31+
),
32+
[props.options]
33+
)
34+
35+
useLayoutEffect(() => {
36+
if (button_ref.current && longest_label) {
37+
const canvas = document.createElement('canvas')
38+
const context = canvas.getContext('2d')
39+
if (context) {
40+
const button_style = window.getComputedStyle(button_ref.current)
41+
context.font = button_style.font
42+
const text_width = context.measureText(longest_label).width
43+
set_width(text_width + 40)
44+
}
45+
}
46+
}, [longest_label])
47+
48+
const selected_option = props.options.find((opt) => opt.value == props.value)
3249

3350
const handle_click_outside = (event: MouseEvent) => {
3451
if (
@@ -46,40 +63,33 @@ export const Dropdown = <T extends string>({
4663
}
4764
}, [])
4865

49-
const menu_items: DropdownMenu.Item[] = options.map((option) => ({
66+
const menu_items: DropdownMenu.Item[] = props.options.map((option) => ({
5067
label: option.label,
51-
is_selected: option.value === value,
68+
is_selected: option.value == props.value,
5269
on_click: () => {
53-
onChange(option.value)
70+
props.onChange(option.value)
5471
set_is_open(false)
5572
}
5673
}))
5774

58-
const style = max_width ? { maxWidth: `${max_width}px` } : undefined
75+
const style = width ? { width: `${width}px` } : undefined
5976

6077
return (
61-
<div
62-
className={cn(styles.dropdown, className)}
63-
ref={dropdown_ref}
64-
style={style}
65-
>
78+
<div className={styles.dropdown} ref={dropdown_ref} style={style}>
6679
<button
67-
className={styles.button}
80+
ref={button_ref}
81+
className={cn(styles.button, { [styles['button--open']]: is_open })}
6882
onClick={() => set_is_open(!is_open)}
69-
data-is-open={is_open}
7083
>
7184
<span>{selected_option?.label ?? 'Select...'}</span>
7285
<span
73-
className={cn(
74-
'codicon codicon-chevron-down',
86+
className={cn('codicon codicon-chevron-down', [
7587
styles.chevron,
76-
is_open && styles.chevron_open
77-
)}
88+
{ [styles['chevron--open']]: is_open }
89+
])}
7890
/>
7991
</button>
80-
{is_open && (
81-
<DropdownMenu items={menu_items} className={styles.menu_override} />
82-
)}
92+
{is_open && <DropdownMenu items={menu_items} />}
8393
</div>
8494
)
8595
}

‎packages/ui/src/components/editor/common/DropdownMenu/DropdownMenu.tsx‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { useState } from 'react'
12
import styles from './DropdownMenu.module.scss'
2-
import cn from 'classnames'
33

44
export namespace DropdownMenu {
55
export type Item = {
@@ -11,24 +11,24 @@ export namespace DropdownMenu {
1111

1212
export type Props = {
1313
items: Item[]
14-
on_mouse_enter?: React.MouseEventHandler<HTMLDivElement>
15-
className?: string
1614
}
1715
}
1816

19-
export const DropdownMenu: React.FC<DropdownMenu.Props> = ({
20-
items,
21-
on_mouse_enter,
22-
className
23-
}) => {
17+
export const DropdownMenu: React.FC<DropdownMenu.Props> = (props) => {
18+
const [is_preselection_respected, set_is_preselection_respected] =
19+
useState<boolean>(true)
20+
2421
return (
25-
<div className={cn(styles.menu, className)} onMouseEnter={on_mouse_enter}>
26-
{items.map((item, index) => (
22+
<div className={styles.menu}>
23+
{props.items.map((item, index) => (
2724
<div
2825
key={index}
2926
className={styles.item}
3027
onClick={item.on_click}
31-
data-selected={item.is_selected}
28+
data-selected={item.is_selected && is_preselection_respected}
29+
onMouseEnter={() => {
30+
set_is_preselection_respected(false)
31+
}}
3232
>
3333
<span>{item.label}</span>
3434
{item.shortcut && (

‎packages/ui/src/components/editor/common/Input/Input.module.scss‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
width: 100%;
88
outline: none;
99

10+
&:hover {
11+
border-color: var(--cwc-border-color-hover);
12+
}
13+
1014
&:focus {
11-
outline: 1px solid var(--vscode-focusBorder);
12-
outline-offset: -1px;
15+
border-color: var(--vscode-focusBorder);
1316
}
1417
}

‎packages/ui/src/components/editor/panel/ResponsePreview/ResponsePreview.module.scss‎

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,12 @@
3939
&--small {
4040
font-size: 13px;
4141
}
42-
43-
// &::after {
44-
// position: absolute;
45-
// content: '';
46-
// width: 100%;
47-
// height: 4px;
48-
// bottom: 0;
49-
// left: 0;
50-
// background: var(--vscode-sideBar-background);
51-
// }
5242
}
5343

5444
.list {
55-
display: block;
45+
display: flex;
46+
flex-direction: column;
47+
gap: var(--padding-4px);
5648

5749
> div:first-child {
5850
margin-top: 0;
@@ -67,10 +59,15 @@
6759
align-items: center;
6860
justify-content: space-between;
6961
gap: var(--padding-8px);
70-
padding: 0 var(--padding-12px);
71-
height: var(--list-item-height);
62+
border: 1px solid var(--cwc-border-color-dimmed);
63+
padding: 0 var(--padding-8px);
64+
margin: 0 var(--padding-12px);
65+
height: 34px;
66+
border-radius: 8px;
67+
7268
&:hover {
7369
background-color: var(--vscode-list-hoverBackground);
70+
border-color: var(--cwc-border-color);
7471

7572
.list__file__actions {
7673
display: flex;

‎packages/ui/src/components/editor/panel/ResponsePreview/ResponsePreview.tsx‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,6 @@ export const ResponsePreview: FC<Props> = (props) => {
203203
}}
204204
/>
205205
)}
206-
<IconButton
207-
codicon_icon="diff-single"
208-
title="Open Changes"
209-
on_click={(e) => {
210-
e.stopPropagation()
211-
set_last_clicked_file_index(index)
212-
props.on_focus_file({
213-
file_path: file.file_path,
214-
workspace_name: file.workspace_name
215-
})
216-
}}
217-
/>
218206
<IconButton
219207
codicon_icon="go-to-file"
220208
title="Go To File"

‎packages/ui/src/components/editor/panel/ResponsePreview/components/TextItem.module.scss‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
max-height: 50px;
2828
overflow: hidden;
2929
position: relative;
30-
color: var(--vscode-descriptionForeground);
3130

3231
&:hover {
3332
color: inherit;

0 commit comments

Comments
 (0)