atom / language-csharp Goto Github PK
View Code? Open in Web Editor NEWC# language support for Atom
License: Other
C# language support for Atom
License: Other
As you can see public byte AltFormCount
is highlighted correctly, wheres public byte FormPointer
is not. This appears to be related to the comment, since it will be highlighted correctly when the comment is removed.
It is also noteworthy that this problem only occurs inside class definitions, but not inside methods.
Hey, I'm coming here from GitHub Linguist repository after noticing an issue with highlighting in one of my files on GitHub.
Halfway through the file, the highlighting gets a bit messed up, where some keywords and names are no longer highlighted properly. Example (everything after the highlighted line is incorrect):
and here is the file in question on my repository. Note that the file is syntactically valid and can be compiled without errors.
Also I noticed in another file (probably unrelated problem, let me know if I should make a separate issue for it) that extension methods are not highlighted correctly either, for example here, both 'this' and the name of the object should have a special color to be consistent with parameter highlighting elsewhere:
If the function returns a generic then the css type is "span.meta.method.return-type.cs" (even for the type in the angle brackets). I believe that the item in the angle brackets (or the angle brackets should be a different type to help with reading.
For the parameter with footprint "SearchRequest searchRequest" the "SearchRequest" is of type "span.variable.parameter.function.cs" but the items in the angle brackets are the same colour as the parameter name and share all the same css.
Parameter attributes aren't recognized, leading to broken highlighting:
You can also see this on github.com, which uses this package for highlighting C#: https://github.com/agardiner/hfmcmd/blob/1d68ee8bbf1058aa8341e2ef6e6576c71901ba7b/src/hfm/Calculate.cs#L67. It was reported by one of our users.
I noticed this maybe within the past week or so (possibly earlier) on GitHub. Class modifiers don't highlight anymore:
public abstract class C { }
public sealed class C { }
There's a weird glitch in highlighting strings. If you have a string within a class and that string has a {
anywhere in it and there's anything before the string other than =
, ignoring @
, then the highlighting doesn't pick up the opening "
and starts highlighting at the end of the string instead, making the rest of the code appear to be within a string. Here's a small example of what I mean:
It doesn't affect the program at all, but it gets really hard to read, especially if this happens at the top of the file.
According TextMate naming conventions:
var
should be storage.type.var
Now: keyword.other
#34Related issue is atom/atom#8430
I'm noticing that a lot of files that I'm opening (likely created by Visual Studio) aren't having their first line highlighted properly. Then, I finally noticed that if i place my cursor at the beginning of the file, and hit backspace, it fixes it. This revealed that there was a no-space character at the beginning of the file that was there, which I guessed was a Unicode BOM.
This is probably a core issue, where Atom should detect utf-8 with BOM encoding (related: atom/atom#3427).
Having "int?" just the "int" part is highlighted but not the "?".
I have my tab indentation set to 2 spaces.
Let's say I have this code:
public void foo() {
var myVar = null;
}
If I add a line above it, when I hit semicolon the indentation jumps for both the initial and the new line
# About to hit semicolon
public void foo() {
this.doStuff() # <- caret is after the bracket here
var myVar= null;
}
# Just hit semicolon
public void foo() {
this.doStuff(); # Just typed this semicolon
var myVar = null;
}
As well as the indentation messing up, the caret jumps to an awful position several chars before var myvar
.
'Property':
'prefix': 'prop'
'body': '${1:string} ${2:PropertyName} { get; set; }'
Property is public so body should be like :
'body': 'public ${1:string} ${2:PropertyName} { get; set; }'
Currently, preprocessor directives are hardcoded to a red color, see stylesheets.less. It would be super ๐ if it would pick up my theme colors ๐
#if DEBUG
#endif
These are detected as:
DEBUG - span.entity.name.function.preprocessor.source.cs
From @vbfox on December 1, 2015 9:12
Namespaces contained in namespace declarations don't get any syntax coloration.
Copied from original issue: microsoft/vscode#849
I request the feature of ///
should generate a template for XML documentation with the <summary>
element.
/// <summary>
///
/// <summary>
public void Foo() {
}
Recommended Tags for Documentation Comments (C# Programming Guide)
Screenshot from GitHub code page: https://dl.dropboxusercontent.com/u/14076298/ShareX/2014/12/uJz1WU2GMD.png
In here syntax highlighting showing some codes as string (orange color) incorrectly.
"/" causing this problem I think.
Any ideas?
Not all these are hilited as numbers
class Syntax
{
public decimal decimal1 = 1.0m;
// ^^^ constant.numeric.source.cs
// ^ storage.type.numeric.cs
public decimal decimal2 = 2.0M;
// ^^^ constant.numeric.source.cs
// ^ storage.type.numeric.cs
public double double1 = 1.0d;
// ^^^ constant.numeric.source.cs
// ^ storage.type.numeric.cs
public double double2 = 2.0D;
// ^^^ constant.numeric.source.cs
// ^ storage.type.numeric.cs
public float float1 = 1.0f;
// ^^^ constant.numeric.source.cs
// ^ storage.type.numeric.cs
public float float2 = 2.0F;
// ^^^ constant.numeric.source.cs
// ^ storage.type.numeric.cs
public long long1 = 1l;
// ^ constant.numeric.source.cs
// ^ storage.type.numeric.cs
public long long2 = 2L;
// ^ constant.numeric.source.cs
// ^ storage.type.numeric.cs
public ulong ulong1 = 1ul;
// ^ constant.numeric.source.cs
// ^^ storage.type.numeric.cs
public ulong ulong2 = 2UL;
// ^ constant.numeric.source.cs
// ^^ storage.type.numeric.cs
public ulong ulong3 = 3lu;
// ^ constant.numeric.source.cs
// ^^ storage.type.numeric.cs
public ulong ulong4 = 4LU;
// ^ constant.numeric.source.cs
// ^^ storage.type.numeric.cs
public ulong ulong5 = 5uL;
// ^ constant.numeric.source.cs
// ^^ storage.type.numeric.cs
public ulong ulong6 = 6Ul;
// ^ constant.numeric.source.cs
// ^^ storage.type.numeric.cs
public ulong ulong7 = 7lU;
// ^ constant.numeric.source.cs
// ^^ storage.type.numeric.cs
public ulong ulong8 = 8Lu;
// ^ constant.numeric.source.cs
// ^^ storage.type.numeric.cs
public ulong bad = 1UU;
// ^^ - storage.type.numeric.cs
}
From @jumpinjackie on December 2, 2015 6:40
Using VSCode 0.10.3
The C# syntax coloring breaks down when interpolated strings are involved.
Example code
namespace Test
{
public class Foo
{
static string AddTableName(string suffix) => $"Bar{suffix}_ADD";
static string ModTableName(string suffix) => $"Bar{suffix}_MOD";
static string DelTableName(string suffix) => $"Bar{suffix}_DEL";
}
}
VSCode screenshot
Copied from original issue: microsoft/vscode#900
I'm not actually using Aton, but rather found this issue through the Github syntax highlighter, which directed me here. As such some of the below doesn't quiet apply to my case and I've only done the points that seemed reasonable to me and removed the other ones from the list
Comments are not highlighted correctly when they start behind the first line of a class definition that implements an interface.
public class Test : ITest // Incorrectly highlighted
{}
public class Test2 // Correctly highlighted
{}
2 Check syntax highlighting
Expected behavior:
The comment on the first line should be highlighted in grey.
Reproduces how often:
Always
Not using Atom at all (see Prequisities). Happens on Github issues.
From @glennc on November 25, 2015 23:9
With the following code:
var a = 0; // {
the // {
isn't green like the other comments.
Copied from original issue: microsoft/vscode#675
Hi,
this is the first time i opened C# files in atom and the syntax highlighting made it impossible for me to read 90% of the code is orange/ brownish.
checked different themes i'm on Seti / Base 16 Tomorrow dark. but it always is the same thing one color dominating the code.
is there something i should do ? is there anyway to contribute to this ?
Hi,
There have been some substantial improvements to the C# grammar in the VSCode repo (here) and ongoing effort to build out the test coverage (here)
As such I wanted to raise your attention to this issue here: dotnet/vscode-csharp#877 :
Appears to me that there is some ongoing duplicated effort with the C# textmate grammar in VSCode (gitlog) and Atom (gitlog).
Seems like the only real difference between the two is JSON vs CSON, so why not extract the VSCode textmate C# grammar and test harness setup into a separate repo in OmniSharp, port any fixes from Atom and then share the same grammar across the two extensions (outping CSON, etc)?
Notice how method names with Generic parameters aren't parsed as entity.name.function.cs
. You can tell because Register<TEvent>
has no style applied.
Also, Generic parameters aren't recognized in method return-types.
sample code:
// Broken
public IDisposable Register<TEvent, THandler>()
where TEvent : IEvent
where THandler : IEventHandler<TEvent>, new()
{
}
// OK
public IDisposable Register(Type eventType, IEventHandler handler)
{
}
// Broken
public IDisposable Register<TEvent>(IEventHandlerFactory handlerFactory) where TEvent : IEvent
{
}
// Returntype broken
public IDisposable<TEvent, TBar> Register(Type eventType, IEventHandlerFactory handlerFactory)
{
}
class Foo
{
int bar;//{baz
}
The {
in the comment above causes the comment not to get parsed or highlighted as a comment.
You can see this on github.com, which uses this package for highlighting C#: https://github.com/nilproject/NiL.JS/blob/7dce6bc52733f8f1d9d56ec4b329dcc7e5b4cae8/NiL.JS/Script.cs#L14. This bug was discovered by one of our users.
Hi, I maintain an Atom Theme and there's a couple things I'd like to add styling for in C#, however the parsing doesn't seem to be adding the appropriate classes. The cases I've noticed so far are:
if
statements and method definitions are not classed, though method call parens are (they get .punctuation.definition
). Javascript classes them as .meta.brace.round
, maybe C# could do something similar?.operator
class.Please have a look on Microsoft.AspNet.Server.Kestrel.
not sure if any other languages uses csx extension. might want to check that first too.
From @isidorn on December 14, 2015 14:41
Just having one color for the using statements looks bad imho
We should use one color for the using
keyword and another for the rest.
Copied from original issue: microsoft/vscode#1284
Noticed this while updating the README of one of my own repos. This code does not highlight correctly:
public class MyCollection<T> : IEnumerable<T>
{
private T[] array;
public StructEnumerator<T> GetEnumerator() =>
Enumerator.Struct(array);
IEnumerator<T> IEnumerable<T>.GetEnumerator() =>
Enumerator.Class(array); // avoid boxing of value types
IEnumerator IEnumerable.GetEnumerator() =>
this.GetEnumerator();
}
Not quite sure how to fix this, but I thought I'd just check in and let you guys know.
This code does not syntax highlight correctly:
using static System.Console;
The static
keyword should be recognized outside of its place as a storage modifier.
From @jonnyguo1988 on December 8, 2015 7:7
hi
please see the attachment, I'm writing unsafe code in c#, but the color for the parameters of pointers is wired, I think this should be a bug.
Thank you
Copied from original issue: microsoft/vscode#1093
From @cdes on December 29, 2015 8:12
I'm using the VSCode Version 0.10.6 (0.10.6).
Default dark theme.
Here's a sample code:
class MyClass
{
}
class Program
{
static void Main()
{
//string is highlighted
string s = "MyClass";
//MyClass is not highlighted
MyClass myClass = new MyClass();
}
}
Here's a video demonstration:
https://www.youtube.com/watch?v=VpRPJc42FZQ
Copied from original issue: microsoft/vscode#1686
This line in the CoreCLR repo seems to not be highlighting properly:
https://github.com/dotnet/coreclr/blob/7b97c58/src/mscorlib/src/System/RtType.cs#L63
Not exactly sure what's causing it, but maybe it has something to do with the angle/square brackets in the comment on the previous line.
Hi, not sure if this is an issue for you or not, if it's in some other package feel free to send me on.
I've noticed a problem with the using
statement on the first line of a file. There seems to be some sort of non-printing character there; hitting backspace removes it and fixes this issue. my guess would be a byte-order mark? So far this seems to happen in any C# file created in Visual Studio.
From @vbfox on December 1, 2015 9:8
In the following code :
using System.Linq;
namespace MyNamespaceIsFoo
{
using System;
public class SearchKey
{
}
}
using System
get colored correctly but using System.Linq
isn't.
Copied from original issue: microsoft/vscode#848
I am not able to use the c# plugin in my editor even though i have this package in my editor.
I used the Atom Dark Fusion Theme and the coloring on the first line "Using ..." will get wrong. All extra using has normal syntax color, it's just the first line.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.