Ejemplo n.º 1
0
 private void UpdateCache(IIntellisenseCache cache, ISassDocument document)
 {
     try
     {
         var manager = new FileTextManager(document.Source);
         using (var scope = manager.Open())
             cache.Update(document.Stylesheet, scope.Text);
     }
     catch (Exception ex)
     {
         Logger.Log(ex, "Failed to update intellisense cache.");
     }
 }
Ejemplo n.º 2
0
        void ProcessRequests()
        {
            while (!ShutdownToken.IsCancellationRequested)
            {
                try
                {
                    BackgroundParseRequest request;
                    if (Requests.TryTake(out request, -1, ShutdownToken))
                    {
                        try
                        {
                            var source = request.Document.Source;
                            source.Refresh();
                            if (source.Exists)
                            {
                                ISassStylesheet stylesheet  = null;
                                var             textManager = new FileTextManager(source);
                                using (var scope = textManager.Open())
                                {
                                    var parser = ParserFactory.Create();
                                    stylesheet = parser.Parse(new FileParsingRequest(scope.Text, request.Document));
                                }

                                if (stylesheet != null)
                                {
                                    request.Document.Update(stylesheet);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(ex, "Failed to process background document parse request.");
                        }
                    }
                }
                catch (OperationCanceledException)
                {
                    // ignore
                    return;
                }
            }
        }
Ejemplo n.º 3
0
        void ProcessRequests()
        {
            while (!ShutdownToken.IsCancellationRequested)
            {
                try
                {
                    BackgroundParseRequest request;
                    if (Requests.TryTake(out request, -1, ShutdownToken))
                    {
                        try
                        {
                            var source = request.Document.Source;
                            source.Refresh();
                            if (source.Exists)
                            {
                                ISassStylesheet stylesheet = null;
                                var textManager = new FileTextManager(source);
                                using (var scope = textManager.Open())
                                {
                                    var parser = ParserFactory.Create();
                                    stylesheet = parser.Parse(new FileParsingRequest(scope.Text, request.Document));
                                }

                                if (stylesheet != null)
                                    request.Document.Update(stylesheet);
                            }
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(ex, "Failed to process background document parse request.");
                        }
                    }
                }
                catch (OperationCanceledException)
                {
                    // ignore
                    return;
                }
            }
        }
Ejemplo n.º 4
0
 private void UpdateCache(IIntellisenseCache cache, ISassDocument document)
 {
     try
     {
         var manager = new FileTextManager(document.Source);
         using (var scope = manager.Open())
             cache.Update(document.Stylesheet, scope.Text);
     }
     catch (Exception ex)
     {
         Logger.Log(ex, "Failed to update intellisense cache.");
     }
 }