Questions tagged [monaco-editor]

Monaco Editor is the JavaScript based text editing portion of VSCode extracted out into standalone library.

The Monaco Editor is the JavaScript based text editing portion of VSCode extracted out into standalone library. It provides an extensive plugin architecture as well as an extensible intellisense like system.

983 questions
43
votes
3 answers

Get the value of Monaco Editor

Microsoft recently open sourced their monaco editor (similar to ace/codemirror). https://github.com/Microsoft/monaco-editor I've got it up and running in the browser, but still can't figure out how to get the current text of the editor, like if I…
Kyle Gobel
  • 5,530
  • 9
  • 45
  • 68
41
votes
6 answers

Monaco editor dynamically resizable

I have been searching for a discussion about if it's possible to mimic the html tag textarea's resizing when using Monaco Editor's field all over the Internet but I couldn't find one answering my question. I'm using the monaco-editor npm package in…
elenaHristova
  • 611
  • 1
  • 8
  • 16
27
votes
3 answers

Adding JavaScript type hints for VSCode/Monaco Intellisence

Is there a way to hint to VSCode/Monaco's intellisense the types of variables. I have some code like this var loc = window.location; var gl = context1.getContext("webgl"); var ctx = context2.getContext("2d"); I see that VSCode knows that loc is a…
gman
  • 100,619
  • 31
  • 269
  • 393
25
votes
2 answers

Syntax validation of a custom language in Monaco editor

I'm trying to integrate a custom language to monaco editor and I went through https://microsoft.github.io/monaco-editor/monarch.html to get an idea on syntax highlighting. But I couldn't find any doc on how we can add error/warning validations…
user2894296
  • 590
  • 1
  • 10
  • 20
24
votes
1 answer

Is there an example project for monaco-editor with omnisharp on a webpage

In my project, I use C# Roslyn scripts for some automation that can my customer write alone. I compile and run this on runtime. Now I would like to have a web editor for c# with intellisense and spell check. For code completion, I would like also to…
Chape Hans
  • 241
  • 1
  • 5
23
votes
4 answers

Monaco Editor 'onChange' event?

I've just started investigating Monaco to be used as the editor for our internal code playground. And I'm unable to figure out how to create a handler for whenever the text in the editor window is changed, either by typing, pasting, or deleting. …
elora
  • 451
  • 1
  • 3
  • 14
23
votes
2 answers

Monaco Editor - How to make some areas readonly

I'm trying to configure the Monaco Editor in a way that certain regions of the textcontent are readonly. More precise, I want the first and last line to be readonly. Example below: public something(someArgument) { // This is readonly // This is…
custi
  • 553
  • 1
  • 4
  • 11
21
votes
5 answers

How do I insert text into a Monaco Editor?

I have a monaco code editor embedded in my app. How do I programmatically insert text on a particular line? var editor = monaco.editor.create(document.getElementById("container"), { value: "// First line\nfunction hello() {\n\talert('Hello…
Doug
  • 14,387
  • 17
  • 74
  • 104
20
votes
3 answers

How to use addExtraLib in Monaco with an external type definition

I can see how to use addExtraLib in Monaco to add an ambient declaration file. What's not clear is how to use this function with an external declaration file so that Typescript code in the editor can do a: import * as External from "external" …
Joe Wood
  • 1,321
  • 2
  • 13
  • 25
19
votes
2 answers

Scroll to line in Monaco editor

I see there is a way to set scrolltop in monaco editor. How would one scroll to a specific line instead of a specific pixel?
Johnston
  • 20,196
  • 18
  • 72
  • 121
18
votes
3 answers

monaco-editor: hide overview ruler

Is there a way to completely hide overview ruler in monaco-editor? It is still visible with the following: overviewRulerLanes: 0, hideCursorInOverviewRuler: true, scrollbar: { vertical: 'hidden' }, …
eprst
  • 733
  • 6
  • 14
17
votes
3 answers

How to run the Monaco editor from a CDN like cdnjs?

I am struggling a bit to find a minimal runnable example that just runs from the CDN, as opposed to the existing in-tree examples which mostly use local servers.
Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
17
votes
2 answers

How to initialize Microsoft Monaco editor in a browser using simple JavaScript or jQuery

I am trying to initialize a text/code editor using Microsoft Monaco. I would like to use core JavaScript or even jQuery but no NodeJS dependency. Is that possible? Some relevant examples: Get the value of Monaco Editor Example in jsFiddle I have the…
Geocrafter
  • 765
  • 1
  • 6
  • 17
16
votes
3 answers

Monaco Editor intellisense from multiple files

I am using monaco-editor and I would like to include suggestions from multiple files. I am not sure what is the best way to do it but basically, I want that when I am exporting some functions in a file2.js, to be able to access that from another…
Bastien L.
  • 119
  • 1
  • 2
  • 9
15
votes
2 answers

Always show the "Show more" section in monaco-editor

I'm working with the Configure javascript defaults example from the monaco editor playground. https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-configure-javascript-defaults When I start typing the pre-defined…
Thatkookooguy
  • 6,669
  • 1
  • 29
  • 54
1
2 3
65 66