-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
70 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using UnityEngine; | ||
using System.Linq; | ||
|
||
namespace uREPL | ||
{ | ||
|
||
public class GlobalClassCompletion : CompletionPlugin | ||
{ | ||
static private string[] globalClassNames_; | ||
|
||
protected override void OnEnable() | ||
{ | ||
if (globalClassNames_ == null) { | ||
globalClassNames_ = System.AppDomain.CurrentDomain.GetAssemblies() | ||
.SelectMany(asm => asm.GetTypes()) | ||
.Where(type => type.IsClass && type.Namespace == null) | ||
.Select(type => type.Name) | ||
.Where(name => char.IsLetter(name[0])) | ||
.Distinct() | ||
.OrderBy(name => name[0]) | ||
.ToArray(); | ||
} | ||
|
||
base.OnEnable(); | ||
} | ||
|
||
public override CompletionInfo[] GetCompletions(string input) | ||
{ | ||
var parts = input.Split(new char[] { '\n', ' ', '\t', '=', '{', '}', '(', ')', '<', '>' }); | ||
var lastPart = parts.Last(); | ||
return globalClassNames_ | ||
.Where(name => name.IndexOf(lastPart) == 0) | ||
.Select(name => new CompletionInfo( | ||
lastPart, | ||
name, | ||
"G", | ||
new Color32(50, 70, 240, 255), | ||
"global::" + name)) | ||
.ToArray(); | ||
} | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
Assets/uREPL/Scripts/Completions/GlobalClassCompletion.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace uREPL | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
m_EditorVersion: 5.4.1f1 | ||
m_StandardAssetsVersion: 0 | ||
m_EditorVersion: 5.5.1f1 |