fix error

This commit is contained in:
YoungwoongLee
2024-03-13 10:49:18 +09:00
parent d8cea915c9
commit d6c936c606
66 changed files with 699 additions and 119 deletions

7
CHANGELOG.md.meta Normal file
View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e3cceb39029f44e4d8c39cb2a333bed2
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

7
CONTRIBUTING.md.meta Normal file
View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: eeba022f52d13c04e992f4d8b0624352
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Editor.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bf5103b4b65105d449e08afc5b0313be
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e742243860d1a8f409a85e49176adc10
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4feb2e7db71d34d40a7e4c0cf33765aa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 79136730e61b87043bff73e5d2be7151
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a92aed9328d17a74d97b976bd0ba80da
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2d8ba14fe0a703a46a0112cb50c1f802
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

11
Editor/Cli.cs.meta Normal file
View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 119670827e2bdfb4c8bab8ae43a91bf6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Editor/Discovery.cs.meta Normal file
View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b9e6525873b60214bac98a2611001065
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fa3cfc2997f49b943b10f66c511ab9b7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Editor/Image.cs.meta Normal file
View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8c2650c3659765147bb1ecb95c04f931
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 876a40e26248b4d49bb090978f2428d8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Editor/Messaging.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: edf1e631e73499647a7b28951b9910ef
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4158afe0f3ba24543b5573829095c090
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a60ca3635cca04b42a8b5b83471bbb2a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b76af5429092a58459912042d3474e74
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 53f72b24585bb564ebdf15944b1a9a78
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bca6d6cb5c976544d83d550e80d0ab10
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 66e2b0fc0f2800148be21743edd56c07
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1903487170519b940925e4d60121d63b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e1eb5180dca1e6e4c80f16fe1e89ab5f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4aac9ec2e87e1df429254b46ea93ee54
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 982947b2e8aa7aa439af7f60a14251b8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Editor/Plugins.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2267e5a8629ec3e4f954d2e5112e3294
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,27 @@
fileFormatVersion: 2
guid: bdd5044780319f34c81bf410b95e0453
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 35f2ac7e588f7f0488890c2eb8eb713b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 39f6c5735f4896746a1bcfa95716cdfb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7c09dc04e9f01884b939d6c1087f95ed
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a78bf80420cfff243be0a089839e1214
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 10c92ccf16d421947abfe28eb5247869
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d5201e27b238df341abb6ede328238d8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e43e4f00a4b35e741b8d658b792c38e7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 56544889635e6154d8f3b295bdfeca38
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 124f613b45b45af49bc986c5cf48f93e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c449403aa776a1d4daca10ff808d30de
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Editor/SimpleJSON.cs.meta Normal file
View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f14a73997ecfc3a49a8b5e46a49c4f4f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Editor/Solution.cs.meta Normal file
View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 27bc8a57b00ccec44945a7db9acf9b3b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2f5aa66aee329a04d9fc7805f908ae6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 34cd2d7b80a45a344b72e4c60d1c22ba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 53157d8310cfca940bb22bf101b2c275
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Editor/Symbols.cs.meta Normal file
View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4f11f75003f55a8408825edd475b9204
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Editor/Testing.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d83b86f0bc6c70b4ba02a9c9f24c865e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 606e2ff16916e884c904be431b4311f3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cd85aa8281e57264ebb6fc4ec8abae25
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a5f5f778f126f0542a5a9c3eb6ce9be4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a2d33327b38d0dd45a27a726a560ab0f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 14de30b850ab54040b195d012eef71fc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 795c5c262a77f1849970ef8abb2aea55
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2b920fd559dbf4a4ba9d960411e3414e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Editor/VSWhere.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ab378124d52ce0f498e46271d915f588
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0cc03a84149fbf24987d62822ee55a04
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 75ebc31926260bd4ab99ffc2dc72b327
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -13,30 +13,23 @@ using UnityEngine;
using SimpleJSON;
using IOPath = System.IO.Path;
namespace Microsoft.Unity.VisualStudio.Editor
{
internal class VisualStudioCodeInstallation : VisualStudioInstallation
{
namespace Microsoft.Unity.VisualStudio.Editor {
internal class VisualStudioCodeInstallation : VisualStudioInstallation {
private static readonly IGenerator _generator = new SdkStyleProjectGeneration();
public override bool SupportsAnalyzers
{
get
{
public override bool SupportsAnalyzers {
get {
return true;
}
}
public override Version LatestLanguageVersionSupported
{
get
{
public override Version LatestLanguageVersionSupported {
get {
return new Version(11, 0);
}
}
private string GetExtensionPath()
{
private string GetExtensionPath() {
var vscode = IsPrerelease ? ".vscode-insiders" : ".vscode";
var extensionsPath = IOPath.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), vscode, "extensions");
if (!Directory.Exists(extensionsPath))
@@ -48,8 +41,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
.FirstOrDefault();
}
public override string[] GetAnalyzers()
{
public override string[] GetAnalyzers() {
var vstuPath = GetExtensionPath();
if (string.IsNullOrEmpty(vstuPath))
return Array.Empty<string>();
@@ -57,34 +49,29 @@ namespace Microsoft.Unity.VisualStudio.Editor
return GetAnalyzers(vstuPath);
}
public override IGenerator ProjectGenerator
{
get
{
public override IGenerator ProjectGenerator {
get {
return _generator;
}
}
private static bool IsCandidateForDiscovery(string path)
{
private static bool IsCandidateForDiscovery(string path) {
#if UNITY_EDITOR_OSX
return Directory.Exists(path) && Regex.IsMatch(path, ".*Code.*.app$", RegexOptions.IgnoreCase);
return Directory.Exists(path) && Regex.IsMatch(path, ".*Cursor.*.app$", RegexOptions.IgnoreCase);
#elif UNITY_EDITOR_WIN
return File.Exists(path) && Regex.IsMatch(path, ".*Code.*.exe$", RegexOptions.IgnoreCase);
return File.Exists(path) && Regex.IsMatch(path, ".*Cursor.*.exe$", RegexOptions.IgnoreCase);
#else
return File.Exists(path) && path.EndsWith("code", StringComparison.OrdinalIgnoreCase);
return File.Exists(path) && path.EndsWith("cursor", StringComparison.OrdinalIgnoreCase);
#endif
}
[Serializable]
internal class VisualStudioCodeManifest
{
internal class VisualStudioCodeManifest {
public string name;
public string version;
}
public static bool TryDiscoverInstallation(string editorPath, out IVisualStudioInstallation installation)
{
public static bool TryDiscoverInstallation(string editorPath, out IVisualStudioInstallation installation) {
installation = null;
if (string.IsNullOrEmpty(editorPath))
@@ -96,8 +83,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
Version version = null;
var isPrerelease = false;
try
{
try {
var manifestBase = GetRealPath(editorPath);
#if UNITY_EDITOR_WIN
@@ -117,21 +103,17 @@ namespace Microsoft.Unity.VisualStudio.Editor
return false;
var manifestFullPath = IOPath.Combine(manifestBase, "resources", "app", "package.json");
if (File.Exists(manifestFullPath))
{
if (File.Exists(manifestFullPath)) {
var manifest = JsonUtility.FromJson<VisualStudioCodeManifest>(File.ReadAllText(manifestFullPath));
Version.TryParse(manifest.version.Split('-').First(), out version);
isPrerelease = manifest.version.ToLower().Contains("insider");
}
}
catch (Exception)
{
} catch (Exception) {
// do not fail if we are not able to retrieve the exact version number
}
isPrerelease = isPrerelease || editorPath.ToLower().Contains("insider");
installation = new VisualStudioCodeInstallation()
{
installation = new VisualStudioCodeInstallation() {
IsPrerelease = isPrerelease,
Name = "Cursor" + (isPrerelease ? " - Insider" : string.Empty) + (version != null ? $" [{version.ToString(3)}]" : string.Empty),
Path = editorPath,
@@ -141,16 +123,14 @@ namespace Microsoft.Unity.VisualStudio.Editor
return true;
}
public static IEnumerable<IVisualStudioInstallation> GetVisualStudioInstallations()
{
public static IEnumerable<IVisualStudioInstallation> GetVisualStudioInstallations() {
var candidates = new List<string>();
#if UNITY_EDITOR_WIN
var localAppPath = IOPath.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Programs");
var programFiles = IOPath.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
foreach (var basePath in new[] {localAppPath, programFiles})
{
foreach (var basePath in new[] { localAppPath, programFiles }) {
candidates.Add(IOPath.Combine(basePath, "Microsoft VS Code Insiders", "Code - Insiders.exe"));
}
#elif UNITY_EDITOR_OSX
@@ -166,8 +146,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
candidates.AddRange(GetXdgCandidates());
#endif
foreach (var candidate in candidates.Distinct())
{
foreach (var candidate in candidates.Distinct()) {
if (TryDiscoverInstallation(candidate, out var installation))
yield return installation;
}
@@ -222,16 +201,13 @@ namespace Microsoft.Unity.VisualStudio.Editor
return new String(cbuf, 0, chars);
}
#else
internal static string GetRealPath(string path)
{
internal static string GetRealPath(string path) {
return path;
}
#endif
public override void CreateExtraFiles(string projectDirectory)
{
try
{
public override void CreateExtraFiles(string projectDirectory) {
try {
var vscodeDirectory = IOPath.Combine(projectDirectory.NormalizePathSeparators(), ".vscode");
Directory.CreateDirectory(vscodeDirectory);
@@ -240,9 +216,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
CreateRecommendedExtensionsFile(vscodeDirectory, enablePatch);
CreateSettingsFile(vscodeDirectory, enablePatch);
CreateLaunchFile(vscodeDirectory, enablePatch);
}
catch (IOException)
{
} catch (IOException) {
}
}
@@ -257,11 +231,9 @@ namespace Microsoft.Unity.VisualStudio.Editor
]
}";
private static void CreateLaunchFile(string vscodeDirectory, bool enablePatch)
{
private static void CreateLaunchFile(string vscodeDirectory, bool enablePatch) {
var launchFile = IOPath.Combine(vscodeDirectory, "launch.json");
if (File.Exists(launchFile))
{
if (File.Exists(launchFile)) {
if (enablePatch)
PatchLaunchFile(launchFile);
@@ -271,10 +243,8 @@ namespace Microsoft.Unity.VisualStudio.Editor
File.WriteAllText(launchFile, DefaultLaunchFileContent);
}
private static void PatchLaunchFile(string launchFile)
{
try
{
private static void PatchLaunchFile(string launchFile) {
try {
const string configurationsKey = "configurations";
const string typeKey = "type";
@@ -282,8 +252,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
var launch = JSONNode.Parse(content);
var configurations = launch[configurationsKey] as JSONArray;
if (configurations == null)
{
if (configurations == null) {
configurations = new JSONArray();
launch.Add(configurationsKey, configurations);
}
@@ -295,18 +264,14 @@ namespace Microsoft.Unity.VisualStudio.Editor
configurations.Add(defaultContent[configurationsKey][0]);
WriteAllTextFromJObject(launchFile, launch);
}
catch (Exception)
{
} catch (Exception) {
// do not fail if we cannot patch the launch.json file
}
}
private void CreateSettingsFile(string vscodeDirectory, bool enablePatch)
{
private void CreateSettingsFile(string vscodeDirectory, bool enablePatch) {
var settingsFile = IOPath.Combine(vscodeDirectory, "settings.json");
if (File.Exists(settingsFile))
{
if (File.Exists(settingsFile)) {
if (enablePatch)
PatchSettingsFile(settingsFile);
@@ -379,10 +344,8 @@ namespace Microsoft.Unity.VisualStudio.Editor
File.WriteAllText(settingsFile, content);
}
private void PatchSettingsFile(string settingsFile)
{
try
{
private void PatchSettingsFile(string settingsFile) {
try {
const string excludesKey = "files.exclude";
const string solutionKey = "dotnet.defaultSolution";
@@ -397,8 +360,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
var patched = false;
// Remove files.exclude for solution+project files in the project root
foreach (var exclude in excludes)
{
foreach (var exclude in excludes) {
if (!bool.TryParse(exclude.Value, out var exc) || !exc)
continue;
@@ -417,8 +379,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
// Check default solution
var defaultSolution = settings[solutionKey];
var solutionFile = IOPath.GetFileName(ProjectGenerator.SolutionFile());
if (defaultSolution == null || defaultSolution.Value != solutionFile)
{
if (defaultSolution == null || defaultSolution.Value != solutionFile) {
settings[solutionKey] = solutionFile;
patched = true;
}
@@ -430,9 +391,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
excludes.Remove(patch);
WriteAllTextFromJObject(settingsFile, settings);
}
catch (Exception)
{
} catch (Exception) {
// do not fail if we cannot patch the settings.json file
}
}
@@ -445,12 +404,10 @@ namespace Microsoft.Unity.VisualStudio.Editor
}
";
private static void CreateRecommendedExtensionsFile(string vscodeDirectory, bool enablePatch)
{
private static void CreateRecommendedExtensionsFile(string vscodeDirectory, bool enablePatch) {
// see https://tattoocoder.com/recommending-vscode-extensions-within-your-open-source-projects/
var extensionFile = IOPath.Combine(vscodeDirectory, "extensions.json");
if (File.Exists(extensionFile))
{
if (File.Exists(extensionFile)) {
if (enablePatch)
PatchRecommendedExtensionsFile(extensionFile);
@@ -460,18 +417,15 @@ namespace Microsoft.Unity.VisualStudio.Editor
File.WriteAllText(extensionFile, DefaultRecommendedExtensionsContent);
}
private static void PatchRecommendedExtensionsFile(string extensionFile)
{
try
{
private static void PatchRecommendedExtensionsFile(string extensionFile) {
try {
const string recommendationsKey = "recommendations";
var content = File.ReadAllText(extensionFile);
var extensions = JSONNode.Parse(content);
var recommendations = extensions[recommendationsKey] as JSONArray;
if (recommendations == null)
{
if (recommendations == null) {
recommendations = new JSONArray();
extensions.Add(recommendationsKey, recommendations);
}
@@ -481,25 +435,20 @@ namespace Microsoft.Unity.VisualStudio.Editor
recommendations.Add(MicrosoftUnityExtensionId);
WriteAllTextFromJObject(extensionFile, extensions);
}
catch (Exception)
{
} catch (Exception) {
// do not fail if we cannot patch the extensions.json file
}
}
private static void WriteAllTextFromJObject(string file, JSONNode node)
{
private static void WriteAllTextFromJObject(string file, JSONNode node) {
using (var fs = File.Open(file, FileMode.Create))
using (var sw = new StreamWriter(fs))
{
using (var sw = new StreamWriter(fs)) {
// Keep formatting/indent in sync with default contents
sw.Write(node.ToString(aIndent: 4));
}
}
public override bool Open(string path, int line, int column, string solution)
{
public override bool Open(string path, int line, int column, string solution) {
line = Math.Max(1, line);
column = Math.Max(0, column);
@@ -513,8 +462,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
return true;
}
private static ProcessStartInfo ProcessStartInfoFor(string application, string arguments)
{
private static ProcessStartInfo ProcessStartInfoFor(string application, string arguments) {
#if UNITY_EDITOR_OSX
// wrap with built-in OSX open feature
arguments = $"-n \"{application}\" --args {arguments}";
@@ -525,8 +473,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
#endif
}
public static void Initialize()
{
public static void Initialize() {
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d83ff2bd8039e2f41a5147034ed5d28e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ddfe5c11838c29047931abace68bf11e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c452f2dfc99f91b4c9883719d71b2d8f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b13003ee9d8f4aa4eadd98d24adbc79b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,5 +1,5 @@
{
"name": "Unity.VisualStudio.Editor",
"name": "Unity.Cursor.Editor",
"references": [],
"includePlatforms": [
"Editor"

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3bdbd29a5ae7b9d4ead62ff67cdd7d57
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

7
LICENSE.md.meta Normal file
View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e1e01663a79c63e45b71da40a22e6954
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 613aeddc44f353d4d9e9986919e730b9
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8e9d2159475628940bb30bf1ca8c5432
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e71f2385c737b5249a357a30c44ba7cb
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,26 +1,14 @@
{
"name": "com.unity.ide.cursor",
"displayName": "Cursor Editor",
"description": "Code editor integration for supporting Cursor as code editor for unity. Adds support for generating csproj files for intellisense purposes, auto discovery of installations, etc.",
"description": "Cursor editor integration for supporting Cursor as code editor for unity. Adds support for generating csproj files for intellisense purposes, auto discovery of installations, etc.",
"version": "2.0.22",
"unity": "2019.4",
"unityRelease": "25f1",
"dependencies": {
"com.unity.test-framework": "1.1.9"
},
"relatedPackages": {
"com.unity.ide.visualstudio.tests": "2.0.22"
},
"_upm": {
"changelog": "Integration:\n\n- Add support for `XDG_DATA_DIRS` and `.desktop` files on Linux for `VS Code` discovery.\n- Use compile-time platform-specifics instead of using runtime conditions.\n\nProject generation:\n\n- Suppress `USG0001` warnings.\n- Mark referenced assemblies as private (to not copy extra files to output directory when building).\n- Add Unity capability to SDK-Style projects.\n- Prevent circular dependency errors with SDK-Style projects."
},
"upmCi": {
"footprint": "0b7347d4363afca9be389b61f0e25489ae3995b8"
},
"documentationUrl": "https://docs.unity3d.com/Packages/com.unity.ide.visualstudio@2.0/manual/index.html",
"repository": {
"url": "https://github.cds.internal.unity3d.com/unity/com.unity.ide.visualstudio.git",
"type": "git",
"revision": "700b44077345e97d37d464ff25507638983aed64"
"changelog": "Integration:\n\n- Add support for Cursor"
}
}

7
package.json.meta Normal file
View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0214c79dfec0ce44486e7d7e8d9b981b
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: