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

C# ISignatureHelpSession类代码示例

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

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



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

示例1: AugmentSignatureHelpSession

        public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
        {
            if (!session.TextView.Properties.ContainsProperty(SessionKey))
            {
                return;
            }

            // At the moment there is a bug in the javascript provider which causes it to
            // repeatedly insert the same Signature values into an ISignatureHelpSession
            // instance.  There is no way, other than reflection, for us to prevent this
            // from happening.  Instead we just ensure that our provider runs after
            // Javascript and then remove the values they add here
            signatures.Clear();

            // Map the trigger point down to our buffer.
            var subjectTriggerPoint = session.GetTriggerPoint(subjectBuffer.CurrentSnapshot);
            if (!subjectTriggerPoint.HasValue)
            {
                return;
            }

            var currentSnapshot = subjectTriggerPoint.Value.Snapshot;
            var querySpan = new SnapshotSpan(subjectTriggerPoint.Value, 0);
            var applicableToSpan = currentSnapshot.CreateTrackingSpan(
                querySpan.Start.Position,
                0,
                SpanTrackingMode.EdgeInclusive);

            string encouragement = encouragements.GetRandomEncouragement();
            if (encouragement != null)
            {
                var signature = new Signature(applicableToSpan, encouragement, "", "");
                signatures.Add(signature);
            }
        }
开发者ID:RC1140,项目名称:Encourage,代码行数:35,代码来源:EncourageSignatureHelpSource.cs


示例2: AugmentSignatureHelpSession

        public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
        {
            SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
            if (!point.HasValue)
                return;

            CssEditorDocument document = CssEditorDocument.FromTextBuffer(_buffer);
            ParseItem item = document.StyleSheet.ItemBeforePosition(point.Value.Position);

            if (item == null)
                return;

            Declaration dec = item.FindType<Declaration>();
            if (dec == null || dec.PropertyName == null || dec.Colon == null)
                return;

            foreach (ISignature signature in signatures)
            {
                if (signature is ValueOrderSignature)
                {
                    signatures.RemoveAt(signatures.Count - 1);
                    break;
                }
            }
        }
开发者ID:LogoPhonix,项目名称:WebEssentials2012,代码行数:25,代码来源:RemoveCssSignatureHelpSource.cs


示例3: AugmentSignatureHelpSession

        public void AugmentSignatureHelpSession(ISignatureHelpSession session, System.Collections.Generic.IList<ISignature> signatures)
        {
            var span = session.GetApplicableSpan(_textBuffer);

            var sigs = _textBuffer.CurrentSnapshot.GetSignatures(span);

            ISignature curSig = null;

            foreach (var sig in sigs.Signatures) {
                if (sigs.ParameterIndex == 0 || sig.Parameters.Count > sigs.ParameterIndex) {
                    curSig = sig;
                    break;
                }
            }

            foreach (var sig in sigs.Signatures) {
                signatures.Add(sig);
            }

            if (curSig != null) {
                // save the current sig so we don't need to recalculate it (we can't set it until
                // the signatures are added by our caller).
                session.Properties.AddProperty(typeof(JSignature), curSig);
            }
        }
开发者ID:borota,项目名称:JTVS,代码行数:25,代码来源:SignatureHelpSource.cs


示例4: AugmentSignatureHelpSession

            public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
            {
                ITextSnapshot snapshot = _textBuffer.CurrentSnapshot;

                // trigger point
                SnapshotPoint? point = session.GetTriggerPoint(snapshot);
                if (point == null)
                    return;

                // get syntax tree
                SyntaxTree syntaxTree = snapshot.GetSyntaxTree();
                var root = syntaxTree.Root as RobotsTxtDocumentSyntax;

                // find line in syntax tree
                ITextSnapshotLine line = point.Value.GetContainingLine();
                RobotsTxtLineSyntax lineSyntax = root.Records.SelectMany(r => r.Lines)
                    .Where(l => !l.NameToken.IsMissing && !l.DelimiterToken.IsMissing)
                    .FirstOrDefault(l => l.Span.IntersectsWith(line.Extent));

                // found
                if (lineSyntax != null)
                {
                    if (lineSyntax.DelimiterToken.Span.Span.End <= point.Value)
                    {
                        // get semantic model
                        ISemanticModel model = syntaxTree.GetSemanticModel();

                        // add signature
                        signatures.Add(new RobotsTxtSignature(model, lineSyntax));
                    }
                }
            }
开发者ID:peterwie,项目名称:RobotsTxtLanguageService,代码行数:32,代码来源:RobotsTxtSignatureHelpSource.cs


示例5: AugmentSignatureHelpSession

        public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
        {
            if (!session.TextView.Properties.ContainsProperty(SessionKey))
            {
                return;
            }

            // Map the trigger point down to our buffer.
            var subjectTriggerPoint = session.GetTriggerPoint(subjectBuffer.CurrentSnapshot);
            if (!subjectTriggerPoint.HasValue)
            {
                return;
            }

            var currentSnapshot = subjectTriggerPoint.Value.Snapshot;
            var querySpan = new SnapshotSpan(subjectTriggerPoint.Value, 0);
            var applicableToSpan = currentSnapshot.CreateTrackingSpan(
                querySpan.Start.Position,
                0,
                SpanTrackingMode.EdgeInclusive);

            string encouragement = encouragements.GetRandomEncouragement();
            var signature = new Signature(applicableToSpan, encouragement, "", "");
            signatures.Add(signature);
        }
开发者ID:jeremyiverson,项目名称:Encourage,代码行数:25,代码来源:EncourageSignatureHelpSource.cs


示例6: AugmentSignatureHelpSession

        public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
        {
            SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot);
            if (!point.HasValue)
                return;

            CssEditorDocument document = CssEditorDocument.FromTextBuffer(_buffer);
            ParseItem item = document.StyleSheet.ItemBeforePosition(point.Value.Position);

            if (item == null)
                return;

            Declaration dec = item.FindType<Declaration>();
            if (dec == null || dec.PropertyName == null || dec.Colon == null)
                return;

            var span = _buffer.CurrentSnapshot.CreateTrackingSpan(dec.Colon.Start, dec.Length - dec.PropertyName.Length, SpanTrackingMode.EdgeNegative);

            ValueOrderFactory.AddSignatures method = ValueOrderFactory.GetMethod(dec);

            if (method != null)
            {
                signatures.Clear();
                method(session, signatures, dec, span);

                Dispatcher.CurrentDispatcher.BeginInvoke(
                    new Action(() => {
                        session.Properties.AddProperty("dec", dec);
                        session.Match();
                    }),
                    DispatcherPriority.Normal, null);
            }
        }
开发者ID:joeriks,项目名称:WebEssentials2013,代码行数:33,代码来源:ValueOrderSignatureHelpSource.cs


示例7: AugmentSignatureHelpSession

        public void AugmentSignatureHelpSession(ISignatureHelpSession session, System.Collections.Generic.IList<ISignature> signatures)
        {
            var textBuffer = session.TextView.TextBuffer;
            var span = session.CreateTrackingSpan(textBuffer);

            var sigs = _provider._Analysis.GetSignatures(textBuffer.CurrentSnapshot, textBuffer, span);

            ISignature curSig = null;

            foreach (var sig in sigs.Signatures) {
                if (sigs.ParameterIndex == 0 || sig.Parameters.Count > sigs.ParameterIndex) {
                    curSig = sig;
                    break;
                }
            }

            foreach (var sig in sigs.Signatures) {
                signatures.Add(sig);
            }

            if (curSig != null) {
                // save the current sig so we don't need to recalculate it (we can't set it until
                // the signatures are added by our caller).
                session.Properties.AddProperty(typeof(PythonSignature), curSig);
            }
        }
开发者ID:TerabyteX,项目名称:main,代码行数:26,代码来源:SignatureHelpSource.cs


示例8: CollectSignatureLists

        public async System.Threading.Tasks.Task CollectSignatureLists(ISignatureHelpSession newSession)
        {
            JavaEditor javaEditor = null;
            if (TextBuffer.Properties.TryGetProperty<JavaEditor>(typeof(JavaEditor), out javaEditor) &&
                javaEditor.TypeRootIdentifier != null)
            {
                var textReader = new TextSnapshotToTextReader(TextBuffer.CurrentSnapshot) as TextReader;
                var position = newSession.GetTriggerPoint(TextBuffer).GetPosition(TextBuffer.CurrentSnapshot);
                var paramHelpRequest = ProtocolHandlers.CreateParamHelpRequest(
                    textReader,
                    javaEditor.TypeRootIdentifier,
                    position);
                var paramHelpResponse = await javaEditor.JavaPkgServer.Send(javaEditor, paramHelpRequest);

                if (paramHelpResponse.responseType == Protocol.Response.ResponseType.ParamHelp &&
                    paramHelpResponse.paramHelpResponse != null)
                {
                    if (paramHelpResponse.paramHelpResponse.status && paramHelpResponse.paramHelpResponse.signatures.Count != 0)
                    {
                        var applicableTo = TextBuffer.CurrentSnapshot.CreateTrackingSpan(new Span(paramHelpResponse.paramHelpResponse.scopeStart, paramHelpResponse.paramHelpResponse.scopeLength), SpanTrackingMode.EdgeInclusive, 0);
                        int selectedParameterIndex = paramHelpResponse.paramHelpResponse.paramCount;
                        Signatures = TransformSignatures(TextBuffer, paramHelpResponse.paramHelpResponse.signatures, applicableTo, selectedParameterIndex); 
                    }
                }
            }
        }
开发者ID:XewTurquish,项目名称:vsminecraft,代码行数:26,代码来源:JavaSignatureHelp.cs


示例9: ValueOrderSignature

        public ValueOrderSignature(
            string syntax,
            string description,
            ITrackingSpan trackingSpan,
            ISignatureHelpSession session)
        {

            _propertyName = "Syntax";
            _syntax = syntax ?? string.Empty;
            _description = description;
            _trackingSpan = trackingSpan;

            _content = string.Format(CultureInfo.InvariantCulture, "{0}: {1}", _propertyName, _syntax);
            _nameParam = new CssPropertyNameParameter(this);
            _currentParam = _nameParam;

            _session = session;

            // In order to dismiss this tip at the appropriate time, I need to listen
            // to changes in the text buffer
            if (_trackingSpan != null && _session != null)
            {
                _session.Dismissed += OnSessionDismissed;
                _trackingSpan.TextBuffer.Changed += OnTextBufferChanged;
            }
        }
开发者ID:EdsonF,项目名称:WebEssentials2013,代码行数:26,代码来源:ValueOrderSignature.cs


示例10: GetBestMatch

        public ISignature GetBestMatch(ISignatureHelpSession session)
        {
            if (session.Signatures.Count <= 0) return null;

            //TODO: Rob G - Flesh this out to cover various signatures

            return session.Signatures[0];
        }
开发者ID:aloker,项目名称:spark,代码行数:8,代码来源:SparkSignatureHelpSource.cs


示例11: TryGetSession

		/// <summary>
		/// Gets the Roslyn sig help session stored in a <see cref="ISignatureHelpSession"/> or null if none
		/// </summary>
		/// <param name="session">Intellisense sig help session</param>
		/// <returns></returns>
		public static SignatureHelpSession TryGetSession(ISignatureHelpSession session) {
			if (session == null)
				return null;
			SignatureHelpSession ourSession;
			if (session.Properties.TryGetProperty(sigHelpSessionKey, out ourSession))
				return ourSession;
			return null;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:13,代码来源:SignatureHelpSession.cs


示例12: AugmentSignatureHelpSession

 public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
 {
     JavaSignatureHelpSessionSignatures storedSigs;
     if (session.Properties.TryGetProperty<JavaSignatureHelpSessionSignatures>(typeof(JavaSignatureHelpSessionSignatures), out storedSigs))
     {
         foreach (var sig in storedSigs.Signatures)
             signatures.Add(sig);
     }
 }
开发者ID:XewTurquish,项目名称:vsminecraft,代码行数:9,代码来源:JavaSignatureHelp.cs


示例13: AugmentSignatureHelpSession

            public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
            {
                AssertIsForeground();
                if (!session.Properties.TryGetProperty<SignatureHelpPresenterSession>(s_augmentSessionKey, out var presenterSession))
                {
                    return;
                }

                session.Properties.RemoveProperty(s_augmentSessionKey);
                presenterSession.AugmentSignatureHelpSession(signatures);
            }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:11,代码来源:SignatureHelpPresenter.SignatureHelpSource.cs


示例14: AugmentSignatureHelpSession

        public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
        {
            ITextSnapshot currentSnapshot = _textBuffer.CurrentSnapshot;
            int currentPosition = session.GetTriggerPoint(_textBuffer).GetPosition(currentSnapshot);
            ITrackingSpan currentApplicableSpan = currentSnapshot.CreateTrackingSpan(new Span(currentPosition, 0), SpanTrackingMode.EdgeInclusive, TrackingFidelityMode.Forward);

            signatures.Add(CreateSignature(_textBuffer, "<content name=\"namedContentArea\" />", "Spools all output in the content element into a named text writer", currentApplicableSpan));
            signatures.Add(CreateSignature(_textBuffer, "<content var=\"variable\" />", "Spools all output into a temporary text writer", currentApplicableSpan));
            signatures.Add(CreateSignature(_textBuffer, "<content def=\"variable\" />", "Spools all output into a temporary text writer (same as 'var')", currentApplicableSpan));
            signatures.Add(CreateSignature(_textBuffer, "<default x=\"xValue\" y=\"yValue\" />", "Declares local variables if a symbol of a given name is not known to be in scope", currentApplicableSpan));
        }
开发者ID:aloker,项目名称:spark,代码行数:11,代码来源:SparkSignatureHelpSource.cs


示例15: AugmentSignatureHelpSessionAsync

        internal static Task AugmentSignatureHelpSessionAsync(this SignatureHelpSource signatureHelpSource, ISignatureHelpSession session, IList<ISignature> signatures, AstRoot ast) {
            var tcs = new TaskCompletionSource<object>();

            var ready = signatureHelpSource.AugmentSignatureHelpSession(session, signatures, ast, (o, p) => {
                signatureHelpSource.AugmentSignatureHelpSession(session, signatures, ast, null);
                tcs.TrySetResult(null);
            });

            if (ready) {
                tcs.TrySetResult(null);
            }

            return tcs.Task;
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:14,代码来源:SignatureHelpSourceUtility.cs


示例16: SignatureHelp

        public SignatureHelp(ISignatureHelpSession session, ITextBuffer subjectBuffer, string functionName,
                             string documentation, ISignatureInfo signatureInfo) {
            FunctionName = functionName;
            _signatureInfo = signatureInfo;

            Documentation = documentation;
            Parameters = null;

            Session = session;
            Session.Dismissed += OnSessionDismissed;

            TextView = session.TextView;
            TextView.Caret.PositionChanged += OnCaretPositionChanged;

            SubjectBuffer = subjectBuffer;
            SubjectBuffer.Changed += OnSubjectBufferChanged;
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:17,代码来源:SignatureHelp.cs


示例17: AugmentSignatureHelpSession

        public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures) {
            if (!REditorSettings.SignatureHelpEnabled || session.IsDismissed) {
                return;
            }

            var document = REditorDocument.TryFromTextBuffer(_textBuffer);
            if (document != null) {
                if (!document.EditorTree.IsReady) {
                    document.EditorTree.InvokeWhenReady((p) => {
                        var broker = _shell.ExportProvider.GetExportedValue<ISignatureHelpBroker>();
                        broker.DismissAllSessions((ITextView)p);
                        broker.TriggerSignatureHelp((ITextView)p);
                    }, session.TextView, this.GetType(), processNow: true);
                }
                AugmentSignatureHelpSession(session, signatures, document.EditorTree.AstRoot, TriggerSignatureHelp);
            }
        }
开发者ID:Microsoft,项目名称:RTVS,代码行数:17,代码来源:SignatureHelpSource.cs


示例18: GetBestMatch

        public ISignature GetBestMatch(ISignatureHelpSession session)
        {
            int number = 0;

            if (session.Properties.ContainsProperty("dec"))
            {
                Declaration dec = session.Properties["dec"] as Declaration;
                string methodName = ValueOrderFactory.GetMethod(dec).Method.Name;
                if (dec.Values.Count > 0 && (methodName == "Margins" || methodName == "Corners"))
                {
                    number = 4 - dec.Values.Count;
                }
            }

            return (session.Signatures != null && session.Signatures.Count > number && number > -1)
                ? session.Signatures[number]
                : null;
        }
开发者ID:joeriks,项目名称:WebEssentials2013,代码行数:18,代码来源:ValueOrderSignatureHelpSource.cs


示例19: AugmentSignatureHelpSession

        public void AugmentSignatureHelpSession(ISignatureHelpSession session, System.Collections.Generic.IList<ISignature> signatures) {
            var span = session.GetApplicableSpan(_textBuffer);

            var sigs = _textBuffer.CurrentSnapshot.GetSignatures(_provider._serviceProvider, span);

            ISignature curSig = sigs.Signatures
                .OrderBy(s => s.Parameters.Count)
                .FirstOrDefault(s => sigs.ParameterIndex < s.Parameters.Count);
            
            foreach (var sig in sigs.Signatures) {
                signatures.Add(sig);
            }

            if (curSig != null) {
                // save the current sig so we don't need to recalculate it (we can't set it until
                // the signatures are added by our caller).
                session.Properties.AddProperty(typeof(PythonSignature), curSig);
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:19,代码来源:SignatureHelpSource.cs


示例20: GetBestMatch

        public ISignature GetBestMatch(ISignatureHelpSession session)
        {
            SignatureHelpManager signatureHelpManager;
            if (!session.Properties.TryGetProperty(typeof(SignatureHelpManager), out signatureHelpManager))
                return null;

            Dictionary<SignatureItem, ISignature> signaturesMap;
            if (!session.Properties.TryGetProperty(typeof(Dictionary<SignatureItem, ISignature>), out signaturesMap))
                return null;

            var model = signatureHelpManager.Model;
            if (model == null)
                return null;

            if (model.Signature == null)
                return null;

            return signaturesMap[model.Signature];
        }
开发者ID:pminiszewski,项目名称:HlslTools,代码行数:19,代码来源:SignatureHelpSource.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ISigner类代码示例发布时间:2022-05-24
下一篇:
C# ISignals类代码示例发布时间: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