Skip to content

Commit b67fbed

Browse files
committed
More candidates and json consistency
1 parent 4c749b0 commit b67fbed

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

Packages/com.unity.ide.visualstudio/Editor/VisualStudioCodeInstallation.cs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,13 @@ public static IEnumerable<IVisualStudioInstallation> GetVisualStudioInstallation
127127
if (VisualStudioEditor.IsWindows)
128128
{
129129
var localAppPath = IOPath.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Programs");
130-
candidates.Add(IOPath.Combine(localAppPath, "Microsoft VS Code", "Code.exe"));
131-
candidates.Add(IOPath.Combine(localAppPath, "Microsoft VS Code Insiders", "Code - Insiders.exe"));
130+
var programFiles = IOPath.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
131+
132+
foreach (var basePath in new[] {localAppPath, programFiles})
133+
{
134+
candidates.Add(IOPath.Combine(basePath, "Microsoft VS Code", "Code.exe"));
135+
candidates.Add(IOPath.Combine(basePath, "Microsoft VS Code Insiders", "Code - Insiders.exe"));
136+
}
132137
} else if (VisualStudioEditor.IsOSX)
133138
{
134139
var appPath = IOPath.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
@@ -170,6 +175,19 @@ private static void CreateLaunchFile(string vscodeDirectory)
170175
var launchFile = IOPath.Combine(vscodeDirectory, "launch.json");
171176
if (File.Exists(launchFile))
172177
return;
178+
179+
const string content = @"{
180+
""version"": ""0.2.0"",
181+
""configurations"": [
182+
{
183+
""name"": ""Attach to Unity"",
184+
""type"": ""vstuc"",
185+
""request"": ""attach"",
186+
}
187+
]
188+
}";
189+
190+
File.WriteAllText(launchFile, content);
173191
}
174192

175193
private static void CreateSettingsFile(string vscodeDirectory)
@@ -244,9 +262,9 @@ private static void CreateRecommendedExtensionsFile(string vscodeDirectory)
244262
return;
245263

246264
const string content = @"{
247-
""recommendations"": [
248-
""ms-dotnettools.csharp""
249-
]
265+
""recommendations"": [
266+
""visualstudiotoolsforunity.vstuc""
267+
]
250268
}
251269
";
252270
File.WriteAllText(extensionFile, content);

0 commit comments

Comments
 (0)