Ejemplo n.º 1
0
        public static TextStylePolicy GetTextStylePolicy(this OptionKey optionKey)
        {
            var mimeChain = DesktopService.GetMimeTypeInheritanceChainForRoslynLanguage(optionKey.Language);

            if (mimeChain == null)
            {
                throw new Exception($"Unknown Roslyn language {optionKey.Language}");
            }
            return(PolicyService.GetDefaultPolicy <TextStylePolicy> (mimeChain));
        }
Ejemplo n.º 2
0
        TextStylePolicy GetTextPolicyForLanguage(string language)
        {
            var mimeChain = DesktopService.GetMimeTypeInheritanceChainForRoslynLanguage(language);

            if (mimeChain == null)
            {
                throw new Exception($"Unknown Roslyn language {language}");
            }
            return(PolicyService.GetDefaultPolicy <TextStylePolicy> (mimeChain));
        }
        public async Task <IDocumentOptions> GetOptionsForDocumentAsync(Document document, CancellationToken cancellationToken)
        {
            var mimeChain = DesktopService.GetMimeTypeInheritanceChainForRoslynLanguage(document.Project.Language);

            if (mimeChain == null)
            {
                return(null);
            }

            var project = TypeSystemService.GetMonoProject(document.Project);
            var policy  = project.Policies.Get <TextStylePolicy> (mimeChain);

            return(new TextDocumentOptions(policy));
        }