Example #1
0
        internal static IRazorCodeGenerator Create(Microsoft.VisualStudio.Text.ITextBuffer buffer, Version razorVersion, string physicalPath, string virtualPath)
        {
            RazorCodeGenerator razorCodeGenerator = ServiceManager.GetService <RazorCodeGenerator>(buffer);

            if (razorCodeGenerator == null)
            {
                razorCodeGenerator = new RazorCodeGenerator(buffer, razorVersion, physicalPath, virtualPath);
            }
            return(razorCodeGenerator);
        }
Example #2
0
        private void OnDocumentClosing(object sender, EventArgs e)
        {
            RazorCodeGenerator service = ServiceManager.GetService <RazorCodeGenerator>(_diskBuffer);

            if (service != null)
            {
                service.SpansChanged -= OnSpansChanged;
            }
            _document.OnDocumentClosing -= OnDocumentClosing;
            ServiceManager.RemoveService <RazorSpanClassifier>(_diskBuffer);
        }
Example #3
0
 private void EnsureInitialized()
 {
     if (!_advisedToSpansChanged)
     {
         RazorCodeGenerator service = ServiceManager.GetService <RazorCodeGenerator>(_diskBuffer);
         if (service != null)
         {
             service.SpansChanged  += OnSpansChanged;
             _advisedToSpansChanged = true;
         }
     }
 }
 IRazorCodeGenerator IRazorCodeGeneratorProvider.CreateRazorCodeGenerator(ITextBuffer buffer, Version razorVersion, string physicalPath, string virtualPath)
 {
     return(RazorCodeGenerator.Create(buffer, razorVersion, physicalPath, virtualPath));
 }