[svn] r6752: vs-plugin/trunk:
Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprWalkInfo.n
Nemerle....
IT
svnadmin at nemerle.org
Wed Oct 11 03:47:12 CEST 2006
Log:
Goto by .pdf location.
Author: IT
Date: Wed Oct 11 03:47:05 2006
New Revision: 6752
Modified:
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprWalkInfo.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprWalker.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/GotoInfo.n
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringScope.cs
vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleSource.cs
vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj
vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprWalkInfo.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprWalkInfo.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprWalkInfo.n Wed Oct 11 03:47:05 2006
@@ -9,21 +9,22 @@
public class ExprWalkInfo
{
- internal this(handler : ExprWalkHandler)
- {
- Handler = handler;
- }
-
- public mutable IsStoped : bool;
+ public mutable IsStopped : bool;
public mutable Handler : ExprWalkHandler;
public mutable Node : object;
public mutable Nodes : list[object] = [];
+ internal Init(handler : ExprWalkHandler) : void
+ {
+ Handler = handler;
+ IsStopped = false;
+ }
+
internal Push(node : object) : bool
{
Node = node;
- if (IsStoped || Node == null || Handler == null)
+ if (IsStopped || Node == null || Handler == null)
{
false;
}
@@ -31,7 +32,7 @@
{
Handler(this);
- if (!IsStoped && Node != null)
+ if (!IsStopped && Node != null)
{
Nodes ::= node;
true
@@ -43,7 +44,7 @@
internal Pop() : void
{
- unless (IsStoped)
+ unless (IsStopped)
{
match (Nodes)
{
@@ -57,19 +58,21 @@
{
def walker = ExprWalker();
+ walker.Info.Nodes = Nodes;
+
walk(walker);
- when (IsStoped)
- Nodes = walker.Info.Nodes :: Nodes;
+ when (IsStopped)
+ Nodes = walker.Info.Nodes;
Skip();
}
- public Walk(expr : PExpr) : void { Walk(_.Walk(expr, Handler)) }
- public Walk(expr : TExpr) : void { Walk(_.Walk(expr, Handler)) }
- public Walk(pat : Pattern) : void { Walk(_.Walk(pat, Handler)) }
+ public Walk(node : PExpr) : void { Walk(w => w.Walk(node, Handler)) }
+ public Walk(node : TExpr) : void { Walk(w => w.Walk(node, Handler)) }
+ public Walk(node : Pattern) : void { Walk(w => w.Walk(node, Handler)) }
- public Stop() : void { IsStoped = true }
+ public Stop() : void { IsStopped = true }
public Skip() : void { Node = null }
}
}
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 Wed Oct 11 03:47:05 2006
@@ -14,7 +14,7 @@
{
public class ExprWalker
{
- [Accessor] mutable _info : ExprWalkInfo;
+ [Accessor] mutable _info : ExprWalkInfo = ExprWalkInfo();
private Go(lst : list[P.PExpr]) : void { when (lst != null) foreach (item in lst) Go(item); }
private Go(lst : list[P.ClassMember]) : void { when (lst != null) foreach (item in lst) Go(item); }
@@ -433,19 +433,19 @@
public Walk([NotNull] expression : PExpr, [NotNull] walkHandler : ExprWalkHandler) : void
{
- _info = ExprWalkInfo(walkHandler);
+ _info.Init(walkHandler);
Go(expression);
}
public Walk([NotNull] pattern : Pattern, [NotNull] walkHandler : ExprWalkHandler) : void
{
- _info = ExprWalkInfo(walkHandler);
+ _info.Init(walkHandler);
Go(pattern);
}
public Walk([NotNull] expression : TExpr, [NotNull] walkHandler : ExprWalkHandler) : void
{
- _info = ExprWalkInfo(walkHandler);
+ _info.Init(walkHandler);
Go(expression);
}
}
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/GotoInfo.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/GotoInfo.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/GotoInfo.n Wed Oct 11 03:47:05 2006
@@ -14,9 +14,12 @@
[Accessor] mutable _lineEnd : int;
[Accessor] mutable _colStart : int;
[Accessor] mutable _colEnd : int;
+ [Accessor] mutable _member : IMember;
public this(member : IMember)
{
+ _member = member;
+
SetLocation(member.Location);
}
Modified: vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringScope.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringScope.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/LanguageService/NemerleAuthoringScope.cs Wed Oct 11 03:47:05 2006
@@ -1,4 +1,6 @@
using System;
+using System.Runtime.InteropServices;
+using System.Diagnostics.SymbolStore;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Package;
@@ -85,9 +87,11 @@
GotoInfo info = _project.GetGoto(_filePath, line, col, _sourceText);
- if (info == null || !info.HasLocation)
+ if (info == null)
return null;
+ if (info.HasLocation)
+ {
span.iStartLine = info.LineStart;
span.iEndLine = info.LineEnd;
span.iStartIndex = info.ColStart;
@@ -96,6 +100,57 @@
return info.FilePath;
}
+ if (null != info.Member && !string.IsNullOrEmpty(info.FilePath))
+ {
+ Guid mdiGuid = new Guid("7DAC8207-D3AE-4c75-9B67-92801A497D44");
+ IntPtr mdiPtr = IntPtr.Zero;
+ object mdiUnk;
+
+ if (VSConstants.S_OK == _project.SmartOpenScope.OpenScope(info.FilePath, 0, ref mdiGuid, out mdiUnk))
+ {
+ try
+ {
+ mdiPtr = Marshal.GetIUnknownForObject(mdiUnk);
+
+ SymbolToken token = new SymbolToken(info.Member.GetHandle().MetadataToken);
+ ISymbolBinder1 binder = new SymBinder();
+ ISymbolReader reader = binder.GetReader(mdiPtr, info.FilePath, null);
+ ISymbolMethod method = reader.GetMethod(token);
+
+ if (method.SequencePointCount > 0)
+ {
+ ISymbolDocument[] documents = new ISymbolDocument[1];
+ int[] lines = new int[1];
+ int[] offsets = new int[1];
+ int[] columns = new int[1];
+ int[] endLines = new int[1];
+ int[] endColumns = new int[1];
+
+ method.GetSequencePoints(null, documents, lines, columns, endLines, endColumns);
+
+ span.iStartLine = lines[0] - 1;
+ span.iEndLine = endLines[0] - 1;
+ span.iStartIndex = columns[0] - 1;
+ span.iEndIndex = endColumns[0] - 1;
+
+ return documents[0].URL;
+ }
+ }
+ catch (COMException)
+ {
+ // The file was not found or line numbers were stripped from pdb.
+ }
+ finally
+ {
+ if (IntPtr.Zero != mdiPtr)
+ Marshal.Release(mdiPtr);
+ }
+ }
+ }
+
+ return null;
+ }
+
public override Declarations GetDeclarations(
IVsTextView view, int line, int col, TokenInfo info, ParseReason reason)
{
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 Wed Oct 11 03:47:05 2006
@@ -98,10 +98,7 @@
aspan[0] = GetDocumentSpan();
NativeMethods.ThrowOnFailure(session.EnumHiddenRegions(
- (uint)FIND_HIDDEN_REGION_FLAGS.FHR_BY_CLIENT_DATA,
- 0,//25,
- aspan,
- out ppenum));
+ (uint)FIND_HIDDEN_REGION_FLAGS.FHR_BY_CLIENT_DATA, 25, aspan, out ppenum));
IVsHiddenRegion[] aregion = new IVsHiddenRegion[1];
@@ -144,8 +141,7 @@
// what matches, what needs to be removed, and what needs to be inserted.
//
NewHiddenRegion r = pos < hiddenRegions.Count ?
- (NewHiddenRegion)hiddenRegions[pos] :
- new NewHiddenRegion();
+ (NewHiddenRegion)hiddenRegions[pos] : new NewHiddenRegion();
for (int i = 0, n = regions.Count; i < n; i++)
{
Modified: vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Nemerle.VsIntegration.csproj Wed Oct 11 03:47:05 2006
@@ -68,6 +68,7 @@
ProjectReference to Nemerle projects.
-->
<Reference Include="..\Nemerle.Compiler.Utils\bin\$(Configuration)\Nemerle.Compiler.Utils.dll" />
+ <Reference Include="ISymWrapper" />
</ItemGroup>
<ItemGroup>
<Compile Include="Project\ScopeNode.cs" />
Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/ProjectInfo.cs Wed Oct 11 03:47:05 2006
@@ -88,6 +88,11 @@
get { return _projectsInfos; }
}
+ public IVsSmartOpenScope SmartOpenScope
+ {
+ get { return (IVsSmartOpenScope)_site.GetService(typeof (SVsSmartOpenScope)); }
+ }
+
#region Project References
public void AddAssembly(AssemblyName assemblyName)
More information about the svn
mailing list