You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
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.
Multiple updates and cleanup: removed reference to "column", fixed the formulas to account for empty lines after #line directive, clarified rules and character offset, added more Razor examples.
Activity
[-][Proposal]: Column mapping #line directives[/-][+][Proposal]: WIP - Column mapping #line directives[/+][-][Proposal]: WIP - Column mapping #line directives[/-][+][Proposal]: Column mapping #line directives[/+]tmat commentedon May 13, 2021
@NTaylorMullen @jinujoseph FYI
KalleOlaviNiemitalo commentedon May 17, 2021
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.
tmat commentedon May 17, 2021
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.
CyrusNajmabadi commentedon May 17, 2021
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.
tmat commentedon May 17, 2021
Sure, let's define column = number of characters from the start of the line.
CyrusNajmabadi commentedon May 17, 2021
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.
tmat commentedon May 17, 2021
The PDB specification uses column, so we need to map it to that. The compiler already does that mapping.
CyrusNajmabadi commentedon May 17, 2021
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.
tmat commentedon May 17, 2021
As I said the column has no meaning to the language. We can call it foo. Character works too :)
CyrusNajmabadi commentedon May 17, 2021
Alright. I recommend 'Character' or 'Start' then :)
tmat commentedon May 17, 2021
Character then. End start and start start doesn't work well.
ufcpp commentedon May 18, 2021
What is 'character'?
In VS for Win, Ch = the number of UTF-16 code units, Col = N times wider than a monospace ASCII character?

In VS Code, Col = the number of UTF-32 codepoints?

[-][Proposal]: Column mapping #line directives[/-][+][Proposal]: Enhanced #line directives[/+]tmat commentedon Jun 1, 2021
Multiple updates and cleanup: removed reference to "column", fixed the formulas to account for empty lines after
#linedirective, clarified rules and character offset, added more Razor examples.