Skip to content

Commit

Permalink
0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
frarees committed Oct 17, 2020
1 parent 1cf1473 commit f80273f
Show file tree
Hide file tree
Showing 39 changed files with 520 additions and 906 deletions.
2 changes: 2 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Select your favourite [external script editor](https://docs.unity3d.com/Manual/P
| VimR | || |
| gVim || | |
| Sublime Text 3 ||| |
| CotEditor | || |
| BBEdit | || |

_gVim versions 8.1 and 8.2._

Expand Down
Binary file modified .github/images/prefs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 21 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## [0.6.0] - 2020-10-17

### Added
- Revised installation paths.
- Fall back on PATH when searching for installations.
- Check for successful MonoInstallationFinder reflection.
- Export FrameworkPathOverride setting for integrations that allow passing environment variables.
- Native opening for editors that require it.
- Custom arguments per editor.
- Generate project files on demand.
- Discovery APIs to find and use installations.
- Support for BBEdit and CotEditor on macOS.

### Removed
- Launcher library and its APIs.
- Setting class.
- OmniSharp reloading.
- Matching compiler version on 2020.2+ (Unity fixed it).

## [0.5.1] - 2020-10-12

### Added
Expand All @@ -8,7 +27,7 @@
- `package.json` EditorConfig rules.
- .NET EditorConfig rules.

### Changed
### Removed
- Don't include the README in the package.

## [0.5.0] - 2020-10-06
Expand Down Expand Up @@ -85,7 +104,7 @@
- Support for MacVim on macOS.
- Support for Sublime Text 3 on macOS.

[Unreleased]: https://github.com/frarees/easyeditor/compare/v0.5.1...HEAD
[0.6.0]: https://github.com/frarees/easyeditor/compare/v0.5.1...v0.6.0
[0.5.1]: https://github.com/frarees/easyeditor/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/frarees/easyeditor/compare/v0.4.3...v0.5.0
[0.4.3]: https://github.com/frarees/easyeditor/compare/v0.4.2...v0.4.3
Expand Down
5 changes: 0 additions & 5 deletions Editor/AssemblyInfo.cs

This file was deleted.

8 changes: 0 additions & 8 deletions Editor/AssemblyInfo.cs.meta

This file was deleted.

96 changes: 96 additions & 0 deletions Editor/Discovery.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
namespace EasyEditor
{
using System.Collections.Generic;
using System.IO;
using Unity.CodeEditor;
using UnityEditor;
using UnityEngine;

[System.Serializable]
internal class Discovery
{
public string name = default;
public string executable = default;
public string[] paths = default;
public string defaultArguments = default;

public bool inheritsEnvironmentVariables = false;
public bool requiresNativeOpen = false;

[TextArea] public string notes = default;

private List<string> allPaths = new List<string>();

public bool AutoGenerate
{
get => EditorPrefs.GetBool($"EasyEditor.{name}.AutoGenerate", true);
set => EditorPrefs.SetBool($"EasyEditor.{name}.AutoGenerate", value);
}

public bool ExportFrameworkPathOverride
{
get => EditorPrefs.GetBool($"EasyEditor.{name}.ExportFrameworkPathOverride", !requiresNativeOpen && inheritsEnvironmentVariables);
set => EditorPrefs.SetBool($"EasyEditor.{name}.ExportFrameworkPathOverride", value && !requiresNativeOpen && inheritsEnvironmentVariables);
}

#if !UNITY_2020_2_OR_NEWER
public bool MatchCompilerVersion
{
get => EditorPrefs.GetBool($"EasyEditor.{name}.MatchCompilerVersion", true);
set => EditorPrefs.SetBool($"EasyEditor.{name}.MatchCompilerVersion", value);
}
#endif

public string Arguments
{
get => EditorPrefs.GetString($"EasyEditor.{name}.Arguments", defaultArguments);
set => EditorPrefs.SetString($"EasyEditor.{name}.Arguments", value);
}

public bool TryGetFirstValidInstallation(out CodeEditor.Installation installation)
{
allPaths.Clear();

for (int i = 0; i < paths.Length; i++)
{
string path = paths[i];
#if UNITY_EDITOR_WIN
path = path.Replace("$(ProgramFiles)", System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFiles));
path = path.Replace("$(ProgramFiles(x86))", System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFilesX86));
#endif
allPaths.Add(path);
}

string pathEnv = System.Environment.GetEnvironmentVariable("PATH");
if (!string.IsNullOrEmpty(pathEnv))
{
allPaths.AddRange(pathEnv.Split(':'));
}

foreach (string path in allPaths)
{
if (!Directory.Exists(path))
{
continue;
}

string editorPath = Path.Combine(path, executable);
if (!File.Exists(editorPath))
{
continue;
}

installation = new CodeEditor.Installation()
{
Name = name,
Path = editorPath,
};
return true;
}

installation = default;
return false;
}
}
}

2 changes: 1 addition & 1 deletion Editor/Launcher.cs.meta → Editor/Discovery.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f80273f

Please sign in to comment.