Skip to content

Determining if a token is the first on a line #314

@sharwell

Description

@sharwell

During my ongoing work on DotNetAnalyzers/StyleCopAnalyzers#261, I noticed a potential problem with CommonFormattingHelpers.IsFirstTokenOnLine.

Consider the following code:

int x = Foo(a
, b);

In this case, IsFirstTokenOnLine returns true for the , token. However, if the input is modified to the following:

int x = Foo(a // a comment
, b);

The code returns false for the , token. This occurs because non-whitespace characters appear between the , token and the preceding token a.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEBugVerifiedhelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions