Skip to content

Commit

Permalink
1.0.2 - 2019/03/07
Browse files Browse the repository at this point in the history
@2019.2
  • Loading branch information
ErikMoczi committed Mar 8, 2019
1 parent e544a53 commit ca3ea47
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 27 deletions.
2 changes: 1 addition & 1 deletion package/CHANGELOG.md
@@ -1,6 +1,6 @@
# Code Editor Package for Visual Studio

## [1.0.1] - 2019-01-01
## [1.0.2] - 2019-01-01

### This is the first release of *Unity Package visualstudio_editor*.

Expand Down
Binary file modified package/Editor/COMIntegration/Debug/COMIntegration.exe
Binary file not shown.
14 changes: 2 additions & 12 deletions package/Editor/ProjectGeneration.cs
Expand Up @@ -559,22 +559,12 @@ public string SolutionFile()
IEnumerable<ResponseFileData> responseFilesData
)
{
string targetFrameworkVersion;
string targetLanguageVersion;
var toolsVersion = "4.0";
var productVersion = "10.0.20506";
const string baseDirectory = ".";

if (island.compilerOptions.ApiCompatibilityLevel == ApiCompatibilityLevel.NET_4_6)
{
targetFrameworkVersion = "v4.7.1";
targetLanguageVersion = "latest";
}
else
{
targetFrameworkVersion = "v3.5";
targetLanguageVersion = "4";
}
var targetFrameworkVersion = "v4.7.1";
var targetLanguageVersion = "latest";

var arguments = new object[]
{
Expand Down
36 changes: 25 additions & 11 deletions package/Editor/VSEditor.cs
Expand Up @@ -34,7 +34,11 @@ public class VSEditor : IExternalCodeEditor

static IEnumerable<string> FindVisualStudioDevEnvPaths()
{
var asset = AssetDatabase.FindAssets("VSWhere a:packages").Select(AssetDatabase.GUIDToAssetPath).First(assetPath => assetPath.Contains("vswhere.exe"));
string asset = AssetDatabase.FindAssets("VSWhere a:packages").Select(AssetDatabase.GUIDToAssetPath).FirstOrDefault(assetPath => assetPath.Contains("vswhere.exe"));
if (string.IsNullOrWhiteSpace(asset)) // This may be called too early where the asset database has not replicated this information yet.
{
yield break;
}
UnityEditor.PackageManager.PackageInfo packageInfo = UnityEditor.PackageManager.PackageInfo.FindForAssetPath(asset);
var progpath = packageInfo.resolvedPath + asset.Substring("Packages/com.unity.ide.visualstudio".Length);
var process = new Process
Expand Down Expand Up @@ -73,13 +77,10 @@ static VSEditor()
var editor = new VSEditor(new Discovery(), new ProjectGeneration());
CodeEditor.Register(editor);
var current = CodeEditor.CurrentEditorInstallation;
foreach (string[] paths in InstalledVisualStudios.Values)
if (editor.TryGetInstallationForPath(current, out var installation))
{
if (paths.Contains(current))
{
editor.CreateIfDoesntExist();
return;
}
editor.Initialize(current);
return;
}
}

Expand Down Expand Up @@ -357,22 +358,34 @@ public void SyncAll()

public void Initialize(string editorInstallationPath)
{
CreateIfDoesntExist();
m_Initiliazer.Initialize(editorInstallationPath, InstalledVisualStudios);
}

public bool OpenProject(string path, int line, int column)
{
var comAssetPath = AssetDatabase.FindAssets("COMIntegration a:packages").Select(AssetDatabase.GUIDToAssetPath).First(assetPath => assetPath.Contains("COMIntegration.exe"));
if (string.IsNullOrWhiteSpace(comAssetPath)) // This may be called too early where the asset database has not replicated this information yet.
{
return false;
}
UnityEditor.PackageManager.PackageInfo packageInfo = UnityEditor.PackageManager.PackageInfo.FindForAssetPath(comAssetPath);
var progpath = packageInfo.resolvedPath + comAssetPath.Substring("Packages/com.unity.ide.visualstudio".Length);
var solution = GetSolutionFile(path); // TODO: If solution file doesn't exist resync.
var fileInfo = new FileInfo(path).FullName;

var solution = GetSolutionFile(path);
if (solution == "")
{
m_Generation.Sync();
solution = GetSolutionFile(path);
}
solution = solution == "" ? "" : $"\"{solution}\"";
var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = progpath,
Arguments = $"\"{CodeEditor.CurrentEditorInstallation}\" \"{path}\" {solution} {line}",
Arguments = $"\"{CodeEditor.CurrentEditorInstallation}\" \"{fileInfo}\" {solution} {line}",
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
Expand All @@ -383,12 +396,13 @@ public bool OpenProject(string path, int line, int column)

while (!process.StandardOutput.EndOfStream)
{
if (process.StandardOutput.ReadLine() == "displayProgressBar")
var outputLine = process.StandardOutput.ReadLine();
if (outputLine == "displayProgressBar")
{
EditorUtility.DisplayProgressBar("Opening Visual Studio", "Starting up Visual Studio, this might take some time.", .5f);
}

if (process.StandardOutput.ReadLine() == "clearprogressbar")
if (outputLine == "clearprogressbar")
{
EditorUtility.ClearProgressBar();
}
Expand Down
6 changes: 3 additions & 3 deletions package/package.json
Expand Up @@ -2,16 +2,16 @@
"name": "com.unity.ide.visualstudio",
"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.",
"version": "1.0.1",
"version": "1.0.2",
"unity": "2019.2",
"unityRelease": "0a7",
"dependencies": {},
"relatedPackages": {
"com.unity.ide.visualstudio.tests": "1.0.1"
"com.unity.ide.visualstudio.tests": "1.0.2"
},
"repository": {
"type": "git",
"url": "git@github.cds.internal.unity3d.com:unity/com.unity.ide.visualstudio.git",
"revision": "01f8b1736d13644871b17ddd5f18a3ef99d98e9a"
"revision": "34da9a734db5b16dfe722ac5371dac8c09099597"
}
}
1 change: 1 addition & 0 deletions versions.txt
Expand Up @@ -6,3 +6,4 @@
0.1.0-preview.11
1.0.0
1.0.1
1.0.2

0 comments on commit ca3ea47

Please sign in to comment.