Support for c# 6.0 language features

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 4 years ago by René Weibel
Version: 15.1.0623
Avatar

Hi

Does the SyntaxEditor .NET Languages Add-on support the new c# 6.0 language features?

Thank you,

René

Comments (13)

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Not yet, but we have it on the TODO list to work on once we get past some other projects that are currently work in progress.


Actipro Software Support

Posted 3 years ago by Frederik St-Onge
Avatar

Any news on that? I've seen c# 6.0 being used in LinqPad...

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

We did start to look into it back in February but found that ever since Roslyn team took over, they stopped making specification updates.  So there are no official specs on C# 6.0 available for us to build our language around.  We posted a request for this a while back here:

https://github.com/dotnet/roslyn/issues/3169

Please comment on that issue and say that it's really important to get official specs so that third party companies like ours can build more tooling around the enhancements in new language versions.  It seems like nothing is happening on their end.


Actipro Software Support

Posted 3 years ago by Chris Shaw
Avatar

It's four months after the last comment, and Microsoft is already previewing C# 7.  Is last year's language supported yet?  Will next year's be supported soon?

 

Thanks,

--Chris

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Chris,

The main problem is that per above, Microsoft stopped producing official specifications for C# and VB grammars like they had done previously.  And as a third party implementer of the language, that makes it extremely difficult to update our own parser to fit whatever they did.

We had been pestering them in the Github thread above to work on this.  Several months back when we had wanted to work on this, they didn't have anything spec-wise, so we had started on another major new product project in the meantime.  After that, Lucian did add some specs for C# 6.0 that we can hopefully use.  Yet it seems there still is no VB 14 spec to match.  I would suggest posting in that Github thread requesting support for keeping the C# and VB specs up-to-date since grammars are essential for companies like ours to keep up with their changes.  The more people who post and request this, the more likely they will do it.

Adding support for the new changes is higher up on our priority list to revisit once we get past the major project we're on right now.


Actipro Software Support

Posted 2 years ago by Chris Shaw
Avatar

You probably know this already, but the latest post is that the grammars are available:

https://github.com/dotnet/roslyn/issues/3169

I assume that this wasn't in time for v2017.1, but might it get into 2017.2?

 

Thanks,

--Chris

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Chris,

Thanks, yes we did see they got posted but haven't looked into them just yet.  The 2017.1 version had many massive updates that took longer than expected to wrap up.  Right now we are doing some minor tweaks based on feedback from that release along with small things we put off until after the 2017.1 release.

After we wrap those up, we are hoping to get into the .NET Language Add-on updates along with some other things.  So we should be digging into it soon.


Actipro Software Support

Answer - Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello all,

I wanted to let you know that we just finished updating the WPF SyntaxEditors to support C# 6 and VB 14 syntax. These updates will be in the next v2017.1 maintenance release, due in the next several weeks.


Actipro Software Support

Posted 2 years ago by Chris Shaw
Avatar

Hi,

I just built with v17.1.0651, and the Syntax Editor is just what I'd hoped.  Now I get to fight with Roslyn...!

 

Thanks,

--Chris

Posted 2 years ago by Christel
Avatar

Hi,

could it be, that not all C# 6.0 features are supported with 2017.1.0652?

It works for this:

if (....)
{
throw new Exception($"Error text formatted");
}

Null propagating operator => ok

List<string> linesOfCodes = new List<string>{"line1","line2"};
var value = linesOfCodes?.Count?? 0;

But not for Digit separators

//int number = 1_000_000;

Not for Binary Literals
//var bits = 0b11110000; // 0xF0

not for Exception Filter:

try
{
...
}
catch(SqlException e)
if(e.Number == 4711)
{
...
}

etc.

Do you have a feature list for C# 6.0 support in .NET Addon Languages?

Thanks

Christel

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Christel,

Microsoft has been absolutely awful about formally documenting changes to C#/VB ever since they went open source.  The latest language grammar specification in their GitHub repo is only a draft of C# 6, and they are already working on C# 8.  That being said, I believe we have everything covered for C# 6 based on what various articles we could piece together and by looking at the grammar.

For the numeric literal issues you mentioned, those are actually part of C# 7.  

For the exception filter issue you mentioned, those are done with the "when" keyword and not "if".  We do support the "when" syntax already since that is part of C# 6.

I hope that helps.


Actipro Software Support

Posted 2 years ago by Chris Shaw
Avatar

Hi,

I actually have a couple of quibbles with the implementation of the $"" notation for strings (in 17.1.652).

I type this into my application:

System.Windows.Forms.MessageBox.Show($"Clock: { this.Clock }");

In my SyntaxEditor code window, everything between the two parentheses is colored the red of a string literal, where in Visual Studio, the braces and '.Clock' are black and 'this' is blue.  Also (and more importantly), I do not get Intellisense prompts when I type 'this.' within the braces -- I would expect that.  The SyntaxEditor appears to treat everything within double-quotes as a string literal, rather than parsing the string to find code arguments.

 

Or maybe I'm missing something?

 

Thanks,

--Chris

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Chris,

We are aware of that as a limitation of the lexer.  The reason it's like that is that if we changed the lexer to split that interpolated string literal up into multiple tokens (which is a bit tricky itself), the changes would affect context building and the resolver in a number of areas.  It is something we'd like to dig into in the future, but it won't make the cut for the first 2017.2 release.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.