Ejemplo n.º 1
0
        private void AddMissingImports(List <string> importList)
        {
            if (importList.Count > 0)
            {
                var projEntry = _textView.TextBuffer.GetPythonProjectEntry();
                if (projEntry != null)
                {
                    PythonAst       ast;
                    IAnalysisCookie cookie;
                    projEntry.GetTreeAndCookie(out ast, out cookie);
                    if (ast != null)
                    {
                        var walker = new ImportWalker();
                        ast.Walk(walker);

                        foreach (var import in importList)
                        {
                            if (!walker.Imports.Contains(import))
                            {
                                MissingImportAnalysis.AddImport(
                                    _serviceProvider,
                                    _textView.TextBuffer,
                                    _textView,
                                    null,
                                    import
                                    );
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public override void Invoke()
 {
     MissingImportAnalysis.AddImport(
         _serviceProvider,
         _buffer,
         _view,
         FromName,
         Name
         );
 }
Ejemplo n.º 3
0
        public void Invoke(CancellationToken cancellationToken)
        {
            Debug.Assert(!string.IsNullOrEmpty(_name));

            MissingImportAnalysis.AddImport(
                _source._provider,
                _buffer,
                _source._view,
                _fromModule,
                _name
                );
        }