How to use mirrorsharp - 2 common examples

To help you get started, we’ve selected a few mirrorsharp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ashmind / mirrorsharp / Owin.Demo / app.js View on Github external
void M(int p) {
        var l = p;
    }
}

class G {
}`;

if (language === 'F#') {
    code = '[]\r\nlet main argv = \r\n    0';
}
else if (mode === 'script') {
    code = '// C# Script uses Random as the host object.\r\nvar m = Next();';
}

mirrorsharp(document.getElementById('editor-container'), {
    serviceUrl: window.location.href.replace(/^http(s?:\/\/[^/]+).*$/i, 'ws$1/mirrorsharp'),
    selfDebugEnabled: true,
    language,
    initialText: code,
    initialServerOptions: (mode !== 'regular' ? { 'x-mode': mode } : {})
});
github ashmind / mirrorsharp / AspNetCore.Demo / app.js View on Github external
const parts = item.split('=');
    o[parts[0]] = parts[1];
    return o;
}, {});
const language = (params['language'] || 'CSharp').replace('Sharp', '#');
const mode = params['mode'] || 'regular';

const textarea = document.getElementsByTagName('textarea')[0];
if (language === 'F#') {
    textarea.value = '[]\r\nlet main argv = \r\n    0';
}
else if (mode === 'script') {
    textarea.value = 'var messages = Context.Messages;';
}

const ms = mirrorsharp(textarea, {
    serviceUrl: window.location.href.replace(/^http(s?:\/\/[^/]+).*$/i, 'ws$1/mirrorsharp'),
    selfDebugEnabled: true,
    language: language
});
if (mode !== 'regular')
    ms.setServerOptions({ 'language': language, 'x-mode': mode });

mirrorsharp

A code editor `<textarea>` for .NET.

BSD-2-Clause
Latest version published 3 years ago

Package Health Score

55 / 100
Full package analysis

Popular mirrorsharp functions

Similar packages