private async Task AddMissingImports(List <string> importList, SnapshotPoint point) { if (importList.Count > 0) { var projEntry = _textView.GetAnalysisEntry(_textView.TextBuffer, _serviceProvider); if (projEntry != null) { foreach (var import in importList) { var isMissing = await projEntry.Analyzer.IsMissingImportAsync( projEntry, import, new SourceLocation( point.Position, point.Position - point.GetContainingLine().Start + 1, point.GetContainingLine().LineNumber ) ); if (isMissing) { await VsProjectAnalyzer.AddImportAsync( projEntry, null, import, _textView, _textView.TextBuffer ); } } } } }
public async void Invoke(CancellationToken cancellationToken) { Debug.Assert(!string.IsNullOrEmpty(_name)); await VsProjectAnalyzer.AddImportAsync( _buffer.GetAnalysisEntry(), _fromModule, _name, _source._view, _buffer ); }
public async void Invoke(CancellationToken cancellationToken) { Debug.Assert(!string.IsNullOrEmpty(_name)); var entryService = _source._provider.GetEntryService(); AnalysisEntry entry; if (entryService == null || !entryService.TryGetAnalysisEntry(_source._view, _buffer, out entry)) { return; } await VsProjectAnalyzer.AddImportAsync( entry, _fromModule, _name, _source._view, _buffer ); }
private async Task AddMissingImports(List <string> importList, SnapshotPoint point) { if (importList.Count == 0) { return; } AnalysisEntry entry; if (_entryService == null || !_entryService.TryGetAnalysisEntry(_textView, _textView.TextBuffer, out entry)) { return; } foreach (var import in importList) { var isMissing = await entry.Analyzer.IsMissingImportAsync( entry, import, new SourceLocation( point.Position, point.Position - point.GetContainingLine().Start + 1, point.GetContainingLine().LineNumber ) ); if (isMissing) { await VsProjectAnalyzer.AddImportAsync( entry, null, import, _textView, _textView.TextBuffer ); } } }