csharpdeeb25a2 | 1 | using Microsoft.CodeAnalysis.CSharp; |
| 2 | |
| 3 | namespace CascadeIDE.Services; |
| 4 | |
| 5 | internal static class CSharpCompletionKeywords |
| 6 | { |
| 7 | public static IReadOnlyList<string> All { get; } = Build(); |
| 8 | |
| 9 | private static string[] Build() |
| 10 | { |
| 11 | var set = new HashSet<string>(StringComparer.Ordinal); |
| 12 | foreach (SyntaxKind kind in Enum.GetValues<SyntaxKind>()) |
| 13 | { |
| 14 | if (!SyntaxFacts.IsKeywordKind(kind) && !SyntaxFacts.IsContextualKeyword(kind)) |
| 15 | continue; |
| 16 | |
| 17 | var text = SyntaxFacts.GetText(kind); |
| 18 | if (text.Length > 0) |
| 19 | set.Add(text); |
| 20 | } |
| 21 | |
| 22 | var keywords = set.ToArray(); |
| 23 | Array.Sort(keywords, StringComparer.Ordinal); |
| 24 | return keywords; |
| 25 | } |
| 26 | } |
| 27 | |
View only · write via MCP/CIDE