forked from dotnet/interactive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement
%whos
magic command for F# (dotnet#730)
* implement `%whos` magic command for F# * get rid of unused constructor * convert potentially expensive property getter into a method * move formatter to separate class * add null check
- Loading branch information
Showing
11 changed files
with
232 additions
and
107 deletions.
There are no files selected for viewing
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 was deleted.
Oops, something went wrong.
This file was deleted.
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
|
||
namespace Microsoft.DotNet.Interactive | ||
{ | ||
public class CurrentVariable | ||
{ | ||
public CurrentVariable(string name, Type type, object value) | ||
{ | ||
Name = name; | ||
Type = type; | ||
Value = value; | ||
} | ||
|
||
public object Value { get; } | ||
|
||
public Type Type { get; } | ||
|
||
public string Name { get; } | ||
} | ||
} |
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,37 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Microsoft.DotNet.Interactive | ||
{ | ||
public class CurrentVariables : IEnumerable<CurrentVariable> | ||
{ | ||
private readonly Dictionary<string, CurrentVariable> _variables = new Dictionary<string, CurrentVariable>(); | ||
|
||
public CurrentVariables(IEnumerable<CurrentVariable> variables, bool detailed) | ||
: this(detailed) | ||
{ | ||
if (variables == null) | ||
{ | ||
throw new ArgumentNullException(nameof(variables)); | ||
} | ||
|
||
foreach (var variable in variables.Where(v => v != null)) | ||
{ | ||
_variables[variable.Name] = variable; | ||
} | ||
} | ||
|
||
private CurrentVariables(bool detailed) | ||
{ | ||
Detailed = detailed; | ||
} | ||
|
||
public bool Detailed { get; } | ||
|
||
public IEnumerator<CurrentVariable> GetEnumerator() => _variables.Values.GetEnumerator(); | ||
|
||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); | ||
} | ||
} |
Oops, something went wrong.