diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-07-09 14:31:54 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-07-09 14:31:54 -0700 |
commit | f407524e0985807a30e5b08d5e8754d24c7a1291 (patch) | |
tree | 002fa10009c9bcd7d18ef7452cfc0bc6d4c10907 | |
parent | afe3016ec3c143787e95a8b7e7a31f8177f63957 (diff) | |
download | sncontinue-f407524e0985807a30e5b08d5e8754d24c7a1291.tar.gz sncontinue-f407524e0985807a30e5b08d5e8754d24c7a1291.tar.bz2 sncontinue-f407524e0985807a30e5b08d5e8754d24c7a1291.zip |
edit at cursor
-rw-r--r-- | continuedev/src/continuedev/steps/main.py | 11 | ||||
-rw-r--r-- | extension/package-lock.json | 4 | ||||
-rw-r--r-- | extension/package.json | 2 |
3 files changed, 14 insertions, 3 deletions
diff --git a/continuedev/src/continuedev/steps/main.py b/continuedev/src/continuedev/steps/main.py index 0a20ddd7..4f543022 100644 --- a/continuedev/src/continuedev/steps/main.py +++ b/continuedev/src/continuedev/steps/main.py @@ -245,6 +245,17 @@ class EditHighlightedCodeStep(Step): async def run(self, sdk: ContinueSDK) -> Coroutine[Observation, None, None]: range_in_files = sdk.get_code_context(only_editing=True) + + # If nothing highlighted, insert at the cursor if possible + if len(range_in_files) == 0: + highlighted_code = await sdk.ide.getHighlightedCode() + if highlighted_code is not None: + for rif in highlighted_code: + if rif.range.start == rif.range.end: + range_in_files.append( + RangeInFileWithContents.from_range_in_file(rif, "")) + + # If nothing highlighted, edit the first open file if len(range_in_files) == 0: # Get the full contents of all open files files = await sdk.ide.getOpenFiles() diff --git a/extension/package-lock.json b/extension/package-lock.json index 22f8b492..5733c2dd 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.141", + "version": "0.0.143", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.141", + "version": "0.0.143", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index beb675b3..444372f8 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.141", + "version": "0.0.143", "publisher": "Continue", "engines": { "vscode": "^1.67.0" |