tunnelvisionlabs / LangSvcV2

"Language Service V2" reference repository
Other
86 stars 38 forks source link

Failure to indent properly on some cases #57

Open LuizZak opened 9 years ago

LuizZak commented 9 years ago

The automatic indentation works as expected when writing a new rule, adding spaces when adding new lines, but in some cases the indent is not behaving properly, or not working at all.

The following grammar file exhibits odd indenting behavior at a few points:

grammar Test;

options
{
    language=CSharp;
}

testRule1 #point 1#: 'a';

testRule2 #point 2#: 'b'#point 3#

When adding a new line on #point 1#, the next line is not indented at all. When adding a new line on #point 2#, the next line is indented by two spaces only. When adding a new line on #point 3#, the next line is indented to align to the 'b' on the line above

When trying to write a new rule at the bottom of the file it indents by a tab when adding new lines.

This behavior occurs when using the unreleased extension that has support on VS 2015, I haven't tested on 2013, though.

sharwell commented 9 years ago

Certainly some strange behavior going on here. I don't think I'm going to be able to fix it prior to the next release without delaying the new Visual Studio 2015 support.

Point 3 in your example is actually doing the correct thing, but the other two are not. The difference between the behavior of point 1 and 2 is the inclusion (or omission) of the ; at the end of the line.