mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 06:17:58 +00:00
Serena: option to use gitignore for ignoring, defaulting to true
This commit is contained in:
1 parent
54588962b7
commit
316357ab91
2 files changed
+20
-6
No files matched your search
@@ -7,8 +7,13 @@ project_root: /path/to/project
|
||||
# * csharp: Requires the presence of a .sln file in the project folder.
|
||||
language: python
|
||||
|
||||
# list of directories to ignore: either names (e.g. "temp") or relative paths (e.g. "build/foo")
|
||||
ignored_dirs: [".git", "temp"]
|
||||
# whether to use the project's gitignore file to ignore files
|
||||
ignore_all_files_in_gitignore: true
|
||||
|
||||
# list of additional paths to ignore
|
||||
# same syntax as gitignore, so you can use * and **
|
||||
ignored_paths: []
|
||||
|
||||
|
||||
# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
|
||||
# Below is the complete list of tools for convenience.
|
||||
|
||||
+13
-4
@@ -47,8 +47,12 @@ class ProjectConfig(ToStringMixin):
|
||||
if project_root is None:
|
||||
project_root = Path(config_dict["project_root"])
|
||||
self.project_root: str = str(project_root.resolve())
|
||||
self.ignored_dirs: list[str] = config_dict.get("ignored_dirs", [])
|
||||
self.ignored_paths: list[str] = config_dict.get("ignored_paths", [])
|
||||
self.excluded_tools: set[str] = set(config_dict.get("excluded_tools", []))
|
||||
self.ignore_all_files_in_gitignore = config_dict.get("ignore_all_files_in_gitignore", True)
|
||||
|
||||
# backwards compatibility
|
||||
self.ignored_paths.extend(config_dict.get("ignored_dirs", []))
|
||||
|
||||
@classmethod
|
||||
def from_yml(cls, yml_path: Path) -> Self:
|
||||
@@ -251,9 +255,14 @@ class SerenaAgent:
|
||||
|
||||
# instantiate and start the language server
|
||||
assert self.project_config is not None
|
||||
multilspy_config = MultilspyConfig(code_language=self.project_config.language)
|
||||
multilspy_config = MultilspyConfig(code_language=self.project_config.language, ignored_paths=self.project_config.ignored_paths)
|
||||
ls_logger = MultilspyLogger()
|
||||
self.language_server = SyncLanguageServer.create(multilspy_config, ls_logger, self.project_config.project_root)
|
||||
self.language_server = SyncLanguageServer.create(
|
||||
multilspy_config,
|
||||
ls_logger,
|
||||
self.project_config.project_root,
|
||||
add_gitignore_content_to_config=self.project_config.ignore_all_files_in_gitignore,
|
||||
)
|
||||
self.language_server.start()
|
||||
if not self.language_server.is_running():
|
||||
raise RuntimeError(f"Failed to start the language server for {self.project_config}")
|
||||
@@ -544,7 +553,7 @@ class ListDirTool(Tool):
|
||||
os.path.join(self.project_root, relative_path),
|
||||
relative_to=self.project_root,
|
||||
recursive=recursive,
|
||||
ignored_dirs=self.project_config.ignored_dirs,
|
||||
ignored_dirs=self.project_config.ignored_paths,
|
||||
)
|
||||
result = json.dumps({"dirs": dirs, "files": files})
|
||||
return self._limit_length(result, max_answer_chars)
|
||||
|
||||
Reference in new issue
Block a user