Skip to content
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

C# syntax highlighting is broken by multiline types #179

Open
alexr00 opened this issue Apr 28, 2020 · 4 comments
Open

C# syntax highlighting is broken by multiline types #179

alexr00 opened this issue Apr 28, 2020 · 4 comments

Comments

@alexr00
Copy link

alexr00 commented Apr 28, 2020

Originally from @svenskmand in microsoft/vscode#96341

  • VSCode Version:
    Version: 1.44.2 (system setup)
    Commit: ff915844119ce9485abfe8aa9076ec76b5300ddd
    Date: 2020-04-16T16:36:23.138Z
    Electron: 7.1.11
    Chrome: 78.0.3904.130
    Node.js: 12.8.1
    V8: 7.8.279.23-electron.0
    OS: Windows_NT x64 10.0.18363
  • OS Version: Windows 10

Steps to Reproduce:

  1. Open a new C# file and input the following code
namespace Foo {
	public interface IBar<T> {
		IList<T> Baz(IList<IList<IList<IList<IList<IList<
		IList<IList<T>>>>>>>> foobar);		
	}	
}
  1. The type of the foobar variable and the rest of the method has a white text color and no syntax highlighting.

This is how the syntax highlighting looks before the line break:
Without line break

This is how the syntax highlighting looks with the line break:
With line break

Does this issue occur when all extensions are disabled?: Yes

@svenskmand
Copy link

Any update on this? :)

@npapapietro
Copy link

Not sure if this is related but other valid code is broken in multiline statements as well for example

namespace Foo
{
    public class Bar
    {
        public string Name {get; set;}

        public string Test(Bar[] myArray)
        {
            string result = myArray
                                .Where(a => a.Name.Length > 2)
                                .FirstOrDefault()?
                                .Name ?? "Name";

            return result;
        }
    }
}

I'm noticing that even the embedded text here is broken.

I'm using dotnetcore3.1 and C# 8

@wise0704
Copy link
Contributor

wise0704 commented Sep 4, 2023

Not sure if this is related but other valid code is broken in multiline statements as well for example

namespace Foo
{
    public class Bar
    {
        public string Name {get; set;}

        public string Test(Bar[] myArray)
        {
            string result = myArray
                                .Where(a => a.Name.Length > 2)
                                .FirstOrDefault()?
                                .Name ?? "Name";

            return result;
        }
    }
}

I'm noticing that even the embedded text here is broken.

I'm using dotnetcore3.1 and C# 8

That is because ? is treated as a conditional operator since it cannot look into next line to see the presence of a . and then backtrack.
Related issue was #183 and has been fixed.

@wise0704
Copy link
Contributor

wise0704 commented Sep 4, 2023

This issue is also the same problem as #63 and other linked issues under it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants