Skip to content

attackgithub/mirrorsharp

 
 

Repository files navigation

Overview

AppVeyor branch AppVeyor tests

MirrorSharp is a code editor <textarea> 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.Owin on the server (.NET Core is planned, but not supported yet)
  • mirrorsharp.js — client library that provides the user interface

Server

MirrorSharp.Owin

NuGet

NuGet: Install-Package MirrorSharp.Owin -Pre
Once installed, call app.UseMirrorSharp() in your OWIN startup.

Client

npm

NPM: npm install mirrorsharp --save

CSS

If you are using LESS, CSS references can be done automatically by including mirrorsharp/mirrorsharp.less.
Otherwise, make sure to include the following:

  1. codemirror/lib/codemirror.css
  2. codemirror/addon/lint/lint.css
  3. codemirror/addon/hint/show-hint.css
  4. codemirror-addon-infotip/dist/infotip.css
  5. codemirror-addon-lint-fix/dist/lint-fix.css
  6. mirrorsharp/mirrorsharp.css

JS

JS can be done automatically since mirrorsharp has proper requires. Otherwise:

  1. codemirror/lib/codemirror.js
  2. codemirror/mode/clike/clike.js
  3. codemirror/addon/lint/lint.js
  4. codemirror/addon/hint/show-hint.js
  5. codemirror-addon-infotip/dist/infotip.js
  6. codemirror-addon-lint-fix/dist/lint-fix.js
  7. mirrorsharp/mirrorsharp.js

Usage

Once referenced, you can do the following:

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

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

Note that textarea is an actual textarea element, and not a CSS selector or jQuery object.

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 .\mirrorsharp build to build and prepare everything.

Testing

TODO, but see MirrorSharp.Testing on NuGet.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 81.7%
  • JavaScript 12.3%
  • CSS 3.9%
  • HTML 1.6%
  • Other 0.5%