[svn] r6734: vs-plugin/trunk:
Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Relocation.n
Ne...
IT
svnadmin at nemerle.org
Thu Sep 28 05:43:57 CEST 2006
Log:
Region for usings.
Author: IT
Date: Thu Sep 28 05:43:52 2006
New Revision: 6734
Modified:
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Relocation.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.n
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Relocation.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Relocation.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/Project.Relocation.n Thu Sep 28 05:43:52 2006
@@ -1,19 +1,19 @@
using System;
using System.IO;
using System.Diagnostics;
+
using Nemerle.Assertions;
using Nemerle.Collections;
using Nemerle.Compiler;
using Nemerle.Compiler.Parsetree;
using Nemerle.Imperative;
using Nemerle.Utility;
+using Nemerle.Compiler.Utils;
using SR = System.Reflection;
using SCG = System.Collections.Generic;
-using Nemerle.Compiler.Utils;
using Typed = Nemerle.Compiler.Typedtree;
-
namespace Nemerle.Completion2
{
public partial class Project
@@ -27,7 +27,8 @@
newEndChar : int, newEndLine : int,
oldEndChar : int, oldEndLine : int,
startChar : int, startLine : int
- ) : bool
+ )
+ : bool
{
def fileIndex = _compileUnits.GetFileIndex(filePath);
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 Thu Sep 28 05:43:52 2006
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Diagnostics;
using Nemerle.Assertions;
@@ -172,6 +173,14 @@
def fileIndex = _compileUnits.GetFileIndex(fileName);
+ mutable afterUsingLine = int.MaxValue;
+
+ def checkLine(line)
+ {
+ when (afterUsingLine > line)
+ afterUsingLine = line;
+ }
+
def isNext(line, col, ch)
{
def str = source.GetLine(line);
@@ -192,6 +201,7 @@
colStart = source.GetLine(lineStart).Length + 1;
addHiddenRegion(Location(fileIndex, lineStart, colStart, lineEnd, colEnd), true);
+ checkLine(lineStart);
// Get regions and errors for methods.
//
@@ -233,6 +243,8 @@
else
loc,
true);
+
+ checkLine(loc.Line);
}
| builder is TypeBuilder when builder.Location.FileIndex == fileIndex =>
@@ -243,12 +255,18 @@
}
}
+ def namespaces = List();
+
def processDecl(decl)
{
| 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) =>
decls.Iter(processDecl);
@@ -266,14 +284,66 @@
when (isNext(lineEnd, colEnd, '}')) colEnd++;
addHiddenRegion(Location(fileIndex, lineStart, colStart, lineEnd, colEnd), true);
+ checkLine(lineStart);
| None => ()
}
+
| _ => ()
}
foreach (decl in _compileUnits[fileIndex].Decls)
processDecl(decl);
+
+ 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), true);
+ }
+ }
}
public GetMethodTip(
Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs Thu Sep 28 05:43:52 2006
@@ -213,7 +213,7 @@
if (!TextSpanHelper.ValidSpan(this, r.tsHiddenText))
{
- Debug.Assert(false, "Invalid span " + r.tsHiddenText.iStartLine + "," + r.tsHiddenText.iStartIndex + "," + r.tsHiddenText.iEndLine + "," + r.tsHiddenText.iEndIndex);
+ //Debug.Assert(false, "Invalid span " + r.tsHiddenText.iStartLine + "," + r.tsHiddenText.iStartIndex + "," + r.tsHiddenText.iEndLine + "," + r.tsHiddenText.iEndIndex);
break;
}
else
More information about the svn
mailing list