43 Commits
Author SHA1 Message Date
Amir Fathi 941f4ded18 fix(csharp): stop tuple-typed properties losing their name to the method branch (#1967)
* fix(csharp): stop tuple-typed properties losing their name to the method branch

_extract_base_name_and_type split Roslyn's "Name : Type" property names by
checking for a literal '(' anywhere in the raw string. A C# tuple type is
written with parentheses ("(int X, string Y)"), so a tuple-typed property
tripped that guard and fell into the method branch instead, which kept the
trailing " :" as part of the reported name (e.g. "Position :"). Since
find_symbol defaults to exact name-path matching, such a property becomes
unfindable by its real name.

The guard now only checks for '(' in the identifier segment before the
first " : ", not the whole string, so a parenthesis inside the type
annotation no longer affects branch selection.

* fix(csharp): bump the high-level symbol cache fingerprint

_normalize_symbol_name's output changed in this PR, and
_document_symbols_cache_fingerprint gates the cache that stores its
result; leaving the version at 1 would keep serving the old, corrupted
names to anyone with an existing on-disk cache.
2026-09-21 12:14:38 +02:00
Dominik Jain d2cf18ddcb Refactoring: Rename Language to LanguageServerId
This resolves a long-standing naming issue in Serena & SolidLSP.
2026-07-22 20:55:36 +02:00
Dominik JainandClaude Opus 4.8 1c12156901 SolidLSP: Apply InitializeParamsBuilder across all remaining language servers
Convert every remaining SolidLanguageServer subclass from the old
_get_initialize_params method to the new _create_base_initialize_params
override, so common LSP initialize keys (processId, rootPath, rootUri,
clientInfo, workspaceFolders) are provided centrally by the
InitializeParamsBuilder rather than by each server.

- Drop the per-server processId/rootPath/rootUri/workspaceFolders and all
  clientInfo entries (including the VS Code spoofs in rust_analyzer and
  sourcekit); these are now set centrally.
- Preserve nested capabilities.workspace.workspaceFolders flags and any
  server-specific initializationOptions.workspaceFolders (e.g. kotlin,
  eclipse_jdtls).
- omnisharp keeps loading its JSON template but no longer sets the
  centrally-managed keys.
- Update _start_server call sites to self._create_initialize_params() and
  drop now-unnecessary cast()/type: ignore wrappers.

angular, svelte and vue are intentionally left as-is: they already override
_create_base_initialize_params for their TypeScript companion server, and
their remaining _get_initialize_params drives a separate language server
process.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 01:05:40 +02:00
Lauritz-Configo 8e7c8feb84 Fix Windows C# startup and Roslyn install 2026-06-27 19:29:43 +02:00
Michael Panchenko 4bd60f18d4 Tests: removed csharp tests relying on mocks 2026-05-04 19:39:58 +02:00
Michael Panchenko bd7e64e85a Fixed diagnostics files uri handling, added low-level tests 2026-04-29 23:52:26 +02:00
Michael Panchenko c55e0c900e Diagnostics, implementation and definition tools (WIP) 2026-04-29 23:52:26 +02:00
Michael Panchenko d30cdf8474 Fix symbol name resolution in selected LS (#1247)
Adds tests for name resolution for each language and fixes the name resolution where tests have failed.

Also:

Extends python tests to cover ty
Extends skipping conditions for several LS (but only when not in CI)
Better test output in CI
Removed a wrong python test (started failing for ty and should have failed for pyright too)
2026-04-01 16:29:00 +02:00
Michael Panchenko f00a992e5d Security enhancement: pinned all runtime deps, verify checksums
Extended documentation of ls_specific_settings and of our security approach
2026-03-27 13:00:09 +01:00
Michael Panchenko 0bbd9e375e Reformat (minor, after replacing black with ruff)
Black dependency created a dependabot warning and couldn't be bumped since it collided with pathspec dependencies. Since ruff can also format, black is not needed. But we now have these small format changes, mostly in test files
2026-03-23 21:10:41 +01:00
Alberto SimõesandDominik Jain 58efe413e3 Merge pull request #1131 from cx-alberto-simoes/feature/configurable-serena-folder-location
feat: add configurable project_serena_folder_location setting

Add a new `project_serena_folder_location` setting to `serena_config.yml` that allows configuring where the per-project `.serena` data folder (memories, caches) is stored, with `$projectDir` and `$projectFolderName` placeholder support (default: `$projectDir/.serena`, preserving current behavior).

Resolves #1123

Co-authored-by: Dominik Jain <dominik.jain@oraios-ai.de>
2026-03-05 21:09:13 +01:00
Dominik Jain 9800d4e98b Introduce DotNETUtil
* Apply in FSharpLanguageServer and CSharpLanguageServer
* CSharpLanguageServer: Disabled auto-install of .NET (does not work reliably)
  and remove corresponding test
* Remove TestFSharpLanguageServerSetup
2026-03-02 17:47:32 +01:00
joachim.arting 88cd3c27a2 feat(csharp): add .slnx solution file support 2026-02-23 09:08:18 +01:00
Tom Longhurst b432560789 Make hover test assertions more specific
Assert on actual hover content (type names and symbol names) instead
of just checking for non-empty content. This verifies hover returns
meaningful type information from Roslyn.
2026-02-02 22:36:02 +00:00
Tom Longhurst 3627f61977 Address PR review: use iter_symbols() and make hover tests assertive
- Replace get_all_symbols_and_roots() with iter_symbols() to avoid
  redundant tuple unpacking
- Make hover tests assert that hover_info is not None instead of
  defensive conditionals
2026-02-02 22:28:56 +00:00
Tom Longhurst 5cb8f62a02 Fix test_install_dotnet_uses_bash_script_on_linux platform detection
The test was mocking platform.system() but not the full platform detection
chain. On non-Linux CI platforms, platform.libc_ver() returns empty string,
causing "linux--x64" (double dash) instead of "linux-x64" in the platform ID.

Fix by mocking PlatformUtils.get_platform_id() directly to return proper
PlatformId values, following the pattern used in other tests.

Fixes both Linux bash script and Windows PowerShell script tests.
2026-02-02 15:53:34 +00:00
Tom Longhurst 973724c258 Add hover injection for C# type annotations
Following ALLanguageServer pattern, inject cached original symbol names
(with type annotations) into hover responses. This ensures type information
is available via hover operation as per SolidLSP convention.

- Override request_hover() to prepend original names to hover content
- Add comprehensive hover test verifying both property and method hovers
- Test covers Name property and IsAdult method

Addresses reviewer feedback about delivering type info via hover.
Test passes.
2026-02-02 14:45:06 +00:00
Tom Longhurst 0f7e9722c3 Update C# tests to use exact matching for normalized symbol names
Replace startswith() checks with exact matching now that symbol names
are normalized at the source. This is cleaner and more accurate.

Comments updated to reflect that names are normalized (not type-annotated).
All 14 tests pass.
2026-02-02 14:40:26 +00:00
Tom Longhurst cc2eb0a0be Update tests and symbol handling for new Roslyn format with type annotations
The new Roslyn 5.5.0 returns symbols with type annotations:
- Properties: 'Name : string' instead of 'Name'
- Methods: 'Add(int, int) : int' instead of 'Add'

Changes:
- Update SymbolUtils.symbol_tree_contains_name() to handle both formats
- Update test assertions to match new format (startswith checks)
- Update test expectations (new Roslyn correctly excludes definitions from references)

This provides more informative symbol information while maintaining backward compatibility.
2026-02-02 12:13:55 +00:00
Tom Longhurst f5e2b8a21b Add tests for .NET version detection edge cases
- Test cached .NET installation is reused without re-downloading
- Test .NET 9 is rejected and triggers .NET 10 install
- Test .NET 11+ versions are accepted for forward compatibility

All 7 .NET install tests now pass (4 existing + 3 new)
2026-02-02 10:57:10 +00:00
Tom Longhurst af0075c3e0 Use official .NET install scripts instead of manual downloads
Replace manual .NET runtime downloads with Microsoft's official dotnet-install
scripts for better maintainability and automatic platform detection.

Changes:
- Remove 6 DotNetRuntime RuntimeDependency entries (42 lines removed)
- Replace _ensure_dotnet_runtime_from_config with _install_dotnet_with_script
- Use bash script (dotnet-install.sh) for Linux/macOS
- Use PowerShell script (dotnet-install.ps1) for Windows
- Update version check from .NET 9 to .NET 10+ (supports 10.x, 11.x, etc.)
- Add comprehensive tests for install script behavior

Benefits:
- Simpler codebase (~80 lines of manual download code → ~60 lines of script invocation)
- Automatic platform/architecture detection by Microsoft scripts
- Built-in checksum verification and dependency handling
- Official Microsoft-maintained approach
- Easier version updates (just change version string)
- Better compatibility with .NET 10 (required by roslyn-language-server packages)

The language server packages from NuGet.org remain unchanged - this only
affects how the .NET runtime is installed to execute the language server.
2026-02-02 10:32:53 +00:00
Tom Longhurst b238e1d0ce Switch C# language server from Azure NuGet feed to official NuGet.org
Replace Microsoft.CodeAnalysis.LanguageServer packages from Azure DevOps
feed with official roslyn-language-server packages from NuGet.org.

Changes:
- Update package names to roslyn-language-server.* (from Microsoft.CodeAnalysis.LanguageServer.*)
- Update version from 5.0.0-1.25329.6 to 5.5.0-2.26078.4
- Add direct URLs pointing to NuGet.org for each platform variant
- Update extract paths from content/LanguageServer/<platform> to tools/net10.0/<platform>
- Simplify download logic by removing Azure feed service index lookup
- Replace _download_nuget_package_direct with simpler _download_nuget_package
- Add tests to verify NuGet.org download behavior

Benefits:
- More reliable package source (official NuGet.org vs Azure DevOps feed)
- Newer version with latest Roslyn improvements
- Simpler codebase (removed ~60 lines of Azure-specific logic)
- Better error messages with explicit URLs
2026-02-02 10:21:43 +00:00
Dominik Jain b33a4085c2 CSharpLanguageServer: Refactored to use DependencyProvider 2026-01-15 18:55:15 +01:00
Dominik Jain b724eccde6 CSharpLanguageServer: Wait for indexing to complete
resolving issues pertaining to retrievals not working correctly initially

Fixes #814
2025-12-08 18:27:23 +01:00
Dominik Jain 4982622b6a Disable randomly failing assertion #814 2025-12-06 13:59:12 +01:00
Dominik Jain 7f11d6b7e8 Fix SuspendedLoggerContext (adding a copy to serena.util.logging) 2025-11-23 13:32:41 +01:00
Dominik Jain 82d495b2a6 Remove LanguageServerLogger
Resolves #745
2025-11-20 21:33:37 +01:00
Dominik Jain d8cac3aedb Introduce abstraction DocumentSymbols, which is now returned by request_document_symbols 2025-11-12 03:46:18 +01:00
MischaPanch aa8c5c6ff6 Minor fix in mocks in tests.
Unclear why there was no failure in the past in CI
2025-09-02 18:54:49 +02:00
MischaPanch e6ae39ab1b Fixed path in test 2025-08-15 13:28:32 +02:00
MischaPanch d4dedd5d84 Improve waiting logic for cross-file references to be ready
Now waiting only once instead of on each request, hopefully that's enough
2025-08-15 13:10:46 +02:00
MischaPanch c82fab97c1 CSharp: added waiting for request_referencing and test for cross-file references 2025-08-14 12:01:58 +02:00
MischaPanch 65259254fd CC Vanilla
Tokens: 5,213,813
Prompts:
- I recently added the non-optional parameter solidlsp_settings to the init of SolidLanguageServer, the create method, and the ls_resources_dir method. All language server subclasses now need to be adjusted            │
│   accordingly to use solidlsp_settings. Do that. You can have a look at relevant memories in .serena/memories to understand the repo structure
- don't execute elixir tests, they hang
2025-07-25 15:17:03 +02:00
Michael Panchenko 7e06148648 Refactoring: added base method ls_resources_dir, used in C# LS 2025-07-06 18:28:22 +02:00
Michael Panchenko cf2a0c248b Moved omnisharp module up, minor tweaks
In this state, C# tests with omnisharp as LS mostly pass, except those querying for references
2025-07-06 00:08:40 +02:00
Michael Panchenko e8e417a18e Refactoring, stage 1: move ls implementations one step up
Paths to jsons were adjusted in the modules, minimal change, tests run through
2025-07-05 12:46:37 +02:00
Tom Longhurst cfe3350c34 Fix C# Language Server (#262)
Now when the language server starts, the initialisation will scan for solution or project files, and then pass them to the language server instructing it to open them. Which in-turn should give us all the nice context since the code is actually being 'loaded' up properly now.
2025-06-30 22:39:44 +02:00
Michael Panchenko 0ea317bd33 Restructured C# tests to be like the other tests 2025-06-29 01:00:43 +02:00
Michael Panchenko e21fb40376 Missing pytest mark 2025-06-29 00:24:32 +02:00
Michael Panchenko 3d4dba77bd Formatting, minor ruff fixes 2025-06-28 23:42:44 +02:00
Claude AssistantandClaude 723b7cb175 Fix C# language server startup and test configuration
- Add required --stdio flag for Microsoft.CodeAnalysis.LanguageServer
- Add required --extensionLogDirectory parameter to avoid startup failure
- Fix test fixture to properly start/stop language server
- Remove skip markers from C# tests to enable testing
- Return cache_dir from setup_runtime_dependencies for log directory creation

The language server now starts successfully and the first test passes.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-25 23:49:54 +01:00
Claude Assistant 57e30aec57 Replace OmniSharp with Microsoft.CodeAnalysis.LanguageServer
- Implemented new CSharpLanguageServer class using Microsoft's official C# language server
- Downloads Microsoft.CodeAnalysis.LanguageServer NuGet package (requires .NET 9)
- Supports direct download from NuGet API with fallback to package managers
- Uses platform-specific runtime packages (linux-x64, win-x64, osx-x64, etc.)
- Caches downloaded language server in ~/.cache/serena/language-servers/csharp/
- Added basic tests for C# language server functionality
- Updated SolidLanguageServer.create to use new implementation
- Removed old OmniSharp implementation

Note: Full language server tests are skipped as they require .NET 9 runtime
2025-06-25 22:56:17 +01:00
Tom Longhurst eb8b118d62 Initial Commit 2025-06-25 22:01:46 +01:00