Skip to content

Commit a9a84b9

Browse files
committed
Merge pull request #177 from vosen/master
Small changes and cleanups
2 parents b459a20 + d474213 commit a9a84b9

10 files changed

+42
-24
lines changed

VisualRust.Project/DefaultRustLauncher.cs

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,20 @@ private void LaunchInGdbDebugger(string file)
124124
{
125125
writer.WriteAttributeString("WorkingDirectory", EscapePath(debugConfig.WorkingDir));
126126
// GDB won't search working directory by default, but this is expected on Windows.
127-
writer.WriteAttributeString("AdditionalSOLibSearchPath", debugConfig.WorkingDir);
127+
string rustBinPath = RustBinPath();
128+
string additionalPath;
129+
if (rustBinPath != null)
130+
additionalPath = rustBinPath + ";" + debugConfig.WorkingDir;
131+
else
132+
additionalPath = debugConfig.WorkingDir;
133+
writer.WriteAttributeString("AdditionalSOLibSearchPath", additionalPath);
128134
}
129135
else
130136
{
131137
writer.WriteAttributeString("WorkingDirectory", EscapePath(Path.GetDirectoryName(file)));
138+
string rustBinPath = RustBinPath();
139+
if(rustBinPath != null)
140+
writer.WriteAttributeString("AdditionalSOLibSearchPath", rustBinPath);
132141
}
133142
// this affects the number of bytes the engine reads when disassembling commands,
134143
// x64 has the largest maximum command size, so it should be safe to use for x86 as well
@@ -155,10 +164,6 @@ private void LaunchInGdbDebugger(string file)
155164

156165
IVsDebugger4 vsDebugger = (IVsDebugger4)project.GetService(typeof(SVsShellDebugger));
157166
vsDebugger.LaunchDebugTargets4((uint)targets.Length, targets, results);
158-
159-
// Type "gdb <command>" in the VS Command Window
160-
var commandWnd = (IVsCommandWindow)project.GetService(typeof(SVsCommandWindow));
161-
commandWnd.ExecuteCommand("alias gdb Debug.GDBExec");
162167
}
163168

164169
private string GuessArchitecture()
@@ -247,21 +252,26 @@ private ProcessStartInfo CreateProcessStartInfo(string startupFile)
247252
return startInfo;
248253
}
249254

250-
private void InjectRustBinPath(ProcessStartInfo startInfo)
255+
private string RustBinPath()
251256
{
252257
EnvDTE.Project proj = project.GetAutomationObject() as EnvDTE.Project;
253-
if(proj == null)
254-
return;
258+
if (proj == null)
259+
return null;
255260
string currentConfigName = Utilities.GetActiveConfigurationName(proj);
256-
if(currentConfigName == null)
257-
return;
258-
ProjectConfig currentConfig = project.ConfigProvider.GetProjectConfiguration(currentConfigName);
259-
if(currentConfig == null)
260-
return;
261+
if (currentConfigName == null)
262+
return null;
263+
ProjectConfig currentConfig = project.ConfigProvider.GetProjectConfiguration(currentConfigName);
264+
if (currentConfig == null)
265+
return null;
261266
string currentTarget = currentConfig.GetConfigurationProperty("PlatformTarget", true);
262-
if(currentTarget == null)
263-
currentTarget = Shared.Environment.DefaultTarget;
264-
string installPath = Shared.Environment.FindInstallPath(currentTarget);
267+
if (currentTarget == null)
268+
currentTarget = Shared.Environment.DefaultTarget;
269+
return Shared.Environment.FindInstallPath(currentTarget);
270+
}
271+
272+
private void InjectRustBinPath(ProcessStartInfo startInfo)
273+
{
274+
string installPath = RustBinPath();
265275
if(installPath == null)
266276
return;
267277
string envPath = Environment.GetEnvironmentVariable("PATH");

VisualRust.Setup/racer2013.wxs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<Directory Id="Dir_Racer_$(var.VsVersion)" Name="Racer"/>
77
</DirectoryRef>
88
<ComponentGroup Id="CmpGroup_Racer_$(var.VsVersion)" Directory="Dir_Racer_$(var.VsVersion)">
9-
<Component Id="Cmp_racer_bf2373e_exe_$(var.VsVersion)" Guid="{BC0C9FDF-6495-457E-9F8D-38FAC0202544}">
10-
<File Id="File_racer_bf2373e_exe_$(var.VsVersion)" KeyPath="yes" Source="$(var.VisualRust.TargetDir)\Racer\racer-bf2373e.exe" />
9+
<Component Id="Cmp_racer_120e98b_exe_$(var.VsVersion)" Guid="{A3019A3B-A2F6-4B06-AC42-370B2945A8FB}">
10+
<File Id="File_racer_120e98b_exe_$(var.VsVersion)" KeyPath="yes" Source="$(var.VisualRust.TargetDir)\Racer\racer-120e98b.exe" />
1111
</Component>
1212
<Component Id="Cmp_libgcc_s_dw2_1_dll_$(var.VsVersion)" Guid="{E64B2509-45B7-485E-822A-4274127D23E4}">
1313
<File Id="File_libgcc_s_dw2_1_dll_$(var.VsVersion)" KeyPath="yes" Source="$(var.VisualRust.TargetDir)\Racer\libgcc_s_dw2-1.dll" />

VisualRust.Setup/racer2015.wxs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<Directory Id="Dir_Racer_$(var.VsVersion)" Name="Racer"/>
77
</DirectoryRef>
88
<ComponentGroup Id="CmpGroup_Racer_$(var.VsVersion)" Directory="Dir_Racer_$(var.VsVersion)">
9-
<Component Id="Cmp_racer_bf2373e_exe_$(var.VsVersion)" Guid="{7EB0A233-EA92-4B8A-AA94-538B71F6945F}">
10-
<File Id="File_racer_bf2373e_exe_$(var.VsVersion)" KeyPath="yes" Source="$(var.VisualRust.TargetDir)\Racer\racer-bf2373e.exe" />
9+
<Component Id="Cmp_racer_120e98b_exe_$(var.VsVersion)" Guid="{382AAA98-783C-46CD-A028-91D9864C4DA8}">
10+
<File Id="File_racer_120e98b_exe_$(var.VsVersion)" KeyPath="yes" Source="$(var.VisualRust.TargetDir)\Racer\racer-120e98b.exe" />
1111
</Component>
1212
<Component Id="Cmp_libgcc_s_dw2_1_dll_$(var.VsVersion)" Guid="{7C4DDC79-CD34-47B8-9C9C-3288D445588F}">
1313
<File Id="File_libgcc_s_dw2_1_dll_$(var.VsVersion)" KeyPath="yes" Source="$(var.VisualRust.TargetDir)\Racer\libgcc_s_dw2-1.dll" />

VisualRust/Racer/RacerSingleton.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace VisualRust.Racer
1616
public class RacerSingleton
1717
{
1818
private const string SystemRacerExecutable = "racer.exe";
19-
private const string BundledRacerExecutable = "racer-bf2373e.exe";
19+
private const string BundledRacerExecutable = "racer-120e98b.exe";
2020
private const string RacerSourceEnviromentVariable = "RUST_SRC_PATH";
2121
private const int TimeoutMillis = 3000;
2222

VisualRust/Racer/racer-120e98b.exe

8.84 MB
Binary file not shown.

VisualRust/Racer/racer-bf2373e.exe

-23.2 MB
Binary file not shown.

VisualRust/RustClassifier.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ public IEnumerable<ITagSpan<ClassificationTag>> GetTags(NormalizedSnapshotSpanCo
142142
realStart = curSpan.Start.Position + token.StartIndex - multilinePrefixSize;
143143
realTokenLength = token.Text.Length;
144144
}
145-
var tokenSpan = new SnapshotSpan(curSpan.Snapshot, new Span(realStart, realTokenLength));
145+
// This little check is required because, we are sometimes called (eg. when copying in vs2015) on a span smaller than a whole line
146+
var tokenRange = new Span(realStart, realTokenLength).Intersection(curSpan);
147+
if (!tokenRange.HasValue)
148+
continue;
149+
var tokenSpan = new SnapshotSpan(curSpan.Snapshot, tokenRange.Value);
146150
yield return new TagSpan<ClassificationTag>(tokenSpan, new ClassificationTag(_rustTypes[Utils.LexerTokenToRustToken(token.Text, token.Type)]));
147151
}
148152
}

VisualRust/RustGoToDefinitionCommandHandler.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ protected override bool Execute(VSConstants.VSStd97CmdID command, uint options,
8989
}
9090
return true;
9191
}
92+
else
93+
{
94+
Utils.PrintToOutput(findOutput);
95+
}
9296

9397
}
9498
return false;

VisualRust/Utils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ internal static void PrintToOutput(string s, params object[] args)
262262
IVsOutputWindowPane pane;
263263
ErrorHandler.ThrowOnFailure(outWindow.CreatePane(paneGuid, "General", 1, 0));
264264
outWindow.GetPane(ref paneGuid, out pane);
265-
pane.OutputString(string.Format("[VisualRust]: " + s, args) + "\n");
265+
pane.OutputString(string.Format("[Visual Rust]: " + s, args));
266266
pane.Activate();
267267
}
268268

VisualRust/VisualRust.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
294294
<IncludeInVSIX>true</IncludeInVSIX>
295295
</Content>
296-
<Content Include="Racer\racer-bf2373e.exe">
296+
<Content Include="Racer\racer-120e98b.exe">
297297
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
298298
<IncludeInVSIX>true</IncludeInVSIX>
299299
</Content>

0 commit comments

Comments
 (0)