Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sestinj committed Nov 1, 2023
2 parents 847bbf6 + 9942fe9 commit 38baf57
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
4 changes: 2 additions & 2 deletions extensions/vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion extensions/vscode/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "continue",
"icon": "media/icon.png",
"version": "0.1.40",
"version": "0.1.41",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"
Expand Down
5 changes: 5 additions & 0 deletions gui/src/components/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,11 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
setInputFocused(false);
},
onKeyDown: (event) => {
// Prevent duplicate calls to keyDown events due to IME.
if (isComposing) {
return;
}

dispatch(setBottomMessage(undefined));
if (event.key === "Enter" && event.shiftKey) {
// Prevent Downshift's default 'Enter' behavior.
Expand Down
4 changes: 2 additions & 2 deletions server/continuedev/plugins/context_providers/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from ...core.context import ContextProvider
from ...core.main import ContextItem, ContextItemDescription, ContextItemId
from ...libs.util.create_async_task import create_async_task
from .util import remove_meilisearch_disallowed_chars
from .util import remove_meilisearch_disallowed_chars, remove_prefix


class DynamicProvider(ContextProvider, ABC):
Expand Down Expand Up @@ -40,7 +40,7 @@ async def get_item(self, id: ContextItemId, query: str) -> ContextItem:
if not id.provider_title == self.title:
raise Exception("Invalid provider title for item")

query = query.lstrip(self.title + " ")
query = remove_prefix(text=query, prefix=self.title).strip()
results = await self.get_content(query)

ctx_item = self.BASE_CONTEXT_ITEM.copy()
Expand Down
4 changes: 2 additions & 2 deletions server/continuedev/plugins/context_providers/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ...core.main import ContextItem, ContextItemDescription, ContextItemId
from ...libs.util.logging import logger
from ...libs.util.ripgrep import get_rg_path
from .util import remove_meilisearch_disallowed_chars
from .util import remove_meilisearch_disallowed_chars, remove_prefix


class SearchContextProvider(ContextProvider):
Expand Down Expand Up @@ -80,7 +80,7 @@ async def get_item(self, id: ContextItemId, query: str) -> ContextItem:
if not id.provider_title == self.title:
raise Exception("Invalid provider title for item")

query = query.lstrip("search ")
query = remove_prefix(text=query, prefix="search").strip()
results = await self._search(query)

ctx_item = self.BASE_CONTEXT_ITEM.copy()
Expand Down
4 changes: 2 additions & 2 deletions server/continuedev/plugins/context_providers/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from ...core.context import ContextProvider
from ...core.main import ContextItem, ContextItemDescription, ContextItemId
from .util import remove_meilisearch_disallowed_chars
from .util import remove_meilisearch_disallowed_chars, remove_prefix


class URLContextProvider(ContextProvider):
Expand Down Expand Up @@ -92,7 +92,7 @@ async def get_item(self, id: ContextItemId, query: str) -> ContextItem:
raise Exception("Invalid provider title for item")

# Generate the dynamic item
url = query.lstrip("url ").strip()
url = remove_prefix(text=query, prefix="url").strip()
if url is None or url == "":
return None
content, title = self._get_url_text_contents_and_title(url)
Expand Down
12 changes: 12 additions & 0 deletions server/continuedev/plugins/context_providers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,15 @@

def remove_meilisearch_disallowed_chars(id: str) -> str:
return re.sub(r"[^0-9a-zA-Z_-]", "", id)


def remove_prefix(text: str, prefix: str) -> str:
if text.startswith(prefix):
return text[len(prefix):]
return text


def remove_suffix(text: str, suffix: str) -> str:
if text.endswith(suffix):
return text[:-len(suffix)]
return text

0 comments on commit 38baf57

Please sign in to comment.