Permalink
Browse files

fixed compile errors

do not trim end of line while correcting the indentation
  • Loading branch information...
1 parent 5e68dff commit dabf54fb1ea159c840d3af0709aa4c8af9ea04e0 @siegfriedpammer siegfriedpammer committed Nov 25, 2010
View
28 ...ns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs
@@ -141,8 +141,12 @@ void FormatLineInternal(ITextEditor editor, int lineNr, int cursorOffset, char c
InsertDocumentationComments(editor, lineNr, cursorOffset);
}
- if (ch == '\n' && lineAboveText != null)
- {
+ if (ch == '\n' && lineAboveText != null) {
+ if (IsInsideDocumentationComment(editor, lineAbove, lineAbove.EndOffset)) {
+ editor.Document.Insert(cursorOffset, "''' ");
+ return;
+ }
+
string textToReplace = lineAboveText.TrimLine();
if (doCasing)
@@ -153,12 +157,10 @@ void FormatLineInternal(ITextEditor editor, int lineNr, int cursorOffset, char c
if (IsInString(lineAboveText)) {
if (IsFinishedString(curLineText)) {
- editor.Document.Insert(lineAbove.Offset + lineAbove.Length,
- "\" & _");
+ editor.Document.Insert(lineAbove.EndOffset, "\" & _");
editor.Document.Insert(currentLine.Offset, "\"");
} else {
- editor.Document.Insert(lineAbove.Offset + lineAbove.Length,
- "\"");
+ editor.Document.Insert(lineAbove.EndOffset, "\"");
}
} else {
string indent = DocumentUtilitites.GetWhitespaceAfter(editor.Document, lineAbove.Offset);
@@ -170,11 +172,8 @@ void FormatLineInternal(ITextEditor editor, int lineNr, int cursorOffset, char c
}
IndentLines(editor, lineNr - 1, lineNr);
- }
- else if(ch == '>')
- {
- if (IsInsideDocumentationComment(editor, currentLine, cursorOffset))
- {
+ } else if(ch == '>') {
+ if (IsInsideDocumentationComment(editor, currentLine, cursorOffset)) {
int column = editor.Caret.Offset - currentLine.Offset;
int index = Math.Min(column - 1, curLineText.Length - 1);
@@ -507,13 +506,10 @@ static bool IsInsideDocumentationComment(ITextEditor editor, IDocumentLine curLi
{
for (int i = curLine.Offset; i < cursorOffset; ++i) {
char ch = editor.Document.GetCharAt(i);
- if (ch == '"') {
+ if (ch == '"')
return false;
- }
if (ch == '\'' && i + 2 < cursorOffset && editor.Document.GetCharAt(i + 1) == '\'' && editor.Document.GetCharAt(i + 2) == '\'')
- {
return true;
- }
}
return false;
}
@@ -736,7 +732,7 @@ static void ApplyToRange(ITextEditor editor, Stack<string> indentation, int begi
for (int i = begin; i <= end; i++) {
IDocumentLine curLine = editor.Document.GetLine(i);
- string lineText = curLine.Text.Trim(' ', '\t', '\r', '\n');
+ string lineText = curLine.Text.TrimStart(' ', '\t', '\r', '\n');
string noComments = lineText.TrimComments().TrimEnd(' ', '\t', '\r', '\n');
if (i < selBegin || i > selEnd) {
View
1 src/AddIns/BackendBindings/VBNetBinding/Project/Src/LanguageUtils.cs
@@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
+using System.Text.RegularExpressions;
namespace ICSharpCode.VBNetBinding
{

0 comments on commit dabf54f

Please sign in to comment.