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


C# ITrackingSpan.GetEndPoint方法代码示例

本文整理汇总了C#中ITrackingSpan.GetEndPoint方法的典型用法代码示例。如果您正苦于以下问题:C# ITrackingSpan.GetEndPoint方法的具体用法?C# ITrackingSpan.GetEndPoint怎么用?C# ITrackingSpan.GetEndPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITrackingSpan的用法示例。


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

示例1: ReverseExpressionParser

        public ReverseExpressionParser(ITextSnapshot snapshot, ITextBuffer buffer, ITrackingSpan span)
        {
            _snapshot = snapshot;
            _buffer = buffer;
            _span = span;

            var loc = span.GetSpan(snapshot);
            var line = _curLine = snapshot.GetLineFromPosition(loc.Start);

            var targetSpan = new Span(line.Start.Position, span.GetEndPoint(snapshot).Position - line.Start.Position);
            _tokens = Classifier.GetClassificationSpans(new SnapshotSpan(snapshot, targetSpan));
        }
开发者ID:TerabyteX,项目名称:main,代码行数:12,代码来源:ReverseExpressionParser.cs

示例2: Make

        public static CompletionAnalysis Make(IList<ClassificationSpan> tokens, ITrackingSpan span, ITextBuffer textBuffer, CompletionOptions options) {
            Debug.Assert(tokens[0].Span.GetText() == "from");

            var ns = new List<string>();
            bool nsComplete = false;
            bool seenImport = false;
            bool seenName = false;
            bool seenAs = false;
            bool seenAlias = false;
            bool includeStar = true;
            foreach (var token in tokens.Skip(1)) {
                if (token == null || token.Span.End > span.GetEndPoint(textBuffer.CurrentSnapshot).Position) {
                    break;
                }

                if (!seenImport) {
                    if (token.ClassificationType.IsOfType(PredefinedClassificationTypeNames.Identifier)) {
                        ns.Add(token.Span.GetText());
                        nsComplete = true;
                    } else if (token.ClassificationType.IsOfType(PythonPredefinedClassificationTypeNames.Dot)) {
                        nsComplete = false;
                    }
                    seenImport = IsKeyword(token, "import");
                } else if (token.ClassificationType.IsOfType(PythonPredefinedClassificationTypeNames.Comma)) {
                    seenName = false;
                    seenAs = false;
                    seenAlias = false;
                    includeStar = false;
                } else if (token.Span.GetText() == "*") {
                    // Nothing comes after a star
                    return EmptyCompletionContext;
                } else if (IsKeyword(token, "as")) {
                    seenAs = true;
                } else if (token.ClassificationType.IsOfType(PredefinedClassificationTypeNames.Identifier)) {
                    if (seenAlias) {
                        return EmptyCompletionContext;
                    } else if (seenAs) {
                        seenAlias = true;
                    } else if (seenName) {
                        return EmptyCompletionContext;
                    } else {
                        seenName = true;
                    }
                } else {
                    includeStar = false;
                }
            }
            if (!seenImport) {
                if (nsComplete) {
                    return new ImportKeywordCompletionAnalysis(span, textBuffer, options);
                } else {
                    return ImportCompletionAnalysis.Make(tokens, span, textBuffer, options);
                }
            }

            if (!nsComplete || seenAlias || seenAs) {
                return EmptyCompletionContext;
            }

            if (seenName) {
                return new AsKeywordCompletionAnalysis(span, textBuffer, options);
            }

            return new FromImportCompletionAnalysis(ns.ToArray(), includeStar, span, textBuffer, options);
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:65,代码来源:FromImportCompletionAnalysis.cs


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