Esempio n. 1
0
        private void TextView_Closed(object sender, EventArgs e)
        {
            var textView = (ITextView)sender;

            AnalysisEntry entry;

            if (_entryService.TryGetAnalysisEntry(textView, textView.TextBuffer, out entry))
            {
                entry.Analyzer.BufferDetached(entry, textView.TextBuffer);
            }

            textView.Closed -= TextView_Closed;
        }
Esempio n. 2
0
        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
                        );
                }
            }
        }