feat(csharp): add .slnx solution file support (#1056)

Co-authored-by: joachim.arting <joachim.arting@gmail.com>
This commit is contained in:
Michael Panchenkoandjoachim.arting authored and GitHub committed 2026-02-23 13:49:15 +01:00
commit 6214b46e7b
2 files changed
+9 -9

No files matched your search

@@ -122,23 +122,23 @@ def breadth_first_file_scan(root_dir: str) -> Iterable[str]:
def find_solution_or_project_file(root_dir: str) -> str | None:
"""
Find the first .sln file in breadth-first order.
If no .sln file is found, look for a .csproj file.
Find the first .sln or .slnx file in breadth-first order.
If no solution file is found, look for a .csproj file.
"""
sln_file = None
csproj_file = None
for filename in breadth_first_file_scan(root_dir):
if filename.endswith(".sln") and sln_file is None:
if filename.endswith((".sln", ".slnx")) and sln_file is None:
sln_file = filename
elif filename.endswith(".csproj") and csproj_file is None:
csproj_file = filename
# If we found a .sln file, return it immediately
# If we found a solution file, return it immediately
if sln_file:
return sln_file
# If no .sln file was found, return the first .csproj file
# If no solution file was found, return the first .csproj file
return csproj_file
@@ -321,7 +321,7 @@ class CSharpLanguageServer(SolidLanguageServer):
if solution_or_project:
log.info(f"Found solution/project file: {solution_or_project}")
else:
log.warning("No .sln or .csproj file found, language server will attempt auto-discovery")
log.warning("No .sln/.slnx or .csproj file found, language server will attempt auto-discovery")
log.debug(f"Language server command: {' '.join(cmd)}")
@@ -811,10 +811,10 @@ class CSharpLanguageServer(SolidLanguageServer):
"""
Open solution and project files using notifications.
"""
# Find solution file
# Find solution file (.sln or .slnx)
solution_file = None
for filename in breadth_first_file_scan(self.repository_root_path):
if filename.endswith(".sln"):
if filename.endswith((".sln", ".slnx")):
solution_file = filename
break
+1 -1
View File
@@ -339,7 +339,7 @@ class TestCSharpSolutionProjectOpening:
CSharpLanguageServer(mock_config, str(temp_path), mock_settings)
# Verify that logger was called with warning about no solution/project files
expected_log_msg = "No .sln or .csproj file found, language server will attempt auto-discovery"
expected_log_msg = "No .sln/.slnx or .csproj file found, language server will attempt auto-discovery"
assert expected_log_msg in mem_log.get_log()
def test_solution_and_project_opening_with_real_test_repo(self):