[svn] r6884: vs-plugin/trunk: ConsoleTest/Program.cs
Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj ...
IT
svnadmin at nemerle.org
Tue Nov 14 04:15:49 CET 2006
Log:
1. Outlining for match.
2. StackOverflow test .
Author: IT
Date: Tue Nov 14 04:15:41 2006
New Revision: 6884
Added:
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Checker.n
Modified:
vs-plugin/trunk/ConsoleTest/Program.cs
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprWalker.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ISource.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ProjectManager.n
vs-plugin/trunk/Nemerle.Compiler.Utils/NemerleCodeDomProvider.n
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringScope.cs
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/SourceTextManager.cs
Modified: vs-plugin/trunk/ConsoleTest/Program.cs
==============================================================================
--- vs-plugin/trunk/ConsoleTest/Program.cs (original)
+++ vs-plugin/trunk/ConsoleTest/Program.cs Tue Nov 14 04:15:41 2006
@@ -14,6 +14,7 @@
test.Check_partial_region();
test.Check_region_location();
+ test.QuickTip_StackOverflow();
test.QuickTip_TupleProp();
test.QuickTip_TupleMethod();
test.Complete_enum();
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.csproj Tue Nov 14 04:15:41 2006
@@ -157,6 +157,9 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
+ <ItemGroup>
+ <Compile Include="Nemerle.Completion2\CodeModel\Checker.n" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Added: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Checker.n
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Checker.n Tue Nov 14 04:15:41 2006
@@ -0,0 +1,416 @@
+using System;
+using System.Collections.Generic;
+
+using Nemerle.Compiler;
+using Nemerle.Compiler.Parsetree;
+using Nemerle.Compiler.Typedtree;
+using Nemerle.Compiler.Utils;
+
+using Nemerle.Assertions;
+using Nemerle.Imperative;
+using Nemerle.Utility;
+
+namespace Nemerle.Completion2
+{
+ class Checker
+ {
+ public this(
+ project : Project,
+ fileName : string,
+ source : ISource,
+ addHiddenRegion : AddHiddenRegion,
+ addError : AddError
+ )
+ {
+ _project = project;
+ _fileName = fileName;
+ _source = source;
+ _addHiddenRegion = addHiddenRegion;
+ _addError = addError;
+ }
+
+ _project : Project;
+ _fileName : string;
+ _source : ISource;
+ _addHiddenRegion : AddHiddenRegion;
+ _addError : AddError;
+
+ mutable _lastLine : string;
+ mutable _lastLineIndex : int;
+ mutable _lineCount : int;
+ mutable _fileIndex : int;
+ mutable _afterUsingLine : int;
+
+ GetLine(lineIndex : int) : string
+ {
+ when (_lastLineIndex != lineIndex)
+ {
+ _lastLineIndex = lineIndex;
+ _lastLine = _source.GetLine(lineIndex);
+ }
+
+ _lastLine
+ }
+
+ GetLineCount() : int
+ {
+ when (_lineCount < 0)
+ _lineCount = _source.LineCount;
+
+ _lineCount
+ }
+
+ IsNext(line : int, col : int, ch : char) : bool
+ {
+ def str = GetLine(line);
+ col > 0 && str.Length >= col && str[col - 1] == ch
+ }
+
+ FindNext(lineIndex : int, col : int, text : string) : int * int
+ {
+ def endLine = Math.Max(GetLineCount(), lineIndex + 10);
+
+ mutable c = col - 1;
+
+ for (mutable l = lineIndex; l < endLine; l++)
+ {
+ def line = GetLine(l);
+
+ def peek () { if (c < line.Length) line[c] else '\0' }
+ def skip () { c++; }
+ def peekn(i) { if (c + i < line.Length) line[c + i] else '\0' }
+ def eol () { c >= line.Length }
+
+ while (!eol())
+ {
+ match (peek())
+ {
+ | '/' when peekn(+1) == '/' => c = int.MaxValue - 1;
+ | '/' when peekn(+1) == '*' => return (l, c + 1);
+ | ch when text[0] == ch =>
+
+ when (text.Length == 1 || line.Substring(c) == text)
+ return (l, c + 1);
+
+ | _ => ()
+ }
+
+ skip();
+ }
+
+ c = 0;
+ }
+
+ (lineIndex, col)
+ }
+
+ CheckLine(line : int) : void
+ {
+ when (_afterUsingLine > line)
+ _afterUsingLine = line;
+ }
+
+ AddRegion(loc : Location, isExpanded : bool) : void
+ {
+ when (!loc.IsEmpty())
+ {
+ _addHiddenRegion(
+ if (IsNext(loc.Line, loc.Column, ' '))
+ Location(_fileIndex, loc.Line, loc.Column + 1, loc.EndLine, loc.EndColumn)
+ else
+ loc,
+ null,
+ isExpanded);
+
+ CheckLine(loc.Line);
+ }
+ }
+
+ ProcessMatch(cases : list[MatchCase]) : void
+ {
+ def walker = ExprWalker();
+ def locs = cases.Map(c =>
+ {
+ mutable ploc = walker.GetLocation(c.patterns.Head);
+
+ foreach (p in c.patterns.Tail)
+ ploc = Utils.Combine(ploc, walker.GetLocation(p));
+
+ (ploc, walker.GetLocation(c.body))
+ });
+
+ def startLoc(ploc, bloc)
+ {
+ mutable line = bloc.Line;
+ mutable col = bloc.Column;
+
+ def str = GetLine(ploc.EndLine);
+ def idx = str.IndexOf("=>", ploc.EndColumn - 1);
+
+ when (idx >= 0)
+ {
+ line = ploc.EndLine;
+ col = idx + 3;
+ }
+
+ (line, col)
+ }
+
+ def loop(locs)
+ {
+ | (p1, b1) :: (p2, b2) :: t =>
+
+ when (p1.EndLine + 1 < p2.Line)
+ {
+ def (line, col) = startLoc(p1, b1);
+ def endLine = p2.Line - 1;
+
+ AddRegion(
+ Location(_fileIndex, line, col, endLine, GetLine(endLine).Length + 1),
+ false);
+ }
+
+ loop((p2, b2) :: t)
+
+ | [(p, b)] =>
+
+ def (line, col) = startLoc(p, b);
+ mutable eLine;
+ mutable eCol;
+
+ (eLine, eCol) = FindNext(b.EndLine, b.EndColumn, "}");
+
+ if (eLine == b.EndLine)
+ {
+ when (eCol > 1 && eCol != b.EndColumn)
+ {
+ def line = GetLine(eLine);
+
+ _debug(line[eCol - 2]);
+ when (line[eCol - 2] == ' ' || line[eCol - 2] == '\t')
+ eCol--;
+ }
+ }
+ else
+ {
+ def line = GetLine(eLine).Substring(0, eCol - 1);
+
+ when (line.Trim(' ', '\t').Length == 0)
+ {
+ eLine--;
+ eCol = GetLine(eLine).Length + 1
+ }
+ }
+
+ AddRegion(Location(_fileIndex, line, col, eLine, eCol),false);
+
+ | [] => ()
+ }
+
+ loop(locs);
+ }
+
+ ProcessBuilder(builder : TypeBuilder) : void
+ {
+ when (builder.IsDelegate || builder.IsVariantOption)
+ return;
+
+ // Region for the type itself.
+ //
+ mutable lineStart = builder.Location.Line;
+ mutable colStart = builder.Location.Column;
+ mutable lineEnd = builder.Location.EndLine;
+ mutable colEnd = builder.Location.EndColumn;
+
+ // Should be temporary solution until we get location for the type name.
+ //
+ colStart = GetLine(lineStart).Length + 1;
+
+ _addHiddenRegion(Location(_fileIndex, lineStart, colStart, lineEnd, colEnd), null, true);
+ CheckLine(lineStart);
+
+ // Get regions and errors for methods.
+ //
+ def _start = Environment.TickCount;
+
+ def isProcessed(m)
+ {
+ !(m.Attributes %&& (NemerleAttributes.SpecialName | NemerleAttributes.Abstract))
+ && m.Location.FileIndex == _fileIndex
+ }
+
+ def members = builder.GetDirectMembers().Filter(isProcessed);
+
+ foreach (member in members)
+ {
+ // TypeBuilder can contain methods from many parts of partial
+ // class and super classes. We must process only memebers defined
+ // in processed file only!
+ //
+ | method is MethodBuilder =>
+
+#if !DEBUG
+ when (_start < Environment.TickCount - 2000)
+ break;
+#endif
+
+ def pExpr = method.GetParsedBody();
+
+ when (pExpr != null)
+ {
+ ExprWalker().Walk(pExpr, fun(info : ExprWalkInfo)
+ {
+ match (info.Node)
+ {
+ //| PExpr.MacroCall => info.Skip();
+ | PExpr.DefFunctions(funs) => // { funs : list [Function_decl]; }
+
+ funs.Iter(f => AddRegion(
+ Utils.Combine(f.header.Location, f.body.Location).
+ TrimStart(f.header.Location, true),
+ false));
+
+ | PExpr.Match(_, cases) => ProcessMatch(cases);
+ | _ => ()
+ }
+ });
+ }
+
+ // Get the method region location.
+ //
+ AddRegion(method.Location.TrimStart(method.fun_header.ret_type_loc, false), true);
+
+ | builder is TypeBuilder =>
+
+ ProcessBuilder(builder)
+
+ | _ => ()
+ }
+ }
+
+ ProcessDecls(decls : list[Decl]) : void
+ {
+ // #regions go first as there is a limitation for the total amount of hidden regions.
+ //
+
+ //TODO: Ðåãèîíû ïîêà íå ðåëîêåéòÿòñÿ. Òàê ÷òî ïðè çìåíåíèè èñõîäíèêîâ îíè äîëæíû âðàòü.
+ def regions = _project.CompileUnits.GetRegions(_fileIndex);
+
+ foreach (r in regions)
+ {
+ // Êàêîé ñìûñë â mutable? Äà è âîîáùå çà÷åì êîïèðîâàòü Location â ïåðåìåííûå?
+ mutable lineStart = r.Location.Line;
+ mutable colStart = r.Location.Column;
+ mutable lineEnd = r.Location.EndLine;
+ mutable colEnd = r.Location.EndColumn;
+
+ def str = GetLine(lineStart);
+
+ colStart = str.IndexOf('#') + 1;
+
+ _addHiddenRegion(
+ Location(_fileIndex, lineStart, colStart, lineEnd, colEnd),
+ if (r.Text.IsNullOrEmpty()) "#region" else r.Text, false);
+ }
+
+ def namespaces = List();
+
+ foreach (decl in decls)
+ {
+ | Decl.Type(builder) when builder.Location.FileIndex == _fileIndex =>
+
+ ProcessBuilder(builder)
+
+ | Using as ns when ns.NameLocations.Exists(l => l.FileIndex == _fileIndex) =>
+
+ namespaces.Add(ns);
+
+ | Namespace(decls, _, locations, _, _, nsloc) =>
+
+ ProcessDecls(decls);
+
+ match (locations.Find(l => l.FileIndex == _fileIndex))
+ {
+ | Some(loc) =>
+
+ mutable lineStart = loc.EndLine;
+ mutable colStart = loc.EndColumn;
+ mutable lineEnd = nsloc.EndLine;
+ mutable colEnd = nsloc.EndColumn;
+
+ when (IsNext(lineStart, colStart, ' ')) colStart++;
+ when (IsNext(lineEnd, colEnd, '}')) colEnd++;
+
+ _addHiddenRegion(Location(_fileIndex, lineStart, colStart, lineEnd, colEnd), null, true);
+ CheckLine(lineStart);
+
+ | None => ()
+ }
+ | _ => ()
+ }
+
+ when (namespaces.Count > 1)
+ {
+ mutable usingLoc;
+
+ foreach (ns in namespaces)
+ {
+ match (ns.NameLocations.Find(l => l.FileIndex == _fileIndex))
+ {
+ | Some(loc) =>
+
+ usingLoc = if (usingLoc.IsEmpty()) loc else Utils.Combine(usingLoc, ns.Location);
+
+ | _ => ()
+ }
+ }
+
+ when (!usingLoc.IsEmpty())
+ {
+ mutable lineStart = usingLoc.Line;
+ mutable colStart = usingLoc.Column;
+ mutable lineEnd = usingLoc.EndLine;
+ mutable colEnd = usingLoc.EndColumn;
+
+ when (_afterUsingLine != int.MaxValue)
+ {
+ for (mutable i = lineEnd; i < _afterUsingLine; i++)
+ {
+ def str = GetLine(i);
+ def idx = str.IndexOf(";");
+
+ when (idx >= 0)
+ {
+ lineEnd = i;
+ colEnd = idx + 2;
+ break;
+ }
+ }
+ }
+
+ _addHiddenRegion(Location(_fileIndex, lineStart, colStart, lineEnd, colEnd), null, true);
+ }
+ }
+ }
+
+ public Check() : void
+ {
+ _lineCount = -1;
+ _lastLineIndex = -1;
+ _afterUsingLine = int.MaxValue;
+ _fileIndex = _project.CompileUnits.GetFileIndex(_fileName);
+
+ foreach (cm in _project.GetAllCompilerMessageForFile(_fileIndex))
+ when (!_addError(cm))
+ break;
+
+ ProcessDecls(_project.CompileUnits[_fileIndex].Decls);
+ }
+
+ _debug(obj : object) : void
+ {
+ when (obj != null)
+ ignore(obj.ToString());
+ }
+ }
+}
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n
==============================================================================
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprWalker.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprWalker.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprWalker.n Tue Nov 14 04:15:41 2006
@@ -4,6 +4,7 @@
using Nemerle.Compiler;
using Nemerle.Compiler.Parsetree;
using Nemerle.Compiler.Typedtree;
+using Nemerle.Compiler.Utils;
using Nemerle.Imperative;
using Nemerle.Utility;
@@ -453,6 +454,19 @@
_info.Init(walkHandler);
Go(expression);
}
+
+ public GetLocation(expression : PExpr) : Location
+ {
+ mutable loc = expression.Location;
+
+ Walk(expression, info =>
+ {
+ when (info.Node is Located)
+ loc = Utils.Combine(loc, (info.Node :> Located).Location);
+ });
+
+ loc
+ }
}
}
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n Tue Nov 14 04:15:41 2006
@@ -152,12 +152,7 @@
}
}
- private _Debug[T](obj : T) : void
- {
- _ = obj.ToString();
- }
-
- private GetAllCompilerMessageForFile(fileIndex : int) : SCG.IEnumerable[CompilerMessage]
+ internal GetAllCompilerMessageForFile(fileIndex : int) : SCG.IEnumerable[CompilerMessage]
{
foreach (cm when cm.Location.FileIndex == fileIndex in Errors)
yield cm;
@@ -208,248 +203,15 @@
seq
}
- _debug(obj : object) : void
- {
- _ = obj.ToString();
- }
-
public Check(
- /*[NotNull]*/ fileName : string,
- /*[NotNull]*/ source : ISource,
- /*[NotNull]*/ addHiddenRegion : AddHiddenRegion,
- /*[NotNull]*/ addError : AddError
+ [NotNull] fileName : string,
+ [NotNull] source : ISource,
+ [NotNull] addHiddenRegion : AddHiddenRegion,
+ [NotNull] addError : AddError
)
: void
{
- def fileIndex = _compileUnits.GetFileIndex(fileName);
-
- foreach (cm in GetAllCompilerMessageForFile(fileIndex))
- when (!addError(cm))
- break;
-
- def isNext(line, col, ch)
- {
- def str = source.GetLine(line);
- col > 0 && str.Length >= col && str[col - 1] == ch
- }
-
- def processDecls(decls)
- {
- mutable afterUsingLine = int.MaxValue;
-
- def checkLine(line)
- {
- when (afterUsingLine > line)
- afterUsingLine = line;
- }
-
- def addRegion(loc, isExpanded)
- {
- when (!loc.IsEmpty())
- {
- addHiddenRegion(
- if (isNext(loc.Line, loc.Column, ' '))
- Location(fileIndex, loc.Line, loc.Column + 1, loc.EndLine, loc.EndColumn)
- else
- loc,
- null,
- isExpanded);
-
- checkLine(loc.Line);
- }
- }
-
- def processBuilder(builder : TypeBuilder)
- {
- when (builder.IsDelegate || builder.IsVariantOption)
- return;
-
- // Region for the type itself.
- //
- mutable lineStart = builder.Location.Line;
- mutable colStart = builder.Location.Column;
- mutable lineEnd = builder.Location.EndLine;
- mutable colEnd = builder.Location.EndColumn;
-
- // Should be temporary solution until we get location for the type name.
- //
- colStart = source.GetLine(lineStart).Length + 1;
-
- addHiddenRegion(Location(fileIndex, lineStart, colStart, lineEnd, colEnd), null, true);
- checkLine(lineStart);
-
- // Get regions and errors for methods.
- //
- def _start = Environment.TickCount;
-
- def isProcessed(m)
- {
- !(m.Attributes %&& (NemerleAttributes.SpecialName | NemerleAttributes.Abstract))
- && m.Location.FileIndex == fileIndex
- }
-
- def members = builder.GetDirectMembers().Filter(isProcessed);
-
- foreach (member in members)
- {
- // TypeBuilder can contain methods from many parts of partial
- // class and super classes. We must process only memebers defined
- // in processed file only!
- //
- | method is MethodBuilder =>
-
-#if !DEBUG
- when (_start < Environment.TickCount - 2000)
- break;
-#endif
-
-// try
-// {
- def pExpr = method.GetParsedBody();
-
- when (pExpr != null)
- {
- ExprWalker().Walk(pExpr, fun(info : ExprWalkInfo)
- {
- match (info.Node)
- {
- | PExpr.DefFunctions(funs) => // { funs : list [Function_decl]; }
-
- funs.Iter(f => addRegion(
- Utils.Combine(f.header.Location, f.body.Location).
- TrimStart(f.header.Location, true),
- false));
-
- | _ => ()
- }
- });
- }
-// }
-// catch
-// {
-// | _ => ()
-// }
-
- // Get the method region location.
- //
- addRegion(method.Location.TrimStart(method.fun_header.ret_type_loc, false), true);
-
- | builder is TypeBuilder =>
-
- processBuilder(builder)
-
- | _ => ()
- }
- }
-
- def namespaces = List();
-
- foreach (decl in decls)
- {
- | Decl.Type(builder) when builder.Location.FileIndex == fileIndex =>
-
- processBuilder(builder)
-
- | Using as ns when ns.NameLocations.Exists(l => l.FileIndex == fileIndex) =>
-
- namespaces.Add(ns);
-
- | Namespace(decls, _, locations, _, _, nsloc) =>
-
- processDecls(decls);
-
- match (locations.Find(l => l.FileIndex == fileIndex))
- {
- | Some(loc) =>
-
- mutable lineStart = loc.EndLine;
- mutable colStart = loc.EndColumn;
- mutable lineEnd = nsloc.EndLine;
- mutable colEnd = nsloc.EndColumn;
-
- when (isNext(lineStart, colStart, ' ')) colStart++;
- when (isNext(lineEnd, colEnd, '}')) colEnd++;
-
- addHiddenRegion(Location(fileIndex, lineStart, colStart, lineEnd, colEnd), null, true);
- checkLine(lineStart);
-
- | None => ()
- }
- | _ => ()
- }
-
- when (namespaces.Count > 1)
- {
- mutable usingLoc;
-
- foreach (ns in namespaces)
- {
- match (ns.NameLocations.Find(l => l.FileIndex == fileIndex))
- {
- | Some(loc) =>
-
- if (usingLoc.IsEmpty())
- {
- usingLoc = loc;
- }
- else
- {
- usingLoc = Utils.Combine(usingLoc, ns.Location);
- }
-
- | _ => ()
- }
- }
-
- when (!usingLoc.IsEmpty())
- {
- mutable lineStart = usingLoc.Line;
- mutable colStart = usingLoc.Column;
- mutable lineEnd = usingLoc.EndLine;
- mutable colEnd = usingLoc.EndColumn;
-
- when (afterUsingLine != int.MaxValue)
- {
- for (mutable i = lineEnd; i < afterUsingLine; i++)
- {
- def str = source.GetLine(i);
- def idx = str.IndexOf(";");
-
- when (idx >= 0)
- {
- lineEnd = i;
- colEnd = idx + 2;
- break;
- }
- }
- }
-
- addHiddenRegion(Location(fileIndex, lineStart, colStart, lineEnd, colEnd), null, true);
- }
- }
-
- //TODO: Ðåãèîíû ïîêà íå ðåëîêåéòÿòñÿ. Òàê ÷òî ïðè çìåíåíèè èñõîäíèêîâ îíè äîëæíû âðàòü.
- def regions = CompileUnits.GetRegions(fileIndex);
-
- foreach (r in regions)
- {
- // Êàêîé ñìûñë â mutable? Äà è âîîáùå çà÷åì êîïèðîâàòü Location â ïåðåìåííûå?
- mutable lineStart = r.Location.Line;
- mutable colStart = r.Location.Column;
- mutable lineEnd = r.Location.EndLine;
- mutable colEnd = r.Location.EndColumn;
-
- def str = source.GetLine(lineStart);
-
- colStart = str.IndexOf('#') + 1;
-
- addHiddenRegion(
- Location(fileIndex, lineStart, colStart, lineEnd, colEnd),
- if (r.Text.IsNullOrEmpty()) "#region" else r.Text, false);
- }
- }
-
- processDecls(_compileUnits[fileIndex].Decls);
+ Checker(this, fileName, source, addHiddenRegion, addError).Check();
}
public GetMethodTip(
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Content/Class1.n Tue Nov 14 04:15:41 2006
@@ -161,6 +161,15 @@
class D : C { }
+class Class3
+{
+ Foo() : void
+ {
+ def (/*StackOverflow*/
+ _ = "".ToString();
+ }
+}
+
module ClassExtension
{
Boo() : void
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.Init.n Tue Nov 14 04:15:41 2006
@@ -169,6 +169,11 @@
{
throw NotImplementedException();
}
+
+ public LineCount : int
+ {
+ get { File.ReadAllLines(_filePath).Length }
+ }
}
}
}
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n Tue Nov 14 04:15:41 2006
@@ -429,6 +429,15 @@
}
[Test]
+ public QuickTip_StackOverflow() : void
+ {
+ def file = FilePath1;
+ def (line, col) = ReadLocation(file, "StackOverflow");
+
+ _ = _project.GetQuickTipInfo(file, line, col);
+ }
+
+ [Test]
public QuickTip_TupleMethod() : void
{
def file = FilePath2;
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ISource.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ISource.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ISource.n Tue Nov 14 04:15:41 2006
@@ -11,5 +11,6 @@
GetLine(line : int) : string;
GetPositionOfLineIndex(line : int, col : int) : int;
GetLineIndexOfPosition(pos : int) : int * int;
+ LineCount : int { get };
}
}
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ProjectManager.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ProjectManager.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/TextManagement/ProjectManager.n Tue Nov 14 04:15:41 2006
@@ -154,6 +154,13 @@
scanLines(1, 1);
}
+
+ public LineCount : int
+ {
+ [NotImplemented]
+ get { }
+ }
+
} // class SimpleSourceTextManager
} // class ProjectManager
} // namespace Nemerle.Completion2
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/NemerleCodeDomProvider.n
==============================================================================
Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringScope.cs
==============================================================================
Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs Tue Nov 14 04:15:41 2006
@@ -247,6 +247,8 @@
new SourceTextManager(projectInfo.GetSource(request.FileName)),
delegate(Location location, string text, bool isExpanded)
{
+ if (location.Line < location.EndLine)
+ {
NewHiddenRegion r = new NewHiddenRegion();
r.tsHiddenText = Convert(location);
@@ -258,6 +260,7 @@
HIDDEN_REGION_STATE.hrsExpanded: HIDDEN_REGION_STATE.hrsDefault);
request.Sink.AddHiddenRegion(r);
+ }
},
delegate(CompilerMessage cm)
{
Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/SourceTextManager.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/SourceTextManager.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/SourceTextManager.cs Tue Nov 14 04:15:41 2006
@@ -54,10 +54,7 @@
line--; // Convert to zero based index.
#if DEBUG
- int lineCount;
- int hr1 = Source.GetTextLines().GetLineCount(out lineCount);
-
- NativeMethods.ThrowOnFailure(hr1);
+ int lineCount = LineCount;
if (line >= lineCount) // just for debugging purpose.
Trace.Assert(line < lineCount);
@@ -79,5 +76,18 @@
return new Tuple<int,int>(line + 1, col + 1);
}
+
+ public int LineCount
+ {
+ get
+ {
+ int lineCount;
+ int hr1 = Source.GetTextLines().GetLineCount(out lineCount);
+
+ NativeMethods.ThrowOnFailure(hr1);
+
+ return lineCount;
+ }
+ }
}
}
More information about the svn
mailing list