diff --git a/package-lock.json b/package-lock.json index e252af1b..1aa999e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -84,7 +84,7 @@ }, "array-equal": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", "dev": true }, @@ -938,9 +938,9 @@ } }, "monaco-editor-core": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.18.1.tgz", - "integrity": "sha512-euzXzmwjZFG0oAPGjICMwINcZBzQDyfGDYlAR5YNMBJZO9Bmkqq1xpTTze/qQ0KKbVmawFXiwgUbg7WVgebP9Q==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.19.0.tgz", + "integrity": "sha512-wD60zpYDhsuJbzzLQigAteK2cA5fkuaDn+4c7NLwm/526OX5eL6MMvLhfvRgrDvLO00SYhFf6vz1y1C8M1hTpQ==", "dev": true }, "monaco-plugin-helpers": { diff --git a/package.json b/package.json index a6d67ea2..cae37153 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "glob": "^7.1.6", "jsdom": "^15.2.1", "mocha": "^6.2.2", - "monaco-editor-core": "0.18.1", + "monaco-editor-core": "0.19.0", "monaco-plugin-helpers": "^1.0.2", "requirejs": "^2.3.6", "terser": "^4.4.3", diff --git a/src/kotlin/kotlin.test.ts b/src/kotlin/kotlin.test.ts index 25c90036..e2f61e7a 100644 --- a/src/kotlin/kotlin.test.ts +++ b/src/kotlin/kotlin.test.ts @@ -670,6 +670,36 @@ testTokenization('kotlin', [ { startIndex: 22, type: '' }, { startIndex: 23, type: 'delimiter.curly.kt' }, ] - }] -]); + }], + [{ + line: 'val text = """', + tokens: [ + { startIndex: 0, type: 'keyword.val.kt' }, + { startIndex: 3, type: '' }, + { startIndex: 4, type: 'identifier.kt' }, + { startIndex: 8, type: '' }, + { startIndex: 9, type: 'delimiter.kt' }, + { startIndex: 10, type: '' }, + { startIndex: 11, type: 'string.kt' }, + ] + }, + { + line: ' for (c in "foo")', + tokens: [ + { startIndex: 0, type: 'string.kt' }, + ] + }, + { + line: ' print(c)', + tokens: [ + { startIndex: 0, type: 'string.kt' }, + ] + }, + { + line: '"""', + tokens: [ + { startIndex: 0, type: 'string.kt' }, + ] + }], +]); diff --git a/src/kotlin/kotlin.ts b/src/kotlin/kotlin.ts index f2d9ed2a..cc641134 100644 --- a/src/kotlin/kotlin.ts +++ b/src/kotlin/kotlin.ts @@ -119,6 +119,7 @@ export const language = { // strings [/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string + [/"""/, 'string', '@multistring'], [/"/, 'string', '@string'], // characters @@ -155,5 +156,13 @@ export const language = { [/\\./, 'string.escape.invalid'], [/"/, 'string', '@pop'] ], + + multistring: [ + [/[^\\"]+/, 'string'], + [/@escapes/, 'string.escape'], + [/\\./, 'string.escape.invalid'], + [/"""/, 'string', '@pop'], + [/./, 'string'] + ], }, }; diff --git a/test/all.js b/test/all.js index fd9d6ab1..229f7b6c 100644 --- a/test/all.js +++ b/test/all.js @@ -18,7 +18,7 @@ global.document = tmp.window.document; global.navigator = tmp.window.navigator; global.self = global; global.document.queryCommandSupported = function () { return false; }; -global.window = { location: {} }; +global.window = { location: {}, navigator: tmp.window.navigator }; requirejs(['./test/setup'], function () { glob('release/dev/*/*.test.js', { cwd: path.dirname(__dirname) }, function (err, files) {