diff options
-rw-r--r-- | extension/package-lock.json | 4 | ||||
-rw-r--r-- | extension/package.json | 2 | ||||
-rw-r--r-- | extension/react-app/src/components/ComboBox.tsx | 58 |
3 files changed, 37 insertions, 27 deletions
diff --git a/extension/package-lock.json b/extension/package-lock.json index 5e2a7e2a..30b9952c 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.223", + "version": "0.0.224", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.223", + "version": "0.0.224", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index 507e00b8..9b9daef6 100644 --- a/extension/package.json +++ b/extension/package.json @@ -14,7 +14,7 @@ "displayName": "Continue", "pricing": "Free", "description": "The open-source coding autopilot", - "version": "0.0.223", + "version": "0.0.224", "publisher": "Continue", "engines": { "vscode": "^1.67.0" diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index 9aab4e93..da559383 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -162,33 +162,43 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { } }, onInputValueChange({ inputValue, highlightedIndex }) { - if (!inputValue) return; + if (!inputValue) { + setItems([]); + return; + } props.onInputValueChange(inputValue); if (inputValue.endsWith("@") || currentlyInContextQuery) { - setCurrentlyInContextQuery(true); - const segs = inputValue.split("@"); - const providerAndQuery = segs[segs.length - 1]; - const [provider, query] = providerAndQuery.split(" "); - searchClient - .index(SEARCH_INDEX_NAME) - .search(providerAndQuery) - .then((res) => { - setItems( - res.hits.map((hit) => { - return { - name: hit.name, - description: hit.description, - id: hit.id, - }; - }) - ); - }) - .catch(() => { - // Swallow errors, because this simply is not supported on Windows at the moment - }); - return; + + if (segs.length > 1) { + // Get search results and return + setCurrentlyInContextQuery(true); + const providerAndQuery = segs[segs.length - 1]; + const [provider, query] = providerAndQuery.split(" "); + searchClient + .index(SEARCH_INDEX_NAME) + .search(providerAndQuery) + .then((res) => { + setItems( + res.hits.map((hit) => { + return { + name: hit.name, + description: hit.description, + id: hit.id, + }; + }) + ); + }) + .catch(() => { + // Swallow errors, because this simply is not supported on Windows at the moment + }); + return; + } else { + // Exit the '@' context menu + setCurrentlyInContextQuery(false); + setItems; + } } setItems( props.items.filter((item) => @@ -262,7 +272,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { key={`${item.description.id.item_id}${idx}`} item={item} warning={ - false && item.content.length > 4000 && item.editing + item.content.length > 4000 && item.editing ? "Editing such a large range may be slow" : undefined } |