From 1d97c9c76e36032ca01a3ebdc1ab656856077bae Mon Sep 17 00:00:00 2001
From: Nate Sesti <sestinj@gmail.com>
Date: Fri, 30 Jun 2023 20:05:18 -0700
Subject: kill servers started by old extension versions

---
 continuedev/src/continuedev/steps/core/core.py | 17 ++++++++++-------
 continuedev/src/continuedev/steps/main.py      |  2 +-
 2 files changed, 11 insertions(+), 8 deletions(-)

(limited to 'continuedev')

diff --git a/continuedev/src/continuedev/steps/core/core.py b/continuedev/src/continuedev/steps/core/core.py
index f81b3f6d..f59ef33c 100644
--- a/continuedev/src/continuedev/steps/core/core.py
+++ b/continuedev/src/continuedev/steps/core/core.py
@@ -221,18 +221,21 @@ class DefaultModelEditCodeStep(Step):
         # TODO: Keep track of start line of the range, because it's needed below for offset stuff
         rif_start_line = rif.range.start.line
         if len(rif.contents) > 0:
-            first_line = rif.contents.splitlines(keepends=True)[0]
-            while first_line.strip() == "":
+            lines = rif.contents.splitlines(keepends=True)
+            first_line = lines[0] if lines else None
+            while first_line and first_line.strip() == "":
                 file_prefix += first_line
                 rif.contents = rif.contents[len(first_line):]
-                first_line = rif.contents.splitlines(keepends=True)[0]
+                lines = rif.contents.splitlines(keepends=True)
+                first_line = lines[0] if lines else None
 
-            last_line = rif.contents.splitlines(keepends=True)[-1]
-            while last_line.strip() == "":
+            last_line = lines[-1] if lines else None
+            while last_line and last_line.strip() == "":
                 file_suffix = last_line + file_suffix
                 rif.contents = rif.contents[:len(
                     rif.contents) - len(last_line)]
-                last_line = rif.contents.splitlines(keepends=True)[-1]
+                lines = rif.contents.splitlines(keepends=True)
+                last_line = lines[-1] if lines else None
 
             while rif.contents.startswith("\n"):
                 file_prefix += "\n"
@@ -241,7 +244,7 @@ class DefaultModelEditCodeStep(Step):
                 file_suffix = "\n" + file_suffix
                 rif.contents = rif.contents[:-1]
 
-        return file_prefix, rif.contents, file_suffix, model_to_use
+                return file_prefix, rif.contents, file_suffix, model_to_use
 
     def compile_prompt(self, file_prefix: str, contents: str, file_suffix: str, sdk: ContinueSDK) -> str:
         prompt = self._prompt
diff --git a/continuedev/src/continuedev/steps/main.py b/continuedev/src/continuedev/steps/main.py
index 5caac180..def1af4e 100644
--- a/continuedev/src/continuedev/steps/main.py
+++ b/continuedev/src/continuedev/steps/main.py
@@ -249,7 +249,7 @@ class EditHighlightedCodeStep(Step):
     user_input: str = Field(
         ..., title="User Input", description="The natural language request describing how to edit the code")
     hide = True
-    description: str = "Change the contents of the currently highlighted code or open file"
+    description: str = "Change the contents of the currently highlighted code or open file. You should call this function if the user asks seems to be asking for a code change."
 
     async def describe(self, models: Models) -> Coroutine[str, None, None]:
         return "Editing code"
-- 
cgit v1.2.3-70-g09d2