Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the Monaco Editor in a browser without VSCode #446

Closed
Sevin777 opened this issue Nov 22, 2015 · 41 comments
Closed

Using the Monaco Editor in a browser without VSCode #446

Sevin777 opened this issue Nov 22, 2015 · 41 comments
Assignees
Labels
feature-request Request for new features or functionality
Milestone

Comments

@Sevin777
Copy link

Now that VS Code is open source, it also means that the Monaco Editor is open source (at-least to some extent).

I would really like to use this editor in my own web application for editing TypeScript files. The only problem is I can't find any documentation about how to do this. I know its possible because the editor is on TypeScript Playground and a few other places.

As far as I can tell, the open sourcing of VS Code is the first time the source code of the Monaco editor has been made public. Also, I think that the VS Code repository is the primary source of the Monaco editor (someone from Microsoft please confirm?).

So far, there have been many questions about using the Monaco Editor on Stack Overflow and other forums, but I have yet to see an official reply from Microsoft.

Can someone please provide some documentation on using the Monaco Editor in a web site, or perhaps release the source code of TypeScript Playground (There is nothing to hide now that we have the Monaco source in the VS Code repository).

Currently, the only thing keeping me from using TypeScript as a JavaScript replacement is the fact that I can't easily use the Monaco Editor inside of my web application. I'm currently using the ACE Editor with a Tern plugin I created. I don't want to go through all of the work of creating full Intellisense support for TypeScript inside of ACE because its a significant undertaking- Instead I'd rather contribute to the Monaco editor and use it as a replacement for ACE (and replace JavaScript with TypeScript).

@Sevin777 Sevin777 changed the title Using the Monaco Editor without VSCode Using the Monaco Editor in a browser without VSCode Nov 22, 2015
@mackenza
Copy link

+1 for this. Doing proper context code completion in CodeMirror and Ace is a nightmare. An open source editor that had good hooks to this kind of thing would be gold. We just need some docs on using it ;)

@egamma egamma added the feature-request Request for new features or functionality label Nov 22, 2015
@egamma
Copy link
Member

egamma commented Nov 22, 2015

@sevin7676 you are correct that the Monaco editor is contained in the vscode repository and we are working on making the Monaco Editor more easy to consume independent of VS Code.

@lzantal
Copy link

lzantal commented Nov 23, 2015

+1 making some docs on Monaco editor. So far this editor beats both codemirror and ace :)

@egamma egamma modified the milestone: Backlog Dec 10, 2015
@malekpour
Copy link

This is almost same as #815

@JoshClose
Copy link

I'm eagerly awaiting this also. Don't forget to close this UserVoice suggestion when it's complete. https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/7782546-release-monaco-javascript-code-editor

@bobzhang
Copy link

+1, the other options like codemirror or ace does not even come close compared with typescript playground

@pawsong
Copy link

pawsong commented Dec 29, 2015

+1 Waiting for this!

@T18970237136
Copy link

+1
Any news on this? I'm waiting for this so I can embed the editor on our product's config page where the user can edit custom TypeScripts that are run on a server and provide our API definition.
Thanks!

@egamma
Copy link
Member

egamma commented Jan 22, 2016

It is still on our backlog but it didn't make the cut for the GA milestone, sorry.

@basarat
Copy link
Contributor

basarat commented Jan 29, 2016

I've been using code mirror to bootstrap http://alm.tools/. Would like to integrate Monaco when it becomes available. I have time. It's a labor of love 🌹

@egamma
Copy link
Member

egamma commented Jan 30, 2016

fyi @Microsoft/vscode

@joselee
Copy link

joselee commented Feb 5, 2016

+1 The editor at the typescriptlang playground is amazing! Especially the speed, intellisense, and VS look-and-feel.

Been working a lot with other code editors that offer intellisense, but none come close to Monaco. Eagerly waiting :)

Thanks for keeping us updated, @egamma

@verbman
Copy link

verbman commented Feb 12, 2016

+1 yes please

@codler
Copy link

codler commented Feb 26, 2016

👍

@darrinm
Copy link

darrinm commented Mar 29, 2016

While we wait for official documentation... This HTML hosts the editor (in TypeScript mode) when served from the 'out' directory VSC builds to:

<!DOCTYPE html>
<html>
<head>
<title>VSC Editor</title>
<style>
    html, body { height: 100%; margin: 0; }
    .box { display: flex; flex-flow: column; height: 100%; }
    .box .row { flex: 0 1 auto; }
    .box .row.content { flex: 1 1 auto; }
</style>
</head>
<body>
<div class='box'>
    <div class='row content' id="editor"></div>
</div>
<script type="text/javascript" src="vs/loader.js"></script>
<script type="text/javascript">
'use strict';

(function () {
    require(['vs/editor/editor.main', 'vs/base/browser/ui/aria/aria'], function (main, aria) {
        aria.setARIAContainer(document.body);

        var editor = Monaco.Editor.create(document.getElementById('editor'), {
            value: 'var foo = \'bar\';',
            mode: 'text/typescript'
        });

        window.addEventListener('resize', function () {
            editor.layout();
        });
    });
})();
</script>
</body>
</html>

@darrylryan
Copy link

I managed to get the editor working using something similar to darrinm's solution but I still haven't figured out how to add extra libraries to the auto completion system. The azure-based playgrounds out there seem to have a way to include code libraries but the API seems different for the version in VS Code and I haven't been able to figure it out yet :(

@Starcounter-Jack
Copy link

👍

@mbana
Copy link

mbana commented Apr 19, 2016

@egamma do you have a rough date on when this might be available?

@Cryrivers
Copy link
Contributor

+1 please make it possible

@ghost
Copy link

ghost commented Apr 20, 2016

+1 ,I think that this feature will bring closer to this project many people who don't use vs code yet

@egamma
Copy link
Member

egamma commented Apr 22, 2016

@mbana we made good progress on this during the April decompression iteration (e.g. #4640). However, we need more time to work on docs. It is a candidate for May but we do not have the May iteration plan yet.

@mbana
Copy link

mbana commented May 1, 2016

@egamma, thank you. I looked at the PR - there's a lot of commits there and I am not entirely familiar with with VSCode code-base just yet.

  • Is there a minimal example available that I could look showing the editor being used inside a browser?
  • Out of interest, is VSCode taking the approach Eclipse took in allowing one to build ship a custom IDE with only a chosen set of features enabled?

All the best! Love the VSCode.

@egamma
Copy link
Member

egamma commented May 2, 2016

@mbana I've linked to the PR as an illustration of progress, not that you can use it already.

Out of interest, is VSCode taking the approach Eclipse took in allowing one to build ship a custom IDE with only a chosen set of features enabled?

This is not our main focus but you can create a branded custom IDE, the product.json file is the means towards branding.

Glad you like VS Code

@gujiman
Copy link

gujiman commented May 10, 2016

Is there any difference between Monaco Editor and Winjs (http://try.buildwinjs.com/)? They both seem similar. Will Monaco be better than Winjs?

@nikeee
Copy link
Contributor

nikeee commented May 10, 2016

@gujiman The WinJS site seems to use a version of monaco, since it uses classes like monaco-editor vs-dark. The WinJS library itself does not seem to contain any code editor controls.

@vbguyny
Copy link

vbguyny commented May 10, 2016

The intellisense/autocomplete in Winjs appears to be very slow. I suggest looking at http://vbguyny.github.io/Ace.Tern/demo.html which uses the ACE editor plus the Tern libraries to create a very powerful and fast editor.

@malekpour
Copy link

@gujiman WinJS is irrelevant, it is a collection of UI controls which does not contain a source code editor.
If you are looking for good examples of Monaco in browser you can check http://www.typescriptlang.org/play/index.html or Visual Studio Live if you have an Azure Subscription.

@egamma Is there any possibility to access Visual Studio Live source code? I know https://github.com/projectkudu/kudu is open source but front end code is not available, right?

@egamma
Copy link
Member

egamma commented May 11, 2016

Please see the May plan we will make progress on this topic #6105

@joselee
Copy link

joselee commented May 11, 2016

Great news! Thank you egamma!

@nojvek
Copy link
Contributor

nojvek commented May 11, 2016

I've been meaning to get a prototype of vscode as editor in chrome devtools workspaces in my free time. Would be great to have documentation.

@ups216
Copy link

ups216 commented Jun 3, 2016

@egamma Thanks a lot for your Q&A yesterday in Shanghai. I read the plan and looks like Monaco will be a separate repo? is this happening already? Can we have the URL?

BTW: hope you had a great time in China :)

@basarat
Copy link
Contributor

basarat commented Jun 3, 2016

@ups216 its been done https://www.npmjs.com/package/monaco-editor-core which is just shipped (pushed to npm) from this repository and I'm experimenting migrating alm to it as well alm-tools/alm#120 🌹

@jokeyrhyme
Copy link

@basarat have you considered using something like https://github.com/lerna/lerna to help manage the mono-repo approach (single repo, multiple npm packages) ? Do you think there will be other goodies in VSCode that make sense to extract as separate npm packages?

@Sevin777
Copy link
Author

It looks like progress is being made on this :)

https://code.visualstudio.com/updates#vscode
image

@jonathanhotono
Copy link

+1 looking forward to get the full Javascript solution of vscode. This is exciting!

@maxdec
Copy link

maxdec commented Jun 20, 2016

\o/ https://github.com/Microsoft/monaco-editor

@Sevin777
Copy link
Author

@maxdec , thank you for the link.

The issue is now resolved!

https://github.com/Microsoft/monaco-editor

@basarat
Copy link
Contributor

basarat commented Jun 21, 2016

Just made a release of alm that uses monaco : 0.1.0. Let me know how it goes 🌹

@jokeyrhyme
Copy link

Will VSCode use this newly extracted Monaco? Will they be synchronised? Will they diverge?

@scottlu
Copy link

scottlu commented Sep 29, 2016

GHEdit is a project that has "ported" large sections VSCode to run in a browser. If you have an interest in doing that here is the project page:

https://github.com/spiffcode/ghedit

It's targeted at editing, searching, and browsing Github repos. Live version:

https://spiffcode.github.io/ghedit

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests