You've already forked com.unity.ide.cursor
mirror of
https://github.com/boxqkrtm/com.unity.ide.cursor.git
synced 2026-05-14 14:20:09 +00:00
com.unity.ide.visualstudio@2.0.5
## [2.0.5] - 2020-10-30 Integration: Disable legacy pdb symbol checking for Unity packages
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
# Code Editor Package for Visual Studio
|
# Code Editor Package for Visual Studio
|
||||||
|
|
||||||
|
## [2.0.5] - 2020-10-30
|
||||||
|
|
||||||
|
Integration:
|
||||||
|
|
||||||
|
Disable legacy pdb symbol checking for Unity packages
|
||||||
|
|
||||||
|
|
||||||
## [2.0.3] - 2020-09-09
|
## [2.0.3] - 2020-09-09
|
||||||
|
|
||||||
Project generation:
|
Project generation:
|
||||||
|
|||||||
4
Editor/AssemblyInfo.cs
Normal file
4
Editor/AssemblyInfo.cs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
[assembly:InternalsVisibleTo("Unity.VisualStudio.EditorTests")]
|
||||||
|
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
||||||
3
Editor/AssemblyInfo.cs.meta
Normal file
3
Editor/AssemblyInfo.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d791d407901442e49862d3aa783ce8af
|
||||||
|
timeCreated: 1602756877
|
||||||
@@ -15,7 +15,10 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
{
|
{
|
||||||
internal static class Discovery
|
internal static class Discovery
|
||||||
{
|
{
|
||||||
public static IEnumerable<VisualStudioInstallation> GetVisualStudioInstallations()
|
internal const string ManagedWorkload = "Microsoft.VisualStudio.Workload.ManagedGame";
|
||||||
|
|
||||||
|
|
||||||
|
public static IEnumerable<IVisualStudioInstallation> GetVisualStudioInstallations()
|
||||||
{
|
{
|
||||||
if (VisualStudioEditor.IsWindows)
|
if (VisualStudioEditor.IsWindows)
|
||||||
{
|
{
|
||||||
@@ -45,7 +48,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool TryDiscoverInstallation(string editorPath, out VisualStudioInstallation installation)
|
public static bool TryDiscoverInstallation(string editorPath, out IVisualStudioInstallation installation)
|
||||||
{
|
{
|
||||||
installation = null;
|
installation = null;
|
||||||
|
|
||||||
@@ -61,7 +64,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
// On Mac we use the .app folder, so we need to access to main assembly
|
// On Mac we use the .app folder, so we need to access to main assembly
|
||||||
if (VisualStudioEditor.IsOSX)
|
if (VisualStudioEditor.IsOSX)
|
||||||
fvi = Path.Combine(editorPath, "Contents", "Resources", "lib", "monodevelop", "bin", "VisualStudio.exe");
|
fvi = Path.Combine(editorPath, "Contents", "Resources", "lib", "monodevelop", "bin", "VisualStudio.exe");
|
||||||
|
|
||||||
if (!File.Exists(fvi))
|
if (!File.Exists(fvi))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -82,7 +85,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region VsWhere Json Schema
|
#region VsWhere Json Schema
|
||||||
#pragma warning disable CS0649
|
#pragma warning disable CS0649
|
||||||
[Serializable]
|
[Serializable]
|
||||||
internal class VsWhereResult
|
internal class VsWhereResult
|
||||||
{
|
{
|
||||||
@@ -95,7 +98,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
|
|
||||||
public IEnumerable<VisualStudioInstallation> ToVisualStudioInstallations()
|
public IEnumerable<VisualStudioInstallation> ToVisualStudioInstallations()
|
||||||
{
|
{
|
||||||
foreach(var entry in entries)
|
foreach (var entry in entries)
|
||||||
{
|
{
|
||||||
yield return new VisualStudioInstallation()
|
yield return new VisualStudioInstallation()
|
||||||
{
|
{
|
||||||
@@ -123,7 +126,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
public string productDisplayVersion; // non parseable like "16.3.0 Preview 3.0"
|
public string productDisplayVersion; // non parseable like "16.3.0 Preview 3.0"
|
||||||
public string buildVersion;
|
public string buildVersion;
|
||||||
}
|
}
|
||||||
#pragma warning restore CS3021
|
#pragma warning restore CS3021
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private static IEnumerable<VisualStudioInstallation> QueryVsWhere()
|
private static IEnumerable<VisualStudioInstallation> QueryVsWhere()
|
||||||
|
|||||||
@@ -49,6 +49,14 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
return path.Replace(string.Concat(WinSeparator, WinSeparator), WinSeparator.ToString());
|
return path.Replace(string.Concat(WinSeparator, WinSeparator), WinSeparator.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string NormalizeWindowsToUnix(string path)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(path))
|
||||||
|
return path;
|
||||||
|
|
||||||
|
return path.Replace(WinSeparator, UnixSeparator);
|
||||||
|
}
|
||||||
|
|
||||||
internal static bool IsFileInProjectDirectory(string fileName)
|
internal static bool IsFileInProjectDirectory(string fileName)
|
||||||
{
|
{
|
||||||
var basePath = Path.GetFullPath(Path.Combine(Application.dataPath, ".."));
|
var basePath = Path.GetFullPath(Path.Combine(Application.dataPath, ".."));
|
||||||
|
|||||||
@@ -7,28 +7,29 @@ using System.IO;
|
|||||||
|
|
||||||
namespace Microsoft.Unity.VisualStudio.Editor
|
namespace Microsoft.Unity.VisualStudio.Editor
|
||||||
{
|
{
|
||||||
public sealed class Image : IDisposable {
|
public sealed class Image : IDisposable
|
||||||
|
{
|
||||||
|
|
||||||
long position;
|
long position;
|
||||||
Stream stream;
|
Stream stream;
|
||||||
|
|
||||||
Image (Stream stream)
|
Image(Stream stream)
|
||||||
{
|
{
|
||||||
this.stream = stream;
|
this.stream = stream;
|
||||||
this.position = stream.Position;
|
this.position = stream.Position;
|
||||||
this.stream.Position = 0;
|
this.stream.Position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Advance (int length)
|
bool Advance(int length)
|
||||||
{
|
{
|
||||||
if (stream.Position + length >= stream.Length)
|
if (stream.Position + length >= stream.Length)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
stream.Seek (length, SeekOrigin.Current);
|
stream.Seek(length, SeekOrigin.Current);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveTo (uint position)
|
bool MoveTo(uint position)
|
||||||
{
|
{
|
||||||
if (position >= stream.Length)
|
if (position >= stream.Length)
|
||||||
return false;
|
return false;
|
||||||
@@ -37,65 +38,65 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDisposable.Dispose ()
|
void IDisposable.Dispose()
|
||||||
{
|
{
|
||||||
stream.Position = position;
|
stream.Position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
ushort ReadUInt16 ()
|
ushort ReadUInt16()
|
||||||
{
|
{
|
||||||
return (ushort) (stream.ReadByte ()
|
return (ushort)(stream.ReadByte()
|
||||||
| (stream.ReadByte () << 8));
|
| (stream.ReadByte() << 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint ReadUInt32 ()
|
uint ReadUInt32()
|
||||||
{
|
{
|
||||||
return (uint) (stream.ReadByte ()
|
return (uint)(stream.ReadByte()
|
||||||
| (stream.ReadByte () << 8)
|
| (stream.ReadByte() << 8)
|
||||||
| (stream.ReadByte () << 16)
|
| (stream.ReadByte() << 16)
|
||||||
| (stream.ReadByte () << 24));
|
| (stream.ReadByte() << 24));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsManagedAssembly ()
|
bool IsManagedAssembly()
|
||||||
{
|
{
|
||||||
if (stream.Length < 318)
|
if (stream.Length < 318)
|
||||||
return false;
|
return false;
|
||||||
if (ReadUInt16 () != 0x5a4d)
|
if (ReadUInt16() != 0x5a4d)
|
||||||
return false;
|
return false;
|
||||||
if (!Advance (58))
|
if (!Advance(58))
|
||||||
return false;
|
return false;
|
||||||
if (!MoveTo (ReadUInt32 ()))
|
if (!MoveTo(ReadUInt32()))
|
||||||
return false;
|
return false;
|
||||||
if (ReadUInt32 () != 0x00004550)
|
if (ReadUInt32() != 0x00004550)
|
||||||
return false;
|
return false;
|
||||||
if (!Advance (20))
|
if (!Advance(20))
|
||||||
return false;
|
return false;
|
||||||
if (!Advance (ReadUInt16 () == 0x20b ? 222 : 206))
|
if (!Advance(ReadUInt16() == 0x20b ? 222 : 206))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return ReadUInt32 () != 0;
|
return ReadUInt32() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsAssembly (string file)
|
public static bool IsAssembly(string file)
|
||||||
{
|
{
|
||||||
if (file == null)
|
if (file == null)
|
||||||
throw new ArgumentNullException ("file");
|
throw new ArgumentNullException("file");
|
||||||
|
|
||||||
using (var stream = new FileStream (file, FileMode.Open, FileAccess.Read, FileShare.Read))
|
using (var stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||||
return IsAssembly (stream);
|
return IsAssembly(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsAssembly (Stream stream)
|
public static bool IsAssembly(Stream stream)
|
||||||
{
|
{
|
||||||
if (stream == null)
|
if (stream == null)
|
||||||
throw new ArgumentNullException (nameof(stream));
|
throw new ArgumentNullException(nameof(stream));
|
||||||
if (!stream.CanRead)
|
if (!stream.CanRead)
|
||||||
throw new ArgumentException (nameof(stream));
|
throw new ArgumentException(nameof(stream));
|
||||||
if (!stream.CanSeek)
|
if (!stream.CanSeek)
|
||||||
throw new ArgumentException (nameof(stream));
|
throw new ArgumentException(nameof(stream));
|
||||||
|
|
||||||
using (var image = new Image (stream))
|
using (var image = new Image(stream))
|
||||||
return image.IsManagedAssembly ();
|
return image.IsManagedAssembly();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 058b02c03ea09473aab4dc5fc50af1ef
|
guid: 543eb5eeeb1d5424ca8876b93fad5326
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>BuildMachineOSBuild</key>
|
<key>BuildMachineOSBuild</key>
|
||||||
<string>19B88</string>
|
<string>19H2</string>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>en</string>
|
<string>en</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
@@ -14,6 +14,8 @@
|
|||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>AppleEventIntegration</string>
|
<string>AppleEventIntegration</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>BNDL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
<key>CFBundleSupportedPlatforms</key>
|
<key>CFBundleSupportedPlatforms</key>
|
||||||
@@ -25,17 +27,21 @@
|
|||||||
<key>DTCompiler</key>
|
<key>DTCompiler</key>
|
||||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||||
<key>DTPlatformBuild</key>
|
<key>DTPlatformBuild</key>
|
||||||
<string>10E125</string>
|
<string>12A7300</string>
|
||||||
|
<key>DTPlatformName</key>
|
||||||
|
<string>macosx</string>
|
||||||
<key>DTPlatformVersion</key>
|
<key>DTPlatformVersion</key>
|
||||||
<string>GM</string>
|
<string>10.15.6</string>
|
||||||
<key>DTSDKBuild</key>
|
<key>DTSDKBuild</key>
|
||||||
<string>18E219</string>
|
<string>19G68</string>
|
||||||
<key>DTSDKName</key>
|
<key>DTSDKName</key>
|
||||||
<string>macosx10.14</string>
|
<string>macosx10.15</string>
|
||||||
<key>DTXcode</key>
|
<key>DTXcode</key>
|
||||||
<string>1020</string>
|
<string>1201</string>
|
||||||
<key>DTXcodeBuild</key>
|
<key>DTXcodeBuild</key>
|
||||||
<string>10E125</string>
|
<string>12A7300</string>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>10.13</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>Copyright © 2019 Unity. All rights reserved.</string>
|
<string>Copyright © 2019 Unity. All rights reserved.</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 680cf1008b4284eddbb82ec4d76644a1
|
guid: 29239d79a3471495e9d270601006dad7
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: ba4355216f6c44abbb17503872c42c97
|
guid: e811c7e1c1e9a4b50b237772d317959f
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 4e53c7f7b5c7e4a3d890cb596ed56c22
|
guid: 9c3599bc139404df2955d3ffd39d60d6
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 11ca2399a9422473eb66bca747f3ad52
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>files</key>
|
||||||
|
<dict/>
|
||||||
|
<key>files2</key>
|
||||||
|
<dict/>
|
||||||
|
<key>rules</key>
|
||||||
|
<dict>
|
||||||
|
<key>^Resources/</key>
|
||||||
|
<true/>
|
||||||
|
<key>^Resources/.*\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>optional</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1100</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/Base\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1010</real>
|
||||||
|
</dict>
|
||||||
|
<key>^version.plist$</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
<key>rules2</key>
|
||||||
|
<dict>
|
||||||
|
<key>.*\.dSYM($|/)</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>11</real>
|
||||||
|
</dict>
|
||||||
|
<key>^(.*/)?\.DS_Store$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>2000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
||||||
|
<dict>
|
||||||
|
<key>nested</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>10</real>
|
||||||
|
</dict>
|
||||||
|
<key>^.*</key>
|
||||||
|
<true/>
|
||||||
|
<key>^Info\.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^PkgInfo$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/.*\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>optional</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1100</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/Base\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1010</real>
|
||||||
|
</dict>
|
||||||
|
<key>^[^/]+$</key>
|
||||||
|
<dict>
|
||||||
|
<key>nested</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>10</real>
|
||||||
|
</dict>
|
||||||
|
<key>^embedded\.provisionprofile$</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^version\.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3379e8bd711774041a330f218af69b7a
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Unity Technologies.
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -7,181 +12,175 @@ using UnityEditor.PackageManager;
|
|||||||
|
|
||||||
namespace Microsoft.Unity.VisualStudio.Editor
|
namespace Microsoft.Unity.VisualStudio.Editor
|
||||||
{
|
{
|
||||||
public interface IAssemblyNameProvider
|
public interface IAssemblyNameProvider
|
||||||
{
|
{
|
||||||
string[] ProjectSupportedExtensions { get; }
|
string[] ProjectSupportedExtensions { get; }
|
||||||
string ProjectGenerationRootNamespace { get; }
|
string ProjectGenerationRootNamespace { get; }
|
||||||
ProjectGenerationFlag ProjectGenerationFlag { get; }
|
ProjectGenerationFlag ProjectGenerationFlag { get; }
|
||||||
|
|
||||||
string GetAssemblyNameFromScriptPath(string path);
|
string GetAssemblyNameFromScriptPath(string path);
|
||||||
string GetAssemblyName(string assemblyOutputPath, string assemblyName);
|
string GetAssemblyName(string assemblyOutputPath, string assemblyName);
|
||||||
bool IsInternalizedPackagePath(string path);
|
bool IsInternalizedPackagePath(string path);
|
||||||
IEnumerable<Assembly> GetAssemblies(Func<string, bool> shouldFileBePartOfSolution);
|
IEnumerable<Assembly> GetAssemblies(Func<string, bool> shouldFileBePartOfSolution);
|
||||||
IEnumerable<string> GetAllAssetPaths();
|
IEnumerable<string> GetAllAssetPaths();
|
||||||
UnityEditor.PackageManager.PackageInfo FindForAssetPath(string assetPath);
|
UnityEditor.PackageManager.PackageInfo FindForAssetPath(string assetPath);
|
||||||
ResponseFileData ParseResponseFile(string responseFilePath, string projectDirectory, string[] systemReferenceDirectories);
|
ResponseFileData ParseResponseFile(string responseFilePath, string projectDirectory, string[] systemReferenceDirectories);
|
||||||
void ToggleProjectGeneration(ProjectGenerationFlag preference);
|
void ToggleProjectGeneration(ProjectGenerationFlag preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AssemblyNameProvider : IAssemblyNameProvider
|
public class AssemblyNameProvider : IAssemblyNameProvider
|
||||||
{
|
{
|
||||||
ProjectGenerationFlag m_ProjectGenerationFlag = (ProjectGenerationFlag)EditorPrefs.GetInt(
|
ProjectGenerationFlag m_ProjectGenerationFlag = (ProjectGenerationFlag)EditorPrefs.GetInt(
|
||||||
"unity_project_generation_flag",
|
"unity_project_generation_flag",
|
||||||
(int)(ProjectGenerationFlag.Local | ProjectGenerationFlag.Embedded));
|
(int)(ProjectGenerationFlag.Local | ProjectGenerationFlag.Embedded));
|
||||||
|
|
||||||
public string[] ProjectSupportedExtensions => EditorSettings.projectGenerationUserExtensions;
|
public string[] ProjectSupportedExtensions => EditorSettings.projectGenerationUserExtensions;
|
||||||
|
|
||||||
public string ProjectGenerationRootNamespace => EditorSettings.projectGenerationRootNamespace;
|
public string ProjectGenerationRootNamespace => EditorSettings.projectGenerationRootNamespace;
|
||||||
|
|
||||||
public ProjectGenerationFlag ProjectGenerationFlag
|
public ProjectGenerationFlag ProjectGenerationFlag
|
||||||
{
|
{
|
||||||
get => m_ProjectGenerationFlag;
|
get => m_ProjectGenerationFlag;
|
||||||
private set
|
private set
|
||||||
{
|
{
|
||||||
EditorPrefs.SetInt("unity_project_generation_flag", (int)value);
|
EditorPrefs.SetInt("unity_project_generation_flag", (int)value);
|
||||||
m_ProjectGenerationFlag = value;
|
m_ProjectGenerationFlag = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetAssemblyNameFromScriptPath(string path)
|
public string GetAssemblyNameFromScriptPath(string path)
|
||||||
{
|
{
|
||||||
return CompilationPipeline.GetAssemblyNameFromScriptPath(path);
|
return CompilationPipeline.GetAssemblyNameFromScriptPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Assembly> GetAssemblies(Func<string, bool> shouldFileBePartOfSolution)
|
public IEnumerable<Assembly> GetAssemblies(Func<string, bool> shouldFileBePartOfSolution)
|
||||||
{
|
{
|
||||||
foreach (var assembly in CompilationPipeline.GetAssemblies())
|
foreach (var assembly in CompilationPipeline.GetAssemblies())
|
||||||
{
|
{
|
||||||
if (assembly.sourceFiles.Any(shouldFileBePartOfSolution))
|
if (assembly.sourceFiles.Any(shouldFileBePartOfSolution))
|
||||||
{
|
{
|
||||||
var options = new ScriptCompilerOptions()
|
var options = new ScriptCompilerOptions
|
||||||
{
|
{
|
||||||
ResponseFiles = assembly.compilerOptions.ResponseFiles,
|
ResponseFiles = assembly.compilerOptions.ResponseFiles,
|
||||||
AllowUnsafeCode = assembly.compilerOptions.AllowUnsafeCode,
|
AllowUnsafeCode = assembly.compilerOptions.AllowUnsafeCode,
|
||||||
ApiCompatibilityLevel = assembly.compilerOptions.ApiCompatibilityLevel
|
ApiCompatibilityLevel = assembly.compilerOptions.ApiCompatibilityLevel
|
||||||
};
|
};
|
||||||
|
|
||||||
yield return new Assembly(assembly.name, @"Temp\Bin\Debug\",
|
yield return new Assembly(assembly.name, @"Temp\Bin\Debug\",
|
||||||
assembly.sourceFiles, new[] { "DEBUG", "TRACE" }.Concat(assembly.defines).Concat(EditorUserBuildSettings.activeScriptCompilationDefines).ToArray(),
|
assembly.sourceFiles, new[] { "DEBUG", "TRACE" }.Concat(assembly.defines).Concat(EditorUserBuildSettings.activeScriptCompilationDefines).ToArray(),
|
||||||
assembly.assemblyReferences,
|
assembly.assemblyReferences,
|
||||||
assembly.compiledAssemblyReferences,
|
assembly.compiledAssemblyReferences,
|
||||||
assembly.flags,
|
assembly.flags,
|
||||||
#if UNITY_2020_2_OR_NEWER
|
#if UNITY_2020_2_OR_NEWER
|
||||||
options,
|
options,
|
||||||
assembly.rootNamespace);
|
assembly.rootNamespace);
|
||||||
#else
|
#else
|
||||||
options);
|
options);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.PlayerAssemblies))
|
if (ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.PlayerAssemblies))
|
||||||
{
|
{
|
||||||
foreach (var assembly in CompilationPipeline.GetAssemblies(AssembliesType.Player).Where(assembly => assembly.sourceFiles.Any(shouldFileBePartOfSolution)))
|
foreach (var assembly in CompilationPipeline.GetAssemblies(AssembliesType.Player).Where(assembly => assembly.sourceFiles.Any(shouldFileBePartOfSolution)))
|
||||||
{
|
{
|
||||||
var options = new ScriptCompilerOptions()
|
var options = new ScriptCompilerOptions
|
||||||
{
|
{
|
||||||
ResponseFiles = assembly.compilerOptions.ResponseFiles,
|
ResponseFiles = assembly.compilerOptions.ResponseFiles,
|
||||||
AllowUnsafeCode = assembly.compilerOptions.AllowUnsafeCode,
|
AllowUnsafeCode = assembly.compilerOptions.AllowUnsafeCode,
|
||||||
ApiCompatibilityLevel = assembly.compilerOptions.ApiCompatibilityLevel
|
ApiCompatibilityLevel = assembly.compilerOptions.ApiCompatibilityLevel
|
||||||
};
|
};
|
||||||
|
|
||||||
yield return new Assembly(assembly.name, @"Temp\Bin\Debug\Player\",
|
yield return
|
||||||
assembly.sourceFiles,
|
new Assembly(assembly.name, @"Temp\Bin\Debug\Player\",
|
||||||
new[] { "DEBUG", "TRACE" }.Concat(assembly.defines).ToArray(),
|
assembly.sourceFiles,
|
||||||
assembly.assemblyReferences,
|
new[] { "DEBUG", "TRACE" }.Concat(assembly.defines).ToArray(),
|
||||||
assembly.compiledAssemblyReferences,
|
assembly.assemblyReferences,
|
||||||
assembly.flags,
|
assembly.compiledAssemblyReferences,
|
||||||
|
assembly.flags,
|
||||||
#if UNITY_2020_2_OR_NEWER
|
#if UNITY_2020_2_OR_NEWER
|
||||||
options,
|
options,
|
||||||
assembly.rootNamespace);
|
assembly.rootNamespace);
|
||||||
#else
|
#else
|
||||||
options);
|
options);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetCompileOutputPath(string assemblyName)
|
public string GetCompileOutputPath(string assemblyName)
|
||||||
{
|
{
|
||||||
if (assemblyName.EndsWith(".Player", StringComparison.Ordinal))
|
return assemblyName.EndsWith(".Player", StringComparison.Ordinal) ? @"Temp\Bin\Debug\Player\" : @"Temp\Bin\Debug\";
|
||||||
{
|
}
|
||||||
return @"Temp\Bin\Debug\Player\";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return @"Temp\Bin\Debug\";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<string> GetAllAssetPaths()
|
public IEnumerable<string> GetAllAssetPaths()
|
||||||
{
|
{
|
||||||
return AssetDatabase.GetAllAssetPaths();
|
return AssetDatabase.GetAllAssetPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UnityEditor.PackageManager.PackageInfo FindForAssetPath(string assetPath)
|
public UnityEditor.PackageManager.PackageInfo FindForAssetPath(string assetPath)
|
||||||
{
|
{
|
||||||
return UnityEditor.PackageManager.PackageInfo.FindForAssetPath(assetPath);
|
return UnityEditor.PackageManager.PackageInfo.FindForAssetPath(assetPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInternalizedPackagePath(string path)
|
public bool IsInternalizedPackagePath(string path)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path.Trim()))
|
if (string.IsNullOrEmpty(path.Trim()))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var packageInfo = FindForAssetPath(path);
|
var packageInfo = FindForAssetPath(path);
|
||||||
if (packageInfo == null)
|
if (packageInfo == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var packageSource = packageInfo.source;
|
var packageSource = packageInfo.source;
|
||||||
switch (packageSource)
|
switch (packageSource)
|
||||||
{
|
{
|
||||||
case PackageSource.Embedded:
|
case PackageSource.Embedded:
|
||||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Embedded);
|
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Embedded);
|
||||||
case PackageSource.Registry:
|
case PackageSource.Registry:
|
||||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Registry);
|
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Registry);
|
||||||
case PackageSource.BuiltIn:
|
case PackageSource.BuiltIn:
|
||||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.BuiltIn);
|
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.BuiltIn);
|
||||||
case PackageSource.Unknown:
|
case PackageSource.Unknown:
|
||||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Unknown);
|
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Unknown);
|
||||||
case PackageSource.Local:
|
case PackageSource.Local:
|
||||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Local);
|
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Local);
|
||||||
case PackageSource.Git:
|
case PackageSource.Git:
|
||||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Git);
|
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Git);
|
||||||
case PackageSource.LocalTarball:
|
case PackageSource.LocalTarball:
|
||||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.LocalTarBall);
|
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.LocalTarBall);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResponseFileData ParseResponseFile(string responseFilePath, string projectDirectory, string[] systemReferenceDirectories)
|
public ResponseFileData ParseResponseFile(string responseFilePath, string projectDirectory, string[] systemReferenceDirectories)
|
||||||
{
|
{
|
||||||
return CompilationPipeline.ParseResponseFile(
|
return CompilationPipeline.ParseResponseFile(
|
||||||
responseFilePath,
|
responseFilePath,
|
||||||
projectDirectory,
|
projectDirectory,
|
||||||
systemReferenceDirectories
|
systemReferenceDirectories
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ToggleProjectGeneration(ProjectGenerationFlag preference)
|
public void ToggleProjectGeneration(ProjectGenerationFlag preference)
|
||||||
{
|
{
|
||||||
if (ProjectGenerationFlag.HasFlag(preference))
|
if (ProjectGenerationFlag.HasFlag(preference))
|
||||||
{
|
{
|
||||||
ProjectGenerationFlag ^= preference;
|
ProjectGenerationFlag ^= preference;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProjectGenerationFlag |= preference;
|
ProjectGenerationFlag |= preference;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetProjectGenerationFlag()
|
public void ResetProjectGenerationFlag()
|
||||||
{
|
{
|
||||||
ProjectGenerationFlag = ProjectGenerationFlag.None;
|
ProjectGenerationFlag = ProjectGenerationFlag.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetAssemblyName(string assemblyOutputPath, string assemblyName)
|
public string GetAssemblyName(string assemblyOutputPath, string assemblyName)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,31 +1,36 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Unity Technologies.
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Microsoft.Unity.VisualStudio.Editor
|
namespace Microsoft.Unity.VisualStudio.Editor
|
||||||
{
|
{
|
||||||
public interface IFileIO
|
public interface IFileIO
|
||||||
{
|
{
|
||||||
bool Exists(string fileName);
|
bool Exists(string fileName);
|
||||||
|
|
||||||
string ReadAllText(string fileName);
|
string ReadAllText(string fileName);
|
||||||
void WriteAllText(string fileName, string content);
|
void WriteAllText(string fileName, string content);
|
||||||
}
|
}
|
||||||
|
|
||||||
class FileIOProvider : IFileIO
|
class FileIOProvider : IFileIO
|
||||||
{
|
{
|
||||||
public bool Exists(string fileName)
|
public bool Exists(string fileName)
|
||||||
{
|
{
|
||||||
return File.Exists(fileName);
|
return File.Exists(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ReadAllText(string fileName)
|
public string ReadAllText(string fileName)
|
||||||
{
|
{
|
||||||
return File.ReadAllText(fileName);
|
return File.ReadAllText(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteAllText(string fileName, string content)
|
public void WriteAllText(string fileName, string content)
|
||||||
{
|
{
|
||||||
File.WriteAllText(fileName, content, Encoding.UTF8);
|
File.WriteAllText(fileName, content, Encoding.UTF8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,26 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Unity Technologies.
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
namespace Microsoft.Unity.VisualStudio.Editor
|
namespace Microsoft.Unity.VisualStudio.Editor
|
||||||
{
|
{
|
||||||
public interface IGUIDGenerator
|
public interface IGUIDGenerator
|
||||||
{
|
{
|
||||||
string ProjectGuid(string projectName, string assemblyName);
|
string ProjectGuid(string projectName, string assemblyName);
|
||||||
string SolutionGuid(string projectName, ScriptingLanguage scriptingLanguage);
|
string SolutionGuid(string projectName, ScriptingLanguage scriptingLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
class GUIDProvider : IGUIDGenerator
|
class GUIDProvider : IGUIDGenerator
|
||||||
{
|
{
|
||||||
public string ProjectGuid(string projectName, string assemblyName)
|
public string ProjectGuid(string projectName, string assemblyName)
|
||||||
{
|
{
|
||||||
return SolutionGuidGenerator.GuidForProject(projectName + assemblyName);
|
return SolutionGuidGenerator.GuidForProject(projectName + assemblyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SolutionGuid(string projectName, ScriptingLanguage scriptingLanguage)
|
public string SolutionGuid(string projectName, ScriptingLanguage scriptingLanguage)
|
||||||
{
|
{
|
||||||
return SolutionGuidGenerator.GuidForSolution(projectName, scriptingLanguage);
|
return SolutionGuidGenerator.GuidForSolution(projectName, scriptingLanguage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,9 @@
|
|||||||
using System;
|
/*---------------------------------------------------------------------------------------------
|
||||||
using System.Collections.Generic;
|
* Copyright (c) Unity Technologies.
|
||||||
using System.Linq;
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
using System.Text;
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
using System.Threading.Tasks;
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Microsoft.Unity.VisualStudio.Editor
|
namespace Microsoft.Unity.VisualStudio.Editor
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Microsoft.Unity.VisualStudio.Editor
|
namespace Microsoft.Unity.VisualStudio.Editor
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using System;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Unity.CodeEditor;
|
using Unity.CodeEditor;
|
||||||
@@ -18,14 +17,14 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
[InitializeOnLoad]
|
[InitializeOnLoad]
|
||||||
public class VisualStudioEditor : IExternalCodeEditor
|
public class VisualStudioEditor : IExternalCodeEditor
|
||||||
{
|
{
|
||||||
private static readonly VisualStudioInstallation[] _installations;
|
private static readonly IVisualStudioInstallation[] _installations;
|
||||||
|
|
||||||
internal static bool IsOSX => Application.platform == RuntimePlatform.OSXEditor;
|
internal static bool IsOSX => Application.platform == RuntimePlatform.OSXEditor;
|
||||||
internal static bool IsWindows => !IsOSX && Path.DirectorySeparatorChar == '\\' && Environment.NewLine == "\r\n";
|
internal static bool IsWindows => !IsOSX && Path.DirectorySeparatorChar == FileUtility.WinSeparator && Environment.NewLine == "\r\n";
|
||||||
|
|
||||||
CodeEditor.Installation[] IExternalCodeEditor.Installations => _installations
|
CodeEditor.Installation[] IExternalCodeEditor.Installations => _installations
|
||||||
.Select(i => i.ToCodeEditorInstallation())
|
.Select(i => i.ToCodeEditorInstallation())
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
private readonly IGenerator _generator = new ProjectGeneration();
|
private readonly IGenerator _generator = new ProjectGeneration();
|
||||||
|
|
||||||
@@ -39,7 +38,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
UnityEngine.Debug.Log($"Error detecting Visual Studio installations: {ex}");
|
UnityEngine.Debug.LogError($"Error detecting Visual Studio installations: {ex}");
|
||||||
_installations = Array.Empty<VisualStudioInstallation>();
|
_installations = Array.Empty<VisualStudioInstallation>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +63,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool TryGetVisualStudioInstallationForPath(string editorPath, out VisualStudioInstallation installation)
|
internal virtual bool TryGetVisualStudioInstallationForPath(string editorPath, out IVisualStudioInstallation installation)
|
||||||
{
|
{
|
||||||
// lookup for well known installations
|
// lookup for well known installations
|
||||||
foreach (var candidate in _installations)
|
foreach (var candidate in _installations)
|
||||||
@@ -79,7 +78,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
return Discovery.TryDiscoverInstallation(editorPath, out installation);
|
return Discovery.TryDiscoverInstallation(editorPath, out installation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation)
|
public virtual bool TryGetInstallationForPath(string editorPath, out CodeEditor.Installation installation)
|
||||||
{
|
{
|
||||||
var result = TryGetVisualStudioInstallationForPath(editorPath, out var vsi);
|
var result = TryGetVisualStudioInstallationForPath(editorPath, out var vsi);
|
||||||
installation = vsi == null ? default : vsi.ToCodeEditorInstallation();
|
installation = vsi == null ? default : vsi.ToCodeEditorInstallation();
|
||||||
@@ -117,14 +116,14 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RegenerateProjectFiles()
|
void RegenerateProjectFiles()
|
||||||
{
|
{
|
||||||
var rect = EditorGUI.IndentedRect(EditorGUILayout.GetControlRect(new GUILayoutOption[] {}));
|
var rect = EditorGUI.IndentedRect(EditorGUILayout.GetControlRect(new GUILayoutOption[] { }));
|
||||||
rect.width = 252;
|
rect.width = 252;
|
||||||
if (GUI.Button(rect, "Regenerate project files"))
|
if (GUI.Button(rect, "Regenerate project files"))
|
||||||
{
|
{
|
||||||
_generator.Sync();
|
_generator.Sync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsButton(ProjectGenerationFlag preference, string guiMessage, string toolTip)
|
void SettingsButton(ProjectGenerationFlag preference, string guiMessage, string toolTip)
|
||||||
{
|
{
|
||||||
@@ -143,8 +142,12 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
foreach (var file in importedFiles.Where(a => Path.GetExtension(a) == ".pdb"))
|
foreach (var file in importedFiles.Where(a => Path.GetExtension(a) == ".pdb"))
|
||||||
{
|
{
|
||||||
var pdbFile = FileUtility.GetAssetFullPath(file);
|
var pdbFile = FileUtility.GetAssetFullPath(file);
|
||||||
var asmFile = Path.ChangeExtension(pdbFile, ".dll");
|
|
||||||
|
|
||||||
|
// skip Unity packages like com.unity.ext.nunit
|
||||||
|
if (pdbFile.IndexOf($"{Path.DirectorySeparatorChar}com.unity.", StringComparison.OrdinalIgnoreCase) > 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var asmFile = Path.ChangeExtension(pdbFile, ".dll");
|
||||||
if (!File.Exists(asmFile) || !Image.IsAssembly(asmFile))
|
if (!File.Exists(asmFile) || !Image.IsAssembly(asmFile))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -176,11 +179,31 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void CheckCurrentEditorInstallation()
|
||||||
|
{
|
||||||
|
var editorPath = CodeEditor.CurrentEditorInstallation;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Discovery.TryDiscoverInstallation(editorPath, out _))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (IOException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
UnityEngine.Debug.LogWarning($"Visual Studio executable {editorPath} is not found. Please change your settings in Edit > Preferences > External Tools.");
|
||||||
|
}
|
||||||
|
|
||||||
public bool OpenProject(string path, int line, int column)
|
public bool OpenProject(string path, int line, int column)
|
||||||
{
|
{
|
||||||
|
CheckCurrentEditorInstallation();
|
||||||
|
|
||||||
if (!IsSupportedPath(path))
|
if (!IsSupportedPath(path))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!IsProjectGeneratedFor(path, out var missingFlag))
|
||||||
|
UnityEngine.Debug.LogWarning($"You are trying to open {path} outside a generated project. This might cause problems with IntelliSense and debugging. To avoid this, you can change your .csproj preferences in Edit > Preferences > External Tools and enable {GetProjectGenerationFlagDescription(missingFlag)} generation.");
|
||||||
|
|
||||||
if (IsOSX)
|
if (IsOSX)
|
||||||
return OpenOSXApp(path, line, column);
|
return OpenOSXApp(path, line, column);
|
||||||
|
|
||||||
@@ -190,6 +213,67 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string GetProjectGenerationFlagDescription(ProjectGenerationFlag flag)
|
||||||
|
{
|
||||||
|
switch (flag)
|
||||||
|
{
|
||||||
|
case ProjectGenerationFlag.BuiltIn:
|
||||||
|
return "Built-in packages";
|
||||||
|
case ProjectGenerationFlag.Embedded:
|
||||||
|
return "Embedded packages";
|
||||||
|
case ProjectGenerationFlag.Git:
|
||||||
|
return "Git packages";
|
||||||
|
case ProjectGenerationFlag.Local:
|
||||||
|
return "Local packages";
|
||||||
|
case ProjectGenerationFlag.LocalTarBall:
|
||||||
|
return "Local tarball";
|
||||||
|
case ProjectGenerationFlag.PlayerAssemblies:
|
||||||
|
return "Player projects";
|
||||||
|
case ProjectGenerationFlag.Registry:
|
||||||
|
return "Registry packages";
|
||||||
|
case ProjectGenerationFlag.Unknown:
|
||||||
|
return "Packages from unknown sources";
|
||||||
|
case ProjectGenerationFlag.None:
|
||||||
|
default:
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsProjectGeneratedFor(string path, out ProjectGenerationFlag missingFlag)
|
||||||
|
{
|
||||||
|
missingFlag = ProjectGenerationFlag.None;
|
||||||
|
|
||||||
|
// No need to check when opening the whole solution
|
||||||
|
if (string.IsNullOrEmpty(path))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// We only want to check for cs scripts
|
||||||
|
if (ProjectGeneration.ScriptingLanguageFor(path) != ScriptingLanguage.CSharp)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Even on windows, the package manager requires relative path + unix style separators for queries
|
||||||
|
var basePath = _generator.ProjectDirectory;
|
||||||
|
var relativePath = FileUtility
|
||||||
|
.NormalizeWindowsToUnix(path)
|
||||||
|
.Replace(basePath, string.Empty)
|
||||||
|
.Trim(FileUtility.UnixSeparator);
|
||||||
|
|
||||||
|
var packageInfo = UnityEditor.PackageManager.PackageInfo.FindForAssetPath(relativePath);
|
||||||
|
if (packageInfo == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
var source = packageInfo.source;
|
||||||
|
if (!Enum.TryParse<ProjectGenerationFlag>(source.ToString(), out var flag))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (_generator.AssemblyNameProvider.ProjectGenerationFlag.HasFlag(flag))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Return false if we found a source not flagged for generation
|
||||||
|
missingFlag = flag;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private bool OpenWindowsApp(string path, int line)
|
private bool OpenWindowsApp(string path, int line)
|
||||||
{
|
{
|
||||||
var progpath = FileUtility
|
var progpath = FileUtility
|
||||||
|
|||||||
@@ -10,7 +10,16 @@ using IOPath = System.IO.Path;
|
|||||||
|
|
||||||
namespace Microsoft.Unity.VisualStudio.Editor
|
namespace Microsoft.Unity.VisualStudio.Editor
|
||||||
{
|
{
|
||||||
internal class VisualStudioInstallation
|
internal interface IVisualStudioInstallation
|
||||||
|
{
|
||||||
|
string Path { get; }
|
||||||
|
bool SupportsAnalyzers { get; }
|
||||||
|
bool SupportsCSharp8 { get; }
|
||||||
|
string[] GetAnalyzers();
|
||||||
|
CodeEditor.Installation ToCodeEditorInstallation();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class VisualStudioInstallation : IVisualStudioInstallation
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|||||||
@@ -33,8 +33,9 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
// - if another application is using this port with exclusive access
|
// - if another application is using this port with exclusive access
|
||||||
// - or if the firewall is not properly configured
|
// - or if the firewall is not properly configured
|
||||||
var messagingPort = MessagingPort();
|
var messagingPort = MessagingPort();
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
_messager = Messager.BindTo(messagingPort);
|
_messager = Messager.BindTo(messagingPort);
|
||||||
_messager.ReceiveMessage += ReceiveMessage;
|
_messager.ReceiveMessage += ReceiveMessage;
|
||||||
}
|
}
|
||||||
@@ -155,7 +156,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
|||||||
// If the user disabled auto-refresh in Unity, do not try to force refresh the Asset database
|
// If the user disabled auto-refresh in Unity, do not try to force refresh the Asset database
|
||||||
if (!EditorPrefs.GetBool("kAutoRefresh", true))
|
if (!EditorPrefs.GetBool("kAutoRefresh", true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RunOnceOnUpdate(AssetDatabase.Refresh);
|
RunOnceOnUpdate(AssetDatabase.Refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,18 +2,18 @@
|
|||||||
"name": "com.unity.ide.visualstudio",
|
"name": "com.unity.ide.visualstudio",
|
||||||
"displayName": "Visual Studio Editor",
|
"displayName": "Visual Studio Editor",
|
||||||
"description": "Code editor integration for supporting Visual Studio as code editor for unity. Adds support for generating csproj files for intellisense purposes, auto discovery of installations, etc.",
|
"description": "Code editor integration for supporting Visual Studio as code editor for unity. Adds support for generating csproj files for intellisense purposes, auto discovery of installations, etc.",
|
||||||
"version": "2.0.3",
|
"version": "2.0.5",
|
||||||
"unity": "2020.1",
|
"unity": "2020.1",
|
||||||
"unityRelease": "0a12",
|
"unityRelease": "0a12",
|
||||||
"relatedPackages": {
|
"relatedPackages": {
|
||||||
"com.unity.ide.visualstudio.tests": "2.0.3"
|
"com.unity.ide.visualstudio.tests": "2.0.5"
|
||||||
},
|
},
|
||||||
"upmCi": {
|
"upmCi": {
|
||||||
"footprint": "a528d76d0398bf543d3597af18e87e2f3a13d40a"
|
"footprint": "848c02b3f0fe476a599004cd972346a89e39d26f"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "https://github.cds.internal.unity3d.com/unity/com.unity.ide.visualstudio.git",
|
"url": "https://github.cds.internal.unity3d.com/unity/com.unity.ide.visualstudio.git",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"revision": "869804bff6e99d0d0e9c1867aebaa070fad875e5"
|
"revision": "83ca94e82bb6da515dc57e0d860b6b2224f56991"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user