Esempio n. 1
0
        public void OnBlockCreated(ITextBuffer editorBuffer, LanguageProjectionBuffer projectionBuffer)
        {
            WindowHelpers.WaitFor(delegate
            {
                // Make sure we don't set up ContainedLanguages until the buffer is ready
                // When loading lots of Markdown files on solution load, we might need to
                // wait for multiple idle cycles.
                var doc = ServiceManager.GetService <HtmlEditorDocument>(editorBuffer);
                if (doc == null)
                {
                    return(false);
                }
                if (doc.PrimaryView == null)
                {
                    return(false);
                }

                Guid guid = FindGuid();
                if (guid != Guid.Empty)
                {
                    ContainedLanguageAdapter.ForBuffer(editorBuffer).AddIntellisenseProjectLanguage(projectionBuffer, guid);
                }
                return(true);
            });
        }
        public void OnBlockCreated(ITextBuffer editorBuffer, LanguageProjectionBuffer projectionBuffer)
        {
            EventHandler <EventArgs> h = null;

            h = delegate
            {
                // Make sure we don't set up ContainedLanguages until the buffer is ready
                // When loading lots of Markdown files on solution load, we might need to
                // wait for multiple idle cycles.
                var doc = ServiceManager.GetService <HtmlEditorDocument>(editorBuffer);
                if (doc == null)
                {
                    return;
                }
                if (doc.PrimaryView == null)
                {
                    return;
                }

                WebEditor.OnIdle -= h;
                Guid guid = FindGuid();
                if (guid != Guid.Empty)
                {
                    ContainedLanguageAdapter.ForBuffer(editorBuffer).AddIntellisenseProjectLanguage(projectionBuffer, guid);
                }
            };
            WebEditor.OnIdle += h;
        }