mirror of
https://github.com/tiennm99/serena.git
synced 2026-08-01 04:22:29 +00:00
[DATALAD RUNCMD] chore: run codespell throughout fixing a few new typos automagically
=== Do not change lines below ===
{
"chain": [],
"cmd": "codespell -w",
"exit": 0,
"extra_inputs": [],
"inputs": [],
"outputs": [],
"pwd": "."
}
^^^ Do not change lines above ^^^
This commit is contained in:
+1
-1
@@ -33,7 +33,7 @@ Also some improvements to prompts.
|
||||
|
||||
# 2025-05-21
|
||||
|
||||
**Signficant improvement in symbol finding!**
|
||||
**Significant improvement in symbol finding!**
|
||||
|
||||
* Serena core:
|
||||
* `FindSymbolTool` now can look for symbols by specifying paths to them, not just the symbol name
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ When developing the `ReplaceRegexTool` we were initially not able to make Claude
|
||||
examples nor explicit instructions helped. It was only after adding
|
||||
|
||||
```
|
||||
IMPORTANT: REMEMBER TO USE WILDCARDS WEHEN APPROPRIATE! I WILL BE VERY UNHAPPY IF YOU WRITE LONG REGEXES WITHOUT USING WILDCARDS INSTEAD!
|
||||
IMPORTANT: REMEMBER TO USE WILDCARDS WHEN APPROPRIATE! I WILL BE VERY UNHAPPY IF YOU WRITE LONG REGEXES WITHOUT USING WILDCARDS INSTEAD!
|
||||
```
|
||||
|
||||
to the initial instructions and to the tool description that Claude finally started following the instructions.
|
||||
|
||||
@@ -31,7 +31,7 @@ class LSPConstants:
|
||||
# key used to represent the language a document is in - "java", "csharp", etc.
|
||||
LANGUAGE_ID = "languageId"
|
||||
|
||||
# key used to represent the version of a document (a shared value betwen the client and server)
|
||||
# key used to represent the version of a document (a shared value between the client and server)
|
||||
VERSION = "version"
|
||||
|
||||
# key used to represent the text of a document being sent from the client to the server on open
|
||||
|
||||
@@ -2243,7 +2243,7 @@ class SignatureHelp(TypedDict):
|
||||
range of `signatures` the value defaults to zero or is ignored if
|
||||
the `SignatureHelp` has no signatures.
|
||||
|
||||
Whenever possible implementors should make an active decision about
|
||||
Whenever possible implementers should make an active decision about
|
||||
the active signature and shouldn't rely on a default value.
|
||||
|
||||
In future version of the protocol this property might become
|
||||
|
||||
@@ -32,7 +32,7 @@ class MultilspyLogger:
|
||||
|
||||
def log(self, debug_message: str, level: int, sanitized_error_message: str = "", stacklevel: int = 2) -> None:
|
||||
"""
|
||||
Log the debug and santized messages using the logger
|
||||
Log the debug and sanitized messages using the logger
|
||||
"""
|
||||
|
||||
debug_message = debug_message.replace("'", '"').replace("\n", " ")
|
||||
|
||||
@@ -109,7 +109,7 @@ class PathUtils:
|
||||
from urllib.parse import urlparse, unquote
|
||||
from urllib.request import url2pathname
|
||||
except ImportError:
|
||||
# backwards compatability
|
||||
# backwards compatibility
|
||||
from urlparse import urlparse
|
||||
from urllib import unquote, url2pathname
|
||||
parsed = urlparse(uri)
|
||||
@@ -168,12 +168,12 @@ class FileUtils:
|
||||
response = requests.get(url, stream=True, timeout=60)
|
||||
if response.status_code != 200:
|
||||
logger.log(f"Error downloading file '{url}': {response.status_code} {response.text}", logging.ERROR)
|
||||
raise MultilspyException("Error downoading file.")
|
||||
raise MultilspyException("Error downloading file.")
|
||||
with open(target_path, "wb") as f:
|
||||
shutil.copyfileobj(response.raw, f)
|
||||
except Exception as exc:
|
||||
logger.log(f"Error downloading file '{url}': {exc}", logging.ERROR)
|
||||
raise MultilspyException("Error downoading file.") from None
|
||||
raise MultilspyException("Error downloading file.") from None
|
||||
|
||||
@staticmethod
|
||||
def download_and_extract_archive(logger: MultilspyLogger, url: str, target_path: str, archive_type: str) -> None:
|
||||
|
||||
+4
-4
@@ -1681,7 +1681,7 @@ class ReplaceSymbolBodyTool(Tool, ToolMarkerCanEdit):
|
||||
as the tool will automatically add the indentation of the original symbol to each line. For example,
|
||||
for replacing a method in python, you can just write (using the standard python indentation):
|
||||
body="def my_method_replacement(self, ...):\n first_line\n second_line...". So each line after the first line only has
|
||||
an indentation of 4 (the indentation relative to the first characted),
|
||||
an indentation of 4 (the indentation relative to the first character),
|
||||
since the additional indentation will be added by the tool. Same for more deeply nested
|
||||
cases. You always only need to write the relative indentation to the first character of the first line, and that
|
||||
in turn should not have any indentation.
|
||||
@@ -1718,7 +1718,7 @@ class InsertAfterSymbolTool(Tool, ToolMarkerCanEdit):
|
||||
|
||||
:param name_path: for finding the symbol to insert after, same logic as in the `find_symbol` tool.
|
||||
:param relative_path: the relative path to the file containing the symbol
|
||||
:param body: the body/content to be inserted. Important: the insterted code will automatically have the
|
||||
:param body: the body/content to be inserted. Important: the inserted code will automatically have the
|
||||
same indentation as the symbol's body, so you do not need to provide any additional indentation.
|
||||
"""
|
||||
self.symbol_manager.insert_after_symbol(
|
||||
@@ -1748,7 +1748,7 @@ class InsertBeforeSymbolTool(Tool, ToolMarkerCanEdit):
|
||||
|
||||
:param name_path: for finding the symbol to insert before, same logic as in the `find_symbol` tool.
|
||||
:param relative_path: the relative path to the file containing the symbol
|
||||
:param body: the body/content to be inserted. Important: the insterted code will automatically have the
|
||||
:param body: the body/content to be inserted. Important: the inserted code will automatically have the
|
||||
same indentation as the symbol's body, so you do not need to provide any additional indentation.
|
||||
"""
|
||||
self.symbol_manager.insert_before_symbol(
|
||||
@@ -1828,7 +1828,7 @@ class ReplaceRegexTool(Tool, ToolMarkerCanEdit):
|
||||
Always try to use wildcards to avoid specifying the exact content of the code to be replaced,
|
||||
especially if it spans several lines.
|
||||
|
||||
IMPORTANT: REMEMBER TO USE WILDCARDS WEHEN APPROPRIATE! I WILL BE VERY UNHAPPY IF YOU WRITE LONG REGEXES WITHOUT USING WILDCARDS INSTEAD!
|
||||
IMPORTANT: REMEMBER TO USE WILDCARDS WHEN APPROPRIATE! I WILL BE VERY UNHAPPY IF YOU WRITE LONG REGEXES WITHOUT USING WILDCARDS INSTEAD!
|
||||
|
||||
:param relative_path: the relative path to the file
|
||||
:param regex: a Python-style regular expression, matches of which will be replaced.
|
||||
|
||||
@@ -27,7 +27,7 @@ prompt: |
|
||||
you are replacing or inserting above or below. In particular, keep in mind the description of the `replace_symbol_body` tool. If you want to add some new code at the end of the file, you should
|
||||
use the `insert_after_symbol` tool with the last top-level symbol in the file. If you want to add an import, often a good strategy is to use
|
||||
`insert_before_symbol` with the first top-level symbol in the file.
|
||||
You can unterstand relationships between symbols by using the `find_referencing_symbols` tool. If not explicitly requested otherwise by a user,
|
||||
You can understand relationships between symbols by using the `find_referencing_symbols` tool. If not explicitly requested otherwise by a user,
|
||||
you make sure that when you edit a symbol, it is either done in a backward-compatible way, or you find and adjust the references as needed.
|
||||
The `find_referencing_symbols` tool will give you code snippets around the references, as well as symbolic information.
|
||||
You will generally be able to use the info from the snippets and the regex-based approach to adjust the references as well.
|
||||
@@ -52,7 +52,7 @@ prompt: |
|
||||
1. If the snippet to be replaced is likely to be unique within the file, you perform the replacement by directly using the escaped version of the
|
||||
original.
|
||||
2. If the snippet is probably not unique, and you want to replace all occurrences, you use the `allow_multiple_occurrences` flag.
|
||||
3. If the snippet is not unique, and you want to replace a specific occurence, you make use of the code surrounding the snippet
|
||||
3. If the snippet is not unique, and you want to replace a specific occurrence, you make use of the code surrounding the snippet
|
||||
to extend the regex with content before/after such that the regex will have exactly one match.
|
||||
4. You generally assume that a snippet is unique, knowing that the tool will return an error on multiple matches. You only read more file content
|
||||
(for crafvarting a more specific regex) if such a failure unexpectedly occurs.
|
||||
@@ -102,7 +102,7 @@ prompt: |
|
||||
|
||||
Generally, I remind you that you rely on the regex tool with providing you the correct feedback, no need for more verification!
|
||||
|
||||
IMPORTANT: REMEMBER TO USE WILDCARDS WEHEN APPROPRIATE! I WILL BE VERY UNHAPPY IF YOU WRITE LONG REGEXES WITHOUT USING WILDCARDS INSTEAD!
|
||||
IMPORTANT: REMEMBER TO USE WILDCARDS WHEN APPROPRIATE! I WILL BE VERY UNHAPPY IF YOU WRITE LONG REGEXES WITHOUT USING WILDCARDS INSTEAD!
|
||||
excluded_tools:
|
||||
- replace_lines
|
||||
- insert_at_line
|
||||
|
||||
@@ -39,7 +39,7 @@ prompts:
|
||||
use `find_symbol` with the name path `Foo/__init__` and `include_body=True`. If you don't know yet which methods in `Foo` you need to read or edit,
|
||||
you can use `find_symbol` with the name path `Foo`, `include_body=False` and `depth=1` to get all (top-level) methods of `Foo` before proceeding
|
||||
to read the desired methods with `include_body=True`
|
||||
You can unterstand relationships between symbols by using the `find_referencing_symbols` tool.
|
||||
You can understand relationships between symbols by using the `find_referencing_symbols` tool.
|
||||
|
||||
You generally have access to memories and it may be useful for you to read them, but also only if they help you
|
||||
to answer the question or complete the task. You can infer which memories are relevant to the current task by reading
|
||||
|
||||
@@ -492,7 +492,7 @@ class SymbolManager:
|
||||
"""
|
||||
:param lang_server: the language server to use for symbol retrieval as well as editing operations.
|
||||
:param agent: the agent to use (only needed for marking files as modified). You can pass None if you don't
|
||||
need an agent to be avare of file modifications performed by the symbol manager.
|
||||
need an agent to be aware of file modifications performed by the symbol manager.
|
||||
"""
|
||||
self._lang_server = lang_server
|
||||
self.agent = agent
|
||||
|
||||
Reference in New Issue
Block a user