• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IProjectEntry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: TryGetAnalysis

 internal static bool TryGetAnalysis(this ITextBuffer buffer, out IProjectEntry analysis)
 {
     return buffer.Properties.TryGetProperty<IProjectEntry>(typeof(IProjectEntry), out analysis);
 }
开发者ID:TerabyteX,项目名称:main,代码行数:4,代码来源:Extensions.cs


示例17: GetCurrentCode

        private static CurrentCode GetCurrentCode(IProjectEntry entry, int buffer) {
            object dictTmp;
            SortedDictionary<int, CurrentCode> dict;
            if (!entry.Properties.TryGetValue(_currentCodeKey, out dictTmp)) {
                entry.Properties[_currentCodeKey] = dict = new SortedDictionary<int, CurrentCode>();
            } else {
                dict = (SortedDictionary<int, CurrentCode>)dictTmp;
            }

            CurrentCode curCode;
            if (!dict.TryGetValue(buffer, out curCode)) {
                curCode = dict[buffer] = new CurrentCode();
            }

            return curCode;
        }
开发者ID:RussBaz,项目名称:PTVS,代码行数:16,代码来源:ProjectEntryExtensions.cs


示例18: EntryEventArgs

 public EntryEventArgs(IProjectEntry entry) {
     Entry = entry;
 }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:3,代码来源:EntryEventArgs.cs


示例19: UnloadFile

        internal void UnloadFile(IProjectEntry entry) {
            if (_pyAnalyzer == null) {
                // We aren't able to analyze code.
                return;
            }

            if (entry != null) {
                // If we remove a Python module, reanalyze any other modules
                // that referenced it.
                IPythonProjectEntry[] reanalyzeEntries = null;
                var pyEntry = entry as IPythonProjectEntry;
                if (pyEntry != null && !string.IsNullOrEmpty(pyEntry.ModuleName)) {
                    reanalyzeEntries = _pyAnalyzer.GetEntriesThatImportModule(pyEntry.ModuleName, false).ToArray();
                }

                ClearParserTasks(entry);
                _pyAnalyzer.RemoveModule(entry);
                IProjectEntry removed;
                _projectFiles.TryRemove(entry.FilePath, out removed);

                if (reanalyzeEntries != null) {
                    foreach (var existing in reanalyzeEntries) {
                        _analysisQueue.Enqueue(existing, AnalysisPriority.Normal);
                    }
                }
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:27,代码来源:ProjectAnalyzer.cs


示例20: ParseFile

        private void ParseFile(IProjectEntry entry, IDictionary<int, CodeInfo> buffers) {
            IPythonProjectEntry pyEntry;
            IExternalProjectEntry externalEntry;

            SortedDictionary<int, ParseResult> parseResults = new SortedDictionary<int, ParseResult>();

            if ((pyEntry = entry as IPythonProjectEntry) != null) {
                foreach (var buffer in buffers) {
                    var errorSink = new CollectingErrorSink();
                    var tasks = new List<AP.TaskItem>();
                    ParserOptions options = MakeParserOptions(errorSink, tasks);

                    using (var parser = buffer.Value.CreateParser(Project.LanguageVersion, options)) {
                        var ast = ParseOneFile(parser);
                        parseResults[buffer.Key] = new ParseResult(
                            ast,
                            errorSink,
                            tasks,
                            buffer.Value.Version
                        );
                    }
                }

                // Save the single or combined tree into the project entry
                UpdateAnalysisTree(pyEntry, parseResults);

                // update squiggles for the buffer. snapshot may be null if we
                // are analyzing a file that is not open
                SendParseComplete(pyEntry, parseResults);

                // enqueue analysis of the file
                if (parseResults.Where(x => x.Value.Ast != null).Any()) {
                    _analysisQueue.Enqueue(pyEntry, AnalysisPriority.Normal);
                }
            } else if ((externalEntry = entry as IExternalProjectEntry) != null) {
                foreach (var keyValue in buffers) {
                    externalEntry.ParseContent(keyValue.Value.GetReader(), null);
                    _analysisQueue.Enqueue(entry, AnalysisPriority.Normal);
                }
            }
        }
开发者ID:,项目名称:,代码行数:41,代码来源:



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IProjectFile类代码示例发布时间:2022-05-24
下一篇:
C# IProjectContent类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap