当前位置: 首页>>代码示例>>C#>>正文


C# IProjectEntry类代码示例

本文整理汇总了C#中IProjectEntry的典型用法代码示例。如果您正苦于以下问题:C# IProjectEntry类的具体用法?C# IProjectEntry怎么用?C# IProjectEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IProjectEntry类属于命名空间,在下文中一共展示了IProjectEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EnqueueFile

        /// <summary>
        /// Parses the specified file on disk.
        /// </summary>
        /// <param name="filename"></param>
        public void EnqueueFile(IProjectEntry projEntry, string filename) {
            var severity = _parser.PyService.GeneralOptions.IndentationInconsistencySeverity;
            EnqueWorker(() => {
                for (int i = 0; i < 10; i++) {
                    try {
                        if (!File.Exists(filename)) {
                            break;
                        }
                        using (var reader = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete)) {
                            _parser.ParseFile(projEntry, filename, reader, severity);
                            return;
                        }
                    } catch (IOException) {
                        // file being copied, try again...
                        Thread.Sleep(100);
                    } catch (UnauthorizedAccessException) {
                        // file is inaccessible, try again...
                        Thread.Sleep(100);
                    }
                }

                IPythonProjectEntry pyEntry = projEntry as IPythonProjectEntry;
                if (pyEntry != null) {
                    // failed to parse, keep the UpdateTree calls balanced
                    pyEntry.UpdateTree(null, null);
                }
            });
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:32,代码来源:ParseQueue.cs

示例2: GetTestCases

        public static IEnumerable<TestCaseInfo> GetTestCases(IProjectEntry projEntry)
        {
            var entry = projEntry as IPythonProjectEntry;
            if (entry == null) {
                yield break;
            }

            foreach (var classValue in GetTestCaseClasses(entry)) {
                // Check the name of all functions on the class using the
                // analyzer. This will return functions defined on this
                // class and base classes
                foreach (var member in GetTestCaseMembers(entry, classValue)) {
                    // Find the definition to get the real location of the
                    // member. Otherwise decorators will confuse us.
                    var definition = entry.Analysis
                        .GetVariablesByIndex(classValue.Name + "." + member.Key, 0)
                        .FirstOrDefault(v => v.Type == VariableType.Definition);

                    var location = (definition != null) ?
                        definition.Location :
                        member.Value.SelectMany(m => m.Locations).FirstOrDefault(loc => loc != null);

                    int endLine = location?.EndLine ?? location?.StartLine ?? 0;

                    yield return new TestCaseInfo(
                        classValue.DeclaringModule.FilePath,
                        classValue.Name,
                        member.Key,
                        location.StartLine,
                        location.StartColumn,
                        endLine
                    );
                }
            }
        }
开发者ID:,项目名称:,代码行数:35,代码来源:

示例3: EnqueueFile

        /// <summary>
        /// Parses the specified file on disk.
        /// </summary>
        /// <param name="filename"></param>
        private void EnqueueFile(IProjectEntry projEntry, string filename) {
            // get the current snapshot from the UI thread

            EnqueWorker(() => {
                for (int i = 0; i < 10; i++) {
                    try {
                        if (!File.Exists(filename)) {
                            break;
                        }

                        var cookie = new FileCookie(filename);
                        var reader = new StreamReader(
                            new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete)
                        );

                        using (reader) {
                            ParseFile(projEntry, filename, reader, cookie);
                        }
                        return;
                    } catch (IOException) {
                        // file being copied, try again...
                        Thread.Sleep(100);
                    } catch (UnauthorizedAccessException) {
                        // file is inaccessible, try again...
                        Thread.Sleep(100);
                    }
                }

                IJsProjectEntry pyEntry = projEntry as IJsProjectEntry;
                if (pyEntry != null) {
                    // failed to parse, keep the UpdateTree calls balanced
                    pyEntry.UpdateTree(null, null);
                }
            });
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:39,代码来源:ParseQueue.cs

示例4: BufferParser

            private const int ReparseDelay = 1000;      // delay in MS before we re-parse a buffer w/ non-line changes.

            public BufferParser(IProjectEntry initialProjectEntry, VsProjectAnalyzer parser, ITextBuffer buffer) {
                _parser = parser;
                _timer = new Timer(ReparseTimer, null, Timeout.Infinite, Timeout.Infinite);
                _buffers = new[] { buffer };
                _currentProjEntry = initialProjectEntry;
                AttachedViews = 1;

                InitBuffer(buffer);
            }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:11,代码来源:BufferParser.cs

示例5: EnqueueBuffer

        /// <summary>
        /// Parses the specified text buffer.  Continues to monitor the parsed buffer and updates
        /// the parse tree asynchronously as the buffer changes.
        /// </summary>
        /// <param name="buffer"></param>
        private BufferParser EnqueueBuffer(IProjectEntry projEntry, ITextBuffer buffer) {
            // only attach one parser to each buffer, we can get multiple enqueue's
            // for example if a document is already open when loading a project.
            BufferParser bufferParser;
            if (!buffer.Properties.TryGetProperty<BufferParser>(typeof(BufferParser), out bufferParser)) {
                bufferParser = new BufferParser(projEntry, this, buffer);

                var curSnapshot = buffer.CurrentSnapshot;
                bufferParser.EnqueingEntry();
                EnqueWorker(() => {
                    ParseBuffers(bufferParser, curSnapshot);
                });
            } else {
                bufferParser.AttachedViews++;
            }

            return bufferParser;
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:23,代码来源:ParseQueue.cs

示例6: EnqueueBuffer

        /// <summary>
        /// Parses the specified text buffer.  Continues to monitor the parsed buffer and updates
        /// the parse tree asynchronously as the buffer changes.
        /// </summary>
        /// <param name="buffer"></param>
        public BufferParser EnqueueBuffer(IProjectEntry projEntry, ITextView textView, ITextBuffer buffer) {
            // only attach one parser to each buffer, we can get multiple enqueue's
            // for example if a document is already open when loading a project.
            BufferParser bufferParser;
            if (!buffer.Properties.TryGetProperty<BufferParser>(typeof(BufferParser), out bufferParser)) {
                Dispatcher dispatcher = null;
                var uiElement = textView as UIElement;
                if (uiElement != null) {
                    dispatcher = uiElement.Dispatcher;
                }
                bufferParser = new BufferParser(this, dispatcher, projEntry, _parser, buffer);

                var curSnapshot = buffer.CurrentSnapshot;
                var severity = _parser.PyService.GeneralOptions.IndentationInconsistencySeverity;
                bufferParser.EnqueingEntry();
                EnqueWorker(() => {
                    _parser.ParseBuffers(bufferParser, severity, curSnapshot);
                });
            } else {
                bufferParser.AttachedViews++;
            }
            
            return bufferParser;
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:29,代码来源:ParseQueue.cs

示例7: ParseFile

        internal void ParseFile(IProjectEntry entry, string filename, Stream content, Severity indentationSeverity) {
            IPythonProjectEntry pyEntry;
            IExternalProjectEntry externalEntry;

            TextReader reader = null;
            ITextSnapshot snapshot = GetOpenSnapshot(entry);
            string zipFileName = GetZipFileName(entry);
            string pathInZipFile = GetPathInZipFile(entry);
            IAnalysisCookie cookie;
            if (snapshot != null) {
                cookie = new SnapshotCookie(snapshot);
                reader = new SnapshotSpanSourceCodeReader(new SnapshotSpan(snapshot, 0, snapshot.Length));
            } else if (zipFileName != null) {
                cookie = new ZipFileCookie(zipFileName, pathInZipFile);
            } else {
                cookie = new FileCookie(filename);
            }

            if ((pyEntry = entry as IPythonProjectEntry) != null) {
                PythonAst ast;
                CollectingErrorSink errorSink;
                List<TaskProviderItem> commentTasks;
                if (reader != null) {
                    ParsePythonCode(snapshot, reader, indentationSeverity, out ast, out errorSink, out commentTasks);
                } else {
                    ParsePythonCode(snapshot, content, indentationSeverity, out ast, out errorSink, out commentTasks);
                }

                if (ast != null) {
                    pyEntry.UpdateTree(ast, cookie);
                } else {
                    // notify that we failed to update the existing analysis
                    pyEntry.UpdateTree(null, null);
                }

                // update squiggles for the buffer. snapshot may be null if we
                // are analyzing a file that is not open
                UpdateErrorsAndWarnings(entry, snapshot, errorSink, commentTasks);

                // enqueue analysis of the file
                if (ast != null) {
                    _analysisQueue.Enqueue(pyEntry, AnalysisPriority.Normal);
                }
            } else if ((externalEntry = entry as IExternalProjectEntry) != null) {
                externalEntry.ParseContent(reader ?? new StreamReader(content), cookie);
                _analysisQueue.Enqueue(entry, AnalysisPriority.Normal);
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:48,代码来源:ProjectAnalyzer.cs

示例8: DisconnectErrorList

 public void DisconnectErrorList(IProjectEntry projEntry, ITextBuffer buffer) {
     _errorProvider.RemoveBufferForErrorSource(projEntry, ParserTaskMoniker, buffer);
     _commentTaskProvider.RemoveBufferForErrorSource(projEntry, ParserTaskMoniker, buffer);
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:4,代码来源:ProjectAnalyzer.cs

示例9: GetPathInZipFile

 internal static string GetPathInZipFile(IProjectEntry entry) {
     object result;
     entry.Properties.TryGetValue(_pathInZipFile, out result);
     return (string)result;
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:5,代码来源:ProjectAnalyzer.cs

示例10: OnShouldWarnOnLaunchChanged

 private void OnShouldWarnOnLaunchChanged(IProjectEntry entry) {
     var evt = ShouldWarnOnLaunchChanged;
     if (evt != null) {
         evt(this, new EntryEventArgs(entry));
     }
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:6,代码来源:ProjectAnalyzer.cs

示例11: ClearParserTasks

        internal void ClearParserTasks(IProjectEntry entry) {
            if (entry != null) {
                _errorProvider.Clear(entry, ParserTaskMoniker);
                _commentTaskProvider.Clear(entry, ParserTaskMoniker);
                _unresolvedSquiggles.StopListening(entry as IPythonProjectEntry);

                bool removed = false;
                lock (_hasParseErrorsLock) {
                    removed = _hasParseErrors.Remove(entry);
                }
                if (removed) {
                    OnShouldWarnOnLaunchChanged(entry);
                }
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:15,代码来源:ProjectAnalyzer.cs

示例12: ResolveLocation

 public LocationInfo ResolveLocation(IProjectEntry project, object location) {
     SourceLocation loc = (SourceLocation)location;
     return new LocationInfo(project, loc.Line, loc.Column);
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:4,代码来源:SourceLocationResolver.cs

示例13: MonitoredBufferResult

 public MonitoredBufferResult(BufferParser bufferParser, ITextView textView, IProjectEntry projectEntry) {
     BufferParser = bufferParser;
     TextView = textView;
     ProjectEntry = projectEntry;
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:5,代码来源:MonitoredBufferResult.cs

示例14: ParseFile

        private void ParseFile(IProjectEntry entry, string filename, TextReader reader, IAnalysisCookie cookie) {
            IJsProjectEntry jsEntry;
            IExternalProjectEntry externalEntry;

            if ((jsEntry = entry as IJsProjectEntry) != null) {
                JsAst ast;
                CollectingErrorSink errorSink;
                ParseNodejsCode(reader, out ast, out errorSink);

                if (ast != null) {
                    jsEntry.UpdateTree(ast, cookie);
                } else {
                    // notify that we failed to update the existing analysis
                    jsEntry.UpdateTree(null, null);
                }
                ProjectItem item;
                if (!_projectFiles.TryGetValue(filename, out item) || item.ReportErrors) {
                    // update squiggles for the buffer. snapshot may be null if we
                    // are analyzing a file that is not open
                    UpdateErrorsAndWarnings(entry, GetSnapshot(reader), errorSink);
                } else {
                    TaskProvider.Clear(entry, ParserTaskMoniker);
                }

                // enqueue analysis of the file
                if (ast != null && ShouldEnqueue()) {
                    _analysisQueue.Enqueue(jsEntry, AnalysisPriority.Normal);
                }
            } else if ((externalEntry = entry as IExternalProjectEntry) != null) {
                externalEntry.ParseContent(reader ?? reader, cookie);
                if (ShouldEnqueue()) {
                    _analysisQueue.Enqueue(entry, AnalysisPriority.Normal);
                }
            }
        }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:35,代码来源:VsProjectAnalyzer.cs

示例15: DisconnectErrorList

 private void DisconnectErrorList(IProjectEntry projEntry, ITextBuffer buffer) {
     TaskProvider.RemoveBufferForErrorSource(projEntry, ParserTaskMoniker, buffer);
 }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:3,代码来源:VsProjectAnalyzer.cs


注:本文中的IProjectEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。