-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal]: Enhanced #line directives #4747
Comments
Is there a specification of how tab characters, fullwidth characters, and combining characters affect the column numbers? ECMA-334 5th ed. does not mention "column" at all. |
The column information is used to generate sequence points as specified here and column for compiler diagnostics (implementation detail). They have no meaning to the language. |
I would recomment avoiding the term 'column' and use the term 'character' instead. This matches all our other terminology, and means it doesn't sound related to the 'view'. As an example 'column' is ambiguous when it comes to characters like 'tab'. But 'character' is not. |
Sure, let's define column = number of characters from the start of the line. |
I guess i'm saying: just dont' call it 'column' then. We already use 'character' for that purpose. line/character is a very common idiom used elsewhere just for this purpose and to avoid the confusion here. The recommendation is to not use 'column' unless your feature is literally view oriented, and you are tryign to say: it should show up in this column and should be affected by things like tab-width. |
The PDB specification uses column, so we need to map it to that. The compiler already does that mapping. |
Sure. But this is at the C# language level. I'd prefer it not use that. We could use 'character' or 'start'. Both of which are widespread and clearly avoid this. The mapping to the pdb spec can happen under the covers, with a clear message that the PDB spec here doesn't mean 'column' in any sort of tab-centric manner. There's no reason to leak this concept from taht lower layer directly to the c# spec level with that same name. If it helps though, we can have normative text that just clarifies that these are effectively teh same. |
As I said the column has no meaning to the language. We can call it foo. Character works too :) |
Alright. I recommend 'Character' or 'Start' then :) |
Character then. End start and start start doesn't work well. |
Multiple updates and cleanup: removed reference to "column", fixed the formulas to account for empty lines after |
Enhanced #line directives
Summary
The compiler applies the mapping defined by
#line
directives to diagnostic locations and sequence points emitted to the PDB.Currently only the line number and file path can be mapped while the starting character is inferred from the source code. The proposal is to allow specifying full span mapping.
#line (startLine, startChar) - (endLine, endChar) charOffset "fileName"
Spec: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-10.0/enhanced-line-directives.md
Drawbacks
Alternatives
Unresolved questions
Design meetings
The text was updated successfully, but these errors were encountered: