Skip to content

Commit

Permalink
root namespace rename
Browse files Browse the repository at this point in the history
  • Loading branch information
waf committed May 30, 2021
1 parent c0e2744 commit 261a317
Show file tree
Hide file tree
Showing 27 changed files with 69 additions and 59 deletions.
2 changes: 1 addition & 1 deletion CSharpRepl.Services/Completion/AutoCompleteService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using System.Linq;
using System.Threading.Tasks;

namespace Sharply.Services.Completion
namespace CSharpRepl.Services.Completion
{
public record CompletionItemWithDescription(CompletionItem Item, Lazy<Task<string>> DescriptionProvider);

Expand Down
2 changes: 1 addition & 1 deletion CSharpRepl.Services/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using System.Collections.Generic;

namespace Sharply.Services
namespace CSharpRepl.Services
{
/// <summary>
/// Configuration from command line parameters
Expand Down
2 changes: 1 addition & 1 deletion CSharpRepl.Services/EqualityComparerFunc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System;
using System.Collections.Generic;

namespace Sharply.Services
namespace CSharpRepl.Services
{
public class EqualityComparerFunc<T> : IEqualityComparer<T>
{
Expand Down
2 changes: 1 addition & 1 deletion CSharpRepl.Services/Nuget/ConsoleNugetLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using NuGet.Common;
using PrettyPrompt.Consoles;

namespace Sharply.Services.Nuget
namespace CSharpRepl.Services.Nuget
{
public class ConsoleNugetLogger : ILogger
{
Expand Down
4 changes: 2 additions & 2 deletions CSharpRepl.Services/Nuget/NugetMetadataResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace Sharply.Services.Nuget
namespace CSharpRepl.Services.Nuget
{
public class NugetMetadataResolver : MetadataReferenceResolver
{
Expand All @@ -32,7 +32,7 @@ public NugetMetadataResolver(IConsole console, IReadOnlyCollection<string> imple
this.console = console;
this.defaultResolver = ScriptMetadataResolver.Default;
this.assemblyPaths = new HashSet<string>(implementationAssemblyPaths);
this.loadContext = new AssemblyLoadContext(nameof(Sharply) + "Repl");
this.loadContext = new AssemblyLoadContext(nameof(CSharpRepl) + "Repl");
this.nugetInstaller = new NugetPackageInstaller(console);
this.dummyPlaceholder = new[] { MetadataReference.CreateFromFile(typeof(object).Assembly.Location) }.ToImmutableArray();

Expand Down
2 changes: 1 addition & 1 deletion CSharpRepl.Services/Nuget/NugetPackageInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace Sharply.Services.Nuget
namespace CSharpRepl.Services.Nuget
{
public class NugetPackageInstaller
{
Expand Down
2 changes: 1 addition & 1 deletion CSharpRepl.Services/Roslyn/PrettyPrinter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.CodeAnalysis.Scripting.Hosting;
using System;

namespace Sharply.Services.Roslyn
namespace CSharpRepl.Services.Roslyn
{
class PrettyPrinter
{
Expand Down
2 changes: 1 addition & 1 deletion CSharpRepl.Services/Roslyn/ReferenceAssemblyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using System.Reflection;
using System.Runtime.InteropServices;

namespace Sharply.Services.Roslyn
namespace CSharpRepl.Services.Roslyn
{
/// <remarks>
/// Useful notes https://github.com/dotnet/roslyn/blob/main/docs/wiki/Runtime-code-generation-using-Roslyn-compilations-in-.NET-Core-App.md
Expand Down
2 changes: 1 addition & 1 deletion CSharpRepl.Services/Roslyn/RoslynExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.CodeAnalysis;
using System;

namespace Sharply.Services.Roslyn
namespace CSharpRepl.Services.Roslyn
{
static class RoslynExtensions
{
Expand Down
8 changes: 4 additions & 4 deletions CSharpRepl.Services/Roslyn/RoslynServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

using Sharply.Services.SyntaxHighlighting;
using CSharpRepl.Services.SyntaxHighlighting;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
Expand All @@ -12,12 +12,12 @@
using System.Linq;
using System.Threading.Tasks;
using System.Threading;
using Sharply.Services.SymbolExploration;
using Sharply.Services.Completion;
using CSharpRepl.Services.SymbolExploration;
using CSharpRepl.Services.Completion;
using Microsoft.Extensions.Caching.Memory;
using PrettyPrompt.Consoles;

namespace Sharply.Services.Roslyn
namespace CSharpRepl.Services.Roslyn
{
public class RoslynServices
{
Expand Down
4 changes: 2 additions & 2 deletions CSharpRepl.Services/Roslyn/ScriptRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

using Sharply.Services.Nuget;
using CSharpRepl.Services.Nuget;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Scripting;
Expand All @@ -15,7 +15,7 @@
using Microsoft.CodeAnalysis.Scripting.Hosting;
using PrettyPrompt.Consoles;

namespace Sharply.Services.Roslyn
namespace CSharpRepl.Services.Roslyn
{
class ScriptRunner
{
Expand Down
2 changes: 1 addition & 1 deletion CSharpRepl.Services/Roslyn/WorkspaceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using System.Collections.Generic;
using System.Linq;

namespace Sharply.Services.Roslyn
namespace CSharpRepl.Services.Roslyn
{
class WorkspaceManager
{
Expand Down
2 changes: 1 addition & 1 deletion CSharpRepl.Services/SymbolExploration/SymbolExplorer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Linq;
using System.Threading.Tasks;

namespace Sharply.Services.SymbolExploration
namespace CSharpRepl.Services.SymbolExploration
{
/// <summary>
/// Provides information (e.g. types) of symbols in a <see cref="Document"/>.
Expand Down
2 changes: 1 addition & 1 deletion CSharpRepl.Services/SyntaxHighlighting/DefaultTheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using Microsoft.CodeAnalysis.Classification;

namespace Sharply.Services.SyntaxHighlighting
namespace CSharpRepl.Services.SyntaxHighlighting
{
class DefaultTheme : Theme
{
Expand Down
2 changes: 1 addition & 1 deletion CSharpRepl.Services/SyntaxHighlighting/HighlightedSpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.CodeAnalysis.Text;
using PrettyPrompt.Highlighting;

namespace Sharply.Services.SyntaxHighlighting
namespace CSharpRepl.Services.SyntaxHighlighting
{
public record HighlightedSpan(TextSpan TextSpan, AnsiColor Color);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using System.Text.Json;
using System.Threading.Tasks;

namespace Sharply.Services.SyntaxHighlighting
namespace CSharpRepl.Services.SyntaxHighlighting
{
/// <summary>
/// Invokes roslyn's classification API on a code document, and combines the
Expand Down
6 changes: 3 additions & 3 deletions CSharpRepl.Tests/CommandLineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

using Sharply.Services;
using Sharply.Services.Roslyn;
using CSharpRepl.Services;
using CSharpRepl.Services.Roslyn;
using System;
using System.Linq;
using Xunit;

namespace Sharply.Tests
namespace CSharpRepl.Tests
{
public class CommandLineTests
{
Expand Down
6 changes: 3 additions & 3 deletions CSharpRepl.Tests/CompletionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

using Sharply.Services;
using Sharply.Services.Roslyn;
using CSharpRepl.Services;
using CSharpRepl.Services.Roslyn;
using System.Linq;
using System.Threading.Tasks;
using Xunit;

namespace Sharply.Tests
namespace CSharpRepl.Tests
{
[Collection(nameof(RoslynServices))]
public class CompletionTests : IAsyncLifetime
Expand Down
6 changes: 3 additions & 3 deletions CSharpRepl.Tests/EvaluationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

using Sharply.Services;
using Sharply.Services.Roslyn;
using CSharpRepl.Services;
using CSharpRepl.Services.Roslyn;
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace Sharply.Tests
namespace CSharpRepl.Tests
{
[Collection(nameof(RoslynServices))]
public class EvaluationTests : IAsyncLifetime
Expand Down
2 changes: 1 addition & 1 deletion CSharpRepl.Tests/FakeConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using PrettyPrompt.Consoles;
using System.Text;

namespace Sharply.Tests
namespace CSharpRepl.Tests
{
static class FakeConsole
{
Expand Down
6 changes: 3 additions & 3 deletions CSharpRepl.Tests/SymbolExplorerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

using Sharply.Services;
using Sharply.Services.Roslyn;
using CSharpRepl.Services;
using CSharpRepl.Services.Roslyn;
using System.Threading.Tasks;
using Xunit;

namespace Sharply.Tests
namespace CSharpRepl.Tests
{
[Collection(nameof(RoslynServices))]
public class SymbolExplorerTests : IAsyncLifetime
Expand Down
6 changes: 3 additions & 3 deletions CSharpRepl.Tests/SyntaxHighlightingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

using Microsoft.CodeAnalysis.Text;
using Sharply.Services;
using Sharply.Services.Roslyn;
using CSharpRepl.Services;
using CSharpRepl.Services.Roslyn;
using System.Linq;
using System.Threading.Tasks;
using Xunit;

namespace Sharply.Tests
namespace CSharpRepl.Tests
{
[Collection(nameof(RoslynServices))]
public class SyntaxHighlightingTests : IAsyncLifetime
Expand Down
6 changes: 3 additions & 3 deletions CSharpRepl/CommandLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

using Sharply.Services;
using Sharply.Services.Roslyn;
using CSharpRepl.Services;
using CSharpRepl.Services.Roslyn;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using static System.Environment;

namespace Sharply
namespace CSharpRepl
{
/// <summary>
/// Parses command line arguments.
Expand Down
32 changes: 21 additions & 11 deletions CSharpRepl/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@

using System;
using System.Threading.Tasks;
using Sharply.Services.Roslyn;
using CSharpRepl.Services.Roslyn;
using PrettyPrompt.Highlighting;
using PrettyPrompt.Consoles;
using Sharply.Prompt;
using Sharply.Services;
using CSharpRepl.Prompt;
using CSharpRepl.Services;
using System.Threading;
using PrettyPrompt;

namespace Sharply
namespace CSharpRepl
{
static class Program
{
private static IConsole console;
private static RoslynServices roslyn;
private static IPrompt prompt;

static async Task Main(string[] args)
{
Expand Down Expand Up @@ -63,7 +65,7 @@ private static async Task RunPrompt(Configuration config)
// `roslyn` is required for the syntax highlighting in the text,
// and `prompt` is required because it enables escape sequences.
roslyn = new RoslynServices(console, config);
var prompt = PromptConfiguration.Create(roslyn);
prompt = PromptConfiguration.Create(roslyn);

console.WriteLine($"Welcome to the C# REPL (Read Eval Print Loop)!");
console.WriteLine("Type C# expressions and statements at the prompt and press Enter to evaluate them.");
Expand Down Expand Up @@ -163,18 +165,26 @@ private static string Reference(string reference = null)
var argument = reference is null ? "" : Color("string") + @" """ + reference + @"""" + AnsiEscapeCodes.Reset;

return preprocessor + argument;

}

private static string VariableDeclaration =>
Color("keyword") + "var" + AnsiEscapeCodes.Reset + " " +
Color("field name") + "x" + AnsiEscapeCodes.Reset + " " +
Color("operator") + "=" + AnsiEscapeCodes.Reset;
prompt.HasUserOptedOutFromColor
? "var x ="
: (Color("keyword") + "var" + AnsiEscapeCodes.Reset + " " +
Color("field name") + "x" + AnsiEscapeCodes.Reset + " " +
Color("operator") + "=" + AnsiEscapeCodes.Reset);

static string Color(string reference) =>
AnsiEscapeCodes.ToAnsiEscapeSequence(new ConsoleFormat(roslyn.ToColor(reference)));

private static string Help => AnsiEscapeCodes.Green + @"help" + AnsiEscapeCodes.Reset;
private static string Exit => AnsiEscapeCodes.BrightRed + @"exit" + AnsiEscapeCodes.Reset;
private static string Help =>
prompt.HasUserOptedOutFromColor
? @"""help"""
: AnsiEscapeCodes.Green + "help" + AnsiEscapeCodes.Reset;

private static string Exit =>
prompt.HasUserOptedOutFromColor
? @"""exit"""
: AnsiEscapeCodes.BrightRed + @"exit" + AnsiEscapeCodes.Reset;
}
}
6 changes: 3 additions & 3 deletions CSharpRepl/Prompt/PromptAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

using System.Collections.Generic;
using System.Linq;
using Sharply.Services.SyntaxHighlighting;
using CSharpRepl.Services.SyntaxHighlighting;
using PrettyPrompt.Highlighting;
using PromptCompletionItem = PrettyPrompt.Completion.CompletionItem;
using Sharply.Services.Completion;
using CSharpRepl.Services.Completion;

namespace Sharply.Prompt
namespace CSharpRepl.Prompt
{
/// <summary>
/// Maps the classes produced by our roslyn code into the classes for interacting with our prompt library.
Expand Down
Loading

0 comments on commit 261a317

Please sign in to comment.