From 93c48edcccff90b59bdb99e5f200d88e378318f9 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 13 Mar 2018 16:58:42 +0100 Subject: [PATCH] Reorganize project --- .npmignore | 2 +- README.md | 21 +- scripts/bundle.js | 76 ++-- src/_.contribution.ts | 46 +++ src/bat/bat.contribution.ts | 17 + src/{test => bat}/bat.test.ts | 2 +- src/{ => bat}/bat.ts | 0 src/coffee/coffee.contribution.ts | 18 + src/{test => coffee}/coffee.test.ts | 2 +- src/{ => coffee}/coffee.ts | 0 src/cpp/cpp.contribution.ts | 23 ++ src/{test => cpp}/cpp.test.ts | 2 +- src/{ => cpp}/cpp.ts | 0 src/csharp/csharp.contribution.ts | 17 + src/{test => csharp}/csharp.test.ts | 2 +- src/{ => csharp}/csharp.ts | 0 src/csp/csp.contribution.ts | 17 + src/{test => csp}/csp.test.ts | 2 +- src/{ => csp}/csp.ts | 0 src/css/css.contribution.ts | 18 + src/{test => css}/css.test.ts | 2 +- src/{ => css}/css.ts | 0 src/dockerfile/dockerfile.contribution.ts | 18 + src/{test => dockerfile}/dockerfile.test.ts | 2 +- src/{ => dockerfile}/dockerfile.ts | 0 src/fsharp/fsharp.contribution.ts | 17 + src/{test => fsharp}/fsharp.test.ts | 2 +- src/{ => fsharp}/fsharp.ts | 0 src/go/go.contribution.ts | 17 + src/{test => go}/go.test.ts | 2 +- src/{ => go}/go.ts | 0 src/handlebars/handlebars.contribution.ts | 18 + src/{test => handlebars}/handlebars.test.ts | 2 +- src/{ => handlebars}/handlebars.ts | 0 src/html/html.contribution.ts | 18 + src/{test => html}/html.test.ts | 2 +- src/{ => html}/html.ts | 0 src/ini/ini.contribution.ts | 18 + src/{ => ini}/ini.ts | 0 src/java/java.contribution.ts | 18 + src/{test => java}/java.test.ts | 2 +- src/{ => java}/java.ts | 0 src/less/less.contribution.ts | 18 + src/{test => less}/less.test.ts | 2 +- src/{ => less}/less.ts | 0 src/lua/lua.contribution.ts | 17 + src/{test => lua}/lua.test.ts | 2 +- src/{ => lua}/lua.ts | 0 src/markdown/markdown.contribution.ts | 17 + src/{test => markdown}/markdown.test.ts | 2 +- src/{ => markdown}/markdown.ts | 0 src/{test => }/mocha.d.ts | 0 src/monaco.contribution.ts | 336 ++---------------- src/msdax/msdax.contribution.ts | 17 + src/{test => msdax}/msdax.test.ts | 2 +- src/{ => msdax}/msdax.ts | 0 src/mysql/mysql.contribution.ts | 17 + src/{test => mysql}/mysql.test.ts | 2 +- src/{ => mysql}/mysql.ts | 0 src/objective-c/objective-c.contribution.ts | 17 + src/{test => objective-c}/objective-c.test.ts | 2 +- src/{ => objective-c}/objective-c.ts | 0 src/pgsql/pgsql.contribution.ts | 17 + src/{test => pgsql}/pgsql.test.ts | 2 +- src/{ => pgsql}/pgsql.ts | 0 src/php/php.contribution.ts | 18 + src/{test => php}/php.test.ts | 2 +- src/{ => php}/php.ts | 0 src/postiats/postiats.contribution.ts | 17 + src/{test => postiats}/postiats.test.ts | 2 +- src/{ => postiats}/postiats.ts | 0 src/powershell/powershell.contribution.ts | 17 + src/{test => powershell}/powershell.test.ts | 2 +- src/{ => powershell}/powershell.ts | 0 src/pug/pug.contribution.ts | 17 + src/{test => pug}/pug.test.ts | 2 +- src/{ => pug}/pug.ts | 0 src/python/python.contribution.ts | 18 + src/{test => python}/python.test.ts | 2 +- src/{ => python}/python.ts | 0 src/r/r.contribution.ts | 17 + src/{test => r}/r.test.ts | 2 +- src/{ => r}/r.ts | 0 src/razor/razor.contribution.ts | 18 + src/{test => razor}/razor.test.ts | 2 +- src/{ => razor}/razor.ts | 0 src/redis/redis.contribution.ts | 17 + src/{test => redis}/redis.test.ts | 2 +- src/{ => redis}/redis.ts | 0 src/redshift/redshift.contribution.ts | 17 + src/{test => redshift}/redshift.test.ts | 2 +- src/{ => redshift}/redshift.ts | 0 src/ruby/ruby.contribution.ts | 18 + src/{test => ruby}/ruby.test.ts | 2 +- src/{ => ruby}/ruby.ts | 0 src/sb/sb.contribution.ts | 17 + src/{test => sb}/sb.test.ts | 2 +- src/{ => sb}/sb.ts | 0 src/scss/scss.contribution.ts | 18 + src/{test => scss}/scss.test.ts | 2 +- src/{ => scss}/scss.ts | 0 src/solidity/solidity.contribution.ts | 17 + src/{test => solidity}/solidity.test.ts | 2 +- src/{ => solidity}/solidity.ts | 0 src/sql/sql.contribution.ts | 17 + src/{test => sql}/sql.test.ts | 2 +- src/{ => sql}/sql.ts | 0 src/swift/swift.contribution.ts | 18 + src/{test => swift}/swift.test.ts | 2 +- src/{ => swift}/swift.ts | 0 src/test/testRunner.ts | 3 +- src/vb/vb.contribution.ts | 17 + src/{test => vb}/vb.test.ts | 2 +- src/{ => vb}/vb.ts | 0 src/xml/xml.contribution.ts | 19 + src/{test => xml}/xml.test.ts | 2 +- src/{ => xml}/xml.ts | 0 src/yaml/yaml.contribution.ts | 18 + src/{test => yaml}/yaml.test.ts | 2 +- src/{ => yaml}/yaml.ts | 0 test/setup.js | 74 ++-- 121 files changed, 875 insertions(+), 426 deletions(-) create mode 100644 src/_.contribution.ts create mode 100644 src/bat/bat.contribution.ts rename src/{test => bat}/bat.test.ts (94%) rename src/{ => bat}/bat.ts (100%) create mode 100644 src/coffee/coffee.contribution.ts rename src/{test => coffee}/coffee.test.ts (99%) rename src/{ => coffee}/coffee.ts (100%) create mode 100644 src/cpp/cpp.contribution.ts rename src/{test => cpp}/cpp.test.ts (99%) rename src/{ => cpp}/cpp.ts (100%) create mode 100644 src/csharp/csharp.contribution.ts rename src/{test => csharp}/csharp.test.ts (99%) rename src/{ => csharp}/csharp.ts (100%) create mode 100644 src/csp/csp.contribution.ts rename src/{test => csp}/csp.test.ts (87%) rename src/{ => csp}/csp.ts (100%) create mode 100644 src/css/css.contribution.ts rename src/{test => css}/css.test.ts (96%) rename src/{ => css}/css.ts (100%) create mode 100644 src/dockerfile/dockerfile.contribution.ts rename src/{test => dockerfile}/dockerfile.test.ts (99%) rename src/{ => dockerfile}/dockerfile.ts (100%) create mode 100644 src/fsharp/fsharp.contribution.ts rename src/{test => fsharp}/fsharp.test.ts (99%) rename src/{ => fsharp}/fsharp.ts (100%) create mode 100644 src/go/go.contribution.ts rename src/{test => go}/go.test.ts (99%) rename src/{ => go}/go.ts (100%) create mode 100644 src/handlebars/handlebars.contribution.ts rename src/{test => handlebars}/handlebars.test.ts (96%) rename src/{ => handlebars}/handlebars.ts (100%) create mode 100644 src/html/html.contribution.ts rename src/{test => html}/html.test.ts (96%) rename src/{ => html}/html.ts (100%) create mode 100644 src/ini/ini.contribution.ts rename src/{ => ini}/ini.ts (100%) create mode 100644 src/java/java.contribution.ts rename src/{test => java}/java.test.ts (99%) rename src/{ => java}/java.ts (100%) create mode 100644 src/less/less.contribution.ts rename src/{test => less}/less.test.ts (96%) rename src/{ => less}/less.ts (100%) create mode 100644 src/lua/lua.contribution.ts rename src/{test => lua}/lua.test.ts (97%) rename src/{ => lua}/lua.ts (100%) create mode 100644 src/markdown/markdown.contribution.ts rename src/{test => markdown}/markdown.test.ts (94%) rename src/{ => markdown}/markdown.ts (100%) rename src/{test => }/mocha.d.ts (100%) create mode 100644 src/msdax/msdax.contribution.ts rename src/{test => msdax}/msdax.test.ts (99%) rename src/{ => msdax}/msdax.ts (100%) create mode 100644 src/mysql/mysql.contribution.ts rename src/{test => mysql}/mysql.test.ts (99%) rename src/{ => mysql}/mysql.ts (100%) create mode 100644 src/objective-c/objective-c.contribution.ts rename src/{test => objective-c}/objective-c.test.ts (99%) rename src/{ => objective-c}/objective-c.ts (100%) create mode 100644 src/pgsql/pgsql.contribution.ts rename src/{test => pgsql}/pgsql.test.ts (99%) rename src/{ => pgsql}/pgsql.ts (100%) create mode 100644 src/php/php.contribution.ts rename src/{test => php}/php.test.ts (96%) rename src/{ => php}/php.ts (100%) create mode 100644 src/postiats/postiats.contribution.ts rename src/{test => postiats}/postiats.test.ts (99%) rename src/{ => postiats}/postiats.ts (100%) create mode 100644 src/powershell/powershell.contribution.ts rename src/{test => powershell}/powershell.test.ts (99%) rename src/{ => powershell}/powershell.ts (100%) create mode 100644 src/pug/pug.contribution.ts rename src/{test => pug}/pug.test.ts (99%) rename src/{ => pug}/pug.ts (100%) create mode 100644 src/python/python.contribution.ts rename src/{test => python}/python.test.ts (97%) rename src/{ => python}/python.ts (100%) create mode 100644 src/r/r.contribution.ts rename src/{test => r}/r.test.ts (99%) rename src/{ => r}/r.ts (100%) create mode 100644 src/razor/razor.contribution.ts rename src/{test => razor}/razor.test.ts (95%) rename src/{ => razor}/razor.ts (100%) create mode 100644 src/redis/redis.contribution.ts rename src/{test => redis}/redis.test.ts (98%) rename src/{ => redis}/redis.ts (100%) create mode 100644 src/redshift/redshift.contribution.ts rename src/{test => redshift}/redshift.test.ts (99%) rename src/{ => redshift}/redshift.ts (100%) create mode 100644 src/ruby/ruby.contribution.ts rename src/{test => ruby}/ruby.test.ts (98%) rename src/{ => ruby}/ruby.ts (100%) create mode 100644 src/sb/sb.contribution.ts rename src/{test => sb}/sb.test.ts (99%) rename src/{ => sb}/sb.ts (100%) create mode 100644 src/scss/scss.contribution.ts rename src/{test => scss}/scss.test.ts (97%) rename src/{ => scss}/scss.ts (100%) create mode 100644 src/solidity/solidity.contribution.ts rename src/{test => solidity}/solidity.test.ts (99%) rename src/{ => solidity}/solidity.ts (100%) create mode 100644 src/sql/sql.contribution.ts rename src/{test => sql}/sql.test.ts (99%) rename src/{ => sql}/sql.ts (100%) create mode 100644 src/swift/swift.contribution.ts rename src/{test => swift}/swift.test.ts (99%) rename src/{ => swift}/swift.ts (100%) create mode 100644 src/vb/vb.contribution.ts rename src/{test => vb}/vb.test.ts (99%) rename src/{ => vb}/vb.ts (100%) create mode 100644 src/xml/xml.contribution.ts rename src/{test => xml}/xml.test.ts (99%) rename src/{ => xml}/xml.ts (100%) create mode 100644 src/yaml/yaml.contribution.ts rename src/{test => yaml}/yaml.test.ts (98%) rename src/{ => yaml}/yaml.ts (100%) diff --git a/.npmignore b/.npmignore index 52d413d3..e8e47dc4 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,5 @@ /.vscode/ -/release/**/test/ +/release/**/*.test.js/ /scripts/ /src/ /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/scripts/bundle.js b/scripts/bundle.js index 505f4f2e..d9ae2b70 100644 --- a/scripts/bundle.js +++ b/scripts/bundle.js @@ -21,44 +21,44 @@ const BUNDLED_FILE_HEADER = [ ].join('\n'); bundleOne('monaco.contribution'); -bundleOne('bat'); -bundleOne('css'); -bundleOne('coffee'); -bundleOne('cpp'); -bundleOne('csharp'); -bundleOne('dockerfile'); -bundleOne('fsharp'); -bundleOne('go'); -bundleOne('handlebars'); -bundleOne('html'); -bundleOne('ini'); -bundleOne('pug'); -bundleOne('java'); -bundleOne('less'); -bundleOne('lua'); -bundleOne('markdown'); -bundleOne('msdax'); -bundleOne('objective-c'); -bundleOne('php'); -bundleOne('powershell'); -bundleOne('postiats'); -bundleOne('python'); -bundleOne('r'); -bundleOne('razor'); -bundleOne('ruby'); -bundleOne('scss'); -bundleOne('sql'); -bundleOne('swift'); -bundleOne('vb'); -bundleOne('xml'); -bundleOne('yaml'); -bundleOne('solidity'); -bundleOne('sb'); -bundleOne('mysql'); -bundleOne('redshift'); -bundleOne('pgsql'); -bundleOne('redis'); -bundleOne('csp'); +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({ 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/src/test/bat.test.ts b/src/bat/bat.test.ts similarity index 94% rename from src/test/bat.test.ts rename to src/bat/bat.test.ts index 9307c63e..06d3e26a 100644 --- a/src/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 100% rename from src/bat.ts rename to src/bat/bat.ts 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/src/test/coffee.test.ts b/src/coffee/coffee.test.ts similarity index 99% rename from src/test/coffee.test.ts rename to src/coffee/coffee.test.ts index 8c37ce24..51b2ad01 100644 --- a/src/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 100% rename from src/coffee.ts rename to src/coffee/coffee.ts 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/src/test/cpp.test.ts b/src/cpp/cpp.test.ts similarity index 99% rename from src/test/cpp.test.ts rename to src/cpp/cpp.test.ts index 043f12b5..27e8d9da 100644 --- a/src/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 diff --git a/src/cpp.ts b/src/cpp/cpp.ts similarity index 100% rename from src/cpp.ts rename to src/cpp/cpp.ts 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/src/test/csharp.test.ts b/src/csharp/csharp.test.ts similarity index 99% rename from src/test/csharp.test.ts rename to src/csharp/csharp.test.ts index 2ba71661..4ca578a3 100644 --- a/src/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 100% rename from src/csharp.ts rename to src/csharp/csharp.ts 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/src/test/csp.test.ts b/src/csp/csp.test.ts similarity index 87% rename from src/test/csp.test.ts rename to src/csp/csp.test.ts index cfcd8219..0866d10c 100644 --- a/src/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/src/test/css.test.ts b/src/css/css.test.ts similarity index 96% rename from src/test/css.test.ts rename to src/css/css.test.ts index 7a6901f1..4499001b 100644 --- a/src/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 100% rename from src/css.ts rename to src/css/css.ts 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/src/test/dockerfile.test.ts b/src/dockerfile/dockerfile.test.ts similarity index 99% rename from src/test/dockerfile.test.ts rename to src/dockerfile/dockerfile.test.ts index 7245358d..68d32b4f 100644 --- a/src/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/src/test/fsharp.test.ts b/src/fsharp/fsharp.test.ts similarity index 99% rename from src/test/fsharp.test.ts rename to src/fsharp/fsharp.test.ts index 60fe175c..2fe82857 100644 --- a/src/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 diff --git a/src/fsharp.ts b/src/fsharp/fsharp.ts similarity index 100% rename from src/fsharp.ts rename to src/fsharp/fsharp.ts 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/src/test/go.test.ts b/src/go/go.test.ts similarity index 99% rename from src/test/go.test.ts rename to src/go/go.test.ts index ece692ca..3fa373cb 100644 --- a/src/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/src/test/handlebars.test.ts b/src/handlebars/handlebars.test.ts similarity index 96% rename from src/test/handlebars.test.ts rename to src/handlebars/handlebars.test.ts index 852cbc3c..21dacb6e 100644 --- a/src/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/src/test/html.test.ts b/src/html/html.test.ts similarity index 96% rename from src/test/html.test.ts rename to src/html/html.test.ts index d3c2d335..07c7fe56 100644 --- a/src/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 100% rename from src/html.ts rename to src/html/html.ts 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/src/test/java.test.ts b/src/java/java.test.ts similarity index 99% rename from src/test/java.test.ts rename to src/java/java.test.ts index 498571aa..f9271e49 100644 --- a/src/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 100% rename from src/java.ts rename to src/java/java.ts 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/src/test/less.test.ts b/src/less/less.test.ts similarity index 96% rename from src/test/less.test.ts rename to src/less/less.test.ts index 6b9ceb6d..3b9eff59 100644 --- a/src/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 100% rename from src/less.ts rename to src/less/less.ts 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/src/test/lua.test.ts b/src/lua/lua.test.ts similarity index 97% rename from src/test/lua.test.ts rename to src/lua/lua.test.ts index eb57ab33..c040aac6 100644 --- a/src/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/src/test/markdown.test.ts b/src/markdown/markdown.test.ts similarity index 94% rename from src/test/markdown.test.ts rename to src/markdown/markdown.test.ts index cd1bba58..5e802682 100644 --- a/src/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 100% rename from src/markdown.ts rename to src/markdown/markdown.ts diff --git a/src/test/mocha.d.ts b/src/mocha.d.ts similarity index 100% rename from src/test/mocha.d.ts rename to src/mocha.d.ts diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index 4c3f4065..00ee430c 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -4,301 +4,41 @@ *--------------------------------------------------------------------------------------------*/ '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]; -} - -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'], - loader: () => _monaco.Promise.wrap(import('./bat')) -}); -registerLanguage({ - id: 'coffeescript', - extensions: ['.coffee'], - aliases: ['CoffeeScript', 'coffeescript', 'coffee'], - mimetypes: ['text/x-coffeescript', 'text/coffeescript'], - loader: () => _monaco.Promise.wrap(import('./coffee')) -}); -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')) -}); -registerLanguage({ - id: 'csharp', - extensions: ['.cs', '.csx'], - aliases: ['C#', 'csharp'], - loader: () => _monaco.Promise.wrap(import('./csharp')) -}); -registerLanguage({ - id: 'dockerfile', - extensions: ['.dockerfile'], - filenames: ['Dockerfile'], - aliases: ['Dockerfile'], - loader: () => _monaco.Promise.wrap(import('./dockerfile')) -}); -registerLanguage({ - id: 'fsharp', - extensions: ['.fs', '.fsi', '.ml', '.mli', '.fsx', '.fsscript'], - aliases: ['F#', 'FSharp', 'fsharp'], - loader: () => _monaco.Promise.wrap(import('./fsharp')) -}); -registerLanguage({ - id: 'go', - extensions: ['.go'], - aliases: ['Go'], - loader: () => _monaco.Promise.wrap(import('./go')) -}); -registerLanguage({ - id: 'handlebars', - extensions: ['.handlebars', '.hbs'], - aliases: ['Handlebars', 'handlebars'], - mimetypes: ['text/x-handlebars-template'], - loader: () => _monaco.Promise.wrap(import('./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'], - loader: () => _monaco.Promise.wrap(import('./html')) -}); -registerLanguage({ - id: 'ini', - extensions: ['.ini', '.properties', '.gitconfig'], - filenames: ['config', '.gitattributes', '.gitconfig', '.editorconfig'], - aliases: ['Ini', 'ini'], - loader: () => _monaco.Promise.wrap(import('./ini')) -}); -registerLanguage({ - id: 'pug', - extensions: ['.jade', '.pug'], - aliases: ['Pug', 'Jade', 'jade'], - loader: () => _monaco.Promise.wrap(import('./pug')) -}); -registerLanguage({ - id: 'java', - extensions: ['.java', '.jav'], - aliases: ['Java', 'java'], - mimetypes: ['text/x-java-source', 'text/x-java'], - loader: () => _monaco.Promise.wrap(import('./java')) -}); -registerLanguage({ - id: 'lua', - extensions: ['.lua'], - aliases: ['Lua', 'lua'], - loader: () => _monaco.Promise.wrap(import('./lua')) -}); -registerLanguage({ - id: 'markdown', - extensions: ['.md', '.markdown', '.mdown', '.mkdn', '.mkd', '.mdwn', '.mdtxt', '.mdtext'], - aliases: ['Markdown', 'markdown'], - loader: () => _monaco.Promise.wrap(import('./markdown')) -}); -registerLanguage({ - id: 'msdax', - extensions: ['.dax', '.msdax'], - aliases: ['DAX', 'MSDAX'], - loader: () => _monaco.Promise.wrap(import('./msdax')) -}); -registerLanguage({ - id: 'objective-c', - extensions: ['.m'], - aliases: ['Objective-C'], - loader: () => _monaco.Promise.wrap(import('./objective-c')) -}); -registerLanguage({ - id: 'postiats', - extensions: ['.dats', '.sats', '.hats'], - aliases: ['ATS', 'ATS/Postiats'], - loader: () => _monaco.Promise.wrap(import('./postiats')) -}); -registerLanguage({ - id: 'php', - extensions: ['.php', '.php4', '.php5', '.phtml', '.ctp'], - aliases: ['PHP', 'php'], - mimetypes: ['application/x-php'], - loader: () => _monaco.Promise.wrap(import('./php')) -}); -registerLanguage({ - id: 'powershell', - extensions: ['.ps1', '.psm1', '.psd1'], - aliases: ['PowerShell', 'powershell', 'ps', 'ps1'], - loader: () => _monaco.Promise.wrap(import('./powershell')) -}); -registerLanguage({ - id: 'python', - extensions: ['.py', '.rpy', '.pyw', '.cpy', '.gyp', '.gypi'], - aliases: ['Python', 'py'], - firstLine: '^#!/.*\\bpython[0-9.-]*\\b', - loader: () => _monaco.Promise.wrap(import('./python')) -}); -registerLanguage({ - id: 'r', - extensions: ['.r', '.rhistory', '.rprofile', '.rt'], - aliases: ['R', 'r'], - loader: () => _monaco.Promise.wrap(import('./r')) -}); -registerLanguage({ - id: 'razor', - extensions: ['.cshtml'], - aliases: ['Razor', 'razor'], - mimetypes: ['text/x-cshtml'], - loader: () => _monaco.Promise.wrap(import('./razor')) -}); -registerLanguage({ - id: 'ruby', - extensions: ['.rb', '.rbx', '.rjs', '.gemspec', '.pp'], - filenames: ['rakefile'], - aliases: ['Ruby', 'rb'], - loader: () => _monaco.Promise.wrap(import('./ruby')) -}); -registerLanguage({ - id: 'swift', - aliases: ['Swift', 'swift'], - extensions: ['.swift'], - mimetypes: ['text/swift'], - loader: () => _monaco.Promise.wrap(import('./swift')) -}); -registerLanguage({ - id: 'sql', - extensions: ['.sql'], - aliases: ['SQL'], - loader: () => _monaco.Promise.wrap(import('./sql')) -}); -registerLanguage({ - id: 'vb', - extensions: ['.vb'], - aliases: ['Visual Basic', 'vb'], - loader: () => _monaco.Promise.wrap(import('./vb')) -}); -registerLanguage({ - id: 'xml', - extensions: ['.xml', '.dtd', '.ascx', '.csproj', '.config', '.wxi', '.wxl', '.wxs', '.xaml', '.svg', '.svgz'], - firstLine: '(\\<\\?xml.*)|(\\ _monaco.Promise.wrap(import('./xml')) -}); -registerLanguage({ - id: 'less', - extensions: ['.less'], - aliases: ['Less', 'less'], - mimetypes: ['text/x-less', 'text/less'], - loader: () => _monaco.Promise.wrap(import('./less')) -}); -registerLanguage({ - id: 'scss', - extensions: ['.scss'], - aliases: ['Sass', 'sass', 'scss'], - mimetypes: ['text/x-scss', 'text/scss'], - loader: () => _monaco.Promise.wrap(import('./scss')) -}); -registerLanguage({ - id: 'css', - extensions: ['.css'], - aliases: ['CSS', 'css'], - mimetypes: ['text/css'], - loader: () => _monaco.Promise.wrap(import('./css')) -}); -registerLanguage({ - id: 'yaml', - extensions: ['.yaml', '.yml'], - aliases: ['YAML', 'yaml', 'YML', 'yml'], - mimetypes: ['application/x-yaml'], - loader: () => _monaco.Promise.wrap(import('./yaml')) -}); -registerLanguage({ - id: 'sol', - extensions: ['.sol'], - aliases: ['sol', 'solidity', 'Solidity'], - loader: () => _monaco.Promise.wrap(import('./solidity')) -}); -registerLanguage({ - id: 'sb', - extensions: ['.sb'], - aliases: ['Small Basic', 'sb'], - loader: () => _monaco.Promise.wrap(import('./sb')) -}); - -registerLanguage({ - id: 'mysql', - extensions: [], - aliases: ['MySQL', 'mysql'], - loader: () => _monaco.Promise.wrap(import('./mysql')) -}); - -registerLanguage({ - id: 'pgsql', - extensions: [], - aliases: ['PostgreSQL', 'postgres', 'pg', 'postgre'], - loader: () => _monaco.Promise.wrap(import('./pgsql')) -}); - -registerLanguage({ - id: 'redshift', - extensions: [], - aliases: ['Redshift', 'redshift'], - loader: () => _monaco.Promise.wrap(import('./redshift')) -}); - -registerLanguage({ - id: 'redis', - extensions: ['.redis'], - aliases: ['redis'], - loader: () => _monaco.Promise.wrap(import('./redis')) -}); - -registerLanguage({ - id: 'csp', - extensions: [], - aliases: ['CSP', 'csp'], - loader: () => _monaco.Promise.wrap(import('./csp')) -}); +import './bat/bat.contribution'; +import './coffee/coffee.contribution'; +import './cpp/cpp.contribution'; +import './csharp/csharp.contribution'; +import './csp/csp.contribution'; +import './css/css.contribution'; +import './dockerfile/dockerfile.contribution'; +import './fsharp/fsharp.contribution'; +import './go/go.contribution'; +import './handlebars/handlebars.contribution'; +import './html/html.contribution'; +import './ini/ini.contribution'; +import './java/java.contribution'; +import './less/less.contribution'; +import './lua/lua.contribution'; +import './markdown/markdown.contribution'; +import './msdax/msdax.contribution'; +import './mysql/mysql.contribution'; +import './objective-c/objective-c.contribution'; +import './pgsql/pgsql.contribution'; +import './php/php.contribution'; +import './postiats/postiats.contribution'; +import './powershell/powershell.contribution'; +import './pug/pug.contribution'; +import './python/python.contribution'; +import './r/r.contribution'; +import './razor/razor.contribution'; +import './redis/redis.contribution'; +import './redshift/redshift.contribution'; +import './ruby/ruby.contribution'; +import './sb/sb.contribution'; +import './scss/scss.contribution'; +import './solidity/solidity.contribution'; +import './sql/sql.contribution'; +import './swift/swift.contribution'; +import './vb/vb.contribution'; +import './xml/xml.contribution'; +import './yaml/yaml.contribution'; diff --git a/src/msdax/msdax.contribution.ts b/src/msdax/msdax.contribution.ts new file mode 100644 index 00000000..69df2d00 --- /dev/null +++ b/src/msdax/msdax.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: 'msdax', + extensions: ['.dax', '.msdax'], + aliases: ['DAX', 'MSDAX'], + loader: () => _monaco.Promise.wrap(import('./msdax')) +}); diff --git a/src/test/msdax.test.ts b/src/msdax/msdax.test.ts similarity index 99% rename from src/test/msdax.test.ts rename to src/msdax/msdax.test.ts index 68408305..208ecd2d 100644 --- a/src/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/src/test/mysql.test.ts b/src/mysql/mysql.test.ts similarity index 99% rename from src/test/mysql.test.ts rename to src/mysql/mysql.test.ts index 18ec3b9d..3bf59414 100644 --- a/src/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/src/test/objective-c.test.ts b/src/objective-c/objective-c.test.ts similarity index 99% rename from src/test/objective-c.test.ts rename to src/objective-c/objective-c.test.ts index cd44bbfd..732cba14 100644 --- a/src/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/src/test/pgsql.test.ts b/src/pgsql/pgsql.test.ts similarity index 99% rename from src/test/pgsql.test.ts rename to src/pgsql/pgsql.test.ts index d8958603..163c3032 100644 --- a/src/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/src/test/php.test.ts b/src/php/php.test.ts similarity index 96% rename from src/test/php.test.ts rename to src/php/php.test.ts index 72323f2e..1e3c29db 100644 --- a/src/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 100% rename from src/php.ts rename to src/php/php.ts 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/src/test/postiats.test.ts b/src/postiats/postiats.test.ts similarity index 99% rename from src/test/postiats.test.ts rename to src/postiats/postiats.test.ts index 14ad8e0c..e4624729 100644 --- a/src/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/src/test/powershell.test.ts b/src/powershell/powershell.test.ts similarity index 99% rename from src/test/powershell.test.ts rename to src/powershell/powershell.test.ts index 88478f02..295733c7 100644 --- a/src/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 100% rename from src/powershell.ts rename to src/powershell/powershell.ts 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/src/test/pug.test.ts b/src/pug/pug.test.ts similarity index 99% rename from src/test/pug.test.ts rename to src/pug/pug.test.ts index 998d2e36..80f85662 100644 --- a/src/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 100% rename from src/pug.ts rename to src/pug/pug.ts 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/src/test/python.test.ts b/src/python/python.test.ts similarity index 97% rename from src/test/python.test.ts rename to src/python/python.test.ts index 8a4ea9b9..f4e9ea9d 100644 --- a/src/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 100% rename from src/python.ts rename to src/python/python.ts 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/src/test/r.test.ts b/src/r/r.test.ts similarity index 99% rename from src/test/r.test.ts rename to src/r/r.test.ts index e2ad5ba1..929fb76a 100644 --- a/src/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/src/test/razor.test.ts b/src/razor/razor.test.ts similarity index 95% rename from src/test/razor.test.ts rename to src/razor/razor.test.ts index fc534798..78582417 100644 --- a/src/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/src/test/redis.test.ts b/src/redis/redis.test.ts similarity index 98% rename from src/test/redis.test.ts rename to src/redis/redis.test.ts index 83a96b83..a016deb9 100644 --- a/src/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/src/test/redshift.test.ts b/src/redshift/redshift.test.ts similarity index 99% rename from src/test/redshift.test.ts rename to src/redshift/redshift.test.ts index d8958603..163c3032 100644 --- a/src/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/src/test/ruby.test.ts b/src/ruby/ruby.test.ts similarity index 98% rename from src/test/ruby.test.ts rename to src/ruby/ruby.test.ts index a67586b1..df528c9a 100644 --- a/src/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 diff --git a/src/ruby.ts b/src/ruby/ruby.ts similarity index 100% rename from src/ruby.ts rename to src/ruby/ruby.ts 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/src/test/sb.test.ts b/src/sb/sb.test.ts similarity index 99% rename from src/test/sb.test.ts rename to src/sb/sb.test.ts index 1f1a7cae..923d1185 100644 --- a/src/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/src/test/scss.test.ts b/src/scss/scss.test.ts similarity index 97% rename from src/test/scss.test.ts rename to src/scss/scss.test.ts index ec3dd166..9110e37f 100644 --- a/src/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 100% rename from src/scss.ts rename to src/scss/scss.ts 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/src/test/solidity.test.ts b/src/solidity/solidity.test.ts similarity index 99% rename from src/test/solidity.test.ts rename to src/solidity/solidity.test.ts index ecb8add6..7f39dd07 100644 --- a/src/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/src/test/sql.test.ts b/src/sql/sql.test.ts similarity index 99% rename from src/test/sql.test.ts rename to src/sql/sql.test.ts index 01811965..0d1f4f36 100644 --- a/src/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/src/test/swift.test.ts b/src/swift/swift.test.ts similarity index 99% rename from src/test/swift.test.ts rename to src/swift/swift.test.ts index 18c82b98..b20f073a 100644 --- a/src/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/src/test/testRunner.ts b/src/test/testRunner.ts index 15011a2f..f425a0b6 100644 --- a/src/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 '../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/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/src/test/vb.test.ts b/src/vb/vb.test.ts similarity index 99% rename from src/test/vb.test.ts rename to src/vb/vb.test.ts index f5503c22..b6d0e0a1 100644 --- a/src/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 100% rename from src/vb.ts rename to src/vb/vb.ts 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/src/test/xml.test.ts b/src/xml/xml.test.ts similarity index 99% rename from src/test/xml.test.ts rename to src/xml/xml.test.ts index 25f25ea7..5607a10d 100644 --- a/src/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/src/test/yaml.test.ts b/src/yaml/yaml.test.ts similarity index 98% rename from src/test/yaml.test.ts rename to src/yaml/yaml.test.ts index 4e2d5d2c..553d4fff 100644 --- a/src/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 100% rename from src/yaml.ts rename to src/yaml/yaml.ts diff --git a/test/setup.js b/test/setup.js index 713a321f..b446648f 100644 --- a/test/setup.js +++ b/test/setup.js @@ -26,43 +26,43 @@ define(['require'], function (require) { 'vs/editor/editor.main' ], function () { requirejs([ - 'release/dev/test/bat.test', - 'release/dev/test/css.test', - 'release/dev/test/coffee.test', - 'release/dev/test/cpp.test', - 'release/dev/test/csharp.test', - 'release/dev/test/dockerfile.test', - 'release/dev/test/fsharp.test', - 'release/dev/test/go.test', - 'release/dev/test/handlebars.test', - 'release/dev/test/html.test', - 'release/dev/test/pug.test', - 'release/dev/test/java.test', - 'release/dev/test/less.test', - 'release/dev/test/lua.test', - 'release/dev/test/markdown.test', - 'release/dev/test/msdax.test', - 'release/dev/test/objective-c.test', - 'release/dev/test/php.test', - 'release/dev/test/postiats.test', - 'release/dev/test/powershell.test', - 'release/dev/test/python.test', - 'release/dev/test/r.test', - 'release/dev/test/razor.test', - 'release/dev/test/ruby.test', - 'release/dev/test/scss.test', - 'release/dev/test/swift.test', - 'release/dev/test/sql.test', - 'release/dev/test/vb.test', - 'release/dev/test/xml.test', - 'release/dev/test/yaml.test', - 'release/dev/test/solidity.test', - 'release/dev/test/sb.test', - 'release/dev/test/mysql.test', - 'release/dev/test/pgsql.test', - 'release/dev/test/redshift.test', - 'release/dev/test/redis.test', - 'release/dev/test/csp.test', + '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) {