Files
SharpIDE/src/SharpIDE.Application/Features/Analysis/IdeApplyCompletionService.cs
2025-10-28 18:09:59 +10:00

19 lines
855 B
C#

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Completion;
using SharpIDE.Application.Features.FileWatching;
using SharpIDE.Application.Features.SolutionDiscovery;
namespace SharpIDE.Application.Features.Analysis;
public class IdeApplyCompletionService(RoslynAnalysis roslynAnalysis, FileChangedService fileChangedService)
{
private readonly RoslynAnalysis _roslynAnalysis = roslynAnalysis;
private readonly FileChangedService _fileChangedService = fileChangedService;
public async Task ApplyCompletion(SharpIdeFile file, CompletionItem completionItem, Document document)
{
var (updatedDocumentText, newLinePosition) = await _roslynAnalysis.GetCompletionApplyChanges(file, completionItem, document);
await _fileChangedService.SharpIdeFileChanged(file, updatedDocumentText, FileChangeType.CompletionChange, newLinePosition);
}
}