[svn] r6878: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService:
NemerleLanguageService.cs NemerleScann...
IT
svnadmin at nemerle.org
Mon Nov 13 03:56:46 CET 2006
Log:
Colorizing of files not included in solution.
Author: IT
Date: Mon Nov 13 03:56:43 2006
New Revision: 6878
Modified:
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleLanguageService.cs
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleScanner.cs
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.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 Mon Nov 13 03:56:43 2006
@@ -227,11 +227,12 @@
private AuthoringScope Check(ParseRequest request)
{
ProjectInfo projectInfo = ProjectInfo.FindProject(request.FileName);
- NemerleSource source = projectInfo.GetSource(request.FileName);
if (projectInfo == null)
return null;
+ NemerleSource source = projectInfo.GetSource(request.FileName);
+
int nErrors = 0;
bool allExpanded = source.TimeStamp > 0;
Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleScanner.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleScanner.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleScanner.cs Mon Nov 13 03:56:43 2006
@@ -36,10 +36,19 @@
ProjectInfo projectInfo = ProjectInfo.FindProject(source.GetFilePath());
+ Engine engine;
+
if (projectInfo == null)
- return null;
+ {
+ engine = new Engine(new ProjectManager(_languageService), new TraceWriter());
+ engine.Init();
+ }
+ else
+ {
+ engine = projectInfo.Engine;
+ }
- _lexer = new ScanLexer(projectInfo.Engine);
+ _lexer = new ScanLexer(engine);
}
return _lexer;
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 Mon Nov 13 03:56:43 2006
@@ -112,169 +112,14 @@
return new NemerleAuthoringSink(this, reason, line, col, maxErrors);
}
+#if DEBUG
public override void ProcessHiddenRegions(ArrayList hiddenRegions)
{
-#if DEBUG
LanguageService.Preferences.MaxRegionTime = 1000 * 60 * 10;
-#endif
base.ProcessHiddenRegions(hiddenRegions);
}
- /*
- public override void ProcessHiddenRegions(ArrayList hiddenRegions)
- {
- IVsEnumHiddenRegions ppenum = null;
-
- try
- {
- // Compare the existing regions with the new regions and
- // remove any that do not match the new regions.
- //
- IVsHiddenTextSession session = GetHiddenTextSession();
- TextSpan[] aspan = new TextSpan[1];
-
- aspan[0] = GetDocumentSpan();
-
- NativeMethods.ThrowOnFailure(session.EnumHiddenRegions(
- (uint)FIND_HIDDEN_REGION_FLAGS.FHR_BY_CLIENT_DATA, 25, aspan, out ppenum));
-
- IVsHiddenRegion[] aregion = new IVsHiddenRegion[1];
-
- uint fetched;
- int matched = 0;
- int removed = 0;
- int added = 0;
- int pos = 0;
-
- // Create a list of IVsHiddenRegion objects, sorted in the same order that the
- // authoring sink sorts. This is necessary because VS core editor does NOT return
- // the regions in the same order that we add them.
- //
- ArrayList regions = new ArrayList();
- ArrayList spans = new ArrayList();
-
- while ((ppenum.Next(1, aregion, out fetched)) == NativeMethods.S_OK && fetched == 1)
- {
- NativeMethods.ThrowOnFailure(aregion[0].GetSpan(aspan));
-
- TextSpan s = aspan[0];
-
- int i;
- for (i = spans.Count - 1; i >= 0; i--)
- {
- TextSpan s2 = (TextSpan)spans[i];
-
- if (TextSpanHelper.StartsAfterStartOf(s, s2))
- break;
- }
-
- spans. Insert(i + 1, s);
- regions.Insert(i + 1, aregion[0]);
- }
-
- // Now merge the list found with the list in the AuthoringSink to figure out
- // what matches, what needs to be removed, and what needs to be inserted.
- //
- NewHiddenRegion r = pos < hiddenRegions.Count ?
- (NewHiddenRegion)hiddenRegions[pos] : new NewHiddenRegion();
-
- for (int i = 0, n = regions.Count; i < n; i++)
- {
- IVsHiddenRegion region = (IVsHiddenRegion)regions[i];
- TextSpan span = (TextSpan)spans[i];
-
- // In case we're inserting a new region, scan ahead to matching start line
- //
- while (r.tsHiddenText.iStartLine < span.iStartLine)
- {
- pos++;
-
- if (pos >= hiddenRegions.Count)
- {
- r = new NewHiddenRegion();
- break;
- }
- else
- {
- r = (NewHiddenRegion)hiddenRegions[pos];
- }
- }
-
- if (TextSpanHelper.IsSameSpan(r.tsHiddenText, span))
- {
- // This region is already there.
- //
- matched++;
- hiddenRegions.RemoveAt(pos);
- r = (pos < hiddenRegions.Count) ? (NewHiddenRegion)hiddenRegions[pos] : new NewHiddenRegion();
- }
- else
- {
- removed++;
- NativeMethods.ThrowOnFailure(region.Invalidate((int)CHANGE_HIDDEN_REGION_FLAGS.chrNonUndoable));
- }
- }
-
- int start = Environment.TickCount;
-
- if (hiddenRegions.Count > 0)
- {
- int count = hiddenRegions.Count;
-
- // For very large documents this can take a while, so add them in chunks of
- // 1000 and stop after 5 seconds.
- //
- int maxTime = this.LanguageService.Preferences.MaxRegionTime;
- int chunkSize = 1000;
- NewHiddenRegion[] chunk = new NewHiddenRegion[chunkSize];
- int now = Environment.TickCount;
- int i = 0;
-
- while (i < count
-#if DEBUG
- && start > now - maxTime
#endif
- )
- {
- int j = 0;
-
- while (i < count && j < chunkSize)
- {
- r = (NewHiddenRegion)hiddenRegions[i];
-
- if (!TextSpanHelper.ValidSpan(this, r.tsHiddenText))
- {
- //Debug.Assert(false, "Invalid span " + r.tsHiddenText.iStartLine + "," + r.tsHiddenText.iStartIndex + "," + r.tsHiddenText.iEndLine + "," + r.tsHiddenText.iEndIndex);
- break;
- }
- else
- {
- chunk[j] = r;
- added++;
- }
-
- i++;
- j++;
- }
-
- int hr = session.AddHiddenRegions((int)CHANGE_HIDDEN_REGION_FLAGS.chrNonUndoable, j, chunk, null);
-
- if (NativeMethods.Failed(hr))
- break; // stop adding if we start getting errors.
-
- now = Environment.TickCount;
- }
- }
-
- int diff = Environment.TickCount - start;
- Trace.WriteLine(String.Format(CultureInfo.InvariantCulture, "Hidden Regions: Matched={0}, Removed={1}, Addded={2}/{3} in {4} ms", matched, removed, added, hiddenRegions.Count, diff));
- }
- finally
- {
- Marshal.ReleaseComObject(ppenum);
- }
- }
- */
public override void ReformatSpan(EditArray mgr, TextSpan span)
{
More information about the svn
mailing list