Browse Source

Fixed SD2-472 (Cursor disappears off screen whilst pressing right arrow key) and a newly introduce performance problems with large files (>5000 lines).

Added constructor insight support to BooBinding.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@546 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
0ac8a0bd47
  1. 6
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooLanguageProperties.cs
  2. 2
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ExpressionFinder.cs
  3. 10
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextAreaControl.cs
  4. 39
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextView.cs
  5. 10
      src/Main/Base/Project/Src/Dom/LanguageProperties.cs
  6. 14
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/InsightWindow/MethodInsightDataProvider.cs

6
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooLanguageProperties.cs

@ -33,5 +33,11 @@ namespace Grunwald.BooBinding @@ -33,5 +33,11 @@ namespace Grunwald.BooBinding
return true;
}
}
public override bool AllowObjectConstructionOutsideContext {
get {
return true;
}
}
}
}

2
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ExpressionFinder.cs

@ -220,7 +220,7 @@ namespace Grunwald.BooBinding.CodeCompletion @@ -220,7 +220,7 @@ namespace Grunwald.BooBinding.CodeCompletion
const int _elseIndex = 10;
static readonly
int[][] _stateTable = { // " ' \ \n $ { } # / * else
int[][] _stateTable = { // " ' \ \n $ { } # / * else
/* 0: in Code */ new int[] { 1 , 7 , 0 , 0 , 0 , 0 , 0 , 13 , 12 , 0 , 0 },
/* 1: after " */ new int[] { 2 , 6 , 10 , 0 , 8 , 6 , 6 , 6 , 6 , 6 , 6 },
/* 2: after "" */ new int[] { 3 , 7 , 0 , 0 , 0 , 0 , 0 , 13 , 12 , 0 , 0 },

10
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextAreaControl.cs

@ -150,9 +150,10 @@ namespace ICSharpCode.TextEditor @@ -150,9 +150,10 @@ namespace ICSharpCode.TextEditor
// number of visible lines in document (folding!)
vScrollBar.Maximum = textArea.MaxVScrollValue;
int max = 0;
foreach (ISegment lineSegment in Document.LineSegmentCollection) {
if(Document.FoldingManager.IsLineVisible(Document.GetLineNumberForOffset(lineSegment.Offset))) {
max = Math.Max(max, textArea.TextView.GetVisualColumn(Document.GetLineNumberForOffset(lineSegment.Offset),lineSegment.Length));
foreach (LineSegment lineSegment in this.Document.LineSegmentCollection) {
int lineNumber = Document.GetLineNumberForOffset(lineSegment.Offset);
if(Document.FoldingManager.IsLineVisible(lineNumber)) {
max = Math.Max(max, textArea.TextView.GetVisualColumnFast(lineSegment, lineSegment.Length));
}
}
hScrollBar.Minimum = 0;
@ -239,7 +240,8 @@ namespace ICSharpCode.TextEditor @@ -239,7 +240,8 @@ namespace ICSharpCode.TextEditor
int curCharMin = (int)(this.hScrollBar.Value - this.hScrollBar.Minimum);
int curCharMax = curCharMin + textArea.TextView.VisibleColumnCount;
int pos = textArea.TextView.GetVisualColumn(textArea.Caret.Line, textArea.Caret.Column);
int pos = textArea.TextView.GetVisualColumn(textArea.Caret.Line,
textArea.Caret.Column);
if (textArea.TextView.VisibleColumnCount < 0) {
hScrollBar.Value = 0;

39
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextView.cs

@ -669,7 +669,36 @@ namespace ICSharpCode.TextEditor @@ -669,7 +669,36 @@ namespace ICSharpCode.TextEditor
public int GetVisualColumn(int logicalLine, int logicalColumn)
{
return (int)((GetDrawingXPos(logicalLine, logicalColumn) + MinTabWidth) / WideSpaceWidth);
int column = 0;
using (Graphics g = textArea.CreateGraphics()) {
CountColumns(ref column, 0, logicalColumn, logicalLine, g);
}
return column;
}
public int GetVisualColumnFast(LineSegment line, int logicalColumn)
{
int lineOffset = line.Offset;
int tabIndent = Document.TextEditorProperties.TabIndent;
int guessedColumn = 0;
for (int i = 0; i < logicalColumn; ++i) {
char ch;
if (i >= line.Length) {
ch = ' ';
} else {
ch = Document.GetCharAt(lineOffset + i);
}
switch (ch) {
case '\t':
guessedColumn += tabIndent;
guessedColumn = (guessedColumn / tabIndent) * tabIndent;
break;
default:
++guessedColumn;
break;
}
}
return guessedColumn;
}
/// <summary>
@ -910,10 +939,14 @@ namespace ICSharpCode.TextEditor @@ -910,10 +939,14 @@ namespace ICSharpCode.TextEditor
FoldMarker f = null;
// search the last folding that's interresting
for (i = foldings.Count - 1; i >= 0; --i) {
f = (FoldMarker)foldings[i];
f = foldings[i];
if (f.StartLine < logicalLine || f.StartLine == logicalLine && f.StartColumn < logicalColumn) {
break;
}
FoldMarker f2 = foldings[i / 2];
if (f2.StartLine > logicalLine || f2.StartLine == logicalLine && f2.StartColumn >= logicalColumn) {
i /= 2;
}
}
int lastFolding = 0;
int firstFolding = 0;
@ -952,7 +985,7 @@ namespace ICSharpCode.TextEditor @@ -952,7 +985,7 @@ namespace ICSharpCode.TextEditor
int foldEnd = 0;
drawingPos = 0;
for (i = firstFolding; i <= lastFolding; ++i) {
f = (FoldMarker)foldings[i];
f = foldings[i];
drawingPos += CountColumns(ref column, foldEnd, f.StartColumn, f.StartLine, g);
foldEnd = f.EndColumn;
column += f.FoldText.Length;

10
src/Main/Base/Project/Src/Dom/LanguageProperties.cs

@ -54,6 +54,16 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -54,6 +54,16 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
/// <summary>
/// Allow invoking an object constructor outside of ExpressionContext.ObjectCreation.
/// Used for Boo, which creates instances like this: 'self.Size = Size(10, 20)'
/// </summary>
public virtual bool AllowObjectConstructionOutsideContext {
get {
return false;
}
}
public virtual bool ShowInNamespaceCompletion(IClass c)
{
return true;

14
src/Main/Base/Project/Src/TextEditor/Gui/Editor/InsightWindow/MethodInsightDataProvider.cs

@ -133,19 +133,23 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -133,19 +133,23 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
expressionResult.Context = ExpressionContext.Type;
}
ResolveResult results = ParserService.Resolve(expressionResult, caretLineNumber, caretColumn, fileName, document.TextContent);
TypeResolveResult trr = results as TypeResolveResult;
if (trr != null && !constructorInsight) {
if (ParserService.CurrentProjectContent.Language.AllowObjectConstructionOutsideContext)
constructorInsight = true;
}
if (constructorInsight) {
TypeResolveResult result = results as TypeResolveResult;
if (result == null)
if (trr == null)
return;
foreach (IMethod method in result.ResolvedType.GetMethods()) {
foreach (IMethod method in trr.ResolvedType.GetMethods()) {
if (method.IsConstructor && !method.IsStatic) {
methods.Add(method);
}
}
if (methods.Count == 0 && result.ResolvedClass != null && !result.ResolvedClass.IsAbstract && !result.ResolvedClass.IsStatic) {
if (methods.Count == 0 && trr.ResolvedClass != null && !trr.ResolvedClass.IsAbstract && !trr.ResolvedClass.IsStatic) {
// add default constructor
methods.Add(Constructor.CreateDefault(result.ResolvedClass));
methods.Add(Constructor.CreateDefault(trr.ResolvedClass));
}
} else {
MethodResolveResult result = results as MethodResolveResult;

Loading…
Cancel
Save