mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 22:16:23 +00:00
Fix in Project._is_ignored_relative_path: Filtering of files for source files ignored the language backend
The check is really only possible for LSP, so the flag is now ignored for JetBrains (where there is no known list of languages).
This commit is contained in:
1 parent
423c04101d
commit
3096ac4fe2
2 files changed
+16
-11
No files matched your search
@@ -18,6 +18,8 @@ Status of the `main` branch. Changes prior to the next official version change w
|
||||
- Update prompts/instructions: Serena instructions manual, modes (editing, interactive)
|
||||
- Allow structured tool output to be configured on a per-context basis, disabling it for Claude Code
|
||||
(which does not correctly unpack structured output) #1042
|
||||
- Fix: Project-specific filtering of files for source files ignored the language backend.
|
||||
The check is really only possible for LSP.
|
||||
|
||||
* CLI:
|
||||
- Fix `--project-from-cwd` hijacking git worktrees nested under a Serena project. `find_project_root`
|
||||
|
||||
+14
-11
@@ -231,17 +231,20 @@ class Project(ToStringMixin):
|
||||
log.debug(f"Path {abs_path} does not exist, skipping ignore check")
|
||||
return False
|
||||
|
||||
# Check file extension if it's a file
|
||||
is_file = os.path.isfile(abs_path)
|
||||
if is_file and ignore_non_source_files:
|
||||
is_file_in_supported_language = False
|
||||
for language in self.project_config.languages:
|
||||
fn_matcher = language.get_source_fn_matcher()
|
||||
if fn_matcher.is_relevant_filename(abs_path):
|
||||
is_file_in_supported_language = True
|
||||
break
|
||||
if not is_file_in_supported_language:
|
||||
return True
|
||||
# check code file restriction (depending on backend)
|
||||
if ignore_non_source_files:
|
||||
# apply restriction only for LSP backend, which enumerates known languages
|
||||
# and therefore can determine whether a file is a source file or not
|
||||
if self.language_backend.is_lsp():
|
||||
if os.path.isfile(abs_path):
|
||||
is_file_in_supported_language = False
|
||||
for language in self.project_config.languages:
|
||||
fn_matcher = language.get_source_fn_matcher()
|
||||
if fn_matcher.is_relevant_filename(abs_path):
|
||||
is_file_in_supported_language = True
|
||||
break
|
||||
if not is_file_in_supported_language:
|
||||
return True
|
||||
|
||||
# Create normalized path for consistent handling
|
||||
rel_path = Path(relative_path)
|
||||
|
||||
Reference in new issue
Block a user