Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
Disable indentation in for loops
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexer10 committed Apr 1, 2020
1 parent eeb4398 commit e2d13c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion App/AssemblyInfo1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
#if (DEBUG)
[assembly: AssemblyVersion("1.13.*")]
#else
[assembly: AssemblyVersion("1.3.4.3")]
[assembly: AssemblyVersion("1.3.4.4")]
#endif
16 changes: 12 additions & 4 deletions UI/Components/EditorElement.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -530,11 +530,19 @@ private void TextArea_TextEntered(object sender, TextCompositionEventArgs e)
if (e.Text == ";")
if (editor.CaretOffset >= 0)
{

var line = editor.Document.GetLineByOffset(editor.CaretOffset);
var leadingIndentation =
editor.Document.GetText(TextUtilities.GetLeadingWhitespace(editor.Document, line));
var newLineStr = leadingIndentation + SPSyntaxTidy.TidyUp(editor.Document.GetText(line)).Trim();
editor.Document.Replace(line, newLineStr);
var text = editor.Document.GetText(line);

// TODO: Poor way to fix this but atm I have no idea on how to fix this properly
if (!text.Contains("for"))
{
var leadingIndentation =
editor.Document.GetText(TextUtilities.GetLeadingWhitespace(editor.Document, line));
var newLineStr = leadingIndentation +
SPSyntaxTidy.TidyUp(text).Trim();
editor.Document.Replace(line, newLineStr);
}
}

switch (e.Text)
Expand Down

0 comments on commit e2d13c7

Please sign in to comment.