4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "declaration": true,
4 | "lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"],
5 | "module": "amd",
6 | "moduleResolution": "node",
7 | "outDir": "../out/amd",
8 | "strict": true,
9 | "target": "es5"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/website/index/samples/sample.sb.txt:
--------------------------------------------------------------------------------
1 | begin:
2 | TextWindow.Write("Enter a number: ")
3 | num = TextWindow.ReadNumber()
4 | remainder = Math.Remainder(num, 2)
5 | If (remainder = 0) Then
6 | TextWindow.WriteLine("The number is Even")
7 | Else
8 | TextWindow.WriteLine("The number is Odd")
9 | EndIf
10 | Goto begin
--------------------------------------------------------------------------------
/samples/browser-esm-vite-react/src/main.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Editor } from './components/Editor';
4 | import './userWorker';
5 |
6 | ReactDOM.render(
7 |
8 |
9 | ,
10 | document.getElementById('root')
11 | );
12 |
--------------------------------------------------------------------------------
/website/playground/new-samples/creating-the-editor/syntax-highlighting-for-html-elements/sample.js:
--------------------------------------------------------------------------------
1 | // The colorizeElement-function will read the data-lang-attribute
2 | // from the element to select the correct language mode. In this
3 | // sample it is text/css.
4 | monaco.editor.colorizeElement(document.getElementById('code'));
5 |
--------------------------------------------------------------------------------
/website/index/samples/sample.pgsql.txt:
--------------------------------------------------------------------------------
1 | BEGIN
2 | SELECT * INTO STRICT myrec FROM emp WHERE empname = myname;
3 | EXCEPTION
4 | WHEN NO_DATA_FOUND THEN
5 | RAISE EXCEPTION 'employee % not found', myname;
6 | WHEN TOO_MANY_ROWS THEN
7 | RAISE EXCEPTION 'employee % not unique', myname;
8 | END;
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | const gulp = require('gulp');
2 | const es = require('event-stream');
3 | const path = require('path');
4 | const fs = require('fs');
5 | const rimraf = require('rimraf');
6 | const cp = require('child_process');
7 | const CleanCSS = require('clean-css');
8 | const uncss = require('uncss');
9 | const File = require('vinyl');
10 |
--------------------------------------------------------------------------------
/website/index/samples/sample.lua.txt:
--------------------------------------------------------------------------------
1 | -- defines a factorial function
2 | function fact (n)
3 | if n == 0 then
4 | return 1
5 | else
6 | return n * fact(n-1)
7 | end
8 | end
9 |
10 | print("enter a number:")
11 | a = io.read("*number") -- read a number
12 | print(fact(a))
--------------------------------------------------------------------------------
/samples/browser-esm-webpack-typescript-react/src/index.tsx:
--------------------------------------------------------------------------------
1 | import './index.css';
2 |
3 | import React from 'react';
4 | import ReactDOM from 'react-dom';
5 | import { Editor } from './components/Editor';
6 |
7 | ReactDOM.render(
8 |
9 |
10 | ,
11 | document.getElementById('root')
12 | );
13 |
--------------------------------------------------------------------------------
/website/index/samples/sample.flow9.txt:
--------------------------------------------------------------------------------
1 | import material/material;
2 |
3 | export {
4 | demoMakeHelloWorld(onClose : () -> void) -> Material;
5 | }
6 |
7 | demoMakeHelloWorld(onClose : () -> void) -> Material {
8 | MCenter(
9 | MLines2(
10 | MText("Hello, world!", []),
11 | MTextButton("CLOSE", onClose, [], [])
12 | )
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/samples/browser-esm-webpack/dist/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/samples/browser-esm-parcel/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/samples/browser-esm-webpack-small/dist/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/test/smoke/esbuild/esbuild.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/test/smoke/webpack/webpack.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/website/index/samples/sample.python.txt:
--------------------------------------------------------------------------------
1 | import banana
2 |
3 |
4 | class Monkey:
5 | # Bananas the monkey can eat.
6 | capacity = 10
7 | def eat(self, n):
8 | """Make the monkey eat n bananas!"""
9 | self.capacity -= n * banana.size
10 |
11 | def feeding_frenzy(self):
12 | self.eat(9.25)
13 | return "Yum yum"
14 |
--------------------------------------------------------------------------------
/website/index/samples/sample.ini.txt:
--------------------------------------------------------------------------------
1 | # Example of a .gitconfig file
2 |
3 | [core]
4 | repositoryformatversion = 0
5 | filemode = false
6 | bare = false
7 | logallrefupdates = true
8 | symlinks = false
9 | ignorecase = true
10 | hideDotFiles = dotGitOnly
11 |
12 | # Defines the master branch
13 | [branch "master"]
14 | remote = origin
15 | merge = refs/heads/master
16 |
--------------------------------------------------------------------------------
/website/playground/new-samples/interacting-with-the-editor/line-and-inline-decorations/sample.css:
--------------------------------------------------------------------------------
1 | .myInlineDecoration {
2 | color: red !important;
3 | cursor: pointer;
4 | text-decoration: underline;
5 | font-weight: bold;
6 | font-style: oblique;
7 | }
8 |
9 | .myLineDecoration {
10 | background: lightblue;
11 | width: 5px !important;
12 | margin-left: 3px;
13 | }
14 |
--------------------------------------------------------------------------------
/samples/browser-esm-vite-react/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | browser-esm-vite-react
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/website/index/samples/sample.redshift.txt:
--------------------------------------------------------------------------------
1 | create view tables_vw as
2 | select distinct(id) table_id
3 | ,trim(datname) db_name
4 | ,trim(nspname) schema_name
5 | ,trim(relname) table_name
6 | from stv_tbl_perm
7 | join pg_class on pg_class.oid = stv_tbl_perm.id
8 | join pg_namespace on pg_namespace.oid = relnamespace
9 | join pg_database on pg_database.oid = stv_tbl_perm.db_id;
10 |
--------------------------------------------------------------------------------
/website/index/samples/sample.twig.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {% block title %}Welcome!{% endblock %}
6 | {% block stylesheets %}{% endblock %}
7 |
8 |
9 | {% block body %}{% endblock %}
10 | {% block javascripts %}{% endblock %}
11 |
12 |
13 |
--------------------------------------------------------------------------------
/website/index/samples/sample.yaml.txt:
--------------------------------------------------------------------------------
1 | %TAG ! tag:clarkevans.com,2002:
2 | --- !shape
3 | # Use the ! handle for presenting
4 | # tag:clarkevans.com,2002:circle
5 | - !circle
6 | center: &ORIGIN {x: 73, y: 129}
7 | radius: 7
8 | - !line
9 | start: *ORIGIN
10 | finish: { x: 89, y: 102 }
11 | - !label
12 | start: *ORIGIN
13 | color: 0xFFEEBB
14 | text: Pretty vector drawing.
15 |
--------------------------------------------------------------------------------
/test/manual/index.css:
--------------------------------------------------------------------------------
1 | .monaco-editor .token.custom-info {
2 | color: grey !important;
3 | }
4 | .monaco-editor .token.custom-error {
5 | color: red !important;
6 | font-weight: bold !important;
7 | font-size: 1.2em !important;
8 | }
9 | .monaco-editor .token.custom-notice {
10 | color: orange !important;
11 | }
12 | .monaco-editor .token.custom-date {
13 | color: green !important;
14 | }
15 |
--------------------------------------------------------------------------------
/test/smoke/common.js:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | exports.PORT = 8563;
7 |
--------------------------------------------------------------------------------
/samples/browser-esm-esbuild/dist/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/website/index/samples/sample.apex.txt:
--------------------------------------------------------------------------------
1 | /* Using a single database query, find all the leads in
2 | the database that have the same email address as any
3 | of the leads being inserted or updated. */
4 | for (Lead lead : [SELECT Email FROM Lead WHERE Email IN :leadMap.KeySet()]) {
5 | Lead newLead = leadMap.get(lead.Email);
6 | newLead.Email.addError('A lead with this email address already exists.');
7 | }
8 |
--------------------------------------------------------------------------------
/website/index/samples/sample.mysql.txt:
--------------------------------------------------------------------------------
1 | CREATE TABLE shop (
2 | article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,
3 | dealer CHAR(20) DEFAULT '' NOT NULL,
4 | price DOUBLE(16,2) DEFAULT '0.00' NOT NULL,
5 | PRIMARY KEY(article, dealer));
6 | INSERT INTO shop VALUES
7 | (1,'A',3.45),(1,'B',3.99),(2,'A',10.99),(3,'B',1.45),
8 | (3,'C',1.69),(3,'D',1.25),(4,'D',19.95);
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 | "editor.tabSize": 4,
4 | "editor.insertSpaces": false,
5 | "files.insertFinalNewline": true,
6 | "files.trimTrailingWhitespace": true,
7 | "search.exclude": {
8 | "**/node_modules": true,
9 | "**/release": true,
10 | "**/out": true
11 | },
12 | "typescript.tsdk": "./node_modules/typescript/lib"
13 | }
14 |
--------------------------------------------------------------------------------
/test/manual/samples/run-editor-sample-cr-ps1.txt:
--------------------------------------------------------------------------------
1 |
2 | # A line that ends only in CR(0x0D) and not LF (0x0A).
foreach($parameterSet in $ObjInfoArray)
3 | {
4 | # This line also ends only in CR(0x0D) and not LF (0x0A).
if ($parameterSet["class"] -eq "blank")
5 | {
6 | if ($XenCenterNodeSelected)
7 | {
8 | continue
9 | }
10 | $XenCenterNodeSelected = 1;
$SelectedObjectNames += "XenCenter"
11 | }
12 | }
--------------------------------------------------------------------------------
/website/playground/new-samples/creating-the-diffeditor/hello-diff-world/sample.js:
--------------------------------------------------------------------------------
1 | var originalModel = monaco.editor.createModel('heLLo world!', 'text/plain');
2 | var modifiedModel = monaco.editor.createModel('hello orlando!', 'text/plain');
3 |
4 | var diffEditor = monaco.editor.createDiffEditor(document.getElementById('container'));
5 | diffEditor.setModel({
6 | original: originalModel,
7 | modified: modifiedModel
8 | });
9 |
--------------------------------------------------------------------------------
/src/fillers/monaco-editor-core.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | export * from 'monaco-editor-core';
7 |
--------------------------------------------------------------------------------
/website/index/samples/sample.perl.txt:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | use strict;
3 | use warnings;
4 |
5 | use Path::Tiny;
6 |
7 | my $dir = path('foo','bar'); # foo/bar
8 |
9 | # Iterate over the content of foo/bar
10 | my $iter = $dir->iterator;
11 | while (my $file = $iter->()) {
12 |
13 | # See if it is a directory and skip
14 | next if $file->is_dir();
15 |
16 | # Print out the file name and path
17 | print "$file\n";
18 | }
--------------------------------------------------------------------------------
/samples/browser-esm-esbuild/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Monaco Editor esbuild Bundler Sample
8 |
9 | To run this sample, you need to:
10 |
11 |
12 | $/browser-esm-esbuild> npm run build
13 |
15 |
16 | Then, open the ./dist folder.
17 |
18 |
19 |
--------------------------------------------------------------------------------
/website/playground/new-samples/creating-the-editor/hello-world/sample.js:
--------------------------------------------------------------------------------
1 | // The Monaco Editor can be easily created, given an
2 | // empty container and an options literal.
3 | // Two members of the literal are "value" and "language".
4 | // The editor takes the full size of its container.
5 |
6 | monaco.editor.create(document.getElementById('container'), {
7 | value: "function hello() {\n\talert('Hello world!');\n}",
8 | language: 'javascript'
9 | });
10 |
--------------------------------------------------------------------------------
/website/index/samples/sample.proto.txt:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | import public "other.proto";
3 |
4 | /* SearchRequest represents a search query, with pagination options to
5 | * indicate which results to include in the response. */
6 |
7 | message SearchRequest {
8 | required string query = 1;
9 | optional int32 page_number = 2; // Which page number do we want?
10 | optional int32 result_per_page = 3; // Number of results to return per page.
11 | }
12 |
--------------------------------------------------------------------------------
/website/index/samples/sample.bat.txt:
--------------------------------------------------------------------------------
1 | rem *******Begin Comment**************
2 | rem This program starts the superapp batch program on the network,
3 | rem directs the output to a file, and displays the file
4 | rem in Notepad.
5 | rem *******End Comment**************
6 | @echo off
7 | if exist C:\output.txt goto EMPTYEXISTS
8 | setlocal
9 | path=g:\programs\superapp;%path%
10 | call superapp>C:\output.txt
11 | endlocal
12 | :EMPTYEXISTS
13 | start notepad c:\output.txt
--------------------------------------------------------------------------------
/samples/electron-amd/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Monaco Editor Electron Sample
8 |
9 | To run this sample, you need to
10 | download Electron
11 | and then execute:
12 |
13 |
Monaco Editor in Electron (without nodeIntegration)!
21 | Note: Since Electron without nodeIntegration is very similar to a browser, you can have a look
22 | at all the other `browser-` samples, as they should work just fine.
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/basic-languages/objective-c/objective-c.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'objective-c',
13 | extensions: ['.m'],
14 | aliases: ['Objective-C'],
15 | loader: () => {
16 | if (AMD) {
17 | return new Promise((resolve, reject) => {
18 | require(['vs/basic-languages/objective-c/objective-c'], resolve, reject);
19 | });
20 | } else {
21 | return import('./objective-c');
22 | }
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/src/basic-languages/protobuf/protobuf.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'proto',
13 | extensions: ['.proto'],
14 | aliases: ['protobuf', 'Protocol Buffers'],
15 | loader: () => {
16 | if (AMD) {
17 | return new Promise((resolve, reject) => {
18 | require(['vs/basic-languages/protobuf/protobuf'], resolve, reject);
19 | });
20 | } else {
21 | return import('./protobuf');
22 | }
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/src/basic-languages/scheme/scheme.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'scheme',
13 | extensions: ['.scm', '.ss', '.sch', '.rkt'],
14 | aliases: ['scheme', 'Scheme'],
15 | loader: () => {
16 | if (AMD) {
17 | return new Promise((resolve, reject) => {
18 | require(['vs/basic-languages/scheme/scheme'], resolve, reject);
19 | });
20 | } else {
21 | return import('./scheme');
22 | }
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/src/basic-languages/swift/swift.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'swift',
13 | aliases: ['Swift', 'swift'],
14 | extensions: ['.swift'],
15 | mimetypes: ['text/swift'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/swift/swift'], resolve, reject);
20 | });
21 | } else {
22 | return import('./swift');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/website/index/samples/sample.st.txt:
--------------------------------------------------------------------------------
1 | CONFIGURATION DefaultCfg
2 | VAR_GLOBAL
3 | Start_Stop AT %IX0.0: BOOL; (* This is a comment *)
4 | END_VAR
5 | TASK NewTask (INTERVAL := T#20ms);
6 | PROGRAM Main WITH NewTask : PLC_PRG;
7 | END_CONFIGURATION
8 |
9 | PROGRAM demo
10 | VAR_EXTERNAL
11 | Start_Stop: BOOL;
12 | END_VAR
13 | VAR
14 | a : REAL; // Another comment
15 | todTest: TIME_OF_DAY := TOD#12:55;
16 | END_VAR
17 | a := csq(12.5);
18 | TON1(IN := TRUE, PT := T#2s);
19 | 16#FAC0 2#1001_0110
20 | IF TON1.Q AND a > REAL#100 THEN
21 | Start_Stop := TRUE;
22 | END_IF
23 | END_PROGRAM;
24 |
25 | /* Get a square of the circle */
26 | FUNCTION csq : REAL
27 | VAR_INPUT
28 | r: REAL;
29 | END_VAR
30 | VAR CONSTANT
31 | c_pi: REAL := 3.14;
32 | END_VAR
33 | csq := ABS(c_pi * (r * 2));
34 | END_FUNCTION
--------------------------------------------------------------------------------
/src/basic-languages/clojure/clojure.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'clojure',
13 | extensions: ['.clj', '.cljs', '.cljc', '.edn'],
14 | aliases: ['clojure', 'Clojure'],
15 | loader: () => {
16 | if (AMD) {
17 | return new Promise((resolve, reject) => {
18 | require(['vs/basic-languages/clojure/clojure'], resolve, reject);
19 | });
20 | } else {
21 | return import('./clojure');
22 | }
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/src/basic-languages/less/less.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'less',
13 | extensions: ['.less'],
14 | aliases: ['Less', 'less'],
15 | mimetypes: ['text/x-less', 'text/less'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/less/less'], resolve, reject);
20 | });
21 | } else {
22 | return import('./less');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/postiats/postiats.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'postiats',
13 | extensions: ['.dats', '.sats', '.hats'],
14 | aliases: ['ATS', 'ATS/Postiats'],
15 | loader: () => {
16 | if (AMD) {
17 | return new Promise((resolve, reject) => {
18 | require(['vs/basic-languages/postiats/postiats'], resolve, reject);
19 | });
20 | } else {
21 | return import('./postiats');
22 | }
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/src/basic-languages/razor/razor.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'razor',
13 | extensions: ['.cshtml'],
14 | aliases: ['Razor', 'razor'],
15 | mimetypes: ['text/x-cshtml'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/razor/razor'], resolve, reject);
20 | });
21 | } else {
22 | return import('./razor');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/apex/apex.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'apex',
13 | extensions: ['.cls'],
14 | aliases: ['Apex', 'apex'],
15 | mimetypes: ['text/x-apex-source', 'text/x-apex'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/apex/apex'], resolve, reject);
20 | });
21 | } else {
22 | return import('./apex');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/scss/scss.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'scss',
13 | extensions: ['.scss'],
14 | aliases: ['Sass', 'sass', 'scss'],
15 | mimetypes: ['text/x-scss', 'text/scss'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/scss/scss'], resolve, reject);
20 | });
21 | } else {
22 | return import('./scss');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/dart/dart.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'dart',
13 | extensions: ['.dart'],
14 | aliases: ['Dart', 'dart'],
15 | mimetypes: ['text/x-dart-source', 'text/x-dart'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/dart/dart'], resolve, reject);
20 | });
21 | } else {
22 | return import('./dart');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/website/index/samples/sample.kotlin.txt:
--------------------------------------------------------------------------------
1 | const val POINTS_X_PASS: Int = 15
2 | val EZPassAccounts: MutableMap = mutableMapOf(1 to 100, 2 to 100, 3 to 100)
3 | val EZPassReport: Map = EZPassAccounts
4 |
5 | // update points credit
6 | fun updatePointsCredit(accountId: Int) {
7 | if (EZPassAccounts.containsKey(accountId)) {
8 | println("Updating $accountId...")
9 | EZPassAccounts[accountId] = EZPassAccounts.getValue(accountId) + POINTS_X_PASS
10 | } else {
11 | println("Error: Trying to update a non-existing account (id: $accountId)")
12 | }
13 | }
14 |
15 | fun accountsReport() {
16 | println("EZ-Pass report:")
17 | EZPassReport.forEach{
18 | k, v -> println("ID $k: credit $v")
19 | }
20 | }
21 |
22 | fun main() {
23 | accountsReport()
24 | updatePointsCredit(1)
25 | updatePointsCredit(1)
26 | updatePointsCredit(5)
27 | accountsReport()
28 | }
--------------------------------------------------------------------------------
/src/basic-languages/fsharp/fsharp.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'fsharp',
13 | extensions: ['.fs', '.fsi', '.ml', '.mli', '.fsx', '.fsscript'],
14 | aliases: ['F#', 'FSharp', 'fsharp'],
15 | loader: () => {
16 | if (AMD) {
17 | return new Promise((resolve, reject) => {
18 | require(['vs/basic-languages/fsharp/fsharp'], resolve, reject);
19 | });
20 | } else {
21 | return import('./fsharp');
22 | }
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/src/basic-languages/java/java.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'java',
13 | extensions: ['.java', '.jav'],
14 | aliases: ['Java', 'java'],
15 | mimetypes: ['text/x-java-source', 'text/x-java'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/java/java'], resolve, reject);
20 | });
21 | } else {
22 | return import('./java');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/mips/mips.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'mips',
13 | extensions: ['.s'],
14 | aliases: ['MIPS', 'MIPS-V'],
15 | mimetypes: ['text/x-mips', 'text/mips', 'text/plaintext'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/mips/mips'], resolve, reject);
20 | });
21 | } else {
22 | return import('./mips');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/php/php.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'php',
13 | extensions: ['.php', '.php4', '.php5', '.phtml', '.ctp'],
14 | aliases: ['PHP', 'php'],
15 | mimetypes: ['application/x-php'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/php/php'], resolve, reject);
20 | });
21 | } else {
22 | return import('./php');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/powerquery/powerquery.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'powerquery',
13 | extensions: ['.pq', '.pqm'],
14 | aliases: ['PQ', 'M', 'Power Query', 'Power Query M'],
15 | loader: () => {
16 | if (AMD) {
17 | return new Promise((resolve, reject) => {
18 | require(['vs/basic-languages/powerquery/powerquery'], resolve, reject);
19 | });
20 | } else {
21 | return import('./powerquery');
22 | }
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/src/basic-languages/dockerfile/dockerfile.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'dockerfile',
13 | extensions: ['.dockerfile'],
14 | filenames: ['Dockerfile'],
15 | aliases: ['Dockerfile'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/dockerfile/dockerfile'], resolve, reject);
20 | });
21 | } else {
22 | return import('./dockerfile');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/kotlin/kotlin.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'kotlin',
13 | extensions: ['.kt'],
14 | aliases: ['Kotlin', 'kotlin'],
15 | mimetypes: ['text/x-kotlin-source', 'text/x-kotlin'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/kotlin/kotlin'], resolve, reject);
20 | });
21 | } else {
22 | return import('./kotlin');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/liquid/liquid.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'liquid',
13 | extensions: ['.liquid', '.html.liquid'],
14 | aliases: ['Liquid', 'liquid'],
15 | mimetypes: ['application/liquid'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/liquid/liquid'], resolve, reject);
20 | });
21 | } else {
22 | return import('./liquid');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/ruby/ruby.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'ruby',
13 | extensions: ['.rb', '.rbx', '.rjs', '.gemspec', '.pp'],
14 | filenames: ['rakefile', 'Gemfile'],
15 | aliases: ['Ruby', 'rb'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/ruby/ruby'], resolve, reject);
20 | });
21 | } else {
22 | return import('./ruby');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/powershell/powershell.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'powershell',
13 | extensions: ['.ps1', '.psm1', '.psd1'],
14 | aliases: ['PowerShell', 'powershell', 'ps', 'ps1'],
15 | loader: () => {
16 | if (AMD) {
17 | return new Promise((resolve, reject) => {
18 | require(['vs/basic-languages/powershell/powershell'], resolve, reject);
19 | });
20 | } else {
21 | return import('./powershell');
22 | }
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/src/basic-languages/yaml/yaml.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'yaml',
13 | extensions: ['.yaml', '.yml'],
14 | aliases: ['YAML', 'yaml', 'YML', 'yml'],
15 | mimetypes: ['application/x-yaml', 'text/x-yaml'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/yaml/yaml'], resolve, reject);
20 | });
21 | } else {
22 | return import('./yaml');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/graphql/graphql.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'graphql',
13 | extensions: ['.graphql', '.gql'],
14 | aliases: ['GraphQL', 'graphql', 'gql'],
15 | mimetypes: ['application/graphql'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/graphql/graphql'], resolve, reject);
20 | });
21 | } else {
22 | return import('./graphql');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/pascal/pascal.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'pascal',
13 | extensions: ['.pas', '.p', '.pp'],
14 | aliases: ['Pascal', 'pas'],
15 | mimetypes: ['text/x-pascal-source', 'text/x-pascal'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/pascal/pascal'], resolve, reject);
20 | });
21 | } else {
22 | return import('./pascal');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/website/index/samples/sample.less.txt:
--------------------------------------------------------------------------------
1 | @base: #f938ab;
2 |
3 | .box-shadow(@style, @c) when (iscolor(@c)) {
4 | border-radius: @style @c;
5 | }
6 |
7 | .box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) {
8 | .box-shadow(@style, rgba(0, 0, 0, @alpha));
9 | }
10 |
11 | .box {
12 | color: saturate(@base, 5%);
13 | border-color: lighten(@base, 30%);
14 |
15 | div {
16 | .box-shadow((0 0 5px), 30%);
17 | }
18 | }
19 |
20 | #header {
21 | h1 {
22 | font-size: 26px;
23 | font-weight: bold;
24 | }
25 |
26 | p { font-size: 12px;
27 | a { text-decoration: none;
28 | &:hover { border-width: 1px }
29 | }
30 | }
31 | }
32 |
33 | @the-border: 1px;
34 | @base-color: #111;
35 | @red: #842210;
36 |
37 | #header {
38 | color: (@base-color * 3);
39 | border-left: @the-border;
40 | border-right: (@the-border * 2);
41 | }
42 |
43 | #footer {
44 | color: (@base-color + #003300);
45 | border-color: desaturate(@red, 10%);
46 | }
47 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/2_feature_request.yaml:
--------------------------------------------------------------------------------
1 | name: Feature Request
2 | description: Suggest an idea for this project
3 | title: '[Feature Request] '
4 | labels:
5 | - 'feature-request'
6 | body:
7 | - type: markdown
8 | attributes:
9 | value: |
10 | To help us efficiently reviewing your feature request, please fill out this form.
11 | - type: checkboxes
12 | id: not
13 | attributes:
14 | label: Context
15 | options:
16 | - label: This issue is not a bug report. *(please use a different template for reporting a bug)*
17 | required: true
18 | - label: This issue is not a duplicate of an existing issue. *(please use the [search](https://github.com/microsoft/monaco-editor/issues) to find existing issues)*
19 | required: true
20 |
21 | - type: textarea
22 | id: description
23 | attributes:
24 | label: Description
25 | description: Please describe your feature request.
26 |
--------------------------------------------------------------------------------
/samples/browser-amd-localized/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Monaco Editor Localization Sample
8 |
9 |
10 |
11 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/docs/integrate-amd.md:
--------------------------------------------------------------------------------
1 | ## Integrating the AMD version of the Monaco Editor
2 |
3 | Here is the most basic HTML page that embeds the editor using AMD.
4 |
5 | More self-contained samples are available in the [samples folder](../samples/).
6 |
7 | ```html
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
26 |
27 |
28 | ```
29 |
--------------------------------------------------------------------------------
/src/basic-languages/restructuredtext/restructuredtext.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'restructuredtext',
13 | extensions: ['.rst'],
14 | aliases: ['reStructuredText', 'restructuredtext'],
15 | loader: () => {
16 | if (AMD) {
17 | return new Promise((resolve, reject) => {
18 | require(['vs/basic-languages/restructuredtext/restructuredtext'], resolve, reject);
19 | });
20 | } else {
21 | return import('./restructuredtext');
22 | }
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/src/basic-languages/ini/ini.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'ini',
13 | extensions: ['.ini', '.properties', '.gitconfig'],
14 | filenames: ['config', '.gitattributes', '.gitconfig', '.editorconfig'],
15 | aliases: ['Ini', 'ini'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/ini/ini'], resolve, reject);
20 | });
21 | } else {
22 | return import('./ini');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/markdown/markdown.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'markdown',
13 | extensions: ['.md', '.markdown', '.mdown', '.mkdn', '.mkd', '.mdwn', '.mdtxt', '.mdtext'],
14 | aliases: ['Markdown', 'markdown'],
15 | loader: () => {
16 | if (AMD) {
17 | return new Promise((resolve, reject) => {
18 | require(['vs/basic-languages/markdown/markdown'], resolve, reject);
19 | });
20 | } else {
21 | return import('./markdown');
22 | }
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/src/basic-languages/python/python.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'python',
13 | extensions: ['.py', '.rpy', '.pyw', '.cpy', '.gyp', '.gypi'],
14 | aliases: ['Python', 'py'],
15 | firstLine: '^#!/.*\\bpython[0-9.-]*\\b',
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/python/python'], resolve, reject);
20 | });
21 | } else {
22 | return import('./python');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/samples/browser-amd-requirejs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Monaco Editor Sample - Loading with requirejs
8 |
9 |
10 |
15 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/test/manual/samples/run-editor-korean.txt:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | 전문
4 | 유구한 역사와 전통에 빛나는 우리 대한 국민은 3·1 운동으로 건립된 대한민국 임시 정부의 법통과 불의에 항거한 4·19 민주 이념을 계승하고, 조국의 민주 개혁과 평화적 통일의 사명에 입각하여 정의·인도와 동포애로써 민족의 단결을 공고히 하고, 모든 사회적 폐습과 불의를 타파하며, 자율과 조화를 바탕으로 자유 민주적 기본 질서를 더욱 확고히 하여 정치·경제·사회·문화의 모든 영역에 있어서 각인의 기회를 균등히 하고, 능력을 최고도로 발휘하게 하며, 자유와 권리에 따르는 책임과 의무를 완수하게 하여, 안으로는 국민 생활의 균등한 향상을 기하고 밖으로는 항구적인 세계 평화와 인류 공영에 이바지함으로써 우리들과 우리들의 자손의 안전과 자유와 행복을 영원히 확보할 것을 다짐하면서 1948년 7월 12일에 제정되고 8차에 걸쳐 개정된 헌법을 이제 국회의 의결을 거쳐 국민 투표에 의하여 개정한다.
5 | 1987년 10월 29일
6 | 前文
7 | 悠久한 歷史와 傳統에 빛나는 우리 大韓國民은 3·1 運動으로 建立된 大韓民國臨時政府의 法統과 不義에 抗拒한 4·19 民主理念을 繼承하고, 祖國의 民主改革과 平和的統一의 使命에 立脚하여 正義·人道와 同胞愛로써 民族의 團結을 鞏固히 하고, 모든 社會的弊習과 不義를 打破하며, 自律과 調和를 바탕으로 自由民主的基本秩序를 더욱 確固히 하여 政治·經濟·社會·文化의 모든 領域에 있어서 各人의 機會를 均等히 하고, 能力을 最高度로 發揮하게 하며, 自由와 權利에 따르는 責任과 義務를 完遂하게 하여, 안으로는 國民生活의 均等한 向上을 基하고 밖으로는 恒久的인 世界平和와 人類共榮에 이바지함으로써 우리들과 우리들의 子孫의 安全과 自由와 幸福을 永遠히 確保할 것을 다짐하면서 1948年 7月 12日에 制定되고 8次에 걸쳐 改正된 憲法을 이제 國會의 議決을 거쳐 國民投票에 依하여 改正한다.
8 | 1987年 10月 29日
9 |
10 | */
--------------------------------------------------------------------------------
/src/basic-languages/coffee/coffee.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'coffeescript',
13 | extensions: ['.coffee'],
14 | aliases: ['CoffeeScript', 'coffeescript', 'coffee'],
15 | mimetypes: ['text/x-coffeescript', 'text/coffeescript'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/coffee/coffee'], resolve, reject);
20 | });
21 | } else {
22 | return import('./coffee');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/typescript/typescript.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'typescript',
13 | extensions: ['.ts', '.tsx'],
14 | aliases: ['TypeScript', 'ts', 'typescript'],
15 | mimetypes: ['text/typescript'],
16 | loader: (): Promise => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/typescript/typescript'], resolve, reject);
20 | });
21 | } else {
22 | return import('./typescript');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/handlebars/handlebars.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'handlebars',
13 | extensions: ['.handlebars', '.hbs'],
14 | aliases: ['Handlebars', 'handlebars', 'hbs'],
15 | mimetypes: ['text/x-handlebars-template'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/handlebars/handlebars'], resolve, reject);
20 | });
21 | } else {
22 | return import('./handlebars');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/webpack-plugin/smoketest/webpack-cross-origin.config.js:
--------------------------------------------------------------------------------
1 | const MonacoWebpackPlugin = require('../out/index.js');
2 | const path = require('path');
3 |
4 | const ASSET_PATH = 'http://localhost:8088/monaco-editor/test/smoke/webpack/out/';
5 |
6 | const REPO_ROOT = path.join(__dirname, '../../');
7 |
8 | module.exports = {
9 | mode: 'development',
10 | entry: './index.js',
11 | context: __dirname,
12 | output: {
13 | path: path.resolve(REPO_ROOT, 'test/smoke/webpack/out'),
14 | filename: 'app.js',
15 | publicPath: ASSET_PATH
16 | },
17 | resolve: {
18 | alias: {
19 | 'monaco-editor': path.resolve(REPO_ROOT, 'release')
20 | }
21 | },
22 | module: {
23 | rules: [
24 | {
25 | test: /\.css$/,
26 | use: ['style-loader', 'css-loader']
27 | },
28 | {
29 | test: /\.ttf$/,
30 | use: ['file-loader']
31 | }
32 | ]
33 | },
34 | plugins: [
35 | new MonacoWebpackPlugin({
36 | monacoEditorPath: path.resolve(REPO_ROOT, 'release')
37 | })
38 | ]
39 | };
40 |
--------------------------------------------------------------------------------
/website/playground/new-samples/extending-language-services/codelens-provider-example/sample.js:
--------------------------------------------------------------------------------
1 | var editor = monaco.editor.create(document.getElementById('container'), {
2 | value: '{\n\t"dependencies": {\n\t\t\n\t}\n}\n',
3 | language: 'json'
4 | });
5 |
6 | var commandId = editor.addCommand(
7 | 0,
8 | function () {
9 | // services available in `ctx`
10 | alert('my command is executing!');
11 | },
12 | ''
13 | );
14 |
15 | monaco.languages.registerCodeLensProvider('json', {
16 | provideCodeLenses: function (model, token) {
17 | return {
18 | lenses: [
19 | {
20 | range: {
21 | startLineNumber: 1,
22 | startColumn: 1,
23 | endLineNumber: 2,
24 | endColumn: 1
25 | },
26 | id: 'First Line',
27 | command: {
28 | id: commandId,
29 | title: 'First Line'
30 | }
31 | }
32 | ],
33 | dispose: () => {}
34 | };
35 | },
36 | resolveCodeLens: function (model, codeLens, token) {
37 | return codeLens;
38 | }
39 | });
40 |
--------------------------------------------------------------------------------
/samples/browser-amd-iframe/inner.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
15 |
16 |
17 |
18 |
19 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/basic-languages/scala/scala.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'scala',
13 | extensions: ['.scala', '.sc', '.sbt'],
14 | aliases: ['Scala', 'scala', 'SBT', 'Sbt', 'sbt', 'Dotty', 'dotty'],
15 | mimetypes: ['text/x-scala-source', 'text/x-scala', 'text/x-sbt', 'text/x-dotty'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/scala/scala'], resolve, reject);
20 | });
21 | } else {
22 | return import('./scala');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/website/index/samples/sample.bicep.txt:
--------------------------------------------------------------------------------
1 | targetScope = 'subscription'
2 |
3 | param deployStorage bool = true
4 |
5 | @description('The object ID of the principal that will get the role assignment')
6 | param aadPrincipalId string
7 |
8 | module stg './storage.bicep' = if(deployStorage) {
9 | name: 'storageDeploy'
10 | scope: resourceGroup('another-rg') // this will target another resource group in the same subscription
11 | params: {
12 | storageAccountName: ''
13 | }
14 | }
15 |
16 | var contributor = 'b24988ac-6180-42a0-ab88-20f7382dd24c'
17 | resource roleDef 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = {
18 | name: contributor
19 | }
20 |
21 | resource rbac 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
22 | name: guid(subscription().id, aadPrincipalId, contributor)
23 | properties: {
24 | roleDefinitionId: roleDef.id
25 | principalId: aadPrincipalId
26 | }
27 | }
28 |
29 | output storageName array = stg.outputs.containerProps
30 |
--------------------------------------------------------------------------------
/samples/browser-esm-webpack-small/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const TerserPlugin = require('terser-webpack-plugin');
3 |
4 | module.exports = {
5 | mode: 'production',
6 | entry: {
7 | app: './index.js',
8 | 'editor.worker': 'monaco-editor/esm/vs/editor/editor.worker.js'
9 | // "json.worker": 'monaco-editor/esm/vs/language/json/json.worker',
10 | // "css.worker": 'monaco-editor/esm/vs/language/css/css.worker',
11 | // "html.worker": 'monaco-editor/esm/vs/language/html/html.worker',
12 | // "ts.worker": 'monaco-editor/esm/vs/language/typescript/ts.worker',
13 | },
14 | output: {
15 | globalObject: 'self',
16 | filename: '[name].bundle.js',
17 | path: path.resolve(__dirname, 'dist')
18 | },
19 | module: {
20 | rules: [
21 | {
22 | test: /\.css$/,
23 | use: ['style-loader', 'css-loader']
24 | },
25 | {
26 | test: /\.ttf$/,
27 | use: ['file-loader']
28 | }
29 | ]
30 | },
31 | optimization: {
32 | minimize: true,
33 | minimizer: [new TerserPlugin()]
34 | }
35 | };
36 |
--------------------------------------------------------------------------------
/src/basic-languages/html/html.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'html',
13 | extensions: ['.html', '.htm', '.shtml', '.xhtml', '.mdoc', '.jsp', '.asp', '.aspx', '.jshtm'],
14 | aliases: ['HTML', 'htm', 'html', 'xhtml'],
15 | mimetypes: ['text/html', 'text/x-jshtm', 'text/template', 'text/ng-template'],
16 | loader: () => {
17 | if (AMD) {
18 | return new Promise((resolve, reject) => {
19 | require(['vs/basic-languages/html/html'], resolve, reject);
20 | });
21 | } else {
22 | return import('./html');
23 | }
24 | }
25 | });
26 |
--------------------------------------------------------------------------------
/src/basic-languages/javascript/javascript.contribution.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { registerLanguage } from '../_.contribution';
7 |
8 | declare var AMD: any;
9 | declare var require: any;
10 |
11 | registerLanguage({
12 | id: 'javascript',
13 | extensions: ['.js', '.es6', '.jsx', '.mjs', '.cjs'],
14 | firstLine: '^#!.*\\bnode',
15 | filenames: ['jakefile'],
16 | aliases: ['JavaScript', 'javascript', 'js'],
17 | mimetypes: ['text/javascript'],
18 | loader: () => {
19 | if (AMD) {
20 | return new Promise((resolve, reject) => {
21 | require(['vs/basic-languages/javascript/javascript'], resolve, reject);
22 | });
23 | } else {
24 | return import('./javascript');
25 | }
26 | }
27 | });
28 |
--------------------------------------------------------------------------------
/website/index/samples/sample.verilog.txt:
--------------------------------------------------------------------------------
1 | `include "first_counter.v"
2 | module first_counter_tb();
3 | // Declare inputs as regs and outputs as wires
4 | reg clock, reset, enable;
5 | wire [3:0] counter_out;
6 |
7 | // Initialize all variables
8 | initial begin
9 | $display ("time\t clk reset enable counter");
10 | $monitor ("%g\t %b %b %b %b",
11 | $time, clock, reset, enable, counter_out);
12 | clock = 1; // initial value of clock
13 | reset = 0; // initial value of reset
14 | enable = 0; // initial value of enable
15 | #5 reset = 1; // Assert the reset
16 | #10 reset = 0; // De-assert the reset
17 | #10 enable = 1; // Assert enable
18 | #100 enable = 0; // De-assert enable
19 | #5 $finish; // Terminate simulation
20 | end
21 |
22 | // Clock generator
23 | always begin
24 | #5 clock = ~clock; // Toggle clock every 5 ticks
25 | end
26 |
27 | // Connect DUT to test bench
28 | first_counter U_counter (
29 | clock,
30 | reset,
31 | enable,
32 | counter_out
33 | );
34 |
35 | endmodule
36 |
--------------------------------------------------------------------------------
/website/playground/new-samples/creating-the-diffeditor/navigating-a-diff/sample.js:
--------------------------------------------------------------------------------
1 | // The diff editor offers a navigator to jump between changes. Once the diff is computed the next() and previous() method allow navigation. By default setting the selection in the editor manually resets the navigation state.
2 | var originalModel = monaco.editor.createModel(
3 | 'just some text\n\nHello World\n\nSome more text',
4 | 'text/plain'
5 | );
6 | var modifiedModel = monaco.editor.createModel(
7 | 'just some Text\n\nHello World\n\nSome more changes',
8 | 'text/plain'
9 | );
10 |
11 | var diffEditor = monaco.editor.createDiffEditor(document.getElementById('container'));
12 | diffEditor.setModel({
13 | original: originalModel,
14 | modified: modifiedModel
15 | });
16 |
17 | var navi = monaco.editor.createDiffNavigator(diffEditor, {
18 | followsCaret: true, // resets the navigator state when the user selects something in the editor
19 | ignoreCharChanges: true // jump from line to line
20 | });
21 |
22 | window.setInterval(function () {
23 | navi.next();
24 | }, 2000);
25 |
--------------------------------------------------------------------------------
/samples/browser-amd-shared-model/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
{{title}}
29 |