dotnet / dotnet/roslyn

Create a fixer for misplaced preprocessor directives

Open
#85,574 0 comments 0 reactions 0 assignees View on GitHub
Area-Razor enhancement
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

As part of the new tokenizer, we require that preprocessor directives are at the start of the line (modulo whitespace). The razor compiler will emit a couple of diagnostics for scenarios where it sees violations, or potential violations, of this rule, and it would be good to have IDE fixers to help users clean this up. These diagnostics are:

* Error RZ1043: C# preprocessor directives must be at the start of the line, except for whitespace.
* This error is given when we know for certain that a preprocessor directive is misplaced.
* Warning RZ1044: Possible C# preprocessor directive is misplaced. C# preprocessor directives must be at the start of the line, except for whitespace.
* This warning is given when there's a disabled preprocessor section and a possible `#else`, `#elif`, or `#endif` was found in that disabled text.

/cc @ryzngard

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.