public void UpdateParseInformationForFolding(ParseInformation parseInfo) { if (!CodeEditorOptions.Instance.EnableFolding || disableParseInformationFolding) { parseInfo = null; } IServiceContainer container = this.Adapter.GetService(typeof(IServiceContainer)) as IServiceContainer; ParserFoldingStrategy folding = container.GetService(typeof(ParserFoldingStrategy)) as ParserFoldingStrategy; if (parseInfo == null) { if (folding != null) { folding.Dispose(); container.RemoveService(typeof(ParserFoldingStrategy)); } } else { if (folding == null) { TextArea textArea = this.Adapter.GetService(typeof(TextArea)) as TextArea; folding = new ParserFoldingStrategy(textArea); container.AddService(typeof(ParserFoldingStrategy), folding); } folding.UpdateFoldings(parseInfo); } }
public void UpdateParseInformationForFolding(ParseInformation parseInfo) { if (!CodeEditorOptions.Instance.EnableFolding) { parseInfo = null; } else { if (parseInfo == null || !parseInfo.IsFullParseInformation) { parseInfo = SD.ParserService.Parse(this.FileName, this.Document); } if (parseInfo != null && !parseInfo.SupportsFolding) { parseInfo = null; } } IServiceContainer container = this.Adapter.GetService(typeof(IServiceContainer)) as IServiceContainer; ParserFoldingStrategy folding = container.GetService(typeof(ParserFoldingStrategy)) as ParserFoldingStrategy; if (parseInfo == null) { if (folding != null) { folding.Dispose(); container.RemoveService(typeof(ParserFoldingStrategy)); } } else { if (folding == null) { TextArea textArea = this.Adapter.GetService(typeof(TextArea)) as TextArea; folding = new ParserFoldingStrategy(textArea); container.AddService(typeof(ParserFoldingStrategy), folding); } folding.UpdateFoldings(parseInfo); } }