mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-11 03:13:51 +00:00
fix(csharp): skip .csproj files excluded by the project's ignore settings (#2074)
CSharpLanguageServer._open_solution_and_projects scanned the whole repository root and opened every .csproj it found, without consulting the project's ignore settings. On repositories that vendor third-party or sample C# projects this opens projects the language server cannot restore. The cost is paid on every server start, and the resulting restore failures bury the diagnostics of the projects the user actually works on. Measured on an Unreal Engine source tree: 245 projects opened, 53 of them under Engine/Source/ThirdParty, which Roslyn cannot build; each restart emitted thousands of NuGet advisory lines and ended in `The "Csc" task could not be initialized`. SolidLanguageServer.is_ignored_path already implements exactly this check, and CSharpLanguageServer already overrides is_ignored_dirname, so the ignore settings were being honoured everywhere except here. This applies the existing check at project discovery. ignore_unsupported_files=False is required because a .csproj is not itself a C# source file, and would otherwise be excluded on file type rather than by the ignore patterns. Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Dr. Dominik Jain <dominik.jain@oraios-ai.de>
This commit is contained in:
2 files changed
+21
-3
No files matched your search
@@ -89,6 +89,11 @@ Status of the `main` branch. Changes prior to the next official version change w
|
||||
thread (#2038)
|
||||
|
||||
* Language Servers:
|
||||
- Fix: The C# language server opened every `.csproj` found anywhere under the repository root,
|
||||
without consulting the project's ignore settings. On repositories that vendor third-party or
|
||||
sample C# projects, this loads projects the server cannot restore on every start, and their
|
||||
restore failures bury the diagnostics of the projects the user actually works on. Project
|
||||
discovery now skips `.csproj` files matched by the project's ignore patterns
|
||||
- Kotlin: update the managed Kotlin LSP from `262.9593.0` to `263.4702.0`; the `262.9593.0` build
|
||||
has expired and fails on startup with "This build of intellij-server has expired" (#2008)
|
||||
- Fix: Godot's GDScript parser can report a symbol's end column one column past the
|
||||
|
||||
@@ -748,11 +748,24 @@ class CSharpLanguageServer(SolidLanguageServer):
|
||||
self.server.notify.send_notification("solution/open", {"solution": solution_uri})
|
||||
log.debug(f"Opened solution file: {solution_file}")
|
||||
|
||||
# Find and open project files
|
||||
# Find and open project files, skipping any that the project's ignore settings exclude.
|
||||
# Vendored, third-party and sample trees routinely contain .csproj files that the language
|
||||
# server cannot restore or build. Each one costs a project load on every server start, and
|
||||
# the resulting restore failures bury the diagnostics of the projects the user cares about.
|
||||
project_files = []
|
||||
skipped = 0
|
||||
for filename in breadth_first_file_scan(self.repository_root_path):
|
||||
if filename.endswith(".csproj"):
|
||||
project_files.append(filename)
|
||||
if not filename.endswith(".csproj"):
|
||||
continue
|
||||
relative_path = os.path.relpath(filename, self.repository_root_path)
|
||||
# ignore_unsupported_files=False, because a .csproj is not itself a C# source file and
|
||||
# would otherwise be excluded on file type rather than by the ignore patterns.
|
||||
if self.is_ignored_path(relative_path, ignore_unsupported_files=False):
|
||||
skipped += 1
|
||||
continue
|
||||
project_files.append(filename)
|
||||
if skipped:
|
||||
log.debug(f"Skipped {skipped} .csproj file(s) matched by the project's ignore settings")
|
||||
|
||||
# Send project/open notifications for each project file
|
||||
if project_files:
|
||||
|
||||
Reference in new issue
Block a user