public async void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);
            Debug.Assert(view != null);

            int tries = 0;

            // Ugly ugly hack
            // Keep trying to register our filter until after the JSLS CommandFilter
            // is added so we can catch completion before JSLS swallows all of them.
            // To confirm this, click Debug, New Breakpoint, Break at Function, type
            // Microsoft.VisualStudio.JSLS.TextView.TextView.CreateCommandFilter,
            // then make sure that our last filter is added after that runs.
            JsCommandFilter filter = new JsCommandFilter(view, CompletionBroker, _standardClassifications);
            while (true)
            {
                IOleCommandTarget next;
                textViewAdapter.AddCommandFilter(filter, out next);
                filter.Next = next;

                if (IsJSLSInstalled(next) || ++tries > 10)
                    return;
                await Task.Delay(500);
                textViewAdapter.RemoveCommandFilter(filter);    // Remove the too-early filter and try again.
            }
        }
Example #2
0
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);

            Debug.Assert(view != null);

            JsCommandFilter filter = new JsCommandFilter(view, CompletionBroker);

            IOleCommandTarget next;

            textViewAdapter.AddCommandFilter(filter, out next);
            filter.Next = next;
        }
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);
            Debug.Assert(view != null);

            JsCommandFilter filter = new JsCommandFilter(view, CompletionBroker);

            IOleCommandTarget next;
            textViewAdapter.AddCommandFilter(filter, out next);
            filter.Next = next;
        }