async Task UpdateStyleParent(MonoDevelop.Projects.Project styleParent, string mimeType) { RemovePolicyChangeHandler(); if (string.IsNullOrEmpty(mimeType)) { mimeType = "text/plain"; } var mimeTypes = DesktopService.GetMimeTypeInheritanceChain(mimeType); if (styleParent != null) { policyContainer = styleParent.Policies; } else { policyContainer = MonoDevelop.Projects.Policies.PolicyService.DefaultPolicies; } var currentPolicy = policyContainer.Get <TextStylePolicy> (mimeTypes); policyContainer.PolicyChanged += HandlePolicyChanged; ((DefaultSourceEditorOptions)textEditor.Options).UpdateStylePolicy(currentPolicy); var context = await EditorConfigService.GetEditorConfigContext(textEditor.FileName, default(CancellationToken)); if (context == null) { return; } ((DefaultSourceEditorOptions)textEditor.Options).SetContext(context); }
void UpdateStyleParent(MonoDevelop.Projects.Project styleParent, string mimeType) { RemovePolicyChangeHandler(); if (string.IsNullOrEmpty(mimeType)) { mimeType = "text/plain"; } var mimeTypes = DesktopService.GetMimeTypeInheritanceChain(mimeType); if (styleParent != null) { policyContainer = styleParent.Policies; } else { policyContainer = MonoDevelop.Projects.Policies.PolicyService.DefaultPolicies; } var currentPolicy = policyContainer.Get <TextStylePolicy> (mimeTypes); policyContainer.PolicyChanged += HandlePolicyChanged; textEditor.Options = DefaultSourceEditorOptions.Instance.WithTextStyle(currentPolicy); }
void UpdateStyleParent (MonoDevelop.Projects.Project styleParent, string mimeType) { RemovePolicyChangeHandler (); if (string.IsNullOrEmpty (mimeType)) mimeType = "text/plain"; var mimeTypes = DesktopService.GetMimeTypeInheritanceChain (mimeType); if (styleParent != null) policyContainer = styleParent.Policies; else policyContainer = MonoDevelop.Projects.Policies.PolicyService.DefaultPolicies; var currentPolicy = policyContainer.Get<TextStylePolicy> (mimeTypes); policyContainer.PolicyChanged += HandlePolicyChanged; textEditor.Options = DefaultSourceEditorOptions.Instance.WithTextStyle (currentPolicy); }