Skip to content

Commit 635e955

Browse files
author
Paul van Brenk
committed
PR feedback
1 parent 943933f commit 635e955

File tree

3 files changed

+5
-37
lines changed

3 files changed

+5
-37
lines changed

Nodejs/Product/Nodejs/NodejsPackage.cs

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
using System.Diagnostics;
77
using System.Globalization;
88
using System.IO;
9-
using System.Linq;
109
using System.Runtime.InteropServices;
1110
using System.Windows.Forms;
1211
using Microsoft.NodejsTools.Commands;
1312
using Microsoft.NodejsTools.Debugger.DebugEngine;
1413
using Microsoft.NodejsTools.Debugger.Remote;
1514
using Microsoft.NodejsTools.Jade;
16-
using Microsoft.NodejsTools.Logging;
1715
using Microsoft.NodejsTools.Options;
1816
using Microsoft.NodejsTools.Project;
1917
using Microsoft.NodejsTools.ProjectWizard;
@@ -72,7 +70,7 @@ internal sealed partial class NodejsPackage : CommonPackage
7270

7371
// Hold references for the subscribed events. Otherwise the callbacks will be garbage collected
7472
// after the initialization
75-
private List<EnvDTE.CommandEvents> _subscribedCommandEvents = new List<EnvDTE.CommandEvents>();
73+
private readonly List<EnvDTE.CommandEvents> subscribedCommandEvents = new List<EnvDTE.CommandEvents>();
7674

7775
/// <summary>
7876
/// Default constructor of the package.
@@ -125,19 +123,18 @@ protected override void Initialize()
125123
new SendFeedbackCommand(),
126124
new ShowDocumentationCommand()
127125
};
126+
128127
try
129128
{
130129
commands.Add(new AzureExplorerAttachDebuggerCommand());
131130
}
132131
catch (NotSupportedException)
133132
{
134133
}
135-
RegisterCommands(commands, Guids.NodejsCmdSet);
136134

135+
RegisterCommands(commands, Guids.NodejsCmdSet);
137136
MakeDebuggerContextAvailable();
138137

139-
InitializeTelemetry();
140-
141138
// The variable is inherited by child processes backing Test Explorer, and is used in
142139
// the NTVS test discoverer and test executor to connect back to VS.
143140
Environment.SetEnvironmentVariable(NodejsConstants.NodeToolsProcessIdEnvironmentVariable, Process.GetCurrentProcess().Id.ToString());
@@ -172,14 +169,7 @@ private void SubscribeToVsCommandEvents(
172169
{
173170
targetEvent.AfterExecute += afterExecute;
174171
}
175-
this._subscribedCommandEvents.Add(targetEvent);
176-
}
177-
178-
private void InitializeTelemetry()
179-
{
180-
// Fetch the session synchronously on the UI thread; if this doesn't happen before we try using this on
181-
// the background thread then the VS process will deadlock.
182-
TelemetryHelper.Initialize();
172+
this.subscribedCommandEvents.Add(targetEvent);
183173
}
184174

185175
public new IComponentModel ComponentModel => this.GetComponentModel();
@@ -349,15 +339,5 @@ public string BrowseForDirectory(IntPtr owner, string initialDirectory = null)
349339
}
350340
}
351341
}
352-
353-
internal static void NavigateTo(string filename, int line, int col)
354-
{
355-
VsUtilities.NavigateTo(Instance, filename, Guid.Empty, line, col);
356-
}
357-
358-
internal static void NavigateTo(string filename, int pos)
359-
{
360-
VsUtilities.NavigateTo(Instance, filename, Guid.Empty, pos);
361-
}
362342
}
363343
}

Nodejs/Product/Nodejs/Project/NodejsProjectLauncher.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,10 @@ public NodejsProjectLauncher(NodejsProjectNode project)
5252
#region IProjectLauncher Members
5353
public int LaunchProject(bool debug)
5454
{
55-
return Start(ResolveStartupFile(), debug);
55+
return LaunchFile(ResolveStartupFile(), debug);
5656
}
5757

5858
public int LaunchFile(string file, bool debug)
59-
{
60-
return Start(file, debug);
61-
}
62-
63-
private int Start(string file, bool debug)
6459
{
6560
var nodePath = GetNodePath();
6661

Nodejs/Product/Nodejs/Telemetry/TelemetryHelper.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
22

3-
using Microsoft.VisualStudio.Shell;
43
using Microsoft.VisualStudio.Telemetry;
54
using static Microsoft.NodejsTools.Telemetry.TelemetryEvents;
65
using static Microsoft.NodejsTools.Telemetry.TelemetryProperties;
@@ -12,12 +11,6 @@ namespace Microsoft.NodejsTools.Telemetry
1211
/// </summary>
1312
internal static class TelemetryHelper
1413
{
15-
public static void Initialize()
16-
{
17-
ThreadHelper.ThrowIfNotOnUIThread();
18-
var defaultSession = TelemetryService.DefaultSession;
19-
}
20-
2114
public static void LogProjectImported()
2215
{
2316
TelemetryService.DefaultSession.PostUserTask(ProjectImported, TelemetryResult.Success);

0 commit comments

Comments
 (0)