diff --git a/.gitignore b/.gitignore index d9ef910d..79b9535b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ /node_modules/ -/out/ /release/ diff --git a/.npmignore b/.npmignore index c315bcb6..fa3b24da 100644 --- a/.npmignore +++ b/.npmignore @@ -1,6 +1,10 @@ /.vscode/ -/out/ +/release/**/*.test.js +/release/**/test/ +/scripts/ +/src/ /test/ /gulpfile.js /tsconfig.json /.npmignore +/.travis.yml diff --git a/.travis.yml b/.travis.yml index 22bdf91f..1568bc80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - "5.10" + - "8.9.3" script: - npm run compile - npm run test diff --git a/README.md b/README.md index 0cfdc1f8..059e3add 100644 --- a/README.md +++ b/README.md @@ -52,25 +52,18 @@ This npm module is bundled and distributed in the [monaco-editor](https://www.np ## Dev: Adding a new language -* create `$/src/myLang.ts` -* create `$/test/myLang.test.ts` +* create `$/src/myLang/myLang.contribution.ts` +* create `$/src/myLang/myLang.ts` +* create `$/src/myLang/myLang.test.ts` * restart compilation with `$> npm run watch` * edit `$/src/monaco.contribution.ts` and register your new language: +* edit `$/test/setup.js` and load your new language while testing ```js - registerLanguage({ - id: 'sql', - extensions: [ '.sql' ], - aliases: [ 'SQL' ], - module: './sql' - }); + 'release/dev/sql/sql.test', ``` -* edit `$/test/all.js` and load your new language while testing +* edit `$/scripts/bundle.js` and ship your new language ```js - 'out/test/sql.test', -``` -* edit `$/gulpfile.js` and ship your new language -```js - bundleOne('src/sql'), + bundleOne('sql/sql'), ``` ## Code of Conduct diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index 12d7511e..00000000 --- a/gulpfile.js +++ /dev/null @@ -1,168 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -var gulp = require('gulp'); -var tsb = require('gulp-tsb'); -var assign = require('object-assign'); -var fs = require('fs'); -var path = require('path'); -var merge = require('merge-stream'); -var rjs = require('gulp-requirejs'); -var uglify = require('gulp-uglify'); -var rimraf = require('rimraf'); -var es = require('event-stream'); - -gulp.task('clean-release', function(cb) { rimraf('release', { maxBusyTries: 1 }, cb); }); -gulp.task('release', ['clean-release','compile'], function() { - - var sha1 = getGitVersion(__dirname); - var semver = require('./package.json').version; - var headerVersion = semver + '(' + sha1 + ')'; - - var BUNDLED_FILE_HEADER = [ - '/*!-----------------------------------------------------------------------------', - ' * Copyright (c) Microsoft Corporation. All rights reserved.', - ' * monaco-languages version: ' + headerVersion, - ' * Released under the MIT license', - ' * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md', - ' *-----------------------------------------------------------------------------*/', - '' - ].join('\n'); - - function bundleOne(moduleId, exclude) { - return rjs({ - baseUrl: '/out/', - name: 'vs/basic-languages/' + moduleId, - out: moduleId + '.js', - exclude: exclude, - paths: { - 'vs/basic-languages': __dirname + '/out' - } - }) - } - - return merge( - bundleOne('src/monaco.contribution'), - bundleOne('src/bat'), - bundleOne('src/css'), - bundleOne('src/coffee'), - bundleOne('src/cpp'), - bundleOne('src/csharp'), - bundleOne('src/dockerfile'), - bundleOne('src/fsharp'), - bundleOne('src/go'), - bundleOne('src/handlebars'), - bundleOne('src/html'), - bundleOne('src/ini'), - bundleOne('src/pug'), - bundleOne('src/java'), - bundleOne('src/less'), - bundleOne('src/lua'), - bundleOne('src/markdown'), - bundleOne('src/msdax'), - bundleOne('src/objective-c'), - bundleOne('src/php'), - bundleOne('src/powershell'), - bundleOne('src/postiats'), - bundleOne('src/python'), - bundleOne('src/r'), - bundleOne('src/razor'), - bundleOne('src/ruby'), - bundleOne('src/scss'), - bundleOne('src/sql'), - bundleOne('src/swift'), - bundleOne('src/vb'), - bundleOne('src/xml'), - bundleOne('src/yaml'), - bundleOne('src/solidity'), - bundleOne('src/sb'), - bundleOne('src/mysql'), - bundleOne('src/redshift'), - bundleOne('src/pgsql'), - bundleOne('src/redis'), - bundleOne('src/csp') - ) - .pipe(uglify({ - output: { - comments: /^!/ - } - })) - .pipe(es.through(function(data) { - data.contents = new Buffer( - BUNDLED_FILE_HEADER - + data.contents.toString() - ); - this.emit('data', data); - })) - .pipe(gulp.dest('./release/')); -}); - - -var compilation = tsb.create(assign({ verbose: true }, require('./tsconfig.json').compilerOptions)); - -var tsSources = require('./tsconfig.json').include.concat(require('./tsconfig.json').files); - -function compileTask() { - return merge( - gulp.src(tsSources, { base: '.' }).pipe(compilation()) - ) - .pipe(gulp.dest('out')); -} -gulp.task('clean-out', function(cb) { rimraf('out', { maxBusyTries: 1 }, cb); }); -gulp.task('compile', ['clean-out'], compileTask); -gulp.task('compile-without-clean', compileTask); -gulp.task('watch', ['compile'], function() { - gulp.watch(tsSources, ['compile-without-clean']); -}); - -function getGitVersion(repo) { - var git = path.join(repo, '.git'); - var headPath = path.join(git, 'HEAD'); - var head; - - try { - head = fs.readFileSync(headPath, 'utf8').trim(); - } catch (e) { - return void 0; - } - - if (/^[0-9a-f]{40}$/i.test(head)) { - return head; - } - - var refMatch = /^ref: (.*)$/.exec(head); - - if (!refMatch) { - return void 0; - } - - var ref = refMatch[1]; - var refPath = path.join(git, ref); - - try { - return fs.readFileSync(refPath, 'utf8').trim(); - } catch (e) { - // noop - } - - var packedRefsPath = path.join(git, 'packed-refs'); - var refsRaw; - - try { - refsRaw = fs.readFileSync(packedRefsPath, 'utf8').trim(); - } catch (e) { - return void 0; - } - - var refsRegex = /^([0-9a-f]{40})\s+(.+)$/gm; - var refsMatch; - var refs = {}; - - while (refsMatch = refsRegex.exec(refsRaw)) { - refs[refsMatch[2]] = refsMatch[1]; - } - - return refs[ref]; -} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..e527b393 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,923 @@ +{ + "name": "monaco-languages", + "version": "1.0.3", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.1.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", + "dev": true + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "boom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", + "dev": true, + "requires": { + "hoek": "4.2.1" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "browser-request": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/browser-request/-/browser-request-0.3.3.tgz", + "integrity": "sha1-ns5bWsqJopkyJC4Yv5M975h2zBc=", + "dev": true + }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, + "requires": { + "graceful-readlink": "1.0.1" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cryptiles": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", + "dev": true, + "requires": { + "boom": "5.2.0" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "dev": true, + "requires": { + "hoek": "4.2.1" + } + } + } + }, + "cssom": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.2.tgz", + "integrity": "sha1-uANhcMefB6kP8vFuIihAJ6JDhIs=", + "dev": true + }, + "cssstyle": { + "version": "0.2.37", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz", + "integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=", + "dev": true, + "requires": { + "cssom": "0.3.2" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + } + }, + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "diff": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "dev": true + }, + "dom-serializer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", + "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", + "dev": true, + "requires": { + "domelementtype": "1.1.3", + "entities": "1.1.1" + }, + "dependencies": { + "domelementtype": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", + "dev": true + } + } + }, + "domelementtype": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", + "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", + "dev": true + }, + "domhandler": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.1.tgz", + "integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=", + "dev": true, + "requires": { + "domelementtype": "1.3.0" + } + }, + "domutils": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", + "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", + "dev": true, + "requires": { + "dom-serializer": "0.1.0", + "domelementtype": "1.3.0" + } + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "entities": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", + "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "dev": true + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.6", + "mime-types": "2.1.18" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + } + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true + }, + "growl": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "dev": true + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "dev": true, + "requires": { + "ajv": "5.5.2", + "har-schema": "2.0.0" + } + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "hawk": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "dev": true, + "requires": { + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.1", + "sntp": "2.1.0" + } + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "hoek": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", + "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", + "dev": true + }, + "htmlparser2": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", + "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", + "dev": true, + "requires": { + "domelementtype": "1.3.0", + "domhandler": "2.4.1", + "domutils": "1.7.0", + "entities": "1.1.1", + "inherits": "2.0.3", + "readable-stream": "2.3.5" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, + "optional": true + }, + "jsdom-no-contextify": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsdom-no-contextify/-/jsdom-no-contextify-3.1.0.tgz", + "integrity": "sha1-DYvq9hDC/yOJT1Tfp/id0i/Q96s=", + "dev": true, + "requires": { + "browser-request": "0.3.3", + "cssom": "0.3.2", + "cssstyle": "0.2.37", + "htmlparser2": "3.9.2", + "nwmatcher": "1.4.3", + "parse5": "1.5.1", + "request": "2.85.0", + "xml-name-validator": "1.0.0", + "xmlhttprequest": "1.8.0" + } + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json3": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "lodash._baseassign": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "dev": true, + "requires": { + "lodash._basecopy": "3.0.1", + "lodash.keys": "3.1.2" + } + }, + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basecreate": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", + "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", + "dev": true + }, + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash.create": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", + "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", + "dev": true, + "requires": { + "lodash._baseassign": "3.2.0", + "lodash._basecreate": "3.0.3", + "lodash._isiterateecall": "3.0.9" + } + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "3.9.1", + "lodash.isarguments": "3.1.0", + "lodash.isarray": "3.0.4" + } + }, + "mime-db": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", + "dev": true + }, + "mime-types": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "dev": true, + "requires": { + "mime-db": "1.33.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.11" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "mocha": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", + "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.9.0", + "debug": "2.6.8", + "diff": "3.2.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.1", + "growl": "1.9.2", + "he": "1.1.1", + "json3": "3.3.2", + "lodash.create": "3.1.1", + "mkdirp": "0.5.1", + "supports-color": "3.1.2" + } + }, + "monaco-editor-core": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.11.1.tgz", + "integrity": "sha512-zbi+FI4Bm1B48AvAVjir0XUJlH85ZyFHaBcXvZjfy+mui8VaE7Run2ai/l9cvb6oqzTKQwg/UpYDu0BWyB8K5w==", + "dev": true + }, + "monaco-plugin-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/monaco-plugin-helpers/-/monaco-plugin-helpers-1.0.2.tgz", + "integrity": "sha512-7kUx8dtd5qVNVgUARBRhnM8oftPglYwlINfigC4yGUiuzqtIN22u1tly8umiOCIPR0eFiBLjt6aN23oZh2QJgg==", + "dev": true, + "requires": { + "typescript": "2.7.2" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "nwmatcher": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz", + "integrity": "sha512-IKdSTiDWCarf2JTS5e9e2+5tPZGdkRJ79XjYV0pzK8Q9BpsFyBq1RGKxzs7Q8UBushGw7m6TzVKz6fcY99iSWw==", + "dev": true + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "parse5": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz", + "integrity": "sha1-m387DeMr543CQBsXVzzK8Pb1nZQ=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "dev": true + }, + "readable-stream": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.5.tgz", + "integrity": "sha512-tK0yDhrkygt/knjowCUiWP9YdV7c5R+8cR0r/kt9ZhBU906Fs6RpQJCEilamRJj1Nx2rWI6LkW9gKqjTkshhEw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } + }, + "request": { + "version": "2.85.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz", + "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", + "dev": true, + "requires": { + "aws-sign2": "0.7.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.6", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.3.2", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.18", + "oauth-sign": "0.8.2", + "performance-now": "2.1.0", + "qs": "6.5.1", + "safe-buffer": "5.1.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.4", + "tunnel-agent": "0.6.0", + "uuid": "3.2.1" + } + }, + "requirejs": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.5.tgz", + "integrity": "sha512-svnO+aNcR/an9Dpi44C7KSAy5fFGLtmPbaaCeQaklUz8BQhS64tWWIIlvEA5jrWICzlO/X9KSzSeXFnZdBu8nw==", + "dev": true + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true + }, + "sntp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "dev": true, + "requires": { + "hoek": "4.2.1" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "sshpk": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", + "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "dev": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", + "dev": true + }, + "supports-color": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", + "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "dev": true, + "requires": { + "has-flag": "1.0.0" + } + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "dev": true, + "requires": { + "punycode": "1.4.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, + "optional": true + }, + "typescript": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", + "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", + "dev": true + }, + "uglify-js": { + "version": "3.3.14", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.14.tgz", + "integrity": "sha512-OY8VPQU25q09gQRbC+Ekk3xgEVBmYFEfVcgS47ksjTiNht2LmLlUkWutyi38ZsDSToJHwbe76kDGwmD226Z2Fg==", + "dev": true, + "requires": { + "commander": "2.14.1", + "source-map": "0.6.1" + }, + "dependencies": { + "commander": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.14.1.tgz", + "integrity": "sha512-+YR16o3rK53SmWHU3rEM3tPAh2rwb1yPcQX5irVn7mb0gXbwuCCrnkbV5+PBfETdfg1vui07nM6PCG1zndcjQw==", + "dev": true + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "uuid": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", + "dev": true + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "xml-name-validator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-1.0.0.tgz", + "integrity": "sha1-3Pgu4JIyKVHvjMG6WWycv9FKg/E=", + "dev": true + }, + "xmlhttprequest": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", + "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=", + "dev": true + } + } +} diff --git a/package.json b/package.json index 52703a83..0995cc83 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "monaco-languages", - "version": "0.9.0", + "version": "1.0.3", "description": "Bundle of many languages for the Monaco Editor.", "scripts": { - "compile": "node_modules/.bin/gulp compile", - "watch": "node_modules/.bin/gulp watch", - "test": "node_modules/.bin/mocha", - "prepublish": "node_modules/.bin/gulp release" + "compile": "mrmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json", + "watch": "tsc -p ./src --watch", + "test": "mocha", + "prepublish": "npm run compile && node ./scripts/bundle" }, "author": "Microsoft Corporation", "license": "MIT", @@ -18,17 +18,12 @@ "url": "https://github.com/Microsoft/monaco-languages/issues" }, "devDependencies": { - "event-stream": "^3.3.4", - "gulp": "^3.9.1", - "gulp-requirejs": "^1.0.0-rc2", - "gulp-tsb": "^2.0.3", - "gulp-uglify": "^3.0.0", "jsdom-no-contextify": "^3.1.0", - "merge-stream": "^1.0.1", "mocha": "^3.4.2", - "monaco-editor-core": "^0.10.0", - "object-assign": "^4.1.1", - "rimraf": "^2.6.1", - "typescript": "2.3.4" + "monaco-editor-core": "0.11.1", + "monaco-plugin-helpers": "^1.0.2", + "requirejs": "^2.3.5", + "typescript": "2.7.2", + "uglify-js": "^3.3.14" } } diff --git a/scripts/bundle.js b/scripts/bundle.js new file mode 100644 index 00000000..d9ae2b70 --- /dev/null +++ b/scripts/bundle.js @@ -0,0 +1,86 @@ +const requirejs = require('requirejs'); +const path = require('path'); +const fs = require('fs'); +const UglifyJS = require("uglify-js"); +const helpers = require('monaco-plugin-helpers'); + +const REPO_ROOT = path.resolve(__dirname, '..'); + +const sha1 = helpers.getGitVersion(REPO_ROOT); +const semver = require('../package.json').version; +const headerVersion = semver + '(' + sha1 + ')'; + +const BUNDLED_FILE_HEADER = [ + '/*!-----------------------------------------------------------------------------', + ' * Copyright (c) Microsoft Corporation. All rights reserved.', + ' * monaco-languages version: ' + headerVersion, + ' * Released under the MIT license', + ' * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md', + ' *-----------------------------------------------------------------------------*/', + '' +].join('\n'); + +bundleOne('monaco.contribution'); +bundleOne('bat/bat'); +bundleOne('css/css'); +bundleOne('coffee/coffee'); +bundleOne('cpp/cpp'); +bundleOne('csharp/csharp'); +bundleOne('dockerfile/dockerfile'); +bundleOne('fsharp/fsharp'); +bundleOne('go/go'); +bundleOne('handlebars/handlebars'); +bundleOne('html/html'); +bundleOne('ini/ini'); +bundleOne('pug/pug'); +bundleOne('java/java'); +bundleOne('less/less'); +bundleOne('lua/lua'); +bundleOne('markdown/markdown'); +bundleOne('msdax/msdax'); +bundleOne('objective-c/objective-c'); +bundleOne('php/php'); +bundleOne('powershell/powershell'); +bundleOne('postiats/postiats'); +bundleOne('python/python'); +bundleOne('r/r'); +bundleOne('razor/razor'); +bundleOne('ruby/ruby'); +bundleOne('scss/scss'); +bundleOne('sql/sql'); +bundleOne('swift/swift'); +bundleOne('vb/vb'); +bundleOne('xml/xml'); +bundleOne('yaml/yaml'); +bundleOne('solidity/solidity'); +bundleOne('sb/sb'); +bundleOne('mysql/mysql'); +bundleOne('redshift/redshift'); +bundleOne('pgsql/pgsql'); +bundleOne('redis/redis'); +bundleOne('csp/csp'); + +function bundleOne(moduleId, exclude) { + requirejs.optimize({ + baseUrl: 'release/dev/', + name: 'vs/basic-languages/' + moduleId, + out: 'release/min/' + moduleId + '.js', + exclude: exclude, + paths: { + 'vs/basic-languages': REPO_ROOT + '/release/dev' + }, + optimize: 'none' + }, function(buildResponse) { + const filePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js'); + const fileContents = fs.readFileSync(filePath).toString(); + console.log(); + console.log(`Minifying ${filePath}...`); + const result = UglifyJS.minify(fileContents, { + output: { + comments: 'some' + } + }); + console.log(`Done.`); + fs.writeFileSync(filePath, BUNDLED_FILE_HEADER + result.code); + }) +} diff --git a/src/_.contribution.ts b/src/_.contribution.ts new file mode 100644 index 00000000..80594a56 --- /dev/null +++ b/src/_.contribution.ts @@ -0,0 +1,46 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +interface ILang extends monaco.languages.ILanguageExtensionPoint { + loader: () => monaco.Promise; +} + +interface ILangImpl { + conf: monaco.languages.LanguageConfiguration; + language: monaco.languages.IMonarchLanguage; +} + +let languageDefinitions: { [languageId: string]: ILang } = {}; + +function _loadLanguage(languageId: string): monaco.Promise { + const loader = languageDefinitions[languageId].loader; + return loader().then((mod) => { + _monaco.languages.setMonarchTokensProvider(languageId, mod.language); + _monaco.languages.setLanguageConfiguration(languageId, mod.conf); + }); +} + +let languagePromises: { [languageId: string]: monaco.Promise } = {}; + +export function loadLanguage(languageId: string): monaco.Promise { + if (!languagePromises[languageId]) { + languagePromises[languageId] = _loadLanguage(languageId); + } + return languagePromises[languageId]; +} + +export function registerLanguage(def: ILang): void { + let languageId = def.id; + + languageDefinitions[languageId] = def; + _monaco.languages.register(def); + _monaco.languages.onLanguage(languageId, () => { + loadLanguage(languageId); + }); +} diff --git a/src/bat/bat.contribution.ts b/src/bat/bat.contribution.ts new file mode 100644 index 00000000..91261712 --- /dev/null +++ b/src/bat/bat.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'bat', + extensions: ['.bat', '.cmd'], + aliases: ['Batch', 'bat'], + loader: () => _monaco.Promise.wrap(import('./bat')) +}); diff --git a/test/bat.test.ts b/src/bat/bat.test.ts similarity index 94% rename from test/bat.test.ts rename to src/bat/bat.test.ts index 9307c63e..06d3e26a 100644 --- a/test/bat.test.ts +++ b/src/bat/bat.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('bat', [ // Keywords diff --git a/src/bat.ts b/src/bat/bat.ts similarity index 91% rename from src/bat.ts rename to src/bat/bat.ts index 953aab2c..69408bab 100644 --- a/src/bat.ts +++ b/src/bat/bat.ts @@ -27,7 +27,13 @@ export const conf: IRichLanguageConfiguration = { { open: '[', close: ']' }, { open: '(', close: ')' }, { open: '"', close: '"' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*(::\\s*|REM\\s+)#region"), + end: new RegExp("^\\s*(::\\s*|REM\\s+)#endregion") + } + } }; export const language = { diff --git a/src/coffee/coffee.contribution.ts b/src/coffee/coffee.contribution.ts new file mode 100644 index 00000000..2e180f64 --- /dev/null +++ b/src/coffee/coffee.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'coffeescript', + extensions: ['.coffee'], + aliases: ['CoffeeScript', 'coffeescript', 'coffee'], + mimetypes: ['text/x-coffeescript', 'text/coffeescript'], + loader: () => _monaco.Promise.wrap(import('./coffee')) +}); diff --git a/test/coffee.test.ts b/src/coffee/coffee.test.ts similarity index 99% rename from test/coffee.test.ts rename to src/coffee/coffee.test.ts index 8c37ce24..51b2ad01 100644 --- a/test/coffee.test.ts +++ b/src/coffee/coffee.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('coffeescript', [ // Comments diff --git a/src/coffee.ts b/src/coffee/coffee.ts similarity index 97% rename from src/coffee.ts rename to src/coffee/coffee.ts index 7dc780cc..e64cd1ca 100644 --- a/src/coffee.ts +++ b/src/coffee/coffee.ts @@ -32,7 +32,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*#region\\b"), + end: new RegExp("^\\s*#endregion\\b") + } + } }; export const language = { diff --git a/src/cpp/cpp.contribution.ts b/src/cpp/cpp.contribution.ts new file mode 100644 index 00000000..e69b052b --- /dev/null +++ b/src/cpp/cpp.contribution.ts @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'c', + extensions: ['.c', '.h'], + aliases: ['C', 'c'], + loader: () => _monaco.Promise.wrap(import('./cpp')) +}); +registerLanguage({ + id: 'cpp', + extensions: ['.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx'], + aliases: ['C++', 'Cpp', 'cpp'], + loader: () => _monaco.Promise.wrap(import('./cpp')) +}); diff --git a/test/cpp.test.ts b/src/cpp/cpp.test.ts similarity index 98% rename from test/cpp.test.ts rename to src/cpp/cpp.test.ts index 9eb51ab5..27e8d9da 100644 --- a/test/cpp.test.ts +++ b/src/cpp/cpp.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('cpp', [ // Keywords @@ -776,5 +776,13 @@ testTokenization('cpp', [ { startIndex: 25, type: 'identifier.cpp' }, { startIndex: 26, type: 'delimiter.parenthesis.cpp' } ] + }, { + line: 'uR"V0G0N(abc)V0G0N"def', + tokens: [ + { startIndex: 0, type: 'string.raw.begin.cpp' }, + { startIndex: 9, type: 'string.raw.cpp' }, + { startIndex: 12, type: 'string.raw.end.cpp' }, + { startIndex: 19, type: 'identifier.cpp' } + ] }] ]); diff --git a/src/cpp.ts b/src/cpp/cpp.ts similarity index 91% rename from src/cpp.ts rename to src/cpp/cpp.ts index fe8614dc..7e631cbc 100644 --- a/src/cpp.ts +++ b/src/cpp/cpp.ts @@ -31,7 +31,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*#pragma\\s+region\\b"), + end: new RegExp("^\\s*#pragma\\s+endregion\\b") + } + } }; export const language = { @@ -240,10 +246,14 @@ export const language = { escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/, integersuffix: /(ll|LL|u|U|l|L)?(ll|LL|u|U|l|L)?/, floatsuffix: /[fFlL]?/, + encoding: /u|u8|U|L/, // The main tokenizer for our languages tokenizer: { root: [ + // C++ 11 Raw String + [/@encoding?R\"(?:([^ ()\\\t]*))\(/, { token: 'string.raw.begin', next: '@raw.$1' }], + // identifiers and keywords [/[a-zA-Z_]\w*/, { cases: { @@ -318,5 +328,16 @@ export const language = { [/\\./, 'string.escape.invalid'], [/"/, 'string', '@pop'] ], + + raw: [ + [/(.*)(\))(?:([^ ()\\\t]*))(\")/, { + cases: { + '$3==$S2': ['string.raw', 'string.raw.end', 'string.raw.end', { token: 'string.raw.end', next: '@pop' }], + '@default': ['string.raw', 'string.raw', 'string.raw', 'string.raw'] + } + } + ], + [/.*/, 'string.raw'] + ] }, }; diff --git a/src/csharp/csharp.contribution.ts b/src/csharp/csharp.contribution.ts new file mode 100644 index 00000000..2ac1a2a8 --- /dev/null +++ b/src/csharp/csharp.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'csharp', + extensions: ['.cs', '.csx'], + aliases: ['C#', 'csharp'], + loader: () => _monaco.Promise.wrap(import('./csharp')) +}); diff --git a/test/csharp.test.ts b/src/csharp/csharp.test.ts similarity index 99% rename from test/csharp.test.ts rename to src/csharp/csharp.test.ts index 2ba71661..4ca578a3 100644 --- a/test/csharp.test.ts +++ b/src/csharp/csharp.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('csharp', [ diff --git a/src/csharp.ts b/src/csharp/csharp.ts similarity index 98% rename from src/csharp.ts rename to src/csharp/csharp.ts index d07e5f5c..00747ed7 100644 --- a/src/csharp.ts +++ b/src/csharp/csharp.ts @@ -33,7 +33,13 @@ export const conf: IRichLanguageConfiguration = { { open: '<', close: '>' }, { open: '\'', close: '\'' }, { open: '"', close: '"' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*#region\\b"), + end: new RegExp("^\\s*#endregion\\b") + } + } }; export const language = { diff --git a/src/csp/csp.contribution.ts b/src/csp/csp.contribution.ts new file mode 100644 index 00000000..3deef58d --- /dev/null +++ b/src/csp/csp.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'csp', + extensions: [], + aliases: ['CSP', 'csp'], + loader: () => _monaco.Promise.wrap(import('./csp')) +}); diff --git a/test/csp.test.ts b/src/csp/csp.test.ts similarity index 87% rename from test/csp.test.ts rename to src/csp/csp.test.ts index cfcd8219..0866d10c 100644 --- a/test/csp.test.ts +++ b/src/csp/csp.test.ts @@ -5,6 +5,6 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('csp', []); diff --git a/src/csp.ts b/src/csp/csp.ts similarity index 100% rename from src/csp.ts rename to src/csp/csp.ts diff --git a/src/css/css.contribution.ts b/src/css/css.contribution.ts new file mode 100644 index 00000000..bb39d00f --- /dev/null +++ b/src/css/css.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'css', + extensions: ['.css'], + aliases: ['CSS', 'css'], + mimetypes: ['text/css'], + loader: () => _monaco.Promise.wrap(import('./css')) +}); diff --git a/test/css.test.ts b/src/css/css.test.ts similarity index 96% rename from test/css.test.ts rename to src/css/css.test.ts index 7a6901f1..4499001b 100644 --- a/test/css.test.ts +++ b/src/css/css.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('css', [ // Skip whitespace diff --git a/src/css.ts b/src/css/css.ts similarity index 97% rename from src/css.ts rename to src/css/css.ts index f6b6c0ae..c987d8be 100644 --- a/src/css.ts +++ b/src/css/css.ts @@ -35,7 +35,14 @@ export const conf: LanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' } - ] + ], + + folding: { + markers: { + start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"), + end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/") + } + } }; export const language = { diff --git a/src/dockerfile/dockerfile.contribution.ts b/src/dockerfile/dockerfile.contribution.ts new file mode 100644 index 00000000..d4200e08 --- /dev/null +++ b/src/dockerfile/dockerfile.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'dockerfile', + extensions: ['.dockerfile'], + filenames: ['Dockerfile'], + aliases: ['Dockerfile'], + loader: () => _monaco.Promise.wrap(import('./dockerfile')) +}); diff --git a/test/dockerfile.test.ts b/src/dockerfile/dockerfile.test.ts similarity index 99% rename from test/dockerfile.test.ts rename to src/dockerfile/dockerfile.test.ts index 7245358d..68d32b4f 100644 --- a/test/dockerfile.test.ts +++ b/src/dockerfile/dockerfile.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('dockerfile', [ // All diff --git a/src/dockerfile.ts b/src/dockerfile/dockerfile.ts similarity index 100% rename from src/dockerfile.ts rename to src/dockerfile/dockerfile.ts diff --git a/src/fsharp/fsharp.contribution.ts b/src/fsharp/fsharp.contribution.ts new file mode 100644 index 00000000..bd9a0c05 --- /dev/null +++ b/src/fsharp/fsharp.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'fsharp', + extensions: ['.fs', '.fsi', '.ml', '.mli', '.fsx', '.fsscript'], + aliases: ['F#', 'FSharp', 'fsharp'], + loader: () => _monaco.Promise.wrap(import('./fsharp')) +}); diff --git a/test/fsharp.test.ts b/src/fsharp/fsharp.test.ts similarity index 97% rename from test/fsharp.test.ts rename to src/fsharp/fsharp.test.ts index cb4a14c0..2fe82857 100644 --- a/test/fsharp.test.ts +++ b/src/fsharp/fsharp.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('fsharp', [ // comments - single line @@ -184,7 +184,9 @@ testTokenization('fsharp', [ { startIndex: 1, type: '' }, { startIndex: 2, type: 'delimiter.fs' }, { startIndex: 3, type: '' }, - { startIndex: 4, type: 'comment.fs' } + { startIndex: 4, type: 'delimiter.parenthesis.fs' }, + { startIndex: 5, type: 'delimiter.fs' }, + { startIndex: 6, type: 'delimiter.parenthesis.fs' } ] }], diff --git a/src/fsharp.ts b/src/fsharp/fsharp.ts similarity index 94% rename from src/fsharp.ts rename to src/fsharp/fsharp.ts index 281385b0..42fce872 100644 --- a/src/fsharp.ts +++ b/src/fsharp/fsharp.ts @@ -30,7 +30,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' } - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*//\\s*#region\\b|^\\s*\\(\\*\\s*#region(.*)\\*\\)"), + end: new RegExp("^\\s*//\\s*#endregion\\b|^\\s*\\(\\*\\s*#endregion\\s*\\*\\)") + } + } }; export const language = { @@ -121,7 +127,7 @@ export const language = { whitespace: [ [/[ \t\r\n]+/, ''], - [/\(\*/, 'comment', '@comment'], + [/\(\*(?!\))/, 'comment', '@comment'], [/\/\/.*$/, 'comment'], ], diff --git a/src/go/go.contribution.ts b/src/go/go.contribution.ts new file mode 100644 index 00000000..2e0bd2cd --- /dev/null +++ b/src/go/go.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'go', + extensions: ['.go'], + aliases: ['Go'], + loader: () => _monaco.Promise.wrap(import('./go')) +}); diff --git a/test/go.test.ts b/src/go/go.test.ts similarity index 99% rename from test/go.test.ts rename to src/go/go.test.ts index ece692ca..3fa373cb 100644 --- a/test/go.test.ts +++ b/src/go/go.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('go', [ // Tests diff --git a/src/go.ts b/src/go/go.ts similarity index 100% rename from src/go.ts rename to src/go/go.ts diff --git a/src/handlebars/handlebars.contribution.ts b/src/handlebars/handlebars.contribution.ts new file mode 100644 index 00000000..a0252eed --- /dev/null +++ b/src/handlebars/handlebars.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'handlebars', + extensions: ['.handlebars', '.hbs'], + aliases: ['Handlebars', 'handlebars'], + mimetypes: ['text/x-handlebars-template'], + loader: () => _monaco.Promise.wrap(import('./handlebars')) +}); diff --git a/test/handlebars.test.ts b/src/handlebars/handlebars.test.ts similarity index 96% rename from test/handlebars.test.ts rename to src/handlebars/handlebars.test.ts index 852cbc3c..21dacb6e 100644 --- a/test/handlebars.test.ts +++ b/src/handlebars/handlebars.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization(['handlebars', 'css'], [ diff --git a/src/handlebars.ts b/src/handlebars/handlebars.ts similarity index 100% rename from src/handlebars.ts rename to src/handlebars/handlebars.ts diff --git a/src/html/html.contribution.ts b/src/html/html.contribution.ts new file mode 100644 index 00000000..a9eabe15 --- /dev/null +++ b/src/html/html.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'html', + extensions: ['.html', '.htm', '.shtml', '.xhtml', '.mdoc', '.jsp', '.asp', '.aspx', '.jshtm'], + aliases: ['HTML', 'htm', 'html', 'xhtml'], + mimetypes: ['text/html', 'text/x-jshtm', 'text/template', 'text/ng-template'], + loader: () => _monaco.Promise.wrap(import('./html')) +}); diff --git a/test/html.test.ts b/src/html/html.test.ts similarity index 96% rename from test/html.test.ts rename to src/html/html.test.ts index d3c2d335..07c7fe56 100644 --- a/test/html.test.ts +++ b/src/html/html.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization(['html', 'css'], [ diff --git a/src/html.ts b/src/html/html.ts similarity index 94% rename from src/html.ts rename to src/html/html.ts index 0a56e243..e8a45486 100644 --- a/src/html.ts +++ b/src/html/html.ts @@ -55,6 +55,13 @@ export const conf: IRichLanguageConfiguration = { action: { indentAction: _monaco.languages.IndentAction.Indent } } ], + + folding: { + markers: { + start: new RegExp("^\\s*"), + end: new RegExp("^\\s*") + } + } }; export const language = { diff --git a/src/ini/ini.contribution.ts b/src/ini/ini.contribution.ts new file mode 100644 index 00000000..a8344d48 --- /dev/null +++ b/src/ini/ini.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'ini', + extensions: ['.ini', '.properties', '.gitconfig'], + filenames: ['config', '.gitattributes', '.gitconfig', '.editorconfig'], + aliases: ['Ini', 'ini'], + loader: () => _monaco.Promise.wrap(import('./ini')) +}); diff --git a/src/ini.ts b/src/ini/ini.ts similarity index 100% rename from src/ini.ts rename to src/ini/ini.ts diff --git a/src/java/java.contribution.ts b/src/java/java.contribution.ts new file mode 100644 index 00000000..866a69be --- /dev/null +++ b/src/java/java.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'java', + extensions: ['.java', '.jav'], + aliases: ['Java', 'java'], + mimetypes: ['text/x-java-source', 'text/x-java'], + loader: () => _monaco.Promise.wrap(import('./java')) +}); diff --git a/test/java.test.ts b/src/java/java.test.ts similarity index 99% rename from test/java.test.ts rename to src/java/java.test.ts index 498571aa..f9271e49 100644 --- a/test/java.test.ts +++ b/src/java/java.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('java', [ // Comments - single line diff --git a/src/java.ts b/src/java/java.ts similarity index 95% rename from src/java.ts rename to src/java/java.ts index 893b072e..521dd7e1 100644 --- a/src/java.ts +++ b/src/java/java.ts @@ -34,7 +34,13 @@ export const conf: IRichLanguageConfiguration = { { open: '"', close: '"' }, { open: '\'', close: '\'' }, { open: '<', close: '>' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:))") + } + } }; export const language = { diff --git a/src/less/less.contribution.ts b/src/less/less.contribution.ts new file mode 100644 index 00000000..cc61fbce --- /dev/null +++ b/src/less/less.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'less', + extensions: ['.less'], + aliases: ['Less', 'less'], + mimetypes: ['text/x-less', 'text/less'], + loader: () => _monaco.Promise.wrap(import('./less')) +}); diff --git a/test/less.test.ts b/src/less/less.test.ts similarity index 96% rename from test/less.test.ts rename to src/less/less.test.ts index 6b9ceb6d..3b9eff59 100644 --- a/test/less.test.ts +++ b/src/less/less.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization(['less'], [ diff --git a/src/less.ts b/src/less/less.ts similarity index 96% rename from src/less.ts rename to src/less/less.ts index 03ee4256..d3c3a79f 100644 --- a/src/less.ts +++ b/src/less/less.ts @@ -32,7 +32,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"), + end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/") + } + } }; export const language = { diff --git a/src/lua/lua.contribution.ts b/src/lua/lua.contribution.ts new file mode 100644 index 00000000..bec757e0 --- /dev/null +++ b/src/lua/lua.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'lua', + extensions: ['.lua'], + aliases: ['Lua', 'lua'], + loader: () => _monaco.Promise.wrap(import('./lua')) +}); diff --git a/test/lua.test.ts b/src/lua/lua.test.ts similarity index 97% rename from test/lua.test.ts rename to src/lua/lua.test.ts index eb57ab33..c040aac6 100644 --- a/test/lua.test.ts +++ b/src/lua/lua.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('lua', [ diff --git a/src/lua.ts b/src/lua/lua.ts similarity index 100% rename from src/lua.ts rename to src/lua/lua.ts diff --git a/src/markdown/markdown.contribution.ts b/src/markdown/markdown.contribution.ts new file mode 100644 index 00000000..0aa96e6d --- /dev/null +++ b/src/markdown/markdown.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'markdown', + extensions: ['.md', '.markdown', '.mdown', '.mkdn', '.mkd', '.mdwn', '.mdtxt', '.mdtext'], + aliases: ['Markdown', 'markdown'], + loader: () => _monaco.Promise.wrap(import('./markdown')) +}); diff --git a/test/markdown.test.ts b/src/markdown/markdown.test.ts similarity index 94% rename from test/markdown.test.ts rename to src/markdown/markdown.test.ts index cd1bba58..5e802682 100644 --- a/test/markdown.test.ts +++ b/src/markdown/markdown.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('markdown', [ diff --git a/src/markdown.ts b/src/markdown/markdown.ts similarity index 97% rename from src/markdown.ts rename to src/markdown/markdown.ts index fe51ce74..9edf2d66 100644 --- a/src/markdown.ts +++ b/src/markdown/markdown.ts @@ -44,7 +44,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '[', close: ']' }, { open: '`', close: '`' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*"), + end: new RegExp("^\\s*") + } + } }; export const language = { diff --git a/test/mocha.d.ts b/src/mocha.d.ts similarity index 100% rename from test/mocha.d.ts rename to src/mocha.d.ts diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index a74e2e1f..00ee430c 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -4,306 +4,41 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -declare var require: (moduleId: [string], callback: (module: T) => void, error: (err: any) => void) => void; - -// Allow for running under nodejs/requirejs in tests -const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); - -interface ILang extends monaco.languages.ILanguageExtensionPoint { - module: string; -} - -interface ILangImpl { - conf: monaco.languages.LanguageConfiguration; - language: monaco.languages.IMonarchLanguage; -} - -let languageDefinitions: { [languageId: string]: ILang } = {}; - -function _loadLanguage(languageId: string): monaco.Promise { - let module = languageDefinitions[languageId].module; - return new _monaco.Promise((c, e, p) => { - require([module], (mod) => { - _monaco.languages.setMonarchTokensProvider(languageId, mod.language); - _monaco.languages.setLanguageConfiguration(languageId, mod.conf); - c(void 0); - }, e); - }); -} - -let languagePromises: { [languageId: string]: monaco.Promise } = {}; - -export function loadLanguage(languageId: string): monaco.Promise { - if (!languagePromises[languageId]) { - languagePromises[languageId] = _loadLanguage(languageId); - } - return languagePromises[languageId]; -} - -function registerLanguage(def: ILang): void { - let languageId = def.id; - - languageDefinitions[languageId] = def; - _monaco.languages.register(def); - _monaco.languages.onLanguage(languageId, () => { - loadLanguage(languageId); - }); -} - - -registerLanguage({ - id: 'bat', - extensions: ['.bat', '.cmd'], - aliases: ['Batch', 'bat'], - module: './bat' -}); -registerLanguage({ - id: 'coffeescript', - extensions: ['.coffee'], - aliases: ['CoffeeScript', 'coffeescript', 'coffee'], - mimetypes: ['text/x-coffeescript', 'text/coffeescript'], - module: './coffee' -}); -registerLanguage({ - id: 'c', - extensions: ['.c', '.h'], - aliases: ['C', 'c'], - module: './cpp' -}); -registerLanguage({ - id: 'cpp', - extensions: ['.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx'], - aliases: ['C++', 'Cpp', 'cpp'], - module: './cpp' -}); -registerLanguage({ - id: 'csharp', - extensions: ['.cs', '.csx'], - aliases: ['C#', 'csharp'], - module: './csharp' -}); -registerLanguage({ - id: 'dockerfile', - extensions: ['.dockerfile'], - filenames: ['Dockerfile'], - aliases: ['Dockerfile'], - module: './dockerfile' -}); -registerLanguage({ - id: 'fsharp', - extensions: ['.fs', '.fsi', '.ml', '.mli', '.fsx', '.fsscript'], - aliases: ['F#', 'FSharp', 'fsharp'], - module: './fsharp' -}); -registerLanguage({ - id: 'go', - extensions: ['.go'], - aliases: ['Go'], - module: './go' -}); -registerLanguage({ - id: 'handlebars', - extensions: ['.handlebars', '.hbs'], - aliases: ['Handlebars', 'handlebars'], - mimetypes: ['text/x-handlebars-template'], - module: './handlebars' -}); -registerLanguage({ - id: 'html', - extensions: ['.html', '.htm', '.shtml', '.xhtml', '.mdoc', '.jsp', '.asp', '.aspx', '.jshtm'], - aliases: ['HTML', 'htm', 'html', 'xhtml'], - mimetypes: ['text/html', 'text/x-jshtm', 'text/template', 'text/ng-template'], - module: './html' -}); -registerLanguage({ - id: 'ini', - extensions: ['.ini', '.properties', '.gitconfig'], - filenames: ['config', '.gitattributes', '.gitconfig', '.editorconfig'], - aliases: ['Ini', 'ini'], - module: './ini' -}); -registerLanguage({ - id: 'pug', - extensions: ['.jade', '.pug'], - aliases: ['Pug', 'Jade', 'jade'], - module: './pug' -}); -registerLanguage({ - id: 'java', - extensions: ['.java', '.jav'], - aliases: ['Java', 'java'], - mimetypes: ['text/x-java-source', 'text/x-java'], - module: './java' -}); -registerLanguage({ - id: 'lua', - extensions: ['.lua'], - aliases: ['Lua', 'lua'], - module: './lua' -}); -registerLanguage({ - id: 'markdown', - extensions: ['.md', '.markdown', '.mdown', '.mkdn', '.mkd', '.mdwn', '.mdtxt', '.mdtext'], - aliases: ['Markdown', 'markdown'], - module: './markdown' -}); -registerLanguage({ - id: 'msdax', - extensions: ['.dax', '.msdax'], - aliases: ['DAX', 'MSDAX'], - module: './msdax' -}); -registerLanguage({ - id: 'objective-c', - extensions: ['.m'], - aliases: ['Objective-C'], - module: './objective-c' -}); -registerLanguage({ - id: 'postiats', - extensions: ['.dats', '.sats', '.hats'], - aliases: ['ATS', 'ATS/Postiats'], - module: './postiats' -}); -registerLanguage({ - id: 'php', - extensions: ['.php', '.php4', '.php5', '.phtml', '.ctp'], - aliases: ['PHP', 'php'], - mimetypes: ['application/x-php'], - module: './php' -}); -registerLanguage({ - id: 'powershell', - extensions: ['.ps1', '.psm1', '.psd1'], - aliases: ['PowerShell', 'powershell', 'ps', 'ps1'], - module: './powershell' -}); -registerLanguage({ - id: 'python', - extensions: ['.py', '.rpy', '.pyw', '.cpy', '.gyp', '.gypi'], - aliases: ['Python', 'py'], - firstLine: '^#!/.*\\bpython[0-9.-]*\\b', - module: './python' -}); -registerLanguage({ - id: 'r', - extensions: ['.r', '.rhistory', '.rprofile', '.rt'], - aliases: ['R', 'r'], - module: './r' -}); -registerLanguage({ - id: 'razor', - extensions: ['.cshtml'], - aliases: ['Razor', 'razor'], - mimetypes: ['text/x-cshtml'], - module: './razor' -}); -registerLanguage({ - id: 'ruby', - extensions: ['.rb', '.rbx', '.rjs', '.gemspec', '.pp'], - filenames: ['rakefile'], - aliases: ['Ruby', 'rb'], - module: './ruby' -}); -registerLanguage({ - id: 'swift', - aliases: ['Swift', 'swift'], - extensions: ['.swift'], - mimetypes: ['text/swift'], - module: './swift' -}); -registerLanguage({ - id: 'sql', - extensions: ['.sql'], - aliases: ['SQL'], - module: './sql' -}); -registerLanguage({ - id: 'vb', - extensions: ['.vb'], - aliases: ['Visual Basic', 'vb'], - module: './vb' -}); -registerLanguage({ - id: 'xml', - extensions: ['.xml', '.dtd', '.ascx', '.csproj', '.config', '.wxi', '.wxl', '.wxs', '.xaml', '.svg', '.svgz'], - firstLine: '(\\<\\?xml.*)|(\\self).monaco : monaco); + +registerLanguage({ + id: 'msdax', + extensions: ['.dax', '.msdax'], + aliases: ['DAX', 'MSDAX'], + loader: () => _monaco.Promise.wrap(import('./msdax')) +}); diff --git a/test/msdax.test.ts b/src/msdax/msdax.test.ts similarity index 99% rename from test/msdax.test.ts rename to src/msdax/msdax.test.ts index 68408305..208ecd2d 100644 --- a/test/msdax.test.ts +++ b/src/msdax/msdax.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('msdax', [ // Comments diff --git a/src/msdax.ts b/src/msdax/msdax.ts similarity index 100% rename from src/msdax.ts rename to src/msdax/msdax.ts diff --git a/src/mysql/mysql.contribution.ts b/src/mysql/mysql.contribution.ts new file mode 100644 index 00000000..f1476d28 --- /dev/null +++ b/src/mysql/mysql.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'mysql', + extensions: [], + aliases: ['MySQL', 'mysql'], + loader: () => _monaco.Promise.wrap(import('./mysql')) +}); diff --git a/test/mysql.test.ts b/src/mysql/mysql.test.ts similarity index 99% rename from test/mysql.test.ts rename to src/mysql/mysql.test.ts index 18ec3b9d..3bf59414 100644 --- a/test/mysql.test.ts +++ b/src/mysql/mysql.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('mysql', [ // Comments diff --git a/src/mysql.ts b/src/mysql/mysql.ts similarity index 100% rename from src/mysql.ts rename to src/mysql/mysql.ts diff --git a/src/objective-c/objective-c.contribution.ts b/src/objective-c/objective-c.contribution.ts new file mode 100644 index 00000000..e57176f0 --- /dev/null +++ b/src/objective-c/objective-c.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'objective-c', + extensions: ['.m'], + aliases: ['Objective-C'], + loader: () => _monaco.Promise.wrap(import('./objective-c')) +}); diff --git a/test/objective-c.test.ts b/src/objective-c/objective-c.test.ts similarity index 99% rename from test/objective-c.test.ts rename to src/objective-c/objective-c.test.ts index cd44bbfd..732cba14 100644 --- a/test/objective-c.test.ts +++ b/src/objective-c/objective-c.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('objective-c', [ // Keywords diff --git a/src/objective-c.ts b/src/objective-c/objective-c.ts similarity index 100% rename from src/objective-c.ts rename to src/objective-c/objective-c.ts diff --git a/src/pgsql/pgsql.contribution.ts b/src/pgsql/pgsql.contribution.ts new file mode 100644 index 00000000..f3ff6b4c --- /dev/null +++ b/src/pgsql/pgsql.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'pgsql', + extensions: [], + aliases: ['PostgreSQL', 'postgres', 'pg', 'postgre'], + loader: () => _monaco.Promise.wrap(import('./pgsql')) +}); diff --git a/test/pgsql.test.ts b/src/pgsql/pgsql.test.ts similarity index 99% rename from test/pgsql.test.ts rename to src/pgsql/pgsql.test.ts index d8958603..163c3032 100644 --- a/test/pgsql.test.ts +++ b/src/pgsql/pgsql.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('sql', [ // Comments diff --git a/src/pgsql.ts b/src/pgsql/pgsql.ts similarity index 100% rename from src/pgsql.ts rename to src/pgsql/pgsql.ts diff --git a/src/php/php.contribution.ts b/src/php/php.contribution.ts new file mode 100644 index 00000000..c5df88db --- /dev/null +++ b/src/php/php.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'php', + extensions: ['.php', '.php4', '.php5', '.phtml', '.ctp'], + aliases: ['PHP', 'php'], + mimetypes: ['application/x-php'], + loader: () => _monaco.Promise.wrap(import('./php')) +}); diff --git a/test/php.test.ts b/src/php/php.test.ts similarity index 96% rename from test/php.test.ts rename to src/php/php.test.ts index 72323f2e..1e3c29db 100644 --- a/test/php.test.ts +++ b/src/php/php.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization(['php', 'css'], [ // Bug 13596:[ErrorTelemetry] Stream did not advance while tokenizing. Mode id is php (stuck) diff --git a/src/php.ts b/src/php/php.ts similarity index 95% rename from src/php.ts rename to src/php/php.ts index f05217a7..5848206a 100644 --- a/src/php.ts +++ b/src/php/php.ts @@ -28,7 +28,14 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')', notIn: ['string'] }, { open: '"', close: '"', notIn: ['string'] }, { open: '\'', close: '\'', notIn: ['string', 'comment'] } - ] + ], + + folding: { + markers: { + start: new RegExp("^\\s*(#|\/\/)region\\b"), + end: new RegExp("^\\s*(#|\/\/)endregion\\b") + } + } }; export const language = { diff --git a/src/postiats/postiats.contribution.ts b/src/postiats/postiats.contribution.ts new file mode 100644 index 00000000..77e7c2b7 --- /dev/null +++ b/src/postiats/postiats.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'postiats', + extensions: ['.dats', '.sats', '.hats'], + aliases: ['ATS', 'ATS/Postiats'], + loader: () => _monaco.Promise.wrap(import('./postiats')) +}); diff --git a/test/postiats.test.ts b/src/postiats/postiats.test.ts similarity index 99% rename from test/postiats.test.ts rename to src/postiats/postiats.test.ts index 14ad8e0c..e4624729 100644 --- a/test/postiats.test.ts +++ b/src/postiats/postiats.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('postiats', [ // Keywords diff --git a/src/postiats.ts b/src/postiats/postiats.ts similarity index 100% rename from src/postiats.ts rename to src/postiats/postiats.ts diff --git a/src/powershell/powershell.contribution.ts b/src/powershell/powershell.contribution.ts new file mode 100644 index 00000000..7b83a61e --- /dev/null +++ b/src/powershell/powershell.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'powershell', + extensions: ['.ps1', '.psm1', '.psd1'], + aliases: ['PowerShell', 'powershell', 'ps', 'ps1'], + loader: () => _monaco.Promise.wrap(import('./powershell')) +}); diff --git a/test/powershell.test.ts b/src/powershell/powershell.test.ts similarity index 99% rename from test/powershell.test.ts rename to src/powershell/powershell.test.ts index 88478f02..295733c7 100644 --- a/test/powershell.test.ts +++ b/src/powershell/powershell.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('powershell', [ // Comments - single line diff --git a/src/powershell.ts b/src/powershell/powershell.ts similarity index 97% rename from src/powershell.ts rename to src/powershell/powershell.ts index 41eba309..21311c60 100644 --- a/src/powershell.ts +++ b/src/powershell/powershell.ts @@ -33,7 +33,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*#region\\b"), + end: new RegExp("^\\s*#endregion\\b") + } + } }; export const language = { diff --git a/src/pug/pug.contribution.ts b/src/pug/pug.contribution.ts new file mode 100644 index 00000000..f1e0e9d5 --- /dev/null +++ b/src/pug/pug.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'pug', + extensions: ['.jade', '.pug'], + aliases: ['Pug', 'Jade', 'jade'], + loader: () => _monaco.Promise.wrap(import('./pug')) +}); diff --git a/test/pug.test.ts b/src/pug/pug.test.ts similarity index 99% rename from test/pug.test.ts rename to src/pug/pug.test.ts index 998d2e36..80f85662 100644 --- a/test/pug.test.ts +++ b/src/pug/pug.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('pug', [ // Tags [Pug] diff --git a/src/pug.ts b/src/pug/pug.ts similarity index 99% rename from src/pug.ts rename to src/pug/pug.ts index ea625616..26b1b77b 100644 --- a/src/pug.ts +++ b/src/pug/pug.ts @@ -19,7 +19,10 @@ export const conf: IRichLanguageConfiguration = { { open: '{', close: '}', notIn: ['string', 'comment'] }, { open: '[', close: ']', notIn: ['string', 'comment'] }, { open: '(', close: ')', notIn: ['string', 'comment'] }, - ] + ], + folding: { + offSide: true + } }; export const language = { diff --git a/src/python/python.contribution.ts b/src/python/python.contribution.ts new file mode 100644 index 00000000..10c25580 --- /dev/null +++ b/src/python/python.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'python', + extensions: ['.py', '.rpy', '.pyw', '.cpy', '.gyp', '.gypi'], + aliases: ['Python', 'py'], + firstLine: '^#!/.*\\bpython[0-9.-]*\\b', + loader: () => _monaco.Promise.wrap(import('./python')) +}); diff --git a/test/python.test.ts b/src/python/python.test.ts similarity index 97% rename from test/python.test.ts rename to src/python/python.test.ts index 8a4ea9b9..f4e9ea9d 100644 --- a/test/python.test.ts +++ b/src/python/python.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('python', [ // Keywords diff --git a/src/python.ts b/src/python/python.ts similarity index 97% rename from src/python.ts rename to src/python/python.ts index 25fe4fcb..06c715ea 100644 --- a/src/python.ts +++ b/src/python/python.ts @@ -31,7 +31,14 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, - ] + ], + folding: { + offSide: true, + markers: { + start: new RegExp("^\\s*#region\\b"), + end: new RegExp("^\\s*#endregion\\b") + } + } }; export const language = { diff --git a/src/r/r.contribution.ts b/src/r/r.contribution.ts new file mode 100644 index 00000000..7857845a --- /dev/null +++ b/src/r/r.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'r', + extensions: ['.r', '.rhistory', '.rprofile', '.rt'], + aliases: ['R', 'r'], + loader: () => _monaco.Promise.wrap(import('./r')) +}); diff --git a/test/r.test.ts b/src/r/r.test.ts similarity index 99% rename from test/r.test.ts rename to src/r/r.test.ts index e2ad5ba1..929fb76a 100644 --- a/test/r.test.ts +++ b/src/r/r.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('r', [ // Keywords diff --git a/src/r.ts b/src/r/r.ts similarity index 100% rename from src/r.ts rename to src/r/r.ts diff --git a/src/razor/razor.contribution.ts b/src/razor/razor.contribution.ts new file mode 100644 index 00000000..96d762f2 --- /dev/null +++ b/src/razor/razor.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'razor', + extensions: ['.cshtml'], + aliases: ['Razor', 'razor'], + mimetypes: ['text/x-cshtml'], + loader: () => _monaco.Promise.wrap(import('./razor')) +}); diff --git a/test/razor.test.ts b/src/razor/razor.test.ts similarity index 95% rename from test/razor.test.ts rename to src/razor/razor.test.ts index fc534798..78582417 100644 --- a/test/razor.test.ts +++ b/src/razor/razor.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('razor', [ diff --git a/src/razor.ts b/src/razor/razor.ts similarity index 100% rename from src/razor.ts rename to src/razor/razor.ts diff --git a/src/redis/redis.contribution.ts b/src/redis/redis.contribution.ts new file mode 100644 index 00000000..f9cbed66 --- /dev/null +++ b/src/redis/redis.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'redis', + extensions: ['.redis'], + aliases: ['redis'], + loader: () => _monaco.Promise.wrap(import('./redis')) +}); diff --git a/test/redis.test.ts b/src/redis/redis.test.ts similarity index 98% rename from test/redis.test.ts rename to src/redis/redis.test.ts index 83a96b83..a016deb9 100644 --- a/test/redis.test.ts +++ b/src/redis/redis.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('redis', [ diff --git a/src/redis.ts b/src/redis/redis.ts similarity index 100% rename from src/redis.ts rename to src/redis/redis.ts diff --git a/src/redshift/redshift.contribution.ts b/src/redshift/redshift.contribution.ts new file mode 100644 index 00000000..f40d0803 --- /dev/null +++ b/src/redshift/redshift.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'redshift', + extensions: [], + aliases: ['Redshift', 'redshift'], + loader: () => _monaco.Promise.wrap(import('./redshift')) +}); diff --git a/test/redshift.test.ts b/src/redshift/redshift.test.ts similarity index 99% rename from test/redshift.test.ts rename to src/redshift/redshift.test.ts index d8958603..163c3032 100644 --- a/test/redshift.test.ts +++ b/src/redshift/redshift.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('sql', [ // Comments diff --git a/src/redshift.ts b/src/redshift/redshift.ts similarity index 100% rename from src/redshift.ts rename to src/redshift/redshift.ts diff --git a/src/ruby/ruby.contribution.ts b/src/ruby/ruby.contribution.ts new file mode 100644 index 00000000..24e290ff --- /dev/null +++ b/src/ruby/ruby.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'ruby', + extensions: ['.rb', '.rbx', '.rjs', '.gemspec', '.pp'], + filenames: ['rakefile'], + aliases: ['Ruby', 'rb'], + loader: () => _monaco.Promise.wrap(import('./ruby')) +}); diff --git a/test/ruby.test.ts b/src/ruby/ruby.test.ts similarity index 94% rename from test/ruby.test.ts rename to src/ruby/ruby.test.ts index 9365f091..df528c9a 100644 --- a/test/ruby.test.ts +++ b/src/ruby/ruby.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('ruby', [ // Keywords @@ -134,5 +134,13 @@ testTokenization('ruby', [ { startIndex: 0, type: 'identifier.ruby' }, { startIndex: 1, type: 'string.heredoc.delimiter.ruby' } ] + }], + + [{ + line: 'x<<~HERE', + tokens: [ + { startIndex: 0, type: 'identifier.ruby' }, + { startIndex: 1, type: 'string.heredoc.delimiter.ruby' } + ] }] ]); diff --git a/src/ruby.ts b/src/ruby/ruby.ts similarity index 99% rename from src/ruby.ts rename to src/ruby/ruby.ts index b91cd16a..bc5b14c1 100644 --- a/src/ruby.ts +++ b/src/ruby/ruby.ts @@ -179,7 +179,7 @@ export const language = { [/@@[\w]*/, 'namespace.class.identifier'], // class // here document - [/<<-(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }], + [/<<[-~](@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }], [/[ \t\r\n]+<<(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }], [/^<<(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }], diff --git a/src/sb/sb.contribution.ts b/src/sb/sb.contribution.ts new file mode 100644 index 00000000..d35dc0b9 --- /dev/null +++ b/src/sb/sb.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'sb', + extensions: ['.sb'], + aliases: ['Small Basic', 'sb'], + loader: () => _monaco.Promise.wrap(import('./sb')) +}); diff --git a/test/sb.test.ts b/src/sb/sb.test.ts similarity index 99% rename from test/sb.test.ts rename to src/sb/sb.test.ts index 1f1a7cae..923d1185 100644 --- a/test/sb.test.ts +++ b/src/sb/sb.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('sb', [ diff --git a/src/sb.ts b/src/sb/sb.ts similarity index 100% rename from src/sb.ts rename to src/sb/sb.ts diff --git a/src/scss/scss.contribution.ts b/src/scss/scss.contribution.ts new file mode 100644 index 00000000..bc9634fc --- /dev/null +++ b/src/scss/scss.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'scss', + extensions: ['.scss'], + aliases: ['Sass', 'sass', 'scss'], + mimetypes: ['text/x-scss', 'text/scss'], + loader: () => _monaco.Promise.wrap(import('./scss')) +}); diff --git a/test/scss.test.ts b/src/scss/scss.test.ts similarity index 97% rename from test/scss.test.ts rename to src/scss/scss.test.ts index ec3dd166..9110e37f 100644 --- a/test/scss.test.ts +++ b/src/scss/scss.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { testTokenization as actualTestTokenization, ITestItem } from './testRunner'; +import { testTokenization as actualTestTokenization, ITestItem } from '../test/testRunner'; function testTokenization(_language: string | string[], tests: ITestItem[][]): void { tests = tests.map(t => { diff --git a/src/scss.ts b/src/scss/scss.ts similarity index 98% rename from src/scss.ts rename to src/scss/scss.ts index 6f54e861..1fb6d860 100644 --- a/src/scss.ts +++ b/src/scss/scss.ts @@ -32,7 +32,13 @@ export const conf: LanguageConfiguration = { { open: '(', close: ')' }, { open: '"', close: '"' }, { open: '\'', close: '\'' }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"), + end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/") + } + } }; export const language = { diff --git a/src/solidity/solidity.contribution.ts b/src/solidity/solidity.contribution.ts new file mode 100644 index 00000000..98d465de --- /dev/null +++ b/src/solidity/solidity.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'sol', + extensions: ['.sol'], + aliases: ['sol', 'solidity', 'Solidity'], + loader: () => _monaco.Promise.wrap(import('./solidity')) +}); diff --git a/test/solidity.test.ts b/src/solidity/solidity.test.ts similarity index 99% rename from test/solidity.test.ts rename to src/solidity/solidity.test.ts index ecb8add6..7f39dd07 100644 --- a/test/solidity.test.ts +++ b/src/solidity/solidity.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('sol', [ // Keywords diff --git a/src/solidity.ts b/src/solidity/solidity.ts similarity index 100% rename from src/solidity.ts rename to src/solidity/solidity.ts diff --git a/src/sql/sql.contribution.ts b/src/sql/sql.contribution.ts new file mode 100644 index 00000000..629782f4 --- /dev/null +++ b/src/sql/sql.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'sql', + extensions: ['.sql'], + aliases: ['SQL'], + loader: () => _monaco.Promise.wrap(import('./sql')) +}); diff --git a/test/sql.test.ts b/src/sql/sql.test.ts similarity index 99% rename from test/sql.test.ts rename to src/sql/sql.test.ts index 01811965..0d1f4f36 100644 --- a/test/sql.test.ts +++ b/src/sql/sql.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('sql', [ // Comments diff --git a/src/sql.ts b/src/sql/sql.ts similarity index 100% rename from src/sql.ts rename to src/sql/sql.ts diff --git a/src/swift/swift.contribution.ts b/src/swift/swift.contribution.ts new file mode 100644 index 00000000..d6ffb098 --- /dev/null +++ b/src/swift/swift.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'swift', + aliases: ['Swift', 'swift'], + extensions: ['.swift'], + mimetypes: ['text/swift'], + loader: () => _monaco.Promise.wrap(import('./swift')) +}); diff --git a/test/swift.test.ts b/src/swift/swift.test.ts similarity index 99% rename from test/swift.test.ts rename to src/swift/swift.test.ts index 18c82b98..b20f073a 100644 --- a/test/swift.test.ts +++ b/src/swift/swift.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('swift', [ diff --git a/src/swift.ts b/src/swift/swift.ts similarity index 100% rename from src/swift.ts rename to src/swift/swift.ts diff --git a/test/assert.d.ts b/src/test/assert.d.ts similarity index 100% rename from test/assert.d.ts rename to src/test/assert.d.ts diff --git a/test/testRunner.ts b/src/test/testRunner.ts similarity index 92% rename from test/testRunner.ts rename to src/test/testRunner.ts index 35a860ca..f425a0b6 100644 --- a/test/testRunner.ts +++ b/src/test/testRunner.ts @@ -3,7 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import {loadLanguage} from '../src/monaco.contribution'; +import '../monaco.contribution'; +import {loadLanguage} from '../_.contribution'; import * as assert from 'assert'; // Allow for running under nodejs/requirejs in tests diff --git a/src/tsconfig.esm.json b/src/tsconfig.esm.json new file mode 100644 index 00000000..0c69d882 --- /dev/null +++ b/src/tsconfig.esm.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "esnext", + "outDir": "../release/esm", + "target": "es5", + "lib": [ + "dom", + "es5", + "es2015.collection", + "es2015.promise" + ] + }, + "include": [ + "**/*.ts" + ], + "files": [ + "../node_modules/monaco-editor-core/monaco.d.ts" + ] +} diff --git a/src/tsconfig.json b/src/tsconfig.json new file mode 100644 index 00000000..db440f34 --- /dev/null +++ b/src/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "amd", + "outDir": "../release/dev", + "target": "es5", + "lib": [ + "dom", + "es5", + "es2015.collection", + "es2015.promise" + ] + }, + "include": [ + "**/*.ts" + ], + "files": [ + "../node_modules/monaco-editor-core/monaco.d.ts" + ] +} diff --git a/src/vb/vb.contribution.ts b/src/vb/vb.contribution.ts new file mode 100644 index 00000000..744e2958 --- /dev/null +++ b/src/vb/vb.contribution.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'vb', + extensions: ['.vb'], + aliases: ['Visual Basic', 'vb'], + loader: () => _monaco.Promise.wrap(import('./vb')) +}); diff --git a/test/vb.test.ts b/src/vb/vb.test.ts similarity index 99% rename from test/vb.test.ts rename to src/vb/vb.test.ts index f5503c22..b6d0e0a1 100644 --- a/test/vb.test.ts +++ b/src/vb/vb.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('vb', [ diff --git a/src/vb.ts b/src/vb/vb.ts similarity index 98% rename from src/vb.ts rename to src/vb/vb.ts index 53fb67ad..ba0c83c4 100644 --- a/src/vb.ts +++ b/src/vb/vb.ts @@ -47,7 +47,13 @@ export const conf: IRichLanguageConfiguration = { { open: '(', close: ')', notIn: ['string', 'comment'] }, { open: '"', close: '"', notIn: ['string', 'comment'] }, { open: '<', close: '>', notIn: ['string', 'comment'] }, - ] + ], + folding: { + markers: { + start: new RegExp("^\\s*#Region\\b"), + end: new RegExp("^\\s*#End Region\\b") + } + } }; export const language = { diff --git a/src/xml/xml.contribution.ts b/src/xml/xml.contribution.ts new file mode 100644 index 00000000..35e8ad07 --- /dev/null +++ b/src/xml/xml.contribution.ts @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'xml', + extensions: ['.xml', '.dtd', '.ascx', '.csproj', '.config', '.wxi', '.wxl', '.wxs', '.xaml', '.svg', '.svgz'], + firstLine: '(\\<\\?xml.*)|(\\ _monaco.Promise.wrap(import('./xml')) +}); diff --git a/test/xml.test.ts b/src/xml/xml.test.ts similarity index 99% rename from test/xml.test.ts rename to src/xml/xml.test.ts index 25f25ea7..5607a10d 100644 --- a/test/xml.test.ts +++ b/src/xml/xml.test.ts @@ -5,7 +5,7 @@ 'use strict'; -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('xml', [ // Complete Start Tag with Whitespace diff --git a/src/xml.ts b/src/xml/xml.ts similarity index 100% rename from src/xml.ts rename to src/xml/xml.ts diff --git a/src/yaml/yaml.contribution.ts b/src/yaml/yaml.contribution.ts new file mode 100644 index 00000000..6d3c37a2 --- /dev/null +++ b/src/yaml/yaml.contribution.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { registerLanguage } from '../_.contribution'; + +// Allow for running under nodejs/requirejs in tests +const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (self).monaco : monaco); + +registerLanguage({ + id: 'yaml', + extensions: ['.yaml', '.yml'], + aliases: ['YAML', 'yaml', 'YML', 'yml'], + mimetypes: ['application/x-yaml'], + loader: () => _monaco.Promise.wrap(import('./yaml')) +}); diff --git a/test/yaml.test.ts b/src/yaml/yaml.test.ts similarity index 98% rename from test/yaml.test.ts rename to src/yaml/yaml.test.ts index 4e2d5d2c..553d4fff 100644 --- a/test/yaml.test.ts +++ b/src/yaml/yaml.test.ts @@ -1,4 +1,4 @@ -import { testTokenization } from './testRunner'; +import { testTokenization } from '../test/testRunner'; testTokenization('yaml', [ // YAML directive diff --git a/src/yaml.ts b/src/yaml/yaml.ts similarity index 99% rename from src/yaml.ts rename to src/yaml/yaml.ts index 2cc6f499..ee6f8fe5 100644 --- a/src/yaml.ts +++ b/src/yaml/yaml.ts @@ -24,6 +24,9 @@ export const conf: IRichLanguageConfiguration = { { open: '"', close: '"' }, { open: '\'', close: '\'' }, ], + folding: { + offSide: true + } }; export const language = { diff --git a/test/all.js b/test/all.js index be1e6fd1..ac92ab6d 100644 --- a/test/all.js +++ b/test/all.js @@ -17,54 +17,12 @@ global.document.queryCommandSupported = function() {}; global.self = global.window = global.document.parentWindow; global.navigator = global.window.navigator; global.window.require = requirejs; -global.doNotInitLoader = true; function MyWorker() {} MyWorker.prototype.postMessage = function() {}; global.Worker = MyWorker; -requirejs([ - 'vs/editor/editor.main' -], function() { - requirejs([ - 'out/test/bat.test', - 'out/test/css.test', - 'out/test/coffee.test', - 'out/test/cpp.test', - 'out/test/csharp.test', - 'out/test/dockerfile.test', - 'out/test/fsharp.test', - 'out/test/go.test', - 'out/test/handlebars.test', - 'out/test/html.test', - 'out/test/pug.test', - 'out/test/java.test', - 'out/test/less.test', - 'out/test/lua.test', - 'out/test/markdown.test', - 'out/test/msdax.test', - 'out/test/objective-c.test', - 'out/test/php.test', - 'out/test/postiats.test', - 'out/test/powershell.test', - 'out/test/python.test', - 'out/test/r.test', - 'out/test/razor.test', - 'out/test/ruby.test', - 'out/test/scss.test', - 'out/test/swift.test', - 'out/test/sql.test', - 'out/test/vb.test', - 'out/test/xml.test', - 'out/test/yaml.test', - 'out/test/solidity.test', - 'out/test/sb.test', - 'out/test/mysql.test', - 'out/test/pgsql.test', - 'out/test/redshift.test', - 'out/test/redis.test', - 'out/test/csp.test', - ], function() { - run(); // We can launch the tests! - }); +requirejs(['./test/setup'], function() { +}, function(err) { + console.log(err); }); diff --git a/test/css.mock.js b/test/css.mock.js deleted file mode 100644 index e2fb94f9..00000000 --- a/test/css.mock.js +++ /dev/null @@ -1,5 +0,0 @@ -define('vs/css', [], { - load: function(name, req, load) { - load({}); - } -}); diff --git a/test/nls.mock.js b/test/nls.mock.js deleted file mode 100644 index 54349559..00000000 --- a/test/nls.mock.js +++ /dev/null @@ -1,15 +0,0 @@ -define('vs/nls', [], { - create: function() { - return { - localize: function() { - return 'NO_LOCALIZATION_FOR_YOU'; - } - }; - }, - localize: function() { - return 'NO_LOCALIZATION_FOR_YOU'; - }, - load: function(name, req, load) { - load({}); - } -}); diff --git a/test/setup.js b/test/setup.js new file mode 100644 index 00000000..b446648f --- /dev/null +++ b/test/setup.js @@ -0,0 +1,74 @@ + +define('vs/css', [], { + load: function (name, req, load) { + load({}); + } +}); + +define('vs/nls', [], { + create: function () { + return { + localize: function () { + return 'NO_LOCALIZATION_FOR_YOU'; + } + }; + }, + localize: function () { + return 'NO_LOCALIZATION_FOR_YOU'; + }, + load: function (name, req, load) { + load({}); + } +}); + +define(['require'], function (require) { + requirejs([ + 'vs/editor/editor.main' + ], function () { + requirejs([ + 'release/dev/bat/bat.test', + 'release/dev/css/css.test', + 'release/dev/coffee/coffee.test', + 'release/dev/cpp/cpp.test', + 'release/dev/csharp/csharp.test', + 'release/dev/dockerfile/dockerfile.test', + 'release/dev/fsharp/fsharp.test', + 'release/dev/go/go.test', + 'release/dev/handlebars/handlebars.test', + 'release/dev/html/html.test', + 'release/dev/pug/pug.test', + 'release/dev/java/java.test', + 'release/dev/less/less.test', + 'release/dev/lua/lua.test', + 'release/dev/markdown/markdown.test', + 'release/dev/msdax/msdax.test', + 'release/dev/objective-c/objective-c.test', + 'release/dev/php/php.test', + 'release/dev/postiats/postiats.test', + 'release/dev/powershell/powershell.test', + 'release/dev/python/python.test', + 'release/dev/r/r.test', + 'release/dev/razor/razor.test', + 'release/dev/ruby/ruby.test', + 'release/dev/scss/scss.test', + 'release/dev/swift/swift.test', + 'release/dev/sql/sql.test', + 'release/dev/vb/vb.test', + 'release/dev/xml/xml.test', + 'release/dev/yaml/yaml.test', + 'release/dev/solidity/solidity.test', + 'release/dev/sb/sb.test', + 'release/dev/mysql/mysql.test', + 'release/dev/pgsql/pgsql.test', + 'release/dev/redshift/redshift.test', + 'release/dev/redis/redis.test', + 'release/dev/csp/csp.test', + ], function () { + run(); // We can launch the tests! + }, function (err) { + console.log(err); + }); + }, function (err) { + console.log(err); + }); +}); diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 3534ffba..00000000 --- a/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "compilerOptions": { - "module": "amd", - "outDir": "out", - "target": "es5" - }, - "include": [ - "src/*.ts", - "test/*.ts" - ], - "files": [ - "node_modules/monaco-editor-core/monaco.d.ts" - ] -}