Skip to content

Commit 85f0a08

Browse files
committed
Bump version to 1.888.0 and simplify ghost text suggestion logic
1 parent 8707528 commit 85f0a08

2 files changed

Lines changed: 10 additions & 15 deletions

File tree

apps/editor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gemini-coder",
33
"displayName": "Code Web Chat",
44
"description": "The fastest way to code with AI (CWC)",
5-
"version": "1.887.0",
5+
"version": "1.888.0",
66
"scripts": {
77
"build": "npx vsce package --no-dependencies",
88
"vscode:prepublish": "rimraf out && npm run compile",

packages/ui/src/components/editor/panel/prompts/PromptField/hooks/use-ghost-text.ts

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,17 @@ export const use_ghost_text = (params: {
8282
pre_caret_range.selectNodeContents(params.input_ref.current)
8383
pre_caret_range.setEnd(range.startContainer, range.startOffset)
8484
const text_before_cursor = pre_caret_range.toString()
85-
const last_word_match = text_before_cursor.match(/[\S]+$/)
85+
const last_word_match = text_before_cursor.match(
86+
/[a-zA-Z_][a-zA-Z0-9_]*$/
87+
)
8688

8789
if (last_word_match) {
88-
const last_word_with_prefix = last_word_match[0]
89-
const word_start_match =
90-
last_word_with_prefix.match(/[a-zA-Z_]/)
91-
if (word_start_match) {
92-
const last_word = last_word_with_prefix.substring(
93-
word_start_match.index ?? 0
94-
)
95-
if (last_word.length >= 2) {
96-
for (const id of identifiers) {
97-
if (id.startsWith(last_word) && id !== last_word) {
98-
potential_ghost_text = id.substring(last_word.length)
99-
break
100-
}
90+
const last_word = last_word_match[0]
91+
if (last_word.length >= 2) {
92+
for (const id of identifiers) {
93+
if (id.startsWith(last_word) && id !== last_word) {
94+
potential_ghost_text = id.substring(last_word.length)
95+
break
10196
}
10297
}
10398
}

0 commit comments

Comments
 (0)