csharpcf25d736 | 1 | using RoslynMcp.ServiceLayer; |
| 2 | |
| 3 | namespace CascadeIDE.Services.Roslyn; |
| 4 | |
| 5 | /// <summary>In-process Roslyn MCP ServiceLayer for Monaco refactorings (move type, extract interface, rename).</summary> |
| 6 | public static class RoslynMcpEditorIntelligence |
| 7 | { |
| 8 | public static Task<RoslynEditorCodeActionsResult> ListCodeActionsAsync( |
| 9 | string solutionPath, |
| 10 | string filePath, |
| 11 | string liveDocumentText, |
| 12 | int line, |
| 13 | int column, |
| 14 | CancellationToken cancellationToken = default) => |
| 15 | CodeActions.ListForEditorAsync( |
| 16 | solutionPath, |
| 17 | filePath, |
| 18 | line, |
| 19 | column, |
| 20 | liveDocumentText, |
| 21 | cancellationToken: cancellationToken); |
| 22 | |
| 23 | public static Task<RoslynEditorApplyResult> ApplyCodeActionAsync( |
| 24 | string solutionPath, |
| 25 | string filePath, |
| 26 | string liveDocumentText, |
| 27 | int line, |
| 28 | int column, |
| 29 | int actionIndex, |
| 30 | CancellationToken cancellationToken = default) => |
| 31 | CodeActions.ApplyForEditorAsync( |
| 32 | solutionPath, |
| 33 | filePath, |
| 34 | line, |
| 35 | column, |
| 36 | actionIndex, |
| 37 | liveDocumentText, |
| 38 | cancellationToken: cancellationToken); |
| 39 | |
| 40 | public static Task<RoslynEditorApplyResult> RenameAsync( |
| 41 | string solutionPath, |
| 42 | string filePath, |
| 43 | string liveDocumentText, |
| 44 | int line, |
| 45 | int column, |
| 46 | string newName, |
| 47 | CancellationToken cancellationToken = default) => |
| 48 | RenameSymbol.RenameForEditorAsync( |
| 49 | solutionPath, |
| 50 | filePath, |
| 51 | line, |
| 52 | column, |
| 53 | newName, |
| 54 | liveDocumentText, |
| 55 | renameFile: true, |
| 56 | renamePartialTypeFiles: true, |
| 57 | cancellationToken: cancellationToken); |
| 58 | } |
| 59 | |
View only · write via MCP/CIDE