[svn] r6620: vs-plugin/trunk:
Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerMessage.n
Nemerle.Compile...
IT
svnadmin at nemerle.org
Wed Sep 6 03:26:09 CEST 2006
Log:
Message/error/hint highlighting.
Author: IT
Date: Wed Sep 6 03:26:04 2006
New Revision: 6620
Modified:
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerMessage.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.CompilerMessages.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Init.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/SourceCollection.n
vs-plugin/trunk/Nemerle.VsIntegration/Engine/ProjectInfo.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerleLanguage.cs
vs-plugin/trunk/Nemerle.VsIntegration/Parsing/NemerleAuthoringScope.cs
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerMessage.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerMessage.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CompilerMessage.n Wed Sep 6 03:26:04 2006
@@ -3,6 +3,7 @@
namespace Nemerle.Completion2
{
+ [Record]
public class CompilerMessage
{
public mutable Message : string;
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine-main.n Wed Sep 6 03:26:04 2006
@@ -27,7 +27,7 @@
ClearRelocationMaps();
ClearCompilerMessages();
Instance = this;
- Init ();
+ Init();
// lexing of the NotParsed files
// we save the parsed files to improve performance
@@ -75,13 +75,13 @@
}
catch { | _e => Trace.WriteLine(_e); }
- // xz. Âđîäĺ ęŕę çŕíčěŕĺňń˙ ďîńňđîĺíčĺě ĺäčíîăî äĺđĺâŕ ňčďîâ č đŕçđĺřĺíč˙ ńńűëîę.
+ // xz. Looks like it's building types' tree and is resolving references.
try { this.Hierarchy.Run(); }
catch { | _e => Trace.WriteLine(_e); }
def nsTree = NameTree.NamespaceTree;
- /// Ďđîáĺăŕĺňń˙ ďî ďđîńňđŕíńňâŕě čěĺí äë˙ ęŕćäîăî ôŕéëŕ
+ // Go through namespaces for each file.
def AddTypeBilders(@namespace, index, nsTree)
{
def node = @namespace.InsideEnv.CurrentNamespace;
@@ -93,12 +93,7 @@
foreach (subNode in node.Children.Values)
match (subNode.Value)
{
- | Cached(tc) =>//TypeInfoCache.
- match (tc)
- {
- | tb is TypeBuilder =>
- def tb = tb;
-
+ | Cached(tb is TypeBuilder) =>
//FixMe: match (tb.PartsLocation.Find(loc => loc.FileIndex == index))
// unresolved expression: accessing member `FileIndex' in `loc' : Nemerle.Compiler.Location
// at Nemerle.Compiler.Typer2.Unfold(TExpr expr) in D:\MyProjects\RSDN\Nemerle\nemerle\ncc\typing\Typer2.n:line 198
@@ -110,8 +105,6 @@
}
| _ => ()
}
- | _ => ()
- }
// Sort declarations by first part of locatoin.
@namespace.Decls = Nemerle.Collections.List.Sort(
@@ -127,7 +120,6 @@
when (_fileInfos[i] != null)
AddTypeBilders(_fileInfos[i], i, nsTree);
-
Project(this, CompileUnitCollection(this, _fileInfos), nsTree)
}
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.CompilerMessages.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.CompilerMessages.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.CompilerMessages.n Wed Sep 6 03:26:04 2006
@@ -1,67 +1,45 @@
using System;
-using System.IO;
-using System.Diagnostics;
using SCG = System.Collections.Generic;
-using Nemerle.Assertions;
-using Nemerle.Collections;
+
using Nemerle.Compiler;
-using Nemerle.Compiler.Parsetree;
-using Nemerle.Imperative;
using Nemerle.Utility;
-using Nemerle.Compiler.Utils;
-using Typed = Nemerle.Compiler.Typedtree;
-using SR = System.Reflection;
-
-
namespace Nemerle.Completion2
{
public partial class Engine
{
+ [Accessor(flags=WantSetter)] mutable _processMessages : bool;
+
+ _listMessages : SCG.List[CompilerMessage] = SCG.List();
+
public ClearCompilerMessages() : void
{
+ when (_processMessages)
_listMessages.Clear();
}
- public AddCompilerMessage(location : Location, kind : MessageKind, message : string) : void
+ public AddCompilerMessage(message : string, location : Location, kind : MessageKind, ) : void
{
- mutable error = CompilerMessage();
- error.MessageKind = kind;
- error.Location = location;
- error.Message = message;
- _listMessages.Add(error);
+ when (_processMessages)
+ _listMessages.Add(CompilerMessage(message, location, kind));
}
- public AddErrorMessage(location : Location, message : string) : void
+ ProcessCompilerMessage(location : Location, message : string) : void
{
- AddCompilerMessage(location, MessageKind.Error, message);
- }
-
- public AddWarningMessage(location : Location, message : string) : void
+ def Check(text, add)
{
- AddCompilerMessage(location, MessageKind.Warning, message);
- }
-
- public AddHintMessage(location : Location, message : string) : void
+ if (message.IndexOf(text) >= 0)
{
- AddCompilerMessage(location, MessageKind.Hint, message);
+ add(message.Substring(message.IndexOf(text) + text.Length), location);
+ true
+ }
+ else
+ false
}
- _listMessages : SCG.List[CompilerMessage] = SCG.List();
-
- ProcessErrorMessage(location : Location, message : string) : void
- {
- mutable error = CompilerMessage();
- error.Location = location;
- if (message.IndexOf ("error: ") != -1)
- AddErrorMessage(location, message.Substring(
- message.IndexOf("error: ")).Replace ("error: ", ""));
- else if (message.IndexOf("warning: ") != -1)
- AddWarningMessage(location, message.Substring(
- message.IndexOf("warning: ")).Replace("warning: ", ""));
- else when (message.IndexOf ("hint: ") != -1)
- AddHintMessage(location, message.Substring(
- message.IndexOf("hint: ")).Replace("hint: ", ""));
+ _= Check("error: ", AddCompilerMessage(_, _, MessageKind.Error))
+ || Check("warning: ", AddCompilerMessage(_, _, MessageKind.Warning))
+ || Check("hint: ", AddCompilerMessage(_, _, MessageKind.Hint));
}
} // end class Engine
} // end namespace
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Init.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Init.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Engine/Engine.Init.n Wed Sep 6 03:26:04 2006
@@ -34,7 +34,7 @@
_defines = DefineCollection (this);
_references = ReferenceCollection (this);
_sources = SourceCollection ();
- MessageOccured += ProcessErrorMessage;
+ MessageOccured += ProcessCompilerMessage;
Options.GreedyReferences = true;
Options.ColorMessages = false;
Options.IgnoreConfusion = true;
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/SourceCollection.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/SourceCollection.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/SourceCollection.n Wed Sep 6 03:26:04 2006
@@ -21,9 +21,9 @@
internal mutable _sources : Hashtable[string, ParsedFile];
- public AddOrUpdate (file : string, contents : string) : void
+ public AddOrUpdate (file : string, content : string) : void
{
- _sources[file] = ParsedFile.NotParsed(contents);
+ _sources[file] = ParsedFile.NotParsed(content);
}
public Remove (dile : string) : void
Modified: vs-plugin/trunk/Nemerle.VsIntegration/Engine/ProjectInfo.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Engine/ProjectInfo.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Engine/ProjectInfo.cs Wed Sep 6 03:26:04 2006
@@ -115,11 +115,11 @@
#endregion
/// <summary>
- /// Ĺńëč ôŕéë ďîäęëţ÷ĺí ę ďđîĺęňó, ňî âîçâđŕůŕĺňń˙ ĺăî timestamp (âĺđńč˙).
- /// Číŕ÷ĺ âîçâđŕůŕĺňń˙ 0.
+ /// If the provided file is attached to the project, its timestamp (version) is returned.
+ /// Otherwise 0.
/// </summary>
/// <param name="filePath">
- /// Ďîëíűé ďóňü ę ôŕéëó äë˙ ęîňîđîăî íóćíî óçíŕňü timestamp.
+ /// Full file path.
/// </param>
public int GetFileTimestamp(string filePath)
{
@@ -144,12 +144,12 @@
if (timestamp != oldTimestamp)
{
- Engine.Sources.AddOrUpdate(filePath, GetFileContant(request));
+ Engine.Sources.AddOrUpdate(filePath, GetFileContent(request));
_filesMap[filePath] = timestamp;
}
}
- string GetFileContant(ParseRequest request)
+ string GetFileContent(ParseRequest request)
{
string text = request.Text;
Modified: vs-plugin/trunk/Nemerle.VsIntegration/NemerleLanguage.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/NemerleLanguage.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/NemerleLanguage.cs Wed Sep 6 03:26:04 2006
@@ -169,6 +169,10 @@
if (projectInfo == null)
return null;
+ projectInfo.Engine.ProcessMessages = true;
+
+ try
+ {
projectInfo.UpdateFile(request);
Project project = projectInfo.Engine.GetProject();
@@ -196,6 +200,11 @@
{
return GetCodeRegion(request, lineStart - 1, colStart - 1, lineEnd - 1, colEnd - 1);
});
+ }
+ finally
+ {
+ projectInfo.Engine.ProcessMessages = false;
+ }
return GetDefaultScope(request);
}
Modified: vs-plugin/trunk/Nemerle.VsIntegration/Parsing/NemerleAuthoringScope.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Parsing/NemerleAuthoringScope.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Parsing/NemerleAuthoringScope.cs Wed Sep 6 03:26:04 2006
@@ -98,6 +98,9 @@
private void ShowCompilerMessages()
{
+ return;
+
+ /*
CompilerMessage[] errors = _project.Project.Engine.CompilerMessages;
TaskProvider taskProvider = _sink.Source.GetTaskProvider();
@@ -123,6 +126,7 @@
{
taskProvider.ResumeRefresh(); // batch updates.
}
+ */
}
}
}
More information about the svn
mailing list