예제 #1
0
        public void Configure(RazorCodeGenerationOptionsBuilder options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            options.SuppressMetadataAttributes = true;
        }
예제 #2
0
        public void Configure(RazorCodeGenerationOptionsBuilder options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            options.SuppressChecksum = true;
        }
예제 #3
0
            public void Configure(RazorCodeGenerationOptionsBuilder options)
            {
                if (options == null)
                {
                    throw new ArgumentNullException(nameof(options));
                }

                // These metadata attributes require a reference to the Razor.Runtime package which we don't
                // otherwise need.
                options.SuppressMetadataAttributes = true;
            }
예제 #4
0
        public void Configure(RazorCodeGenerationOptionsBuilder options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (options.Configuration != null && options.Configuration.LanguageVersion.Major < 3)
            {
                // Prior to 3.0 there were no C# version specific controlled features. Suppress nullability enforcement.
                options.SuppressNullabilityEnforcement = true;
            }
            else if (CSharpLanguageVersion < LanguageVersion.CSharp8)
            {
                // Having nullable flags < C# 8.0 would cause compile errors.
                options.SuppressNullabilityEnforcement = true;
            }
            else
            {
                // Given that nullability enforcement can be a compile error we only turn it on for C# >= 8.0. There are
                // cases in tooling when the project isn't fully configured yet at which point the CSharpLanguageVersion
                // may be Default (value 0). In those cases that C# version is equivalently "unspecified" and is up to the consumer
                // to act in a safe manner to not cause unneeded errors for older compilers. Therefore if the version isn't
                // >= 8.0 (Latest has a higher value) then nullability enforcement is suppressed.
                //
                // Once the project finishes configuration the C# language version will be updated to reflect the effective
                // language version for the project by our workspace change detectors. That mechanism extracts the correlated
                // Roslyn project and acquires the effective C# version at that point.
                options.SuppressNullabilityEnforcement = false;
            }

            if (options.Configuration?.LanguageVersion.Major >= 5)
            {
                // This is a useful optimization but isn't supported by older framework versions
                options.OmitMinimizedComponentAttributeValues = true;
            }

            if (CSharpLanguageVersion >= LanguageVersion.CSharp10)
            {
                options.UseEnhancedLinePragma = true;
            }
        }
예제 #5
0
 public void Configure(RazorCodeGenerationOptionsBuilder options)
 {
     options.IndentSize     = _settings.IndentSize;
     options.IndentWithTabs = _settings.IndentWithTabs;
 }
 public void Configure(RazorCodeGenerationOptionsBuilder options)
 {
     options.SuppressChecksum = true;
 }
 public void Configure(RazorCodeGenerationOptionsBuilder options)
 {
     options.SetDesignTime(_designTime);
 }
예제 #8
0
 private void ConfigureDesignTimeCodeGenerationOptions(RazorCodeGenerationOptionsBuilder builder)
 {
     builder.SetDesignTime(true);
     builder.SuppressChecksum           = true;
     builder.SuppressMetadataAttributes = true;
 }
예제 #9
0
 private void ConfigureCodeGenerationOptions(RazorCodeGenerationOptionsBuilder builder)
 {
 }
예제 #10
0
 public void Configure(RazorCodeGenerationOptionsBuilder options)
 {
     options.SupportLocalizedComponentNames = true;
 }
 public void Configure(RazorCodeGenerationOptionsBuilder options)
 {
     // We don't need to explicitly subscribe to options changing because this method will be run on every parse.
     options.IndentSize     = _optionsMonitor.CurrentValue.TabSize;
     options.IndentWithTabs = !_optionsMonitor.CurrentValue.InsertSpaces;
 }
 public void Configure(RazorCodeGenerationOptionsBuilder options) => _action(options);
예제 #13
0
 public void Configure(RazorCodeGenerationOptionsBuilder options)
 {
     options.RootNamespace = "HelloAssembly";
 }