csharpdeeb25a2 | 1 | using CascadeIDE.Services; |
| 2 | |
| 3 | namespace CascadeIDE.Features.Editor; |
| 4 | |
| 5 | /// <summary>Inline hints редактора: фильтрация и выдача по настройкам <c>editor.inline_hints</c>.</summary> |
| 6 | public sealed partial class EditorWorkspaceViewModel |
| 7 | { |
| 8 | /// <summary>Собрать inlay hints для документа с учётом пользовательских настроек editor.inline_hints.</summary> |
| 9 | public IReadOnlyList<EditorTrailingInlayPart> GetEditorInlineHintsForFile(string filePath, string sourceText) |
| 10 | { |
| 11 | var opts = _host.McpSettings.Editor.InlineHints; |
| 12 | if (!opts.Enabled) |
| 13 | return []; |
| 14 | |
| 15 | var parts = _host.HostCsharpLanguageService.GetVarInlayHintsForFile(filePath, sourceText); |
| 16 | if (opts.ParameterNames && opts.VariableTypes) |
| 17 | return parts; |
| 18 | |
| 19 | var filtered = parts.Where(static p => !string.IsNullOrWhiteSpace(p.Label)); |
| 20 | |
| 21 | if (!opts.ParameterNames) |
| 22 | filtered = filtered.Where(static p => !p.Label.TrimEnd().EndsWith(':')); |
| 23 | if (!opts.VariableTypes) |
| 24 | filtered = filtered.Where(static p => !p.Label.StartsWith(" ", StringComparison.Ordinal)); |
| 25 | |
| 26 | return filtered.ToList(); |
| 27 | } |
| 28 | } |
| 29 | |
View only · write via MCP/CIDE