Sublime Forum

Looking for beta tester for C# syntax

#1

A long time ago I made a PR to improve C# syntax in Sublime.

The thing is it’s not just a simple improvement it’s a complete lifting.
Indeed the original C# syntax was just a list of keyword to highlight.

Here I tried doing something more ambitious with proper detection of types and support of generics.
It also supports the latest C# 6 features, and I’m already preping for C# 7

One year and 37 commits later the syntax starts looking pretty good (IMHO better that what VS do) but it hasn’t been battle tested by hords of C# developers using delegates, async and other nasty things. I don’t know if there is a lot of people using Sublime for coding in C# or just browsing code, so I hope someone get my message in a bottle.

If you want to improve the futur of C# in Sublime, go to my repo (branch master), grab the C# folder and symlink it or copy-paste it in your Packages folder, and tell me what you think.

0 Likes

#2

All in all, a massive improvement over the current syntax definition that ships with ST :slight_smile:

Types like string and int get the scope support.type.cs, but String and IEnumerable and Tuple get variable.other.type.cs, despite also being built-in to the .NET Framework. Is this intentional?

0 Likes

#3

Thanks for testing and the feedback,
I’ll add your suggestions soon.

It treat string, int differently than IEnumerable because the first two are listed as keywords and are “alias” for the types System.String and System.Int32. I used the list of built-in types from the C# reference as base_type.

For the scope I used variable.other.type for marking types. I found no written conventions on the subject, so I made it up.

1 Like

#4

Also, one more thing - not sure how possible/easy/desirable it would be to change, but:

I quite often use LINQPad to write C# scripts, whereby it is not necessary to have methods be part of a class. Currently, the following code isn’t scoped correctly:

void Main()
{
    
}

public IEnumerable<string[]> Method1()
{
    yield break;
}

public IEnumerable<string[]> Method2()
{
    yield break;
}

in that the second public (i.e. Method2) is variable.other.type.cs and the rest of the method declaration is not scoped correctly.


Thanks for all your hard work on this BTW! :slight_smile:

0 Likes

#5

For now I handle methods declaration in a special way, and they can only appear inside class.

I think this is a limitation, and I already started to work on that because C# 7 is likely to allow nested methods appearing in any piece of code.

If that works out I’ll probably also allow methods outside of classes.

2 Likes