Файли
openidea/languages/csharp.toml
T
LU XIANGRUIтаwildcatDownstairs 9e4fbe863d fix(csharp): show Roslyn's inlay hints and bold the right parameter (#7701)
Roslyn's inlay hints are off unless the client turns them on, and csharp.toml passed no csharp|inlay_hints settings, so C# showed no parameter name or type hints. csharp.toml and razor.toml now enable parameter hints for literals, new-expressions and indexers (with Roslyn's suppressions) and var/lambda parameter types. Parameter info matches string parameter labels as whole words from the parameter list on (all servers) and keeps a variadic last parameter (params, ..., *args) bold. The real-server test is ignored by default (needs the .NET SDK).

Closes #7678

Co-authored-by: wildcatDownstairs <[email protected]>
2026-12-03 15:31:16 +08:00

53 рядки
2.5 KiB
TOML
Неформатований Анотація Історія

Цей файл містить неоднозначні символи Юнікоду
Цей файл містить символи Юнікоду, які можна сплутати з іншими символами. Якщо ви вважаєте, що це зроблено навмисно, можете сміливо ігнорувати це попередження. Щоб показати їх, скористайтеся кнопкою Escape.
id = "csharp"
name = "C#"
extensions = ["cs", "csx"]
line-comment = "//"
block-comment = ["/*", "*/"]
indent = { tab-size = 4, insert-spaces = true }
ui-mode = "C#"
tree-sitter = "csharp"
[[language-servers]]
name = "roslyn-language-server"
command = "roslyn-language-server"
# --autoLoadProjects: the server finds and opens the solution or projects itself.
args = ["--stdio", "--autoLoadProjects", "--telemetryLevel", "off"]
root-markers = ["*.sln", "*.slnx", "*.csproj", "global.json", "Directory.Build.props", "ProjectSettings/ProjectVersion.txt"]
install-hint = "Install Roslyn (C#) in Settings › Languages & Frameworks › Language Servers (needs the .NET 10 SDK), or csharp-ls for older SDKs"
[language-servers.settings."csharp|completion"]
dotnet_show_completion_items_from_unimported_namespaces = true
# Roslyn's inlay hints are off unless asked for (#7678). Parameter names where the argument
# doesn't say what it is (literals, `new X()`, indexers), not at variables and other expressions;
# the types of `var` and lambda parameters. Editor › Inlay Hints turns each kind off.
[language-servers.settings."csharp|inlay_hints"]
dotnet_enable_inlay_hints_for_parameters = true
dotnet_enable_inlay_hints_for_literal_parameters = true
dotnet_enable_inlay_hints_for_object_creation_parameters = true
dotnet_enable_inlay_hints_for_indexer_parameters = true
dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix = true
dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent = true
dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name = true
csharp_enable_inlay_hints_for_types = true
csharp_enable_inlay_hints_for_implicit_variable_types = true
csharp_enable_inlay_hints_for_lambda_parameter_types = true
dotnet_enable_inlay_hints_for_other_parameters = false
# On by default in Roslyn; the type is mostly written beside them already (#7326).
csharp_enable_inlay_hints_for_implicit_object_creation = false
csharp_enable_inlay_hints_for_collection_expressions = false
[[language-servers]]
name = "csharp-ls"
# Alternative: used only when the server above is not installed.
fallback = true
command = "csharp-ls"
root-markers = ["*.sln", "*.slnx", "*.csproj", "global.json", "Directory.Build.props", "ProjectSettings/ProjectVersion.txt"]
install-hint = "dotnet tool install --global csharp-ls"
[debugger]
adapter = "netcoredbg"
command = "netcoredbg"
args = ["--interpreter=vscode"]
install-hint = "Install netcoredbg (.NET debugger) in Settings › Languages & Frameworks › Language Servers"