コード例 #1
0
ファイル: Controller.Session.cs プロジェクト: znatz/roslyn
            private void OnPresenterSessionItemSelected(object sender, CompletionItemEventArgs e)
            {
                AssertIsForeground();
                Contract.ThrowIfFalse(ReferenceEquals(this.PresenterSession, sender));

                SetModelSelectedItem(m => e.CompletionItem);
            }
コード例 #2
0
ファイル: Controller.Session.cs プロジェクト: znatz/roslyn
            private void OnPresenterSessionItemCommitted(object sender, CompletionItemEventArgs e)
            {
                AssertIsForeground();
                Contract.ThrowIfFalse(ReferenceEquals(this.PresenterSession, sender));

                this.Controller.CommitItem(e.CompletionItem);
            }
コード例 #3
0
 private void CompletionSession_ItemCommitted(object sender, CompletionItemEventArgs itemEventArgs)
 {
     if (TryIsChooseMethod(itemEventArgs))
     {
         EditorOperations = _editorOperationsFactory.GetEditorOperations(TextView);
         string parenthesis = "()";
         EditorOperations.InsertText(parenthesis);
     }
 }
コード例 #4
0
        private bool TryIsChooseMethod(CompletionItemEventArgs itemEventArgs)
        {
            if (itemEventArgs.Item.Filters.IsEmpty)
            {
                return(false);
            }

            var allowedMethods = new Dictionary <string, string>()
            {
                { "m", "Methods" }, { "x", "Extension methods" }
            };

            foreach (var item in itemEventArgs.Item.Filters)
            {
                if (allowedMethods.ContainsKey(item.AccessKey) && allowedMethods[item.AccessKey] == item.DisplayText)
                {
                    return(true);
                }
            }

            return(false);
        }