Browse Source

fixed compile errors

do not trim end of line while correcting the indentation
pull/14/head
Siegfried Pammer 15 years ago
parent
commit
dabf54fb1e
  1. 28
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs
  2. 1
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/LanguageUtils.cs

28
src/AddIns/BackendBindings/VBNetBinding/Project/Src/FormattingStrategy/VBNetFormattingStrategy.cs

@ -141,8 +141,12 @@ namespace ICSharpCode.VBNetBinding
InsertDocumentationComments(editor, lineNr, cursorOffset); 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(); string textToReplace = lineAboveText.TrimLine();
if (doCasing) if (doCasing)
@ -153,12 +157,10 @@ namespace ICSharpCode.VBNetBinding
if (IsInString(lineAboveText)) { if (IsInString(lineAboveText)) {
if (IsFinishedString(curLineText)) { if (IsFinishedString(curLineText)) {
editor.Document.Insert(lineAbove.Offset + lineAbove.Length, editor.Document.Insert(lineAbove.EndOffset, "\" & _");
"\" & _");
editor.Document.Insert(currentLine.Offset, "\""); editor.Document.Insert(currentLine.Offset, "\"");
} else { } else {
editor.Document.Insert(lineAbove.Offset + lineAbove.Length, editor.Document.Insert(lineAbove.EndOffset, "\"");
"\"");
} }
} else { } else {
string indent = DocumentUtilitites.GetWhitespaceAfter(editor.Document, lineAbove.Offset); string indent = DocumentUtilitites.GetWhitespaceAfter(editor.Document, lineAbove.Offset);
@ -170,11 +172,8 @@ namespace ICSharpCode.VBNetBinding
} }
IndentLines(editor, lineNr - 1, lineNr); IndentLines(editor, lineNr - 1, lineNr);
} } else if(ch == '>') {
else if(ch == '>') if (IsInsideDocumentationComment(editor, currentLine, cursorOffset)) {
{
if (IsInsideDocumentationComment(editor, currentLine, cursorOffset))
{
int column = editor.Caret.Offset - currentLine.Offset; int column = editor.Caret.Offset - currentLine.Offset;
int index = Math.Min(column - 1, curLineText.Length - 1); int index = Math.Min(column - 1, curLineText.Length - 1);
@ -507,13 +506,10 @@ namespace ICSharpCode.VBNetBinding
{ {
for (int i = curLine.Offset; i < cursorOffset; ++i) { for (int i = curLine.Offset; i < cursorOffset; ++i) {
char ch = editor.Document.GetCharAt(i); char ch = editor.Document.GetCharAt(i);
if (ch == '"') { if (ch == '"')
return false; return false;
}
if (ch == '\'' && i + 2 < cursorOffset && editor.Document.GetCharAt(i + 1) == '\'' && editor.Document.GetCharAt(i + 2) == '\'') if (ch == '\'' && i + 2 < cursorOffset && editor.Document.GetCharAt(i + 1) == '\'' && editor.Document.GetCharAt(i + 2) == '\'')
{
return true; return true;
}
} }
return false; return false;
} }
@ -736,7 +732,7 @@ namespace ICSharpCode.VBNetBinding
for (int i = begin; i <= end; i++) { for (int i = begin; i <= end; i++) {
IDocumentLine curLine = editor.Document.GetLine(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'); string noComments = lineText.TrimComments().TrimEnd(' ', '\t', '\r', '\n');
if (i < selBegin || i > selEnd) { if (i < selBegin || i > selEnd) {

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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System; using System;
using System.Text.RegularExpressions;
namespace ICSharpCode.VBNetBinding namespace ICSharpCode.VBNetBinding
{ {

Loading…
Cancel
Save