• Stars
    star
    218
  • Rank 181,805 (Top 4 %)
  • Language
    C#
  • License
    BSD 2-Clause "Sim...
  • Created over 8 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

MirrorSharp is a code editor <textarea> built on Roslyn and CodeMirror

Overview

MirrorSharp is a reusable client-server code editor component built on Roslyn and CodeMirror.

Features

Code completion

Code completion

Signature help

Signature help

Quick fixes

Quick fixes

Diagnostics

Diagnostics

Quick info

Quick info

Usage

You'll need the following:

  • MirrorSharp.AspNetCore on the server (MirrorSharp.Owin if .NET Framework)
  • mirrorsharp.js — client library that provides the user interface

Server

build

MirrorSharp.AspNetCore

NuGet

Install-Package MirrorSharp.AspNetCore

If using Endpoint Routing (3.0+ only):

app.UseEndpoints(endpoints => {
    // ...
    endpoints.MapMirrorSharp("/mirrorsharp");
});

If not using Endpoint Routing:

app.MapMirrorSharp("/mirrosharp");

MirrorSharp.Owin

NuGet

Install-Package MirrorSharp.Owin

In your Startup:

app.MapMirrorSharp("/mirrosharp");

Client

build

Library Type NPM
mirrorsharp-codemirror-6-preview Latest npm
mirrorsharp Stable npm
npm install mirrorsharp-codemirror-6-preview --save

Note: The name is temporary — once all testing on 6-preview is completed, it will become mirrorsharp 3.

Breaking Changes

Version mirrorsharp-codemirror-6-preview (future mirrorsharp 3.0+) includes a number of breaking changes — see migration-from-2.md for the full migration guide.

Build

Since mirrorsharp JS files are not bundled, you'll need to use a bundler such as Webpack, Parcel or ESBuild.

You can see a Parcel example in AspNetCore.Demo.

Note that mirrorsharp is written in TypeScript, and the package includes full TypeScript types.

Note: You need to manually require/import mirrorsharp/mirrorsharp.css into your bundle.

Usage

import mirrorsharp from 'mirrorsharp-codemirror-6-preview';

mirrorsharp(container, { serviceUrl: 'wss://your_app_root/mirrorsharp' });

If you're not using HTTPS, you'll likely need ws:// instead of wss://.

Note that the container is an actual HTML element, and not a CSS selector.

API

TODO. In general the idea is that "it just works", however customization is a goal and some options are already available.

Demos

You can check out the demos if you clone the repository locally.
After cloning, run ms setup to build and prepare everything.

Testing

TODO, but see MirrorSharp.Testing on NuGet.

More Repositories

1

SharpLab

.NET language playground
C#
2,691
star
2

FluentConsole

FluentConsole.Green.Line("Hello World!")
C#
123
star
3

ashmind-extensions

Most of those extensions should have been in BCL.
C#
65
star
4

SourceMock

SourceMock is a C# mocking framework based on source generators
C#
55
star
5

ExceptionBreaker

Visual Studio extension that provides a way to quickly toggle breaking on all exceptions.
C#
48
star
6

net-feature-tests

Feature tests for .NET libraries
HTML
45
star
7

Unbreakable

Alive, dammit!
C#
37
star
8

expressive

Expressive is a library that converts compiled methods into expression trees.
C#
32
star
9

Argument

Argument validation methods, for example: this.user = Argument.NotNull("user", user).
C#
26
star
10

SolutionIcon

Visual Studio extension that adds solution-related icon to VS taskbar button.
C#
23
star
11

SourcePath

A prototype of XPath-like queries for C# syntax trees
C#
15
star
12

librawnet

Wrapper for the libraw API. You can *try* to use it, but it is very raw indeed.
C#
14
star
13

StringInterpolationBridge

FormattableString for pre 4.6 .NET
XML
11
star
14

language-syntax-explanations

📚 Language syntax explanations used by SharpLab
JavaScript
9
star
15

html2text

Small utility to extract text from HTML
C#
7
star
16

AttachToAnything

Provides a Visual Studio toolbar to quickly attach to any predefined process
C#
7
star
17

neostructure

Opinionated project template for .NET
JavaScript
5
star
18

pedanticsvg

A code-focused SVG editor
JavaScript
5
star
19

codemirror-addon-infotip

Infotip is a CodeMirror addon that provides context-based tooltips
JavaScript
5
star
20

gallery

Peer-to-browser gallery implementation in ASP.NET MVC.
C#
4
star
21

StackFilter

Alt. homepage for StackOverflow with 200% more filters
JavaScript
4
star
22

Gate.Adapters.AspNet

Unofficial ASP.NET (MVC) adapter for https://github.com/owin/gate
JavaScript
4
star
23

Cilin

Here be dragons
C#
4
star
24

codemirror-addon-lint-fix

Lint Fix is a CodeMirror addon that provides UI for quick-fixing lint issues.
TypeScript
4
star
25

light

C#
3
star
26

infoof

Info.PropertyOf<You>(u => u.Bases)
C#
3
star
27

AgentHeisenbug

[ThreadSafe] and [ReadOnly] for ReSharper
C#
3
star
28

lezer-csharp-simple

Minimal C# parser for lezer parser system
TypeScript
3
star
29

sharplab-infrastructure

PowerShell
3
star
30

WebConfig.MimeMaps

Shell
3
star
31

xsltui

Single page XSLT-transformer.
JavaScript
3
star
32

lightwiki

JavaScript
3
star
33

Autofac.Extras.FileSystemRegistration

File system assembly discovery for Autofac (e.g. builder.RegisterAssemblyModulesInDirectories).
C#
3
star
34

ashmind-code

Managed program structural analysis attempts from 2008
C#
3
star
35

lightget

A simple .NET thing that tries to be wget
C#
2
star
36

ftpush

C#
2
star
37

LightMigrator

Yet another migrations framework (readme will appear eventually)
C#
2
star
38

oldowan

The primitive build system
TypeScript
2
star
39

pedantic-io-embeddedresource

Embedded resource helper that mirrors File APIs: e.g. EmbeddedResource.ReadAllText().
C#
2
star
40

api-extractor-bug-import-type

Repro for api-extractor import type bug
TypeScript
2
star
41

Impostor

Configuration-based mock HTTP service
C#
2
star
42

licenses.json

A single JSON data file with information on common software licenses.
JavaScript
2
star
43

making.sharplab.io

Ruby
2
star
44

rxjs-asynctestscheduler-prototype

PROTOTYPE, do not use yet
TypeScript
2
star
45

textmetrics

JavaScript library for text measurement (similar to fontmetrics)
JavaScript
2
star
46

spinach

A set of tools to sign unsigned assemblies
C#
2
star
47

OpenSans.nupkg

NuGet package for Open Sans by Steve Matteson.
2
star
48

CopyAndReplace

Visual Studio extension to quckly rename/change file that was just pasted
C#
2
star
49

redrocket

JavaScript
2
star
50

AutoSwap

Very incomplete DI service implementation hotswapper
C#
1
star
51

csharplang-reader

Simple reader for dotnet/csharplang meeting notes.
TypeScript
1
star
52

zirconium-fish

A very rough proof of concept for in-browser automation (Chrome only for now).
JavaScript
1
star
53

ashmind.github.io

1
star
54

RoslynList

List of all roslyn-related online tools
1
star
55

Chew

Tool that combines/minifies <script> and <link> tags in html. Warning: very limited/bad code inside.
C#
1
star
56

AshMind.IO.Abstractions

Similar to System.IO.Abstractions, but with .NET 4.5 methods and slightly different API
C#
1
star
57

bootstrap-less-singlefile

A single file version of bootstrap .less files
CSS
1
star