From 23db8835f58f66290f6141174eedb78ca7abbab9 Mon Sep 17 00:00:00 2001 From: David Storey Date: Tue, 8 Dec 2015 17:03:17 -0800 Subject: [PATCH] Merge branch 'Microsoft/master' into update-css-intellisense # Conflicts: # src/vs/languages/html/common/htmlTags.ts --- .editorconfig | 15 + .gitignore | 1 + .travis.yml | 8 +- .vscode/settings.json | 1 + OSSREADME.json | 392 +- README.md | 4 +- appveyor.yml | 14 + build/gulpfile.editor.js | 2 +- build/gulpfile.hygiene.js | 152 + build/gulpfile.vscode.js | 29 +- build/lib/copyrights.js | 36 - build/lib/style.js | 60 - build/lib/util.js | 11 + build/npm/preinstall.js | 13 + extensions/csharp-o/.gitignore | 1 - extensions/csharp-o/OSSREADME.json | 29 - extensions/csharp-o/gulpfile.js | 93 - extensions/csharp-o/package.json | 102 - extensions/csharp-o/snippets/csharp.json | 524 - .../csharp-o/src/features/abstractProvider.ts | 26 - .../csharp-o/src/features/changeForwarding.ts | 62 - .../src/features/codeActionProvider.ts | 98 - .../csharp-o/src/features/codeLensProvider.ts | 83 - extensions/csharp-o/src/features/commands.ts | 171 - .../src/features/completionItemProvider.ts | 86 - .../src/features/definitionProvider.ts | 25 - .../src/features/diagnosticsProvider.ts | 232 - .../src/features/documentHighlightProvider.ts | 31 - .../src/features/documentSymbolProvider.ts | 28 - .../src/features/formattingEditProvider.ts | 52 - .../csharp-o/src/features/hoverProvider.ts | 28 - .../csharp-o/src/features/omnisharpStatus.ts | 259 - .../src/features/referenceProvider.ts | 27 - .../csharp-o/src/features/renameProvider.ts | 40 - .../src/features/signatureHelpProvider.ts | 42 - .../src/features/workspaceSymbolProvider.ts | 45 - extensions/csharp-o/src/launchTargetFinder.ts | 82 - extensions/csharp-o/src/omnisharpMain.ts | 82 - extensions/csharp-o/src/omnisharpServer.ts | 507 - .../csharp-o/src/omnisharpServerLauncher.ts | 161 - extensions/csharp-o/src/protocol.ts | 416 - extensions/csharp-o/src/typeConvertion.ts | 72 - .../src/typings/applicationinsights.d.ts | 69 - .../csharp-o/src/typings/semver/semver.d.ts | 125 - extensions/csharp-o/tsconfig.json | 12 - extensions/csharp-o/typings/mocha.d.ts | 13 - extensions/css/snippets/css.json | 12 +- extensions/fsharp/syntaxes/fsharp.json | 2 +- extensions/html/OSSREADME.json | 22 + extensions/html/package.json | 16 +- extensions/html/syntaxes/HTML.plist | 855 + extensions/javascript/OSSREADME.json | 8 +- .../javascript/javascript.configuration.json | 11 + extensions/javascript/package.json | 7 +- .../javascript/syntaxes/JavaScript.tmLanguage | 2162 +- extensions/javascript/syntaxes/Readme.md | 7 + extensions/json/OSSREADME.json | 7 + extensions/json/package.json | 19 + extensions/json/syntaxes/JSON.tmLanguage | 387 + extensions/lua/syntaxes/Lua.plist | 2 +- extensions/mono-debug/mono-debug.azure.json | 2 +- extensions/node-debug/node-debug.azure.json | 2 +- extensions/php/package.json | 5 + .../src/features/completionItemProvider.ts | 12 +- .../php/src/features/validationProvider.ts | 29 +- .../php/src/test/php-worker.test.ts.disabled | 27 +- extensions/python/package.json | 4 +- extensions/ruby/package.json | 2 +- extensions/shaderlab/package.json | 2 +- extensions/tsconfig.json | 2 +- .../server/typescript/lib/lib.core.d.ts | 1472 +- .../server/typescript/lib/lib.core.es6.d.ts | 1757 +- .../typescript/server/typescript/lib/lib.d.ts | 1798 +- .../server/typescript/lib/lib.dom.d.ts | 332 +- .../server/typescript/lib/lib.es6.d.ts | 2083 +- .../server/typescript/lib/lib.scriptHost.d.ts | 14 +- .../server/typescript/lib/lib.webworker.d.ts | 47 +- .../server/typescript/lib/tsserver.js | 20407 ++++++++-------- extensions/typescript/src/typescriptMain.ts | 6 +- extensions/vb/package.json | 4 +- .../vscode-api-tests/.vscode/launch.json | 17 + .../vscode-api-tests/.vscode/tasks.json | 30 + extensions/vscode-api-tests/.vscodeignore | 3 - extensions/vscode-api-tests/README.md | 14 - extensions/vscode-api-tests/package.json | 5 +- .../vscode-api-tests/src/commands.test.ts | 29 + .../vscode-api-tests/src/editor.test.ts | 41 + extensions/vscode-api-tests/src/index.ts | 3 +- extensions/vscode-api-tests/src/utils.ts | 88 + .../vscode-api-tests/src/window.test.ts | 19 +- .../vscode-api-tests/src/workspace.test.ts | 111 +- extensions/xml/package.json | 63 +- gulpfile.js | 68 +- npm-shrinkwrap.json | 27 +- package.json | 182 +- product.json | 1 + scripts/code.bat | 18 +- scripts/code.sh | 37 +- src/bootstrap.js | 14 +- src/typings/https-proxy-agent.d.ts | 11 + .../typings/native-keymap.d.ts | 18 +- src/typings/windows-mutex.ts | 12 + src/vs/base/browser/browser.ts | 1 - src/vs/base/browser/dom.ts | 19 - src/vs/base/browser/globalMouseMoveMonitor.ts | 20 +- src/vs/base/browser/idleMonitor.ts | 50 +- src/vs/base/browser/iframe.ts | 20 +- src/vs/base/browser/ui/inputbox/inputBox.ts | 3 + .../browser/ui/messagelist/messageList.css | 2 +- .../ui/resourceviewer/resourceViewer.ts | 15 +- src/vs/base/common/async.ts | 8 +- src/vs/base/common/collections.ts | 20 +- src/vs/base/common/flags.ts | 12 +- src/vs/base/common/graph.ts | 26 +- src/vs/base/common/http.ts | 29 + src/vs/base/common/injector.ts | 38 +- src/vs/base/common/keyCodes.ts | 48 +- src/vs/base/common/labels.ts | 6 +- src/vs/base/common/marshalling.ts | 2 +- src/vs/base/common/network.ts | 44 +- src/vs/base/common/remote.ts | 24 +- src/vs/base/common/service.ts | 11 +- src/vs/base/common/uri.ts | 6 +- src/vs/base/common/worker/workerProtocol.ts | 12 +- src/vs/base/node/extfs.ts | 42 +- src/vs/base/node/processes.ts | 2 +- src/vs/base/node/request.ts | 34 - src/vs/base/node/service.cp.ts | 2 +- .../quickopen/browser/quickOpenWidget.ts | 23 +- .../base/parts/tree/browser/treeDefaults.ts | 8 +- src/vs/base/parts/tree/common/treeModel.ts | 2 +- src/vs/base/test/common/network.test.ts | 13 +- src/vs/base/test/node/service/service.test.ts | 42 +- src/vs/base/test/node/service/testService.ts | 6 + src/vs/css.js | 18 +- .../editor/browser/controller/mouseTarget.ts | 2 +- src/vs/editor/browser/editor.all.js | 1 + src/vs/editor/browser/editorBrowser.ts | 1 + .../browser/standalone/simpleServices.ts | 7 +- .../standalone/standaloneCodeEditor.ts | 10 +- src/vs/editor/browser/view/viewOverlays.ts | 7 +- .../viewParts/viewCursors/viewCursors.ts | 12 +- src/vs/editor/browser/widget/media/tokens.css | 242 +- .../common/config/commonEditorConfig.ts | 8 + src/vs/editor/common/config/config.ts | 6 +- src/vs/editor/common/config/defaultConfig.ts | 1 + src/vs/editor/common/core/position.ts | 2 +- src/vs/editor/common/core/range.ts | 2 +- src/vs/editor/common/editorCommon.ts | 26 +- .../editor/common/editorCommonExtensions.ts | 39 +- src/vs/editor/common/model/mirrorModel.ts | 81 +- src/vs/editor/common/model/model.ts | 17 +- .../common/model/textModelWithTokens.ts | 40 +- src/vs/editor/common/modes.ts | 109 +- src/vs/editor/common/modes/abstractMode.ts | 104 +- .../editor/common/modes/abstractModeWorker.ts | 48 +- .../common/modes/languageFeatureRegistry.ts | 144 +- .../editor/common/modes/languageSelector.ts | 24 +- src/vs/editor/common/modes/lineStream.ts | 12 +- src/vs/editor/common/modes/modesFilters.ts | 32 +- src/vs/editor/common/modes/modesRegistry.ts | 4 +- .../common/modes/monarch/monarchDefinition.ts | 2 +- src/vs/editor/common/modes/nullMode.ts | 4 + src/vs/editor/common/modes/supports.ts | 42 +- src/vs/editor/common/services/bulkEdit.ts | 2 +- .../editor/common/services/modeServiceImpl.ts | 2 +- src/vs/editor/common/services/modelService.ts | 7 +- .../common/services/modelServiceImpl.ts | 351 +- .../editor/common/services/resourceService.ts | 7 +- .../common/services/resourceServiceImpl.ts | 10 +- .../common/viewModel/prefixSumComputer.ts | 42 +- .../editor/common/worker/validationHelper.ts | 8 +- .../contrib/codelens/browser/codelens.ts | 66 +- .../contrib/codelens/common/codelens.ts | 46 +- .../comment/common/lineCommentCommand.ts | 6 +- .../contextmenu/browser/contextmenu.ts | 2 +- .../browser/defineKeybinding.css | 42 + .../browser/defineKeybinding.ts | 297 + src/vs/editor/contrib/format/common/format.ts | 80 +- .../contrib/format/common/formatActions.ts | 44 +- .../contrib/format/common/formatCommand.ts | 62 +- .../format/test/common/formatCommand.test.ts | 295 + .../browser/goToDeclaration.ts | 64 +- .../goToDeclaration/common/goToDeclaration.ts | 37 +- .../contrib/gotoError/browser/gotoError.ts | 6 +- src/vs/editor/contrib/hover/browser/hover.css | 4 +- .../hover/browser/modesContentHover.ts | 27 +- src/vs/editor/contrib/hover/common/hover.ts | 35 +- .../linesOperations/common/linesOperations.ts | 4 +- src/vs/editor/contrib/links/browser/links.ts | 6 +- .../contrib/multicursor/common/multicursor.ts | 10 +- .../browser/parameterHintsModel.ts | 15 +- .../parameterHints/common/parameterHints.ts | 24 +- .../contrib/quickFix/browser/quickFix.ts | 4 +- .../contrib/quickFix/browser/quickFixModel.ts | 26 +- .../browser/quickFixSelectionWidget.ts | 18 +- .../contrib/quickFix/common/quickFix.ts | 54 +- .../contrib/quickOpen/browser/quickCommand.ts | 2 +- .../contrib/quickOpen/common/quickOpen.ts | 83 +- .../browser/referenceSearch.ts | 22 +- .../browser/referenceSearchWidget.ts | 9 +- .../referenceSearch/common/referenceSearch.ts | 34 +- .../editor/contrib/rename/browser/rename2.ts | 40 +- .../contrib/rename/browser/renameModel.ts | 2 +- src/vs/editor/contrib/rename/common/rename.ts | 60 +- .../common/tokenSelectionSupport.ts | 4 +- .../contrib/suggest/browser/suggestModel.ts | 103 +- .../contrib/suggest/browser/suggestWidget.ts | 6 +- .../editor/contrib/suggest/common/suggest.ts | 108 +- .../wordHighlighter/common/wordHighlighter.ts | 58 +- src/vs/editor/css/hc-white-theme.css | 130 - src/vs/editor/standalone-languages/csharp.ts | 2 +- src/vs/editor/standalone-languages/lua.ts | 2 +- .../common/model/editableTextModel.test.ts | 44 +- .../test/common/model/mirrorModel.test.ts | 158 +- .../common/modes/languageSelector.test.ts | 38 +- .../common/modes/textToHtmlTokenizer.test.ts | 4 + .../test/common/modes/tokenization.test.ts | 8 + src/vs/editor/test/common/modesTestUtils.ts | 24 +- src/vs/editor/test/common/modesUtil.ts | 23 +- .../common/services/resourceService.test.ts | 20 +- src/vs/editor/test/common/testModes.ts | 4 + src/vs/languages/css/common/css.ts | 89 +- .../vs/languages/css/common/cssTokenTypes.ts | 29 +- src/vs/languages/css/common/cssWorker.ts | 40 +- .../languages/css/common/parser/cssErrors.ts | 2 +- .../languages/css/common/parser/cssSymbols.ts | 68 +- .../languages/css/common/services/browsers.js | 2 +- .../css/common/services/cssLanguageService.ts | 8 +- .../css/common/services/intelliSense.ts | 9 +- .../css/common/services/typeResolution.ts | 4 +- .../css/test/common/css-worker.test.ts | 78 +- src/vs/languages/css/test/common/css.test.ts | 167 +- src/vs/languages/html/common/OSSREADME.json | 19 + src/vs/languages/html/common/html.ts | 35 +- .../html/common/htmlEmptyTagsShared.ts | 12 + src/vs/languages/html/common/htmlTags.ts | 441 +- .../languages/html/common/htmlTokenTypes.ts | 6 +- src/vs/languages/html/common/htmlWorker.ts | 66 +- .../html/test/common/html-worker.test.ts | 17 +- .../common/javascript.contribution.ts | 6 +- .../javascript/common/javascriptWorker.ts | 2 +- .../json/common/features/jsonTokenTypes.ts | 8 +- src/vs/languages/json/common/json.ts | 10 +- .../languages/json/common/jsonIntellisense.ts | 16 +- .../json/common/jsonSchemaService.ts | 27 +- src/vs/languages/json/common/jsonWorker.ts | 43 +- .../json/common/parser/jsonParser.ts | 24 +- .../common/fixtures/Microsoft.Compute.json | 835 + .../common/fixtures/deploymentTemplate.json | 5 +- .../json/test/common/jsonworker.test.ts | 120 +- .../languages/json/test/common/parser.test.ts | 33 +- .../languages/json/test/node/schema.test.ts | 124 +- src/vs/languages/less/common/less.ts | 43 +- .../less/test/common/colorizer.test.ts | 305 +- .../less/test/common/intellisense.test.ts | 18 +- src/vs/languages/markdown/common/markdown.ts | 9 +- .../markdown/common/markdownWorker.ts | 35 +- src/vs/languages/markdown/common/tokens.css | 224 +- .../markdown/test/common/markdown.test.ts | 7 +- src/vs/languages/php/test/common/php.test.ts | 13 +- src/vs/languages/sass/common/sass.ts | 55 +- .../sass/common/services/intelliSense.ts | 4 +- .../sass/test/common/sass-worker.test.ts | 19 +- .../languages/sass/test/common/sass.test.ts | 485 +- .../common/projectResolver.ts | 11 +- .../test/common/projectResolver.test.ts | 1 - .../typescript/common/features/definitions.ts | 2 +- .../typescript/common/features/moduleLinks.ts | 4 +- .../typescript/common/features/quickFix.ts | 42 +- .../common/features/quickFixMainActions.ts | 9 +- .../typescript/common/features/references.ts | 3 +- .../typescript/common/features/suggestions.ts | 2 +- .../participants/filenameSuggestions.ts | 7 +- .../common/project/projectService.ts | 3 + .../languages/typescript/common/typescript.ts | 4 +- .../typescript/common/typescriptMode.ts | 33 +- .../typescript/common/typescriptWorker2.ts | 7 +- .../common/features/logicalSelection.test.ts | 4 +- .../test/common/features/outline.test.ts | 4 +- .../test/common/features/quickfix.test.ts | 69 +- .../participants/filenameSuggestions.test.ts | 6 +- .../languages/vsxml/common/vsxmlTokenTypes.ts | 2 +- src/vs/loader.js | 27 +- src/vs/nls.js | 13 +- .../platform/actions/common/actionsService.ts | 2 +- .../common/configurationRegistry.ts | 33 +- src/vs/platform/configuration/common/model.ts | 3 - .../contextview/browser/contextView.ts | 10 +- .../browser/keybindingServiceImpl.ts | 30 +- .../common/commonKeybindingResolver.ts | 10 +- .../keybinding/common/keybindingService.ts | 6 +- .../keybinding/common/keybindingsRegistry.ts | 5 - .../platform/markers/common/markerService.ts | 8 +- .../platform/markers/common/problemMatcher.ts | 7 +- .../markers/test/common/markerService.test.ts | 30 +- .../platform/plugins/common/ipcRemoteCom.ts | 24 +- .../request/common/baseRequestService.ts | 42 +- src/vs/platform/request/common/request.ts | 16 +- src/vs/platform/search/common/search.ts | 2 +- .../common/abstractTelemetryService.ts | 21 +- .../thread/common/abstractThreadService.ts | 3 +- src/vs/platform/workspace/common/workspace.ts | 7 +- src/vs/text.js | 15 +- src/vs/vscode.d.ts | 49 +- .../api/browser/extHostOutputService.ts | 20 +- .../api/browser/pluginHost.api.impl.ts | 38 +- .../api/browser/pluginHostQuickOpen.ts | 18 + .../api/browser/pluginHostWorkspace.ts | 4 +- .../common/extHostLanguageFeatureCommands.ts | 255 + .../api/common/extHostLanguageFeatures.ts | 1039 + .../workbench/api/common/languageFeatures.ts | 1293 - .../workbench/api/common/mainThreadEditors.ts | 2 + .../api/common/pluginHostCommands.ts | 16 +- .../api/common/pluginHostDocuments.ts | 20 +- .../api/common/pluginHostTypeConverters.ts | 357 +- .../workbench/api/common/pluginHostTypes.ts | 2 +- .../parts/activitybar/activitybarPart.ts | 4 +- .../browser/parts/editor/binaryDiffEditor.ts | 17 +- .../browser/parts/editor/binaryEditor.ts | 12 +- .../browser/parts/editor/binaryEditorModel.ts | 37 + .../browser/parts/editor/diffEditorInput.ts | 24 +- .../parts/editor/editor.contribution.ts | 31 +- .../browser/parts/editor/editorPart.ts | 14 +- .../parts/editor/readOnlyEditorInput.ts | 99 - .../parts/editor/readOnlyEditorModel.ts | 32 - .../parts/editor/resourceEditorInput.ts | 142 +- .../parts/editor/resourceEditorModel.ts | 150 +- .../browser/parts/editor/stringEditorInput.ts | 2 +- .../browser/parts/editor/stringEditorModel.ts | 8 +- .../browser/parts/editor/textDiffEditor.ts | 26 +- .../browser/parts/editor/textEditorModel.ts | 9 +- .../parts/editor/untitledEditorInput.ts | 2 +- .../parts/quickopen/editorHistoryModel.ts | 12 +- .../parts/quickopen/quickOpenController.ts | 19 +- .../browser/parts/sidebar/sidebarPart.ts | 14 +- .../browser/parts/statusbar/statusbarPart.ts | 2 +- src/vs/workbench/browser/viewlet.ts | 3 +- src/vs/workbench/browser/workbench.ts | 25 +- src/vs/workbench/common/textEditorWorker.ts | 3 +- src/vs/workbench/electron-browser/actions.ts | 66 +- src/vs/workbench/electron-browser/index.html | 38 +- .../workbench/electron-browser/integration.ts | 25 +- .../electron-browser/main.contribution.ts | 5 + src/vs/workbench/electron-browser/main.ts | 6 + src/vs/workbench/electron-browser/shell.ts | 201 +- src/vs/workbench/electron-browser/window.ts | 8 + src/vs/workbench/electron-main/bootstrap.js | 2 +- src/vs/workbench/electron-main/env.ts | 16 +- src/vs/workbench/electron-main/lifecycle.ts | 3 +- src/vs/workbench/electron-main/main.ts | 46 +- src/vs/workbench/electron-main/menus.ts | 7 +- .../electron-main/sharedProcessMain.ts | 2 +- .../electron-main/win32/auto-updater.win32.ts | 18 +- src/vs/workbench/electron-main/window.ts | 22 +- src/vs/workbench/electron-main/windows.ts | 137 +- src/vs/workbench/node/pluginHostMain.ts | 16 +- src/vs/workbench/node/pluginHostProcess.ts | 2 +- src/vs/workbench/node/proxy.ts | 65 + .../parts/debug/browser/debug.contribution.ts | 165 +- .../parts/debug/browser/debugActionItems.ts | 23 +- .../parts/debug/browser/debugActions.ts | 80 +- .../debug/browser/debugEditorContribution.ts | 194 + .../debug/browser/debugEditorModelManager.ts | 248 +- .../parts/debug/browser/debugHoverWidget.ts | 6 +- .../parts/debug/browser/debugViewer.ts | 212 +- .../parts/debug/browser/debugViewlet.ts | 14 +- .../media/breakpoint-disabled-dark.svg | 2 +- .../browser/media/breakpoint-disabled.svg | 2 +- .../browser/media/breakpoint-hover-dark.svg | 1 - .../debug/browser/media/breakpoint-hover.svg | 1 - ...point-dark.svg => breakpoint-verified.svg} | 2 +- .../parts/debug/browser/media/breakpoint.svg | 2 +- .../media/current-and-breakpoint-dark.svg | 2 +- .../browser/media/current-and-breakpoint.svg | 2 +- .../browser/media/debug.contribution.css | 26 +- .../debug/browser/media/debugViewlet.css | 12 +- .../media/stackframe-and-breakpoint-dark.svg | 2 +- .../media/stackframe-and-breakpoint.svg | 2 +- .../parts/debug/browser/replEditor.ts | 2 +- src/vs/workbench/parts/debug/common/debug.ts | 230 +- .../parts/debug/common/debugModel.ts | 139 +- .../parts/debug/common/debugProtocol.d.ts | 2 +- .../parts/debug/common/debugSource.ts | 37 + .../debug/{browser => common}/replHistory.ts | 0 .../electron-browser/debug.contribution.ts | 8 +- .../debug/electron-browser/debugService.ts | 544 +- .../debug/electron-browser/extensionOutput.ts | 115 - .../debug/node/debugConfigurationManager.ts | 349 + .../parts/debug/node/rawDebugSession.ts | 18 +- .../debug/test/common/debugModel.test.ts | 122 +- .../debug/test/common/debugSource.test.ts | 50 + .../debug/test/common/debugViewModel.test.ts | 38 + .../debug/test/common/replHistory.test.ts | 47 + .../debug/test/node/debugAdapter.test.ts | 80 + .../parts/emmet/node/editorAccessor.ts | 2 +- src/vs/workbench/parts/emmet/node/emmet.d.ts | 4 +- .../parts/extensions/common/extensions.ts | 1 + .../electron-browser/extensionsActions.ts | 23 + .../electron-browser/extensionsQuickOpen.ts | 99 +- .../extensionsWorkbenchExtension.ts | 18 +- .../extensions/node/extensionsService.ts | 34 +- .../extensions/node/vsoGalleryService.ts | 4 +- .../parts/feedback/browser/feedback.ts | 291 - .../feedback/browser/media/close-dark.svg | 1 - .../parts/feedback/browser/media/close.svg | 1 - .../parts/feedback/browser/media/feedback.css | 399 - .../parts/feedback/browser/media/happy.svg | 1 - .../parts/feedback/browser/media/info.svg | 1 - .../parts/feedback/browser/media/sad.svg | 1 - .../parts/feedback/browser/media/smiley.svg | 1 - .../electron-browser/feedback.contribution.ts | 19 - .../feedback/electron-browser/feedback.ts | 251 - .../files/browser/editors/fileEditorInput.ts | 32 +- .../files/browser/editors/textFileEditor.ts | 6 +- .../browser/editors/textFileEditorModel.ts | 16 +- .../files/browser/fileActions.contribution.ts | 6 +- .../parts/files/browser/fileActions.ts | 45 +- .../parts/files/browser/fileTracker.ts | 4 +- .../parts/files/browser/files.contribution.ts | 4 +- .../parts/files/browser/saveErrorHandler.ts | 70 +- .../parts/files/browser/saveParticipant.ts | 23 +- .../parts/files/browser/views/explorerView.ts | 22 +- .../files/browser/views/explorerViewer.ts | 6 +- .../files/browser/views/workingFilesView.ts | 5 +- .../files/browser/views/workingFilesViewer.ts | 2 +- .../parts/files/browser/workingFilesModel.ts | 2 +- src/vs/workbench/parts/files/common/files.ts | 13 +- .../electron-browser/electronFileTracker.ts | 2 +- .../electron-browser/textFileServices.ts | 58 +- .../test/browser/fileEditorModel.test.ts | 2 + .../git/browser/gitActions.contribution.ts | 45 +- .../workbench/parts/git/browser/gitActions.ts | 36 +- .../parts/git/browser/gitEditorInputs.ts | 32 +- .../parts/git/browser/gitServices.ts | 36 +- .../git/browser/gitWorkbenchContributions.ts | 31 +- .../git/browser/views/changes/changesView.css | 14 +- .../git/browser/views/changes/changesView.ts | 30 +- .../browser/views/changes/changesViewer.ts | 66 +- src/vs/workbench/parts/git/common/git.ts | 8 +- src/vs/workbench/parts/git/common/gitModel.ts | 52 +- .../parts/git/common/noopGitService.ts | 3 +- .../workbench/parts/git/common/stageRanges.ts | 2 +- .../electron-browser/electronGitService.ts | 100 +- .../parts/git/electron-browser/gitApp.ts | 78 +- src/vs/workbench/parts/git/node/git.lib.ts | 317 +- .../workbench/parts/git/node/rawGitService.ts | 180 +- .../parts/git/test/common/stageRanges.test.ts | 6 +- .../lib/test/node/systemVariables.test.ts | 4 +- .../markdown/browser/markdownEditorModel.ts | 2 +- .../markdown/browser/markdownExtension.ts | 3 +- .../parts/output/browser/outputActions.ts | 4 +- .../quickopen/browser/commandsHandler.ts | 6 +- .../quickopen/browser/gotoSymbolHandler.ts | 33 +- .../parts/quickopen/browser/markersHandler.ts | 2 +- .../search/browser/openAnythingHandler.ts | 60 +- .../parts/search/browser/openFileHandler.ts | 38 +- .../parts/search/browser/openSymbolHandler.ts | 26 +- .../parts/search/browser/searchViewlet.ts | 2 +- .../workbench/parts/search/common/search.ts | 33 +- .../parts/search/common/searchQuery.ts | 2 +- .../search/test/common/searchModel.test.ts | 11 +- .../electron-browser/snippetsTracker.ts | 7 +- .../parts/tasks/common/problemCollectors.ts | 20 +- .../parts/tasks/common/taskSampleConfig.json | 2 +- .../electron-browser/task.contribution.ts | 18 +- .../parts/tasks/node/processRunnerSystem.ts | 4 +- .../node/appInsightsTelemetryAppender.test.ts | 2 +- .../{common => node}/configurationService.ts | 89 +- .../electron-browser/contextmenuService.ts | 73 +- .../services/editor/browser/editorService.ts | 2 +- .../services/editor/common/editorService.ts | 4 +- .../files/electron-browser/fileService.ts | 2 +- .../services/files/node/fileService.ts | 12 +- .../services/files/node/watcher/common.ts | 2 +- .../files/node/watcher/win32/CodeHelper.exe | Bin 83456 -> 83968 bytes .../files/test/node/fileService.test.ts | 4 +- .../keybinding/browser/keybindingService.ts | 2 +- .../pluginKeybindingService.ts | 88 +- .../message/browser/messageService.ts | 2 +- .../quickopen/browser/quickOpenService.ts | 2 +- .../services/request/common/requestService.ts | 4 +- .../services/request/node/requestService.ts | 9 +- .../services/search/node/fileSearch.ts | 171 +- .../services/search/node/rawSearchService.ts | 8 +- .../services/search/node/searchService.ts | 31 +- .../services/search/test/node/search.test.ts | 30 +- .../thread/electron-browser/threadService.ts | 44 +- .../window/electron-browser/windowService.ts | 6 +- .../workspace/common/contextService.ts | 2 +- .../browser/parts/editor/editorInput.test.ts | 50 - .../browser/parts/editor/editorModel.test.ts | 2 +- .../parts/editor/resourceEditorInput.test.ts | 178 - .../parts/editor/resourceEditorModel.test.ts | 137 - .../parts/editor/stringEditorInput.test.ts | 16 +- .../test/browser/servicesTestUtils.ts | 6 +- .../extHostLanguageFeatureCommands.test.ts | 311 + .../api/extHostLanguageFeatures.test.ts | 992 + .../test/common/api/languageFeatures.test.ts | 177 - .../test/common/api/testThreadService.ts | 90 + src/vs/workbench/workbench.main.js | 2 - test/all.js | 15 +- test/run.bat | 2 +- test/run.sh | 10 +- 504 files changed, 30211 insertions(+), 27525 deletions(-) create mode 100644 .editorconfig create mode 100644 appveyor.yml create mode 100644 build/gulpfile.hygiene.js delete mode 100644 build/lib/copyrights.js delete mode 100644 build/lib/style.js create mode 100644 build/npm/preinstall.js delete mode 100644 extensions/csharp-o/.gitignore delete mode 100644 extensions/csharp-o/OSSREADME.json delete mode 100644 extensions/csharp-o/gulpfile.js delete mode 100644 extensions/csharp-o/package.json delete mode 100644 extensions/csharp-o/snippets/csharp.json delete mode 100644 extensions/csharp-o/src/features/abstractProvider.ts delete mode 100644 extensions/csharp-o/src/features/changeForwarding.ts delete mode 100644 extensions/csharp-o/src/features/codeActionProvider.ts delete mode 100644 extensions/csharp-o/src/features/codeLensProvider.ts delete mode 100644 extensions/csharp-o/src/features/commands.ts delete mode 100644 extensions/csharp-o/src/features/completionItemProvider.ts delete mode 100644 extensions/csharp-o/src/features/definitionProvider.ts delete mode 100644 extensions/csharp-o/src/features/diagnosticsProvider.ts delete mode 100644 extensions/csharp-o/src/features/documentHighlightProvider.ts delete mode 100644 extensions/csharp-o/src/features/documentSymbolProvider.ts delete mode 100644 extensions/csharp-o/src/features/formattingEditProvider.ts delete mode 100644 extensions/csharp-o/src/features/hoverProvider.ts delete mode 100644 extensions/csharp-o/src/features/omnisharpStatus.ts delete mode 100644 extensions/csharp-o/src/features/referenceProvider.ts delete mode 100644 extensions/csharp-o/src/features/renameProvider.ts delete mode 100644 extensions/csharp-o/src/features/signatureHelpProvider.ts delete mode 100644 extensions/csharp-o/src/features/workspaceSymbolProvider.ts delete mode 100644 extensions/csharp-o/src/launchTargetFinder.ts delete mode 100644 extensions/csharp-o/src/omnisharpMain.ts delete mode 100644 extensions/csharp-o/src/omnisharpServer.ts delete mode 100644 extensions/csharp-o/src/omnisharpServerLauncher.ts delete mode 100644 extensions/csharp-o/src/protocol.ts delete mode 100644 extensions/csharp-o/src/typeConvertion.ts delete mode 100644 extensions/csharp-o/src/typings/applicationinsights.d.ts delete mode 100644 extensions/csharp-o/src/typings/semver/semver.d.ts delete mode 100644 extensions/csharp-o/tsconfig.json delete mode 100644 extensions/csharp-o/typings/mocha.d.ts create mode 100644 extensions/html/OSSREADME.json create mode 100644 extensions/html/syntaxes/HTML.plist create mode 100644 extensions/javascript/javascript.configuration.json create mode 100644 extensions/json/OSSREADME.json create mode 100644 extensions/json/package.json create mode 100644 extensions/json/syntaxes/JSON.tmLanguage create mode 100644 extensions/vscode-api-tests/.vscode/launch.json create mode 100644 extensions/vscode-api-tests/.vscode/tasks.json delete mode 100644 extensions/vscode-api-tests/README.md create mode 100644 extensions/vscode-api-tests/src/commands.test.ts create mode 100644 extensions/vscode-api-tests/src/editor.test.ts create mode 100644 extensions/vscode-api-tests/src/utils.ts rename extensions/csharp-o/src/typings/ref.d.ts => src/typings/native-keymap.d.ts (54%) create mode 100644 src/typings/windows-mutex.ts create mode 100644 src/vs/editor/contrib/defineKeybinding/browser/defineKeybinding.css create mode 100644 src/vs/editor/contrib/defineKeybinding/browser/defineKeybinding.ts create mode 100644 src/vs/editor/contrib/format/test/common/formatCommand.test.ts delete mode 100644 src/vs/editor/css/hc-white-theme.css rename extensions/csharp-o/src/features/documentation.ts => src/vs/languages/css/common/cssTokenTypes.ts (52%) create mode 100644 src/vs/languages/html/common/OSSREADME.json create mode 100644 src/vs/languages/html/common/htmlEmptyTagsShared.ts create mode 100644 src/vs/languages/json/test/common/fixtures/Microsoft.Compute.json create mode 100644 src/vs/workbench/api/common/extHostLanguageFeatureCommands.ts create mode 100644 src/vs/workbench/api/common/extHostLanguageFeatures.ts delete mode 100644 src/vs/workbench/api/common/languageFeatures.ts create mode 100644 src/vs/workbench/browser/parts/editor/binaryEditorModel.ts delete mode 100644 src/vs/workbench/browser/parts/editor/readOnlyEditorInput.ts delete mode 100644 src/vs/workbench/browser/parts/editor/readOnlyEditorModel.ts create mode 100644 src/vs/workbench/node/proxy.ts create mode 100644 src/vs/workbench/parts/debug/browser/debugEditorContribution.ts delete mode 100644 src/vs/workbench/parts/debug/browser/media/breakpoint-hover-dark.svg delete mode 100644 src/vs/workbench/parts/debug/browser/media/breakpoint-hover.svg rename src/vs/workbench/parts/debug/browser/media/{breakpoint-dark.svg => breakpoint-verified.svg} (71%) create mode 100644 src/vs/workbench/parts/debug/common/debugSource.ts rename src/vs/workbench/parts/debug/{browser => common}/replHistory.ts (100%) delete mode 100644 src/vs/workbench/parts/debug/electron-browser/extensionOutput.ts create mode 100644 src/vs/workbench/parts/debug/node/debugConfigurationManager.ts create mode 100644 src/vs/workbench/parts/debug/test/common/debugSource.test.ts create mode 100644 src/vs/workbench/parts/debug/test/common/debugViewModel.test.ts create mode 100644 src/vs/workbench/parts/debug/test/common/replHistory.test.ts create mode 100644 src/vs/workbench/parts/debug/test/node/debugAdapter.test.ts delete mode 100644 src/vs/workbench/parts/feedback/browser/feedback.ts delete mode 100644 src/vs/workbench/parts/feedback/browser/media/close-dark.svg delete mode 100644 src/vs/workbench/parts/feedback/browser/media/close.svg delete mode 100644 src/vs/workbench/parts/feedback/browser/media/feedback.css delete mode 100644 src/vs/workbench/parts/feedback/browser/media/happy.svg delete mode 100644 src/vs/workbench/parts/feedback/browser/media/info.svg delete mode 100644 src/vs/workbench/parts/feedback/browser/media/sad.svg delete mode 100644 src/vs/workbench/parts/feedback/browser/media/smiley.svg delete mode 100644 src/vs/workbench/parts/feedback/electron-browser/feedback.contribution.ts delete mode 100644 src/vs/workbench/parts/feedback/electron-browser/feedback.ts rename src/vs/workbench/services/configuration/{common => node}/configurationService.ts (57%) rename src/vs/workbench/services/keybinding/{browser => electron-browser}/pluginKeybindingService.ts (72%) delete mode 100644 src/vs/workbench/test/browser/parts/editor/resourceEditorInput.test.ts delete mode 100644 src/vs/workbench/test/browser/parts/editor/resourceEditorModel.test.ts create mode 100644 src/vs/workbench/test/common/api/extHostLanguageFeatureCommands.test.ts create mode 100644 src/vs/workbench/test/common/api/extHostLanguageFeatures.test.ts delete mode 100644 src/vs/workbench/test/common/api/languageFeatures.test.ts create mode 100644 src/vs/workbench/test/common/api/testThreadService.ts diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..bb63c97c9e5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Tab indentation +[*] +indent_style = tab +indent_size = 4 + +# The indent size used in the `package.json` file cannot be changed +# https://github.com/npm/npm/pull/3180#issuecomment-16336516 +[{.travis.yml,npm-shrinkwrap.json,package.json}] +indent_style = space +indent_size = 2 diff --git a/.gitignore b/.gitignore index 7fcf2c97b8b..736b3124ec5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ npm-debug.log Thumbs.db node_modules/ +.build/ out/ out-build/ out-editor/ diff --git a/.travis.yml b/.travis.yml index 7588dfb3d1d..d03a3b77e7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,12 +26,16 @@ before_install: - npm config set python `which python` - npm install -g gulp - if [ $TRAVIS_OS_NAME == "linux" ]; then - export CXX="g++-4.9" CC="gcc-4.9"; + export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0; + sh -e /etc/init.d/xvfb start; + sleep 3; fi install: - ./scripts/npm.sh install - - gulp electron compile script: + - gulp hygiene + - gulp electron + - gulp compile - ./test/run.sh diff --git a/.vscode/settings.json b/.vscode/settings.json index 43712cc1ac4..7acd2c0fbe4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,6 +9,7 @@ "search.exclude": { "**/node_modules/**": true, "**/bower_components": true, + ".build/**": true, "out*/**": true, "extensions/**/out/**": true } diff --git a/OSSREADME.json b/OSSREADME.json index fda07da6926..962a0525a03 100644 --- a/OSSREADME.json +++ b/OSSREADME.json @@ -1,196 +1,196 @@ -// Listing in here platform dependencies that come in at build time - -[{ - "name": "atom-brightray", - "repositoryURL": "https://github.com/atom/brightray", - "license": "MIT", - "isProd": true -}, -{ - "name": "chromium", - "version": "45.0.2454.85", - "repositoryURL": "http://www.chromium.org/Home", - "licenseDetail": [ - "BSD License", - "", - "Copyright 2014 The Chromium Authors. All rights reserved.", - "", - "Redistribution and use in source and binary forms, with or without modification,", - "are permitted provided that the following conditions are met:", - "", - " * Redistributions of source code must retain the above copyright notice, this", - " list of conditions and the following disclaimer.", - "", - " * Redistributions in binary form must reproduce the above copyright notice,", - " this list of conditions and the following disclaimer in the documentation", - " and/or other materials provided with the distribution.", - "", - " * Neither the name Google Inc. nor the names of its contributors may be used to", - " endorse or promote products derived from this software without specific", - " prior written permission.", - "", - "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND", - "ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED", - "WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE", - "DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR", - "ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES", - "(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;", - "LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON", - "ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT", - "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS", - "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - ], - "isProd": true -}, -{ - "name": "libchromiumcontent", - "version": "45.0.2454.85 ", - "license": "MIT", - "repositoryURL": "https://github.com/atom/libchromiumcontent", - "isProd": true -}, -{ - "name": "nodejs", - "version": "4.1.1", - "repositoryURL": "https://github.com/nodejs/node", - "isProd": true -}, -{ - "name": "electron", - "version": "0.34.1", - "license": "MIT", - "repositoryURL": "https://github.com/atom/electron", - "isProd": true -}, -{ - "name": "inno setup", - "version": "5.5.6", - "repositoryURL": "https://github.com/jrsoftware/issrc", - "isProd": true -}, - - -// ---------------------------------------------------------- -// The following definitions are here for the sole purpose of -// defining licenses for dependencies where licensing cannot -// be inferred by tooling: - -{ - // Reason: LICENSE file missing in repo - // SOURCE: https://github.com/isaacs/core-util-is/blob/master/lib/util.js - "name":"core-util-is", - "isLicense": true, - "licenseDetail": [ - "Copyright Joyent, Inc. and other Node contributors.", - "", - "Permission is hereby granted, free of charge, to any person obtaining a", - "copy of this software and associated documentation files (the", - "\"Software\"), to deal in the Software without restriction, including", - "without limitation the rights to use, copy, modify, merge, publish,", - "distribute, sublicense, and/or sell copies of the Software, and to permit", - "persons to whom the Software is furnished to do so, subject to the", - "following conditions:", - "", - "The above copyright notice and this permission notice shall be included", - "in all copies or substantial portions of the Software.", - "", - "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", - "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF", - "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN", - "NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,", - "DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR", - "OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE", - "USE OR OTHER DEALINGS IN THE SOFTWARE." - ] -}, -{ - // Reason: vscode-textmate is not public yet - // TODO: Remove once vscode-textmate visibility is made public - "name": "vscode-textmate", - "isLicense": true, - "licenseDetail": [ - "The MIT License (MIT)", - "", - "Copyright (c) Microsoft Corporation", - "", - "Permission is hereby granted, free of charge, to any person obtaining a copy", - "of this software and associated documentation files (the \"Software\"), to deal", - "in the Software without restriction, including without limitation the rights", - "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell", - "copies of the Software, and to permit persons to whom the Software is", - "furnished to do so, subject to the following conditions:", - "", - "The above copyright notice and this permission notice shall be included in all", - "copies or substantial portions of the Software.", - "", - "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR", - "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", - "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE", - "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", - "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,", - "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE", - "SOFTWARE." - ] -}, -{ - // Reason: LICENSE file missing in repo - "name": "winreg", - "isLicense": true, - "licenseDetail": [ - "Copyright (c) Paul Bottin", - "", - "The BSD License", - "", - "Redistribution and use in source and binary forms, with or without", - "modification, are permitted provided that the following conditions", - "are met:", - "", - "1. Redistributions of source code must retain the above copyright", - " notice, this list of conditions and the following disclaimer.", - "", - "2. Redistributions in binary form must reproduce the above copyright", - " notice, this list of conditions and the following disclaimer in the", - " documentation and/or other materials provided with the distribution.", - "", - "THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND", - "ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE", - "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR", - "PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS", - "BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR", - "CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF", - "SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR", - "BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,", - "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE", - "OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN", - "IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - ] -}, -{ - // Reason: LICENSE file doesn't have Copyright statement - "name": "readdirp", - "isLicense": true, - "licenseDetail": [ - "This software is released under the MIT license:", - "", - "Copyright (c) Thorsten Lorenz", - "", - "Permission is hereby granted, free of charge, to any person obtaining a copy of", - "this software and associated documentation files (the \"Software\"), to deal in", - "the Software without restriction, including without limitation the rights to", - "use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of", - "the Software, and to permit persons to whom the Software is furnished to do so,", - "subject to the following conditions:", - "", - "The above copyright notice and this permission notice shall be included in all", - "copies or substantial portions of the Software.", - "", - "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR", - "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS", - "FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR", - "COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER", - "IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN", - "CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." - ] -} - -] +// Listing in here platform dependencies that come in at build time + +[{ + "name": "atom-brightray", + "repositoryURL": "https://github.com/atom/brightray", + "license": "MIT", + "isProd": true +}, +{ + "name": "chromium", + "version": "45.0.2454.85", + "repositoryURL": "http://www.chromium.org/Home", + "licenseDetail": [ + "BSD License", + "", + "Copyright 2014 The Chromium Authors. All rights reserved.", + "", + "Redistribution and use in source and binary forms, with or without modification,", + "are permitted provided that the following conditions are met:", + "", + " * Redistributions of source code must retain the above copyright notice, this", + " list of conditions and the following disclaimer.", + "", + " * Redistributions in binary form must reproduce the above copyright notice,", + " this list of conditions and the following disclaimer in the documentation", + " and/or other materials provided with the distribution.", + "", + " * Neither the name Google Inc. nor the names of its contributors may be used to", + " endorse or promote products derived from this software without specific", + " prior written permission.", + "", + "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND", + "ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED", + "WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE", + "DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR", + "ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES", + "(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;", + "LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON", + "ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT", + "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS", + "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + ], + "isProd": true +}, +{ + "name": "libchromiumcontent", + "version": "45.0.2454.85 ", + "license": "MIT", + "repositoryURL": "https://github.com/atom/libchromiumcontent", + "isProd": true +}, +{ + "name": "nodejs", + "version": "4.1.1", + "repositoryURL": "https://github.com/nodejs/node", + "isProd": true +}, +{ + "name": "electron", + "version": "0.34.5", + "license": "MIT", + "repositoryURL": "https://github.com/atom/electron", + "isProd": true +}, +{ + "name": "inno setup", + "version": "5.5.6", + "repositoryURL": "https://github.com/jrsoftware/issrc", + "isProd": true +}, + + +// ---------------------------------------------------------- +// The following definitions are here for the sole purpose of +// defining licenses for dependencies where licensing cannot +// be inferred by tooling: + +{ + // Reason: LICENSE file missing in repo + // SOURCE: https://github.com/isaacs/core-util-is/blob/master/lib/util.js + "name":"core-util-is", + "isLicense": true, + "licenseDetail": [ + "Copyright Joyent, Inc. and other Node contributors.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a", + "copy of this software and associated documentation files (the", + "\"Software\"), to deal in the Software without restriction, including", + "without limitation the rights to use, copy, modify, merge, publish,", + "distribute, sublicense, and/or sell copies of the Software, and to permit", + "persons to whom the Software is furnished to do so, subject to the", + "following conditions:", + "", + "The above copyright notice and this permission notice shall be included", + "in all copies or substantial portions of the Software.", + "", + "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF", + "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN", + "NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,", + "DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR", + "OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE", + "USE OR OTHER DEALINGS IN THE SOFTWARE." + ] +}, +{ + // Reason: vscode-textmate is not public yet + // TODO: Remove once vscode-textmate visibility is made public + "name": "vscode-textmate", + "isLicense": true, + "licenseDetail": [ + "The MIT License (MIT)", + "", + "Copyright (c) Microsoft Corporation", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and associated documentation files (the \"Software\"), to deal", + "in the Software without restriction, including without limitation the rights", + "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell", + "copies of the Software, and to permit persons to whom the Software is", + "furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in all", + "copies or substantial portions of the Software.", + "", + "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR", + "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE", + "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,", + "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE", + "SOFTWARE." + ] +}, +{ + // Reason: LICENSE file missing in repo + "name": "winreg", + "isLicense": true, + "licenseDetail": [ + "Copyright (c) Paul Bottin", + "", + "The BSD License", + "", + "Redistribution and use in source and binary forms, with or without", + "modification, are permitted provided that the following conditions", + "are met:", + "", + "1. Redistributions of source code must retain the above copyright", + " notice, this list of conditions and the following disclaimer.", + "", + "2. Redistributions in binary form must reproduce the above copyright", + " notice, this list of conditions and the following disclaimer in the", + " documentation and/or other materials provided with the distribution.", + "", + "THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND", + "ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE", + "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR", + "PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS", + "BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR", + "CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF", + "SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR", + "BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,", + "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE", + "OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN", + "IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + ] +}, +{ + // Reason: LICENSE file doesn't have Copyright statement + "name": "readdirp", + "isLicense": true, + "licenseDetail": [ + "This software is released under the MIT license:", + "", + "Copyright (c) Thorsten Lorenz", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy of", + "this software and associated documentation files (the \"Software\"), to deal in", + "the Software without restriction, including without limitation the rights to", + "use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of", + "the Software, and to permit persons to whom the Software is furnished to do so,", + "subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in all", + "copies or substantial portions of the Software.", + "", + "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR", + "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS", + "FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR", + "COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER", + "IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN", + "CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." + ] +} + +] diff --git a/README.md b/README.md index 5f405d9a8c2..f3ef3ceca03 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Visual Studio Code - Open Source -[![Build Status](https://travis-ci.org/Microsoft/vscode.svg?branch=master)](https://travis-ci.org/Microsoft/vscode) +[![Build Status](https://travis-ci.org/Microsoft/vscode.svg?branch=master)](https://travis-ci.org/Microsoft/vscode) [![Build status](https://ci.appveyor.com/api/projects/status/vuhlhg80tj3e2a0l?svg=true)](https://ci.appveyor.com/project/VSCode/vscode) [VS Code](http://code.visualstudio.com) is a new type of tool that combines the simplicity of a code editor with what developers need for their core edit-build-debug cycle. Code provides comprehensive editing and debugging support, an extensibility model, and lightweight integration with existing tools. @@ -28,4 +28,4 @@ Many of the core components and extensions to Code live in their own repositorie For a complete list, please see the [Related Projects](https://github.com/Microsoft/vscode/wiki/Related-Projects) page on our wiki. ## License -[MIT](LICENSE.txt) \ No newline at end of file +[MIT](LICENSE.txt) diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000000..4092aa3f717 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,14 @@ +environment: + ATOM_SHELL_INTERNAL_RUN_AS_NODE: 1 + +install: + - ps: Install-Product node 4.1.1 x64 + - npm install -g gulp mocha + +build_script: + - .\scripts\npm.bat install --force + - gulp electron + - gulp compile + +test_script: + - mocha diff --git a/build/gulpfile.editor.js b/build/gulpfile.editor.js index 6c6798c5a0a..f1bd8355b35 100644 --- a/build/gulpfile.editor.js +++ b/build/gulpfile.editor.js @@ -14,7 +14,7 @@ var util = require('./lib/util'); var common = require('./gulpfile.common'); var root = path.dirname(__dirname); -var commit = process.env['BUILD_SOURCEVERSION'] || require('./lib/git').getVersion(root); +var commit = util.getVersion(root); // Build diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js new file mode 100644 index 00000000000..4744ab4513b --- /dev/null +++ b/build/gulpfile.hygiene.js @@ -0,0 +1,152 @@ +/*--------------------------------------------------------------------------------------------- + * 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 filter = require('gulp-filter'); +var es = require('event-stream'); +var path = require('path'); + +var all = [ + 'build/**/*', + 'extensions/**/*', + 'scripts/**/*', + 'src/**/*', + 'test/**/*' +]; + +var eolFilter = [ + '**', + '!extensions/**/out/**', + '!**/node_modules/**', + '!**/fixtures/**', + '!**/*.{svg,exe,png,scpt,bat,cur,ttf,woff,eot}', +]; + +var indentationFilter = [ + '**', + '!**/lib/**', + '!**/*.d.ts', + '!extensions/typescript/server/**', + '!test/assert.js', + '!**/package.json', + '!**/npm-shrinkwrap.json', + '!**/octicons/**', + '!**/vs/languages/sass/test/common/example.scss', + '!**/vs/languages/less/common/parser/less.grammar.txt', + '!**/vs/languages/css/common/buildscripts/css-schema.xml', + '!**/vs/languages/markdown/common/raw.marked.js', + '!**/vs/base/common/winjs.base.raw.js', + '!**/vs/base/node/terminateProcess.sh', + '!**/vs/base/node/terminateProcess.sh', + '!**/vs/text.js', + '!**/vs/nls.js', + '!**/vs/css.js', + '!**/vs/loader.js', + '!extensions/**/snippets/**', + '!extensions/**/syntaxes/**', + '!extensions/**/themes/**', +]; + +var copyrightFilterList = [ + '**', + '!**/*.json', + '!**/*.html', + '!**/test/**', + '!**/*.md', + '!**/*.sh', + '!**/*.txt', + '!src/vs/editor/standalone-languages/swift.ts', +]; + +var copyrightHeader = [ + '/*---------------------------------------------------------------------------------------------', + ' * Copyright (c) Microsoft Corporation. All rights reserved.', + ' * Licensed under the MIT License. See License.txt in the project root for license information.', + ' *--------------------------------------------------------------------------------------------*/' +].join('\n'); + +var hygiene = exports.hygiene = function (some) { + var errorCount = 0; + + var eol = es.through(function (file) { + if (/\r\n?/g.test(file.contents.toString('utf8'))) { + console.error(file.relative + ': Bad EOL found'); + errorCount++; + } + + this.emit('data', file); + }); + + var indentation = es.through(function (file) { + file.contents + .toString('utf8') + .split(/\r\n|\r|\n/) + .forEach(function(line, i) { + if (/^\s*$/.test(line)) { + // empty or whitespace lines are OK + } else if (/^[\t]*[^\s]/.test(line)) { + // good indent + } else if (/^[\t]* \*/.test(line)) { + // block comment using an extra space + } else { + console.error(file.relative + '(' + (i + 1) + ',1): Bad whitespace indentation'); + errorCount++; + } + }); + + this.emit('data', file); + }); + + var copyrights = es.through(function (file) { + if (file.contents.toString('utf8').indexOf(copyrightHeader) !== 0) { + console.error(file.relative + ': Missing or bad copyright statement'); + errorCount++; + } + + this.emit('data', file); + }); + + return gulp.src(some || all, { base: '.' }) + .pipe(filter(function (f) { return !f.stat.isDirectory(); })) + .pipe(filter(eolFilter)) + .pipe(eol) + .pipe(filter(indentationFilter)) + .pipe(indentation) + .pipe(filter(copyrightFilterList)) + .pipe(copyrights) + .pipe(es.through(null, function () { + if (errorCount > 0) { + this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'build/gulpfile.hygiene.js\'.'); + } else { + this.emit('end'); + } + })); +}; + +gulp.task('hygiene', function () { + return hygiene(); +}); + +// this allows us to run this as a git pre-commit hook +if (require.main === module) { + var cp = require('child_process'); + cp.exec('git diff --cached --name-only', function (err, out) { + if (err) { + console.error(); + console.error(err); + process.exit(1); + } + + var some = out + .split(/\r?\n/) + .filter(function (l) { return !!l; }); + + hygiene(some).on('error', function (err) { + console.error(); + console.error(err); + process.exit(1); + }); + }); +} diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index b3a0cb057d7..55367db027b 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -25,7 +25,8 @@ var util = require('./lib/util'); var buildfile = require('../src/buildfile'); var common = require('./gulpfile.common'); var root = path.dirname(__dirname); -var commit = process.env['BUILD_SOURCEVERSION'] || require('./lib/git').getVersion(root); +var build = path.join(root, '.build'); +var commit = util.getVersion(root); var baseModules = [ 'app', 'applicationinsights', 'assert', 'auto-updater', 'browser-window', @@ -34,11 +35,15 @@ var baseModules = [ 'https', 'https-proxy-agent', 'iconv-lite', 'ipc', 'menu', 'menu-item', 'net', 'original-fs', 'os', 'path', 'readline', 'remote', 'sax', 'screen', 'semver', 'shell', 'stream', 'string_decoder', 'url', 'vscode-textmate', 'web-frame', 'winreg', - 'yauzl' + 'yauzl', 'native-keymap' ]; // Build +var builtInExtensions = { + 'jrieken.vscode-omnisharp': '0.1.0', +}; + var vscodeEntryPoints = _.flatten([ buildfile.entrypoint('vs/workbench/workbench.main'), buildfile.base, @@ -112,7 +117,7 @@ var config = { gulp.task('electron', function () { // Force windows to use ia32 var arch = (process.platform === 'win32' ? 'ia32' : process.arch); - return electron.dest(path.join(path.dirname(root), 'Electron-Build'), _.extend({}, config, { arch: arch })); + return electron.dest(path.join(build, 'electron'), _.extend({}, config, { arch: arch })); }); function mixinProduct() { @@ -161,12 +166,7 @@ function packageTask(platform, arch, opts) { 'extensions/**', '!extensions/*/src/**', '!extensions/*/out/**/test/**', - '!extensions/typescript/bin/**', - '!extensions/csharp-o/node_modules/del/**', - '!extensions/csharp-o/node_modules/gulp/**', - '!extensions/csharp-o/node_modules/gulp-decompress/**', - '!extensions/csharp-o/node_modules/gulp-download/**', - '!extensions/csharp-o/node_modules/typescript/**' + '!extensions/typescript/bin/**' ], { base: '.' }); var pluginHostSourceMap = gulp.src(out + '/vs/workbench/node/pluginHostProcess.js.map', { base: '.' }) @@ -182,8 +182,9 @@ function packageTask(platform, arch, opts) { var license = gulp.src(['Credits_*', 'LICENSE.txt', 'ThirdPartyNotices.txt'], { base: '.' }); var api = gulp.src('src/vs/vscode.d.ts').pipe(rename('out/vs/vscode.d.ts')); - var depsSrc = _.flatten(Object.keys(packagejson.dependencies) - .map(function (d) { return ['node_modules/' + d + '/**', '!node_modules/' + d + '/**/{test,tests}/**']; })); + var depsSrc = _.flatten(Object.keys(packagejson.dependencies).concat(Object.keys(packagejson.optionalDependencies)) + .map(function (d) { return ['node_modules/' + d + '/**', '!node_modules/' + d + '/**/{test,tests}/**']; }) + ); var deps = gulp.src(depsSrc, { base: '.', dot: true }) .pipe(util.cleanNodeModule('fsevents', ['binding.gyp', 'fsevents.cc', 'build/**', 'src/**', 'test/**'], true)) @@ -197,6 +198,11 @@ function packageTask(platform, arch, opts) { resources = es.merge(resources, gulp.src(product.icons.application.png, { base: '.' })); } + var extraExtensions = util.downloadExtensions(builtInExtensions) + .pipe(rename(function (p) { + p.dirname = path.posix.join('extensions', p.dirname); + })); + var all = es.merge( api, packageJson, @@ -204,6 +210,7 @@ function packageTask(platform, arch, opts) { license, sources, deps, + extraExtensions, resources ).pipe(util.skipDirectories()); diff --git a/build/lib/copyrights.js b/build/lib/copyrights.js deleted file mode 100644 index b468398bc60..00000000000 --- a/build/lib/copyrights.js +++ /dev/null @@ -1,36 +0,0 @@ -var es = require('event-stream'); -var fs = require('fs'); -var path = require('path'); - -var copyright = [ - '/*---------------------------------------------------------------------------------------------', - ' * Copyright (c) Microsoft Corporation. All rights reserved.', - ' * Licensed under the MIT License. See License.txt in the project root for license information.', - ' *--------------------------------------------------------------------------------------------*/' -].join('\n'); - - -exports.copyrights = function () { - return es.mapSync(function (file) { - if (file.contents) { - var contents = file.contents.toString('utf8'); - - if (contents.indexOf(copyright) !== 0) { - throw new Error('File ' + file.path + ' does not contain copyright statement.'); - } - } - }); -}; - -exports.insertCopyrights = function() { - return es.mapSync(function (file) { - if (file.contents) { - var contents = file.contents.toString('utf8'); - - if (contents.indexOf(copyright) !== 0) { - contents = copyright + '\n\n' + contents; - fs.writeFileSync(file.path, contents, 'utf8'); - } - } - }); -} diff --git a/build/lib/style.js b/build/lib/style.js deleted file mode 100644 index d9d890d37ce..00000000000 --- a/build/lib/style.js +++ /dev/null @@ -1,60 +0,0 @@ -var es = require('event-stream'); -var path = require('path'); - -module.exports = function (opts) { - return es.mapSync(function (file) { - if (file.stat.isDirectory()) { - return file; - } - var contents = file.contents.toString('utf8'); - - if (opts.complain) { - if (contents.indexOf('\r\n') >= 0) { - console.log(file.path + ' uses \\r\\n'); - } - - if (opts.whitespace) { - var lines = contents.split(/\r\n|\r|\n/); - for (var i = 0, len = lines.length; i < len; i++) { - var line = lines[i]; - if (line.length === 0) { - // empty lines are OK - continue; - } - - if (/^[\t]*[^\s]/.test(line)) { - // good indent - continue; - } else if (/^[\t]* \*/.test(line)) { - // block comment using an extra space - continue; - } else if (/^[\t]+$/.test(line)) { - // empty line - continue; - } else { - console.log(file.path + '(' + (i + 1) + ',1): Mixed whitespace indentation'); - } - } - } - } else { - var lines = contents.split(/\r\n|\r|\n/); - - if (opts.whitespace) { - for (var i = 0, len = lines.length; i < len; i++) { - var line = lines[i]; - line = line.replace(/^\ {28}/, '\t\t\t\t\t\t\t'); - line = line.replace(/^\ {24}/, '\t\t\t\t\t\t'); - line = line.replace(/^\ {20}/, '\t\t\t\t\t'); - line = line.replace(/^\ {16}/, '\t\t\t\t'); - line = line.replace(/^\ {12}/, '\t\t\t'); - line = line.replace(/^\ {8}/, '\t\t'); - line = line.replace(/^\ {4}/, '\t'); - lines[i] = line; - } - } - - file.contents = new Buffer(lines.join('\n'), 'utf8'); - } - return file; - }); -}; diff --git a/build/lib/util.js b/build/lib/util.js index 5bb82a71055..7424e8e6876 100644 --- a/build/lib/util.js +++ b/build/lib/util.js @@ -10,6 +10,7 @@ var _ = require('underscore'); var path = require('path'); var fs = require('fs'); var rimraf = require('rimraf'); +var git = require('./git'); var NoCancellationToken = { isCancellationRequested: function () { @@ -275,4 +276,14 @@ exports.downloadExtensions = function(extensions) { }); return es.merge(streams); +}; + +exports.getVersion = function (root) { + var version = process.env['BUILD_SOURCEVERSION']; + + if (!version || !/^[0-9a-f]{40}$/i.test(version)) { + version = git.getVersion(root); + } + + return version; }; \ No newline at end of file diff --git a/build/npm/preinstall.js b/build/npm/preinstall.js new file mode 100644 index 00000000000..d70393040fd --- /dev/null +++ b/build/npm/preinstall.js @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +var win = "Please run '.\\scripts\\npm.bat install' instead." +var nix = "Please run './scripts/npm.sh install' instead." + +if (process.env['npm_config_disturl'] !== 'https://atom.io/download/atom-shell') { + console.error("You can't use plain npm to install Code's dependencies."); + console.error(/^win/.test(process.platform) ? win : nix); + process.exit(1); +} \ No newline at end of file diff --git a/extensions/csharp-o/.gitignore b/extensions/csharp-o/.gitignore deleted file mode 100644 index ba077a4031a..00000000000 --- a/extensions/csharp-o/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/extensions/csharp-o/OSSREADME.json b/extensions/csharp-o/OSSREADME.json deleted file mode 100644 index efd91bfec9a..00000000000 --- a/extensions/csharp-o/OSSREADME.json +++ /dev/null @@ -1,29 +0,0 @@ -[ - { - "name": "Omnisharp-roslyn", - "repositoryURL": "https://github.com/OmniSharp/omnisharp-roslyn", - "version": "1.5.5", - "license": "MIT", - "isProd": true - }, - { - "name": "ScriptCS", - "repositoryURL": "https://github.com/scriptcs/scriptcs", - "version": "0.16.0", - "license": "Apache2", - "licenseDetail": [ - "Copyright 2013 Glenn Block, Justin Rusbatch, Filip Wojcieszyn", - "", - "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file ", - "except in compliance with the License. You may obtain a copy of the License at", - "", - "http://www.apache.org/licenses/LICENSE-2.0", - "", - "Unless required by applicable law or agreed to in writing, software distributed under the ", - "License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ", - "either express or implied. See the License for the specific language governing permissions ", - "and limitations under the License." - ], - "isProd": true - } -] \ No newline at end of file diff --git a/extensions/csharp-o/gulpfile.js b/extensions/csharp-o/gulpfile.js deleted file mode 100644 index b78077bd37a..00000000000 --- a/extensions/csharp-o/gulpfile.js +++ /dev/null @@ -1,93 +0,0 @@ -var gulp = require('gulp'); -var decompress = require('gulp-decompress'); -var es = require('event-stream'); -var GitHub = require('github-releases'); -var tmp = require('tmp'); -var vfs = require('vinyl-fs'); -var del = require('del'); -var fs = require('fs'); -var path = require('path'); - -tmp.setGracefulCleanup(); - -function downloadOmnisharp(version) { - var result = es.through(); - - function onError(err) { - result.emit('error', err); - } - - var repo = new GitHub({ - repo: 'OmniSharp/omnisharp-roslyn', - token: process.env['GITHUB_TOKEN'] - }); - - repo.getReleases({ tag_name: version }, function (err, releases) { - if (err) { return onError(err); } - if (!releases.length) { return onError(new Error('Release not found')); } - if (!releases[0].assets.length) { return onError(new Error('Assets not found')); } - - repo.downloadAsset(releases[0].assets[0], function (err, istream) { - if (err) { return onError(err); } - - tmp.file(function (err, tmpPath, fd, cleanupCallback) { - if (err) { return onError(err); } - - var ostream = fs.createWriteStream(null, { fd: fd }); - ostream.once('error', onError); - istream.once('error', onError); - ostream.once('finish', function () { - vfs.src(tmpPath).pipe(result); - }); - istream.pipe(ostream); - }); - }); - }); - - return result; -} - -gulp.task('omnisharp:clean', function () { - return del('bin'); -}); - -gulp.task('omnisharp:fetch', ['omnisharp:clean'], function () { - return downloadOmnisharp('v1.5.6') - .pipe(decompress({strip: 1})) - .pipe(gulp.dest('bin')); -}); - -gulp.task('omnisharp:fixscripts', ['omnisharp:fetch'], function () { - - var _fixes = Object.create(null); - _fixes['./bin/omnisharp.cmd'] = '@"%~dp0packages\\dnx-clr-win-x86.1.0.0-beta4\\bin\\dnx.exe" "%~dp0packages\\OmniSharp\\1.0.0\\root" run %*'; - _fixes['./bin/omnisharp'] = '#!/bin/bash\n\ -SOURCE="${BASH_SOURCE[0]}"\n\ -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink\n\ - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"\n\ - SOURCE="$(readlink "$SOURCE")"\n\ - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located\n\ -done\n\ -DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"\n\ -export SET DNX_APPBASE="$DIR/packages/OmniSharp/1.0.0/root"\n\ -export PATH=/usr/local/bin:/Library/Frameworks/Mono.framework/Commands:$PATH # this is required for the users of the Homebrew Mono package\n\ -exec "$DIR/packages/dnx-mono.1.0.0-beta4/bin/dnx" "$DNX_APPBASE" run "$@"\n\ -\n'; - - var promises = Object.keys(_fixes).map(function (key) { - return new Promise(function(resolve, reject) { - fs.writeFile(path.join(__dirname, key), _fixes[key], function (err) { - if (err) { - reject(err); - } else { - resolve(); - } - }) - }); - }); - - return Promise.all(promises) -}); - - -gulp.task('omnisharp', ['omnisharp:fixscripts']); \ No newline at end of file diff --git a/extensions/csharp-o/package.json b/extensions/csharp-o/package.json deleted file mode 100644 index 5a8833524a9..00000000000 --- a/extensions/csharp-o/package.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "name": "csharp-o", - "version": "0.1.0", - "publisher": "vscode", - "engines": { - "node": "^4.0.0", - "vscode": "*" - }, - "activationEvents": [ - "onLanguage:csharp", - "onCommand:o.restart", - "onCommand:o.pickProjectAndStart", - "onCommand:o.restore", - "onCommand:o.execute", - "onCommand:o.showOutput", - "onCommand:o.execute", - "onCommand:o.execute-last-command" - ], - "main": "./out/omnisharpMain", - "scripts": { - "postinstall": "node ./node_modules/gulp/bin/gulp.js omnisharp", - "vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../gulpfile.plugins.js compile-plugin:csharp-o ./tsconfig.json" - }, - "dependencies": { - "run-in-terminal": "*", - "semver": "*" - }, - "devDependencies": { - "del": "^2.0.2", - "event-stream": "^3.3.2", - "github-releases": "^0.3.0", - "gulp": "^3.8.9", - "gulp-decompress": "^1.2.0", - "tmp": "0.0.28", - "vinyl-fs": "^2.2.1" - }, - "extensionDependencies": [ - "vscode.csharp" - ], - "contributes": { - "commands": [ - { - "command": "o.restart", - "title": "Restart OmniSharp", - "category": "OmniSharp" - }, - { - "command": "o.pickProjectAndStart", - "title": "Select Project", - "category": "OmniSharp" - }, - { - "command": "o.restore", - "title": "Restore Packages", - "category": "dnx" - }, - { - "command": "o.execute", - "title": "Run Command", - "category": "dnx" - } - ], - "keybindings": [ - { - "command": "o.showOutput", - "key": "Ctrl+L L", - "mac": "Cmd+L L" - }, - { - "command": "o.execute", - "key": "Ctrl+L Shift+R", - "mac": "Cmd+L Shift+R" - }, - { - "command": "o.execute-last-command", - "key": "Ctrl+L R", - "mac": "Cmd+L R" - }, - { - "key": "shift+0", - "command": "^acceptSelectedSuggestion", - "when": "editorTextFocus && suggestWidgetVisible && editorLangId == 'csharp' && suggestionSupportsAcceptOnKey" - }, - { - "key": "shift+9", - "command": "^acceptSelectedSuggestion", - "when": "editorTextFocus && suggestWidgetVisible && editorLangId == 'csharp' && suggestionSupportsAcceptOnKey" - }, - { - "key": ".", - "command": "^acceptSelectedSuggestion", - "when": "editorTextFocus && suggestWidgetVisible && editorLangId == 'csharp' && suggestionSupportsAcceptOnKey" - } - ], - "snippets": [ - { - "language": "csharp", - "path": "./snippets/csharp.json" - } - ] - } -} diff --git a/extensions/csharp-o/snippets/csharp.json b/extensions/csharp-o/snippets/csharp.json deleted file mode 100644 index 51035c35935..00000000000 --- a/extensions/csharp-o/snippets/csharp.json +++ /dev/null @@ -1,524 +0,0 @@ -{ - "Attribute using recommended pattern": { - - "prefix": "attribute", - "body": [ - "[System.AttributeUsage(System.AttributeTargets.${All}, Inherited = ${false}, AllowMultiple = ${true})]", - "sealed class ${My}Attribute : System.Attribute", - "{", - " // See the attribute guidelines at", - " // http://go.microsoft.com/fwlink/?LinkId=85236", - " readonly string positionalString;", - " ", - " // This is a positional argument", - " public ${My}Attribute (string positionalString)", - " {", - " this.positionalString = positionalString;", - " ", - " // TODO: Implement code here", - " ${throw new System.NotImplementedException();}", - " }", - " ", - " public string PositionalString", - " {", - " get { return positionalString; }", - " }", - " ", - " // This is a named argument", - " public int NamedInt { get; set; }", - "}" - ], - "description": "Attribute using recommended pattern" - }, - - "Checked block": { - - "prefix": "checked", - "body": [ - "checked", - "{", - " $0", - "}" - ], - "description": "Checked block" - }, - - "Class": { - - "prefix": "class", - "body": [ - "class ${Name}", - "{", - " $0", - "}" - ], - "description": "Class" - }, - - "Console.WriteLine": { - - "prefix": "cw", - "body": [ - "System.Console.WriteLine($0);" - ], - "description": "Console.WriteLine" - }, - - "do...while loop": { - - "prefix": "do", - "body": [ - "do", - "{", - " $0", - "} while (${true});" - ], - "description": "do...while loop" - }, - - "Else statement": { - - "prefix": "else", - "body": [ - "else", - "{", - " $0", - "}" - ], - "description": "Else statement" - }, - - "Enum": { - - "prefix": "enum", - "body": [ - "enum ${Name}", - "{", - " $0", - "}" - ], - "description": "Enum" - }, - - "Implementing Equals() according to guidelines": { - - "prefix": "equals", - "body": [ - "// override object.Equals", - "public override bool Equals (object obj)", - "{", - " //", - " // See the full list of guidelines at", - " // http://go.microsoft.com/fwlink/?LinkID=85237", - " // and also the guidance for operator== at", - " // http://go.microsoft.com/fwlink/?LinkId=85238", - " //", - " ", - " if (obj == null || GetType() != obj.GetType())", - " {", - " return false;", - " }", - " ", - " // TODO: write your implementation of Equals() here", - " ${1:throw new System.NotImplementedException();}", - " return base.Equals (obj);", - "}", - "", - "// override object.GetHashCode", - "public override int GetHashCode()", - "{", - " // TODO: write your implementation of GetHashCode() here", - " ${2:throw new System.NotImplementedException();}", - " return base.GetHashCode();", - "}" - ], - "description": "Implementing Equals() according to guidelines" - }, - - "Exception": { - - "prefix": "exception", - "body": [ - "[System.Serializable]", - "public class ${My}Exception : ${System.Exception}", - "{", - " public ${My}Exception() { }", - " public ${My}Exception( string message ) : base( message ) { }", - " public ${My}Exception( string message, System.Exception inner ) : base( message, inner ) { }", - " protected ${My}Exception(", - " System.Runtime.Serialization.SerializationInfo info,", - " System.Runtime.Serialization.StreamingContext context ) : base( info, context ) { }", - "}" - ], - "description": "Exception" - }, - - "Foreach statement": { - - "prefix": "foreach", - "body": [ - "foreach (${var} ${item} in ${collection})", - "{", - " $0", - "}" - ], - "description": "Foreach statement" - }, - - "Reverse for loop": { - - "prefix": "forr", - "body": [ - "for (int ${i} = ${length} - 1; ${i} >= 0 ; ${i}--)", - "{", - " $0", - "}" - ], - "description": "Reverse for loop" - }, - - "for loop": { - - "prefix": "for", - "body": [ - "for (int ${i} = 0; ${i} < ${length}; ${i}++)", - "{", - " $0", - "}" - ], - "description": "for loop" - }, - - "if statement": { - - "prefix": "if", - "body": [ - "if (${true})", - "{", - " $0", - "}" - ], - "description": "if statement" - }, - - "Indexer": { - - "prefix": "indexer", - "body": [ - "${public} ${object} this[${int} index]", - "{", - " get { $0 }", - " set { $1 }", - "}" - ], - "description": "Indexer" - }, - - "Interface": { - - "prefix": "interface", - "body": [ - "interface I${Name}", - "{", - " $0", - "}" - ], - "description": "Interface" - }, - - "Safely invoking an event": { - - "prefix": "invoke", - "body": [ - "${EventHandler} temp = ${MyEvent};", - "if (temp != null)", - "{", - " temp($0);", - "}" - ], - "description": "Safely invoking an event" - }, - - "Simple iterator": { - - "prefix": "iterator", - "body": [ - "public System.Collections.Generic.IEnumerator<${ElementType}> GetEnumerator()", - "{", - " $0throw new System.NotImplementedException();", - " yield return default(${ElementType});", - "}" - ], - "description": "Simple iterator" - }, - - "Named iterator/indexer pair using a nested class": { - - "prefix": "iterindex", - "body": [ - "public ${Name}Iterator ${Name}", - "{", - " get", - " {", - " return new ${Name}Iterator(this);", - " }", - "}", - "", - "public class ${Name}Iterator", - "{", - " readonly ${ClassName} outer;", - " ", - " internal ${Name}Iterator(${ClassName} outer)", - " {", - " this.outer = outer;", - " }", - " ", - " // TODO: provide an appropriate implementation here", - " public int Length { get { return 1; } }", - " ", - " public ${ElementType} this[int index]", - " {", - " get", - " {", - " //", - " // TODO: implement indexer here", - " //", - " // you have full access to ${ClassName} privates", - " //", - " ${throw new System.NotImplementedException();}", - " return default(${ElementType});", - " }", - " }", - " ", - " public System.Collections.Generic.IEnumerator<${ElementType}> GetEnumerator()", - " {", - " for (int i = 0; i < this.Length; i++)", - " {", - " yield return this[i];", - " }", - " }", - "}" - ], - "description": "Named iterator/indexer pair using a nested class" - }, - - "Lock statement": { - - "prefix": "lock", - "body": [ - "lock (${this})", - "{", - " $0", - "}" - ], - "description": "Lock statement" - }, - - "MessageBox.Show": { - - "prefix": "mbox", - "body": [ - "System.Windows.Forms.MessageBox.Show(\"${Text}\");$0" - ], - "description": "MessageBox.Show" - }, - - "Namespace": { - - "prefix": "namespace", - "body": [ - "namespace ${Name}", - "{", - " $0", - "}" - ], - "description": "Namespace" - }, - - "#if": { - - "prefix": "ifd", - "body": [ - "#if ${true}", - " $0", - "#endif" - ], - "description": "#if" - }, - - "#region": { - - "prefix": "region", - "body": [ - "#region ${Name}", - " $0", - "#endregion" - ], - "description": "#region" - }, - - "Property and backing field": { - - "prefix": "propfull", - "body": [ - "private ${int} ${myVar};", - - "public ${int} ${MyProperty}", - "{", - " get { return ${myVar};}", - " set { ${myVar} = value;}", - "}", - "$0" - ], - "description": "Property and backing field" - }, - - "propg": { - - "prefix": "propg", - "body": [ - "public ${int} ${MyProperty} { get; private set; }$0" - ], - "description": "An automatically implemented property with a 'get' accessor and a private 'set' accessor. C# 3.0 or higher" - }, - - "prop": { - - "prefix": "prop", - "body": [ - "public ${int} ${MyProperty} { get; set; }$0" - ], - "description": "An automatically implemented property. C# 3.0 or higher" - }, - - "sim": { - - "prefix": "sim", - "body": [ - "static int Main(string[] args)", - "{", - " $0", - " return 0;", - "}" - ], - "description": "int Main()" - }, - - "Struct": { - - "prefix": "struct", - "body": [ - "struct ${Name}", - "{", - " $0", - "}" - ], - "description": "Struct" - }, - - "svm": { - - "prefix": "svm", - "body": [ - "static void Main(string[] args)", - "{", - " $0", - "}" - ], - "description": "void Main()" - }, - - "Switch statement": { - - "prefix": "switch", - "body": [ - "switch (${switch_on})", - "{", - " $0", - " default:", - "}" - ], - "description": "Switch statement" - }, - - "Try finally": { - - "prefix": "tryf", - "body": [ - "try", - "{", - " ${_}", - "}", - "finally", - "{", - " $0", - "}" - ], - "description": "Try finally" - }, - - "Try catch": { - - "prefix": "try", - "body": [ - "try", - "{", - " ${_}", - "}", - "catch (${System.Exception})", - "{", - " $0", - " throw;", - "}" - ], - "description": "Try catch" - }, - - "Unchecked block": { - - "prefix": "unchecked", - "body": [ - "unchecked", - "{", - " $0", - "}" - ], - "description": "Unchecked block" - }, - - "Unsafe statement": { - - "prefix": "unsafe", - "body": [ - "unsafe", - "{", - " $0", - "}" - ], - "description": "Unsafe statement" - }, - - "Using statement": { - - "prefix": "using", - "body": [ - "using(${resource})", - "{", - " $0", - "}" - ], - "description": "Using statement" - }, - - "While loop": { - - "prefix": "while", - "body": [ - "while (${true})", - "{", - " $0", - "}" - ], - "description": "While loop" - } -} \ No newline at end of file diff --git a/extensions/csharp-o/src/features/abstractProvider.ts b/extensions/csharp-o/src/features/abstractProvider.ts deleted file mode 100644 index e0b2264417c..00000000000 --- a/extensions/csharp-o/src/features/abstractProvider.ts +++ /dev/null @@ -1,26 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 {OmnisharpServer} from '../omnisharpServer'; -import {Disposable} from 'vscode'; - -export default class AbstractProvider { - - protected _server: OmnisharpServer; - protected _disposables: Disposable[]; - - constructor(server: OmnisharpServer) { - this._server = server; - this._disposables = []; - } - - dispose() { - while (this._disposables.length) { - this._disposables.pop().dispose(); - } - } -} diff --git a/extensions/csharp-o/src/features/changeForwarding.ts b/extensions/csharp-o/src/features/changeForwarding.ts deleted file mode 100644 index c9d32fb7d60..00000000000 --- a/extensions/csharp-o/src/features/changeForwarding.ts +++ /dev/null @@ -1,62 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 {Disposable, Uri, workspace} from 'vscode'; -import {OmnisharpServer} from '../omnisharpServer'; -import * as proto from '../protocol'; - -function forwardDocumentChanges(server: OmnisharpServer): Disposable { - - return workspace.onDidChangeTextDocument(event => { - - let {document} = event; - if (document.isUntitled || document.languageId !== 'csharp') { - return; - } - - if (!server.isRunning()) { - return; - } - - server.makeRequest(proto.UpdateBuffer, { - Buffer: document.getText(), - Filename: document.fileName - }).catch(err => { - console.error(err); - return err; - }); - }); -} - -function forwardFileChanges(server: OmnisharpServer): Disposable { - - function onFileSystemEvent(uri: Uri): void { - if (!server.isRunning()) { - return; - } - let req = { Filename: uri.fsPath }; - server.makeRequest(proto.FilesChanged, [req]).catch(err => { - console.warn('[o] failed to forward file change event for ' + uri.fsPath, err); - return err; - }); - } - - const watcher = workspace.createFileSystemWatcher('**/*.*'); - let d1 = watcher.onDidCreate(onFileSystemEvent); - let d2 = watcher.onDidChange(onFileSystemEvent); - let d3 = watcher.onDidDelete(onFileSystemEvent); - - return Disposable.from(watcher, d1, d2, d3); -} - -export default function forwardChanges(server: OmnisharpServer): Disposable { - - // combine file watching and text document watching - return Disposable.from( - forwardDocumentChanges(server), - forwardFileChanges(server)); -} diff --git a/extensions/csharp-o/src/features/codeActionProvider.ts b/extensions/csharp-o/src/features/codeActionProvider.ts deleted file mode 100644 index 6cb11e69873..00000000000 --- a/extensions/csharp-o/src/features/codeActionProvider.ts +++ /dev/null @@ -1,98 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 {CodeActionProvider, CodeActionContext, Command, CancellationToken, TextDocument, WorkspaceEdit, TextEdit, Range, Uri, workspace, commands} from 'vscode'; -import {OmnisharpServer} from '../omnisharpServer'; -import AbstractProvider from './abstractProvider'; -import {TextChange, V2} from '../protocol'; -import {toRange2} from '../typeConvertion'; - -export default class OmnisharpCodeActionProvider extends AbstractProvider implements CodeActionProvider { - - private _disabled: boolean; - private _commandId: string; - - constructor(server: OmnisharpServer) { - super(server); - this._commandId = 'omnisharp.runCodeAction'; - - this._updateEnablement(); - let d1 = workspace.onDidChangeConfiguration(this._updateEnablement, this); - let d2 = commands.registerCommand(this._commandId, this._runCodeAction, this); - this._disposables.push(d1, d2); - } - - private _updateEnablement(): void { - let value = workspace.getConfiguration().get('csharp.disableCodeActions', false); - this._disabled = value; - } - - public provideCodeActions(document: TextDocument, range: Range, context: CodeActionContext, token: CancellationToken): Promise { - - if (this._disabled) { - return; - } - - let req: V2.GetCodeActionsRequest = { - Filename: document.fileName, - Selection: OmnisharpCodeActionProvider._asRange(range) - } - - return this._server.makeRequest(V2.GetCodeActions, req, token).then(response => { - return response.CodeActions.map(ca => { - return { - title: ca.Name, - command: this._commandId, - arguments: [ca.Identifier, document, range] - }; - }); - }, (error) => { - return Promise.reject('Problem invoking \'GetCodeActions\' on OmniSharp server: ' + error); - }); - } - - private _runCodeAction(id: string, document: TextDocument, range: Range): Promise { - - let req: V2.RunCodeActionRequest = { - Filename: document.fileName, - Selection: OmnisharpCodeActionProvider._asRange(range), - Identifier: id, - WantsTextChanges: true - }; - - return this._server.makeRequest(V2.RunCodeAction, req).then(response => { - - if (response && Array.isArray(response.Changes)) { - - let edit = new WorkspaceEdit(); - - for (let change of response.Changes) { - let uri = Uri.file(change.FileName); - let edits: TextEdit[] = []; - for (let textChange of change.Changes) { - edits.push(TextEdit.replace(toRange2(textChange), textChange.NewText)); - } - - edit.set(uri, edits); - } - - return workspace.applyEdit(edit); - } - - }, (error) => { - return Promise.reject('Problem invoking \'RunCodeAction\' on OmniSharp server: ' + error); - }); - } - - private static _asRange(range: Range): V2.Range { - let {start, end} = range; - return { - Start: { Line: start.line + 1, Column: start.character + 1 }, - End: { Line: end.line + 1, Column: end.character + 1 } - }; - } -} diff --git a/extensions/csharp-o/src/features/codeLensProvider.ts b/extensions/csharp-o/src/features/codeLensProvider.ts deleted file mode 100644 index 510456b5376..00000000000 --- a/extensions/csharp-o/src/features/codeLensProvider.ts +++ /dev/null @@ -1,83 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 {CancellationToken, CodeLens, SymbolKind, Range, Uri, TextDocument, CodeLensProvider, Position} from 'vscode'; -import {createRequest, toRange, toLocation} from '../typeConvertion'; -import AbstractSupport from './abstractProvider'; -import * as proto from '../protocol'; - -class OmniSharpCodeLens extends CodeLens { - - fileName: string; - - constructor(fileName: string, range: Range) { - super(range); - this.fileName = fileName; - } -} - -export default class OmniSharpCodeLensProvider extends AbstractSupport implements CodeLensProvider { - - private static filteredSymbolNames: { [name: string]: boolean } = { - 'Equals': true, - 'Finalize': true, - 'GetHashCode': true, - 'ToString': true - }; - - provideCodeLenses(document: TextDocument, token: CancellationToken): CodeLens[] | Thenable { - - return this._server.makeRequest(proto.CurrentFileMembersAsTree, { - Filename: document.fileName - }, token).then(tree => { - var ret: CodeLens[] = []; - tree.TopLevelTypeDefinitions.forEach(node => OmniSharpCodeLensProvider._convertQuickFix(ret, document.fileName, node)); - return ret; - }); - } - - private static _convertQuickFix(bucket: CodeLens[], fileName:string, node: proto.Node): void { - - if (node.Kind === 'MethodDeclaration' && OmniSharpCodeLensProvider.filteredSymbolNames[node.Location.Text]) { - return; - } - - let lens = new OmniSharpCodeLens(fileName, toRange(node.Location)); - bucket.push(lens); - - for (let child of node.ChildNodes) { - OmniSharpCodeLensProvider._convertQuickFix(bucket, fileName, child); - } - } - - resolveCodeLens(codeLens: CodeLens, token: CancellationToken): Thenable { - if (codeLens instanceof OmniSharpCodeLens) { - - let req = { - Filename: codeLens.fileName, - Line: codeLens.range.start.line + 1, - Column: codeLens.range.start.character + 1, - OnlyThisFile: false, - ExcludeDefinition: true - }; - - return this._server.makeRequest(proto.FindUsages, req, token).then(res => { - if (!res || !Array.isArray(res.QuickFixes)) { - return; - } - let len = res.QuickFixes.length; - codeLens.command = { - title: len === 1 ? '1 reference' : `${len} references`, - command: 'editor.action.showReferences', - arguments: [Uri.file(req.Filename), codeLens.range.start, res.QuickFixes.map(toLocation)] - }; - - return codeLens; - }); - } - } -} diff --git a/extensions/csharp-o/src/features/commands.ts b/extensions/csharp-o/src/features/commands.ts deleted file mode 100644 index fd0bf62819d..00000000000 --- a/extensions/csharp-o/src/features/commands.ts +++ /dev/null @@ -1,171 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 * as proto from '../protocol'; -import {OmnisharpServer} from '../omnisharpServer'; -import {Disposable, ViewColumn, commands, window} from 'vscode'; -import {join, dirname, basename} from 'path'; -import findLaunchTargets from '../launchTargetFinder'; -import {runInTerminal} from 'run-in-terminal'; - -const isWin = /^win/.test(process.platform); - -export default function registerCommands(server: OmnisharpServer) { - let d1 = commands.registerCommand('o.restart', () => server.restart()); - let d2 = commands.registerCommand('o.pickProjectAndStart', () => pickProjectAndStart(server)); - let d3 = commands.registerCommand('o.restore', () => dnxRestoreForAll(server)); - let d4 = commands.registerCommand('o.execute', () => dnxExecuteCommand(server)); - let d5 = commands.registerCommand('o.execute-last-command', () => dnxExecuteLastCommand(server)); - let d6 = commands.registerCommand('o.showOutput', () => server.getChannel().show(ViewColumn.Three)); - return Disposable.from(d1, d2, d3, d4, d5, d6); -} - -function pickProjectAndStart(server: OmnisharpServer) { - - return findLaunchTargets().then(targets => { - - let currentPath = server.getSolutionPathOrFolder(); - if (currentPath) { - for (let target of targets) { - if (target.target.fsPath === currentPath) { - target.label = `\u2713 ${target.label}`; - } - } - } - - return window.showQuickPick(targets, { - matchOnDescription: true, - placeHolder: `Select 1 of ${targets.length} projects` - }).then(target => { - if (target) { - return server.restart(target.target.fsPath); - } - }); - }); -} - -interface Command { - label: string; - description: string; - execute(): Thenable; -} - -let lastCommand: Command; - -function dnxExecuteLastCommand(server: OmnisharpServer) { - if (lastCommand) { - lastCommand.execute(); - } else { - dnxExecuteCommand(server); - } -} - -function dnxExecuteCommand(server: OmnisharpServer) { - - if (!server.isRunning()) { - return Promise.reject('OmniSharp server is not running.'); - } - - return server.makeRequest(proto.Projects).then(info => { - - let commands: Command[] = []; - - info.Dnx.Projects.forEach(project => { - Object.keys(project.Commands).forEach(key => { - - commands.push({ - label: `dnx ${key} - (${project.Name || basename(project.Path)})`, - description: dirname(project.Path), - execute() { - lastCommand = this; - - let command = join(info.Dnx.RuntimePath, 'bin/dnx'); - let args = [key]; - - // dnx-beta[1-6] needs a leading dot, like 'dnx . run' - if (/-beta[1-6]/.test(info.Dnx.RuntimePath)) { - args.unshift('.'); - } - - if (isWin) { - command += '.exe'; - } - - return runInTerminal(command, args, { - cwd: dirname(project.Path), - env: { - // KRE_COMPILATION_SERVER_PORT: workspace.DesignTimeHostPort - } - }); - } - }); - }); - }); - - return window.showQuickPick(commands).then(command => { - if (command) { - return command.execute(); - } - }); - }); -} - -export function dnxRestoreForAll(server: OmnisharpServer) { - - if (!server.isRunning()) { - return Promise.reject('OmniSharp server is not running.'); - } - - return server.makeRequest(proto.Projects).then(info => { - - let commands:Command[] = []; - - info.Dnx.Projects.forEach(project => { - commands.push({ - label: `dnu restore - (${project.Name || basename(project.Path)})`, - description: dirname(project.Path), - execute() { - - let command = join(info.Dnx.RuntimePath, 'bin/dnu'); - if (isWin) { - command += '.cmd'; - } - - return runInTerminal(command, ['restore'], { - cwd: dirname(project.Path) - }); - } - }); - }); - - return window.showQuickPick(commands).then(command => { - if(command) { - return command.execute(); - } - }); - }); -} - -export function dnxRestoreForProject(server: OmnisharpServer, fileName: string) { - - return server.makeRequest(proto.Projects).then((info):Promise => { - for(let project of info.Dnx.Projects) { - if (project.Path === fileName) { - let command = join(info.Dnx.RuntimePath, 'bin/dnu'); - if (isWin) { - command += '.cmd'; - } - - return runInTerminal(command, ['restore'], { - cwd: dirname(project.Path) - }); - } - } - - return Promise.reject(`Failed to execute restore, try to run 'dnu restore' manually for ${fileName}.`) - }); -} \ No newline at end of file diff --git a/extensions/csharp-o/src/features/completionItemProvider.ts b/extensions/csharp-o/src/features/completionItemProvider.ts deleted file mode 100644 index bc69fde325d..00000000000 --- a/extensions/csharp-o/src/features/completionItemProvider.ts +++ /dev/null @@ -1,86 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 {plain} from './documentation'; -import AbstractSupport from './abstractProvider'; -import * as proto from '../protocol'; -import {createRequest} from '../typeConvertion'; -import {CompletionItemProvider, CompletionItem, CompletionItemKind, Uri, CancellationToken, TextDocument, Range, Position} from 'vscode'; - -export default class OmniSharpCompletionItemProvider extends AbstractSupport implements CompletionItemProvider { - - public provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken): Promise { - - let wordToComplete = ''; - let range = document.getWordRangeAtPosition(position); - if (range) { - wordToComplete = document.getText(new Range(range.start, position)); - } - - let req = createRequest(document, position); - req.WordToComplete = wordToComplete; - req.WantDocumentationForEveryCompletionResult = true; - req.WantKind = true; - - return this._server.makeRequest(proto.AutoComplete, req).then(values => { - - if (!values) { - return; - } - - let result: CompletionItem[] = []; - let completions: { [c: string]: CompletionItem[] } = Object.create(null); - - // transform AutoCompleteResponse to CompletionItem and - // group by code snippet - for (let value of values) { - let completion = new CompletionItem(value.CompletionText.replace(/\(|\)|<|>/g, '')); - completion.detail = value.DisplayText; - completion.documentation = plain(value.Description); - completion.kind = _kinds[value.Kind] || CompletionItemKind.Property; - - let array = completions[completion.label]; - if (!array) { - completions[completion.label] = [completion]; - } else { - array.push(completion); - } - } - - // per suggestion group, select on and indicate overloads - for (let key in completions) { - - let suggestion = completions[key][0], - overloadCount = completions[key].length - 1; - - if (overloadCount === 0) { - // remove non overloaded items - delete completions[key]; - - } else { - // indicate that there is more - suggestion.detail = `${suggestion.detail} (+ ${overloadCount} overload(s))`; - } - result.push(suggestion); - } - - return result; - }); - } -} - -var _kinds: { [kind: string]: CompletionItemKind; } = Object.create(null); -_kinds['Variable'] = CompletionItemKind.Variable; -_kinds['Struct'] = CompletionItemKind.Interface; -_kinds['Interface'] = CompletionItemKind.Interface; -_kinds['Enum'] = CompletionItemKind.Enum; -_kinds['EnumMember'] = CompletionItemKind.Property; -_kinds['Property'] = CompletionItemKind.Property; -_kinds['Class'] = CompletionItemKind.Class; -_kinds['Field'] = CompletionItemKind.Field; -_kinds['EventField'] = CompletionItemKind.File; -_kinds['Method'] = CompletionItemKind.Method; diff --git a/extensions/csharp-o/src/features/definitionProvider.ts b/extensions/csharp-o/src/features/definitionProvider.ts deleted file mode 100644 index d03c1f7a008..00000000000 --- a/extensions/csharp-o/src/features/definitionProvider.ts +++ /dev/null @@ -1,25 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 AbstractSupport from './abstractProvider'; -import * as Protocol from '../protocol'; -import {createRequest, toLocation} from '../typeConvertion'; -import {Uri, TextDocument, Position, Location, CancellationToken, DefinitionProvider} from 'vscode'; - -export default class CSharpDefinitionProvider extends AbstractSupport implements DefinitionProvider { - - public provideDefinition(document: TextDocument, position: Position, token: CancellationToken): Promise { - - let req = createRequest(document, position); - - return this._server.makeRequest(Protocol.GoToDefinition, req, token).then(value => { - if (value && value.FileName) { - return toLocation(value); - } - }); - } -} diff --git a/extensions/csharp-o/src/features/diagnosticsProvider.ts b/extensions/csharp-o/src/features/diagnosticsProvider.ts deleted file mode 100644 index 96310e6ee3d..00000000000 --- a/extensions/csharp-o/src/features/diagnosticsProvider.ts +++ /dev/null @@ -1,232 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 {OmnisharpServer} from '../omnisharpServer'; -import AbstractSupport from './abstractProvider'; -import * as proto from '../protocol'; -import {createRequest, toRange} from '../typeConvertion'; -import {Disposable, Uri, CancellationTokenSource, TextDocument, TextDocumentChangeEvent, Range, Diagnostic, DiagnosticSeverity, Location, workspace, languages} from 'vscode'; - -export class Advisor { - - private _disposable: Disposable; - private _server: OmnisharpServer; - private _packageRestoreCounter: number = 0; - private _projectSourceFileCounts: { [path: string]: number } = Object.create(null); - - constructor(server: OmnisharpServer) { - this._server = server; - let d1 = server.onProjectChange(this._onProjectChange, this); - let d2 = server.onBeforePackageRestore(this._onBeforePackageRestore, this); - let d3 = server.onPackageRestore(this._onPackageRestore, this); - this._disposable = Disposable.from(d1, d2, d3); - } - - public dispose() { - this._disposable.dispose(); - } - - public shouldValidateFiles(): boolean { - return this._isServerStarted() - && !this._isRestoringPackages(); - } - - public shouldValidateProject(): boolean { - return this._isServerStarted() - && !this._isRestoringPackages() - && !this._isHugeProject(); - } - - private _onProjectChange(info: proto.ProjectInformationResponse): void { - if (info.DnxProject && info.DnxProject.SourceFiles) { - this._projectSourceFileCounts[info.DnxProject.Path] = info.DnxProject.SourceFiles.length; - } - if (info.MsBuildProject && info.MsBuildProject.SourceFiles) { - this._projectSourceFileCounts[info.MsBuildProject.Path] = info.MsBuildProject.SourceFiles.length; - } - } - - private _onBeforePackageRestore(): void { - this._packageRestoreCounter += 1; - } - - private _onPackageRestore(): void { - this._packageRestoreCounter -= 1; - } - - private _isServerStarted(): boolean { - return this._server.isRunning(); - } - - private _isRestoringPackages(): boolean { - return this._packageRestoreCounter > 0; - } - - private _isHugeProject(): boolean { - var sourceFileCount = 0; - for (var key in this._projectSourceFileCounts) { - sourceFileCount += this._projectSourceFileCounts[key]; - if (sourceFileCount > 1000) { - return true; - } - } - return false; - } -} - -export default function reportDiagnostics(server: OmnisharpServer, advisor: Advisor): Disposable { - return new DiagnosticsProvider(server, advisor); -} - -class DiagnosticsProvider extends AbstractSupport { - - private _validationAdvisor: Advisor; - private _disposable: Disposable; - private _documentValidations: { [uri: string]: CancellationTokenSource } = Object.create(null); - private _projectValidation: CancellationTokenSource; - private _diagnostics: vscode.DiagnosticCollection; - - constructor(server: OmnisharpServer, validationAdvisor: Advisor) { - super(server); - this._validationAdvisor = validationAdvisor; - this._diagnostics = languages.createDiagnosticCollection('omnisharp'); - - let d1 = this._server.onPackageRestore(this._validateProject, this); - let d2 = this._server.onProjectChange(this._validateProject, this); - let d4 = workspace.onDidOpenTextDocument(event => this._onDocumentAddOrChange(event), this); - let d3 = workspace.onDidChangeTextDocument(event => this._onDocumentAddOrChange(event.document), this); - let d5 = workspace.onDidCloseTextDocument(this._onDocumentRemove, this); - this._disposable = Disposable.from(this._diagnostics, d1, d2, d3, d4, d5); - } - - public dispose(): void { - if (this._projectValidation) { - this._projectValidation.dispose(); - } - for (let key in this._documentValidations) { - this._documentValidations[key].dispose(); - } - this._disposable.dispose(); - } - - private _onDocumentAddOrChange(document: TextDocument): void { - if (document.languageId === 'csharp' && document.uri.scheme === 'file') { - this._validateDocument(document); - this._validateProject(); - } - } - - private _onDocumentRemove(document: TextDocument) { - let key = document.uri.toString(); - let didChange = false; - if (this._diagnostics[key]) { - didChange = true; - this._diagnostics[key].dispose(); - delete this._diagnostics[key]; - } - if (this._documentValidations[key]) { - didChange = true; - this._documentValidations[key].cancel(); - delete this._documentValidations[key]; - } - if (didChange) { - this._validateProject(); - } - } - - private _validateDocument(document: TextDocument): void { - - if (!this._validationAdvisor.shouldValidateFiles()) { - return; - } - - let key = document.uri.toString(); - if (this._documentValidations[key]) { - this._documentValidations[key].cancel(); - } - - let source = new CancellationTokenSource(); - let handle = setTimeout(() => { - let req: proto.Request = { Filename: document.fileName }; - this._server.makeRequest(proto.CodeCheck, req, source.token).then(value => { - - // (re)set new diagnostics for this document - let diagnostics = value.QuickFixes.map(DiagnosticsProvider._asDiagnostic); - this._diagnostics.set(document.uri, diagnostics); - }); - }, 750); - - source.token.onCancellationRequested(() => clearTimeout(handle)); - this._documentValidations[key] = source; - } - - private _validateProject(): void { - - if (!this._validationAdvisor.shouldValidateProject()) { - return; - } - - if (this._projectValidation) { - this._projectValidation.cancel(); - } - - this._projectValidation = new CancellationTokenSource(); - let handle = setTimeout(() => { - this._server.makeRequest(proto.CodeCheck, {}, this._projectValidation.token).then(value => { - - let quickFixes = value.QuickFixes.sort((a, b) => a.FileName.localeCompare(b.FileName)); - let entries: [Uri, Diagnostic[]][] = []; - let lastEntry: [Uri, Diagnostic[]]; - - for (let quickFix of quickFixes) { - - let diag = DiagnosticsProvider._asDiagnostic(quickFix); - let uri = Uri.file(quickFix.FileName); - - if (lastEntry && lastEntry[0].toString() === uri.toString()) { - lastEntry[1].push(diag); - } else { - lastEntry = [uri, [diag]]; - entries.push(lastEntry); - } - } - - // replace all entries - this._diagnostics.set(entries); - }); - }, 3000); - - // clear timeout on cancellation - this._projectValidation.token.onCancellationRequested(() => { - clearTimeout(handle); - }); - } - - // --- data converter - - private static _asDiagnostic(quickFix: proto.QuickFix): Diagnostic { - let severity = DiagnosticsProvider._asDiagnosticSeverity(quickFix.LogLevel); - let message = `${quickFix.Text} [${quickFix.Projects.map(n => DiagnosticsProvider._asProjectLabel(n)).join(', ') }]`; - return new Diagnostic(toRange(quickFix), message, severity); - } - - private static _asDiagnosticSeverity(logLevel: string): DiagnosticSeverity { - switch (logLevel.toLowerCase()) { - case 'hidden': - case 'warning': - case 'warn': - return DiagnosticSeverity.Warning; - default: - return DiagnosticSeverity.Error; - } - } - - private static _asProjectLabel(projectName: string): string { - var idx = projectName.indexOf('+'); - return projectName.substr(idx + 1); - } -} diff --git a/extensions/csharp-o/src/features/documentHighlightProvider.ts b/extensions/csharp-o/src/features/documentHighlightProvider.ts deleted file mode 100644 index 647a1265310..00000000000 --- a/extensions/csharp-o/src/features/documentHighlightProvider.ts +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 AbstractSupport from './abstractProvider'; -import * as proto from '../protocol'; -import {createRequest, toRange} from '../typeConvertion'; -import {DocumentHighlightProvider, DocumentHighlight, DocumentHighlightKind, Uri, CancellationToken, TextDocument, Position, Range} from 'vscode'; - -export default class OmnisharpDocumentHighlightProvider extends AbstractSupport implements DocumentHighlightProvider { - - public provideDocumentHighlights(resource: TextDocument, position: Position, token: CancellationToken): Promise { - - let req = createRequest(resource, position); - req.OnlyThisFile = true; - req.ExcludeDefinition = false; - - return this._server.makeRequest(proto.FindUsages, req, token).then(res => { - if (res && Array.isArray(res.QuickFixes)) { - return res.QuickFixes.map(OmnisharpDocumentHighlightProvider._asDocumentHighlight); - } - }); - } - - private static _asDocumentHighlight(quickFix: proto.QuickFix): DocumentHighlight { - return new DocumentHighlight(toRange(quickFix), DocumentHighlightKind.Read); - } -} diff --git a/extensions/csharp-o/src/features/documentSymbolProvider.ts b/extensions/csharp-o/src/features/documentSymbolProvider.ts deleted file mode 100644 index 9311631a669..00000000000 --- a/extensions/csharp-o/src/features/documentSymbolProvider.ts +++ /dev/null @@ -1,28 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 AbstractSupport from './abstractProvider'; -import * as Protocol from '../protocol'; -import {toDocumentSymbol} from '../typeConvertion'; -import {DocumentSymbolProvider, SymbolInformation, SymbolKind, Uri, TextDocument, Range, CancellationToken} from 'vscode'; - -export default class OmnisharpDocumentSymbolProvider extends AbstractSupport implements DocumentSymbolProvider { - - public provideDocumentSymbols(document: TextDocument, token: CancellationToken): Promise { - - return this._server.makeRequest(Protocol.CurrentFileMembersAsTree, {Filename: document.fileName}, token).then(tree => { - var ret: SymbolInformation[] = []; - for (let node of tree.TopLevelTypeDefinitions) { - toDocumentSymbol(ret, node); - } - return ret; - }); - } - - -} - diff --git a/extensions/csharp-o/src/features/formattingEditProvider.ts b/extensions/csharp-o/src/features/formattingEditProvider.ts deleted file mode 100644 index 38001dfe8f9..00000000000 --- a/extensions/csharp-o/src/features/formattingEditProvider.ts +++ /dev/null @@ -1,52 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 AbstractSupport from './abstractProvider'; -import * as proto from '../protocol'; -import {Uri, DocumentRangeFormattingEditProvider, OnTypeFormattingEditProvider, FormattingOptions, CancellationToken, TextEdit, TextDocument, Range, Position} from 'vscode'; - -export default class FormattingSupport extends AbstractSupport implements DocumentRangeFormattingEditProvider { - - public provideDocumentRangeFormattingEdits(document: TextDocument, range: Range, options: FormattingOptions, token: CancellationToken): Promise { - - let request = { - Filename: document.fileName, - Line: range.start.line + 1, - Column: range.start.character + 1, - EndLine: range.end.line + 1, - EndColumn: range.end.character + 1 - }; - - return this._server.makeRequest(proto.FormatRange, request, token).then(res => { - if (res && Array.isArray(res.Changes)) { - return res.Changes.map(FormattingSupport._asEditOptionation); - } - }); - } - - public provideOnTypeFormattingEdits(document: TextDocument, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): Promise { - - let request = { - Filename: document.fileName, - Line: position.line + 1, - Column: position.character + 1, - Character: ch - }; - - return this._server.makeRequest(proto.FormatAfterKeystroke, request, token).then(res => { - if (res && Array.isArray(res.Changes)) { - return res.Changes.map(FormattingSupport._asEditOptionation); - } - }); - } - - private static _asEditOptionation(change: proto.TextChange): TextEdit { - return new TextEdit( - new Range(change.StartLine - 1, change.StartColumn - 1, change.EndLine - 1, change.EndColumn - 1), - change.NewText); - } -} diff --git a/extensions/csharp-o/src/features/hoverProvider.ts b/extensions/csharp-o/src/features/hoverProvider.ts deleted file mode 100644 index c5abb1c1a08..00000000000 --- a/extensions/csharp-o/src/features/hoverProvider.ts +++ /dev/null @@ -1,28 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 {plain} from './documentation'; -import AbstractSupport from './abstractProvider'; -import * as Protocol from '../protocol'; -import {createRequest} from '../typeConvertion'; -import {HoverProvider, Hover, TextDocument, CancellationToken, Range, Position} from 'vscode'; - -export default class OmniSharpHoverProvider extends AbstractSupport implements HoverProvider { - - public provideHover(document: TextDocument, position: Position, token: CancellationToken): Promise { - - let req = createRequest(document, position); - req.IncludeDocumentation = true; - - return this._server.makeRequest(Protocol.TypeLookup, req, token).then(value => { - if (value && value.Type) { - let contents = [plain(value.Documentation), { language: 'csharp', value: value.Type }]; - return new Hover(contents); - } - }); - } -} diff --git a/extensions/csharp-o/src/features/omnisharpStatus.ts b/extensions/csharp-o/src/features/omnisharpStatus.ts deleted file mode 100644 index bf7609ff0e2..00000000000 --- a/extensions/csharp-o/src/features/omnisharpStatus.ts +++ /dev/null @@ -1,259 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 * as vscode from 'vscode'; -import {OmnisharpServer} from '../omnisharpServer'; -import {dnxRestoreForProject} from './commands'; -import {basename} from 'path'; -import * as proto from '../protocol'; - - -export default function reportStatus(server: OmnisharpServer) { - return vscode.Disposable.from( - reportServerStatus(server), - forwardOutput(server), - reportDocumentStatus(server)); -} - -// --- document status - -let defaultSelector: vscode.DocumentSelector = [ - 'csharp', // c#-files OR - { pattern: '**/project.json' }, // project.json-files OR - { pattern: '**/*.sln' }, // any solution file OR - { pattern: '**/*.csproj' } // an csproj file -]; - -class Status { - - selector: vscode.DocumentSelector; - text: string; - command: string; - color: string; - - constructor(selector: vscode.DocumentSelector) { - this.selector = selector; - } -} - -export function reportDocumentStatus(server: OmnisharpServer): vscode.Disposable { - - let disposables: vscode.Disposable[] = []; - - let entry = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, Number.MIN_VALUE); - let defaultStatus = new Status(defaultSelector); - let projectStatus: Status; - - function render() { - - if (!vscode.window.activeTextEditor) { - entry.hide(); - return; - } - - let document = vscode.window.activeTextEditor.document; - let status: Status; - - if (projectStatus && vscode.languages.match(projectStatus.selector, document)) { - status = projectStatus; - } else if (defaultStatus.text && vscode.languages.match(defaultStatus.selector, document)) { - status = defaultStatus; - } - - if (status) { - entry.text = status.text; - entry.command = status.command; - entry.color = status.color; - entry.show(); - return; - } - - entry.hide(); - } - - disposables.push(vscode.window.onDidChangeActiveTextEditor(render)); - - disposables.push(server.onServerError(err => { - defaultStatus.text = '$(flame) Error starting OmniSharp'; - defaultStatus.command = 'o.showOutput'; - defaultStatus.color = ''; - render(); - })); - - disposables.push(server.onMultipleLaunchTargets(targets => { - defaultStatus.text = '$(flame) Select project'; - defaultStatus.command = 'o.pickProjectAndStart'; - defaultStatus.color = 'rgb(90, 218, 90)'; - render(); - })); - - disposables.push(server.onBeforeServerStart(path => { - defaultStatus.text = '$(flame) Starting...'; - defaultStatus.command = 'o.showOutput'; - defaultStatus.color = ''; - render(); - })); - - disposables.push(server.onServerStop(() => { - projectStatus = undefined; - defaultStatus.text = undefined; - })); - - disposables.push(server.onServerStart(path => { - - defaultStatus.text = '$(flame) Running'; - defaultStatus.command = 'o.pickProjectAndStart'; - defaultStatus.color = ''; - render(); - - function updateProjectInfo() { - server.makeRequest(proto.Projects).then(info => { - - let fileNames: vscode.DocumentSelector[] = []; - let label: string; - - // show sln-file if applicable - if (info.MSBuild.SolutionPath) { - label = basename(info.MSBuild.SolutionPath)//workspace.getRelativePath(info.MSBuild.SolutionPath); - fileNames.push({ pattern: info.MSBuild.SolutionPath }); - - for (let project of info.MSBuild.Projects) { - fileNames.push({ pattern: project.Path }); - for (let sourceFile of project.SourceFiles) { - fileNames.push({ pattern: sourceFile }); - } - } - } - - // show dnx projects if applicable - let count = 0; - for (let project of info.Dnx.Projects) { - count += 1; - - fileNames.push({ pattern: project.Path }); - for (let sourceFile of project.SourceFiles) { - fileNames.push({ pattern: sourceFile }); - } - } - if (label) { - // we already have a message from a sln-file - } else if (count === 1) { - label = basename(info.Dnx.Projects[0].Path)//workspace.getRelativePath(info.Dnx.Projects[0].Path); - } else { - label = `${count} projects`; - } - - // set project info - projectStatus = new Status(fileNames); - projectStatus.text = '$(flame) ' + label; - projectStatus.command = 'o.pickProjectAndStart'; - - // default is to change project - defaultStatus.text = '$(flame) Switch projects'; - defaultStatus.command = 'o.pickProjectAndStart'; - render(); - }); - } - - disposables.push(server.onProjectAdded(updateProjectInfo)); - disposables.push(server.onProjectChange(updateProjectInfo)); - disposables.push(server.onProjectRemoved(updateProjectInfo)); - })); - - return vscode.Disposable.from(...disposables); -} - - -// ---- server status - -export function reportServerStatus(server: OmnisharpServer): vscode.Disposable{ - - function appendLine(value: string = '') { - server.getChannel().appendLine(value); - } - - let d0 = server.onServerError(err => { - appendLine('[ERROR] ' + err); - }); - - let d1 = server.onError(message => { - if (message.FileName) { - appendLine(`${message.FileName}(${message.Line},${message.Column})`); - } - appendLine(message.Text); - appendLine(); - showMessageSoon(); - }); - - let d2 = server.onMsBuildProjectDiagnostics(message => { - - function asErrorMessage(message: proto.MSBuildDiagnosticsMessage) { - let value = `${message.FileName}(${message.StartLine},${message.StartColumn}): Error: ${message.Text}`; - appendLine(value); - } - - function asWarningMessage(message: proto.MSBuildDiagnosticsMessage) { - let value = `${message.FileName}(${message.StartLine},${message.StartColumn}): Warning: ${message.Text}`; - appendLine(value); - } - - if (message.Errors.length > 0 || message.Warnings.length > 0) { - appendLine(message.FileName); - message.Errors.forEach(error => asErrorMessage); - message.Warnings.forEach(warning => asWarningMessage); - appendLine(); - showMessageSoon(); - } - }); - - let d3 = server.onUnresolvedDependencies(message => { - - let info = `There are unresolved dependencies from '${vscode.workspace.asRelativePath(message.FileName) }'. Please execute the restore command to continue.`; - - return vscode.window.showInformationMessage(info, 'Restore').then(value => { - if (value) { - dnxRestoreForProject(server, message.FileName); - } - }); - }); - - return vscode.Disposable.from(d0, d1, d2, d3); -} - -// show user message -let _messageHandle: number; -function showMessageSoon() { - clearTimeout(_messageHandle); - _messageHandle = setTimeout(function() { - - let message = "Some projects have trouble loading. Please review the output for more details."; - vscode.window.showWarningMessage(message, { title: "Show Output", command: 'o.showOutput' }).then(value => { - if (value) { - vscode.commands.executeCommand(value.command); - } - }); - }, 1500); -} - -// --- mirror output in channel - -function forwardOutput(server: OmnisharpServer) { - - const logChannel = server.getChannel(); - const timing200Pattern = /^\[INFORMATION:OmniSharp.Middleware.LoggingMiddleware\] \/\w+: 200 \d+ms/; - - function forward(message: string) { - // strip stuff like: /codecheck: 200 339ms - if(!timing200Pattern.test(message)) { - logChannel.append(message); - } - } - - return vscode.Disposable.from( - server.onStdout(forward), - server.onStderr(forward)); -} - diff --git a/extensions/csharp-o/src/features/referenceProvider.ts b/extensions/csharp-o/src/features/referenceProvider.ts deleted file mode 100644 index 0815c8a8377..00000000000 --- a/extensions/csharp-o/src/features/referenceProvider.ts +++ /dev/null @@ -1,27 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 AbstractSupport from './abstractProvider'; -import * as Protocol from '../protocol'; -import {createRequest, toLocation} from '../typeConvertion'; -import {ReferenceProvider, Location, Range, TextDocument, Uri, CancellationToken, Position} from 'vscode'; - -export default class OmnisharpReferenceProvider extends AbstractSupport implements ReferenceProvider { - - public provideReferences(document: TextDocument, position: Position, options: { includeDeclaration: boolean;}, token: CancellationToken): Promise { - - let req = createRequest(document, position); - req.OnlyThisFile = false; - req.ExcludeDefinition = false; - - return this._server.makeRequest(Protocol.FindUsages, req, token).then(res => { - if (res && Array.isArray(res.QuickFixes)) { - return res.QuickFixes.map(toLocation); - } - }); - } -} diff --git a/extensions/csharp-o/src/features/renameProvider.ts b/extensions/csharp-o/src/features/renameProvider.ts deleted file mode 100644 index 129a675d158..00000000000 --- a/extensions/csharp-o/src/features/renameProvider.ts +++ /dev/null @@ -1,40 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 AbstractSupport from './abstractProvider'; -import * as proto from '../protocol'; -import {createRequest, toRange} from '../typeConvertion'; -import {RenameProvider, TextEdit, WorkspaceEdit, TextDocument, Uri, CancellationToken, Position, Range} from 'vscode'; - -export default class OmnisharpRenameProvider extends AbstractSupport implements RenameProvider { - - public provideRenameEdits(document: TextDocument, position: Position, newName: string, token: CancellationToken): Promise { - - let request = createRequest(document, position); - request.WantsTextChanges = true, - request.RenameTo = newName; - - return this._server.makeRequest(proto.Rename, request, token).then(response => { - - if (!response) { - return; - } - - const edit = new WorkspaceEdit(); - response.Changes.forEach(change => { - const uri = Uri.file(change.FileName); - change.Changes.forEach(change => { - edit.replace(uri, - new Range(change.StartLine - 1, change.StartColumn - 1, change.EndLine - 1, change.EndColumn - 1), - change.NewText); - }); - }); - - return edit; - }); - } -} diff --git a/extensions/csharp-o/src/features/signatureHelpProvider.ts b/extensions/csharp-o/src/features/signatureHelpProvider.ts deleted file mode 100644 index eb673249c7f..00000000000 --- a/extensions/csharp-o/src/features/signatureHelpProvider.ts +++ /dev/null @@ -1,42 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 AbstractSupport from './abstractProvider'; -import * as Protocol from '../protocol'; -import {createRequest} from '../typeConvertion'; -import {SignatureHelpProvider, SignatureHelp, SignatureInformation, ParameterInformation, Uri, CancellationToken, TextDocument, Position} from 'vscode'; - -export default class OmniSharpSignatureHelpProvider extends AbstractSupport implements SignatureHelpProvider { - - public provideSignatureHelp(document: TextDocument, position: Position, token: CancellationToken): Promise { - - let req = createRequest(document, position); - - return this._server.makeRequest(Protocol.SignatureHelp, req, token).then(res => { - - let ret = new SignatureHelp(); - ret.activeSignature = res.ActiveSignature; - ret.activeParameter = res.ActiveParameter; - - for(let signature of res.Signatures) { - - let signatureInfo = new SignatureInformation(signature.Label, signature.Documentation); - ret.signatures.push(signatureInfo); - - for (let parameter of signature.Parameters) { - let parameterInfo = new ParameterInformation( - parameter.Label, - parameter.Documentation); - - signatureInfo.parameters.push(parameterInfo); - } - } - - return ret; - }); - } -} diff --git a/extensions/csharp-o/src/features/workspaceSymbolProvider.ts b/extensions/csharp-o/src/features/workspaceSymbolProvider.ts deleted file mode 100644 index d144a3e1eb4..00000000000 --- a/extensions/csharp-o/src/features/workspaceSymbolProvider.ts +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 AbstractSupport from './abstractProvider'; -import * as Protocol from '../protocol'; -import {createRequest, toRange} from '../typeConvertion'; -import {CancellationToken, Uri, Range, WorkspaceSymbolProvider, SymbolInformation, SymbolKind} from 'vscode'; - - -export default class OmnisharpWorkspaceSymbolProvider extends AbstractSupport implements WorkspaceSymbolProvider { - - public provideWorkspaceSymbols(search: string, token: CancellationToken): Promise { - - return this._server.makeRequest(Protocol.FindSymbols, { - Filter: search, - Filename: '' - }, token).then(res => { - if (res && Array.isArray(res.QuickFixes)) { - return res.QuickFixes.map(OmnisharpWorkspaceSymbolProvider._asSymbolInformation); - } - }); - } - - private static _asSymbolInformation(symbolInfo: Protocol.SymbolLocation): SymbolInformation { - - return new SymbolInformation(symbolInfo.Text, OmnisharpWorkspaceSymbolProvider._toKind(symbolInfo), - toRange(symbolInfo), - Uri.file(symbolInfo.FileName)); - } - - private static _toKind(symbolInfo: Protocol.SymbolLocation): SymbolKind { - switch (symbolInfo.Kind) { - case 'Method': - return SymbolKind.Method; - case 'Field': - case 'Property': - return SymbolKind.Field; - } - return SymbolKind.Class; - } -} diff --git a/extensions/csharp-o/src/launchTargetFinder.ts b/extensions/csharp-o/src/launchTargetFinder.ts deleted file mode 100644 index e3630c850a4..00000000000 --- a/extensions/csharp-o/src/launchTargetFinder.ts +++ /dev/null @@ -1,82 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 * as paths from 'path'; -import {EventEmitter} from 'events'; -import {Uri, workspace} from 'vscode'; - -export interface LaunchTarget { - label: string; - description: string; - directory: Uri; - resource: Uri; - target: Uri; -} - - -export default function getLaunchTargets(): Thenable { - return workspace.findFiles('{**/*.sln,**/*.csproj,**/project.json}', '{**/node_modules/**,**/.git/**,**/bower_components/**}', 100).then(resources => { - return select(resources, Uri.file(workspace.rootPath)); - }); -} - -function select(resources: Uri[], root: Uri): LaunchTarget[] { - - if (!Array.isArray(resources)) { - return []; - } - - var targets: LaunchTarget[] = [], - hasCsProjFiles = false, - hasProjectJson = false, - hasProjectJsonAtRoot = false; - - hasCsProjFiles = resources - .some(resource => /\.csproj$/.test(resource.fsPath)); - - resources.forEach(resource => { - - // sln files - if (hasCsProjFiles && /\.sln$/.test(resource.fsPath)) { - targets.push({ - label: paths.basename(resource.fsPath), - description: workspace.asRelativePath(paths.dirname(resource.fsPath)), - resource, - target: resource, - directory: Uri.file(paths.dirname(resource.fsPath)) - }); - } - - // project.json files - if (/project.json$/.test(resource.fsPath)) { - - var dirname = paths.dirname(resource.fsPath); - hasProjectJson = true; - hasProjectJsonAtRoot = hasProjectJsonAtRoot || dirname === root.fsPath; - - targets.push({ - label: paths.basename(resource.fsPath), - description: workspace.asRelativePath(paths.dirname(resource.fsPath)), - resource, - target: Uri.file(dirname), - directory: Uri.file(dirname) - }); - } - }); - - if (hasProjectJson && !hasProjectJsonAtRoot) { - targets.push({ - label: paths.basename(root.fsPath), - description: '', - resource: root, - target: root, - directory: root - }); - } - - return targets.sort((a, b) => a.directory.fsPath.localeCompare(b.directory.fsPath)); -} - diff --git a/extensions/csharp-o/src/omnisharpMain.ts b/extensions/csharp-o/src/omnisharpMain.ts deleted file mode 100644 index 4fcf03ffb68..00000000000 --- a/extensions/csharp-o/src/omnisharpMain.ts +++ /dev/null @@ -1,82 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 DefinitionProvider from './features/definitionProvider'; -import CodeLensProvider from './features/codeLensProvider'; -import DocumentHighlightProvider from './features/documentHighlightProvider'; -import DocumentSymbolProvider from './features/documentSymbolProvider'; -import CodeActionProvider from './features/codeActionProvider'; -import ReferenceProvider from './features/referenceProvider'; -import HoverProvider from './features/hoverProvider'; -import RenameProvider from './features/renameProvider'; -import FormatProvider from './features/formattingEditProvider'; -import CompletionItemProvider from './features/completionItemProvider'; -import WorkspaceSymbolProvider from './features/workspaceSymbolProvider'; -import reportDiagnostics,{Advisor} from './features/diagnosticsProvider'; -import SignatureHelpProvider from './features/signatureHelpProvider'; -import registerCommands from './features/commands'; -import {StdioOmnisharpServer} from './omnisharpServer'; -import forwardChanges from './features/changeForwarding'; -import reportStatus from './features/omnisharpStatus'; -import findLaunchTargets from './launchTargetFinder'; -import {Disposable, ExtensionContext, languages, extensions} from 'vscode'; - -export function activate(context: ExtensionContext): any { - - const _selector: vscode.DocumentSelector = { - language: 'csharp', - scheme: 'file' // only files from disk - }; - - const server = new StdioOmnisharpServer(); - let advisor = new Advisor(server); - - let disposables: Disposable[] = []; - let localDisposables: Disposable[] = []; - - disposables.push(server.onServerStart(() => { - // register language feature provider on start - localDisposables.push(languages.registerDefinitionProvider(_selector, new DefinitionProvider(server))); - localDisposables.push(languages.registerCodeLensProvider(_selector, new CodeLensProvider(server))); - localDisposables.push(languages.registerDocumentHighlightProvider(_selector, new DocumentHighlightProvider(server))); - localDisposables.push(languages.registerDocumentSymbolProvider(_selector, new DocumentSymbolProvider(server))); - localDisposables.push(languages.registerReferenceProvider(_selector, new ReferenceProvider(server))); - localDisposables.push(languages.registerHoverProvider(_selector, new HoverProvider(server))); - localDisposables.push(languages.registerRenameProvider(_selector, new RenameProvider(server))); - localDisposables.push(languages.registerDocumentRangeFormattingEditProvider(_selector, new FormatProvider(server))); - localDisposables.push(languages.registerOnTypeFormattingEditProvider(_selector, new FormatProvider(server), '}', ';')); - localDisposables.push(languages.registerCompletionItemProvider(_selector, new CompletionItemProvider(server), '.', '<')); - localDisposables.push(languages.registerWorkspaceSymbolProvider(new WorkspaceSymbolProvider(server))); - localDisposables.push(languages.registerSignatureHelpProvider(_selector, new SignatureHelpProvider(server), '(', ',')); - let codeActionProvider = new CodeActionProvider(server); - localDisposables.push(codeActionProvider); - localDisposables.push(languages.registerCodeActionsProvider(_selector, codeActionProvider)); - localDisposables.push(reportDiagnostics(server, advisor)); - localDisposables.push(forwardChanges(server)); - })); - - disposables.push(server.onServerStop(() => { - // remove language feature providers on stop - Disposable.from(...localDisposables).dispose(); - })); - - disposables.push(registerCommands(server)); - disposables.push(reportStatus(server)); - - // read and store last solution or folder path - server.autoStart(context.workspaceState.get('lastSolutionPathOrFolder')); - server.onBeforeServerStart(path => context.workspaceState.update('lastSolutionPathOrFolder', path)); - - // stop server on deactivate - disposables.push(new Disposable(() => { - advisor.dispose(); - server.stop(); - })); - - context.subscriptions.push(...disposables); -} - diff --git a/extensions/csharp-o/src/omnisharpServer.ts b/extensions/csharp-o/src/omnisharpServer.ts deleted file mode 100644 index 153d9a2176f..00000000000 --- a/extensions/csharp-o/src/omnisharpServer.ts +++ /dev/null @@ -1,507 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 {EventEmitter} from 'events'; -import {ChildProcess, exec} from 'child_process'; -import {request} from 'http'; -import {dirname} from 'path'; -import {ReadLine, createInterface} from 'readline'; -import omnisharpLauncher from './omnisharpServerLauncher'; -import {Disposable, CancellationToken, OutputChannel, workspace, window} from 'vscode'; -import {ErrorMessage, UnresolvedDependenciesMessage, MSBuildProjectDiagnostics, ProjectInformationResponse} from './protocol'; -import getLaunchTargets, {LaunchTarget} from './launchTargetFinder'; - - -enum ServerState { - Starting, - Started, - Stopped -} - -interface Request { - path: string; - data?: any; - onSuccess: Function; - onError: Function; - _enqueued: number; -} - -export abstract class OmnisharpServer { - - private _eventBus = new EventEmitter(); - private _start: Promise; - private _state: ServerState = ServerState.Stopped; - private _solutionPath: string; - private _queue: Request[] = []; - private _isProcessingQueue = false; - private _channel: OutputChannel; - - protected _serverProcess: ChildProcess; - protected _extraArgv: string[]; - - constructor() { - this._extraArgv = []; - this._channel = window.createOutputChannel('OmniSharp Log'); - } - - public isRunning(): boolean { - return this._state === ServerState.Started; - } - - private _getState(): ServerState { - return this._state; - } - - private _setState(value: ServerState) : void { - if (typeof value !== 'undefined' && value !== this._state) { - this._state = value; - this._fireEvent('stateChanged', this._state); - } - } - - public getSolutionPathOrFolder(): string { - return this._solutionPath; - } - - public getChannel(): vscode.OutputChannel { - return this._channel; - } - - public onStdout(listener: (e: string) => any, thisArg?: any) { - return this._addListener('stdout', listener, thisArg); - } - - public onStderr(listener: (e: string) => any, thisArg?: any) { - return this._addListener('stderr', listener, thisArg); - } - - public onError(listener: (e: ErrorMessage) => any, thisArg?: any) { - return this._addListener('Error', listener, thisArg); - } - - public onServerError(listener: (err: any) => any, thisArg?: any) { - return this._addListener('ServerError', listener, thisArg); - } - - public onUnresolvedDependencies(listener: (e: UnresolvedDependenciesMessage) => any, thisArg?:any) { - return this._addListener('UnresolvedDependencies', listener, thisArg); - } - - public onBeforePackageRestore(listener: () => any, thisArg?: any) { - return this._addListener('PackageRestoreStarted', listener, thisArg); - } - - public onPackageRestore(listener: () => any, thisArg?: any) { - return this._addListener('PackageRestoreFinished', listener, thisArg); - } - - public onProjectChange(listener: (e: ProjectInformationResponse) => any, thisArg?: any) { - return this._addListener('ProjectChanged', listener, thisArg); - } - - public onProjectAdded(listener: (e: ProjectInformationResponse) => any, thisArg?: any) { - return this._addListener('ProjectAdded', listener, thisArg); - } - - public onProjectRemoved(listener: (e: ProjectInformationResponse) => any, thisArg?: any) { - return this._addListener('ProjectRemoved', listener, thisArg); - } - - public onMsBuildProjectDiagnostics(listener: (e: MSBuildProjectDiagnostics) => any, thisArg?: any) { - return this._addListener('MsBuildProjectDiagnostics', listener, thisArg); - } - - public onBeforeServerStart(listener: (e:string) => any) { - return this._addListener('BeforeServerStart', listener); - } - - public onServerStart(listener: (e: string) => any) { - return this._addListener('ServerStart', listener); - } - - public onServerStop(listener: () => any) { - return this._addListener('ServerStop', listener); - } - - public onMultipleLaunchTargets(listener: (targets: LaunchTarget[]) => any, thisArg?: any) { - return this._addListener('server:MultipleLaunchTargets', listener, thisArg); - } - - public onOmnisharpStart(listener: () => any) { - return this._addListener('started', listener); - } - - private _addListener(event: string, listener: (e: any) => any, thisArg?: any): Disposable { - listener = thisArg ? listener.bind(thisArg) : listener; - this._eventBus.addListener(event, listener); - return new Disposable(() => this._eventBus.removeListener(event, listener)); - } - - protected _fireEvent(event: string, args: any): void { - this._eventBus.emit(event, args); - } - - public start(solutionPath: string): Promise { - if (!this._start) { - this._start = this._doStart(solutionPath); - } - return this._start; - } - - private _doStart(solutionPath: string): Promise { - - this._setState(ServerState.Starting); - this._solutionPath = solutionPath; - - var cwd = dirname(solutionPath), - argv = ['-s', solutionPath, '--hostPID', process.pid.toString(), 'dnx:enablePackageRestore=false'].concat(this._extraArgv); - - this._fireEvent('stdout', `[INFO] Starting OmniSharp at '${solutionPath}'...\n`); - this._fireEvent('BeforeServerStart', solutionPath); - - return omnisharpLauncher(cwd, argv).then(value => { - this._serverProcess = value.process; - this._fireEvent('stdout', `[INFO] Started OmniSharp from '${value.command}' with process id ${value.process.pid}...\n`); - return this._doConnect(); - }).then(_ => { - this._fireEvent('ServerStart', solutionPath); - this._setState(ServerState.Started); - this._processQueue(); - }, err => { - this._fireEvent('ServerError', err); - throw err; - }); - } - - protected abstract _doConnect(): Promise; - - public stop(): Promise { - - var ret: Promise; - - if (!this._serverProcess) { - // nothing to kill - ret = Promise.resolve(undefined); - - } else if (/^win/.test(process.platform)) { - // when killing a process in windows its child - // processes are *not* killed but become root - // processes. Therefore we use TASKKILL.EXE - ret = new Promise((resolve, reject) => { - var killer = exec(`taskkill /F /T /PID ${this._serverProcess.pid}`, function (err, stdout, stderr) { - if (err) { - return reject(err); - } - }); - killer.on('exit', resolve); - killer.on('error', reject); - }); - } else { - this._serverProcess.kill('SIGTERM'); - ret = Promise.resolve(undefined); - } - return ret.then(_ => { - this._start = null; - this._serverProcess = null; - this._setState(ServerState.Stopped); - this._fireEvent('ServerStop', this); - return; - }); - } - - public restart(solutionPath: string = this._solutionPath): Promise { - if (solutionPath) { - return this.stop().then(() => { - this.start(solutionPath) - }); - } - } - - public autoStart(preferredPath:string): Thenable { - return getLaunchTargets().then(targets => { - if (targets.length === 0) { - return new Promise((resolve, reject) => { - // 1st watch for files - let watcher = workspace.createFileSystemWatcher('{**/*.sln,**/project.json}', false, true, true); - watcher.onDidCreate(uri => { - watcher.dispose(); - resolve(); - }); - }).then(() => { - // 2nd try again - return this.autoStart(preferredPath); - }); - } - - if (targets.length > 1) { - - for (let target of targets) { - if (target.target.fsPath === preferredPath) { - // start preferred path - return this.restart(preferredPath); - } - } - - this._fireEvent('server:MultipleLaunchTargets', targets); - return Promise.reject(undefined); - } - - // just start - return this.restart(targets[0].target.fsPath); - }); - } - - public makeRequest(path: string, data?: any, token?: CancellationToken): Promise { - - if (this._getState() !== ServerState.Started) { - return Promise.reject('server has been stopped or not started'); - } - - let request: Request; - let promise = new Promise((resolve, reject) => { - request = { - path, - data, - onSuccess: resolve, - onError: reject, - _enqueued: Date.now() - }; - this._queue.push(request); - // this._statOnRequestStart(request); - if (this._getState() === ServerState.Started && !this._isProcessingQueue) { - this._processQueue(); - } - }); - - if (token) { - token.onCancellationRequested(() => { - let idx = this._queue.indexOf(request); - if (idx !== -1) { - this._queue.splice(idx, 1); - let err = new Error('Canceled'); - err.message = 'Canceled'; - request.onError(err); - } - }); - } - - return promise; - } - - private _processQueue(): void { - - if (this._queue.length === 0) { - // nothing to do - this._isProcessingQueue = false; - return; - } - - // signal that we are working on it - this._isProcessingQueue = true; - - // send next request and recurse when done - var thisRequest = this._queue.shift(); - this._makeNextRequest(thisRequest.path, thisRequest.data).then(value => { - thisRequest.onSuccess(value); - this._processQueue(); - // this._statOnRequestEnd(thisRequest, true); - }, err => { - thisRequest.onError(err); - this._processQueue(); - // this._statOnRequestEnd(thisRequest, false); - }).catch(err => { - console.error(err); - this._processQueue(); - }); - } - - protected abstract _makeNextRequest(path: string, data: any): Promise; - - // private _statOnRequestStart(request: Request): void { - // console.log(`[DEBUG] *enqueuing* request '${request.path}' (queue size is ${this._queue.length})\n`); - // } - - // private _statOnRequestEnd(request: Request, successfully: boolean): void { - // var duration = Date.now() - request._enqueued, - // state = successfully ? 'successfully' : 'with errors'; - - // console.log(`[DEBUG] request '${request.path}' finished *${state}* after ${duration}ms\n`); - // } -} - -namespace WireProtocol { - - export interface Packet { - Type: string; - Seq: number; - } - - export interface RequestPacket extends Packet { - Command: string; - Arguments: any; - } - - export interface ResponsePacket extends Packet { - Command: string; - Request_seq: number; - Running: boolean; - Success: boolean; - Message: string; - Body: any; - } - - export interface EventPacket extends Packet { - Event: string; - Body: any; - } -} - -export class StdioOmnisharpServer extends OmnisharpServer { - - private static _seqPool = 1; - private static StartupTimeout = 1000 * 60; - private static ResponsePacketTimeout = 1000 * 60 * 15; // helps debugging - - private _rl: ReadLine; - private _activeRequest: { [seq: number]: { onSuccess: Function; onError: Function; } } = Object.create(null); - private _callOnStop: Function[] = []; - - constructor() { - super(); - - // extra argv - this._extraArgv.push('--stdio'); - } - - public stop(): Promise { - while (this._callOnStop.length) { - this._callOnStop.pop()(); - } - return super.stop(); - } - - protected _doConnect(): Promise { - - this._serverProcess.stderr.on('data', (data: any) => this._fireEvent('stderr', String(data))); - - this._rl = createInterface({ - input: this._serverProcess.stdout, - output: this._serverProcess.stdin, - terminal: false - }); - - var p = new Promise((resolve, reject) => { - var listener: Disposable; - - // timeout logic - var handle = setTimeout(() => { - listener && listener.dispose(); - reject(new Error('Failed to start OmniSharp')); - }, StdioOmnisharpServer.StartupTimeout); - - // handle started-event - listener = this.onOmnisharpStart(() => { - listener && listener.dispose(); - clearTimeout(handle); - resolve(this); - }); - }); - - this._startListening(); - - return p; - } - - private _startListening(): void { - - var onLineReceived = (line: string) => { - if (line[0] !== '{') { - this._fireEvent('stdout', `${line}\n`); - return; - } - - var packet: WireProtocol.Packet; - try { - packet = JSON.parse(line); - } catch (e) { - // not json - return; - } - - if (!packet.Type) { - // bogous packet - return; - } - - switch (packet.Type) { - case 'response': - this._handleResponsePacket( packet); - break; - case 'event': - this._handleEventPacket( packet); - break; - default: - console.warn('unknown packet: ', packet); - break; - } - }; - this._rl.addListener('line', onLineReceived); - this._callOnStop.push(() => this._rl.removeListener('line', onLineReceived)); - } - - private _handleResponsePacket(packet: WireProtocol.ResponsePacket): void { - - var requestSeq = packet.Request_seq, - entry = this._activeRequest[requestSeq]; - - if (!entry) { - console.warn('Received a response WITHOUT a request', packet); - return; - } - - delete this._activeRequest[requestSeq]; - - if (packet.Success) { - entry.onSuccess(packet.Body); - } else { - entry.onError(packet.Message || packet.Body); - } - } - - private _handleEventPacket(packet: WireProtocol.EventPacket): void { - - if (packet.Event === 'log') { - // handle log events - var entry = <{ LogLevel: string; Name: string; Message: string; }> packet.Body; - this._fireEvent('stdout', `[${entry.LogLevel}:${entry.Name}] ${entry.Message}\n`); - return; - } else { - // fwd all other events - this._fireEvent(packet.Event, packet.Body); - } - } - - protected _makeNextRequest(path: string, data: any): Promise { - - var thisRequestPacket: WireProtocol.RequestPacket = { - Type: 'request', - Seq: StdioOmnisharpServer._seqPool++, - Command: path, - Arguments: data - }; - - return new Promise((c, e) => { - - this._activeRequest[thisRequestPacket.Seq] = { - onSuccess: c, - onError: e - }; - - this._serverProcess.stdin.write(JSON.stringify(thisRequestPacket) + '\n'); - }); - } -} diff --git a/extensions/csharp-o/src/omnisharpServerLauncher.ts b/extensions/csharp-o/src/omnisharpServerLauncher.ts deleted file mode 100644 index 618f26b71fe..00000000000 --- a/extensions/csharp-o/src/omnisharpServerLauncher.ts +++ /dev/null @@ -1,161 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 {exists as fileExists} from 'fs'; -import {spawn, ChildProcess} from 'child_process'; -import {workspace} from 'vscode'; -import {satisfies} from 'semver'; -import {join} from 'path'; - -var omnisharpEnv = 'OMNISHARP'; -var isWindows = /^win/.test(process.platform); - -export default function launch(cwd: string, args: string[]):Promise < { process: ChildProcess, command: string } > { - - return new Promise((resolve, reject) => { - - try { - (isWindows ? launchWindows(cwd, args) : launchNix(cwd, args)).then(value => { - - // async error - when target not not ENEOT - value.process.on('error', reject); - - // success after a short freeing event loop - setTimeout(function () { - resolve(value); - }, 0); - }, err => { - reject(err); - }); - - } catch (err) { - reject(err); - } - }); -} - -function launchWindows(cwd: string, args: string[]): Promise<{ process: ChildProcess, command: string }> { - return getOmnisharpPath().then(command => { - - args = args.slice(0); - args.unshift(command); - args = [[ - '/s', - '/c', - '"' + args.map(arg => /^[^"].* .*[^"]/.test(arg) ? `"${arg}"` : arg).join(' ') + '"' - ].join(' ')]; - - let process = spawn('cmd', args, { - windowsVerbatimArguments: true, - detached: false, - // env: details.env, - cwd: cwd - }); - - return { - process, - command - }; - }); -} - -function launchNix(cwd: string, args: string[]): Promise<{ process: ChildProcess, command: string }>{ - - return new Promise((resolve, reject) => { - hasMono('>=4.0.1').then(hasIt => { - if (!hasIt) { - reject(new Error('Cannot start Omnisharp because Mono version >=4.0.1 is required. See http://go.microsoft.com/fwlink/?linkID=534832#_20001')); - } else { - resolve(); - } - }); - }).then(_ => { - return getOmnisharpPath(); - }).then(command => { - let process = spawn(command, args, { - detached: false, - // env: details.env, - cwd - }); - - return { - process, - command - } - }); -} - -function getOmnisharpPath(): Promise { - - let pathCandidate: string; - - let config = workspace.getConfiguration(); - if (config.has('csharp.omnisharp')) { - // form config - pathCandidate = config.get('csharp.omnisharp'); - - } else if (typeof process.env[omnisharpEnv] === 'string') { - // form enviroment variable - console.warn('[deprecated] use workspace or user settings with "csharp.omnisharp":"/path/to/omnisharp"'); - pathCandidate = process.env[omnisharpEnv]; - - } else { - // bundled version of Omnisharp - pathCandidate = join(__dirname, '../bin/omnisharp') - if (isWindows) { - pathCandidate += '.cmd'; - } - } - - return new Promise((resolve, reject) => { - fileExists(pathCandidate, localExists => { - if (localExists) { - resolve(pathCandidate); - } else { - reject('OmniSharp does not exist at location: ' + pathCandidate); - } - }); - }); -} - -const versionRegexp = /(\d+\.\d+\.\d+)/; - -export function hasMono(range?: string): Promise { - - return new Promise((resolve, reject) => { - let childprocess: ChildProcess; - try { - childprocess = spawn('mono', ['--version']); - } catch (e) { - return resolve(false); - } - - childprocess.on('error', function (err: any) { - resolve(false); - }); - - let stdout = ''; - childprocess.stdout.on('data', (data: NodeBuffer) => { - stdout += data.toString(); - }); - - childprocess.stdout.on('close', () => { - let match = versionRegexp.exec(stdout), - ret: boolean; - - if (!match) { - ret = false; - } else if (!range) { - ret = true; - } else { - ret = satisfies(match[1], range); - } - - resolve(ret); - }); - }); -} \ No newline at end of file diff --git a/extensions/csharp-o/src/protocol.ts b/extensions/csharp-o/src/protocol.ts deleted file mode 100644 index e7bf125a7d2..00000000000 --- a/extensions/csharp-o/src/protocol.ts +++ /dev/null @@ -1,416 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -'use strict'; - -export var GoToDefinition = '/gotoDefinition'; - -export var CodeCheck = '/codecheck'; - -export var AutoComplete = '/autocomplete'; - -export var CurrentFileMembersAsTree = '/currentfilemembersastree'; - -export var TypeLookup = '/typelookup'; - -export var AddToProject = '/addtoproject'; - -export var RemoveFromProject = '/removefromproject'; - -export var FindUsages = '/findusages'; - -export var FindSymbols = '/findsymbols'; - -export var CodeFormat = '/codeformat'; - -export var GetCodeActions = '/getcodeactions'; - -export var RunCodeAction = '/runcodeaction'; - -export var FormatAfterKeystroke = '/formatAfterKeystroke'; - -export var FormatRange = '/formatRange'; - -export var UpdateBuffer = '/updatebuffer'; - -export var ChangeBuffer = '/changebuffer'; - -export var Projects = '/projects'; - -export var Rename = '/rename'; - -export var FilesChanged = '/filesChanged'; - -export var SignatureHelp = '/signatureHelp'; - -export interface Request { - Filename: string; - Line?: number; - Column?: number; - Buffer?: string; -} - -export interface ChangeBufferRequest { - FileName: string; - StartLine: number; - StartColumn: number; - EndLine: number; - EndColumn: number; - NewText: string; -} - -export interface AddToProjectRequest extends Request { - //? -} - -export interface RemoveFromProjectRequest extends Request { - //? -} - -export interface FindUsagesRequest extends Request { - // MaxWidth: number; ? - OnlyThisFile: boolean; - ExcludeDefinition: boolean; -} - -export interface FindSymbolsRequest extends Request { - Filter: string; -} - -export interface FormatRequest extends Request { - ExpandTab: boolean; -} - -export interface CodeActionRequest extends Request { - CodeAction: number; - WantsTextChanges?: boolean; - SelectionStartColumn?: number; - SelectionStartLine?: number; - SelectionEndColumn?: number; - SelectionEndLine?: number; -} - -export interface FormatResponse { - Buffer: string; -} - -export interface TextChange { - NewText: string; - StartLine: number; - StartColumn: number; - EndLine: number; - EndColumn: number; -} - -export interface FormatAfterKeystrokeRequest extends Request { - Character: string; -} - -export interface FormatRangeRequest extends Request { - EndLine: number; - EndColumn: number; -} - -export interface FormatRangeResponse { - Changes: TextChange[]; -} - -export interface ResourceLocation { - FileName: string; - Line: number; - Column: number; -} - -export interface Error { - Message: string; - Line: number; - Column: number; - EndLine: number; - EndColumn: number; - FileName: string; -} - -export interface ErrorResponse { - Errors: Error[]; -} - -export interface QuickFix { - LogLevel: string; - FileName: string; - Line: number; - Column: number; - EndLine: number; - EndColumn: number; - Text: string; - Projects: string[]; -} - -export interface SymbolLocation extends QuickFix { - Kind: string; -} - -export interface QuickFixResponse { - QuickFixes: QuickFix[]; -} - -export interface FindSymbolsResponse { - QuickFixes: SymbolLocation[]; -} - -export interface TypeLookupRequest extends Request { - IncludeDocumentation: boolean; -} - -export interface TypeLookupResponse { - Type: string; - Documentation: string; -} - -export interface RunCodeActionResponse { - Text: string; - Changes: TextChange[]; -} - -export interface GetCodeActionsResponse { - CodeActions: string[]; -} - -export interface Node { - ChildNodes: Node[]; - Location: QuickFix; - Kind: string; -} - -export interface CurrentFileMembersAsTreeResponse { - TopLevelTypeDefinitions: Node[]; -} - -export interface AutoCompleteRequest extends Request { - WordToComplete: string; - WantDocumentationForEveryCompletionResult?: boolean; - WantImportableTypes?: boolean; - WantMethodHeader?: boolean; - WantSnippet?: boolean; - WantReturnType?: boolean; - WantKind?: boolean; -} - -export interface AutoCompleteResponse { - CompletionText: string; - Description: string; - DisplayText: string; - RequiredNamespaceImport: string; - MethodHeader: string; - ReturnType: string; - Snippet: string; - Kind: string; -} - -export interface ProjectInformationResponse { - MsBuildProject: MSBuildProject; - DnxProject: DnxProject; -} - -export interface WorkspaceInformationResponse { - MSBuild: MsBuildWorkspaceInformation; - Dnx: DnxWorkspaceInformation; - ScriptCs: ScriptCsContext; -} - -export interface MsBuildWorkspaceInformation { - SolutionPath: string; - Projects: MSBuildProject[]; -} - -export interface ScriptCsContext { - CsxFiles: { [n: string]: string }; - References: { [n: string]: string }; - Usings: { [n: string]: string }; - ScriptPacks: { [n: string]: string }; - Path: string; -} - -export interface MSBuildProject { - ProjectGuid: string; - Path: string; - AssemblyName: string; - TargetPath: string; - TargetFramework: string; - SourceFiles: string[]; -} - -export interface DnxWorkspaceInformation { - RuntimePath: string; - DesignTimeHostPort: number; - Projects: DnxProject[]; -} - -export interface DnxProject { - Path: string; - Name: string; - Commands: { [name: string]: string; }; - Configurations: string[]; - ProjectSearchPaths: string[]; - Frameworks: DnxFramework[]; - GlobalJsonPath: string; - SourceFiles: string[]; -} - -export interface DnxFramework { - Name: string; - FriendlyName: string; - ShortName: string; -} - -export interface RenameRequest extends Request { - RenameTo: string; - WantsTextChanges?: boolean; -} - -export interface ModifiedFileResponse { - FileName: string; - Buffer: string; - Changes: TextChange[]; -} - -export interface RenameResponse { - Changes: ModifiedFileResponse[]; -} - -export interface SignatureHelp { - Signatures: SignatureHelpItem[]; - ActiveSignature: number; - ActiveParameter: number; -} - -export interface SignatureHelpItem { - Name: string; - Label: string; - Documentation: string; - Parameters: SignatureHelpParameter[]; -} - -export interface SignatureHelpParameter { - Name: string; - Label: string; - Documentation: string; -} - -export interface MSBuildProjectDiagnostics { - FileName: string; - Warnings: MSBuildDiagnosticsMessage[]; - Errors: MSBuildDiagnosticsMessage[]; -} - -export interface MSBuildDiagnosticsMessage { - LogLevel: string; - FileName: string; - Text: string; - StartLine: number; - StartColumn: number; - EndLine: number; - EndColumn: number; -} - -export interface ErrorMessage { - Text: string; - FileName: string; - Line: number; - Column: number; -} - -export interface PackageRestoreMessage { - FileName: string; - Succeeded: boolean; -} - -export interface UnresolvedDependenciesMessage { - FileName: string; - UnresolvedDependencies: PackageDependency[]; -} - -export interface PackageDependency { - Name: string; - Version: string; -} - -export namespace V2 { - - export var GetCodeActions = '/v2/getcodeactions'; - export var RunCodeAction = '/v2/runcodeaction'; - - export interface Point { - Line: number; - Column: number; - } - - export interface Range { - Start: Point; - End: Point; - } - - export interface GetCodeActionsRequest extends Request { - Selection: Range - } - - export interface OmniSharpCodeAction { - Identifier: string; - Name: string; - } - - export interface GetCodeActionsResponse { - CodeActions: OmniSharpCodeAction[]; - } - - export interface RunCodeActionRequest extends Request { - Identifier: string; - Selection: Range; - WantsTextChanges: boolean; - } - - export interface RunCodeActionResponse { - Changes: ModifiedFileResponse[]; - } - - - export interface MSBuildProjectDiagnostics { - FileName: string; - Warnings: MSBuildDiagnosticsMessage[]; - Errors: MSBuildDiagnosticsMessage[]; - } - - export interface MSBuildDiagnosticsMessage { - LogLevel: string; - FileName: string; - Text: string; - StartLine: number; - StartColumn: number; - EndLine: number; - EndColumn: number; - } - - export interface ErrorMessage { - Text: string; - FileName: string; - Line: number; - Column: number; - } - - export interface PackageRestoreMessage { - FileName: string; - Succeeded: boolean; - } - - export interface UnresolvedDependenciesMessage { - FileName: string; - UnresolvedDependencies: PackageDependency[]; - } - - export interface PackageDependency { - Name: string; - Version: string; - } - -} \ No newline at end of file diff --git a/extensions/csharp-o/src/typeConvertion.ts b/extensions/csharp-o/src/typeConvertion.ts deleted file mode 100644 index aa81c426ab0..00000000000 --- a/extensions/csharp-o/src/typeConvertion.ts +++ /dev/null @@ -1,72 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 * as proto from './protocol'; -import * as vscode from 'vscode'; - -export function toLocation(location: proto.ResourceLocation): vscode.Location { - let {FileName, Line, Column} = location; - return new vscode.Location(vscode.Uri.file(FileName), new vscode.Position(Line - 1, Column - 1)); -} - -export function toRange(rangeLike: { Line: number; Column: number; EndLine: number; EndColumn: number;}): vscode.Range { - let {Line, Column, EndLine, EndColumn} = rangeLike; - return new vscode.Range(Line - 1, Column - 1, EndLine - 1, EndColumn - 1); -} - -export function toRange2(rangeLike: { StartLine: number; StartColumn: number; EndLine: number; EndColumn: number;}): vscode.Range { - let {StartLine, StartColumn, EndLine, EndColumn} = rangeLike; - return new vscode.Range(StartLine - 1, StartColumn - 1, EndLine - 1, EndColumn - 1); -} - -export function createRequest(document: vscode.TextDocument, where: vscode.Position | vscode.Range, includeBuffer:boolean = false): T { - - let Line: number, Column: number; - - if (where instanceof vscode.Position) { - Line = where.line + 1; - Column = where.character + 1; - } else if(where instanceof vscode.Range) { - Line = where.start.line + 1; - Column = where.start.character + 1 - } - - let request: proto.Request = { - Filename: document.fileName, - Buffer: includeBuffer ? document.getText() : undefined, - Line, - Column - }; - - return request; -} - -export function toDocumentSymbol(bucket: vscode.SymbolInformation[], node: proto.Node, containerLabel?: string): void { - - let ret = new vscode.SymbolInformation(node.Location.Text, kinds[node.Kind], - toRange(node.Location), - undefined, containerLabel); - - if (node.ChildNodes) { - for (let child of node.ChildNodes) { - toDocumentSymbol(bucket, child, ret.name) - } - } - bucket.push(ret); -} - -var kinds: { [kind: string]: vscode.SymbolKind; } = Object.create(null); -kinds['NamespaceDeclaration'] = vscode.SymbolKind.Namespace; -kinds['ClassDeclaration'] = vscode.SymbolKind.Class; -kinds['FieldDeclaration'] = vscode.SymbolKind.Field; -kinds['PropertyDeclaration'] = vscode.SymbolKind.Property; -kinds['EventFieldDeclaration'] = vscode.SymbolKind.Property; -kinds['MethodDeclaration'] = vscode.SymbolKind.Method; -kinds['EnumDeclaration'] = vscode.SymbolKind.Enum; -kinds['StructDeclaration'] = vscode.SymbolKind.Enum; -kinds['EnumMemberDeclaration'] = vscode.SymbolKind.Property; -kinds['InterfaceDeclaration'] = vscode.SymbolKind.Interface; -kinds['VariableDeclaration'] = vscode.SymbolKind.Variable; diff --git a/extensions/csharp-o/src/typings/applicationinsights.d.ts b/extensions/csharp-o/src/typings/applicationinsights.d.ts deleted file mode 100644 index 7c2c37d2b03..00000000000 --- a/extensions/csharp-o/src/typings/applicationinsights.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -declare class Client { - public context: any; - public config: any; - public trackEvent(eventName: string, properties: {[key: string]: string}, measures?: {[key: string]: number}): void; -} - -declare class ApplicationInsights { - static client: Client; - /** - * Initializes a client with the given instrumentation key, if this is not specified, the value will be - * read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY - * @returns {ApplicationInsights/Client} a new client - */ - static getClient(instrumentationKey?: string): Client; - /** - * Initializes the default client of the client and sets the default configuration - * @param instrumentationKey the instrumentation key to use. Optional, if this is not specified, the value will be - * read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY - * @returns {ApplicationInsights} this class - */ - static setup(instrumentationKey?: string): typeof ApplicationInsights; - /** - * Starts automatic collection of telemetry. Prior to calling start no telemetry will be collected - * @returns {ApplicationInsights} this class - */ - static start(): typeof ApplicationInsights; - /** - * Sets the state of console tracking (enabled by default) - * @param value if true console activity will be sent to Application Insights - * @returns {ApplicationInsights} this class - */ - static setAutoCollectConsole(value: boolean): typeof ApplicationInsights; - /** - * Sets the state of exception tracking (enabled by default) - * @param value if true uncaught exceptions will be sent to Application Insights - * @returns {ApplicationInsights} this class - */ - static setAutoCollectExceptions(value: boolean): typeof ApplicationInsights; - /** - * Sets the state of performance tracking (enabled by default) - * @param value if true performance counters will be collected every second and sent to Application Insights - * @returns {ApplicationInsights} this class - */ - static setAutoCollectPerformance(value: boolean): typeof ApplicationInsights; - /** - * Sets the state of request tracking (enabled by default) - * @param value if true requests will be sent to Application Insights - * @returns {ApplicationInsights} this class - */ - static setAutoCollectRequests(value: boolean): typeof ApplicationInsights; - - /** - * Sets the state of enabling offline mode to cache event when client is offline (disabled by default) - * @param value if true events that happen while client is offline will be cahced on disk, - * client will retry to send events when back online - * @returns {ApplicationInsights} this class - */ - public static setOfflineMode(value: boolean): typeof ApplicationInsights; - /** - * Enables verbose debug logging - * @returns {ApplicationInsights} this class - */ - static enableVerboseLogging(): typeof ApplicationInsights; -} - - -declare module 'applicationinsights' { - export = ApplicationInsights; -} \ No newline at end of file diff --git a/extensions/csharp-o/src/typings/semver/semver.d.ts b/extensions/csharp-o/src/typings/semver/semver.d.ts deleted file mode 100644 index cb8efa4f500..00000000000 --- a/extensions/csharp-o/src/typings/semver/semver.d.ts +++ /dev/null @@ -1,125 +0,0 @@ -// Type definitions for semver v2.2.1 -// Project: https://github.com/isaacs/node-semver -// Definitions by: Bart van der Schoor -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module SemVerModule { - /** - * Return the parsed version, or null if it's not valid. - */ - function valid(v: string, loose?: boolean): string; - /** - * Return the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid. - */ - function inc(v: string, release: string, loose?: boolean): string; - - // Comparison - /** - * v1 > v2 - */ - function gt(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 >= v2 - */ - function gte(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 < v2 - */ - function lt(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 <= v2 - */ - function lte(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings. - */ - function eq(v1: string, v2: string, loose?: boolean): boolean; - /** - * v1 != v2 The opposite of eq. - */ - function neq(v1: string, v2: string, loose?: boolean): boolean; - /** - * Pass in a comparison string, and it'll call the corresponding semver comparison function. "===" and "!==" do simple string comparison, but are included for completeness. Throws if an invalid comparison string is provided. - */ - function cmp(v1: string, comparator: any, v2: string, loose?: boolean): boolean; - /** - * Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if v2 is greater. Sorts in ascending order if passed to Array.sort(). - */ - function compare(v1: string, v2: string, loose?: boolean): number; - /** - * The reverse of compare. Sorts an array of versions in descending order when passed to Array.sort(). - */ - function rcompare(v1: string, v2: string, loose?: boolean): number; - - // Ranges - /** - * Return the valid range or null if it's not valid - */ - function validRange(range: string, loose?: boolean): string; - /** - * Return true if the version satisfies the range. - */ - function satisfies(version: string, range: string, loose?: boolean): boolean; - /** - * Return the highest version in the list that satisfies the range, or null if none of them do. - */ - function maxSatisfying(versions: string[], range: string, loose?: boolean): string; - /** - * Return true if version is greater than all the versions possible in the range. - */ - function gtr(version: string, range: string, loose?: boolean): boolean; - /** - * Return true if version is less than all the versions possible in the range. - */ - function ltr(version: string, range: string, loose?: boolean): boolean; - /** - * Return true if the version is outside the bounds of the range in either the high or low direction. The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.) - */ - function outside(version: string, range: string, hilo: string, loose?: boolean): boolean; - - class SemVerBase { - raw: string; - loose: boolean; - format(): string; - inspect(): string; - toString(): string; - } - - class SemVer extends SemVerBase { - constructor(version: string, loose?: boolean); - - major: number; - minor: number; - patch: number; - version: string; - build: string[]; - prerelease: string[]; - - compare(other:SemVer): number; - compareMain(other:SemVer): number; - comparePre(other:SemVer): number; - inc(release: string): SemVer; - } - - class Comparator extends SemVerBase { - constructor(comp: string, loose?: boolean); - - semver: SemVer; - operator: string; - value: boolean; - parse(comp: string): void; - test(version:SemVer): boolean; - } - - class Range extends SemVerBase { - constructor(range: string, loose?: boolean); - - set: Comparator[][]; - parseRange(range: string): Comparator[]; - test(version: SemVer): boolean; - } -} - -declare module "semver" { - export = SemVerModule; -} diff --git a/extensions/csharp-o/tsconfig.json b/extensions/csharp-o/tsconfig.json deleted file mode 100644 index 73d8ec0fc68..00000000000 --- a/extensions/csharp-o/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "compilerOptions": { - "noLib": true, - "target": "ES5", - "module": "commonjs", - "outDir": "out", - "sourceMap": true - }, - "exclude": [ - "node_modules" - ] -} \ No newline at end of file diff --git a/extensions/csharp-o/typings/mocha.d.ts b/extensions/csharp-o/typings/mocha.d.ts deleted file mode 100644 index 7b23f5d1816..00000000000 --- a/extensions/csharp-o/typings/mocha.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare function run(): void; - -declare function suite(name: string, fn: (err?)=>void); -declare function test(name: string, fn: (done?: (err?)=>void)=>void); -declare function suiteSetup(fn: (done?: (err?)=>void)=>void); -declare function suiteTeardown(fn: (done?: (err?)=>void)=>void); -declare function setup(fn: (done?: (err?)=>void)=>void); -declare function teardown(fn: (done?: (err?)=>void)=>void); diff --git a/extensions/css/snippets/css.json b/extensions/css/snippets/css.json index 73065292a81..b470172f3ff 100644 --- a/extensions/css/snippets/css.json +++ b/extensions/css/snippets/css.json @@ -14,5 +14,15 @@ "border: ${width} ${border-style} ${color};$0" ], "description": "[width] [border-style] [color]" + }, + "gradient": { + "prefix": "gradient", + "body": [ + "background-image: -moz-linear-gradient(top, ${start-color}, ${end-color});", + "background-image: -webkit-gradient(linear, left top, left bottom, from(${start-color}), to(${end-color}));", + "background-image: -webkit-linear-gradient(top, ${start-color}, ${end-color});", + "background-image: linear-gradient(top, ${start-color}, ${end-color});" + ], + "description": "Set the 'background-image' property to a linear gradient" } -} \ No newline at end of file +} diff --git a/extensions/fsharp/syntaxes/fsharp.json b/extensions/fsharp/syntaxes/fsharp.json index f248027a9e9..f65bba136d3 100644 --- a/extensions/fsharp/syntaxes/fsharp.json +++ b/extensions/fsharp/syntaxes/fsharp.json @@ -96,7 +96,7 @@ "patterns": [ { "name": "comment.block.fsharp", - "begin": "(\\(\\*)", + "begin": "(\\(\\*(?!\\)))", "end": "(\\*\\))", "beginCaptures": { "1": { diff --git a/extensions/html/OSSREADME.json b/extensions/html/OSSREADME.json new file mode 100644 index 00000000000..6d2ab8bb14c --- /dev/null +++ b/extensions/html/OSSREADME.json @@ -0,0 +1,22 @@ +// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS: +[{ + "name": "textmate/html.tmbundle", + "version": "0.0.0", + "license": "TextMate Bundle License", + "repositoryURL": "https://github.com/textmate/html.tmbundle", + "licenseDetail": [ + "Copyright (c) textmate-html.tmbundle project authors", + "", + "If not otherwise specified (see below), files in this repository fall under the following license:", + "", + "Permission to copy, use, modify, sell and distribute this", + "software is granted. This software is provided \"as is\" without", + "express or implied warranty, and with no claim as to its", + "suitability for any purpose.", + "", + "An exception is made for files in readable text which contain their own license information,", + "or files where an accompanying file exists (in the same directory) with a \"-license\" suffix added", + "to the base-name name of the original file, and an extension of txt, html, or similar. For example", + "\"tidy\" is accompanied by \"tidy-license.txt\"." + ] +}] diff --git a/extensions/html/package.json b/extensions/html/package.json index a696d241ac4..96c8f0e7bcd 100644 --- a/extensions/html/package.json +++ b/extensions/html/package.json @@ -2,5 +2,19 @@ "name": "html", "version": "0.1.0", "publisher": "vscode", - "engines": { "vscode": "*" } + "engines": { "vscode": "*" }, + "contributes": { + "languages": [{ + "id": "html", + "extensions": [ ".html", ".htm", ".shtml", ".mdoc", ".jsp", ".asp", ".aspx", ".jshtm" ], + "aliases": [ "HTML", "htm", "html", "xhtml" ], + "mimetypes": ["text/html", "text/x-jshtm", "text/template", "text/ng-template"] + }], + "grammars": [{ + /* "language": "html", not yet enabled*/ + "scopeName": "text.html.basic", + "path": "./syntaxes/HTML.plist" + }] + } + } \ No newline at end of file diff --git a/extensions/html/syntaxes/HTML.plist b/extensions/html/syntaxes/HTML.plist new file mode 100644 index 00000000000..d6533b2786a --- /dev/null +++ b/extensions/html/syntaxes/HTML.plist @@ -0,0 +1,855 @@ + + + + + fileTypes + + html + htm + shtml + xhtml + inc + tmpl + tpl + + firstLineMatch + <(?i:(!DOCTYPE\s*)?html) + injections + + R:text.html - comment.block + + comment + Use R: to ensure this matches after any other injections. + patterns + + + match + < + name + invalid.illegal.bad-angle-bracket.html + + + + + keyEquivalent + ^~H + name + HTML + patterns + + + begin + (<)([a-zA-Z0-9:]++)(?=[^>]*></\2>) + beginCaptures + + 1 + + name + punctuation.definition.tag.html + + 2 + + name + entity.name.tag.html + + + end + (>(<)/)(\2)(>) + endCaptures + + 1 + + name + punctuation.definition.tag.html + + 2 + + name + meta.scope.between-tag-pair.html + + 3 + + name + entity.name.tag.html + + 4 + + name + punctuation.definition.tag.html + + + name + meta.tag.any.html + patterns + + + include + #tag-stuff + + + + + begin + (<\?)(xml) + captures + + 1 + + name + punctuation.definition.tag.html + + 2 + + name + entity.name.tag.xml.html + + + end + (\?>) + name + meta.tag.preprocessor.xml.html + patterns + + + include + #tag-generic-attribute + + + include + #string-double-quoted + + + include + #string-single-quoted + + + + + begin + <!-- + captures + + 0 + + name + punctuation.definition.comment.html + + + end + --\s*> + name + comment.block.html + patterns + + + match + -- + name + invalid.illegal.bad-comments-or-CDATA.html + + + include + #embedded-code + + + + + begin + <! + captures + + 0 + + name + punctuation.definition.tag.html + + + end + > + name + meta.tag.sgml.html + patterns + + + begin + (?i:DOCTYPE) + captures + + 1 + + name + entity.name.tag.doctype.html + + + end + (?=>) + name + meta.tag.sgml.doctype.html + patterns + + + match + "[^">]*" + name + string.quoted.double.doctype.identifiers-and-DTDs.html + + + + + begin + \[CDATA\[ + end + ]](?=>) + name + constant.other.inline-data.html + + + match + (\s*)(?!--|>)\S(\s*) + name + invalid.illegal.bad-comments-or-CDATA.html + + + + + include + #embedded-code + + + begin + (?:^\s+)?(<)((?i:style))\b(?![^>]*/>) + captures + + 1 + + name + punctuation.definition.tag.html + + 2 + + name + entity.name.tag.style.html + + 3 + + name + punctuation.definition.tag.html + + + end + (</)((?i:style))(>)(?:\s*\n)? + name + source.css.embedded.html + patterns + + + include + #tag-stuff + + + begin + (>) + beginCaptures + + 1 + + name + punctuation.definition.tag.html + + + end + (?=</(?i:style)) + patterns + + + include + #embedded-code + + + include + source.css + + + + + + + begin + (?:^\s+)?(<)((?i:script))\b(?![^>]*/>)(?![^>]*(?i:type.?=.?text/((?!javascript).*))) + beginCaptures + + 1 + + name + punctuation.definition.tag.html + + 2 + + name + entity.name.tag.script.html + + + end + (?<=</(script|SCRIPT))(>)(?:\s*\n)? + endCaptures + + 2 + + name + punctuation.definition.tag.html + + + name + source.js.embedded.html + patterns + + + include + #tag-stuff + + + begin + (?<!</(?:script|SCRIPT))(>) + captures + + 1 + + name + punctuation.definition.tag.html + + 2 + + name + entity.name.tag.script.html + + + end + (</)((?i:script)) + patterns + + + captures + + 1 + + name + punctuation.definition.comment.js + + + match + (//).*?((?=</script)|$\n?) + name + comment.line.double-slash.js + + + begin + /\* + captures + + 0 + + name + punctuation.definition.comment.js + + + end + \*/|(?=</script) + name + comment.block.js + + + include + source.js + + + + + + + begin + (</?)((?i:body|head|html)\b) + captures + + 1 + + name + punctuation.definition.tag.html + + 2 + + name + entity.name.tag.structure.any.html + + + end + (>) + name + meta.tag.structure.any.html + patterns + + + include + #tag-stuff + + + + + begin + (</?)((?i:address|blockquote|dd|div|section|article|aside|header|footer|nav|menu|dl|dt|fieldset|form|frame|frameset|h1|h2|h3|h4|h5|h6|iframe|noframes|object|ol|p|ul|applet|center|dir|hr|pre)\b) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.block.any.html + + + end + (>) + endCaptures + + 1 + + name + punctuation.definition.tag.end.html + + + name + meta.tag.block.any.html + patterns + + + include + #tag-stuff + + + + + begin + (</?)((?i:a|abbr|acronym|area|b|base|basefont|bdo|big|br|button|caption|cite|code|col|colgroup|del|dfn|em|font|head|html|i|img|input|ins|isindex|kbd|label|legend|li|link|map|meta|noscript|optgroup|option|param|q|s|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|var)\b) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.inline.any.html + + + end + ((?: ?/)?>) + endCaptures + + 1 + + name + punctuation.definition.tag.end.html + + + name + meta.tag.inline.any.html + patterns + + + include + #tag-stuff + + + + + begin + (</?)([a-zA-Z0-9:]+) + beginCaptures + + 1 + + name + punctuation.definition.tag.begin.html + + 2 + + name + entity.name.tag.other.html + + + end + (>) + endCaptures + + 1 + + name + punctuation.definition.tag.end.html + + + name + meta.tag.other.html + patterns + + + include + #tag-stuff + + + + + include + #entities + + + match + <> + name + invalid.illegal.incomplete.html + + + repository + + embedded-code + + patterns + + + include + #smarty + + + include + #python + + + + entities + + patterns + + + captures + + 1 + + name + punctuation.definition.entity.html + + 3 + + name + punctuation.definition.entity.html + + + match + (&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;) + name + constant.character.entity.html + + + match + & + name + invalid.illegal.bad-ampersand.html + + + + python + + begin + (?:^\s*)<\?python(?!.*\?>) + end + \?>(?:\s*$\n)? + name + source.python.embedded.html + patterns + + + include + source.python + + + + smarty + + patterns + + + begin + (\{(literal)\}) + captures + + 1 + + name + source.smarty.embedded.html + + 2 + + name + support.function.built-in.smarty + + + end + (\{/(literal)\}) + + + begin + {{|{ + disabled + 1 + end + }}|} + name + source.smarty.embedded.html + patterns + + + include + source.smarty + + + + + + string-double-quoted + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.html + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.html + + + name + string.quoted.double.html + patterns + + + include + #embedded-code + + + include + #entities + + + + string-single-quoted + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.html + + + end + ' + endCaptures + + 0 + + name + punctuation.definition.string.end.html + + + name + string.quoted.single.html + patterns + + + include + #embedded-code + + + include + #entities + + + + tag-generic-attribute + + match + (?<=[^=])\b([a-zA-Z0-9:-]+) + name + entity.other.attribute-name.html + + tag-id-attribute + + begin + \b(id)\b\s*(=) + captures + + 1 + + name + entity.other.attribute-name.id.html + + 2 + + name + punctuation.separator.key-value.html + + + end + (?!\G)(?<='|"|[^\s<>/]) + name + meta.attribute-with-value.id.html + patterns + + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.html + + + contentName + meta.toc-list.id.html + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.html + + + name + string.quoted.double.html + patterns + + + include + #embedded-code + + + include + #entities + + + + + begin + ' + beginCaptures + + 0 + + name + punctuation.definition.string.begin.html + + + contentName + meta.toc-list.id.html + end + ' + endCaptures + + 0 + + name + punctuation.definition.string.end.html + + + name + string.quoted.single.html + patterns + + + include + #embedded-code + + + include + #entities + + + + + captures + + 0 + + name + meta.toc-list.id.html + + + match + (?<==)(?:[^\s<>/'"]|/(?!>))+ + name + string.unquoted.html + + + + tag-stuff + + patterns + + + include + #tag-id-attribute + + + include + #tag-generic-attribute + + + include + #string-double-quoted + + + include + #string-single-quoted + + + include + #embedded-code + + + include + #unquoted-attribute + + + + unquoted-attribute + + match + (?<==)(?:[^\s<>/'"]|/(?!>))+ + name + string.unquoted.html + + + scopeName + text.html.basic + uuid + 17994EC8-6B1D-11D9-AC3A-000D93589AF6 + + \ No newline at end of file diff --git a/extensions/javascript/OSSREADME.json b/extensions/javascript/OSSREADME.json index bf9126ae300..db887d6c5ab 100644 --- a/extensions/javascript/OSSREADME.json +++ b/extensions/javascript/OSSREADME.json @@ -1,11 +1,11 @@ // ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS: [{ - "name": "typescript-sublime-plugin", - "version": "0.1.8", + "name": "Microsoft/TypeScript-TmLanguage", + "version": "0.0.1", "license": "Apache2", - "repositoryURL": "https://github.com/Microsoft/TypeScript-Sublime-Plugin", - "description": "The file syntaxes/JavaScriptReact.tmLanguage was derived from the TypeScript-Sublime-Plugin https://github.com/Microsoft/TypeScript-Sublime-Plugin.", + "repositoryURL": "https://github.com/Microsoft/TypeScript-TmLanguage", + "description": "The files syntaxes/JavaScriptReact.tmLanguage & syntaxes/JavaScript.tmLanguage were derived from TypeScript-TmLanguage https://github.com/Microsoft/TypeScript-TmLanguage.", "licenseDetail": [ // Reason: LICENSE file does not include Copyright statement "Copyright (c) Microsoft Corporation. All rights reserved.", diff --git a/extensions/javascript/javascript.configuration.json b/extensions/javascript/javascript.configuration.json new file mode 100644 index 00000000000..da6ed547150 --- /dev/null +++ b/extensions/javascript/javascript.configuration.json @@ -0,0 +1,11 @@ +{ + "comments": { + "lineComment": "//", + "blockComment": [ "/*", "*/" ] + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ] +} \ No newline at end of file diff --git a/extensions/javascript/package.json b/extensions/javascript/package.json index e9c2ed6a9a1..17834d8ee29 100644 --- a/extensions/javascript/package.json +++ b/extensions/javascript/package.json @@ -7,9 +7,9 @@ "languages": [{ "id": "javascriptreact", "aliases": ["JavaScript React","jsx"], - "extensions": [".jsx"] - }, - { + "extensions": [".jsx"], + "configuration": "./javascript.configuration.json" + },{ "id": "javascript", "aliases": ["JavaScript", "javascript", "js"], "extensions": [".js", ".es6"], @@ -26,6 +26,7 @@ "scopeName": "source.js", "path": "./syntaxes/JavaScript.tmLanguage" },{ + // referenced by other grammars "scopeName": "source.js.regexp", "path": "./syntaxes/Regular Expressions (JavaScript).tmLanguage" }], diff --git a/extensions/javascript/syntaxes/JavaScript.tmLanguage b/extensions/javascript/syntaxes/JavaScript.tmLanguage index ed1f2245ae3..89987b89ef3 100644 --- a/extensions/javascript/syntaxes/JavaScript.tmLanguage +++ b/extensions/javascript/syntaxes/JavaScript.tmLanguage @@ -2,97 +2,694 @@ - comment - JavaScript Syntax: version 2.0 fileTypes js - htc - jsx - injections - - source.js - meta.ternary-if.js - string - comment - - patterns - - - match - (?<!\w)[\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*(?=\s*:\s*function\b) - name - entity.name.function.js - - - match - (?<!\w)[\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*(?=\s*:) - name - entity.name.attribute-name.js - - - - - keyEquivalent - ^~J name JavaScript patterns + + include + #expression + + + repository + + access-modifier + + match + \b(public|protected|private)\b + name + storage.modifier.js + + arithmetic-operator + + match + \*|/|\-\-|\-|\+\+|\+|% + name + keyword.operator.arithmetic.js + + array-literal + + begin + \[ + beginCaptures + + 0 + + name + meta.brace.square.js + + + end + \] + endCaptures + + 0 + + name + meta.brace.square.js + + + name + meta.array.literal.js + patterns + + + include + #expression + + + + assignment-operator + + match + <<=|>>=|>>>=|\*=|(?<!\()/=|%=|\+=|\-=|&=|\^= + name + keyword.operator.assignment.js + + block + + begin + \{ + beginCaptures + + 0 + + name + meta.brace.curly.js + + + end + \} + endCaptures + + 0 + + name + meta.brace.curly.js + + + name + meta.block.js + patterns + + + include + #expression + + + include + #object-member + + + + boolean-literal + + match + \b(false|true)\b + name + constant.language.boolean.js + + cast + + begin + (?:(?<=return|throw|yield|[=(,:>]))\s*(<)(?!<?\=) + beginCaptures + + 1 + + name + meta.brace.angle.js + + + end + > + endCaptures + + 0 + + name + meta.brace.angle.js + + + name + cast.expr.js + patterns + + + include + #type + + + + comment + + name + comment.js + patterns + + + include + #comment-block-doc + + + include + #comment-block + + + include + #comment-line + + + + comment-block + + begin + /\* + end + \*/ + name + comment.block.js + + comment-block-doc + + begin + /\*\*(?!/) + end + \*/ + name + comment.block.documentation.js + + comment-line + + match + (//).*$\n? + name + comment.line.js + + control-statement + + match + (?<!\.)\b(break|catch|continue|debugger|declare|do|else|finally|for|if|return|switch|throw|try|while|with|super|case|default)\b + name + keyword.control.js + + decl-block + + begin + \{ + beginCaptures + + 0 + + name + meta.brace.curly.js + + + end + \} + endCaptures + + 0 + + name + meta.brace.curly.js + + + name + meta.decl.block.js + patterns + + + include + #expression + + + + declaration + + name + meta.declaration.js + patterns + + + include + #function-declaration + + + include + #object-declaration + + + include + #type-declaration + + + include + #enum-declaration + + + + enum-declaration captures 1 name - punctuation.definition.comment.js + storage.modifier.js + + 2 + + name + storage.type.js + + 3 + + name + entity.name.class.js - comment - Match the shebang for JavaScript executables match - \A(#!).*$\n + (?:\b(const)\s+)?\b(enum)\s+([a-zA-Z_$][\w$]*) name - comment.line.number-sign.shebang.js + meta.enum.declaration.js + expression + + name + meta.expression.js + patterns + + + include + #for-in-simple + + + include + #string + + + include + #regex + + + include + #template + + + include + #comment + + + include + #literal + + + include + #paren-expression + + + include + #var-expr + + + include + #declaration + + + include + #cast + + + include + #new-expr + + + include + #block + + + include + #expression-operator + + + include + #relational-operator + + + include + #arithmetic-operator + + + include + #logic-operator + + + include + #assignment-operator + + + include + #storage-keyword + + + include + #function-call + + + include + #switch-case + + + include + #control-statement + + + + expression-operator + + match + =>|\b(delete|export|import|in|instanceof|module|namespace|new|typeof|void)\b + name + keyword.operator.js + + field-declaration begin - (?x) - (?: - (?<!\w) # Ensure word boundry - ([\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*) # Identifier - \s*(=)\s* - )? # Optional - \b(function) - (?:\s* - (\*) # Optional generator notation - )? # (ECMAScript 6) - (?:\s* - (?<=[\s\*]) - ([\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*) # Optional Name - )? - \s*(\() - + (?<!\()\s*\b([a-zA-Z_$][\w$]*)\s*(\?\s*)?(?=(=|:)) beginCaptures 1 name - meta.function.variable.js + variable.js 2 name keyword.operator.js + + end + (?=\}|;|,)|(?<=\}) + name + meta.field.declaration.js + patterns + + + include + #expression + + + + for-in-simple + + captures + + 1 + + name + storage.type.js + 3 + + name + keyword.operator.js + + + match + (?<=\()\s*\b(var|let|const)\s+([a-zA-Z_$][\w$]*)\s+(in|of)\b + name + forin.expr.js + + function-call + + name + functioncall.expr.js + patterns + + + include + #type-parameters + + + include + #paren-expression + + + + function-declaration + + begin + \b(?:(export)\s+)?(function\b)(?:\s+([a-zA-Z_$][\w$]*))?\s* + beginCaptures + + 1 + + name + storage.modifier.js + + 2 name storage.type.function.js - 4 + 3 + + name + entity.name.function.js + + + end + (?=;|\})|(?<=\}) + name + meta.function.js + patterns + + + include + #comment + + + include + #type-parameters + + + include + #function-type-parameters + + + include + #return-type + + + include + #function-overload-declaration + + + include + #decl-block + + + + function-overload-declaration + + captures + + 1 name storage.modifier.js + 2 + + name + storage.type.function.js + + 3 + + name + entity.name.function.js + + + match + \b(?:(export)\s+)?(function\b)(?:\s+([a-zA-Z_$][\w$]*))?\s* + name + meta.function.overload.js + + function-type-parameters + + begin + \( + beginCaptures + + 0 + + name + meta.brace.round.js + + + end + \) + endCaptures + + 0 + + name + meta.brace.round.js + + + name + meta.function.type.parameter.js + patterns + + + include + #comment + + + include + #parameter-name + + + include + #type-annotation + + + include + #variable-initializer + + + + indexer-declaration + + begin + \[ + beginCaptures + + 0 + + name + meta.brace.square.js + + + end + (\])\s*(\?\s*)?|$ + endCaptures + + 1 + + name + meta.brace.square.js + + 2 + + name + keyword.operator.js + + + name + meta.indexer.declaration.js + patterns + + + include + #type-annotation + + + include + #indexer-parameter + + + include + #expression + + + + indexer-parameter + + captures + + 1 + + name + variable.parameter.js + + + match + ([a-zA-Z_$][\w$]*)(?=\:) + name + meta.indexer.parameter.js + + literal + + name + literal.js + patterns + + + include + #numeric-literal + + + include + #boolean-literal + + + include + #null-literal + + + include + #undefined-literal + + + include + #array-literal + + + include + #this-literal + + + + logic-operator + + match + \!|&|~|\||&&|\|\| + name + keyword.operator.arithmetic.js + + method-declaration + + begin + \b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) + beginCaptures + + 1 + + name + storage.modifier.js + + 2 + + name + storage.modifier.js + + 3 + + name + storage.type.property.js + + 4 + + name + keyword.operator.js + 5 name @@ -101,569 +698,1003 @@ 6 name - punctuation.definition.parameters.begin.js + keyword.operator.js - comment - Match function, optional function name and optional function arguments end - (\)) - endCaptures - - 1 - - name - punctuation.definition.parameters.end.js - - + (?=\}|;|,)|(?<=\}) name - meta.function.js + meta.method.declaration.js patterns include - #function-params + #comment + + + include + #type-parameters + + + include + #function-type-parameters + + + include + #type-annotation + + + include + #method-overload-declaration + + + include + #decl-block + method-overload-declaration + captures + + 1 + + name + storage.modifier.js + + 2 + + name + keyword.operator.js + + 3 + + name + entity.name.function.js + + 4 + + name + keyword.operator.js + + match - \b0[xX]\h+\b + \b(?:(public|private|protected)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) name - constant.numeric.hex.js + meta.method.overload.declaration.js + new-expr + + begin + \b(new)\b + beginCaptures + + 1 + + name + keyword.operator.js + + + end + (?=[(;]|$) + name + new.expr.js + patterns + + + include + #type + + + include + #comment + + + + null-literal match - (?x) - (?<!\w) # Ensure word boundry - (?> - ( - (0|[1-9][0-9]*)(\.[0-9]*)? # 0 or 1 or 1. or 1.0 - | \.[0-9]+ # .1 - ) - ([eE][+-]?[0-9]+)? # Exponent - ) - (?!\w) # Ensure word boundry - + \b(null)\b + name + constant.language.null.js + + numeric-literal + + match + \b(?<=[^$])((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b name constant.numeric.js + object-body begin - ' + \{ beginCaptures 0 name - punctuation.definition.string.begin.js + meta.brace.curly.js end - ' + \} endCaptures 0 name - punctuation.definition.string.end.js + meta.brace.curly.js name - string.quoted.single.js - patterns - - - match - \\(x\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.) - name - constant.character.escape.js - - - - - begin - " - beginCaptures - - 0 - - name - punctuation.definition.string.begin.js - - - end - " - endCaptures - - 0 - - name - punctuation.definition.string.end.js - - - name - string.quoted.double.js - patterns - - - match - \\(x\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.) - name - constant.character.escape.js - - - - - begin - /\* - captures - - 0 - - name - punctuation.definition.comment.js - - - end - \*/ - name - comment.block.js - - - begin - (^[ \t]+)?(?=//) - beginCaptures - - 1 - - name - punctuation.whitespace.comment.leading.js - - - end - (?!\G) - patterns - - - begin - // - beginCaptures - - 0 - - name - punctuation.definition.comment.js - - - end - \n - name - comment.line.double-slash.js - - - - - match - (?<!\.|\$)\b(let|var)\b(?!\$) - name - storage.type.js - - - match - (?<!\.|\$)\b(get|set)\b(?!\$) - name - storage.modifier.js - - - match - (?<!\.|\$)\b(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while|yield)\b(?!\$) - name - keyword.control.js - - - match - (?<!\.|\$)\b(delete|in|instanceof|new|typeof|void|with)\b(?!\$) - name - keyword.operator.js - - - match - !|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|(?<!\()/=|%=|\+=|\-=|&=|\^= - name - keyword.operator.js - - - match - (?<!\.|\$)\b(debugger)\b(?!\$) - name - keyword.other.js - - - match - (?<!\.|\$)\b(Array|Boolean|Date|Error|EvalError|Function|Number|Object|RangeError|ReferenceError|RegExp|String|SyntaxError|TypeError|URIError)\b(?!\$) - name - support.class.js - - - comment - DOM Core Level 4 (http://www.w3.org/TR/domcore/) and DOM Events Level 3 (http://www.w3.org/TR/DOM-Level-3-Events/) - match - (?<!\.|\$)\b(Attr|CharacterData|Comment|CompositionEvent|CustomEvent|Document|DocumentFragment|DocumentType|DOMError|DOMException|DOMImplementation|DOMParser|DOMString|DOMTimestamp|DOMSettableTokenList|DOMStringList|DOMTokenList|Element|Event|EventTarget|FocusEvent|HTMLCollection|KeyboardEvent|MouseEvent|MutationObserver|MutationRecord|Node|NodeFilter|NodeIterator|NodeList|ProcessingInstruction|Range|Text|TextEvent|TreeWalker|UIEvent|WheelEvent|XMLDocument)\b(?!\$) - name - support.class.dom.js - - - comment - DOM Core Level 4 (http://www.w3.org/TR/domcore/) and DOM Events Level 3 (http://www.w3.org/TR/DOM-Level-3-Events/) - match - (?<!\.|\$)\b(CDATASection|DOMConfiguration|DOMErrorHandler|DOMImplementationList|DOMImplementationSource|DOMLocator|DOMObject|DOMUserData|Entity|EntityReference|MutationEvent|NamedNodeMap|NameList|Notation|TypeInfo|UserDataHandler)\b(?!\$) - name - invalid.deprecated.dom.js - - - comment - TypedArray specification used by HTML 5 (http://www.khronos.org/registry/typedarray/specs/latest/) - match - (?<!\.|\$)\b(ArrayBuffer|DataView|Float32Array|Float64Array|Int8Array|Int16Array|Int32Array|TypedArray|Uint8Array|Uint16Array|Uint32Array|Uint8ClampedArray)\b(?!\$) - name - support.class.dom.js - - - comment - File specification used by HTML 5 (http://dev.w3.org/2006/webapi/FileAPI/) - match - (?<!\.|\$)\b(Blob|File|FileList|FileReader)\b(?!\$) - name - support.class.dom.js - - - comment - XMLHttpRequest specification used by HTML 5 (http://xhr.spec.whatwg.org/) - match - (?<!\.|\$)\b(FormData|ProgressEvent|XMLHttpRequest|XMLHttpRequestUpload)\b(?!\$) - name - support.class.dom.js - - - comment - EventSource specification used by HTML 5 (http://www.w3.org/TR/eventsource/) - match - (?<!\.|\$)\b(EventSource)\b(?!\$) - name - support.class.dom.js - - - comment - CSSOM specification used by HTML 5 (http://dev.w3.org/csswg/cssom/) - match - (?<!\.|\$)\b(CSS|CSSCharsetRule|CSSImportRule|CSSPageRule|CSSRule|CSSRuleList|CSSStyleDeclaration|CSSStyleRule|CSSStyleSheet|MediaList|Stylesheet|StyleSheetList)\b(?!\$) - name - support.class.dom.js - - - comment - CSSOM View specification used by HTML 5 (http://dev.w3.org/csswg/cssom-view/) - match - (?<!\.|\$)\b(Screen)\b(?!\$) - name - support.class.dom.js - - - comment - CSS Font specification used by HTML 5 (http://dev.w3.org/csswg/css-fonts/) - match - (?<!\.|\$)\b(CSSFontFaceRule)\b(?!\$) - name - support.class.dom.js - - - comment - SVG specification used by HTML 5 (http://www.w3.org/TR/SVG/single-page.html) - match - (?<!\.|\$)\b(SVGAElement|SVGAltGlyphDefElement|SVGAltGlyphElement|SVGAltGlyphItemElement|SVGAngle|SVGAnimateColorElement|SVGAnimateElement|SVGAnimateMotionElement|SVGAnimateTransformElement|SVGAnimatedAngle|SVGAnimatedBoolean|SVGAnimatedEnumeration|SVGAnimatedInteger|SVGAnimatedLength|SVGAnimatedLengthList|SVGAnimatedNumber|SVGAnimatedNumberList|SVGAnimatedPreserveAspectRatio|SVGAnimatedRect|SVGAnimatedString|SVGAnimatedTransformList|SVGAnimationElement|SVGCircleElement|SVGClipPathElement|SVGColor|SVGComponentTransferFunctionElement|SVGCursorElement|SVGDefsElement|SVGDescElement|SVGDocument|SVGElement|SVGElementInstance|SVGElementInstanceList|SVGEllipseElement|SVGFEBlendElement|SVGFEColorMatrixElement|SVGFEComponentTransferElement|SVGFECompositeElement|SVGFEConvolveMatrixElement|SVGFEDiffuseLightingElement|SVGFEDisplacementMapElement|SVGFEDistantLightElement|SVGFEFloodElement|SVGFEFuncAElement|SVGFEFuncBElement|SVGFEFuncGElement|SVGFEFuncRElement|SVGFEGaussianBlurElement|SVGFEImageElement|SVGFEMergeElement|SVGFEMergeNodeElement|SVGFEMorphologyElement|SVGFEOffsetElement|SVGFEPointLightElement|SVGFESpecularLightingElement|SVGFESpotLightElement|SVGFETileElement|SVGFETurbulenceElement|SVGFilterElement|SVGFontElement|SVGFontFaceElement|SVGFontFaceFormatElement|SVGFontFaceNameElement|SVGFontFaceSrcElement|SVGFontFaceUriElement|SVGForeignObjectElement|SVGGElement|SVGGlyphElement|SVGGlyphRefElement|SVGGradientElement|SVGHKernElement|SVGImageElement|SVGLength|SVGLengthList|SVGLineElement|SVGLinearGradientElement|SVGMPathElement|SVGMarkerElement|SVGMaskElement|SVGMatrix|SVGMetadataElement|SVGMissingGlyphElement|SVGNumber|SVGNumberList|SVGPaint|SVGPathElement|SVGPathSeg|SVGPathSegArcAbs|SVGPathSegArcRel|SVGPathSegClosePath|SVGPathSegCurvetoCubicAbs|SVGPathSegCurvetoCubicRel|SVGPathSegCurvetoCubicSmoothAbs|SVGPathSegCurvetoCubicSmoothRel|SVGPathSegCurvetoQuadraticAbs|SVGPathSegCurvetoQuadraticRel|SVGPathSegCurvetoQuadraticSmoothAbs|SVGPathSegCurvetoQuadraticSmoothRel|SVGPathSegLinetoAbs|SVGPathSegLinetoHorizontalAbs|SVGPathSegLinetoHorizontalRel|SVGPathSegLinetoRel|SVGPathSegLinetoVerticalAbs|SVGPathSegLinetoVerticalRel|SVGPathSegList|SVGPathSegMovetoAbs|SVGPathSegMovetoRel|SVGPatternElement|SVGPoint|SVGPointList|SVGPolygonElement|SVGPolylineElement|SVGPreserveAspectRatio|SVGRadialGradientElement|SVGRect|SVGRectElement|SVGRenderingIntent|SVGSVGElement|SVGScriptElement|SVGSetElement|SVGStopElement|SVGStringList|SVGStyleElement|SVGSwitchElement|SVGSymbolElement|SVGTRefElement|SVGTSpanElement|SVGTextContentElement|SVGTextElement|SVGTextPathElement|SVGTextPositioningElement|SVGTitleElement|SVGTransform|SVGTransformList|SVGUnitTypes|SVGUseElement|SVGUseElement|SVGVKernElement|SVGViewElement|SVGViewSpec|SVGZoomEvent)\b(?!\$) - name - support.class.dom.js - - - comment - WebGL specification used by HTML 5 (http://www.khronos.org/registry/webgl/specs/latest/1.0/) - match - (?<!\.|\$)\b(WebGLActiveInfo|WebGLBuffer|WebGLContextEvent|WebGLFramebuffer|WebGLProgram|WebGLRenderbuffer|WebGLRenderingContext|WebGLShader|WebGLShaderPrecisionFormat|WebGLTexture|WebGLUniformLocation)\b(?!\$) - name - support.class.dom.js - - - comment - HTML 5 (http://www.w3.org/TR/html5/single-page.html) - match - (?<!\.|\$)\b(Audio|BarProp|DOMStringMap|ErrorEvent|FileError|HTMLAllCollection|HTMLAnchorElement|HTMLAppletElement|HTMLAreaElement|HTMLAudioElement|HTMLBRElement|HTMLBaseElement|HTMLBodyElement|HTMLButtonElement|HTMLCanvasElement|HTMLDListElement|HTMLDataElement|HTMLDataListElement|HTMLDetailsElement|HTMLDialogElement|HTMLDirectoryElement|HTMLDivElement|HTMLEmbedElement|HTMLFieldSetElement|HTMLFontElement|HTMLFormControlsCollection|HTMLFormElement|HTMLFrameElement|HTMLFrameSetElement|HTMLHRElement|HTMLHeadElement|HTMLHeadingElement|HTMLHtmlElement|HTMLIFrameElement|HTMLImageElement|HTMLInputElement|HTMLKeygenElement|HTMLLIElement|HTMLLabelElement|HTMLLegendElement|HTMLLinkElement|HTMLMapElement|HTMLMarqueeElement|HTMLMediaElement|HTMLMetaElement|HTMLMeterElement|HTMLModElement|HTMLOListElement|HTMLObjectElement|HTMLOptGroupElement|HTMLOptionElement|HTMLOptionsCollection|HTMLOutputElement|HTMLParagraphElement|HTMLParamElement|HTMLPreElement|HTMLProgressElement|HTMLQuoteElement|HTMLScriptElement|HTMLSelectElement|HTMLSour|HTMLSpanElement|HTMLStyleElement|HTMLTableCaptionElement|HTMLTableCellElement|HTMLTableColElement|HTMLTableDataCellElement|HTMLTableElement|HTMLTableHeaderCellElement|HTMLTableRowElement|HTMLTableSectionElement|HTMLTextAreaElement|HTMLTimeElement|HTMLTitleElement|HTMLTrackElement|HTMLUListElement|HTMLUnknownElement|HTMLVideoElement|HashChangeEvent|History|Image|Location|MediaController|MediaError|MouseEvent|Navigator|Option|PageTransitionEvent|PopStateEvent|TextTrack|TextTrackCue|TextTrackCueList|TextTrackList|TimeRanges|TrackEvent|UIEvent|ValidityState|Window)\b(?!\$) - name - support.class.dom.js - - - comment - HTML 5 (http://www.w3.org/TR/html5/single-page.html#window) - match - (?<!\.|\$)\b(applicationCache|closed|console|crypto|document|external|frameElement|frames|history|innerHeight|innerWidth|length|location|locationbar|menubar|name|navigator|offscreenBuffering|onabort|onafterprint|onbeforeprint|onbeforeunload|onblur|oncancel|oncanplay|oncanplaythrough|onchange|onclick|onclose|oncuechange|ondblclick|ondrag|ondragend|ondragenter|ondragexit|ondragleave|ondragover|ondragstart|ondrop|ondurationchange|onemptied|onended|onerror|onfocus|onhashchange|oninput|oninvalid|onkeydown|onkeypress|onkeyup|onload|onloadeddata|onloadedmetadata|onloadstart|onmessage|onmousedown|onmouseenter|onmouseleave|onmousemove|onmouseout|onmouseover|onmouseup|onmousewheel|onoffline|ononline|onpagehide|onpageshow|onpause|onplay|onplaying|onpopstate|onprogress|onratechange|onreset|onresize|onscroll|onseeked|onseeking|onselect|onshow|onstalled|onstorage|onsubmit|onsuspend|ontimeupdate|onunload|onvolumechange|onwaiting|opener|outerHeight|outerWidth|pageXOffset|pageYOffset|parent|personalbar|postMessage|screen|screenX|screenY|scrollbars|scrollX|scrollY|self|status|statusbar|toolbar|top|window)\b(?!\$) - name - support.constant.dom.js - - - comment - HTML 5 (http://www.w3.org/TR/html5/single-page.html#window) - match - (?<!\.|\$)\b(addEventListener|alert|atob|blur|btoa|clearInterval|clearTimeout|close|confirm|dispatchEvent|doNotTrack|find|focus|getComputedStyle|getMatchedCSSRules|getSelection|matchMedia|moveBy|moveTo|open|openDatabase|print|prompt|removeEventListener|resizeBy|resizeTo|scroll|scrollBy|scrollTo|setInterval|setTimeout|showModalDialog|stop)\b(?!\$) - name - support.function.dom.js - - - match - (?<!\.|\$)\b(captureEvents|defaultStatus|defaultstatus|releaseEvents)\b(?!\$) - name - invalid.deprecated.dom.js - - - match - (?<!\.|\$)\b(JSON|Math)\b(?!\$) - name - support.constant.js - - - match - (?<!\.|\$)\b(decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|uneval)\b(?!\$) - name - support.function.js - - - comment - Keywords reserved for future use but now are unused. - match - (?<!\.|\$)\b(class|const|enum|export|extends|import|super)\b(?!\$) - name - invalid.illegal.js - - - comment - Keywords reserved for future use in strict mode but now are unused. - match - (?<!\.|\$)\b(implements|interface|package|private|protected|public|static)\b(?!\$) - name - invalid.deprecated.js - - - match - \b(false|Infinity|NaN|null|true|undefined)\b - name - constant.language.js - - - match - (?<!\.|\$)\b(this)\b(?!\$) - name - variable.language.js - - - begin - (?<=[=(:,]|^|return|&&|\|\||!|\?)\s*(?=/[^/*+?]) - comment - Dont scope preceding whitespace as string.regex - end - (?<=[/igm]) - patterns - - - begin - / - beginCaptures - - 1 - - name - punctuation.definition.string.begin.js - - - end - (/)[igm]* - endCaptures - - 1 - - name - punctuation.definition.string.end.js - - - name - string.regexp.js - patterns - - - include - source.js.regexp - - - - - - - match - \; - name - punctuation.terminator.statement.js - - - captures - - 1 - - name - punctuation.section.scope.begin.js - - 2 - - name - punctuation.section.scope.end.js - - - comment - Allows the special return snippet to fire. - match - (\{)(\}) - - - captures - - 1 - - name - punctuation.section.scope.begin.js - - 2 - - name - punctuation.section.scope.end.js - - - comment - Allows the special return snippet to fire. - match - (\()(\)) - - - captures - - 1 - - name - punctuation.section.scope.begin.js - - 2 - - name - punctuation.section.scope.end.js - - - comment - Allows the special return snippet to fire. - match - (\[)(\]) - - - match - \{|\} - name - meta.brace.curly.js - - - match - \(|\) - name - meta.brace.round.js - - - match - \[|\] - name - meta.brace.square.js - - - begin - \? - end - : - name - meta.ternary-if.js + meta.object.body.js patterns include - $self + #string + + + include + #comment + + + include + #field-declaration + + + include + #method-declaration + + + include + #indexer-declaration + + + include + #type-annotation + + + include + #variable-initializer + + + include + #access-modifier + + + include + #static-modifier + + + include + #property-accessor + object-declaration - comment - Match classes based on the usage of the "new" operator. - match - (?<=new )([\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*)(?!\w) + begin + \b(?:(export)\s+)?\b(?:(abstract)\s+)?\b(?<!\.)(class)\b + beginCaptures + + 1 + + name + storage.modifier.js + + 2 + + name + storage.modifier.js + + 3 + + name + storage.type.js + + + end + (?<=\}) + endCaptures + + 1 + + name + brace.curly.js + + name - support.class.js - - - comment - Match classes based on the usage of the "instanceof" operator. - match - (?<= instanceof )([\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*)(?!\w) - name - support.class.js - - - comment - Match classes based on the usage of the "prototype" property. - match - (?<!\w)([\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*)(?=\.prototype\b) - name - support.class.js - - - comment - Matches the "prototype" keyword. Even though it is not a valid keyword, it is a special constant of sorts. - match - (?<=\.)(prototype)\b - name - keyword.other.js - - - comment - Matches the function calls. - match - (?<!\w)([\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*)(?=\() - name - meta.function-call.js - - - repository - - function-params - + meta.declaration.object.js patterns - begin - (?=[\p{L}\p{Nl}$_]) - comment - Matches valid argument, function and variable names. To be thorough: https://github.com/mathiasbynens/mothereff.in/tree/master/js-variables - end - (?=[,)]) - patterns - - - match - \G[\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]* - name - variable.parameter.function.js - - + include + #comment + + + include + #object-heritage + + + include + #object-name + + + include + #type-parameters + + + include + #object-body + + + + object-heritage + + begin + (?:\b(extends|implements)) + beginCaptures + + 1 + + name + keyword.other.js + + + end + (?=\{) + endCaptures + + 1 + + name + brace.curly.js + + + name + meta.object.heritage.js + patterns + + + include + #comment + + + include + #type-parameters + + + include + #object-heritage-parent + + + + object-heritage-parent + + captures + + 1 + + name + storage.type.js + + + match + (?:\s*([a-zA-Z_$][\w$]*)) + name + meta.object.heritage.parent.js + + object-member + + begin + [a-zA-Z_$][\w$]*\s*: + end + (?=,|\}) + name + meta.object.member.js + patterns + + + include + #expression + + + + object-name + + captures + + 0 + + name + entity.name.class.js + + + match + [a-zA-Z_$][\w$]* + name + meta.object.name.js + + parameter-name + + captures + + 1 + + name + storage.modifier.js + + 2 + + name + keyword.operator.js + + 3 + + name + variable.parameter.js + + 4 + + name + keyword.operator.js + + + match + (?:\s*\b(public|private|protected)\b\s+)?(\.\.\.)?\s*([a-zA-Z_$][\w$]*)\s*(\??) + name + parameter.name.js + + paren-expression + + begin + \( + beginCaptures + + 0 + + name + meta.brace.paren.js + + + end + \) + endCaptures + + 0 + + name + meta.brace.paren.js + + + patterns + + + include + #expression + + + + property-accessor + + match + \b(get|set)\b + name + storage.type.property.js + + qstring-double + + begin + " + end + "|(?=$) + name + string.double.js + patterns + + + include + #string-character-escape + + + + qstring-single + + begin + ' + end + '|(?=$) + name + string.single.js + patterns + + + include + #string-character-escape + + + + regex + + begin + (?<=[=(:,\[]|^|return|&&|\|\||!)\s*(/)(?![/*+{}?]) + end + $|(/)[igm]* + name + string.regex.js + patterns + + + match + \\. + name + constant.character.escape.js + + + match + \[(\\\]|[^\]])*\] + name + constant.character.class.js + + + + relational-operator + + match + ===|==|=|!=|!==|<=|>=|<>|<|> + name + keyword.operator.comparison.js + + return-type + + begin + (?<=\))\s*: + end + (?=$)|(?=\{|;|//) + name + meta.return.type.js + patterns + + + include + #type + + + + static-modifier + + match + \b(static)\b + name + keyword.other.js + + storage-keyword + + match + \b(number|boolean|string|any|var|let|function|const)\b + name + storage.type.js + + string + + name + string.js + patterns + + + include + #qstring-single + + + include + #qstring-double + + + + string-character-escape + + match + \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$) + name + constant.character.escape + + switch-case + + begin + (?<!\.)\b(case|default)\b + beginCaptures + + 1 + + name + keyword.control.js + + + end + : + name + case.expr.js + patterns + + + include + #expression + + + + template + + begin + ` + beginCaptures + + 0 + + name + string.template.js + + + end + ` + endCaptures + + 0 + + name + string.template.js + + + name + meta.template.js + patterns + + + include + #template-substitution-element + + + include + #template-string-contents + + + + template-string-contents + + begin + .*? + end + (?=(\$\{|`)) + name + string.template.js + patterns + + + include + #string-character-escape + + + + template-substitution-element + + begin + \$\{ + beginCaptures + + 0 + + name + keyword.operator.js + + + end + \} + endCaptures + + 0 + + name + keyword.operator.js + + + name + template.element.js + patterns + + + include + #expression + + + + this-literal + + match + \b(this)\b + name + constant.language.this.js + + type + + name + meta.type.js + patterns + + + include + #type-primitive + + + include + #type-parameters + + + include + #type-tuple + + + include + #type-object + + + include + #type-operator + + + include + #type-paren-or-function-type-parameters + + + include + #type-function-return-type + + + include + #type-name + + + + type-annotation + + begin + : + end + (?=$|[,);\}\]]|//)|(?==[^>])|(?<=[\}>\]\)]|[a-zA-Z_$])\s*(?=\{) + name + meta.type.annotation.js + patterns + + + include + #type + + + include + #string + + + include + #comment + + + + type-declaration + + begin + \b(type)\b\s+([a-zA-Z_$][\w$]*)\s*=\s* + beginCaptures + + 1 + + name + keyword.other.js + + 2 + + name + storage.type.js + + + end + (?=[,);>]|var|type|function|class) + name + meta.type.declaration.js + patterns + + + include + #type + + + + type-function-return-type + + begin + => + beginCaptures + + 0 + + name + keyword.operator.js + + + end + (?=\s*[,\)\{=;>]|//|$) + name + meta.type.function.return.js + patterns + + + include + #type + + + + type-name + + captures + + 1 + + name + entity.name.type.js + + + match + [a-zA-Z_$][.\w$]* + name + meta.type.name.js + + type-object + + begin + \{ + beginCaptures + + 0 + + name + meta.brace.curly.js + + + end + \} + endCaptures + + 0 + + name + meta.brace.curly.js + + + name + meta.object.type.js + patterns + + + include + #comment + + + include + #field-declaration + + + include + #method-declaration + + + include + #indexer-declaration + + + include + #type-annotation + + + + type-operator + + match + [.|] + name + keyword.operator.type.js + + type-parameters + + begin + ([a-zA-Z_$][\w$]*)?(<) + beginCaptures + + 1 + + name + entity.name.type.js + + 2 + + name + meta.brace.angle.js + + + end + (?=$)|(>) + endCaptures + + 2 + + name + meta.brace.angle.js + + + name + meta.type.parameters.js + patterns + + + match + \b(extends)\b + name + keyword.other.js + + + include + #comment + + + include + #type + + + + type-paren-or-function-type-parameters + + begin + (?:\b(new)\b)?\s*\( + beginCaptures + + 1 + + name + keyword.control.js + + + end + \) + name + meta.type.paren.cover.js + patterns + + + include + #comment + + + include + #type + + + include + #function-type-parameters + + + + type-primitive + + captures + + 1 + + name + storage.type.js + + + match + \b(string|number|boolean|symbol|any|void)\b + name + meta.type.primitive.js + + type-tuple + + begin + \[ + beginCaptures + + 0 + + name + meta.brace.square.js + + + end + \] + endCaptures + + 0 + + name + meta.brace.square.js + + + name + meta.type.tuple.js + patterns + + + include + #type + + + include + #comment + + + + undefined-literal + + match + \b(undefined)\b + name + constant.language.js + + var-expr + + begin + (?<!\()\s*\b(var|let|const(?!\s+enum))\s+([a-zA-Z_$][\w$]*) + beginCaptures + + 1 + + name + storage.type.js + + 2 + + name + variable.js + + + end + (?=$|[;=\}\{])|(?<=\}) + name + meta.var.expr.js + patterns + + + include + #type-annotation + + + include + #string + + + include + #comment + + + + variable-initializer + + begin + (=) + beginCaptures + + 1 + + name + keyword.operator.js + + + end + (?=$|[,);=]) + patterns + + + include + #expression @@ -671,7 +1702,6 @@ scopeName source.js uuid - 93E017CC-6F27-11D9-90EB-000D93589AF6 + ef98eb90-bf9b-11e4-bb52-0800200c9a66 - - + \ No newline at end of file diff --git a/extensions/javascript/syntaxes/Readme.md b/extensions/javascript/syntaxes/Readme.md index 7079b2a0a72..e7023ebf188 100644 --- a/extensions/javascript/syntaxes/Readme.md +++ b/extensions/javascript/syntaxes/Readme.md @@ -3,3 +3,10 @@ The JavaScriptReact.tmLanguage bundle is derived from the TypeScriptReact.tmLang Changes: - fileTypes -> .jsx - scopeName -> scope.jsx + +The JavaScript-ts.tmLanguage bundle is derived from the TypeScriptReact.tmLanguage. + +Changes: +- all occurences of .ts -> .js +- fileTypes -> .js +- scopeName -> scope.js diff --git a/extensions/json/OSSREADME.json b/extensions/json/OSSREADME.json new file mode 100644 index 00000000000..aa2ec19ee33 --- /dev/null +++ b/extensions/json/OSSREADME.json @@ -0,0 +1,7 @@ +// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS: +[{ + "name": "Benvie/JavaScriptNext.tmLanguage", + "version": "0.0.0", + "license": "MIT", + "repositoryURL": "https://github.com/Benvie/JavaScriptNext.tmLanguage" +}] diff --git a/extensions/json/package.json b/extensions/json/package.json new file mode 100644 index 00000000000..224e446f8a0 --- /dev/null +++ b/extensions/json/package.json @@ -0,0 +1,19 @@ +{ + "name": "json", + "version": "0.1.0", + "publisher": "vscode", + "engines": { "vscode": "*" }, + "contributes": { + "languages": [{ + "id": "json", + "aliases": ["JSON", "json"], + "extensions": [".json", ".bowerrc", ".jshintrc", ".jscsrc", ".eslintrc"], + "mimetypes": ["application/json"] + }], + "grammars": [{ + "language": "json", + "scopeName": "source.json", + "path": "./syntaxes/JSON.tmLanguage" + }] + } +} \ No newline at end of file diff --git a/extensions/json/syntaxes/JSON.tmLanguage b/extensions/json/syntaxes/JSON.tmLanguage new file mode 100644 index 00000000000..9d6a24cc16a --- /dev/null +++ b/extensions/json/syntaxes/JSON.tmLanguage @@ -0,0 +1,387 @@ + + + + + fileTypes + + json + sublime-settings + sublime-menu + sublime-keymap + sublime-mousemap + sublime-theme + sublime-build + sublime-project + sublime-completions + + foldingStartMarker + (?x) # turn on extended mode + ^ # a line beginning with + \s* # some optional space + [{\[] # the start of an object or array + (?! # but not followed by + .* # whatever + [}\]] # and the close of an object or array + ,? # an optional comma + \s* # some optional space + $ # at the end of the line + ) + | # ...or... + [{\[] # the start of an object or array + \s* # some optional space + $ # at the end of the line + foldingStopMarker + (?x) # turn on extended mode + ^ # a line beginning with + \s* # some optional space + [}\]] # and the close of an object or array + keyEquivalent + ^~J + name + JSON (Javascript Next) + patterns + + + include + #value + + + repository + + array + + begin + \[ + beginCaptures + + 0 + + name + punctuation.definition.array.begin.json + + + end + \] + endCaptures + + 0 + + name + punctuation.definition.array.end.json + + + name + meta.structure.array.json + patterns + + + include + #value + + + match + , + name + punctuation.separator.array.json + + + match + [^\s\]] + name + invalid.illegal.expected-array-separator.json + + + + comments + + patterns + + + begin + /\*\* + captures + + 0 + + name + punctuation.definition.comment.json + + + end + \*/ + name + comment.block.documentation.json + + + begin + /\* + captures + + 0 + + name + punctuation.definition.comment.json + + + end + \*/ + name + comment.block.json + + + captures + + 1 + + name + punctuation.definition.comment.json + + + match + (//).*$\n? + name + comment.line.double-slash.js + + + + constant + + match + \b(?:true|false|null)\b + name + constant.language.json + + number + + match + (?x) # turn on extended mode + -? # an optional minus + (?: + 0 # a zero + | # ...or... + [1-9] # a 1-9 character + \d* # followed by zero or more digits + ) + (?: + (?: + \. # a period + \d+ # followed by one or more digits + )? + (?: + [eE] # an e character + [+-]? # followed by an option +/- + \d+ # followed by one or more digits + )? # make exponent optional + )? # make decimal portion optional + name + constant.numeric.json + + object + + begin + \{ + beginCaptures + + 0 + + name + punctuation.definition.dictionary.begin.json + + + end + \} + endCaptures + + 0 + + name + punctuation.definition.dictionary.end.json + + + name + meta.structure.dictionary.json + patterns + + + comment + the JSON object key + include + #objectkey + + + include + #comments + + + begin + : + beginCaptures + + 0 + + name + punctuation.separator.dictionary.key-value.json + + + end + (,)|(?=\}) + endCaptures + + 1 + + name + punctuation.separator.dictionary.pair.json + + + name + meta.structure.dictionary.value.json + patterns + + + comment + the JSON object value + include + #value + + + match + [^\s,] + name + invalid.illegal.expected-dictionary-separator.json + + + + + match + [^\s\}] + name + invalid.illegal.expected-dictionary-separator.json + + + + string + + begin + " + beginCaptures + + 0 + + name + punctuation.definition.string.begin.json + + + end + " + endCaptures + + 0 + + name + punctuation.definition.string.end.json + + + name + string.quoted.double.json + patterns + + + include + #stringcontent + + + + objectkey + + begin + " + beginCaptures + + 0 + + name + punctuation.support.type.property-name.begin.json + + + end + " + endCaptures + + 0 + + name + punctuation.support.type.property-name.end.json + + + name + support.type.property-name.json + patterns + + + include + #stringcontent + + + + stringcontent + + patterns + + + match + (?x) # turn on extended mode + \\ # a literal backslash + (?: # ...followed by... + ["\\/bfnrt] # one of these characters + | # ...or... + u # a u + [0-9a-fA-F]{4}) # and four hex digits + name + constant.character.escape.json + + + match + \\. + name + invalid.illegal.unrecognized-string-escape.json + + + + value + + patterns + + + include + #constant + + + include + #number + + + include + #string + + + include + #array + + + include + #object + + + include + #comments + + + + + scopeName + source.json + uuid + 8f97457b-516e-48ce-83c7-08ae12fb327a + + + diff --git a/extensions/lua/syntaxes/Lua.plist b/extensions/lua/syntaxes/Lua.plist index a1f92e3239f..493ed743f40 100644 --- a/extensions/lua/syntaxes/Lua.plist +++ b/extensions/lua/syntaxes/Lua.plist @@ -243,7 +243,7 @@ match - \b(break|do|else|for|if|elseif|return|then|repeat|while|until|end|function|local|in)\b + \b(break|do|else|for|if|elseif|goto|return|then|repeat|while|until|end|function|local|in)\b name keyword.control.lua diff --git a/extensions/mono-debug/mono-debug.azure.json b/extensions/mono-debug/mono-debug.azure.json index 15c1cf4bfb6..9ef8abf0514 100644 --- a/extensions/mono-debug/mono-debug.azure.json +++ b/extensions/mono-debug/mono-debug.azure.json @@ -1,6 +1,6 @@ { "account": "monacobuild", "container": "debuggers", - "zip": "757615d/mono-debug.zip", + "zip": "090c7d9/mono-debug.zip", "output": "" } diff --git a/extensions/node-debug/node-debug.azure.json b/extensions/node-debug/node-debug.azure.json index b0853e58a78..370a510e133 100644 --- a/extensions/node-debug/node-debug.azure.json +++ b/extensions/node-debug/node-debug.azure.json @@ -1,6 +1,6 @@ { "account": "monacobuild", "container": "debuggers", - "zip": "a7f6203/node-debug.zip", + "zip": "32575e3/node-debug.zip", "output": "" } diff --git a/extensions/php/package.json b/extensions/php/package.json index ab1d5dc410f..7bcd6a79642 100644 --- a/extensions/php/package.json +++ b/extensions/php/package.json @@ -21,6 +21,11 @@ "title": "PHP Configuration options", "type": "object", "properties": { + "php.validate.enable": { + "type": "boolean", + "default": true, + "description": "Whether php validation is enabled or not." + }, "php.validate.executablePath": { "type": "string", "default": null, diff --git a/extensions/php/src/features/completionItemProvider.ts b/extensions/php/src/features/completionItemProvider.ts index 2f3405c45ff..6eb3b0953db 100644 --- a/extensions/php/src/features/completionItemProvider.ts +++ b/extensions/php/src/features/completionItemProvider.ts @@ -61,7 +61,17 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider while (match = variableMatch.exec(text)) { var word = match[0]; if (!added[word]) { - result.push(createNewProposal(CompletionItemKind.Variable, name, null)); + added[word] = true; + result.push(createNewProposal(CompletionItemKind.Variable, word, null)); + } + } + var functionMatch = /function\s+([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*\(/g; + var match : RegExpExecArray = null; + while (match = functionMatch.exec(text)) { + var word = match[1]; + if (!added[word]) { + added[word] = true; + result.push(createNewProposal(CompletionItemKind.Function, word, null)); } } return Promise.resolve(result); diff --git a/extensions/php/src/features/validationProvider.ts b/extensions/php/src/features/validationProvider.ts index 5092125a328..48971619c1f 100644 --- a/extensions/php/src/features/validationProvider.ts +++ b/extensions/php/src/features/validationProvider.ts @@ -84,6 +84,7 @@ export default class PHPValidationProvider { private static BufferArgs: string[] = ['-l', '-n', '-d', 'display_errors=On', '-d', 'log_errors=Off']; private static FileArgs: string[] = ['-l', '-n', '-d', 'display_errors=On', '-d', 'log_errors=Off', '-f']; + private validationEnabled: boolean; private executable: string; private trigger: RunTrigger; private executableNotFound: boolean; @@ -94,6 +95,7 @@ export default class PHPValidationProvider { constructor() { this.executable = null; + this.validationEnabled = true; this.trigger = RunTrigger.onSave; this.executableNotFound = false; } @@ -109,9 +111,6 @@ export default class PHPValidationProvider { this.diagnosticCollection.delete(textDocument.uri); delete this.delayers[textDocument.uri.toString()]; }, null, subscriptions); - - // Validate all open php documents - vscode.workspace.textDocuments.forEach(this.triggerValidate, this); } public dispose(): void { @@ -123,6 +122,7 @@ export default class PHPValidationProvider { let section = vscode.workspace.getConfiguration('php'); let oldExecutable = this.executable; if (section) { + this.validationEnabled = section.get('validate.enable', true); this.executable = section.get('validate.executablePath', null); this.trigger = RunTrigger.from(section.get('validate.run', RunTrigger.strings.onSave)); } @@ -133,26 +133,29 @@ export default class PHPValidationProvider { if (this.documentListener) { this.documentListener.dispose(); } - if (this.trigger === RunTrigger.onType) { - this.documentListener = vscode.workspace.onDidChangeTextDocument((e) => { - this.triggerValidate(e.document); - }); - } else { - this.documentListener = vscode.workspace.onDidSaveTextDocument(this.triggerValidate, this); + this.diagnosticCollection.clear(); + if (this.validationEnabled) { + if (this.trigger === RunTrigger.onType) { + this.documentListener = vscode.workspace.onDidChangeTextDocument((e) => { + this.triggerValidate(e.document); + }); + } else { + this.documentListener = vscode.workspace.onDidSaveTextDocument(this.triggerValidate, this); + } + // Configuration has changed. Reevaluate all documents. + vscode.workspace.textDocuments.forEach(this.triggerValidate, this); } - // Configuration has changed. Reevaluate all documents. - vscode.workspace.textDocuments.forEach(this.triggerValidate, this); } private triggerValidate(textDocument: vscode.TextDocument): void { - if (textDocument.languageId !== 'php' || this.executableNotFound) { + if (textDocument.languageId !== 'php' || this.executableNotFound || !this.validationEnabled) { return; } let key = textDocument.uri.toString(); let delayer = this.delayers[key]; if (!delayer) { delayer = new ThrottledDelayer(this.trigger === RunTrigger.onType ? 250 : 0); - this.delayers[key]; + this.delayers[key] = delayer; } delayer.trigger(() => this.doValidate(textDocument) ); } diff --git a/extensions/php/src/test/php-worker.test.ts.disabled b/extensions/php/src/test/php-worker.test.ts.disabled index a8dd9e72ba3..336555289e9 100644 --- a/extensions/php/src/test/php-worker.test.ts.disabled +++ b/extensions/php/src/test/php-worker.test.ts.disabled @@ -1,5 +1,5 @@ import assert = require('assert'); -import {CompletionItemProvider, CompletionItem, CompletionItemKind, CancellationToken, TextDocument, Range, Position, Uri} from 'vscode'; +import {CompletionItemProvider, CompletionItem, CompletionItemKind, CancellationToken, TextDocument, Range, Position, Uri, workspace, window} from 'vscode'; import PHPCompletionItemProvider from '../features/completionItemProvider'; import HoverProvider from '../features/hoverProvider'; import SignatureHelpProvider from '../features/signatureHelpProvider'; @@ -7,14 +7,19 @@ import SignatureHelpProvider from '../features/signatureHelpProvider'; var phpCompletionProvider = new PHPCompletionItemProvider(); -var testSuggestionsFor = function(value:string, stringBefore:string):Promise { - var uri = new Uri(); - var doc = new TextDocument(uri, value.split('\n'), '\n', 'php', 1, false); - - var idx = stringBefore ? value.indexOf(stringBefore) + stringBefore.length : 0; - var position = new Position(0, idx); - - return phpCompletionProvider.provideCompletionItems(doc, position, null); +var testSuggestionsFor = function(value:string, stringBefore:string):Thenable { + return workspace.openTextDocument(Uri.parse("untitled:/foo/new.js")).then(document => { + return window.showTextDocument(document).then(textEditor => { + return textEditor.edit(editBuilder => { + var lastLineLength = document.lineAt(document.lineCount - 1).text.length; + editBuilder.replace(new vscode.Range(new vscode.Position(0, 0), new vscode.Position(textEditor.document.lineCount - 1, lastLineLength)), value); + }).then(() => { + var idx = stringBefore ? value.indexOf(stringBefore) + stringBefore.length : 0; + var position = new Position(0, idx); + return phpCompletionProvider.provideCompletionItems(document, position, null); + }) + }) + }); }; var assertSuggestion= function(completions:CompletionItem[], label:string, kind: CompletionItemKind) { @@ -25,9 +30,9 @@ var assertSuggestion= function(completions:CompletionItem[], label:string, kind: assert.equal(entries[0].kind, kind); }; -suite("Extension Tests", () => { +suite("PHP", () => { - test("Something 1", (testDone:(err?:any) => void) => { + test("Intellisense", (testDone:(err?:any) => void) => { Promise.all([ testSuggestionsFor(' { assertSuggestion(completions, '__CLASS__', CompletionItemKind.Field); diff --git a/extensions/python/package.json b/extensions/python/package.json index 5d178ef1c65..ae1633093bc 100644 --- a/extensions/python/package.json +++ b/extensions/python/package.json @@ -6,7 +6,7 @@ "contributes": { "languages": [{ "id": "python", - "extensions": [ ".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi" ], + "extensions": [ ".py", ".rpy", ".pyw", ".cpy", ".gn", ".gyp", ".gypi" ], "aliases": [ "Python", "py" ], "firstLine": "^#!/.*\\bpython[0-9.-]*\\b", "configuration": "./python.configuration.json" @@ -20,4 +20,4 @@ "path": "./syntaxes/Regular Expressions (Python).tmLanguage" }] } -} \ No newline at end of file +} diff --git a/extensions/ruby/package.json b/extensions/ruby/package.json index 83d9bfc8c48..2dd3847cd34 100644 --- a/extensions/ruby/package.json +++ b/extensions/ruby/package.json @@ -7,7 +7,7 @@ "languages": [{ "id": "ruby", "extensions": [ ".rb", ".rbx", ".rjs", ".gemspec", ".pp" ], - "filenames": [ "rakefile" ], + "filenames": [ "rakefile", "gemfile" ], "aliases": [ "Ruby", "rb" ], "configuration": "./ruby.configuration.json" }], diff --git a/extensions/shaderlab/package.json b/extensions/shaderlab/package.json index ae7e7b9fbff..9c10e6b1df9 100644 --- a/extensions/shaderlab/package.json +++ b/extensions/shaderlab/package.json @@ -6,7 +6,7 @@ "contributes": { "languages": [{ "id": "shaderlab", - "extensions": [".shader"], + "extensions": [".shader", ".cginc"], "aliases": ["ShaderLab", "shaderlab"], "configuration": "./shaderlab.configuration.json" }], diff --git a/extensions/tsconfig.json b/extensions/tsconfig.json index 36f6ef5e85c..7b2657a74f5 100644 --- a/extensions/tsconfig.json +++ b/extensions/tsconfig.json @@ -11,6 +11,6 @@ "typescript/src/lib", "typescript/out/lib", "jshint", - "csharp-o" + "vscode-api-tests/node_modules" ] } \ No newline at end of file diff --git a/extensions/typescript/server/typescript/lib/lib.core.d.ts b/extensions/typescript/server/typescript/lib/lib.core.d.ts index 968eb6688d5..692d8fbfe7e 100644 --- a/extensions/typescript/server/typescript/lib/lib.core.d.ts +++ b/extensions/typescript/server/typescript/lib/lib.core.d.ts @@ -1,14 +1,14 @@ /*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. +Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - +License at http://www.apache.org/licenses/LICENSE-2.0 + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ @@ -23,7 +23,7 @@ declare var NaN: number; declare var Infinity: number; /** - * Evaluates JavaScript code and executes it. + * Evaluates JavaScript code and executes it. * @param x A String value that contains valid JavaScript code. */ declare function eval(x: string): any; @@ -31,25 +31,25 @@ declare function eval(x: string): any; /** * Converts A string to an integer. * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. * All other strings are considered decimal. */ declare function parseInt(s: string, radix?: number): number; /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. */ declare function parseFloat(string: string): number; /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). * @param number A numeric value. */ declare function isNaN(number: number): boolean; -/** +/** * Determines whether a supplied number is finite. * @param number Any numeric value. */ @@ -67,7 +67,7 @@ declare function decodeURI(encodedURI: string): string; */ declare function decodeURIComponent(encodedURIComponent: string): string; -/** +/** * Encodes a text string as a valid Uniform Resource Identifier (URI) * @param uri A value representing an encoded URI. */ @@ -106,18 +106,18 @@ interface Object { valueOf(): Object; /** - * Determines whether an object has a property with the specified name. + * Determines whether an object has a property with the specified name. * @param v A property name. */ hasOwnProperty(v: string): boolean; /** - * Determines whether an object exists in another object's prototype chain. + * Determines whether an object exists in another object's prototype chain. * @param v Another object whose prototype chain is to be checked. */ isPrototypeOf(v: Object): boolean; - /** + /** * Determines whether a specified property is enumerable. * @param v A property name. */ @@ -132,36 +132,36 @@ interface ObjectConstructor { /** A reference to the prototype for a class of objects. */ prototype: Object; - /** - * Returns the prototype of an object. + /** + * Returns the prototype of an object. * @param o The object that references the prototype. */ getPrototypeOf(o: any): any; /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. * @param o Object that contains the property. * @param p Name of the property. */ getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. * @param o Object that contains the own properties. */ getOwnPropertyNames(o: any): string[]; - /** + /** * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. + * @param properties JavaScript object that contains one or more property descriptors. */ create(o: any, properties?: PropertyDescriptorMap): any; /** - * Adds a property to an object, or modifies attributes of an existing property. + * Adds a property to an object, or modifies attributes of an existing property. * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. * @param p The property name. * @param attributes Descriptor for the property. It can be for a data property or an accessor property. @@ -169,7 +169,7 @@ interface ObjectConstructor { defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * Adds one or more properties to an object, and/or modifies attributes of existing properties. * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. */ @@ -177,7 +177,7 @@ interface ObjectConstructor { /** * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. + * @param o Object on which to lock the attributes. */ seal(o: T): T; @@ -189,25 +189,25 @@ interface ObjectConstructor { /** * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. + * @param o Object to make non-extensible. */ preventExtensions(o: T): T; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isSealed(o: any): boolean; /** * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isFrozen(o: any): boolean; /** * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. + * @param o Object to test. */ isExtensible(o: any): boolean; @@ -242,7 +242,7 @@ interface Function { call(thisArg: any, ...argArray: any[]): any; /** - * For a given function, creates a bound function that has the same body as the original function. + * For a given function, creates a bound function that has the same body as the original function. * The this object of the bound function is associated with the specified object, and has the specified initial parameters. * @param thisArg An object to which the this keyword can refer inside the new function. * @param argArray A list of arguments to be passed to the new function. @@ -285,7 +285,7 @@ interface String { */ charAt(pos: number): string; - /** + /** * Returns the Unicode value of the character at the specified location. * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. */ @@ -293,12 +293,12 @@ interface String { /** * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. + * @param strings The strings to append to the end of the string. */ concat(...strings: string[]): string; /** - * Returns the position of the first occurrence of a substring. + * Returns the position of the first occurrence of a substring. * @param searchString The substring to search for in the string * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. */ @@ -317,15 +317,15 @@ interface String { */ localeCompare(that: string): number; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ match(regexp: string): RegExpMatchArray; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ match(regexp: RegExp): RegExpMatchArray; @@ -359,40 +359,40 @@ interface String { /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: string): number; /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: RegExp): number; /** * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. * If this value is not specified, the substring continues to the end of stringObj. */ slice(start?: number, end?: number): string; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: string, limit?: number): string[]; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: RegExp, limit?: number): string[]; /** - * Returns the substring at the specified location within a String object. + * Returns the substring at the specified location within a String object. * @param start The zero-based index number indicating the beginning of the substring. * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. * If end is omitted, the characters from start through the end of the original string are returned. @@ -438,8 +438,8 @@ interface StringConstructor { fromCharCode(...codes: number[]): string; } -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. */ declare var String: StringConstructor; @@ -463,7 +463,7 @@ interface Number { */ toString(radix?: number): string; - /** + /** * Returns a string representing a number in fixed-point notation. * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. */ @@ -496,21 +496,21 @@ interface NumberConstructor { /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ MIN_VALUE: number; - /** + /** * A value that is not a number. * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. */ NaN: number; - /** + /** * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. */ NEGATIVE_INFINITY: number; /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. */ POSITIVE_INFINITY: number; } @@ -540,23 +540,23 @@ interface Math { /** The square root of 2. */ SQRT2: number; /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). * For example, the absolute value of -5 is the same as the absolute value of 5. * @param x A numeric expression for which the absolute value is needed. */ abs(x: number): number; /** - * Returns the arc cosine (or inverse cosine) of a number. + * Returns the arc cosine (or inverse cosine) of a number. * @param x A numeric expression. */ acos(x: number): number; - /** - * Returns the arcsine of a number. + /** + * Returns the arcsine of a number. * @param x A numeric expression. */ asin(x: number): number; /** - * Returns the arctangent of a number. + * Returns the arctangent of a number. * @param x A numeric expression for which the arctangent is needed. */ atan(x: number): number; @@ -567,49 +567,49 @@ interface Math { */ atan2(y: number, x: number): number; /** - * Returns the smallest number greater than or equal to its numeric argument. + * Returns the smallest number greater than or equal to its numeric argument. * @param x A numeric expression. */ ceil(x: number): number; /** - * Returns the cosine of a number. + * Returns the cosine of a number. * @param x A numeric expression that contains an angle measured in radians. */ cos(x: number): number; /** - * Returns e (the base of natural logarithms) raised to a power. + * Returns e (the base of natural logarithms) raised to a power. * @param x A numeric expression representing the power of e. */ exp(x: number): number; /** - * Returns the greatest number less than or equal to its numeric argument. + * Returns the greatest number less than or equal to its numeric argument. * @param x A numeric expression. */ floor(x: number): number; /** - * Returns the natural logarithm (base e) of a number. + * Returns the natural logarithm (base e) of a number. * @param x A numeric expression. */ log(x: number): number; /** - * Returns the larger of a set of supplied numeric expressions. + * Returns the larger of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ max(...values: number[]): number; /** - * Returns the smaller of a set of supplied numeric expressions. + * Returns the smaller of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ min(...values: number[]): number; /** - * Returns the value of a base expression taken to a specified power. + * Returns the value of a base expression taken to a specified power. * @param x The base value of the expression. * @param y The exponent value of the expression. */ pow(x: number, y: number): number; /** Returns a pseudorandom number between 0 and 1. */ random(): number; - /** + /** * Returns a supplied numeric expression rounded to the nearest number. * @param x The value to be rounded to the nearest number. */ @@ -685,24 +685,24 @@ interface Date { getUTCMilliseconds(): number; /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ getTimezoneOffset(): number; - /** + /** * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. */ setTime(time: number): number; /** - * Sets the milliseconds value in the Date object using local time. + * Sets the milliseconds value in the Date object using local time. * @param ms A numeric value equal to the millisecond value. */ setMilliseconds(ms: number): number; - /** + /** * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. + * @param ms A numeric value equal to the millisecond value. */ setUTCMilliseconds(ms: number): number; /** - * Sets the seconds value in the Date object using local time. + * Sets the seconds value in the Date object using local time. * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ @@ -714,16 +714,16 @@ interface Date { */ setUTCSeconds(sec: number, ms?: number): number; /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setMinutes(min: number, sec?: number, ms?: number): number; /** * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCMinutes(min: number, sec?: number, ms?: number): number; @@ -731,7 +731,7 @@ interface Date { * Sets the hour value in the Date object using local time. * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setHours(hours: number, min?: number, sec?: number, ms?: number): number; @@ -739,23 +739,23 @@ interface Date { * Sets the hours value in the Date object using Universal Coordinated Time (UTC). * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; /** - * Sets the numeric day-of-the-month value of the Date object using local time. + * Sets the numeric day-of-the-month value of the Date object using local time. * @param date A numeric value equal to the day of the month. */ setDate(date: number): number; - /** + /** * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. + * @param date A numeric value equal to the day of the month. */ setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. */ setMonth(month: number, date?: number): number; @@ -800,7 +800,7 @@ interface DateConstructor { */ parse(s: string): number; /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. * @param month The month as an number between 0 and 11 (January to December). * @param date The date as an number between 1 and 31. @@ -826,13 +826,13 @@ interface RegExpExecArray extends Array { } interface RegExp { - /** + /** * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. * @param string The String object or string literal on which to perform the search. */ exec(string: string): RegExpExecArray; - /** + /** * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. * @param string String on which to perform the search. */ @@ -959,8 +959,8 @@ interface JSON { /** * Converts a JavaScript Object Notation (JSON) string into an object. * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. */ parse(text: string, reviver?: (key: any, value: any) => any): any; /** @@ -1040,14 +1040,14 @@ interface Array { */ join(separator?: string): string; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): T[]; /** * Removes the first element from an array and returns it. */ shift(): T; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1110,21 +1110,21 @@ interface Array { /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; /** * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; @@ -1142,15 +1142,15 @@ interface Array { */ reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; @@ -1205,10 +1205,10 @@ interface ArrayLike { /** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. */ interface ArrayBuffer { /** @@ -1231,7 +1231,7 @@ declare var ArrayBuffer: ArrayBufferConstructor; interface ArrayBufferView { /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1251,124 +1251,124 @@ interface DataView { byteLength: number; byteOffset: number; /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat32(byteOffset: number, littleEndian?: boolean): number; /** * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat64(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt8(byteOffset: number): number; /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt32(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint8(byteOffset: number): number; /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint32(byteOffset: number, littleEndian?: boolean): number; /** - * Stores an Float32 value at the specified byte offset from the start of the view. + * Stores an Float32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Float64 value at the specified byte offset from the start of the view. + * Stores an Float64 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int8 value at the specified byte offset from the start of the view. + * Stores an Int8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setInt8(byteOffset: number, value: number): void; /** - * Stores an Int16 value at the specified byte offset from the start of the view. + * Stores an Int16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int32 value at the specified byte offset from the start of the view. + * Stores an Int32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint8 value at the specified byte offset from the start of the view. + * Stores an Uint8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setUint8(byteOffset: number, value: number): void; /** - * Stores an Uint16 value at the specified byte offset from the start of the view. + * Stores an Uint16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint32 value at the specified byte offset from the start of the view. + * Stores an Uint32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; @@ -1380,17 +1380,17 @@ interface DataViewConstructor { declare var DataView: DataViewConstructor; /** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Int8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1404,21 +1404,21 @@ interface Int8Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Int8Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1428,49 +1428,49 @@ interface Int8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Int8Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; @@ -1485,7 +1485,7 @@ interface Int8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1493,7 +1493,7 @@ interface Int8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1504,65 +1504,65 @@ interface Int8Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int8Array; @@ -1580,7 +1580,7 @@ interface Int8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1589,31 +1589,31 @@ interface Int8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Int8Array; /** * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1631,7 +1631,7 @@ interface Int8ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -1640,7 +1640,7 @@ interface Int8ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1653,17 +1653,17 @@ interface Int8ArrayConstructor { declare var Int8Array: Int8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1677,21 +1677,21 @@ interface Uint8Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint8Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1701,49 +1701,49 @@ interface Uint8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint8Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; @@ -1758,7 +1758,7 @@ interface Uint8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1766,7 +1766,7 @@ interface Uint8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1777,65 +1777,65 @@ interface Uint8Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8Array; @@ -1853,7 +1853,7 @@ interface Uint8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1862,31 +1862,31 @@ interface Uint8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint8Array; /** * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1905,7 +1905,7 @@ interface Uint8ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -1914,7 +1914,7 @@ interface Uint8ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1927,17 +1927,17 @@ interface Uint8ArrayConstructor { declare var Uint8Array: Uint8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. * If the requested number of bytes could not be allocated an exception is raised. */ interface Uint8ClampedArray { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1951,21 +1951,21 @@ interface Uint8ClampedArray { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1975,49 +1975,49 @@ interface Uint8ClampedArray { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint8ClampedArray; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; @@ -2032,7 +2032,7 @@ interface Uint8ClampedArray { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2040,7 +2040,7 @@ interface Uint8ClampedArray { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2051,65 +2051,65 @@ interface Uint8ClampedArray { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8ClampedArray; @@ -2127,7 +2127,7 @@ interface Uint8ClampedArray { */ set(array: Uint8ClampedArray, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2136,31 +2136,31 @@ interface Uint8ClampedArray { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; /** * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8ClampedArray; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2179,7 +2179,7 @@ interface Uint8ClampedArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -2200,17 +2200,17 @@ interface Uint8ClampedArrayConstructor { declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -2224,21 +2224,21 @@ interface Int16Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Int16Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2248,49 +2248,49 @@ interface Int16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Int16Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; @@ -2305,7 +2305,7 @@ interface Int16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2313,7 +2313,7 @@ interface Int16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2324,65 +2324,65 @@ interface Int16Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int16Array; @@ -2400,7 +2400,7 @@ interface Int16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2409,31 +2409,31 @@ interface Int16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Int16Array; /** * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2452,7 +2452,7 @@ interface Int16ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -2461,7 +2461,7 @@ interface Int16ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2474,17 +2474,17 @@ interface Int16ArrayConstructor { declare var Int16Array: Int16ArrayConstructor; /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -2498,21 +2498,21 @@ interface Uint16Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint16Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2522,49 +2522,49 @@ interface Uint16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint16Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; @@ -2579,7 +2579,7 @@ interface Uint16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2587,7 +2587,7 @@ interface Uint16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2598,65 +2598,65 @@ interface Uint16Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint16Array; @@ -2674,7 +2674,7 @@ interface Uint16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2683,31 +2683,31 @@ interface Uint16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint16Array; /** * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2726,7 +2726,7 @@ interface Uint16ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -2735,7 +2735,7 @@ interface Uint16ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2747,17 +2747,17 @@ interface Uint16ArrayConstructor { } declare var Uint16Array: Uint16ArrayConstructor; /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -2771,21 +2771,21 @@ interface Int32Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Int32Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2795,49 +2795,49 @@ interface Int32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Int32Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; @@ -2852,7 +2852,7 @@ interface Int32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2860,7 +2860,7 @@ interface Int32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2871,65 +2871,65 @@ interface Int32Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int32Array; @@ -2947,7 +2947,7 @@ interface Int32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2956,31 +2956,31 @@ interface Int32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Int32Array; /** * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2999,7 +2999,7 @@ interface Int32ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3008,7 +3008,7 @@ interface Int32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3020,17 +3020,17 @@ interface Int32ArrayConstructor { declare var Int32Array: Int32ArrayConstructor; /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -3044,21 +3044,21 @@ interface Uint32Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint32Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3068,49 +3068,49 @@ interface Uint32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint32Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; @@ -3125,7 +3125,7 @@ interface Uint32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3133,7 +3133,7 @@ interface Uint32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3144,65 +3144,65 @@ interface Uint32Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint32Array; @@ -3220,7 +3220,7 @@ interface Uint32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3229,31 +3229,31 @@ interface Uint32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint32Array; /** * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3272,7 +3272,7 @@ interface Uint32ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3281,7 +3281,7 @@ interface Uint32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3298,12 +3298,12 @@ declare var Uint32Array: Uint32ArrayConstructor; */ interface Float32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -3317,21 +3317,21 @@ interface Float32Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Float32Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3341,49 +3341,49 @@ interface Float32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Float32Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; @@ -3398,7 +3398,7 @@ interface Float32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3406,7 +3406,7 @@ interface Float32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3417,65 +3417,65 @@ interface Float32Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float32Array; @@ -3493,7 +3493,7 @@ interface Float32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3502,31 +3502,31 @@ interface Float32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Float32Array; /** * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3545,7 +3545,7 @@ interface Float32ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3554,7 +3554,7 @@ interface Float32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3567,17 +3567,17 @@ interface Float32ArrayConstructor { declare var Float32Array: Float32ArrayConstructor; /** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Float64Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -3591,21 +3591,21 @@ interface Float64Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Float64Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3615,49 +3615,49 @@ interface Float64Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Float64Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; @@ -3672,7 +3672,7 @@ interface Float64Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3680,7 +3680,7 @@ interface Float64Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3691,65 +3691,65 @@ interface Float64Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float64Array; @@ -3767,7 +3767,7 @@ interface Float64Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3776,31 +3776,31 @@ interface Float64Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Float64Array; /** * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float64Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3819,7 +3819,7 @@ interface Float64ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3828,7 +3828,7 @@ interface Float64ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float64Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. diff --git a/extensions/typescript/server/typescript/lib/lib.core.es6.d.ts b/extensions/typescript/server/typescript/lib/lib.core.es6.d.ts index 3189ebdccd8..962210edf23 100644 --- a/extensions/typescript/server/typescript/lib/lib.core.es6.d.ts +++ b/extensions/typescript/server/typescript/lib/lib.core.es6.d.ts @@ -1,14 +1,14 @@ /*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. +Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - +License at http://www.apache.org/licenses/LICENSE-2.0 + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ @@ -23,7 +23,7 @@ declare var NaN: number; declare var Infinity: number; /** - * Evaluates JavaScript code and executes it. + * Evaluates JavaScript code and executes it. * @param x A String value that contains valid JavaScript code. */ declare function eval(x: string): any; @@ -31,25 +31,25 @@ declare function eval(x: string): any; /** * Converts A string to an integer. * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. * All other strings are considered decimal. */ declare function parseInt(s: string, radix?: number): number; /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. */ declare function parseFloat(string: string): number; /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). * @param number A numeric value. */ declare function isNaN(number: number): boolean; -/** +/** * Determines whether a supplied number is finite. * @param number Any numeric value. */ @@ -67,7 +67,7 @@ declare function decodeURI(encodedURI: string): string; */ declare function decodeURIComponent(encodedURIComponent: string): string; -/** +/** * Encodes a text string as a valid Uniform Resource Identifier (URI) * @param uri A value representing an encoded URI. */ @@ -106,18 +106,18 @@ interface Object { valueOf(): Object; /** - * Determines whether an object has a property with the specified name. + * Determines whether an object has a property with the specified name. * @param v A property name. */ hasOwnProperty(v: string): boolean; /** - * Determines whether an object exists in another object's prototype chain. + * Determines whether an object exists in another object's prototype chain. * @param v Another object whose prototype chain is to be checked. */ isPrototypeOf(v: Object): boolean; - /** + /** * Determines whether a specified property is enumerable. * @param v A property name. */ @@ -132,36 +132,36 @@ interface ObjectConstructor { /** A reference to the prototype for a class of objects. */ prototype: Object; - /** - * Returns the prototype of an object. + /** + * Returns the prototype of an object. * @param o The object that references the prototype. */ getPrototypeOf(o: any): any; /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. * @param o Object that contains the property. * @param p Name of the property. */ getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. * @param o Object that contains the own properties. */ getOwnPropertyNames(o: any): string[]; - /** + /** * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. + * @param properties JavaScript object that contains one or more property descriptors. */ create(o: any, properties?: PropertyDescriptorMap): any; /** - * Adds a property to an object, or modifies attributes of an existing property. + * Adds a property to an object, or modifies attributes of an existing property. * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. * @param p The property name. * @param attributes Descriptor for the property. It can be for a data property or an accessor property. @@ -169,7 +169,7 @@ interface ObjectConstructor { defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * Adds one or more properties to an object, and/or modifies attributes of existing properties. * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. */ @@ -177,7 +177,7 @@ interface ObjectConstructor { /** * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. + * @param o Object on which to lock the attributes. */ seal(o: T): T; @@ -189,25 +189,25 @@ interface ObjectConstructor { /** * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. + * @param o Object to make non-extensible. */ preventExtensions(o: T): T; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isSealed(o: any): boolean; /** * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isFrozen(o: any): boolean; /** * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. + * @param o Object to test. */ isExtensible(o: any): boolean; @@ -242,7 +242,7 @@ interface Function { call(thisArg: any, ...argArray: any[]): any; /** - * For a given function, creates a bound function that has the same body as the original function. + * For a given function, creates a bound function that has the same body as the original function. * The this object of the bound function is associated with the specified object, and has the specified initial parameters. * @param thisArg An object to which the this keyword can refer inside the new function. * @param argArray A list of arguments to be passed to the new function. @@ -285,7 +285,7 @@ interface String { */ charAt(pos: number): string; - /** + /** * Returns the Unicode value of the character at the specified location. * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. */ @@ -293,12 +293,12 @@ interface String { /** * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. + * @param strings The strings to append to the end of the string. */ concat(...strings: string[]): string; /** - * Returns the position of the first occurrence of a substring. + * Returns the position of the first occurrence of a substring. * @param searchString The substring to search for in the string * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. */ @@ -317,15 +317,15 @@ interface String { */ localeCompare(that: string): number; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ match(regexp: string): RegExpMatchArray; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ match(regexp: RegExp): RegExpMatchArray; @@ -359,40 +359,40 @@ interface String { /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: string): number; /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: RegExp): number; /** * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. * If this value is not specified, the substring continues to the end of stringObj. */ slice(start?: number, end?: number): string; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: string, limit?: number): string[]; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: RegExp, limit?: number): string[]; /** - * Returns the substring at the specified location within a String object. + * Returns the substring at the specified location within a String object. * @param start The zero-based index number indicating the beginning of the substring. * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. * If end is omitted, the characters from start through the end of the original string are returned. @@ -438,8 +438,8 @@ interface StringConstructor { fromCharCode(...codes: number[]): string; } -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. */ declare var String: StringConstructor; @@ -463,7 +463,7 @@ interface Number { */ toString(radix?: number): string; - /** + /** * Returns a string representing a number in fixed-point notation. * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. */ @@ -496,21 +496,21 @@ interface NumberConstructor { /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ MIN_VALUE: number; - /** + /** * A value that is not a number. * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. */ NaN: number; - /** + /** * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. */ NEGATIVE_INFINITY: number; /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. */ POSITIVE_INFINITY: number; } @@ -540,23 +540,23 @@ interface Math { /** The square root of 2. */ SQRT2: number; /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). * For example, the absolute value of -5 is the same as the absolute value of 5. * @param x A numeric expression for which the absolute value is needed. */ abs(x: number): number; /** - * Returns the arc cosine (or inverse cosine) of a number. + * Returns the arc cosine (or inverse cosine) of a number. * @param x A numeric expression. */ acos(x: number): number; - /** - * Returns the arcsine of a number. + /** + * Returns the arcsine of a number. * @param x A numeric expression. */ asin(x: number): number; /** - * Returns the arctangent of a number. + * Returns the arctangent of a number. * @param x A numeric expression for which the arctangent is needed. */ atan(x: number): number; @@ -567,49 +567,49 @@ interface Math { */ atan2(y: number, x: number): number; /** - * Returns the smallest number greater than or equal to its numeric argument. + * Returns the smallest number greater than or equal to its numeric argument. * @param x A numeric expression. */ ceil(x: number): number; /** - * Returns the cosine of a number. + * Returns the cosine of a number. * @param x A numeric expression that contains an angle measured in radians. */ cos(x: number): number; /** - * Returns e (the base of natural logarithms) raised to a power. + * Returns e (the base of natural logarithms) raised to a power. * @param x A numeric expression representing the power of e. */ exp(x: number): number; /** - * Returns the greatest number less than or equal to its numeric argument. + * Returns the greatest number less than or equal to its numeric argument. * @param x A numeric expression. */ floor(x: number): number; /** - * Returns the natural logarithm (base e) of a number. + * Returns the natural logarithm (base e) of a number. * @param x A numeric expression. */ log(x: number): number; /** - * Returns the larger of a set of supplied numeric expressions. + * Returns the larger of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ max(...values: number[]): number; /** - * Returns the smaller of a set of supplied numeric expressions. + * Returns the smaller of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ min(...values: number[]): number; /** - * Returns the value of a base expression taken to a specified power. + * Returns the value of a base expression taken to a specified power. * @param x The base value of the expression. * @param y The exponent value of the expression. */ pow(x: number, y: number): number; /** Returns a pseudorandom number between 0 and 1. */ random(): number; - /** + /** * Returns a supplied numeric expression rounded to the nearest number. * @param x The value to be rounded to the nearest number. */ @@ -685,24 +685,24 @@ interface Date { getUTCMilliseconds(): number; /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ getTimezoneOffset(): number; - /** + /** * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. */ setTime(time: number): number; /** - * Sets the milliseconds value in the Date object using local time. + * Sets the milliseconds value in the Date object using local time. * @param ms A numeric value equal to the millisecond value. */ setMilliseconds(ms: number): number; - /** + /** * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. + * @param ms A numeric value equal to the millisecond value. */ setUTCMilliseconds(ms: number): number; /** - * Sets the seconds value in the Date object using local time. + * Sets the seconds value in the Date object using local time. * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ @@ -714,16 +714,16 @@ interface Date { */ setUTCSeconds(sec: number, ms?: number): number; /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setMinutes(min: number, sec?: number, ms?: number): number; /** * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCMinutes(min: number, sec?: number, ms?: number): number; @@ -731,7 +731,7 @@ interface Date { * Sets the hour value in the Date object using local time. * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setHours(hours: number, min?: number, sec?: number, ms?: number): number; @@ -739,23 +739,23 @@ interface Date { * Sets the hours value in the Date object using Universal Coordinated Time (UTC). * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; /** - * Sets the numeric day-of-the-month value of the Date object using local time. + * Sets the numeric day-of-the-month value of the Date object using local time. * @param date A numeric value equal to the day of the month. */ setDate(date: number): number; - /** + /** * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. + * @param date A numeric value equal to the day of the month. */ setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. */ setMonth(month: number, date?: number): number; @@ -800,7 +800,7 @@ interface DateConstructor { */ parse(s: string): number; /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. * @param month The month as an number between 0 and 11 (January to December). * @param date The date as an number between 1 and 31. @@ -826,13 +826,13 @@ interface RegExpExecArray extends Array { } interface RegExp { - /** + /** * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. * @param string The String object or string literal on which to perform the search. */ exec(string: string): RegExpExecArray; - /** + /** * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. * @param string String on which to perform the search. */ @@ -959,8 +959,8 @@ interface JSON { /** * Converts a JavaScript Object Notation (JSON) string into an object. * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. */ parse(text: string, reviver?: (key: any, value: any) => any): any; /** @@ -1040,14 +1040,14 @@ interface Array { */ join(separator?: string): string; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): T[]; /** * Removes the first element from an array and returns it. */ shift(): T; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1110,21 +1110,21 @@ interface Array { /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; /** * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; @@ -1142,15 +1142,15 @@ interface Array { */ reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; @@ -1205,10 +1205,10 @@ interface ArrayLike { /** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. */ interface ArrayBuffer { /** @@ -1231,7 +1231,7 @@ declare var ArrayBuffer: ArrayBufferConstructor; interface ArrayBufferView { /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1251,124 +1251,124 @@ interface DataView { byteLength: number; byteOffset: number; /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat32(byteOffset: number, littleEndian?: boolean): number; /** * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat64(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt8(byteOffset: number): number; /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt32(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint8(byteOffset: number): number; /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint32(byteOffset: number, littleEndian?: boolean): number; /** - * Stores an Float32 value at the specified byte offset from the start of the view. + * Stores an Float32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Float64 value at the specified byte offset from the start of the view. + * Stores an Float64 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int8 value at the specified byte offset from the start of the view. + * Stores an Int8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setInt8(byteOffset: number, value: number): void; /** - * Stores an Int16 value at the specified byte offset from the start of the view. + * Stores an Int16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int32 value at the specified byte offset from the start of the view. + * Stores an Int32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint8 value at the specified byte offset from the start of the view. + * Stores an Uint8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setUint8(byteOffset: number, value: number): void; /** - * Stores an Uint16 value at the specified byte offset from the start of the view. + * Stores an Uint16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint32 value at the specified byte offset from the start of the view. + * Stores an Uint32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; @@ -1380,17 +1380,17 @@ interface DataViewConstructor { declare var DataView: DataViewConstructor; /** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Int8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1404,21 +1404,21 @@ interface Int8Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Int8Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1428,49 +1428,49 @@ interface Int8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Int8Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; @@ -1485,7 +1485,7 @@ interface Int8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1493,7 +1493,7 @@ interface Int8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1504,65 +1504,65 @@ interface Int8Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int8Array; @@ -1580,7 +1580,7 @@ interface Int8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1589,31 +1589,31 @@ interface Int8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Int8Array; /** * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1631,7 +1631,7 @@ interface Int8ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -1640,7 +1640,7 @@ interface Int8ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1653,17 +1653,17 @@ interface Int8ArrayConstructor { declare var Int8Array: Int8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1677,21 +1677,21 @@ interface Uint8Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint8Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1701,49 +1701,49 @@ interface Uint8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint8Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; @@ -1758,7 +1758,7 @@ interface Uint8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1766,7 +1766,7 @@ interface Uint8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1777,65 +1777,65 @@ interface Uint8Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8Array; @@ -1853,7 +1853,7 @@ interface Uint8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1862,31 +1862,31 @@ interface Uint8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint8Array; /** * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1905,7 +1905,7 @@ interface Uint8ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -1914,7 +1914,7 @@ interface Uint8ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1927,17 +1927,17 @@ interface Uint8ArrayConstructor { declare var Uint8Array: Uint8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. * If the requested number of bytes could not be allocated an exception is raised. */ interface Uint8ClampedArray { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1951,21 +1951,21 @@ interface Uint8ClampedArray { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1975,49 +1975,49 @@ interface Uint8ClampedArray { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint8ClampedArray; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; @@ -2032,7 +2032,7 @@ interface Uint8ClampedArray { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2040,7 +2040,7 @@ interface Uint8ClampedArray { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2051,65 +2051,65 @@ interface Uint8ClampedArray { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8ClampedArray; @@ -2127,7 +2127,7 @@ interface Uint8ClampedArray { */ set(array: Uint8ClampedArray, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2136,31 +2136,31 @@ interface Uint8ClampedArray { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; /** * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8ClampedArray; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2179,7 +2179,7 @@ interface Uint8ClampedArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -2200,17 +2200,17 @@ interface Uint8ClampedArrayConstructor { declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -2224,21 +2224,21 @@ interface Int16Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Int16Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2248,49 +2248,49 @@ interface Int16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Int16Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; @@ -2305,7 +2305,7 @@ interface Int16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2313,7 +2313,7 @@ interface Int16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2324,65 +2324,65 @@ interface Int16Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int16Array; @@ -2400,7 +2400,7 @@ interface Int16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2409,31 +2409,31 @@ interface Int16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Int16Array; /** * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2452,7 +2452,7 @@ interface Int16ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -2461,7 +2461,7 @@ interface Int16ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2474,17 +2474,17 @@ interface Int16ArrayConstructor { declare var Int16Array: Int16ArrayConstructor; /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -2498,21 +2498,21 @@ interface Uint16Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint16Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2522,49 +2522,49 @@ interface Uint16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint16Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; @@ -2579,7 +2579,7 @@ interface Uint16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2587,7 +2587,7 @@ interface Uint16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2598,65 +2598,65 @@ interface Uint16Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint16Array; @@ -2674,7 +2674,7 @@ interface Uint16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2683,31 +2683,31 @@ interface Uint16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint16Array; /** * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2726,7 +2726,7 @@ interface Uint16ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -2735,7 +2735,7 @@ interface Uint16ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2747,17 +2747,17 @@ interface Uint16ArrayConstructor { } declare var Uint16Array: Uint16ArrayConstructor; /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -2771,21 +2771,21 @@ interface Int32Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Int32Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2795,49 +2795,49 @@ interface Int32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Int32Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; @@ -2852,7 +2852,7 @@ interface Int32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2860,7 +2860,7 @@ interface Int32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2871,65 +2871,65 @@ interface Int32Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int32Array; @@ -2947,7 +2947,7 @@ interface Int32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2956,31 +2956,31 @@ interface Int32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Int32Array; /** * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2999,7 +2999,7 @@ interface Int32ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3008,7 +3008,7 @@ interface Int32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3020,17 +3020,17 @@ interface Int32ArrayConstructor { declare var Int32Array: Int32ArrayConstructor; /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -3044,21 +3044,21 @@ interface Uint32Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint32Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3068,49 +3068,49 @@ interface Uint32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint32Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; @@ -3125,7 +3125,7 @@ interface Uint32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3133,7 +3133,7 @@ interface Uint32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3144,65 +3144,65 @@ interface Uint32Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint32Array; @@ -3220,7 +3220,7 @@ interface Uint32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3229,31 +3229,31 @@ interface Uint32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint32Array; /** * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3272,7 +3272,7 @@ interface Uint32ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3281,7 +3281,7 @@ interface Uint32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3298,12 +3298,12 @@ declare var Uint32Array: Uint32ArrayConstructor; */ interface Float32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -3317,21 +3317,21 @@ interface Float32Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Float32Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3341,49 +3341,49 @@ interface Float32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Float32Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; @@ -3398,7 +3398,7 @@ interface Float32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3406,7 +3406,7 @@ interface Float32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3417,65 +3417,65 @@ interface Float32Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float32Array; @@ -3493,7 +3493,7 @@ interface Float32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3502,31 +3502,31 @@ interface Float32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Float32Array; /** * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3545,7 +3545,7 @@ interface Float32ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3554,7 +3554,7 @@ interface Float32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3567,17 +3567,17 @@ interface Float32ArrayConstructor { declare var Float32Array: Float32ArrayConstructor; /** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Float64Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -3591,21 +3591,21 @@ interface Float64Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Float64Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3615,49 +3615,49 @@ interface Float64Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Float64Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; @@ -3672,7 +3672,7 @@ interface Float64Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3680,7 +3680,7 @@ interface Float64Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3691,65 +3691,65 @@ interface Float64Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float64Array; @@ -3767,7 +3767,7 @@ interface Float64Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3776,31 +3776,31 @@ interface Float64Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Float64Array; /** * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float64Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3819,7 +3819,7 @@ interface Float64ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3828,7 +3828,7 @@ interface Float64ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float64Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3851,8 +3851,8 @@ interface Symbol { } interface SymbolConstructor { - /** - * A reference to the prototype. + /** + * A reference to the prototype. */ prototype: Symbol; @@ -3863,14 +3863,14 @@ interface SymbolConstructor { (description?: string|number): symbol; /** - * Returns a Symbol object from the global symbol registry matching the given key if found. + * Returns a Symbol object from the global symbol registry matching the given key if found. * Otherwise, returns a new symbol with this key. * @param key key to search for. */ for(key: string): symbol; /** - * Returns a key from the global symbol registry matching the given Symbol if found. + * Returns a key from the global symbol registry matching the given Symbol if found. * Otherwise, returns a undefined. * @param sym Symbol to find the key for. */ @@ -3878,61 +3878,61 @@ interface SymbolConstructor { // Well-known Symbols - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. */ hasInstance: symbol; - /** + /** * A Boolean value that if true indicates that an object should flatten to its array elements * by Array.prototype.concat. */ isConcatSpreadable: symbol; - /** - * A method that returns the default iterator for an object. Called by the semantics of the + /** + * A method that returns the default iterator for an object. Called by the semantics of the * for-of statement. */ iterator: symbol; /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. */ match: symbol; - /** - * A regular expression method that replaces matched substrings of a string. Called by the + /** + * A regular expression method that replaces matched substrings of a string. Called by the * String.prototype.replace method. */ replace: symbol; /** - * A regular expression method that returns the index within a string that matches the + * A regular expression method that returns the index within a string that matches the * regular expression. Called by the String.prototype.search method. */ search: symbol; - /** - * A function valued property that is the constructor function that is used to create + /** + * A function valued property that is the constructor function that is used to create * derived objects. */ species: symbol; /** - * A regular expression method that splits a string at the indices that match the regular + * A regular expression method that splits a string at the indices that match the regular * expression. Called by the String.prototype.split method. */ split: symbol; - /** + /** * A method that converts an object to a corresponding primitive value. * Called by the ToPrimitive abstract operation. */ toPrimitive: symbol; - /** + /** * A String value that is used in the creation of the default string description of an object. * Called by the built-in method Object.prototype.toString. */ @@ -3948,12 +3948,12 @@ declare var Symbol: SymbolConstructor; interface Object { /** - * Determines whether an object has a property with the specified name. + * Determines whether an object has a property with the specified name. * @param v A property name. */ hasOwnProperty(v: PropertyKey): boolean; - /** + /** * Determines whether a specified property is enumerable. * @param v A property name. */ @@ -3962,10 +3962,37 @@ interface Object { interface ObjectConstructor { /** - * Copy the values of all of the enumerable own properties from one or more source objects to a + * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. * @param target The target object to copy to. - * @param sources One or more source objects to copy properties from. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties */ assign(target: any, ...sources: any[]): any; @@ -3990,17 +4017,17 @@ interface ObjectConstructor { setPrototypeOf(o: any, proto: any): any; /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. * @param o Object that contains the property. * @param p Name of the property. */ getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript * object (that is, a user-defined object or a built in object) or a DOM object. * @param p The property name. * @param attributes Descriptor for the property. It can be for a data property or an accessor @@ -4028,14 +4055,14 @@ interface Function { interface NumberConstructor { /** * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: + * that is representable as a Number value, which is approximately: * 2.2204460492503130808472633361816 x 10‍−‍16. */ EPSILON: number; /** * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a * number. Only finite values of the type number, result in true. * @param number A numeric value. */ @@ -4048,7 +4075,7 @@ interface NumberConstructor { isInteger(number: number): boolean; /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter * to a number. Only values of the type number, that are also NaN, result in true. * @param number A numeric value. @@ -4061,30 +4088,30 @@ interface NumberConstructor { */ isSafeInteger(number: number): boolean; - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. */ MAX_SAFE_INTEGER: number; - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). */ MIN_SAFE_INTEGER: number; /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. */ parseFloat(string: string): number; /** * Converts A string to an integer. * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. * All other strings are considered decimal. */ @@ -4109,39 +4136,39 @@ interface Array { values: boolean; }; - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, T]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: T) => boolean, thisArg?: any): number; @@ -4149,21 +4176,21 @@ interface Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: T, start?: number, end?: number): T[]; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): T[]; } @@ -4214,32 +4241,32 @@ interface String { [Symbol.iterator](): IterableIterator; /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. */ codePointAt(pos: number): number; /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are * greater than or equal to position; otherwise, returns false. - * @param searchString search string + * @param searchString search string * @param position If position is undefined, 0 is assumed, so as to search all of the String. */ includes(searchString: string, position?: number): boolean; /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at * endPosition – length(this). Otherwise returns false. */ endsWith(searchString: string, endPosition?: number): boolean; /** - * Returns the String value result of normalizing the string into the normalization form + * Returns the String value result of normalizing the string into the normalization form * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default * is "NFC" @@ -4247,15 +4274,15 @@ interface String { normalize(form?: string): string; /** - * Returns a String value that is made from count copies appended together. If count is 0, + * Returns a String value that is made from count copies appended together. If count is 0, * T is the empty String is returned. * @param count number of copies to append */ repeat(count: number): string; /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at * position. Otherwise returns false. */ startsWith(searchString: string, position?: number): boolean; @@ -4350,7 +4377,7 @@ interface StringConstructor { /** * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest + * as such the first argument will be a well formed template call site object and the rest * parameter will contain the substitution values. * @param template A well-formed template string call site representation. * @param substitutions A set of substitution values. @@ -4431,7 +4458,7 @@ interface Math { log1p(x: number): number; /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of * the natural logarithms). * @param x A numeric expression. */ @@ -4542,7 +4569,7 @@ interface RegExp { * Replaces text in a string, using this regular expression. * @param string A String object or string literal whose contents matching against * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every + * @param replaceValue A String object or string literal containing the text to replace for every * successful match of this regular expression. */ [Symbol.replace](string: string, replaceValue: string): string; @@ -4591,15 +4618,15 @@ interface RegExp { */ flags: string; - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. */ sticky: boolean; - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. */ unicode: boolean; } @@ -4691,10 +4718,10 @@ interface JSON { } /** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. */ interface ArrayBuffer { [Symbol.toStringTag]: string; @@ -4705,19 +4732,19 @@ interface DataView { } /** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Int8Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4737,19 +4764,19 @@ interface Int8ArrayConstructor { } /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint8Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4769,21 +4796,21 @@ interface Uint8ArrayConstructor { } /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. * If the requested number of bytes could not be allocated an exception is raised. */ interface Uint8ClampedArray { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4805,21 +4832,21 @@ interface Uint8ClampedArrayConstructor { } /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int16Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4841,19 +4868,19 @@ interface Int16ArrayConstructor { } /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint16Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4873,19 +4900,19 @@ interface Uint16ArrayConstructor { } /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int32Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4905,19 +4932,19 @@ interface Int32ArrayConstructor { } /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint32Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4941,15 +4968,15 @@ interface Uint32ArrayConstructor { * of bytes could not be allocated an exception is raised. */ interface Float32Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4969,19 +4996,19 @@ interface Float32ArrayConstructor { } /** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Float64Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -5066,21 +5093,21 @@ interface Promise { } interface PromiseConstructor { - /** - * A reference to the prototype. + /** + * A reference to the prototype. */ prototype: Promise; /** * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, * and a reject callback used to reject the promise with a provided reason or error. */ new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises + * Creates a Promise that is resolved with an array of results when all of the provided Promises * resolve, or rejected when any Promise is rejected. * @param values An array of Promises. * @returns A new Promise. @@ -5088,7 +5115,7 @@ interface PromiseConstructor { all(values: Iterable>): Promise; /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved * or rejected. * @param values An array of Promises. * @returns A new Promise. diff --git a/extensions/typescript/server/typescript/lib/lib.d.ts b/extensions/typescript/server/typescript/lib/lib.d.ts index 8ace44c8b51..a91916202db 100644 --- a/extensions/typescript/server/typescript/lib/lib.d.ts +++ b/extensions/typescript/server/typescript/lib/lib.d.ts @@ -1,14 +1,14 @@ /*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. +Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - +License at http://www.apache.org/licenses/LICENSE-2.0 + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ @@ -23,7 +23,7 @@ declare var NaN: number; declare var Infinity: number; /** - * Evaluates JavaScript code and executes it. + * Evaluates JavaScript code and executes it. * @param x A String value that contains valid JavaScript code. */ declare function eval(x: string): any; @@ -31,25 +31,25 @@ declare function eval(x: string): any; /** * Converts A string to an integer. * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. * All other strings are considered decimal. */ declare function parseInt(s: string, radix?: number): number; /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. */ declare function parseFloat(string: string): number; /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). * @param number A numeric value. */ declare function isNaN(number: number): boolean; -/** +/** * Determines whether a supplied number is finite. * @param number Any numeric value. */ @@ -67,7 +67,7 @@ declare function decodeURI(encodedURI: string): string; */ declare function decodeURIComponent(encodedURIComponent: string): string; -/** +/** * Encodes a text string as a valid Uniform Resource Identifier (URI) * @param uri A value representing an encoded URI. */ @@ -106,18 +106,18 @@ interface Object { valueOf(): Object; /** - * Determines whether an object has a property with the specified name. + * Determines whether an object has a property with the specified name. * @param v A property name. */ hasOwnProperty(v: string): boolean; /** - * Determines whether an object exists in another object's prototype chain. + * Determines whether an object exists in another object's prototype chain. * @param v Another object whose prototype chain is to be checked. */ isPrototypeOf(v: Object): boolean; - /** + /** * Determines whether a specified property is enumerable. * @param v A property name. */ @@ -132,36 +132,36 @@ interface ObjectConstructor { /** A reference to the prototype for a class of objects. */ prototype: Object; - /** - * Returns the prototype of an object. + /** + * Returns the prototype of an object. * @param o The object that references the prototype. */ getPrototypeOf(o: any): any; /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. * @param o Object that contains the property. * @param p Name of the property. */ getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. * @param o Object that contains the own properties. */ getOwnPropertyNames(o: any): string[]; - /** + /** * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. + * @param properties JavaScript object that contains one or more property descriptors. */ create(o: any, properties?: PropertyDescriptorMap): any; /** - * Adds a property to an object, or modifies attributes of an existing property. + * Adds a property to an object, or modifies attributes of an existing property. * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. * @param p The property name. * @param attributes Descriptor for the property. It can be for a data property or an accessor property. @@ -169,7 +169,7 @@ interface ObjectConstructor { defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * Adds one or more properties to an object, and/or modifies attributes of existing properties. * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. */ @@ -177,7 +177,7 @@ interface ObjectConstructor { /** * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. + * @param o Object on which to lock the attributes. */ seal(o: T): T; @@ -189,25 +189,25 @@ interface ObjectConstructor { /** * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. + * @param o Object to make non-extensible. */ preventExtensions(o: T): T; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isSealed(o: any): boolean; /** * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isFrozen(o: any): boolean; /** * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. + * @param o Object to test. */ isExtensible(o: any): boolean; @@ -242,7 +242,7 @@ interface Function { call(thisArg: any, ...argArray: any[]): any; /** - * For a given function, creates a bound function that has the same body as the original function. + * For a given function, creates a bound function that has the same body as the original function. * The this object of the bound function is associated with the specified object, and has the specified initial parameters. * @param thisArg An object to which the this keyword can refer inside the new function. * @param argArray A list of arguments to be passed to the new function. @@ -285,7 +285,7 @@ interface String { */ charAt(pos: number): string; - /** + /** * Returns the Unicode value of the character at the specified location. * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. */ @@ -293,12 +293,12 @@ interface String { /** * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. + * @param strings The strings to append to the end of the string. */ concat(...strings: string[]): string; /** - * Returns the position of the first occurrence of a substring. + * Returns the position of the first occurrence of a substring. * @param searchString The substring to search for in the string * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. */ @@ -317,15 +317,15 @@ interface String { */ localeCompare(that: string): number; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ match(regexp: string): RegExpMatchArray; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ match(regexp: RegExp): RegExpMatchArray; @@ -359,40 +359,40 @@ interface String { /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: string): number; /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: RegExp): number; /** * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. * If this value is not specified, the substring continues to the end of stringObj. */ slice(start?: number, end?: number): string; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: string, limit?: number): string[]; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: RegExp, limit?: number): string[]; /** - * Returns the substring at the specified location within a String object. + * Returns the substring at the specified location within a String object. * @param start The zero-based index number indicating the beginning of the substring. * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. * If end is omitted, the characters from start through the end of the original string are returned. @@ -438,8 +438,8 @@ interface StringConstructor { fromCharCode(...codes: number[]): string; } -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. */ declare var String: StringConstructor; @@ -463,7 +463,7 @@ interface Number { */ toString(radix?: number): string; - /** + /** * Returns a string representing a number in fixed-point notation. * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. */ @@ -496,21 +496,21 @@ interface NumberConstructor { /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ MIN_VALUE: number; - /** + /** * A value that is not a number. * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. */ NaN: number; - /** + /** * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. */ NEGATIVE_INFINITY: number; /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. */ POSITIVE_INFINITY: number; } @@ -540,23 +540,23 @@ interface Math { /** The square root of 2. */ SQRT2: number; /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). * For example, the absolute value of -5 is the same as the absolute value of 5. * @param x A numeric expression for which the absolute value is needed. */ abs(x: number): number; /** - * Returns the arc cosine (or inverse cosine) of a number. + * Returns the arc cosine (or inverse cosine) of a number. * @param x A numeric expression. */ acos(x: number): number; - /** - * Returns the arcsine of a number. + /** + * Returns the arcsine of a number. * @param x A numeric expression. */ asin(x: number): number; /** - * Returns the arctangent of a number. + * Returns the arctangent of a number. * @param x A numeric expression for which the arctangent is needed. */ atan(x: number): number; @@ -567,49 +567,49 @@ interface Math { */ atan2(y: number, x: number): number; /** - * Returns the smallest number greater than or equal to its numeric argument. + * Returns the smallest number greater than or equal to its numeric argument. * @param x A numeric expression. */ ceil(x: number): number; /** - * Returns the cosine of a number. + * Returns the cosine of a number. * @param x A numeric expression that contains an angle measured in radians. */ cos(x: number): number; /** - * Returns e (the base of natural logarithms) raised to a power. + * Returns e (the base of natural logarithms) raised to a power. * @param x A numeric expression representing the power of e. */ exp(x: number): number; /** - * Returns the greatest number less than or equal to its numeric argument. + * Returns the greatest number less than or equal to its numeric argument. * @param x A numeric expression. */ floor(x: number): number; /** - * Returns the natural logarithm (base e) of a number. + * Returns the natural logarithm (base e) of a number. * @param x A numeric expression. */ log(x: number): number; /** - * Returns the larger of a set of supplied numeric expressions. + * Returns the larger of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ max(...values: number[]): number; /** - * Returns the smaller of a set of supplied numeric expressions. + * Returns the smaller of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ min(...values: number[]): number; /** - * Returns the value of a base expression taken to a specified power. + * Returns the value of a base expression taken to a specified power. * @param x The base value of the expression. * @param y The exponent value of the expression. */ pow(x: number, y: number): number; /** Returns a pseudorandom number between 0 and 1. */ random(): number; - /** + /** * Returns a supplied numeric expression rounded to the nearest number. * @param x The value to be rounded to the nearest number. */ @@ -685,24 +685,24 @@ interface Date { getUTCMilliseconds(): number; /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ getTimezoneOffset(): number; - /** + /** * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. */ setTime(time: number): number; /** - * Sets the milliseconds value in the Date object using local time. + * Sets the milliseconds value in the Date object using local time. * @param ms A numeric value equal to the millisecond value. */ setMilliseconds(ms: number): number; - /** + /** * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. + * @param ms A numeric value equal to the millisecond value. */ setUTCMilliseconds(ms: number): number; /** - * Sets the seconds value in the Date object using local time. + * Sets the seconds value in the Date object using local time. * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ @@ -714,16 +714,16 @@ interface Date { */ setUTCSeconds(sec: number, ms?: number): number; /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setMinutes(min: number, sec?: number, ms?: number): number; /** * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCMinutes(min: number, sec?: number, ms?: number): number; @@ -731,7 +731,7 @@ interface Date { * Sets the hour value in the Date object using local time. * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setHours(hours: number, min?: number, sec?: number, ms?: number): number; @@ -739,23 +739,23 @@ interface Date { * Sets the hours value in the Date object using Universal Coordinated Time (UTC). * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; /** - * Sets the numeric day-of-the-month value of the Date object using local time. + * Sets the numeric day-of-the-month value of the Date object using local time. * @param date A numeric value equal to the day of the month. */ setDate(date: number): number; - /** + /** * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. + * @param date A numeric value equal to the day of the month. */ setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. */ setMonth(month: number, date?: number): number; @@ -800,7 +800,7 @@ interface DateConstructor { */ parse(s: string): number; /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. * @param month The month as an number between 0 and 11 (January to December). * @param date The date as an number between 1 and 31. @@ -826,13 +826,13 @@ interface RegExpExecArray extends Array { } interface RegExp { - /** + /** * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. * @param string The String object or string literal on which to perform the search. */ exec(string: string): RegExpExecArray; - /** + /** * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. * @param string String on which to perform the search. */ @@ -959,8 +959,8 @@ interface JSON { /** * Converts a JavaScript Object Notation (JSON) string into an object. * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. */ parse(text: string, reviver?: (key: any, value: any) => any): any; /** @@ -1040,14 +1040,14 @@ interface Array { */ join(separator?: string): string; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): T[]; /** * Removes the first element from an array and returns it. */ shift(): T; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1110,21 +1110,21 @@ interface Array { /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; /** * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; @@ -1142,15 +1142,15 @@ interface Array { */ reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; @@ -1205,10 +1205,10 @@ interface ArrayLike { /** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. */ interface ArrayBuffer { /** @@ -1231,7 +1231,7 @@ declare var ArrayBuffer: ArrayBufferConstructor; interface ArrayBufferView { /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1251,124 +1251,124 @@ interface DataView { byteLength: number; byteOffset: number; /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat32(byteOffset: number, littleEndian?: boolean): number; /** * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat64(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt8(byteOffset: number): number; /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt32(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint8(byteOffset: number): number; /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint32(byteOffset: number, littleEndian?: boolean): number; /** - * Stores an Float32 value at the specified byte offset from the start of the view. + * Stores an Float32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Float64 value at the specified byte offset from the start of the view. + * Stores an Float64 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int8 value at the specified byte offset from the start of the view. + * Stores an Int8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setInt8(byteOffset: number, value: number): void; /** - * Stores an Int16 value at the specified byte offset from the start of the view. + * Stores an Int16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int32 value at the specified byte offset from the start of the view. + * Stores an Int32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint8 value at the specified byte offset from the start of the view. + * Stores an Uint8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setUint8(byteOffset: number, value: number): void; /** - * Stores an Uint16 value at the specified byte offset from the start of the view. + * Stores an Uint16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint32 value at the specified byte offset from the start of the view. + * Stores an Uint32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; @@ -1380,17 +1380,17 @@ interface DataViewConstructor { declare var DataView: DataViewConstructor; /** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Int8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1404,21 +1404,21 @@ interface Int8Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Int8Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1428,49 +1428,49 @@ interface Int8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Int8Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; @@ -1485,7 +1485,7 @@ interface Int8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1493,7 +1493,7 @@ interface Int8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1504,65 +1504,65 @@ interface Int8Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int8Array; @@ -1580,7 +1580,7 @@ interface Int8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1589,31 +1589,31 @@ interface Int8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Int8Array; /** * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1631,7 +1631,7 @@ interface Int8ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -1640,7 +1640,7 @@ interface Int8ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1653,17 +1653,17 @@ interface Int8ArrayConstructor { declare var Int8Array: Int8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1677,21 +1677,21 @@ interface Uint8Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint8Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1701,49 +1701,49 @@ interface Uint8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint8Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; @@ -1758,7 +1758,7 @@ interface Uint8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1766,7 +1766,7 @@ interface Uint8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1777,65 +1777,65 @@ interface Uint8Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8Array; @@ -1853,7 +1853,7 @@ interface Uint8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1862,31 +1862,31 @@ interface Uint8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint8Array; /** * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1905,7 +1905,7 @@ interface Uint8ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -1914,7 +1914,7 @@ interface Uint8ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1927,17 +1927,17 @@ interface Uint8ArrayConstructor { declare var Uint8Array: Uint8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. * If the requested number of bytes could not be allocated an exception is raised. */ interface Uint8ClampedArray { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1951,21 +1951,21 @@ interface Uint8ClampedArray { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1975,49 +1975,49 @@ interface Uint8ClampedArray { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint8ClampedArray; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; @@ -2032,7 +2032,7 @@ interface Uint8ClampedArray { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2040,7 +2040,7 @@ interface Uint8ClampedArray { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2051,65 +2051,65 @@ interface Uint8ClampedArray { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8ClampedArray; @@ -2127,7 +2127,7 @@ interface Uint8ClampedArray { */ set(array: Uint8ClampedArray, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2136,31 +2136,31 @@ interface Uint8ClampedArray { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; /** * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8ClampedArray; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2179,7 +2179,7 @@ interface Uint8ClampedArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -2200,17 +2200,17 @@ interface Uint8ClampedArrayConstructor { declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -2224,21 +2224,21 @@ interface Int16Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Int16Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2248,49 +2248,49 @@ interface Int16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Int16Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; @@ -2305,7 +2305,7 @@ interface Int16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2313,7 +2313,7 @@ interface Int16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2324,65 +2324,65 @@ interface Int16Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int16Array; @@ -2400,7 +2400,7 @@ interface Int16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2409,31 +2409,31 @@ interface Int16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Int16Array; /** * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2452,7 +2452,7 @@ interface Int16ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -2461,7 +2461,7 @@ interface Int16ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2474,17 +2474,17 @@ interface Int16ArrayConstructor { declare var Int16Array: Int16ArrayConstructor; /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -2498,21 +2498,21 @@ interface Uint16Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint16Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2522,49 +2522,49 @@ interface Uint16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint16Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; @@ -2579,7 +2579,7 @@ interface Uint16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2587,7 +2587,7 @@ interface Uint16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2598,65 +2598,65 @@ interface Uint16Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint16Array; @@ -2674,7 +2674,7 @@ interface Uint16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2683,31 +2683,31 @@ interface Uint16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint16Array; /** * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2726,7 +2726,7 @@ interface Uint16ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -2735,7 +2735,7 @@ interface Uint16ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2747,17 +2747,17 @@ interface Uint16ArrayConstructor { } declare var Uint16Array: Uint16ArrayConstructor; /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -2771,21 +2771,21 @@ interface Int32Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Int32Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2795,49 +2795,49 @@ interface Int32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Int32Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; @@ -2852,7 +2852,7 @@ interface Int32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2860,7 +2860,7 @@ interface Int32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2871,65 +2871,65 @@ interface Int32Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int32Array; @@ -2947,7 +2947,7 @@ interface Int32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2956,31 +2956,31 @@ interface Int32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Int32Array; /** * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2999,7 +2999,7 @@ interface Int32ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3008,7 +3008,7 @@ interface Int32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3020,17 +3020,17 @@ interface Int32ArrayConstructor { declare var Int32Array: Int32ArrayConstructor; /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -3044,21 +3044,21 @@ interface Uint32Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint32Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3068,49 +3068,49 @@ interface Uint32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint32Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; @@ -3125,7 +3125,7 @@ interface Uint32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3133,7 +3133,7 @@ interface Uint32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3144,65 +3144,65 @@ interface Uint32Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint32Array; @@ -3220,7 +3220,7 @@ interface Uint32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3229,31 +3229,31 @@ interface Uint32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint32Array; /** * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3272,7 +3272,7 @@ interface Uint32ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3281,7 +3281,7 @@ interface Uint32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3298,12 +3298,12 @@ declare var Uint32Array: Uint32ArrayConstructor; */ interface Float32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -3317,21 +3317,21 @@ interface Float32Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Float32Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3341,49 +3341,49 @@ interface Float32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Float32Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; @@ -3398,7 +3398,7 @@ interface Float32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3406,7 +3406,7 @@ interface Float32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3417,65 +3417,65 @@ interface Float32Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float32Array; @@ -3493,7 +3493,7 @@ interface Float32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3502,31 +3502,31 @@ interface Float32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Float32Array; /** * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3545,7 +3545,7 @@ interface Float32ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3554,7 +3554,7 @@ interface Float32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3567,17 +3567,17 @@ interface Float32ArrayConstructor { declare var Float32Array: Float32ArrayConstructor; /** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Float64Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -3591,21 +3591,21 @@ interface Float64Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Float64Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3615,49 +3615,49 @@ interface Float64Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Float64Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; @@ -3672,7 +3672,7 @@ interface Float64Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3680,7 +3680,7 @@ interface Float64Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3691,65 +3691,65 @@ interface Float64Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float64Array; @@ -3767,7 +3767,7 @@ interface Float64Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3776,31 +3776,31 @@ interface Float64Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Float64Array; /** * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float64Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3819,7 +3819,7 @@ interface Float64ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3828,7 +3828,7 @@ interface Float64ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float64Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3839,7 +3839,7 @@ interface Float64ArrayConstructor { } declare var Float64Array: Float64ArrayConstructor; ///////////////////////////// -/// ECMAScript Internationalization API +/// ECMAScript Internationalization API ///////////////////////////// declare module Intl { @@ -3881,7 +3881,7 @@ declare module Intl { currency?: string; currencyDisplay?: string; useGrouping?: boolean; - minimumintegerDigits?: number; + minimumIntegerDigits?: number; minimumFractionDigits?: number; maximumFractionDigits?: number; minimumSignificantDigits?: number; @@ -3894,7 +3894,7 @@ declare module Intl { style: string; currency?: string; currencyDisplay?: string; - minimumintegerDigits: number; + minimumIntegerDigits: number; minimumFractionDigits: number; maximumFractionDigits: number; minimumSignificantDigits?: number; @@ -3982,14 +3982,14 @@ interface String { interface Number { /** - * Converts a number to a string by using the current or specified locale. + * Converts a number to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; /** - * Converts a number to a string by using the current or specified locale. + * Converts a number to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ @@ -3998,41 +3998,41 @@ interface Number { interface Date { /** - * Converts a date and time to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; /** - * Converts a date to a string by using the current or specified locale. + * Converts a date to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; /** - * Converts a time to a string by using the current or specified locale. + * Converts a time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - + /** - * Converts a date and time to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - + /** - * Converts a date to a string by using the current or specified locale. + * Converts a date to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; /** - * Converts a time to a string by using the current or specified locale. + * Converts a time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ @@ -4243,8 +4243,8 @@ interface AnalyserNode extends AudioNode { smoothingTimeConstant: number; getByteFrequencyData(array: Uint8Array): void; getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: any): void; - getFloatTimeDomainData(array: any): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; } declare var AnalyserNode: { @@ -4331,7 +4331,7 @@ interface AudioBuffer { length: number; numberOfChannels: number; sampleRate: number; - getChannelData(channel: number): any; + getChannelData(channel: number): Float32Array; } declare var AudioBuffer: { @@ -4375,7 +4375,7 @@ interface AudioContext extends EventTarget { createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; - createPeriodicWave(real: any, imag: any): PeriodicWave; + createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; @@ -4433,7 +4433,7 @@ interface AudioParam { linearRampToValueAtTime(value: number, endTime: number): void; setTargetAtTime(target: number, startTime: number, timeConstant: number): void; setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: any, startTime: number, duration: number): void; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; } declare var AudioParam: { @@ -4509,7 +4509,7 @@ interface BiquadFilterNode extends AudioNode { frequency: AudioParam; gain: AudioParam; type: string; - getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } declare var BiquadFilterNode: { @@ -5108,7 +5108,7 @@ declare var CanvasPattern: { interface CanvasRenderingContext2D { canvas: HTMLCanvasElement; - fillStyle: any; + fillStyle: string | CanvasGradient | CanvasPattern; font: string; globalAlpha: number; globalCompositeOperation: string; @@ -5123,7 +5123,7 @@ interface CanvasRenderingContext2D { shadowColor: string; shadowOffsetX: number; shadowOffsetY: number; - strokeStyle: any; + strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: string; textBaseline: string; arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; @@ -5636,7 +5636,7 @@ declare var DeviceRotationRate: { interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent { /** - * Sets or gets the URL for the current document. + * Sets or gets the URL for the current document. */ URL: string; /** @@ -5664,7 +5664,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ applets: HTMLCollection; /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. */ bgColor: string; /** @@ -5691,19 +5691,19 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ designMode: string; /** - * Sets or retrieves a value that indicates the reading order of the object. + * Sets or retrieves a value that indicates the reading order of the object. */ dir: string; /** - * Gets an object representing the document type declaration associated with the current document. + * Gets an object representing the document type declaration associated with the current document. */ doctype: DocumentType; /** - * Gets a reference to the root node of the document. + * Gets a reference to the root node of the document. */ documentElement: HTMLElement; /** - * Sets or gets the security domain of the document. + * Sets or gets the security domain of the document. */ domain: string; /** @@ -5727,7 +5727,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ images: HTMLCollection; /** - * Gets the implementation object of the current document. + * Gets the implementation object of the current document. */ implementation: DOMImplementation; /** @@ -5735,11 +5735,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ inputEncoding: string; /** - * Gets the date that the page was last modified, if the page supplies one. + * Gets the date that the page was last modified, if the page supplies one. */ lastModified: string; /** - * Sets or gets the color of the document links. + * Sets or gets the color of the document links. */ linkColor: string; /** @@ -5747,7 +5747,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ links: HTMLCollection; /** - * Contains information about the current URL. + * Contains information about the current URL. */ location: Location; media: string; @@ -5775,19 +5775,19 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param ev The event. */ onbeforedeactivate: (ev: UIEvent) => any; - /** - * Fires when the object loses the input focus. + /** + * Fires when the object loses the input focus. * @param ev The focus event. */ onblur: (ev: FocusEvent) => any; /** - * Occurs when playback is possible, but would require further buffering. + * Occurs when playback is possible, but would require further buffering. * @param ev The event. */ oncanplay: (ev: Event) => any; oncanplaythrough: (ev: Event) => any; /** - * Fires when the contents of the object or selection have changed. + * Fires when the contents of the object or selection have changed. * @param ev The event. */ onchange: (ev: Event) => any; @@ -5797,7 +5797,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onclick: (ev: MouseEvent) => any; /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * Fires when the user clicks the right mouse button in the client area, opening the context menu. * @param ev The mouse event. */ oncontextmenu: (ev: PointerEvent) => any; @@ -5821,12 +5821,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param ev The event. */ ondragend: (ev: DragEvent) => any; - /** + /** * Fires on the target element when the user drags the object to a valid drop target. * @param ev The drag event. */ ondragenter: (ev: DragEvent) => any; - /** + /** * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. * @param ev The drag event. */ @@ -5837,23 +5837,23 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ ondragover: (ev: DragEvent) => any; /** - * Fires on the source object when the user starts to drag a text selection or selected object. + * Fires on the source object when the user starts to drag a text selection or selected object. * @param ev The event. */ ondragstart: (ev: DragEvent) => any; ondrop: (ev: DragEvent) => any; /** - * Occurs when the duration attribute is updated. + * Occurs when the duration attribute is updated. * @param ev The event. */ ondurationchange: (ev: Event) => any; /** - * Occurs when the media element is reset to its initial state. + * Occurs when the media element is reset to its initial state. * @param ev The event. */ onemptied: (ev: Event) => any; /** - * Occurs when the end of playback is reached. + * Occurs when the end of playback is reached. * @param ev The event */ onended: (ev: Event) => any; @@ -5863,7 +5863,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onerror: (ev: Event) => any; /** - * Fires when the object receives focus. + * Fires when the object receives focus. * @param ev The event. */ onfocus: (ev: FocusEvent) => any; @@ -5886,12 +5886,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onkeyup: (ev: KeyboardEvent) => any; /** - * Fires immediately after the browser loads the object. + * Fires immediately after the browser loads the object. * @param ev The event. */ onload: (ev: Event) => any; /** - * Occurs when media data is loaded at the current playback position. + * Occurs when media data is loaded at the current playback position. * @param ev The event. */ onloadeddata: (ev: Event) => any; @@ -5901,22 +5901,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onloadedmetadata: (ev: Event) => any; /** - * Occurs when Internet Explorer begins looking for media data. + * Occurs when Internet Explorer begins looking for media data. * @param ev The event. */ onloadstart: (ev: Event) => any; /** - * Fires when the user clicks the object with either mouse button. + * Fires when the user clicks the object with either mouse button. * @param ev The mouse event. */ onmousedown: (ev: MouseEvent) => any; /** - * Fires when the user moves the mouse over the object. + * Fires when the user moves the mouse over the object. * @param ev The mouse event. */ onmousemove: (ev: MouseEvent) => any; /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. + * Fires when the user moves the mouse pointer outside the boundaries of the object. * @param ev The mouse event. */ onmouseout: (ev: MouseEvent) => any; @@ -5926,12 +5926,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onmouseover: (ev: MouseEvent) => any; /** - * Fires when the user releases a mouse button while the mouse is over the object. + * Fires when the user releases a mouse button while the mouse is over the object. * @param ev The mouse event. */ onmouseup: (ev: MouseEvent) => any; /** - * Fires when the wheel button is rotated. + * Fires when the wheel button is rotated. * @param ev The mouse event */ onmousewheel: (ev: MouseWheelEvent) => any; @@ -5953,7 +5953,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onmspointerover: (ev: MSPointerEvent) => any; onmspointerup: (ev: MSPointerEvent) => any; /** - * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. + * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. * @param ev The event. */ onmssitemodejumplistitemremoved: (ev: MSSiteModeEvent) => any; @@ -5968,24 +5968,24 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onpause: (ev: Event) => any; /** - * Occurs when the play method is requested. + * Occurs when the play method is requested. * @param ev The event. */ onplay: (ev: Event) => any; /** - * Occurs when the audio or video has started playing. + * Occurs when the audio or video has started playing. * @param ev The event. */ onplaying: (ev: Event) => any; onpointerlockchange: (ev: Event) => any; onpointerlockerror: (ev: Event) => any; /** - * Occurs to indicate progress while downloading media data. + * Occurs to indicate progress while downloading media data. * @param ev The event. */ onprogress: (ev: ProgressEvent) => any; /** - * Occurs when the playback rate is increased or decreased. + * Occurs when the playback rate is increased or decreased. * @param ev The event. */ onratechange: (ev: Event) => any; @@ -5995,22 +5995,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onreadystatechange: (ev: ProgressEvent) => any; /** - * Fires when the user resets a form. + * Fires when the user resets a form. * @param ev The event. */ onreset: (ev: Event) => any; /** - * Fires when the user repositions the scroll box in the scroll bar on the object. + * Fires when the user repositions the scroll box in the scroll bar on the object. * @param ev The event. */ onscroll: (ev: UIEvent) => any; /** - * Occurs when the seek operation ends. + * Occurs when the seek operation ends. * @param ev The event. */ onseeked: (ev: Event) => any; /** - * Occurs when the current playback position is moved. + * Occurs when the current playback position is moved. * @param ev The event. */ onseeking: (ev: Event) => any; @@ -6021,7 +6021,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onselect: (ev: UIEvent) => any; onselectstart: (ev: Event) => any; /** - * Occurs when the download has stopped. + * Occurs when the download has stopped. * @param ev The event. */ onstalled: (ev: Event) => any; @@ -6032,7 +6032,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onstop: (ev: Event) => any; onsubmit: (ev: Event) => any; /** - * Occurs if the load operation has been intentionally halted. + * Occurs if the load operation has been intentionally halted. * @param ev The event. */ onsuspend: (ev: Event) => any; @@ -6051,7 +6051,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onvolumechange: (ev: Event) => any; /** - * Occurs when playback stops because the next frame of a video resource is not available. + * Occurs when playback stops because the next frame of a video resource is not available. * @param ev The event. */ onwaiting: (ev: Event) => any; @@ -6085,7 +6085,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ title: string; visibilityState: string; - /** + /** * Sets or gets the color of the links that the user has visited. */ vlinkColor: string; @@ -6238,7 +6238,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; createNSResolver(nodeResolver: Node): XPathNSResolver; /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. * @param root The root element or node to start traversing on. * @param whatToShow The type of nodes or elements to appear in the node list * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. @@ -6247,11 +6247,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; createProcessingInstruction(target: string, data: string): ProcessingInstruction; /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. */ createRange(): Range; /** - * Creates a text string from the specified value. + * Creates a text string from the specified value. * @param data String that specifies the nodeValue property of the text node. */ createTextNode(data: string): Text; @@ -6266,7 +6266,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; /** - * Returns the element for the specified x coordinate and the specified y coordinate. + * Returns the element for the specified x coordinate and the specified y coordinate. * @param x The x-offset * @param y The y-offset */ @@ -6491,8 +6491,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven importNode(importedNode: Node, deep: boolean): Node; msElementsFromPoint(x: number, y: number): NodeList; msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; - msGetPrintDocumentForNamedFlow(flowName: string): Document; - msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void; /** * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. * @param url Specifies a MIME type for the document. @@ -6501,7 +6499,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param replace Specifies whether the existing entry for the document is replaced in the history list. */ open(url?: string, name?: string, features?: string, replace?: boolean): Document; - /** + /** * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. * @param commandId Specifies a command identifier. */ @@ -6523,7 +6521,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven queryCommandSupported(commandId: string): boolean; /** * Retrieves the string associated with a command. - * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. + * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. */ queryCommandText(commandId: string): string; /** @@ -6539,12 +6537,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven webkitCancelFullScreen(): void; webkitExitFullscreen(): void; /** - * Writes one or more HTML expressions to a document in the specified window. + * Writes one or more HTML expressions to a document in the specified window. * @param content Specifies the text and HTML tags to write. */ write(...content: string[]): void; /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. * @param content The text and HTML tags to write. */ writeln(...content: string[]): void; @@ -7252,12 +7250,12 @@ interface HTMLAnchorElement extends HTMLElement { */ target: string; /** - * Retrieves or sets the text of the object as a string. + * Retrieves or sets the text of the object as a string. */ text: string; type: string; urn: string; - /** + /** * Returns a string representation of an object. */ toString(): string; @@ -7358,7 +7356,7 @@ interface HTMLAreaElement extends HTMLElement { */ host: string; /** - * Sets or retrieves the host name part of the location or URL. + * Sets or retrieves the host name part of the location or URL. */ hostname: string; /** @@ -7394,7 +7392,7 @@ interface HTMLAreaElement extends HTMLElement { * Sets or retrieves the window or frame at which to target content. */ target: string; - /** + /** * Returns a string representation of an object. */ toString(): string; @@ -7677,7 +7675,7 @@ interface HTMLButtonElement extends HTMLElement { * Overrides the target attribute on a form element. */ formTarget: string; - /** + /** * Sets or retrieves the name of the object. */ name: string; @@ -7694,7 +7692,7 @@ interface HTMLButtonElement extends HTMLElement { * Returns a ValidityState object that represents the validity states of an element. */ validity: ValidityState; - /** + /** * Sets or retrieves the default or selected value of the control. */ value: string; @@ -7828,7 +7826,7 @@ declare var HTMLDirectoryElement: { interface HTMLDivElement extends HTMLElement { /** - * Sets or retrieves how the object is aligned with adjacent text. + * Sets or retrieves how the object is aligned with adjacent text. */ align: string; /** @@ -8974,7 +8972,7 @@ interface HTMLInputElement extends HTMLElement { */ files: FileList; /** - * Retrieves a reference to the form that the object is embedded in. + * Retrieves a reference to the form that the object is embedded in. */ form: HTMLFormElement; /** @@ -9144,7 +9142,7 @@ interface HTMLIsIndexElement extends HTMLElement { */ action: string; /** - * Retrieves a reference to the form that the object is embedded in. + * Retrieves a reference to the form that the object is embedded in. */ form: HTMLFormElement; prompt: string; @@ -9703,7 +9701,7 @@ interface HTMLMetaElement extends HTMLElement { */ scheme: string; /** - * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. + * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. */ url: string; } @@ -9949,7 +9947,7 @@ declare var HTMLOptionElement: { interface HTMLParagraphElement extends HTMLElement { /** - * Sets or retrieves how the object is aligned with adjacent text. + * Sets or retrieves how the object is aligned with adjacent text. */ align: string; clear: string; @@ -10068,10 +10066,10 @@ interface HTMLScriptElement extends HTMLElement { */ defer: boolean; /** - * Sets or retrieves the event for which the script is written. + * Sets or retrieves the event for which the script is written. */ event: string; - /** + /** * Sets or retrieves the object that is bound to the event script. */ htmlFor: string; @@ -10080,7 +10078,7 @@ interface HTMLScriptElement extends HTMLElement { */ src: string; /** - * Retrieves or sets the text of the object as a string. + * Retrieves or sets the text of the object as a string. */ text: string; /** @@ -10101,7 +10099,7 @@ interface HTMLSelectElement extends HTMLElement { autofocus: boolean; disabled: boolean; /** - * Retrieves a reference to the form that the object is embedded in. + * Retrieves a reference to the form that the object is embedded in. */ form: HTMLFormElement; /** @@ -10126,7 +10124,7 @@ interface HTMLSelectElement extends HTMLElement { */ selectedIndex: number; /** - * Sets or retrieves the number of rows in the list box. + * Sets or retrieves the number of rows in the list box. */ size: number; /** @@ -10152,7 +10150,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Adds an element to the areas, controlRange, or options collection. * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. - * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. + * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. */ add(element: HTMLElement, before?: HTMLElement | number): void; /** @@ -10344,7 +10342,7 @@ interface HTMLTableElement extends HTMLElement { */ border: string; /** - * Sets or retrieves the border color of the object. + * Sets or retrieves the border color of the object. */ borderColor: any; /** @@ -10633,7 +10631,7 @@ declare var HTMLTextAreaElement: { interface HTMLTitleElement extends HTMLElement { /** - * Retrieves or sets the text of the object as a string. + * Retrieves or sets the text of the object as a string. */ text: string; } @@ -11063,7 +11061,7 @@ interface ImageDataConstructor { new(array: Uint8ClampedArray, width: number, height: number): ImageData; } -declare var ImageData: ImageDataConstructor; +declare var ImageData: ImageDataConstructor; interface KeyboardEvent extends UIEvent { altKey: boolean; @@ -11314,27 +11312,6 @@ declare var MSHTMLWebViewElement: { new(): MSHTMLWebViewElement; } -interface MSHeaderFooter { - URL: string; - dateLong: string; - dateShort: string; - font: string; - htmlFoot: string; - htmlHead: string; - page: number; - pageTotal: number; - textFoot: string; - textHead: string; - timeLong: string; - timeShort: string; - title: string; -} - -declare var MSHeaderFooter: { - prototype: MSHeaderFooter; - new(): MSHeaderFooter; -} - interface MSInputMethodContext extends EventTarget { compositionEndOffset: number; compositionStartOffset: number; @@ -11493,24 +11470,6 @@ declare var MSPointerEvent: { new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; } -interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget { - percentScale: number; - showHeaderFooter: boolean; - shrinkToFit: boolean; - drawPreviewPage(element: HTMLElement, pageNumber: number): void; - endPrint(): void; - getPrintTaskOptionValue(key: string): any; - invalidatePreview(): void; - setPageCount(pageCount: number): void; - startPrint(): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSPrintManagerTemplatePrinter: { - prototype: MSPrintManagerTemplatePrinter; - new(): MSPrintManagerTemplatePrinter; -} - interface MSRangeCollection { length: number; item(index: number): Range; @@ -11558,63 +11517,6 @@ declare var MSStreamReader: { new(): MSStreamReader; } -interface MSTemplatePrinter { - collate: boolean; - copies: number; - currentPage: boolean; - currentPageAvail: boolean; - duplex: boolean; - footer: string; - frameActive: boolean; - frameActiveEnabled: boolean; - frameAsShown: boolean; - framesetDocument: boolean; - header: string; - headerFooterFont: string; - marginBottom: number; - marginLeft: number; - marginRight: number; - marginTop: number; - orientation: string; - pageFrom: number; - pageHeight: number; - pageTo: number; - pageWidth: number; - selectedPages: boolean; - selection: boolean; - selectionEnabled: boolean; - unprintableBottom: number; - unprintableLeft: number; - unprintableRight: number; - unprintableTop: number; - usePrinterCopyCollate: boolean; - createHeaderFooter(): MSHeaderFooter; - deviceSupports(property: string): any; - ensurePrintDialogDefaults(): boolean; - getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginBottomImportant(pageRule: CSSPageRule): boolean; - getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginLeftImportant(pageRule: CSSPageRule): boolean; - getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginRightImportant(pageRule: CSSPageRule): boolean; - getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginTopImportant(pageRule: CSSPageRule): boolean; - printBlankPage(): void; - printNonNative(document: any): boolean; - printNonNativeFrames(document: any, activeFrame: boolean): void; - printPage(element: HTMLElement): void; - showPageSetupDialog(): boolean; - showPrintDialog(): boolean; - startDoc(title: string): boolean; - stopDoc(): void; - updatePageStatus(status: number): void; -} - -declare var MSTemplatePrinter: { - prototype: MSTemplatePrinter; - new(): MSTemplatePrinter; -} - interface MSWebViewAsyncOperation extends EventTarget { error: DOMError; oncomplete: (ev: Event) => any; @@ -12032,6 +11934,10 @@ declare var Node: { } interface NodeFilter { + acceptNode(n: Node): number; +} + +declare var NodeFilter: { FILTER_ACCEPT: number; FILTER_REJECT: number; FILTER_SKIP: number; @@ -12049,7 +11955,6 @@ interface NodeFilter { SHOW_PROCESSING_INSTRUCTION: number; SHOW_TEXT: number; } -declare var NodeFilter: NodeFilter; interface NodeIterator { expandEntityReferences: boolean; @@ -12759,7 +12664,6 @@ declare var SVGDescElement: { interface SVGElement extends Element { id: string; - className: any; onclick: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusin: (ev: FocusEvent) => any; @@ -12773,6 +12677,7 @@ interface SVGElement extends Element { ownerSVGElement: SVGSVGElement; viewportElement: SVGElement; xmlbase: string; + className: any; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -14934,7 +14839,7 @@ declare var WEBGL_depth_texture: { } interface WaveShaperNode extends AudioNode { - curve: any; + curve: Float32Array; oversample: string; } @@ -15121,34 +15026,34 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: any): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; uniform1i(location: WebGLUniformLocation, x: number): void; uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: any): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; uniform2i(location: WebGLUniformLocation, x: number, y: number): void; uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: any): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: any): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; useProgram(program: WebGLProgram): void; validateProgram(program: WebGLProgram): void; vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: any): void; + vertexAttrib1fv(indx: number, values: Float32Array): void; vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: any): void; + vertexAttrib2fv(indx: number, values: Float32Array): void; vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: any): void; + vertexAttrib3fv(indx: number, values: Float32Array): void; vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: any): void; + vertexAttrib4fv(indx: number, values: Float32Array): void; vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; ACTIVE_ATTRIBUTES: number; @@ -15912,7 +15817,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window locationbar: BarProp; menubar: BarProp; msAnimationStartTime: number; - msTemplatePrinter: MSTemplatePrinter; name: string; navigator: Navigator; offscreenBuffering: string | boolean; @@ -16649,7 +16553,6 @@ interface XMLHttpRequestEventTarget { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } - interface NodeListOf extends NodeList { length: number; item(index: number): TNode; @@ -16670,8 +16573,6 @@ interface EventListenerObject { handleEvent(evt: Event): void; } -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - interface MessageEventInit extends EventInit { data?: any; origin?: string; @@ -16687,6 +16588,8 @@ interface ProgressEventInit extends EventInit { total?: number; } +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + interface ErrorEventHandler { (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; } @@ -16747,7 +16650,6 @@ declare var location: Location; declare var locationbar: BarProp; declare var menubar: BarProp; declare var msAnimationStartTime: number; -declare var msTemplatePrinter: MSTemplatePrinter; declare var name: string; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; @@ -17018,9 +16920,9 @@ declare function addEventListener(type: "waiting", listener: (ev: Event) => any, declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; ///////////////////////////// -/// WorkerGlobalScope APIs +/// WorkerGlobalScope APIs ///////////////////////////// -// These are only available in a Web Worker +// These are only available in a Web Worker declare function importScripts(...urls: string[]): void; @@ -17053,7 +16955,7 @@ interface TextStreamBase { /** * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If + * It is not necessary to close standard streams; they close automatically when the process ends. If * you close a standard stream, be aware that any other pointers to that standard stream become invalid. */ Close(): void; diff --git a/extensions/typescript/server/typescript/lib/lib.dom.d.ts b/extensions/typescript/server/typescript/lib/lib.dom.d.ts index 8c5136020d2..1a224c2e558 100644 --- a/extensions/typescript/server/typescript/lib/lib.dom.d.ts +++ b/extensions/typescript/server/typescript/lib/lib.dom.d.ts @@ -1,21 +1,21 @@ /*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. +Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - +License at http://www.apache.org/licenses/LICENSE-2.0 + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /// ///////////////////////////// -/// ECMAScript Internationalization API +/// ECMAScript Internationalization API ///////////////////////////// declare module Intl { @@ -57,7 +57,7 @@ declare module Intl { currency?: string; currencyDisplay?: string; useGrouping?: boolean; - minimumintegerDigits?: number; + minimumIntegerDigits?: number; minimumFractionDigits?: number; maximumFractionDigits?: number; minimumSignificantDigits?: number; @@ -70,7 +70,7 @@ declare module Intl { style: string; currency?: string; currencyDisplay?: string; - minimumintegerDigits: number; + minimumIntegerDigits: number; minimumFractionDigits: number; maximumFractionDigits: number; minimumSignificantDigits?: number; @@ -158,14 +158,14 @@ interface String { interface Number { /** - * Converts a number to a string by using the current or specified locale. + * Converts a number to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; /** - * Converts a number to a string by using the current or specified locale. + * Converts a number to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ @@ -174,41 +174,41 @@ interface Number { interface Date { /** - * Converts a date and time to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; /** - * Converts a date to a string by using the current or specified locale. + * Converts a date to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; /** - * Converts a time to a string by using the current or specified locale. + * Converts a time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - + /** - * Converts a date and time to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - + /** - * Converts a date to a string by using the current or specified locale. + * Converts a date to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; /** - * Converts a time to a string by using the current or specified locale. + * Converts a time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ @@ -419,8 +419,8 @@ interface AnalyserNode extends AudioNode { smoothingTimeConstant: number; getByteFrequencyData(array: Uint8Array): void; getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: any): void; - getFloatTimeDomainData(array: any): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; } declare var AnalyserNode: { @@ -507,7 +507,7 @@ interface AudioBuffer { length: number; numberOfChannels: number; sampleRate: number; - getChannelData(channel: number): any; + getChannelData(channel: number): Float32Array; } declare var AudioBuffer: { @@ -551,7 +551,7 @@ interface AudioContext extends EventTarget { createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; - createPeriodicWave(real: any, imag: any): PeriodicWave; + createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; @@ -609,7 +609,7 @@ interface AudioParam { linearRampToValueAtTime(value: number, endTime: number): void; setTargetAtTime(target: number, startTime: number, timeConstant: number): void; setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: any, startTime: number, duration: number): void; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; } declare var AudioParam: { @@ -685,7 +685,7 @@ interface BiquadFilterNode extends AudioNode { frequency: AudioParam; gain: AudioParam; type: string; - getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } declare var BiquadFilterNode: { @@ -1284,7 +1284,7 @@ declare var CanvasPattern: { interface CanvasRenderingContext2D { canvas: HTMLCanvasElement; - fillStyle: any; + fillStyle: string | CanvasGradient | CanvasPattern; font: string; globalAlpha: number; globalCompositeOperation: string; @@ -1299,7 +1299,7 @@ interface CanvasRenderingContext2D { shadowColor: string; shadowOffsetX: number; shadowOffsetY: number; - strokeStyle: any; + strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: string; textBaseline: string; arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; @@ -1812,7 +1812,7 @@ declare var DeviceRotationRate: { interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent { /** - * Sets or gets the URL for the current document. + * Sets or gets the URL for the current document. */ URL: string; /** @@ -1840,7 +1840,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ applets: HTMLCollection; /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. */ bgColor: string; /** @@ -1867,19 +1867,19 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ designMode: string; /** - * Sets or retrieves a value that indicates the reading order of the object. + * Sets or retrieves a value that indicates the reading order of the object. */ dir: string; /** - * Gets an object representing the document type declaration associated with the current document. + * Gets an object representing the document type declaration associated with the current document. */ doctype: DocumentType; /** - * Gets a reference to the root node of the document. + * Gets a reference to the root node of the document. */ documentElement: HTMLElement; /** - * Sets or gets the security domain of the document. + * Sets or gets the security domain of the document. */ domain: string; /** @@ -1903,7 +1903,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ images: HTMLCollection; /** - * Gets the implementation object of the current document. + * Gets the implementation object of the current document. */ implementation: DOMImplementation; /** @@ -1911,11 +1911,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ inputEncoding: string; /** - * Gets the date that the page was last modified, if the page supplies one. + * Gets the date that the page was last modified, if the page supplies one. */ lastModified: string; /** - * Sets or gets the color of the document links. + * Sets or gets the color of the document links. */ linkColor: string; /** @@ -1923,7 +1923,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ links: HTMLCollection; /** - * Contains information about the current URL. + * Contains information about the current URL. */ location: Location; media: string; @@ -1951,19 +1951,19 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param ev The event. */ onbeforedeactivate: (ev: UIEvent) => any; - /** - * Fires when the object loses the input focus. + /** + * Fires when the object loses the input focus. * @param ev The focus event. */ onblur: (ev: FocusEvent) => any; /** - * Occurs when playback is possible, but would require further buffering. + * Occurs when playback is possible, but would require further buffering. * @param ev The event. */ oncanplay: (ev: Event) => any; oncanplaythrough: (ev: Event) => any; /** - * Fires when the contents of the object or selection have changed. + * Fires when the contents of the object or selection have changed. * @param ev The event. */ onchange: (ev: Event) => any; @@ -1973,7 +1973,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onclick: (ev: MouseEvent) => any; /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * Fires when the user clicks the right mouse button in the client area, opening the context menu. * @param ev The mouse event. */ oncontextmenu: (ev: PointerEvent) => any; @@ -1997,12 +1997,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param ev The event. */ ondragend: (ev: DragEvent) => any; - /** + /** * Fires on the target element when the user drags the object to a valid drop target. * @param ev The drag event. */ ondragenter: (ev: DragEvent) => any; - /** + /** * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. * @param ev The drag event. */ @@ -2013,23 +2013,23 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ ondragover: (ev: DragEvent) => any; /** - * Fires on the source object when the user starts to drag a text selection or selected object. + * Fires on the source object when the user starts to drag a text selection or selected object. * @param ev The event. */ ondragstart: (ev: DragEvent) => any; ondrop: (ev: DragEvent) => any; /** - * Occurs when the duration attribute is updated. + * Occurs when the duration attribute is updated. * @param ev The event. */ ondurationchange: (ev: Event) => any; /** - * Occurs when the media element is reset to its initial state. + * Occurs when the media element is reset to its initial state. * @param ev The event. */ onemptied: (ev: Event) => any; /** - * Occurs when the end of playback is reached. + * Occurs when the end of playback is reached. * @param ev The event */ onended: (ev: Event) => any; @@ -2039,7 +2039,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onerror: (ev: Event) => any; /** - * Fires when the object receives focus. + * Fires when the object receives focus. * @param ev The event. */ onfocus: (ev: FocusEvent) => any; @@ -2062,12 +2062,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onkeyup: (ev: KeyboardEvent) => any; /** - * Fires immediately after the browser loads the object. + * Fires immediately after the browser loads the object. * @param ev The event. */ onload: (ev: Event) => any; /** - * Occurs when media data is loaded at the current playback position. + * Occurs when media data is loaded at the current playback position. * @param ev The event. */ onloadeddata: (ev: Event) => any; @@ -2077,22 +2077,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onloadedmetadata: (ev: Event) => any; /** - * Occurs when Internet Explorer begins looking for media data. + * Occurs when Internet Explorer begins looking for media data. * @param ev The event. */ onloadstart: (ev: Event) => any; /** - * Fires when the user clicks the object with either mouse button. + * Fires when the user clicks the object with either mouse button. * @param ev The mouse event. */ onmousedown: (ev: MouseEvent) => any; /** - * Fires when the user moves the mouse over the object. + * Fires when the user moves the mouse over the object. * @param ev The mouse event. */ onmousemove: (ev: MouseEvent) => any; /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. + * Fires when the user moves the mouse pointer outside the boundaries of the object. * @param ev The mouse event. */ onmouseout: (ev: MouseEvent) => any; @@ -2102,12 +2102,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onmouseover: (ev: MouseEvent) => any; /** - * Fires when the user releases a mouse button while the mouse is over the object. + * Fires when the user releases a mouse button while the mouse is over the object. * @param ev The mouse event. */ onmouseup: (ev: MouseEvent) => any; /** - * Fires when the wheel button is rotated. + * Fires when the wheel button is rotated. * @param ev The mouse event */ onmousewheel: (ev: MouseWheelEvent) => any; @@ -2129,7 +2129,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onmspointerover: (ev: MSPointerEvent) => any; onmspointerup: (ev: MSPointerEvent) => any; /** - * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. + * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. * @param ev The event. */ onmssitemodejumplistitemremoved: (ev: MSSiteModeEvent) => any; @@ -2144,24 +2144,24 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onpause: (ev: Event) => any; /** - * Occurs when the play method is requested. + * Occurs when the play method is requested. * @param ev The event. */ onplay: (ev: Event) => any; /** - * Occurs when the audio or video has started playing. + * Occurs when the audio or video has started playing. * @param ev The event. */ onplaying: (ev: Event) => any; onpointerlockchange: (ev: Event) => any; onpointerlockerror: (ev: Event) => any; /** - * Occurs to indicate progress while downloading media data. + * Occurs to indicate progress while downloading media data. * @param ev The event. */ onprogress: (ev: ProgressEvent) => any; /** - * Occurs when the playback rate is increased or decreased. + * Occurs when the playback rate is increased or decreased. * @param ev The event. */ onratechange: (ev: Event) => any; @@ -2171,22 +2171,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onreadystatechange: (ev: ProgressEvent) => any; /** - * Fires when the user resets a form. + * Fires when the user resets a form. * @param ev The event. */ onreset: (ev: Event) => any; /** - * Fires when the user repositions the scroll box in the scroll bar on the object. + * Fires when the user repositions the scroll box in the scroll bar on the object. * @param ev The event. */ onscroll: (ev: UIEvent) => any; /** - * Occurs when the seek operation ends. + * Occurs when the seek operation ends. * @param ev The event. */ onseeked: (ev: Event) => any; /** - * Occurs when the current playback position is moved. + * Occurs when the current playback position is moved. * @param ev The event. */ onseeking: (ev: Event) => any; @@ -2197,7 +2197,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onselect: (ev: UIEvent) => any; onselectstart: (ev: Event) => any; /** - * Occurs when the download has stopped. + * Occurs when the download has stopped. * @param ev The event. */ onstalled: (ev: Event) => any; @@ -2208,7 +2208,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onstop: (ev: Event) => any; onsubmit: (ev: Event) => any; /** - * Occurs if the load operation has been intentionally halted. + * Occurs if the load operation has been intentionally halted. * @param ev The event. */ onsuspend: (ev: Event) => any; @@ -2227,7 +2227,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onvolumechange: (ev: Event) => any; /** - * Occurs when playback stops because the next frame of a video resource is not available. + * Occurs when playback stops because the next frame of a video resource is not available. * @param ev The event. */ onwaiting: (ev: Event) => any; @@ -2261,7 +2261,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ title: string; visibilityState: string; - /** + /** * Sets or gets the color of the links that the user has visited. */ vlinkColor: string; @@ -2414,7 +2414,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; createNSResolver(nodeResolver: Node): XPathNSResolver; /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. * @param root The root element or node to start traversing on. * @param whatToShow The type of nodes or elements to appear in the node list * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. @@ -2423,11 +2423,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; createProcessingInstruction(target: string, data: string): ProcessingInstruction; /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. */ createRange(): Range; /** - * Creates a text string from the specified value. + * Creates a text string from the specified value. * @param data String that specifies the nodeValue property of the text node. */ createTextNode(data: string): Text; @@ -2442,7 +2442,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; /** - * Returns the element for the specified x coordinate and the specified y coordinate. + * Returns the element for the specified x coordinate and the specified y coordinate. * @param x The x-offset * @param y The y-offset */ @@ -2667,8 +2667,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven importNode(importedNode: Node, deep: boolean): Node; msElementsFromPoint(x: number, y: number): NodeList; msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; - msGetPrintDocumentForNamedFlow(flowName: string): Document; - msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void; /** * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. * @param url Specifies a MIME type for the document. @@ -2677,7 +2675,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param replace Specifies whether the existing entry for the document is replaced in the history list. */ open(url?: string, name?: string, features?: string, replace?: boolean): Document; - /** + /** * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. * @param commandId Specifies a command identifier. */ @@ -2699,7 +2697,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven queryCommandSupported(commandId: string): boolean; /** * Retrieves the string associated with a command. - * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. + * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. */ queryCommandText(commandId: string): string; /** @@ -2715,12 +2713,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven webkitCancelFullScreen(): void; webkitExitFullscreen(): void; /** - * Writes one or more HTML expressions to a document in the specified window. + * Writes one or more HTML expressions to a document in the specified window. * @param content Specifies the text and HTML tags to write. */ write(...content: string[]): void; /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. * @param content The text and HTML tags to write. */ writeln(...content: string[]): void; @@ -3428,12 +3426,12 @@ interface HTMLAnchorElement extends HTMLElement { */ target: string; /** - * Retrieves or sets the text of the object as a string. + * Retrieves or sets the text of the object as a string. */ text: string; type: string; urn: string; - /** + /** * Returns a string representation of an object. */ toString(): string; @@ -3534,7 +3532,7 @@ interface HTMLAreaElement extends HTMLElement { */ host: string; /** - * Sets or retrieves the host name part of the location or URL. + * Sets or retrieves the host name part of the location or URL. */ hostname: string; /** @@ -3570,7 +3568,7 @@ interface HTMLAreaElement extends HTMLElement { * Sets or retrieves the window or frame at which to target content. */ target: string; - /** + /** * Returns a string representation of an object. */ toString(): string; @@ -3853,7 +3851,7 @@ interface HTMLButtonElement extends HTMLElement { * Overrides the target attribute on a form element. */ formTarget: string; - /** + /** * Sets or retrieves the name of the object. */ name: string; @@ -3870,7 +3868,7 @@ interface HTMLButtonElement extends HTMLElement { * Returns a ValidityState object that represents the validity states of an element. */ validity: ValidityState; - /** + /** * Sets or retrieves the default or selected value of the control. */ value: string; @@ -4004,7 +4002,7 @@ declare var HTMLDirectoryElement: { interface HTMLDivElement extends HTMLElement { /** - * Sets or retrieves how the object is aligned with adjacent text. + * Sets or retrieves how the object is aligned with adjacent text. */ align: string; /** @@ -5150,7 +5148,7 @@ interface HTMLInputElement extends HTMLElement { */ files: FileList; /** - * Retrieves a reference to the form that the object is embedded in. + * Retrieves a reference to the form that the object is embedded in. */ form: HTMLFormElement; /** @@ -5320,7 +5318,7 @@ interface HTMLIsIndexElement extends HTMLElement { */ action: string; /** - * Retrieves a reference to the form that the object is embedded in. + * Retrieves a reference to the form that the object is embedded in. */ form: HTMLFormElement; prompt: string; @@ -5879,7 +5877,7 @@ interface HTMLMetaElement extends HTMLElement { */ scheme: string; /** - * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. + * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. */ url: string; } @@ -6125,7 +6123,7 @@ declare var HTMLOptionElement: { interface HTMLParagraphElement extends HTMLElement { /** - * Sets or retrieves how the object is aligned with adjacent text. + * Sets or retrieves how the object is aligned with adjacent text. */ align: string; clear: string; @@ -6244,10 +6242,10 @@ interface HTMLScriptElement extends HTMLElement { */ defer: boolean; /** - * Sets or retrieves the event for which the script is written. + * Sets or retrieves the event for which the script is written. */ event: string; - /** + /** * Sets or retrieves the object that is bound to the event script. */ htmlFor: string; @@ -6256,7 +6254,7 @@ interface HTMLScriptElement extends HTMLElement { */ src: string; /** - * Retrieves or sets the text of the object as a string. + * Retrieves or sets the text of the object as a string. */ text: string; /** @@ -6277,7 +6275,7 @@ interface HTMLSelectElement extends HTMLElement { autofocus: boolean; disabled: boolean; /** - * Retrieves a reference to the form that the object is embedded in. + * Retrieves a reference to the form that the object is embedded in. */ form: HTMLFormElement; /** @@ -6302,7 +6300,7 @@ interface HTMLSelectElement extends HTMLElement { */ selectedIndex: number; /** - * Sets or retrieves the number of rows in the list box. + * Sets or retrieves the number of rows in the list box. */ size: number; /** @@ -6328,7 +6326,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Adds an element to the areas, controlRange, or options collection. * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. - * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. + * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. */ add(element: HTMLElement, before?: HTMLElement | number): void; /** @@ -6520,7 +6518,7 @@ interface HTMLTableElement extends HTMLElement { */ border: string; /** - * Sets or retrieves the border color of the object. + * Sets or retrieves the border color of the object. */ borderColor: any; /** @@ -6809,7 +6807,7 @@ declare var HTMLTextAreaElement: { interface HTMLTitleElement extends HTMLElement { /** - * Retrieves or sets the text of the object as a string. + * Retrieves or sets the text of the object as a string. */ text: string; } @@ -7239,7 +7237,7 @@ interface ImageDataConstructor { new(array: Uint8ClampedArray, width: number, height: number): ImageData; } -declare var ImageData: ImageDataConstructor; +declare var ImageData: ImageDataConstructor; interface KeyboardEvent extends UIEvent { altKey: boolean; @@ -7490,27 +7488,6 @@ declare var MSHTMLWebViewElement: { new(): MSHTMLWebViewElement; } -interface MSHeaderFooter { - URL: string; - dateLong: string; - dateShort: string; - font: string; - htmlFoot: string; - htmlHead: string; - page: number; - pageTotal: number; - textFoot: string; - textHead: string; - timeLong: string; - timeShort: string; - title: string; -} - -declare var MSHeaderFooter: { - prototype: MSHeaderFooter; - new(): MSHeaderFooter; -} - interface MSInputMethodContext extends EventTarget { compositionEndOffset: number; compositionStartOffset: number; @@ -7669,24 +7646,6 @@ declare var MSPointerEvent: { new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; } -interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget { - percentScale: number; - showHeaderFooter: boolean; - shrinkToFit: boolean; - drawPreviewPage(element: HTMLElement, pageNumber: number): void; - endPrint(): void; - getPrintTaskOptionValue(key: string): any; - invalidatePreview(): void; - setPageCount(pageCount: number): void; - startPrint(): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSPrintManagerTemplatePrinter: { - prototype: MSPrintManagerTemplatePrinter; - new(): MSPrintManagerTemplatePrinter; -} - interface MSRangeCollection { length: number; item(index: number): Range; @@ -7734,63 +7693,6 @@ declare var MSStreamReader: { new(): MSStreamReader; } -interface MSTemplatePrinter { - collate: boolean; - copies: number; - currentPage: boolean; - currentPageAvail: boolean; - duplex: boolean; - footer: string; - frameActive: boolean; - frameActiveEnabled: boolean; - frameAsShown: boolean; - framesetDocument: boolean; - header: string; - headerFooterFont: string; - marginBottom: number; - marginLeft: number; - marginRight: number; - marginTop: number; - orientation: string; - pageFrom: number; - pageHeight: number; - pageTo: number; - pageWidth: number; - selectedPages: boolean; - selection: boolean; - selectionEnabled: boolean; - unprintableBottom: number; - unprintableLeft: number; - unprintableRight: number; - unprintableTop: number; - usePrinterCopyCollate: boolean; - createHeaderFooter(): MSHeaderFooter; - deviceSupports(property: string): any; - ensurePrintDialogDefaults(): boolean; - getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginBottomImportant(pageRule: CSSPageRule): boolean; - getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginLeftImportant(pageRule: CSSPageRule): boolean; - getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginRightImportant(pageRule: CSSPageRule): boolean; - getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginTopImportant(pageRule: CSSPageRule): boolean; - printBlankPage(): void; - printNonNative(document: any): boolean; - printNonNativeFrames(document: any, activeFrame: boolean): void; - printPage(element: HTMLElement): void; - showPageSetupDialog(): boolean; - showPrintDialog(): boolean; - startDoc(title: string): boolean; - stopDoc(): void; - updatePageStatus(status: number): void; -} - -declare var MSTemplatePrinter: { - prototype: MSTemplatePrinter; - new(): MSTemplatePrinter; -} - interface MSWebViewAsyncOperation extends EventTarget { error: DOMError; oncomplete: (ev: Event) => any; @@ -8208,6 +8110,10 @@ declare var Node: { } interface NodeFilter { + acceptNode(n: Node): number; +} + +declare var NodeFilter: { FILTER_ACCEPT: number; FILTER_REJECT: number; FILTER_SKIP: number; @@ -8225,7 +8131,6 @@ interface NodeFilter { SHOW_PROCESSING_INSTRUCTION: number; SHOW_TEXT: number; } -declare var NodeFilter: NodeFilter; interface NodeIterator { expandEntityReferences: boolean; @@ -8935,7 +8840,6 @@ declare var SVGDescElement: { interface SVGElement extends Element { id: string; - className: any; onclick: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusin: (ev: FocusEvent) => any; @@ -8949,6 +8853,7 @@ interface SVGElement extends Element { ownerSVGElement: SVGSVGElement; viewportElement: SVGElement; xmlbase: string; + className: any; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -11110,7 +11015,7 @@ declare var WEBGL_depth_texture: { } interface WaveShaperNode extends AudioNode { - curve: any; + curve: Float32Array; oversample: string; } @@ -11297,34 +11202,34 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: any): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; uniform1i(location: WebGLUniformLocation, x: number): void; uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: any): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; uniform2i(location: WebGLUniformLocation, x: number, y: number): void; uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: any): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: any): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; useProgram(program: WebGLProgram): void; validateProgram(program: WebGLProgram): void; vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: any): void; + vertexAttrib1fv(indx: number, values: Float32Array): void; vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: any): void; + vertexAttrib2fv(indx: number, values: Float32Array): void; vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: any): void; + vertexAttrib3fv(indx: number, values: Float32Array): void; vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: any): void; + vertexAttrib4fv(indx: number, values: Float32Array): void; vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; ACTIVE_ATTRIBUTES: number; @@ -12088,7 +11993,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window locationbar: BarProp; menubar: BarProp; msAnimationStartTime: number; - msTemplatePrinter: MSTemplatePrinter; name: string; navigator: Navigator; offscreenBuffering: string | boolean; @@ -12825,7 +12729,6 @@ interface XMLHttpRequestEventTarget { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } - interface NodeListOf extends NodeList { length: number; item(index: number): TNode; @@ -12846,8 +12749,6 @@ interface EventListenerObject { handleEvent(evt: Event): void; } -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - interface MessageEventInit extends EventInit { data?: any; origin?: string; @@ -12863,6 +12764,8 @@ interface ProgressEventInit extends EventInit { total?: number; } +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + interface ErrorEventHandler { (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; } @@ -12923,7 +12826,6 @@ declare var location: Location; declare var locationbar: BarProp; declare var menubar: BarProp; declare var msAnimationStartTime: number; -declare var msTemplatePrinter: MSTemplatePrinter; declare var name: string; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; diff --git a/extensions/typescript/server/typescript/lib/lib.es6.d.ts b/extensions/typescript/server/typescript/lib/lib.es6.d.ts index 02f46136e79..f2595621029 100644 --- a/extensions/typescript/server/typescript/lib/lib.es6.d.ts +++ b/extensions/typescript/server/typescript/lib/lib.es6.d.ts @@ -1,14 +1,14 @@ /*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. +Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - +License at http://www.apache.org/licenses/LICENSE-2.0 + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ @@ -23,7 +23,7 @@ declare var NaN: number; declare var Infinity: number; /** - * Evaluates JavaScript code and executes it. + * Evaluates JavaScript code and executes it. * @param x A String value that contains valid JavaScript code. */ declare function eval(x: string): any; @@ -31,25 +31,25 @@ declare function eval(x: string): any; /** * Converts A string to an integer. * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. * All other strings are considered decimal. */ declare function parseInt(s: string, radix?: number): number; /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. */ declare function parseFloat(string: string): number; /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). * @param number A numeric value. */ declare function isNaN(number: number): boolean; -/** +/** * Determines whether a supplied number is finite. * @param number Any numeric value. */ @@ -67,7 +67,7 @@ declare function decodeURI(encodedURI: string): string; */ declare function decodeURIComponent(encodedURIComponent: string): string; -/** +/** * Encodes a text string as a valid Uniform Resource Identifier (URI) * @param uri A value representing an encoded URI. */ @@ -106,18 +106,18 @@ interface Object { valueOf(): Object; /** - * Determines whether an object has a property with the specified name. + * Determines whether an object has a property with the specified name. * @param v A property name. */ hasOwnProperty(v: string): boolean; /** - * Determines whether an object exists in another object's prototype chain. + * Determines whether an object exists in another object's prototype chain. * @param v Another object whose prototype chain is to be checked. */ isPrototypeOf(v: Object): boolean; - /** + /** * Determines whether a specified property is enumerable. * @param v A property name. */ @@ -132,36 +132,36 @@ interface ObjectConstructor { /** A reference to the prototype for a class of objects. */ prototype: Object; - /** - * Returns the prototype of an object. + /** + * Returns the prototype of an object. * @param o The object that references the prototype. */ getPrototypeOf(o: any): any; /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. * @param o Object that contains the property. * @param p Name of the property. */ getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. * @param o Object that contains the own properties. */ getOwnPropertyNames(o: any): string[]; - /** + /** * Creates an object that has the specified prototype, and that optionally contains specified properties. * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. + * @param properties JavaScript object that contains one or more property descriptors. */ create(o: any, properties?: PropertyDescriptorMap): any; /** - * Adds a property to an object, or modifies attributes of an existing property. + * Adds a property to an object, or modifies attributes of an existing property. * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. * @param p The property name. * @param attributes Descriptor for the property. It can be for a data property or an accessor property. @@ -169,7 +169,7 @@ interface ObjectConstructor { defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * Adds one or more properties to an object, and/or modifies attributes of existing properties. * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. */ @@ -177,7 +177,7 @@ interface ObjectConstructor { /** * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. + * @param o Object on which to lock the attributes. */ seal(o: T): T; @@ -189,25 +189,25 @@ interface ObjectConstructor { /** * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. + * @param o Object to make non-extensible. */ preventExtensions(o: T): T; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isSealed(o: any): boolean; /** * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. + * @param o Object to test. */ isFrozen(o: any): boolean; /** * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. + * @param o Object to test. */ isExtensible(o: any): boolean; @@ -242,7 +242,7 @@ interface Function { call(thisArg: any, ...argArray: any[]): any; /** - * For a given function, creates a bound function that has the same body as the original function. + * For a given function, creates a bound function that has the same body as the original function. * The this object of the bound function is associated with the specified object, and has the specified initial parameters. * @param thisArg An object to which the this keyword can refer inside the new function. * @param argArray A list of arguments to be passed to the new function. @@ -285,7 +285,7 @@ interface String { */ charAt(pos: number): string; - /** + /** * Returns the Unicode value of the character at the specified location. * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. */ @@ -293,12 +293,12 @@ interface String { /** * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. + * @param strings The strings to append to the end of the string. */ concat(...strings: string[]): string; /** - * Returns the position of the first occurrence of a substring. + * Returns the position of the first occurrence of a substring. * @param searchString The substring to search for in the string * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. */ @@ -317,15 +317,15 @@ interface String { */ localeCompare(that: string): number; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ match(regexp: string): RegExpMatchArray; - /** + /** * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ match(regexp: RegExp): RegExpMatchArray; @@ -359,40 +359,40 @@ interface String { /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: string): number; /** * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. + * @param regexp The regular expression pattern and applicable flags. */ search(regexp: RegExp): number; /** * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. * If this value is not specified, the substring continues to the end of stringObj. */ slice(start?: number, end?: number): string; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: string, limit?: number): string[]; /** * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ split(separator: RegExp, limit?: number): string[]; /** - * Returns the substring at the specified location within a String object. + * Returns the substring at the specified location within a String object. * @param start The zero-based index number indicating the beginning of the substring. * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. * If end is omitted, the characters from start through the end of the original string are returned. @@ -438,8 +438,8 @@ interface StringConstructor { fromCharCode(...codes: number[]): string; } -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. */ declare var String: StringConstructor; @@ -463,7 +463,7 @@ interface Number { */ toString(radix?: number): string; - /** + /** * Returns a string representing a number in fixed-point notation. * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. */ @@ -496,21 +496,21 @@ interface NumberConstructor { /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ MIN_VALUE: number; - /** + /** * A value that is not a number. * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. */ NaN: number; - /** + /** * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. */ NEGATIVE_INFINITY: number; /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. */ POSITIVE_INFINITY: number; } @@ -540,23 +540,23 @@ interface Math { /** The square root of 2. */ SQRT2: number; /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). * For example, the absolute value of -5 is the same as the absolute value of 5. * @param x A numeric expression for which the absolute value is needed. */ abs(x: number): number; /** - * Returns the arc cosine (or inverse cosine) of a number. + * Returns the arc cosine (or inverse cosine) of a number. * @param x A numeric expression. */ acos(x: number): number; - /** - * Returns the arcsine of a number. + /** + * Returns the arcsine of a number. * @param x A numeric expression. */ asin(x: number): number; /** - * Returns the arctangent of a number. + * Returns the arctangent of a number. * @param x A numeric expression for which the arctangent is needed. */ atan(x: number): number; @@ -567,49 +567,49 @@ interface Math { */ atan2(y: number, x: number): number; /** - * Returns the smallest number greater than or equal to its numeric argument. + * Returns the smallest number greater than or equal to its numeric argument. * @param x A numeric expression. */ ceil(x: number): number; /** - * Returns the cosine of a number. + * Returns the cosine of a number. * @param x A numeric expression that contains an angle measured in radians. */ cos(x: number): number; /** - * Returns e (the base of natural logarithms) raised to a power. + * Returns e (the base of natural logarithms) raised to a power. * @param x A numeric expression representing the power of e. */ exp(x: number): number; /** - * Returns the greatest number less than or equal to its numeric argument. + * Returns the greatest number less than or equal to its numeric argument. * @param x A numeric expression. */ floor(x: number): number; /** - * Returns the natural logarithm (base e) of a number. + * Returns the natural logarithm (base e) of a number. * @param x A numeric expression. */ log(x: number): number; /** - * Returns the larger of a set of supplied numeric expressions. + * Returns the larger of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ max(...values: number[]): number; /** - * Returns the smaller of a set of supplied numeric expressions. + * Returns the smaller of a set of supplied numeric expressions. * @param values Numeric expressions to be evaluated. */ min(...values: number[]): number; /** - * Returns the value of a base expression taken to a specified power. + * Returns the value of a base expression taken to a specified power. * @param x The base value of the expression. * @param y The exponent value of the expression. */ pow(x: number, y: number): number; /** Returns a pseudorandom number between 0 and 1. */ random(): number; - /** + /** * Returns a supplied numeric expression rounded to the nearest number. * @param x The value to be rounded to the nearest number. */ @@ -685,24 +685,24 @@ interface Date { getUTCMilliseconds(): number; /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ getTimezoneOffset(): number; - /** + /** * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. */ setTime(time: number): number; /** - * Sets the milliseconds value in the Date object using local time. + * Sets the milliseconds value in the Date object using local time. * @param ms A numeric value equal to the millisecond value. */ setMilliseconds(ms: number): number; - /** + /** * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. + * @param ms A numeric value equal to the millisecond value. */ setUTCMilliseconds(ms: number): number; /** - * Sets the seconds value in the Date object using local time. + * Sets the seconds value in the Date object using local time. * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ @@ -714,16 +714,16 @@ interface Date { */ setUTCSeconds(sec: number, ms?: number): number; /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setMinutes(min: number, sec?: number, ms?: number): number; /** * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCMinutes(min: number, sec?: number, ms?: number): number; @@ -731,7 +731,7 @@ interface Date { * Sets the hour value in the Date object using local time. * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setHours(hours: number, min?: number, sec?: number, ms?: number): number; @@ -739,23 +739,23 @@ interface Date { * Sets the hours value in the Date object using Universal Coordinated Time (UTC). * @param hours A numeric value equal to the hours value. * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. + * @param sec A numeric value equal to the seconds value. * @param ms A numeric value equal to the milliseconds value. */ setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; /** - * Sets the numeric day-of-the-month value of the Date object using local time. + * Sets the numeric day-of-the-month value of the Date object using local time. * @param date A numeric value equal to the day of the month. */ setDate(date: number): number; - /** + /** * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. + * @param date A numeric value equal to the day of the month. */ setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. */ setMonth(month: number, date?: number): number; @@ -800,7 +800,7 @@ interface DateConstructor { */ parse(s: string): number; /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. * @param month The month as an number between 0 and 11 (January to December). * @param date The date as an number between 1 and 31. @@ -826,13 +826,13 @@ interface RegExpExecArray extends Array { } interface RegExp { - /** + /** * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. * @param string The String object or string literal on which to perform the search. */ exec(string: string): RegExpExecArray; - /** + /** * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. * @param string String on which to perform the search. */ @@ -959,8 +959,8 @@ interface JSON { /** * Converts a JavaScript Object Notation (JSON) string into an object. * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. */ parse(text: string, reviver?: (key: any, value: any) => any): any; /** @@ -1040,14 +1040,14 @@ interface Array { */ join(separator?: string): string; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): T[]; /** * Removes the first element from an array and returns it. */ shift(): T; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1110,21 +1110,21 @@ interface Array { /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; /** * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; @@ -1142,15 +1142,15 @@ interface Array { */ reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** + /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; @@ -1205,10 +1205,10 @@ interface ArrayLike { /** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. */ interface ArrayBuffer { /** @@ -1231,7 +1231,7 @@ declare var ArrayBuffer: ArrayBufferConstructor; interface ArrayBufferView { /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1251,124 +1251,124 @@ interface DataView { byteLength: number; byteOffset: number; /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat32(byteOffset: number, littleEndian?: boolean): number; /** * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getFloat64(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt8(byteOffset: number): number; /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getInt32(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint8(byteOffset: number): number; /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint16(byteOffset: number, littleEndian?: boolean): number; /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ getUint32(byteOffset: number, littleEndian?: boolean): number; /** - * Stores an Float32 value at the specified byte offset from the start of the view. + * Stores an Float32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Float64 value at the specified byte offset from the start of the view. + * Stores an Float64 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int8 value at the specified byte offset from the start of the view. + * Stores an Int8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setInt8(byteOffset: number, value: number): void; /** - * Stores an Int16 value at the specified byte offset from the start of the view. + * Stores an Int16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Int32 value at the specified byte offset from the start of the view. + * Stores an Int32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint8 value at the specified byte offset from the start of the view. + * Stores an Uint8 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. */ setUint8(byteOffset: number, value: number): void; /** - * Stores an Uint16 value at the specified byte offset from the start of the view. + * Stores an Uint16 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Stores an Uint32 value at the specified byte offset from the start of the view. + * Stores an Uint32 value at the specified byte offset from the start of the view. * @param byteOffset The place in the buffer at which the value should be set. * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, + * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; @@ -1380,17 +1380,17 @@ interface DataViewConstructor { declare var DataView: DataViewConstructor; /** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Int8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1404,21 +1404,21 @@ interface Int8Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Int8Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1428,49 +1428,49 @@ interface Int8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Int8Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; @@ -1485,7 +1485,7 @@ interface Int8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1493,7 +1493,7 @@ interface Int8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1504,65 +1504,65 @@ interface Int8Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int8Array; @@ -1580,7 +1580,7 @@ interface Int8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1589,31 +1589,31 @@ interface Int8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Int8Array; /** * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1631,7 +1631,7 @@ interface Int8ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -1640,7 +1640,7 @@ interface Int8ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1653,17 +1653,17 @@ interface Int8ArrayConstructor { declare var Int8Array: Int8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint8Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1677,21 +1677,21 @@ interface Uint8Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint8Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1701,49 +1701,49 @@ interface Uint8Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint8Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; @@ -1758,7 +1758,7 @@ interface Uint8Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -1766,7 +1766,7 @@ interface Uint8Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -1777,65 +1777,65 @@ interface Uint8Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8Array; @@ -1853,7 +1853,7 @@ interface Uint8Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -1862,31 +1862,31 @@ interface Uint8Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint8Array; /** * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -1905,7 +1905,7 @@ interface Uint8ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -1914,7 +1914,7 @@ interface Uint8ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint8Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -1927,17 +1927,17 @@ interface Uint8ArrayConstructor { declare var Uint8Array: Uint8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. * If the requested number of bytes could not be allocated an exception is raised. */ interface Uint8ClampedArray { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -1951,21 +1951,21 @@ interface Uint8ClampedArray { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -1975,49 +1975,49 @@ interface Uint8ClampedArray { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint8ClampedArray; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; @@ -2032,7 +2032,7 @@ interface Uint8ClampedArray { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2040,7 +2040,7 @@ interface Uint8ClampedArray { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2051,65 +2051,65 @@ interface Uint8ClampedArray { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint8ClampedArray; @@ -2127,7 +2127,7 @@ interface Uint8ClampedArray { */ set(array: Uint8ClampedArray, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2136,31 +2136,31 @@ interface Uint8ClampedArray { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; /** * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint8ClampedArray; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2179,7 +2179,7 @@ interface Uint8ClampedArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -2200,17 +2200,17 @@ interface Uint8ClampedArrayConstructor { declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -2224,21 +2224,21 @@ interface Int16Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Int16Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2248,49 +2248,49 @@ interface Int16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Int16Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; @@ -2305,7 +2305,7 @@ interface Int16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2313,7 +2313,7 @@ interface Int16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2324,65 +2324,65 @@ interface Int16Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int16Array; @@ -2400,7 +2400,7 @@ interface Int16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2409,31 +2409,31 @@ interface Int16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Int16Array; /** * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2452,7 +2452,7 @@ interface Int16ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -2461,7 +2461,7 @@ interface Int16ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2474,17 +2474,17 @@ interface Int16ArrayConstructor { declare var Int16Array: Int16ArrayConstructor; /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint16Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -2498,21 +2498,21 @@ interface Uint16Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint16Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2522,49 +2522,49 @@ interface Uint16Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint16Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; @@ -2579,7 +2579,7 @@ interface Uint16Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2587,7 +2587,7 @@ interface Uint16Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2598,65 +2598,65 @@ interface Uint16Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint16Array; @@ -2674,7 +2674,7 @@ interface Uint16Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2683,31 +2683,31 @@ interface Uint16Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint16Array; /** * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint16Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2726,7 +2726,7 @@ interface Uint16ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -2735,7 +2735,7 @@ interface Uint16ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint16Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -2747,17 +2747,17 @@ interface Uint16ArrayConstructor { } declare var Uint16Array: Uint16ArrayConstructor; /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -2771,21 +2771,21 @@ interface Int32Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Int32Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -2795,49 +2795,49 @@ interface Int32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Int32Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; @@ -2852,7 +2852,7 @@ interface Int32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -2860,7 +2860,7 @@ interface Int32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -2871,65 +2871,65 @@ interface Int32Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Int32Array; @@ -2947,7 +2947,7 @@ interface Int32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -2956,31 +2956,31 @@ interface Int32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Int32Array; /** * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Int32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -2999,7 +2999,7 @@ interface Int32ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3008,7 +3008,7 @@ interface Int32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3020,17 +3020,17 @@ interface Int32ArrayConstructor { declare var Int32Array: Int32ArrayConstructor; /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -3044,21 +3044,21 @@ interface Uint32Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Uint32Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3068,49 +3068,49 @@ interface Uint32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Uint32Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; @@ -3125,7 +3125,7 @@ interface Uint32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3133,7 +3133,7 @@ interface Uint32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3144,65 +3144,65 @@ interface Uint32Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Uint32Array; @@ -3220,7 +3220,7 @@ interface Uint32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3229,31 +3229,31 @@ interface Uint32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Uint32Array; /** * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Uint32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3272,7 +3272,7 @@ interface Uint32ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3281,7 +3281,7 @@ interface Uint32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3298,12 +3298,12 @@ declare var Uint32Array: Uint32ArrayConstructor; */ interface Float32Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -3317,21 +3317,21 @@ interface Float32Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Float32Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3341,49 +3341,49 @@ interface Float32Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Float32Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; @@ -3398,7 +3398,7 @@ interface Float32Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3406,7 +3406,7 @@ interface Float32Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3417,65 +3417,65 @@ interface Float32Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float32Array; @@ -3493,7 +3493,7 @@ interface Float32Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3502,31 +3502,31 @@ interface Float32Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Float32Array; /** * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float32Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3545,7 +3545,7 @@ interface Float32ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3554,7 +3554,7 @@ interface Float32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float32Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3567,17 +3567,17 @@ interface Float32ArrayConstructor { declare var Float32Array: Float32ArrayConstructor; /** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Float64Array { /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; /** - * The ArrayBuffer instance referenced by the array. + * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBuffer; @@ -3591,21 +3591,21 @@ interface Float64Array { */ byteOffset: number; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): Float64Array; /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, * or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. @@ -3615,49 +3615,49 @@ interface Float64Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: number, start?: number, end?: number): Float64Array; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; @@ -3672,7 +3672,7 @@ interface Float64Array { /** * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the + * @param separator A string used to separate one element of an array from the next in the * resulting String. If omitted, the array elements are separated with a comma. */ join(separator?: string): string; @@ -3680,7 +3680,7 @@ interface Float64Array { /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the * search starts at index 0. */ lastIndexOf(searchElement: number, fromIndex?: number): number; @@ -3691,65 +3691,65 @@ interface Float64Array { length: number; /** - * Calls a defined callback function on each element of an array, and returns an array that + * Calls a defined callback function on each element of an array, and returns an array that * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an * argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; /** - * Reverses the elements in an Array. + * Reverses the elements in an Array. */ reverse(): Float64Array; @@ -3767,7 +3767,7 @@ interface Float64Array { */ set(array: ArrayLike, offset?: number): void; - /** + /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. @@ -3776,31 +3776,31 @@ interface Float64Array { /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If + * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ sort(compareFn?: (a: number, b: number) => number): Float64Array; /** * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. + * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ subarray(begin: number, end?: number): Float64Array; /** - * Converts a number to a string by using the current locale. + * Converts a number to a string by using the current locale. */ toLocaleString(): string; @@ -3819,7 +3819,7 @@ interface Float64ArrayConstructor { new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; /** - * The size in bytes of each element in the array. + * The size in bytes of each element in the array. */ BYTES_PER_ELEMENT: number; @@ -3828,7 +3828,7 @@ interface Float64ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float64Array; - + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. @@ -3851,8 +3851,8 @@ interface Symbol { } interface SymbolConstructor { - /** - * A reference to the prototype. + /** + * A reference to the prototype. */ prototype: Symbol; @@ -3863,14 +3863,14 @@ interface SymbolConstructor { (description?: string|number): symbol; /** - * Returns a Symbol object from the global symbol registry matching the given key if found. + * Returns a Symbol object from the global symbol registry matching the given key if found. * Otherwise, returns a new symbol with this key. * @param key key to search for. */ for(key: string): symbol; /** - * Returns a key from the global symbol registry matching the given Symbol if found. + * Returns a key from the global symbol registry matching the given Symbol if found. * Otherwise, returns a undefined. * @param sym Symbol to find the key for. */ @@ -3878,61 +3878,61 @@ interface SymbolConstructor { // Well-known Symbols - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. */ hasInstance: symbol; - /** + /** * A Boolean value that if true indicates that an object should flatten to its array elements * by Array.prototype.concat. */ isConcatSpreadable: symbol; - /** - * A method that returns the default iterator for an object. Called by the semantics of the + /** + * A method that returns the default iterator for an object. Called by the semantics of the * for-of statement. */ iterator: symbol; /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. */ match: symbol; - /** - * A regular expression method that replaces matched substrings of a string. Called by the + /** + * A regular expression method that replaces matched substrings of a string. Called by the * String.prototype.replace method. */ replace: symbol; /** - * A regular expression method that returns the index within a string that matches the + * A regular expression method that returns the index within a string that matches the * regular expression. Called by the String.prototype.search method. */ search: symbol; - /** - * A function valued property that is the constructor function that is used to create + /** + * A function valued property that is the constructor function that is used to create * derived objects. */ species: symbol; /** - * A regular expression method that splits a string at the indices that match the regular + * A regular expression method that splits a string at the indices that match the regular * expression. Called by the String.prototype.split method. */ split: symbol; - /** + /** * A method that converts an object to a corresponding primitive value. * Called by the ToPrimitive abstract operation. */ toPrimitive: symbol; - /** + /** * A String value that is used in the creation of the default string description of an object. * Called by the built-in method Object.prototype.toString. */ @@ -3948,12 +3948,12 @@ declare var Symbol: SymbolConstructor; interface Object { /** - * Determines whether an object has a property with the specified name. + * Determines whether an object has a property with the specified name. * @param v A property name. */ hasOwnProperty(v: PropertyKey): boolean; - /** + /** * Determines whether a specified property is enumerable. * @param v A property name. */ @@ -3962,10 +3962,37 @@ interface Object { interface ObjectConstructor { /** - * Copy the values of all of the enumerable own properties from one or more source objects to a + * Copy the values of all of the enumerable own properties from one or more source objects to a * target object. Returns the target object. * @param target The target object to copy to. - * @param sources One or more source objects to copy properties from. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties */ assign(target: any, ...sources: any[]): any; @@ -3990,17 +4017,17 @@ interface ObjectConstructor { setPrototypeOf(o: any, proto: any): any; /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. * @param o Object that contains the property. * @param p Name of the property. */ getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript * object (that is, a user-defined object or a built in object) or a DOM object. * @param p The property name. * @param attributes Descriptor for the property. It can be for a data property or an accessor @@ -4028,14 +4055,14 @@ interface Function { interface NumberConstructor { /** * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: + * that is representable as a Number value, which is approximately: * 2.2204460492503130808472633361816 x 10‍−‍16. */ EPSILON: number; /** * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a * number. Only finite values of the type number, result in true. * @param number A numeric value. */ @@ -4048,7 +4075,7 @@ interface NumberConstructor { isInteger(number: number): boolean; /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter * to a number. Only values of the type number, that are also NaN, result in true. * @param number A numeric value. @@ -4061,30 +4088,30 @@ interface NumberConstructor { */ isSafeInteger(number: number): boolean; - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. */ MAX_SAFE_INTEGER: number; - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). */ MIN_SAFE_INTEGER: number; /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. */ parseFloat(string: string): number; /** * Converts A string to an integer. * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. * All other strings are considered decimal. */ @@ -4109,39 +4136,39 @@ interface Array { values: boolean; }; - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, T]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; - /** - * Returns the value of the first element in the array where predicate is true, and undefined + /** + * Returns the value of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - /** - * Returns the index of the first element in the array where predicate is true, and undefined + /** + * Returns the index of the first element in the array where predicate is true, and undefined * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of + * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: T) => boolean, thisArg?: any): number; @@ -4149,21 +4176,21 @@ interface Array { /** * Returns the this object after filling the section identified by start and end with value * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ fill(value: T, start?: number, end?: number): T[]; - /** + /** * Returns the this object after copying a section of the array identified by start and end * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): T[]; } @@ -4214,32 +4241,32 @@ interface String { [Symbol.iterator](): IterableIterator; /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. */ codePointAt(pos: number): number; /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are * greater than or equal to position; otherwise, returns false. - * @param searchString search string + * @param searchString search string * @param position If position is undefined, 0 is assumed, so as to search all of the String. */ includes(searchString: string, position?: number): boolean; /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at * endPosition – length(this). Otherwise returns false. */ endsWith(searchString: string, endPosition?: number): boolean; /** - * Returns the String value result of normalizing the string into the normalization form + * Returns the String value result of normalizing the string into the normalization form * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default * is "NFC" @@ -4247,15 +4274,15 @@ interface String { normalize(form?: string): string; /** - * Returns a String value that is made from count copies appended together. If count is 0, + * Returns a String value that is made from count copies appended together. If count is 0, * T is the empty String is returned. * @param count number of copies to append */ repeat(count: number): string; /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at * position. Otherwise returns false. */ startsWith(searchString: string, position?: number): boolean; @@ -4350,7 +4377,7 @@ interface StringConstructor { /** * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest + * as such the first argument will be a well formed template call site object and the rest * parameter will contain the substitution values. * @param template A well-formed template string call site representation. * @param substitutions A set of substitution values. @@ -4431,7 +4458,7 @@ interface Math { log1p(x: number): number; /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of * the natural logarithms). * @param x A numeric expression. */ @@ -4542,7 +4569,7 @@ interface RegExp { * Replaces text in a string, using this regular expression. * @param string A String object or string literal whose contents matching against * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every + * @param replaceValue A String object or string literal containing the text to replace for every * successful match of this regular expression. */ [Symbol.replace](string: string, replaceValue: string): string; @@ -4591,15 +4618,15 @@ interface RegExp { */ flags: string; - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. */ sticky: boolean; - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. */ unicode: boolean; } @@ -4691,10 +4718,10 @@ interface JSON { } /** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. */ interface ArrayBuffer { [Symbol.toStringTag]: string; @@ -4705,19 +4732,19 @@ interface DataView { } /** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Int8Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4737,19 +4764,19 @@ interface Int8ArrayConstructor { } /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint8Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4769,21 +4796,21 @@ interface Uint8ArrayConstructor { } /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. * If the requested number of bytes could not be allocated an exception is raised. */ interface Uint8ClampedArray { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4805,21 +4832,21 @@ interface Uint8ClampedArrayConstructor { } /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int16Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4841,19 +4868,19 @@ interface Int16ArrayConstructor { } /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint16Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4873,19 +4900,19 @@ interface Uint16ArrayConstructor { } /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Int32Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4905,19 +4932,19 @@ interface Int32ArrayConstructor { } /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ interface Uint32Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4941,15 +4968,15 @@ interface Uint32ArrayConstructor { * of bytes could not be allocated an exception is raised. */ interface Float32Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -4969,19 +4996,19 @@ interface Float32ArrayConstructor { } /** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Float64Array { - /** + /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** + /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** + /** * Returns an list of values in the array */ values(): IterableIterator; @@ -5066,21 +5093,21 @@ interface Promise { } interface PromiseConstructor { - /** - * A reference to the prototype. + /** + * A reference to the prototype. */ prototype: Promise; /** * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, * and a reject callback used to reject the promise with a provided reason or error. */ new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises + * Creates a Promise that is resolved with an array of results when all of the provided Promises * resolve, or rejected when any Promise is rejected. * @param values An array of Promises. * @returns A new Promise. @@ -5088,7 +5115,7 @@ interface PromiseConstructor { all(values: Iterable>): Promise; /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved * or rejected. * @param values An array of Promises. * @returns A new Promise. @@ -5127,7 +5154,7 @@ interface PromiseConstructor { declare var Promise: PromiseConstructor; ///////////////////////////// -/// ECMAScript Internationalization API +/// ECMAScript Internationalization API ///////////////////////////// declare module Intl { @@ -5169,7 +5196,7 @@ declare module Intl { currency?: string; currencyDisplay?: string; useGrouping?: boolean; - minimumintegerDigits?: number; + minimumIntegerDigits?: number; minimumFractionDigits?: number; maximumFractionDigits?: number; minimumSignificantDigits?: number; @@ -5182,7 +5209,7 @@ declare module Intl { style: string; currency?: string; currencyDisplay?: string; - minimumintegerDigits: number; + minimumIntegerDigits: number; minimumFractionDigits: number; maximumFractionDigits: number; minimumSignificantDigits?: number; @@ -5270,14 +5297,14 @@ interface String { interface Number { /** - * Converts a number to a string by using the current or specified locale. + * Converts a number to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; /** - * Converts a number to a string by using the current or specified locale. + * Converts a number to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ @@ -5286,41 +5313,41 @@ interface Number { interface Date { /** - * Converts a date and time to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; /** - * Converts a date to a string by using the current or specified locale. + * Converts a date to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; /** - * Converts a time to a string by using the current or specified locale. + * Converts a time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - + /** - * Converts a date and time to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - + /** - * Converts a date to a string by using the current or specified locale. + * Converts a date to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; /** - * Converts a time to a string by using the current or specified locale. + * Converts a time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ @@ -5531,8 +5558,8 @@ interface AnalyserNode extends AudioNode { smoothingTimeConstant: number; getByteFrequencyData(array: Uint8Array): void; getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: any): void; - getFloatTimeDomainData(array: any): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; } declare var AnalyserNode: { @@ -5619,7 +5646,7 @@ interface AudioBuffer { length: number; numberOfChannels: number; sampleRate: number; - getChannelData(channel: number): any; + getChannelData(channel: number): Float32Array; } declare var AudioBuffer: { @@ -5663,7 +5690,7 @@ interface AudioContext extends EventTarget { createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; - createPeriodicWave(real: any, imag: any): PeriodicWave; + createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; @@ -5721,7 +5748,7 @@ interface AudioParam { linearRampToValueAtTime(value: number, endTime: number): void; setTargetAtTime(target: number, startTime: number, timeConstant: number): void; setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: any, startTime: number, duration: number): void; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; } declare var AudioParam: { @@ -5797,7 +5824,7 @@ interface BiquadFilterNode extends AudioNode { frequency: AudioParam; gain: AudioParam; type: string; - getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } declare var BiquadFilterNode: { @@ -6396,7 +6423,7 @@ declare var CanvasPattern: { interface CanvasRenderingContext2D { canvas: HTMLCanvasElement; - fillStyle: any; + fillStyle: string | CanvasGradient | CanvasPattern; font: string; globalAlpha: number; globalCompositeOperation: string; @@ -6411,7 +6438,7 @@ interface CanvasRenderingContext2D { shadowColor: string; shadowOffsetX: number; shadowOffsetY: number; - strokeStyle: any; + strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: string; textBaseline: string; arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; @@ -6924,7 +6951,7 @@ declare var DeviceRotationRate: { interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent { /** - * Sets or gets the URL for the current document. + * Sets or gets the URL for the current document. */ URL: string; /** @@ -6952,7 +6979,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ applets: HTMLCollection; /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. */ bgColor: string; /** @@ -6979,19 +7006,19 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ designMode: string; /** - * Sets or retrieves a value that indicates the reading order of the object. + * Sets or retrieves a value that indicates the reading order of the object. */ dir: string; /** - * Gets an object representing the document type declaration associated with the current document. + * Gets an object representing the document type declaration associated with the current document. */ doctype: DocumentType; /** - * Gets a reference to the root node of the document. + * Gets a reference to the root node of the document. */ documentElement: HTMLElement; /** - * Sets or gets the security domain of the document. + * Sets or gets the security domain of the document. */ domain: string; /** @@ -7015,7 +7042,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ images: HTMLCollection; /** - * Gets the implementation object of the current document. + * Gets the implementation object of the current document. */ implementation: DOMImplementation; /** @@ -7023,11 +7050,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ inputEncoding: string; /** - * Gets the date that the page was last modified, if the page supplies one. + * Gets the date that the page was last modified, if the page supplies one. */ lastModified: string; /** - * Sets or gets the color of the document links. + * Sets or gets the color of the document links. */ linkColor: string; /** @@ -7035,7 +7062,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ links: HTMLCollection; /** - * Contains information about the current URL. + * Contains information about the current URL. */ location: Location; media: string; @@ -7063,19 +7090,19 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param ev The event. */ onbeforedeactivate: (ev: UIEvent) => any; - /** - * Fires when the object loses the input focus. + /** + * Fires when the object loses the input focus. * @param ev The focus event. */ onblur: (ev: FocusEvent) => any; /** - * Occurs when playback is possible, but would require further buffering. + * Occurs when playback is possible, but would require further buffering. * @param ev The event. */ oncanplay: (ev: Event) => any; oncanplaythrough: (ev: Event) => any; /** - * Fires when the contents of the object or selection have changed. + * Fires when the contents of the object or selection have changed. * @param ev The event. */ onchange: (ev: Event) => any; @@ -7085,7 +7112,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onclick: (ev: MouseEvent) => any; /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * Fires when the user clicks the right mouse button in the client area, opening the context menu. * @param ev The mouse event. */ oncontextmenu: (ev: PointerEvent) => any; @@ -7109,12 +7136,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param ev The event. */ ondragend: (ev: DragEvent) => any; - /** + /** * Fires on the target element when the user drags the object to a valid drop target. * @param ev The drag event. */ ondragenter: (ev: DragEvent) => any; - /** + /** * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. * @param ev The drag event. */ @@ -7125,23 +7152,23 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ ondragover: (ev: DragEvent) => any; /** - * Fires on the source object when the user starts to drag a text selection or selected object. + * Fires on the source object when the user starts to drag a text selection or selected object. * @param ev The event. */ ondragstart: (ev: DragEvent) => any; ondrop: (ev: DragEvent) => any; /** - * Occurs when the duration attribute is updated. + * Occurs when the duration attribute is updated. * @param ev The event. */ ondurationchange: (ev: Event) => any; /** - * Occurs when the media element is reset to its initial state. + * Occurs when the media element is reset to its initial state. * @param ev The event. */ onemptied: (ev: Event) => any; /** - * Occurs when the end of playback is reached. + * Occurs when the end of playback is reached. * @param ev The event */ onended: (ev: Event) => any; @@ -7151,7 +7178,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onerror: (ev: Event) => any; /** - * Fires when the object receives focus. + * Fires when the object receives focus. * @param ev The event. */ onfocus: (ev: FocusEvent) => any; @@ -7174,12 +7201,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onkeyup: (ev: KeyboardEvent) => any; /** - * Fires immediately after the browser loads the object. + * Fires immediately after the browser loads the object. * @param ev The event. */ onload: (ev: Event) => any; /** - * Occurs when media data is loaded at the current playback position. + * Occurs when media data is loaded at the current playback position. * @param ev The event. */ onloadeddata: (ev: Event) => any; @@ -7189,22 +7216,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onloadedmetadata: (ev: Event) => any; /** - * Occurs when Internet Explorer begins looking for media data. + * Occurs when Internet Explorer begins looking for media data. * @param ev The event. */ onloadstart: (ev: Event) => any; /** - * Fires when the user clicks the object with either mouse button. + * Fires when the user clicks the object with either mouse button. * @param ev The mouse event. */ onmousedown: (ev: MouseEvent) => any; /** - * Fires when the user moves the mouse over the object. + * Fires when the user moves the mouse over the object. * @param ev The mouse event. */ onmousemove: (ev: MouseEvent) => any; /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. + * Fires when the user moves the mouse pointer outside the boundaries of the object. * @param ev The mouse event. */ onmouseout: (ev: MouseEvent) => any; @@ -7214,12 +7241,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onmouseover: (ev: MouseEvent) => any; /** - * Fires when the user releases a mouse button while the mouse is over the object. + * Fires when the user releases a mouse button while the mouse is over the object. * @param ev The mouse event. */ onmouseup: (ev: MouseEvent) => any; /** - * Fires when the wheel button is rotated. + * Fires when the wheel button is rotated. * @param ev The mouse event */ onmousewheel: (ev: MouseWheelEvent) => any; @@ -7241,7 +7268,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onmspointerover: (ev: MSPointerEvent) => any; onmspointerup: (ev: MSPointerEvent) => any; /** - * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. + * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. * @param ev The event. */ onmssitemodejumplistitemremoved: (ev: MSSiteModeEvent) => any; @@ -7256,24 +7283,24 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onpause: (ev: Event) => any; /** - * Occurs when the play method is requested. + * Occurs when the play method is requested. * @param ev The event. */ onplay: (ev: Event) => any; /** - * Occurs when the audio or video has started playing. + * Occurs when the audio or video has started playing. * @param ev The event. */ onplaying: (ev: Event) => any; onpointerlockchange: (ev: Event) => any; onpointerlockerror: (ev: Event) => any; /** - * Occurs to indicate progress while downloading media data. + * Occurs to indicate progress while downloading media data. * @param ev The event. */ onprogress: (ev: ProgressEvent) => any; /** - * Occurs when the playback rate is increased or decreased. + * Occurs when the playback rate is increased or decreased. * @param ev The event. */ onratechange: (ev: Event) => any; @@ -7283,22 +7310,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onreadystatechange: (ev: ProgressEvent) => any; /** - * Fires when the user resets a form. + * Fires when the user resets a form. * @param ev The event. */ onreset: (ev: Event) => any; /** - * Fires when the user repositions the scroll box in the scroll bar on the object. + * Fires when the user repositions the scroll box in the scroll bar on the object. * @param ev The event. */ onscroll: (ev: UIEvent) => any; /** - * Occurs when the seek operation ends. + * Occurs when the seek operation ends. * @param ev The event. */ onseeked: (ev: Event) => any; /** - * Occurs when the current playback position is moved. + * Occurs when the current playback position is moved. * @param ev The event. */ onseeking: (ev: Event) => any; @@ -7309,7 +7336,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onselect: (ev: UIEvent) => any; onselectstart: (ev: Event) => any; /** - * Occurs when the download has stopped. + * Occurs when the download has stopped. * @param ev The event. */ onstalled: (ev: Event) => any; @@ -7320,7 +7347,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onstop: (ev: Event) => any; onsubmit: (ev: Event) => any; /** - * Occurs if the load operation has been intentionally halted. + * Occurs if the load operation has been intentionally halted. * @param ev The event. */ onsuspend: (ev: Event) => any; @@ -7339,7 +7366,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ onvolumechange: (ev: Event) => any; /** - * Occurs when playback stops because the next frame of a video resource is not available. + * Occurs when playback stops because the next frame of a video resource is not available. * @param ev The event. */ onwaiting: (ev: Event) => any; @@ -7373,7 +7400,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ title: string; visibilityState: string; - /** + /** * Sets or gets the color of the links that the user has visited. */ vlinkColor: string; @@ -7526,7 +7553,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; createNSResolver(nodeResolver: Node): XPathNSResolver; /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. * @param root The root element or node to start traversing on. * @param whatToShow The type of nodes or elements to appear in the node list * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. @@ -7535,11 +7562,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; createProcessingInstruction(target: string, data: string): ProcessingInstruction; /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. */ createRange(): Range; /** - * Creates a text string from the specified value. + * Creates a text string from the specified value. * @param data String that specifies the nodeValue property of the text node. */ createTextNode(data: string): Text; @@ -7554,7 +7581,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; /** - * Returns the element for the specified x coordinate and the specified y coordinate. + * Returns the element for the specified x coordinate and the specified y coordinate. * @param x The x-offset * @param y The y-offset */ @@ -7779,8 +7806,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven importNode(importedNode: Node, deep: boolean): Node; msElementsFromPoint(x: number, y: number): NodeList; msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; - msGetPrintDocumentForNamedFlow(flowName: string): Document; - msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void; /** * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. * @param url Specifies a MIME type for the document. @@ -7789,7 +7814,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param replace Specifies whether the existing entry for the document is replaced in the history list. */ open(url?: string, name?: string, features?: string, replace?: boolean): Document; - /** + /** * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. * @param commandId Specifies a command identifier. */ @@ -7811,7 +7836,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven queryCommandSupported(commandId: string): boolean; /** * Retrieves the string associated with a command. - * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. + * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. */ queryCommandText(commandId: string): string; /** @@ -7827,12 +7852,12 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven webkitCancelFullScreen(): void; webkitExitFullscreen(): void; /** - * Writes one or more HTML expressions to a document in the specified window. + * Writes one or more HTML expressions to a document in the specified window. * @param content Specifies the text and HTML tags to write. */ write(...content: string[]): void; /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. * @param content The text and HTML tags to write. */ writeln(...content: string[]): void; @@ -8540,12 +8565,12 @@ interface HTMLAnchorElement extends HTMLElement { */ target: string; /** - * Retrieves or sets the text of the object as a string. + * Retrieves or sets the text of the object as a string. */ text: string; type: string; urn: string; - /** + /** * Returns a string representation of an object. */ toString(): string; @@ -8646,7 +8671,7 @@ interface HTMLAreaElement extends HTMLElement { */ host: string; /** - * Sets or retrieves the host name part of the location or URL. + * Sets or retrieves the host name part of the location or URL. */ hostname: string; /** @@ -8682,7 +8707,7 @@ interface HTMLAreaElement extends HTMLElement { * Sets or retrieves the window or frame at which to target content. */ target: string; - /** + /** * Returns a string representation of an object. */ toString(): string; @@ -8965,7 +8990,7 @@ interface HTMLButtonElement extends HTMLElement { * Overrides the target attribute on a form element. */ formTarget: string; - /** + /** * Sets or retrieves the name of the object. */ name: string; @@ -8982,7 +9007,7 @@ interface HTMLButtonElement extends HTMLElement { * Returns a ValidityState object that represents the validity states of an element. */ validity: ValidityState; - /** + /** * Sets or retrieves the default or selected value of the control. */ value: string; @@ -9116,7 +9141,7 @@ declare var HTMLDirectoryElement: { interface HTMLDivElement extends HTMLElement { /** - * Sets or retrieves how the object is aligned with adjacent text. + * Sets or retrieves how the object is aligned with adjacent text. */ align: string; /** @@ -10262,7 +10287,7 @@ interface HTMLInputElement extends HTMLElement { */ files: FileList; /** - * Retrieves a reference to the form that the object is embedded in. + * Retrieves a reference to the form that the object is embedded in. */ form: HTMLFormElement; /** @@ -10432,7 +10457,7 @@ interface HTMLIsIndexElement extends HTMLElement { */ action: string; /** - * Retrieves a reference to the form that the object is embedded in. + * Retrieves a reference to the form that the object is embedded in. */ form: HTMLFormElement; prompt: string; @@ -10991,7 +11016,7 @@ interface HTMLMetaElement extends HTMLElement { */ scheme: string; /** - * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. + * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. */ url: string; } @@ -11237,7 +11262,7 @@ declare var HTMLOptionElement: { interface HTMLParagraphElement extends HTMLElement { /** - * Sets or retrieves how the object is aligned with adjacent text. + * Sets or retrieves how the object is aligned with adjacent text. */ align: string; clear: string; @@ -11356,10 +11381,10 @@ interface HTMLScriptElement extends HTMLElement { */ defer: boolean; /** - * Sets or retrieves the event for which the script is written. + * Sets or retrieves the event for which the script is written. */ event: string; - /** + /** * Sets or retrieves the object that is bound to the event script. */ htmlFor: string; @@ -11368,7 +11393,7 @@ interface HTMLScriptElement extends HTMLElement { */ src: string; /** - * Retrieves or sets the text of the object as a string. + * Retrieves or sets the text of the object as a string. */ text: string; /** @@ -11389,7 +11414,7 @@ interface HTMLSelectElement extends HTMLElement { autofocus: boolean; disabled: boolean; /** - * Retrieves a reference to the form that the object is embedded in. + * Retrieves a reference to the form that the object is embedded in. */ form: HTMLFormElement; /** @@ -11414,7 +11439,7 @@ interface HTMLSelectElement extends HTMLElement { */ selectedIndex: number; /** - * Sets or retrieves the number of rows in the list box. + * Sets or retrieves the number of rows in the list box. */ size: number; /** @@ -11440,7 +11465,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Adds an element to the areas, controlRange, or options collection. * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. - * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. + * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. */ add(element: HTMLElement, before?: HTMLElement | number): void; /** @@ -11632,7 +11657,7 @@ interface HTMLTableElement extends HTMLElement { */ border: string; /** - * Sets or retrieves the border color of the object. + * Sets or retrieves the border color of the object. */ borderColor: any; /** @@ -11921,7 +11946,7 @@ declare var HTMLTextAreaElement: { interface HTMLTitleElement extends HTMLElement { /** - * Retrieves or sets the text of the object as a string. + * Retrieves or sets the text of the object as a string. */ text: string; } @@ -12351,7 +12376,7 @@ interface ImageDataConstructor { new(array: Uint8ClampedArray, width: number, height: number): ImageData; } -declare var ImageData: ImageDataConstructor; +declare var ImageData: ImageDataConstructor; interface KeyboardEvent extends UIEvent { altKey: boolean; @@ -12602,27 +12627,6 @@ declare var MSHTMLWebViewElement: { new(): MSHTMLWebViewElement; } -interface MSHeaderFooter { - URL: string; - dateLong: string; - dateShort: string; - font: string; - htmlFoot: string; - htmlHead: string; - page: number; - pageTotal: number; - textFoot: string; - textHead: string; - timeLong: string; - timeShort: string; - title: string; -} - -declare var MSHeaderFooter: { - prototype: MSHeaderFooter; - new(): MSHeaderFooter; -} - interface MSInputMethodContext extends EventTarget { compositionEndOffset: number; compositionStartOffset: number; @@ -12781,24 +12785,6 @@ declare var MSPointerEvent: { new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; } -interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget { - percentScale: number; - showHeaderFooter: boolean; - shrinkToFit: boolean; - drawPreviewPage(element: HTMLElement, pageNumber: number): void; - endPrint(): void; - getPrintTaskOptionValue(key: string): any; - invalidatePreview(): void; - setPageCount(pageCount: number): void; - startPrint(): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSPrintManagerTemplatePrinter: { - prototype: MSPrintManagerTemplatePrinter; - new(): MSPrintManagerTemplatePrinter; -} - interface MSRangeCollection { length: number; item(index: number): Range; @@ -12846,63 +12832,6 @@ declare var MSStreamReader: { new(): MSStreamReader; } -interface MSTemplatePrinter { - collate: boolean; - copies: number; - currentPage: boolean; - currentPageAvail: boolean; - duplex: boolean; - footer: string; - frameActive: boolean; - frameActiveEnabled: boolean; - frameAsShown: boolean; - framesetDocument: boolean; - header: string; - headerFooterFont: string; - marginBottom: number; - marginLeft: number; - marginRight: number; - marginTop: number; - orientation: string; - pageFrom: number; - pageHeight: number; - pageTo: number; - pageWidth: number; - selectedPages: boolean; - selection: boolean; - selectionEnabled: boolean; - unprintableBottom: number; - unprintableLeft: number; - unprintableRight: number; - unprintableTop: number; - usePrinterCopyCollate: boolean; - createHeaderFooter(): MSHeaderFooter; - deviceSupports(property: string): any; - ensurePrintDialogDefaults(): boolean; - getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginBottomImportant(pageRule: CSSPageRule): boolean; - getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginLeftImportant(pageRule: CSSPageRule): boolean; - getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginRightImportant(pageRule: CSSPageRule): boolean; - getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any; - getPageMarginTopImportant(pageRule: CSSPageRule): boolean; - printBlankPage(): void; - printNonNative(document: any): boolean; - printNonNativeFrames(document: any, activeFrame: boolean): void; - printPage(element: HTMLElement): void; - showPageSetupDialog(): boolean; - showPrintDialog(): boolean; - startDoc(title: string): boolean; - stopDoc(): void; - updatePageStatus(status: number): void; -} - -declare var MSTemplatePrinter: { - prototype: MSTemplatePrinter; - new(): MSTemplatePrinter; -} - interface MSWebViewAsyncOperation extends EventTarget { error: DOMError; oncomplete: (ev: Event) => any; @@ -13320,6 +13249,10 @@ declare var Node: { } interface NodeFilter { + acceptNode(n: Node): number; +} + +declare var NodeFilter: { FILTER_ACCEPT: number; FILTER_REJECT: number; FILTER_SKIP: number; @@ -13337,7 +13270,6 @@ interface NodeFilter { SHOW_PROCESSING_INSTRUCTION: number; SHOW_TEXT: number; } -declare var NodeFilter: NodeFilter; interface NodeIterator { expandEntityReferences: boolean; @@ -14047,7 +13979,6 @@ declare var SVGDescElement: { interface SVGElement extends Element { id: string; - className: any; onclick: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusin: (ev: FocusEvent) => any; @@ -14061,6 +13992,7 @@ interface SVGElement extends Element { ownerSVGElement: SVGSVGElement; viewportElement: SVGElement; xmlbase: string; + className: any; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -16222,7 +16154,7 @@ declare var WEBGL_depth_texture: { } interface WaveShaperNode extends AudioNode { - curve: any; + curve: Float32Array; oversample: string; } @@ -16409,34 +16341,34 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: any): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; uniform1i(location: WebGLUniformLocation, x: number): void; uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: any): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; uniform2i(location: WebGLUniformLocation, x: number, y: number): void; uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: any): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: any): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; useProgram(program: WebGLProgram): void; validateProgram(program: WebGLProgram): void; vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: any): void; + vertexAttrib1fv(indx: number, values: Float32Array): void; vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: any): void; + vertexAttrib2fv(indx: number, values: Float32Array): void; vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: any): void; + vertexAttrib3fv(indx: number, values: Float32Array): void; vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: any): void; + vertexAttrib4fv(indx: number, values: Float32Array): void; vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; ACTIVE_ATTRIBUTES: number; @@ -17200,7 +17132,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window locationbar: BarProp; menubar: BarProp; msAnimationStartTime: number; - msTemplatePrinter: MSTemplatePrinter; name: string; navigator: Navigator; offscreenBuffering: string | boolean; @@ -17937,7 +17868,6 @@ interface XMLHttpRequestEventTarget { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } - interface NodeListOf extends NodeList { length: number; item(index: number): TNode; @@ -17958,8 +17888,6 @@ interface EventListenerObject { handleEvent(evt: Event): void; } -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - interface MessageEventInit extends EventInit { data?: any; origin?: string; @@ -17975,6 +17903,8 @@ interface ProgressEventInit extends EventInit { total?: number; } +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + interface ErrorEventHandler { (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; } @@ -18035,7 +17965,6 @@ declare var location: Location; declare var locationbar: BarProp; declare var menubar: BarProp; declare var msAnimationStartTime: number; -declare var msTemplatePrinter: MSTemplatePrinter; declare var name: string; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; @@ -18317,9 +18246,9 @@ interface NodeListOf { } ///////////////////////////// -/// WorkerGlobalScope APIs +/// WorkerGlobalScope APIs ///////////////////////////// -// These are only available in a Web Worker +// These are only available in a Web Worker declare function importScripts(...urls: string[]): void; @@ -18352,7 +18281,7 @@ interface TextStreamBase { /** * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If + * It is not necessary to close standard streams; they close automatically when the process ends. If * you close a standard stream, be aware that any other pointers to that standard stream become invalid. */ Close(): void; diff --git a/extensions/typescript/server/typescript/lib/lib.scriptHost.d.ts b/extensions/typescript/server/typescript/lib/lib.scriptHost.d.ts index cb77b4ac891..cc97544da60 100644 --- a/extensions/typescript/server/typescript/lib/lib.scriptHost.d.ts +++ b/extensions/typescript/server/typescript/lib/lib.scriptHost.d.ts @@ -1,14 +1,14 @@ /*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. +Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - +License at http://www.apache.org/licenses/LICENSE-2.0 + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ @@ -45,7 +45,7 @@ interface TextStreamBase { /** * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If + * It is not necessary to close standard streams; they close automatically when the process ends. If * you close a standard stream, be aware that any other pointers to that standard stream become invalid. */ Close(): void; diff --git a/extensions/typescript/server/typescript/lib/lib.webworker.d.ts b/extensions/typescript/server/typescript/lib/lib.webworker.d.ts index a3cec8ce7d5..fb015516b90 100644 --- a/extensions/typescript/server/typescript/lib/lib.webworker.d.ts +++ b/extensions/typescript/server/typescript/lib/lib.webworker.d.ts @@ -1,21 +1,21 @@ /*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. +Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - +License at http://www.apache.org/licenses/LICENSE-2.0 + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /// ///////////////////////////// -/// ECMAScript Internationalization API +/// ECMAScript Internationalization API ///////////////////////////// declare module Intl { @@ -57,7 +57,7 @@ declare module Intl { currency?: string; currencyDisplay?: string; useGrouping?: boolean; - minimumintegerDigits?: number; + minimumIntegerDigits?: number; minimumFractionDigits?: number; maximumFractionDigits?: number; minimumSignificantDigits?: number; @@ -70,7 +70,7 @@ declare module Intl { style: string; currency?: string; currencyDisplay?: string; - minimumintegerDigits: number; + minimumIntegerDigits: number; minimumFractionDigits: number; maximumFractionDigits: number; minimumSignificantDigits?: number; @@ -158,14 +158,14 @@ interface String { interface Number { /** - * Converts a number to a string by using the current or specified locale. + * Converts a number to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; /** - * Converts a number to a string by using the current or specified locale. + * Converts a number to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ @@ -174,41 +174,41 @@ interface Number { interface Date { /** - * Converts a date and time to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; /** - * Converts a date to a string by using the current or specified locale. + * Converts a date to a string by using the current or specified locale. * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; /** - * Converts a time to a string by using the current or specified locale. + * Converts a time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - + /** - * Converts a date and time to a string by using the current or specified locale. + * Converts a date and time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - + /** - * Converts a date to a string by using the current or specified locale. + * Converts a date to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; /** - * Converts a time to a string by using the current or specified locale. + * Converts a time to a string by using the current or specified locale. * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. * @param options An object that contains one or more properties that specify comparison options. */ @@ -234,7 +234,7 @@ interface AudioBuffer { length: number; numberOfChannels: number; sampleRate: number; - getChannelData(channel: number): any; + getChannelData(channel: number): Float32Array; } declare var AudioBuffer: { @@ -688,7 +688,7 @@ interface ImageDataConstructor { new(array: Uint8ClampedArray, width: number, height: number): ImageData; } -declare var ImageData: ImageDataConstructor; +declare var ImageData: ImageDataConstructor; interface MSApp { clearTemporaryWebDataAsync(): MSAppAsyncOperation; @@ -1111,7 +1111,6 @@ interface WorkerUtils extends Object, WindowBase64 { setTimeout(handler: any, timeout?: any, ...args: any[]): number; } - interface BlobPropertyBag { type?: string; endings?: string; @@ -1126,8 +1125,6 @@ interface EventListenerObject { handleEvent(evt: Event): void; } -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - interface MessageEventInit extends EventInit { data?: any; origin?: string; @@ -1143,6 +1140,8 @@ interface ProgressEventInit extends EventInit { total?: number; } +declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + interface ErrorEventHandler { (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; } diff --git a/extensions/typescript/server/typescript/lib/tsserver.js b/extensions/typescript/server/typescript/lib/tsserver.js index db542214a51..a1db8028f90 100644 --- a/extensions/typescript/server/typescript/lib/tsserver.js +++ b/extensions/typescript/server/typescript/lib/tsserver.js @@ -1,14 +1,14 @@ /*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. +Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - +License at http://www.apache.org/licenses/LICENSE-2.0 + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ @@ -47,7 +47,6 @@ var ts; })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); var DiagnosticCategory = ts.DiagnosticCategory; })(ts || (ts = {})); -/// var ts; (function (ts) { function createFileMap(getCanonicalFileName) { @@ -411,8 +410,11 @@ var ts; } ts.chainDiagnosticMessages = chainDiagnosticMessages; function concatenateDiagnosticMessageChains(headChain, tailChain) { - Debug.assert(!headChain.next); - headChain.next = tailChain; + var lastChain = headChain; + while (lastChain.next) { + lastChain = lastChain.next; + } + lastChain.next = tailChain; return headChain; } ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains; @@ -569,9 +571,6 @@ var ts; } ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; function getNormalizedPathComponentsOfUrl(url) { - // Get root length of http://www.website.com/folder1/foler2/ - // In this example the root is: http://www.website.com/ - // normalized path components should be ["http://www.website.com/", "folder1", "folder2"] var urlLength = url.length; var rootLength = url.indexOf("://") + "://".length; while (rootLength < urlLength) { @@ -631,6 +630,9 @@ var ts; } ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl; function getBaseFileName(path) { + if (!path) { + return undefined; + } var i = path.lastIndexOf(ts.directorySeparator); return i < 0 ? path : path.substring(i + 1); } @@ -654,6 +656,20 @@ var ts; } ts.fileExtensionIs = fileExtensionIs; ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; + ts.moduleFileExtensions = ts.supportedExtensions; + function isSupportedSourceFileName(fileName) { + if (!fileName) { + return false; + } + for (var _i = 0; _i < ts.supportedExtensions.length; _i++) { + var extension = ts.supportedExtensions[_i]; + if (fileExtensionIs(fileName, extension)) { + return true; + } + } + return false; + } + ts.isSupportedSourceFileName = isSupportedSourceFileName; var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; function removeFileExtension(path) { for (var _i = 0; _i < extensionsToRemove.length; _i++) { @@ -730,8 +746,17 @@ var ts; } Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); + function copyListRemovingItem(item, list) { + var copiedList = []; + for (var i = 0, len = list.length; i < len; i++) { + if (list[i] !== item) { + copiedList.push(list[i]); + } + } + return copiedList; + } + ts.copyListRemovingItem = copyListRemovingItem; })(ts || (ts = {})); -/// var ts; (function (ts) { ts.sys = (function () { @@ -869,6 +894,76 @@ var ts; var _fs = require("fs"); var _path = require("path"); var _os = require("os"); + function createWatchedFileSet(interval, chunkSize) { + if (interval === void 0) { interval = 2500; } + if (chunkSize === void 0) { chunkSize = 30; } + var watchedFiles = []; + var nextFileToCheck = 0; + var watchTimer; + function getModifiedTime(fileName) { + return _fs.statSync(fileName).mtime; + } + function poll(checkedIndex) { + var watchedFile = watchedFiles[checkedIndex]; + if (!watchedFile) { + return; + } + _fs.stat(watchedFile.fileName, function (err, stats) { + if (err) { + watchedFile.callback(watchedFile.fileName); + } + else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { + watchedFile.mtime = getModifiedTime(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); + } + }); + } + function startWatchTimer() { + watchTimer = setInterval(function () { + var count = 0; + var nextToCheck = nextFileToCheck; + var firstCheck = -1; + while ((count < chunkSize) && (nextToCheck !== firstCheck)) { + poll(nextToCheck); + if (firstCheck < 0) { + firstCheck = nextToCheck; + } + nextToCheck++; + if (nextToCheck === watchedFiles.length) { + nextToCheck = 0; + } + count++; + } + nextFileToCheck = nextToCheck; + }, interval); + } + function addFile(fileName, callback) { + var file = { + fileName: fileName, + callback: callback, + mtime: getModifiedTime(fileName) + }; + watchedFiles.push(file); + if (watchedFiles.length === 1) { + startWatchTimer(); + } + return file; + } + function removeFile(file) { + watchedFiles = ts.copyListRemovingItem(file, watchedFiles); + } + return { + getModifiedTime: getModifiedTime, + poll: poll, + startWatchTimer: startWatchTimer, + addFile: addFile, + removeFile: removeFile + }; + } + var watchedFileSet = createWatchedFileSet(); + function isNode4OrLater() { + return parseInt(process.version.charAt(1)) >= 4; + } var platform = _os.platform(); var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; function readFile(fileName, encoding) { @@ -949,16 +1044,21 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); - return { - close: function () { _fs.unwatchFile(fileName, fileChanged); } - }; - function fileChanged(curr, prev) { - if (+curr.mtime <= +prev.mtime) { - return; - } - callback(fileName); + if (isNode4OrLater()) { + return _fs.watch(fileName, function (eventName, relativeFileName) { return callback(fileName); }); } + var watchedFile = watchedFileSet.addFile(fileName, callback); + return { + close: function () { return watchedFileSet.removeFile(watchedFile); } + }; + }, + watchDirectory: function (path, callback, recursive) { + return _fs.watch(path, { persisten: true, recursive: !!recursive }, function (eventName, relativeFileName) { + if (eventName === "rename") { + callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName))); + } + ; + }); }, resolvePath: function (path) { return _path.resolve(path); @@ -1003,7 +1103,6 @@ var ts; } })(); })(ts || (ts = {})); -/// var ts; (function (ts) { ts.Diagnostics = { @@ -1056,7 +1155,7 @@ var ts; Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum member must have initializer." }, _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: ts.DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." }, + In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In ambient enum declarations member initializer must be constant expression." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid 'reference' directive syntax." }, @@ -1144,7 +1243,7 @@ var ts; Property_destructuring_pattern_expected: { code: 1180, category: ts.DiagnosticCategory.Error, key: "Property destructuring pattern expected." }, Array_element_destructuring_pattern_expected: { code: 1181, category: ts.DiagnosticCategory.Error, key: "Array element destructuring pattern expected." }, A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: ts.DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: ts.DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1183, category: ts.DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, Modifiers_cannot_appear_here: { code: 1184, category: ts.DiagnosticCategory.Error, key: "Modifiers cannot appear here." }, Merge_conflict_marker_encountered: { code: 1185, category: ts.DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: ts.DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, @@ -1162,10 +1261,9 @@ var ts; An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: ts.DiagnosticCategory.Error, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, Unterminated_Unicode_escape_sequence: { code: 1199, category: ts.DiagnosticCategory.Error, key: "Unterminated Unicode escape sequence." }, Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, - Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, - Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." }, - Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, + Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead." }, + Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead." }, + Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'es6' when targeting 'ES5' or lower." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, @@ -1194,10 +1292,6 @@ var ts; An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: ts.DiagnosticCategory.Error, key: "An export declaration can only be used in a module." }, An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: ts.DiagnosticCategory.Error, key: "An ambient module declaration is only allowed at the top level in a file." }, A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: ts.DiagnosticCategory.Error, key: "A namespace declaration is only allowed in a namespace or module." }, - Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning: { code: 1236, category: ts.DiagnosticCategory.Error, key: "Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning." }, - with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." }, - await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." }, - Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." }, The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: ts.DiagnosticCategory.Error, key: "The return type of a property decorator function must be either 'void' or 'any'." }, The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: ts.DiagnosticCategory.Error, key: "The return type of a parameter decorator function must be either 'void' or 'any'." }, Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: ts.DiagnosticCategory.Error, key: "Unable to resolve signature of class decorator when called as an expression." }, @@ -1208,6 +1302,10 @@ var ts; _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "'{0}' modifier cannot be used with '{1}' modifier." }, Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract methods can only appear within an abstract class." }, Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method '{0}' cannot have an implementation because it is marked abstract." }, + with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "'with' statements are not allowed in an async function block." }, + await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "'await' expression is only allowed within an async function." }, + Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async functions are only available when targeting ECMAScript 6 and higher." }, + can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "'=' can only be used in an object literal property inside a destructuring assignment." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -1248,7 +1346,7 @@ var ts; Property_0_does_not_exist_on_type_1: { code: 2339, category: ts.DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." }, Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." }, @@ -1332,7 +1430,7 @@ var ts; In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_modules_cannot_be_nested_in_other_modules: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules." }, + Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules or namespaces." }, Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient module declaration cannot specify relative module name." }, Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" }, Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import name cannot be '{0}'" }, @@ -1413,12 +1511,15 @@ var ts; Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." }, All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All declarations of an abstract method must be consecutive." }, Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, - Only_an_ambient_class_can_be_merged_with_an_interface: { code: 2518, category: ts.DiagnosticCategory.Error, key: "Only an ambient class can be merged with an interface." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: "'yield' expressions cannot be used in a parameter initializer." }, await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: "'await' expressions cannot be used in a parameter initializer." }, + Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: "Initializer provides no value for this binding element and the binding element has no default value." }, + A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: "A 'this' type is available only in a non-static member of a class or interface." }, + The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary." }, + A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A module cannot have multiple default exports." }, JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -1431,8 +1532,9 @@ var ts; Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, + Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, - Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition: { code: 2655, category: ts.DiagnosticCategory.Error, key: "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition." }, + Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1517,7 +1619,7 @@ var ts; Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, - A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5053, category: ts.DiagnosticCategory.Error, key: "A 'tsconfig.json' file is already defined at: '{0}'." }, + A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A 'tsconfig.json' file is already defined at: '{0}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1529,7 +1631,7 @@ var ts; Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" }, + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es6'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." }, Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." }, @@ -1550,7 +1652,7 @@ var ts; Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_or_umd: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'." }, + Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es6'." }, Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, @@ -1571,7 +1673,6 @@ var ts; Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, - Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." }, Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes a TypeScript project and creates a tsconfig.json file." }, @@ -1618,79 +1719,83 @@ var ts; Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX attribute expected." }, Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" } + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" }, + An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, + A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." } }; })(ts || (ts = {})); -/// -/// var ts; (function (ts) { + function tokenIsIdentifierOrKeyword(token) { + return token >= 69; + } + ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; var textToToken = { - "abstract": 113, - "any": 115, - "as": 114, - "boolean": 118, - "break": 68, - "case": 69, - "catch": 70, - "class": 71, - "continue": 73, - "const": 72, - "constructor": 119, - "debugger": 74, - "declare": 120, - "default": 75, - "delete": 76, - "do": 77, - "else": 78, - "enum": 79, - "export": 80, - "extends": 81, - "false": 82, - "finally": 83, - "for": 84, - "from": 131, - "function": 85, - "get": 121, - "if": 86, - "implements": 104, - "import": 87, - "in": 88, - "instanceof": 89, - "interface": 105, - "is": 122, - "let": 106, - "module": 123, - "namespace": 124, - "new": 90, - "null": 91, - "number": 126, - "package": 107, - "private": 108, - "protected": 109, - "public": 110, - "require": 125, - "return": 92, - "set": 127, - "static": 111, - "string": 128, - "super": 93, - "switch": 94, - "symbol": 129, - "this": 95, - "throw": 96, - "true": 97, - "try": 98, - "type": 130, - "typeof": 99, - "var": 100, - "void": 101, - "while": 102, - "with": 103, - "yield": 112, - "async": 116, - "await": 117, - "of": 132, + "abstract": 115, + "any": 117, + "as": 116, + "boolean": 120, + "break": 70, + "case": 71, + "catch": 72, + "class": 73, + "continue": 75, + "const": 74, + "constructor": 121, + "debugger": 76, + "declare": 122, + "default": 77, + "delete": 78, + "do": 79, + "else": 80, + "enum": 81, + "export": 82, + "extends": 83, + "false": 84, + "finally": 85, + "for": 86, + "from": 133, + "function": 87, + "get": 123, + "if": 88, + "implements": 106, + "import": 89, + "in": 90, + "instanceof": 91, + "interface": 107, + "is": 124, + "let": 108, + "module": 125, + "namespace": 126, + "new": 92, + "null": 93, + "number": 128, + "package": 109, + "private": 110, + "protected": 111, + "public": 112, + "require": 127, + "return": 94, + "set": 129, + "static": 113, + "string": 130, + "super": 95, + "switch": 96, + "symbol": 131, + "this": 97, + "throw": 98, + "true": 99, + "try": 100, + "type": 132, + "typeof": 101, + "var": 102, + "void": 103, + "while": 104, + "with": 105, + "yield": 114, + "async": 118, + "await": 119, + "of": 134, "{": 15, "}": 16, "(": 17, @@ -1712,37 +1817,39 @@ var ts; "=>": 34, "+": 35, "-": 36, + "**": 38, "*": 37, - "/": 38, - "%": 39, - "++": 40, - "--": 41, - "<<": 42, + "/": 39, + "%": 40, + "++": 41, + "--": 42, + "<<": 43, ">": 43, - ">>>": 44, - "&": 45, - "|": 46, - "^": 47, - "!": 48, - "~": 49, - "&&": 50, - "||": 51, - "?": 52, - ":": 53, - "=": 55, - "+=": 56, - "-=": 57, - "*=": 58, - "/=": 59, - "%=": 60, - "<<=": 61, - ">>=": 62, - ">>>=": 63, - "&=": 64, - "|=": 65, - "^=": 66, - "@": 54 + ">>": 44, + ">>>": 45, + "&": 46, + "|": 47, + "^": 48, + "!": 49, + "~": 50, + "&&": 51, + "||": 52, + "?": 53, + ":": 54, + "=": 56, + "+=": 57, + "-=": 58, + "*=": 59, + "**=": 60, + "/=": 61, + "%=": 62, + "<<=": 63, + ">>=": 64, + ">>>=": 65, + "&=": 66, + "|=": 67, + "^=": 68, + "@": 55 }; var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; @@ -1872,16 +1979,6 @@ var ts; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { - // ES5 7.3: - // The ECMAScript line terminator characters are listed in Table 3. - // Table 3: Line Terminator Characters - // Code Unit Value Name Formal Name - // \u000A Line Feed - // \u000D Carriage Return - // \u2028 Line separator - // \u2029 Paragraph separator - // Only the characters in Table 3 are treated as line terminators. Other new line or line - // breaking characters are treated as white space but not as line terminators. return ch === 10 || ch === 13 || ch === 8232 || @@ -2154,8 +2251,8 @@ var ts; getTokenValue: function () { return tokenValue; }, hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 67 || token > 103; }, - isReservedWord: function () { return token >= 68 && token <= 103; }, + isIdentifier: function () { return token === 69 || token > 105; }, + isReservedWord: function () { return token >= 70 && token <= 105; }, isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, @@ -2177,16 +2274,6 @@ var ts; onError(message, length || 0); } } - function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); - } - function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); - } function scanNumber() { var start = pos; while (isDigit(text.charCodeAt(pos))) @@ -2441,12 +2528,12 @@ var ts; var start = pos; while (pos < end) { var ch = text.charCodeAt(pos); - if (isIdentifierPart(ch)) { + if (isIdentifierPart(ch, languageVersion)) { pos++; } else if (ch === 92) { ch = peekUnicodeEscape(); - if (!(ch >= 0 && isIdentifierPart(ch))) { + if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) { break; } result += text.substring(start, pos); @@ -2469,7 +2556,7 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 67; + return token = 69; } function scanBinaryOrOctalDigits(base) { ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); @@ -2548,7 +2635,7 @@ var ts; } return pos += 2, token = 31; } - return pos++, token = 48; + return pos++, token = 49; case 34: case 39: tokenValue = scanString(); @@ -2557,42 +2644,48 @@ var ts; return token = scanTemplateAndSetTokenValue(); case 37: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 60; + return pos += 2, token = 62; } - return pos++, token = 39; + return pos++, token = 40; case 38: if (text.charCodeAt(pos + 1) === 38) { - return pos += 2, token = 50; + return pos += 2, token = 51; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 64; + return pos += 2, token = 66; } - return pos++, token = 45; + return pos++, token = 46; case 40: return pos++, token = 17; case 41: return pos++, token = 18; case 42: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 58; + return pos += 2, token = 59; + } + if (text.charCodeAt(pos + 1) === 42) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 60; + } + return pos += 2, token = 38; } return pos++, token = 37; case 43: if (text.charCodeAt(pos + 1) === 43) { - return pos += 2, token = 40; + return pos += 2, token = 41; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 56; + return pos += 2, token = 57; } return pos++, token = 35; case 44: return pos++, token = 24; case 45: if (text.charCodeAt(pos + 1) === 45) { - return pos += 2, token = 41; + return pos += 2, token = 42; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 57; + return pos += 2, token = 58; } return pos++, token = 36; case 46: @@ -2647,9 +2740,9 @@ var ts; } } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 59; + return pos += 2, token = 61; } - return pos++, token = 38; + return pos++, token = 39; case 48: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { pos += 2; @@ -2697,7 +2790,7 @@ var ts; tokenValue = "" + scanNumber(); return token = 8; case 58: - return pos++, token = 53; + return pos++, token = 54; case 59: return pos++, token = 23; case 60: @@ -2712,14 +2805,16 @@ var ts; } if (text.charCodeAt(pos + 1) === 60) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 61; + return pos += 3, token = 63; } - return pos += 2, token = 42; + return pos += 2, token = 43; } if (text.charCodeAt(pos + 1) === 61) { return pos += 2, token = 28; } - if (text.charCodeAt(pos + 1) === 47 && languageVariant === 1) { + if (languageVariant === 1 && + text.charCodeAt(pos + 1) === 47 && + text.charCodeAt(pos + 2) !== 42) { return pos += 2, token = 26; } return pos++, token = 25; @@ -2742,7 +2837,7 @@ var ts; if (text.charCodeAt(pos + 1) === 62) { return pos += 2, token = 34; } - return pos++, token = 55; + return pos++, token = 56; case 62: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2755,35 +2850,35 @@ var ts; } return pos++, token = 27; case 63: - return pos++, token = 52; + return pos++, token = 53; case 91: return pos++, token = 19; case 93: return pos++, token = 20; case 94: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 66; + return pos += 2, token = 68; } - return pos++, token = 47; + return pos++, token = 48; case 123: return pos++, token = 15; case 124: if (text.charCodeAt(pos + 1) === 124) { - return pos += 2, token = 51; + return pos += 2, token = 52; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 65; + return pos += 2, token = 67; } - return pos++, token = 46; + return pos++, token = 47; case 125: return pos++, token = 16; case 126: - return pos++, token = 49; + return pos++, token = 50; case 64: - return pos++, token = 54; + return pos++, token = 55; case 92: var cookedChar = peekUnicodeEscape(); - if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { + if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { pos += 6; tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); return token = getIdentifierToken(); @@ -2791,9 +2886,9 @@ var ts; error(ts.Diagnostics.Invalid_character); return pos++, token = 0; default: - if (isIdentifierStart(ch)) { + if (isIdentifierStart(ch, languageVersion)) { pos++; - while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos))) + while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion)) pos++; tokenValue = text.substring(tokenPos, pos); if (ch === 92) { @@ -2820,14 +2915,14 @@ var ts; if (text.charCodeAt(pos) === 62) { if (text.charCodeAt(pos + 1) === 62) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 63; + return pos += 3, token = 65; } - return pos += 2, token = 44; + return pos += 2, token = 45; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 62; + return pos += 2, token = 64; } - return pos++, token = 43; + return pos++, token = 44; } if (text.charCodeAt(pos) === 61) { return pos++, token = 29; @@ -2836,7 +2931,7 @@ var ts; return token; } function reScanSlashToken() { - if (token === 38 || token === 59) { + if (token === 39 || token === 61) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -2870,7 +2965,7 @@ var ts; } p++; } - while (p < end && isIdentifierPart(text.charCodeAt(p))) { + while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) { p++; } pos = p; @@ -2913,14 +3008,14 @@ var ts; break; } } - return token = 234; + return token = 236; } function scanJsxIdentifier() { - if (token === 67) { + if (tokenIsIdentifierOrKeyword(token)) { var firstCharPosition = pos; while (pos < end) { var ch = text.charCodeAt(pos); - if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch) : isIdentifierPart(ch))) { + if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) { pos++; } else { @@ -2983,10 +3078,6 @@ var ts; } ts.createScanner = createScanner; })(ts || (ts = {})); -/// -/// -/// -/// var ts; (function (ts) { ts.optionDeclarations = [ @@ -3059,11 +3150,13 @@ var ts; "commonjs": 1, "amd": 2, "system": 4, - "umd": 3 + "umd": 3, + "es6": 5, + "es2015": 5 }, - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_or_umd, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6, paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd + error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6 }, { name: "newLine", @@ -3187,7 +3280,12 @@ var ts; { name: "target", shortName: "t", - type: { "es3": 0, "es5": 1, "es6": 2 }, + type: { + "es3": 0, + "es5": 1, + "es6": 2, + "es2015": 2 + }, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, paramType: ts.Diagnostics.VERSION, error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES6 @@ -3204,11 +3302,6 @@ var ts; type: "boolean", description: ts.Diagnostics.Watch_input_files }, - { - name: "experimentalAsyncFunctions", - type: "boolean", - description: ts.Diagnostics.Enables_experimental_support_for_ES7_async_functions - }, { name: "experimentalDecorators", type: "boolean", @@ -3341,18 +3434,18 @@ var ts; } } ts.parseCommandLine = parseCommandLine; - function readConfigFile(fileName) { + function readConfigFile(fileName, readFile) { var text = ""; try { - text = ts.sys.readFile(fileName); + text = readFile(fileName); } catch (e) { return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; } - return parseConfigFileText(fileName, text); + return parseConfigFileTextToJson(fileName, text); } ts.readConfigFile = readConfigFile; - function parseConfigFileText(fileName, jsonText) { + function parseConfigFileTextToJson(fileName, jsonText) { try { return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} }; } @@ -3360,8 +3453,8 @@ var ts; return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; } } - ts.parseConfigFileText = parseConfigFileText; - function parseConfigFile(json, host, basePath) { + ts.parseConfigFileTextToJson = parseConfigFileTextToJson; + function parseJsonConfigFileContent(json, host, basePath) { var errors = []; return { options: getCompilerOptions(), @@ -3395,6 +3488,9 @@ var ts; } if (opt.isFilePath) { value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } } options[opt.name] = value; } @@ -3443,9 +3539,8 @@ var ts; return fileNames; } } - ts.parseConfigFile = parseConfigFile; + ts.parseJsonConfigFileContent = parseJsonConfigFileContent; })(ts || (ts = {})); -/// var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { @@ -3479,7 +3574,8 @@ var ts; increaseIndent: function () { }, decreaseIndent: function () { }, clear: function () { return str = ""; }, - trackSymbol: function () { } + trackSymbol: function () { }, + reportInaccessibleThisError: function () { } }; } return stringWriters.pop(); @@ -3541,7 +3637,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 246) { + while (node && node.kind !== 248) { node = node.parent; } return node; @@ -3632,15 +3728,15 @@ var ts; return current; } switch (current.kind) { - case 246: + case 248: + case 220: + case 244: case 218: - case 242: - case 216: - case 197: - case 198: case 199: + case 200: + case 201: return current; - case 190: + case 192: if (!isFunctionLike(current.parent)) { return current; } @@ -3651,9 +3747,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 209 && + declaration.kind === 211 && declaration.parent && - declaration.parent.kind === 242; + declaration.parent.kind === 244; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3689,22 +3785,22 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 246: + case 248: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 209: - case 161: - case 212: - case 184: - case 213: - case 216: - case 215: - case 245: case 211: - case 171: + case 163: + case 214: + case 186: + case 215: + case 218: + case 217: + case 247: + case 213: + case 173: errorNode = node.name; break; } @@ -3726,11 +3822,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 215 && isConst(node); + return node.kind === 217 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 161 || isBindingPattern(node))) { + while (node && (node.kind === 163 || isBindingPattern(node))) { node = node.parent; } return node; @@ -3738,14 +3834,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 209) { + if (node.kind === 211) { node = node.parent; } - if (node && node.kind === 210) { + if (node && node.kind === 212) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 191) { + if (node && node.kind === 193) { flags |= node.flags; } return flags; @@ -3760,7 +3856,7 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 193 && node.expression.kind === 9; + return node.kind === 195 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -3768,7 +3864,7 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJsDocComments(node, sourceFileOfNode) { - var commentRanges = (node.kind === 136 || node.kind === 135) ? + var commentRanges = (node.kind === 138 || node.kind === 137) ? ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : getLeadingCommentRangesOfNode(node, sourceFileOfNode); return ts.filter(commentRanges, isJsDocComment); @@ -3780,69 +3876,71 @@ var ts; } ts.getJsDocComments = getJsDocComments; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (149 <= node.kind && node.kind <= 158) { + if (151 <= node.kind && node.kind <= 160) { return true; } switch (node.kind) { - case 115: - case 126: + case 117: case 128: - case 118: - case 129: + case 130: + case 120: + case 131: return true; - case 101: - return node.parent.kind !== 175; + case 103: + return node.parent.kind !== 177; case 9: - return node.parent.kind === 136; - case 186: + return node.parent.kind === 138; + case 188: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 67: - if (node.parent.kind === 133 && node.parent.right === node) { + case 69: + if (node.parent.kind === 135 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 164 && node.parent.name === node) { + else if (node.parent.kind === 166 && node.parent.name === node) { node = node.parent; } - case 133: - case 164: - ts.Debug.assert(node.kind === 67 || node.kind === 133 || node.kind === 164, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + ts.Debug.assert(node.kind === 69 || node.kind === 135 || node.kind === 166, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 135: + case 166: + case 97: var parent_1 = node.parent; - if (parent_1.kind === 152) { + if (parent_1.kind === 154) { return false; } - if (149 <= parent_1.kind && parent_1.kind <= 158) { + if (151 <= parent_1.kind && parent_1.kind <= 160) { return true; } switch (parent_1.kind) { - case 186: + case 188: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 135: + case 137: return node === parent_1.constraint; - case 139: - case 138: - case 136: - case 209: - return node === parent_1.type; - case 211: - case 171: - case 172: - case 142: case 141: case 140: - case 143: - case 144: + case 138: + case 211: return node === parent_1.type; + case 213: + case 173: + case 174: + case 144: + case 143: + case 142: case 145: case 146: + return node === parent_1.type; case 147: + case 148: + case 149: return node === parent_1.type; - case 169: + case 171: return node === parent_1.type; - case 166: - case 167: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; case 168: + case 169: + return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; + case 170: return false; } } @@ -3853,23 +3951,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 202: + case 204: return visitor(node); - case 218: - case 190: - case 194: - case 195: + case 220: + case 192: case 196: case 197: case 198: case 199: - case 203: - case 204: - case 239: - case 240: + case 200: + case 201: case 205: - case 207: + case 206: + case 241: case 242: + case 207: + case 209: + case 244: return ts.forEachChild(node, traverse); } } @@ -3879,23 +3977,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 182: + case 184: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } + case 217: case 215: - case 213: + case 218: case 216: case 214: - case 212: - case 184: + case 186: return; default: if (isFunctionLike(node)) { var name_6 = node.name; - if (name_6 && name_6.kind === 134) { + if (name_6 && name_6.kind === 136) { traverse(name_6.expression); return; } @@ -3910,14 +4008,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 161: - case 245: - case 136: - case 243: - case 139: + case 163: + case 247: case 138: - case 244: - case 209: + case 245: + case 141: + case 140: + case 246: + case 211: return true; } } @@ -3925,29 +4023,29 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 143 || node.kind === 144); + return node && (node.kind === 145 || node.kind === 146); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 212 || node.kind === 184); + return node && (node.kind === 214 || node.kind === 186); } ts.isClassLike = isClassLike; function isFunctionLike(node) { if (node) { switch (node.kind) { - case 142: - case 171: - case 211: - case 172: - case 141: - case 140: - case 143: case 144: + case 173: + case 213: + case 174: + case 143: + case 142: case 145: case 146: case 147: - case 150: - case 151: + case 148: + case 149: + case 152: + case 153: return true; } } @@ -3956,24 +4054,24 @@ var ts; ts.isFunctionLike = isFunctionLike; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 141: - case 140: - case 142: case 143: + case 142: case 144: - case 211: - case 171: + case 145: + case 146: + case 213: + case 173: return true; } return false; } ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isFunctionBlock(node) { - return node && node.kind === 190 && isFunctionLike(node.parent); + return node && node.kind === 192 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 141 && node.parent.kind === 163; + return node && node.kind === 143 && node.parent.kind === 165; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -4001,36 +4099,39 @@ var ts; return undefined; } switch (node.kind) { - case 134: + case 136: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 137: - if (node.parent.kind === 136 && isClassElement(node.parent.parent)) { + case 139: + if (node.parent.kind === 138 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 172: + case 174: if (!includeArrowFunctions) { continue; } - case 211: - case 171: - case 216: - case 139: - case 138: + case 213: + case 173: + case 218: case 141: case 140: - case 142: case 143: + case 142: case 144: - case 215: - case 246: + case 145: + case 146: + case 147: + case 148: + case 149: + case 217: + case 248: return node; } } @@ -4042,33 +4143,33 @@ var ts; if (!node) return node; switch (node.kind) { - case 134: + case 136: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 137: - if (node.parent.kind === 136 && isClassElement(node.parent.parent)) { + case 139: + if (node.parent.kind === 138 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 211: - case 171: - case 172: + case 213: + case 173: + case 174: if (!includeFunctions) { continue; } - case 139: - case 138: case 141: case 140: - case 142: case 143: + case 142: case 144: + case 145: + case 146: return node; } } @@ -4077,12 +4178,12 @@ var ts; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 149: + case 151: return node.typeName; - case 186: + case 188: return node.expression; - case 67: - case 133: + case 69: + case 135: return node; } } @@ -4090,7 +4191,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 168) { + if (node.kind === 170) { return node.tag; } return node.expression; @@ -4098,40 +4199,40 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 212: + case 214: return true; - case 139: - return node.parent.kind === 212; - case 136: - return node.parent.body && node.parent.parent.kind === 212; - case 143: - case 144: case 141: - return node.body && node.parent.kind === 212; + return node.parent.kind === 214; + case 138: + return node.parent.body && node.parent.parent.kind === 214; + case 145: + case 146: + case 143: + return node.body && node.parent.kind === 214; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 212: + case 214: if (node.decorators) { return true; } return false; - case 139: - case 136: - if (node.decorators) { - return true; - } - return false; - case 143: - if (node.body && node.decorators) { - return true; - } - return false; case 141: - case 144: + case 138: + if (node.decorators) { + return true; + } + return false; + case 145: + if (node.body && node.decorators) { + return true; + } + return false; + case 143: + case 146: if (node.body && node.decorators) { return true; } @@ -4142,10 +4243,10 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 212: + case 214: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 141: - case 144: + case 143: + case 146: return ts.forEach(node.parameters, nodeIsDecorated); } return false; @@ -4155,95 +4256,105 @@ var ts; return nodeIsDecorated(node) || childIsDecorated(node); } ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; + function isPropertyAccessExpression(node) { + return node.kind === 166; + } + ts.isPropertyAccessExpression = isPropertyAccessExpression; + function isElementAccessExpression(node) { + return node.kind === 167; + } + ts.isElementAccessExpression = isElementAccessExpression; function isExpression(node) { switch (node.kind) { case 95: case 93: - case 91: - case 97: - case 82: + case 99: + case 84: case 10: - case 162: - case 163: case 164: case 165: case 166: case 167: case 168: - case 187: case 169: case 170: + case 189: case 171: - case 184: case 172: - case 175: case 173: + case 186: case 174: case 177: - case 178: + case 175: + case 176: case 179: case 180: - case 183: case 181: - case 11: - case 185: - case 231: - case 232: case 182: + case 185: + case 183: + case 11: + case 187: + case 233: + case 234: + case 184: + case 178: return true; - case 133: - while (node.parent.kind === 133) { + case 135: + while (node.parent.kind === 135) { node = node.parent; } - return node.parent.kind === 152; - case 67: - if (node.parent.kind === 152) { + return node.parent.kind === 154; + case 69: + if (node.parent.kind === 154) { return true; } case 8: case 9: + case 97: var parent_2 = node.parent; switch (parent_2.kind) { - case 209: - case 136: - case 139: + case 211: case 138: + case 141: + case 140: + case 247: case 245: - case 243: - case 161: + case 163: return parent_2.initializer === node; - case 193: - case 194: case 195: case 196: - case 202: - case 203: - case 204: - case 239: - case 206: - case 204: - return parent_2.expression === node; case 197: + case 198: + case 204: + case 205: + case 206: + case 241: + case 208: + case 206: + return parent_2.expression === node; + case 199: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 210) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 212) || forStatement.condition === node || forStatement.incrementor === node; - case 198: - case 199: + case 200: + case 201: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 210) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 212) || forInStatement.expression === node; - case 169: - case 187: + case 171: + case 189: return node === parent_2.expression; - case 188: + case 190: return node === parent_2.expression; - case 134: + case 136: return node === parent_2.expression; - case 137: - case 238: + case 139: + case 240: + case 239: return true; - case 186: + case 188: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -4254,6 +4365,10 @@ var ts; return false; } ts.isExpression = isExpression; + function isExternalModuleNameRelative(moduleName) { + return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; + } + ts.isExternalModuleNameRelative = isExternalModuleNameRelative; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); return moduleState === 1 || @@ -4261,7 +4376,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 219 && node.moduleReference.kind === 230; + return node.kind === 221 && node.moduleReference.kind === 232; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4270,20 +4385,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 219 && node.moduleReference.kind !== 230; + return node.kind === 221 && node.moduleReference.kind !== 232; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 220) { + if (node.kind === 222) { return node.moduleSpecifier; } - if (node.kind === 219) { + if (node.kind === 221) { var reference = node.moduleReference; - if (reference.kind === 230) { + if (reference.kind === 232) { return reference.expression; } } - if (node.kind === 226) { + if (node.kind === 228) { return node.moduleSpecifier; } } @@ -4291,13 +4406,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 136: + case 138: + case 143: + case 142: + case 246: + case 245: case 141: case 140: - case 244: - case 243: - case 139: - case 138: return node.questionToken !== undefined; } } @@ -4305,9 +4420,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 259 && + return node.kind === 261 && node.parameters.length > 0 && - node.parameters[0].type.kind === 261; + node.parameters[0].type.kind === 263; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getJSDocTag(node, kind) { @@ -4321,24 +4436,24 @@ var ts; } } function getJSDocTypeTag(node) { - return getJSDocTag(node, 267); + return getJSDocTag(node, 269); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 266); + return getJSDocTag(node, 268); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 268); + return getJSDocTag(node, 270); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 67) { + if (parameter.name && parameter.name.kind === 69) { var parameterName = parameter.name.text; var docComment = parameter.parent.jsDocComment; if (docComment) { return ts.forEach(docComment.tags, function (t) { - if (t.kind === 265) { + if (t.kind === 267) { var parameterTag = t; var name_7 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_7.text === parameterName) { @@ -4357,12 +4472,12 @@ var ts; function isRestParameter(node) { if (node) { if (node.parserContextFlags & 32) { - if (node.type && node.type.kind === 260) { + if (node.type && node.type.kind === 262) { return true; } var paramTag = getCorrespondingJSDocParameterTag(node); if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 260; + return paramTag.typeExpression.type.kind === 262; } } return node.dotDotDotToken !== undefined; @@ -4383,9 +4498,18 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 160 || node.kind === 159); + return !!node && (node.kind === 162 || node.kind === 161); } ts.isBindingPattern = isBindingPattern; + function isNodeDescendentOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + ts.isNodeDescendentOf = isNodeDescendentOf; function isInAmbientContext(node) { while (node) { if (node.flags & (2 | 8192)) { @@ -4398,34 +4522,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 172: - case 161: - case 212: - case 184: - case 142: - case 215: - case 245: - case 228: - case 211: - case 171: - case 143: - case 221: - case 219: - case 224: + case 174: + case 163: + case 214: + case 186: + case 144: + case 217: + case 247: + case 230: case 213: + case 173: + case 145: + case 223: + case 221: + case 226: + case 215: + case 143: + case 142: + case 218: + case 224: + case 138: + case 245: case 141: case 140: + case 146: + case 246: case 216: - case 222: - case 136: - case 243: - case 139: - case 138: - case 144: - case 244: - case 214: - case 135: - case 209: + case 137: + case 211: return true; } return false; @@ -4433,25 +4557,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 201: - case 200: - case 208: - case 195: - case 193: - case 192: - case 198: - case 199: - case 197: - case 194: - case 205: - case 202: - case 204: - case 96: - case 207: - case 191: - case 196: case 203: - case 225: + case 202: + case 210: + case 197: + case 195: + case 194: + case 200: + case 201: + case 199: + case 196: + case 207: + case 204: + case 206: + case 98: + case 209: + case 193: + case 198: + case 205: + case 227: return true; default: return false; @@ -4460,13 +4584,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 142: - case 139: + case 144: case 141: case 143: - case 144: - case 140: - case 147: + case 145: + case 146: + case 142: + case 149: return true; default: return false; @@ -4474,11 +4598,11 @@ var ts; } ts.isClassElement = isClassElement; function isDeclarationName(name) { - if (name.kind !== 67 && name.kind !== 9 && name.kind !== 8) { + if (name.kind !== 69 && name.kind !== 9 && name.kind !== 8) { return false; } var parent = name.parent; - if (parent.kind === 224 || parent.kind === 228) { + if (parent.kind === 226 || parent.kind === 230) { if (parent.propertyName) { return true; } @@ -4492,54 +4616,54 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 139: - case 138: case 141: case 140: case 143: - case 144: + case 142: + case 145: + case 146: + case 247: case 245: - case 243: - case 164: + case 166: return parent.name === node; - case 133: + case 135: if (parent.right === node) { - while (parent.kind === 133) { + while (parent.kind === 135) { parent = parent.parent; } - return parent.kind === 152; + return parent.kind === 154; } return false; - case 161: - case 224: + case 163: + case 226: return parent.propertyName === node; - case 228: + case 230: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 219 || - node.kind === 221 && !!node.name || - node.kind === 222 || + return node.kind === 221 || + node.kind === 223 && !!node.name || node.kind === 224 || - node.kind === 228 || - node.kind === 225 && node.expression.kind === 67; + node.kind === 226 || + node.kind === 230 || + node.kind === 227 && node.expression.kind === 69; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 81); + var heritageClause = getHeritageClause(node.heritageClauses, 83); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; function getClassImplementsHeritageClauseElements(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 104); + var heritageClause = getHeritageClause(node.heritageClauses, 106); return heritageClause ? heritageClause.types : undefined; } ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 81); + var heritageClause = getHeritageClause(node.heritageClauses, 83); return heritageClause ? heritageClause.types : undefined; } ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; @@ -4608,7 +4732,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 68 <= token && token <= 132; + return 70 <= token && token <= 134; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -4621,19 +4745,19 @@ var ts; ts.isAsyncFunctionLike = isAsyncFunctionLike; function hasDynamicName(declaration) { return declaration.name && - declaration.name.kind === 134 && + declaration.name.kind === 136 && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { - return node.kind === 164 && isESSymbolIdentifier(node.expression); + return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression); } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 67 || name.kind === 9 || name.kind === 8) { + if (name.kind === 69 || name.kind === 9 || name.kind === 8) { return name.text; } - if (name.kind === 134) { + if (name.kind === 136) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -4648,21 +4772,21 @@ var ts; } ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; function isESSymbolIdentifier(node) { - return node.kind === 67 && node.text === "Symbol"; + return node.kind === 69 && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; function isModifier(token) { switch (token) { - case 113: - case 116: - case 72: - case 120: - case 75: - case 80: + case 115: + case 118: + case 74: + case 122: + case 77: + case 82: + case 112: case 110: - case 108: - case 109: case 111: + case 113: return true; } return false; @@ -4670,28 +4794,28 @@ var ts; ts.isModifier = isModifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 136; + return root.kind === 138; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 161) { + while (node.kind === 163) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 216 || n.kind === 246; + return isFunctionLike(n) || n.kind === 218 || n.kind === 248; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function cloneEntityName(node) { - if (node.kind === 67) { - var clone_1 = createSynthesizedNode(67); + if (node.kind === 69) { + var clone_1 = createSynthesizedNode(69); clone_1.text = node.text; return clone_1; } else { - var clone_2 = createSynthesizedNode(133); + var clone_2 = createSynthesizedNode(135); clone_2.left = cloneEntityName(node.left); clone_2.left.parent = clone_2; clone_2.right = cloneEntityName(node.right); @@ -4934,7 +5058,7 @@ var ts; ts.getLineOfLocalPosition = getLineOfLocalPosition; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 142 && nodeIsPresent(member.body)) { + if (member.kind === 144 && nodeIsPresent(member.body)) { return member; } }); @@ -4961,10 +5085,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 143) { + if (accessor.kind === 145) { getAccessor = accessor; } - else if (accessor.kind === 144) { + else if (accessor.kind === 146) { setAccessor = accessor; } else { @@ -4973,7 +5097,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 143 || member.kind === 144) + if ((member.kind === 145 || member.kind === 146) && (member.flags & 128) === (accessor.flags & 128)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -4984,10 +5108,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 143 && !getAccessor) { + if (member.kind === 145 && !getAccessor) { getAccessor = member; } - if (member.kind === 144 && !setAccessor) { + if (member.kind === 146 && !setAccessor) { setAccessor = member; } } @@ -5093,16 +5217,16 @@ var ts; ts.writeCommentRange = writeCommentRange; function modifierToFlag(token) { switch (token) { - case 111: return 128; - case 110: return 16; - case 109: return 64; - case 108: return 32; - case 113: return 256; - case 80: return 1; - case 120: return 2; - case 72: return 32768; - case 75: return 1024; - case 116: return 512; + case 113: return 128; + case 112: return 16; + case 111: return 64; + case 110: return 32; + case 115: return 256; + case 82: return 1; + case 122: return 2; + case 74: return 32768; + case 77: return 1024; + case 118: return 512; } return 0; } @@ -5110,29 +5234,29 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 164: - case 165: - case 167: case 166: - case 231: - case 232: + case 167: + case 169: case 168: - case 162: + case 233: + case 234: case 170: - case 163: - case 184: - case 171: - case 67: + case 164: + case 172: + case 165: + case 186: + case 173: + case 69: case 10: case 8: case 9: case 11: - case 181: - case 82: - case 91: - case 95: - case 97: + case 183: + case 84: case 93: + case 97: + case 99: + case 95: return true; } } @@ -5140,12 +5264,12 @@ var ts; } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isAssignmentOperator(token) { - return token >= 55 && token <= 66; + return token >= 56 && token <= 68; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 186 && - node.parent.token === 81 && + return node.kind === 188 && + node.parent.token === 83 && isClassLike(node.parent.parent); } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; @@ -5154,10 +5278,10 @@ var ts; } ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; function isSupportedExpressionWithTypeArgumentsRest(node) { - if (node.kind === 67) { + if (node.kind === 69) { return true; } - else if (node.kind === 164) { + else if (isPropertyAccessExpression(node)) { return isSupportedExpressionWithTypeArgumentsRest(node.expression); } else { @@ -5165,16 +5289,16 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 133 && node.parent.right === node) || - (node.parent.kind === 164 && node.parent.name === node); + return (node.parent.kind === 135 && node.parent.right === node) || + (node.parent.kind === 166 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 163) { + if (kind === 165) { return expression.properties.length === 0; } - if (kind === 162) { + if (kind === 164) { return expression.elements.length === 0; } return false; @@ -5383,21 +5507,29 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 135) { + if (d && d.kind === 137) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 213) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 215) { return current; } } } } ts.getTypeParameterOwner = getTypeParameterOwner; + function arrayStructurallyIsEqualTo(array1, array2) { + if (!array1 || !array2) { + return false; + } + if (array1.length !== array2.length) { + return false; + } + return ts.arrayIsEqualTo(array1.sort(), array2.sort()); + } + ts.arrayStructurallyIsEqualTo = arrayStructurallyIsEqualTo; })(ts || (ts = {})); -/// -/// var ts; (function (ts) { - var nodeConstructors = new Array(270); + var nodeConstructors = new Array(272); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -5435,20 +5567,26 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 133: + case 135: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 135: + case 137: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 136: - case 139: + case 246: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); case 138: - case 243: - case 244: - case 209: - case 161: + case 141: + case 140: + case 245: + case 211: + case 163: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -5457,24 +5595,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 150: - case 151: - case 145: - case 146: + case 152: + case 153: case 147: + case 148: + case 149: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 141: - case 140: - case 142: case 143: + case 142: case 144: - case 171: - case 211: - case 172: + case 145: + case 146: + case 173: + case 213: + case 174: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -5485,290 +5623,290 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 149: + case 151: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 148: + case 150: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 152: - return visitNode(cbNode, node.exprName); - case 153: - return visitNodes(cbNodes, node.members); case 154: - return visitNode(cbNode, node.elementType); + return visitNode(cbNode, node.exprName); case 155: - return visitNodes(cbNodes, node.elementTypes); + return visitNodes(cbNodes, node.members); case 156: + return visitNode(cbNode, node.elementType); case 157: - return visitNodes(cbNodes, node.types); + return visitNodes(cbNodes, node.elementTypes); case 158: - return visitNode(cbNode, node.type); case 159: + return visitNodes(cbNodes, node.types); case 160: - return visitNodes(cbNodes, node.elements); + return visitNode(cbNode, node.type); + case 161: case 162: return visitNodes(cbNodes, node.elements); - case 163: - return visitNodes(cbNodes, node.properties); case 164: + return visitNodes(cbNodes, node.elements); + case 165: + return visitNodes(cbNodes, node.properties); + case 166: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 165: + case 167: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 166: - case 167: + case 168: + case 169: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 168: + case 170: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 169: + case 171: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 170: - return visitNode(cbNode, node.expression); - case 173: - return visitNode(cbNode, node.expression); - case 174: + case 172: return visitNode(cbNode, node.expression); case 175: return visitNode(cbNode, node.expression); - case 177: - return visitNode(cbNode, node.operand); - case 182: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 176: return visitNode(cbNode, node.expression); - case 178: - return visitNode(cbNode, node.operand); + case 177: + return visitNode(cbNode, node.expression); case 179: + return visitNode(cbNode, node.operand); + case 184: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 178: + return visitNode(cbNode, node.expression); + case 180: + return visitNode(cbNode, node.operand); + case 181: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 187: + case 189: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 180: + case 182: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 183: + case 185: return visitNode(cbNode, node.expression); - case 190: - case 217: + case 192: + case 219: return visitNodes(cbNodes, node.statements); - case 246: + case 248: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 191: + case 193: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 210: + case 212: return visitNodes(cbNodes, node.declarations); - case 193: + case 195: return visitNode(cbNode, node.expression); - case 194: + case 196: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 195: + case 197: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 196: + case 198: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 197: + case 199: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 198: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 199: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); case 200: - case 201: - return visitNode(cbNode, node.label); - case 202: - return visitNode(cbNode, node.expression); - case 203: - return visitNode(cbNode, node.expression) || + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 201: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 202: + case 203: + return visitNode(cbNode, node.label); case 204: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 218: - return visitNodes(cbNodes, node.clauses); - case 239: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); - case 240: - return visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.expression); case 205: - return visitNode(cbNode, node.label) || + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 206: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + case 220: + return visitNodes(cbNodes, node.clauses); + case 241: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 242: + return visitNodes(cbNodes, node.statements); case 207: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 208: + return visitNode(cbNode, node.expression); + case 209: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 242: + case 244: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 137: + case 139: return visitNode(cbNode, node.expression); - case 212: - case 184: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); - case 213: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); case 214: + case 186: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 215: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 245: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); case 216: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + case 217: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 247: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 218: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 219: + case 221: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 220: + case 222: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 221: + case 223: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 222: + case 224: return visitNode(cbNode, node.name); - case 223: - case 227: + case 225: + case 229: return visitNodes(cbNodes, node.elements); - case 226: + case 228: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 224: - case 228: + case 226: + case 230: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 225: + case 227: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 181: + case 183: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 188: + case 190: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 134: + case 136: return visitNode(cbNode, node.expression); - case 241: + case 243: return visitNodes(cbNodes, node.types); - case 186: + case 188: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 230: + case 232: return visitNode(cbNode, node.expression); - case 229: - return visitNodes(cbNodes, node.decorators); case 231: + return visitNodes(cbNodes, node.decorators); + case 233: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 232: - case 233: + case 234: + case 235: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 236: + case 238: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); + case 239: + return visitNode(cbNode, node.expression); + case 240: + return visitNode(cbNode, node.expression); case 237: - return visitNode(cbNode, node.expression); - case 238: - return visitNode(cbNode, node.expression); - case 235: return visitNode(cbNode, node.tagName); - case 247: - return visitNode(cbNode, node.type); - case 251: - return visitNodes(cbNodes, node.types); - case 252: - return visitNodes(cbNodes, node.types); - case 250: - return visitNode(cbNode, node.elementType); - case 254: + case 249: return visitNode(cbNode, node.type); case 253: + return visitNodes(cbNodes, node.types); + case 254: + return visitNodes(cbNodes, node.types); + case 252: + return visitNode(cbNode, node.elementType); + case 256: return visitNode(cbNode, node.type); case 255: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.type); case 257: + return visitNodes(cbNodes, node.members); + case 259: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 258: - return visitNode(cbNode, node.type); - case 259: - return visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); case 260: return visitNode(cbNode, node.type); case 261: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); case 262: return visitNode(cbNode, node.type); - case 256: + case 263: + return visitNode(cbNode, node.type); + case 264: + return visitNode(cbNode, node.type); + case 258: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 263: - return visitNodes(cbNodes, node.tags); case 265: + return visitNodes(cbNodes, node.tags); + case 267: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 266: - return visitNode(cbNode, node.typeExpression); - case 267: - return visitNode(cbNode, node.typeExpression); case 268: + return visitNode(cbNode, node.typeExpression); + case 269: + return visitNode(cbNode, node.typeExpression); + case 270: return visitNodes(cbNodes, node.typeParameters); } } @@ -5864,9 +6002,9 @@ var ts; return; function visit(node) { switch (node.kind) { - case 191: - case 211: - case 136: + case 193: + case 213: + case 138: addJSDocComment(node); } forEachChild(node, visit); @@ -5885,10 +6023,6 @@ var ts; } } function fixupParentReferences(sourceFile) { - // normally parent references are set during binding. However, for clients that only need - // a syntax tree, and no semantic features, then the binding process is an unnecessary - // overhead. This functions allows us to set all the parents, without all the expense of - // binding. var parent = sourceFile; forEachChild(sourceFile, visitNode); return; @@ -5904,7 +6038,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion) { - var sourceFile = createNode(246, 0); + var sourceFile = createNode(248, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -6063,16 +6197,16 @@ var ts; return speculationHelper(callback, false); } function isIdentifier() { - if (token === 67) { + if (token === 69) { return true; } - if (token === 112 && inYieldContext()) { + if (token === 114 && inYieldContext()) { return false; } - if (token === 117 && inAwaitContext()) { + if (token === 119 && inAwaitContext()) { return false; } - return token > 103; + return token > 105; } function parseExpected(kind, diagnosticMessage, shouldAdvance) { if (shouldAdvance === void 0) { shouldAdvance = true; } @@ -6168,24 +6302,24 @@ var ts; function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; if (isIdentifier) { - var node = createNode(67); - if (token !== 67) { + var node = createNode(69); + if (token !== 69) { node.originalKeywordKind = token; } node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); } - return createMissingNode(67, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + return createMissingNode(69, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); } function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage); } function parseIdentifierName() { - return createIdentifier(isIdentifierOrKeyword()); + return createIdentifier(ts.tokenIsIdentifierOrKeyword(token)); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || + return ts.tokenIsIdentifierOrKeyword(token) || token === 9 || token === 8; } @@ -6205,10 +6339,10 @@ var ts; return parsePropertyNameWorker(false); } function isSimplePropertyName() { - return token === 9 || token === 8 || isIdentifierOrKeyword(); + return token === 9 || token === 8 || ts.tokenIsIdentifierOrKeyword(token); } function parseComputedPropertyName() { - var node = createNode(134); + var node = createNode(136); parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); @@ -6218,20 +6352,27 @@ var ts; return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - if (token === 72) { - return nextToken() === 79; + if (token === 74) { + return nextToken() === 81; } - if (token === 80) { + if (token === 82) { nextToken(); - if (token === 75) { + if (token === 77) { return lookAhead(nextTokenIsClassOrFunction); } return token !== 37 && token !== 15 && canFollowModifier(); } - if (token === 75) { + if (token === 77) { return nextTokenIsClassOrFunction(); } + if (token === 113) { + nextToken(); + return canFollowModifier(); + } nextToken(); + if (scanner.hasPrecedingLineBreak()) { + return false; + } return canFollowModifier(); } function parseAnyContextualModifier() { @@ -6245,7 +6386,7 @@ var ts; } function nextTokenIsClassOrFunction() { nextToken(); - return token === 71 || token === 85; + return token === 73 || token === 87; } function isListElement(parsingContext, inErrorRecovery) { var node = currentNode(parsingContext); @@ -6258,7 +6399,7 @@ var ts; case 3: return !(token === 23 && inErrorRecovery) && isStartOfStatement(); case 2: - return token === 69 || token === 75; + return token === 71 || token === 77; case 4: return isStartOfTypeMember(); case 5: @@ -6296,9 +6437,9 @@ var ts; case 20: return isHeritageClause(); case 21: - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); case 13: - return isIdentifierOrKeyword() || token === 15; + return ts.tokenIsIdentifierOrKeyword(token) || token === 15; case 14: return true; case 22: @@ -6314,7 +6455,7 @@ var ts; ts.Debug.assert(token === 15); if (nextToken() === 16) { var next = nextToken(); - return next === 24 || next === 15 || next === 81 || next === 104; + return next === 24 || next === 15 || next === 83 || next === 106; } return true; } @@ -6324,11 +6465,11 @@ var ts; } function nextTokenIsIdentifierOrKeyword() { nextToken(); - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); } function isHeritageClauseExtendsOrImplementsKeyword() { - if (token === 104 || - token === 81) { + if (token === 106 || + token === 83) { return lookAhead(nextTokenIsStartOfExpression); } return false; @@ -6352,13 +6493,13 @@ var ts; case 21: return token === 16; case 3: - return token === 16 || token === 69 || token === 75; + return token === 16 || token === 71 || token === 77; case 7: - return token === 15 || token === 81 || token === 104; + return token === 15 || token === 83 || token === 106; case 8: return isVariableDeclaratorListTerminator(); case 17: - return token === 27 || token === 17 || token === 15 || token === 81 || token === 104; + return token === 27 || token === 17 || token === 15 || token === 83 || token === 106; case 11: return token === 18 || token === 23; case 15: @@ -6372,11 +6513,11 @@ var ts; case 20: return token === 15 || token === 16; case 13: - return token === 27 || token === 38; + return token === 27 || token === 39; case 14: return token === 25 && lookAhead(nextTokenIsSlash); case 22: - return token === 18 || token === 53 || token === 16; + return token === 18 || token === 54 || token === 16; case 23: return token === 27 || token === 16; case 25: @@ -6497,17 +6638,17 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 142: - case 147: - case 143: case 144: - case 139: - case 189: - return true; + case 149: + case 145: + case 146: case 141: + case 191: + return true; + case 143: var methodDeclaration = node; - var nameIsConstructor = methodDeclaration.name.kind === 67 && - methodDeclaration.name.originalKeywordKind === 119; + var nameIsConstructor = methodDeclaration.name.kind === 69 && + methodDeclaration.name.originalKeywordKind === 121; return !nameIsConstructor; } } @@ -6516,8 +6657,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 239: - case 240: + case 241: + case 242: return true; } } @@ -6526,65 +6667,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 211: - case 191: - case 190: - case 194: + case 213: case 193: - case 206: - case 202: - case 204: - case 201: - case 200: - case 198: - case 199: - case 197: - case 196: - case 203: case 192: - case 207: - case 205: + case 196: case 195: case 208: - case 220: - case 219: - case 226: - case 225: - case 216: - case 212: - case 213: - case 215: + case 204: + case 206: + case 203: + case 202: + case 200: + case 201: + case 199: + case 198: + case 205: + case 194: + case 209: + case 207: + case 197: + case 210: + case 222: + case 221: + case 228: + case 227: + case 218: case 214: + case 215: + case 217: + case 216: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 245; + return node.kind === 247; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 146: + case 148: + case 142: + case 149: case 140: case 147: - case 138: - case 145: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 209) { + if (node.kind !== 211) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 136) { + if (node.kind !== 138) { return false; } var parameter = node; @@ -6684,7 +6825,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(21)) { - var node = createNode(133, entity.pos); + var node = createNode(135, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -6692,16 +6833,16 @@ var ts; return entity; } function parseRightSideOfDot(allowIdentifierNames) { - if (scanner.hasPrecedingLineBreak() && isIdentifierOrKeyword()) { + if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token)) { var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) { - return createMissingNode(67, true, ts.Diagnostics.Identifier_expected); + return createMissingNode(69, true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(181); + var template = createNode(183); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 12, "Template head has wrong token kind"); var templateSpans = []; @@ -6714,7 +6855,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(188); + var span = createNode(190); span.expression = allowInAnd(parseExpression); var literal; if (token === 16) { @@ -6749,14 +6890,14 @@ var ts; } function parseTypeReferenceOrTypePredicate() { var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - if (typeName.kind === 67 && token === 122 && !scanner.hasPrecedingLineBreak()) { + if (typeName.kind === 69 && token === 124 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var node_1 = createNode(148, typeName.pos); + var node_1 = createNode(150, typeName.pos); node_1.parameterName = typeName; node_1.type = parseType(); return finishNode(node_1); } - var node = createNode(149, typeName.pos); + var node = createNode(151, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); @@ -6764,15 +6905,15 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(152); - parseExpected(99); + var node = createNode(154); + parseExpected(101); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(135); + var node = createNode(137); node.name = parseIdentifier(); - if (parseOptional(81)) { + if (parseOptional(83)) { if (isStartOfType() || !isStartOfExpression()) { node.constraint = parseType(); } @@ -6788,7 +6929,7 @@ var ts; } } function parseParameterType() { - if (parseOptional(53)) { + if (parseOptional(54)) { return token === 9 ? parseLiteralNode(true) : parseType(); @@ -6796,7 +6937,7 @@ var ts; return undefined; } function isStartOfParameter() { - return token === 22 || isIdentifierOrPattern() || ts.isModifier(token) || token === 54; + return token === 22 || isIdentifierOrPattern() || ts.isModifier(token) || token === 55; } function setModifiers(node, modifiers) { if (modifiers) { @@ -6805,7 +6946,7 @@ var ts; } } function parseParameter() { - var node = createNode(136); + var node = createNode(138); node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(22); @@ -6813,7 +6954,7 @@ var ts; if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { nextToken(); } - node.questionToken = parseOptionalToken(52); + node.questionToken = parseOptionalToken(53); node.type = parseParameterType(); node.initializer = parseBindingElementInitializer(true); return finishNode(node); @@ -6860,10 +7001,10 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 146) { - parseExpected(90); + if (kind === 148) { + parseExpected(92); } - fillSignature(53, false, false, false, node); + fillSignature(54, false, false, false, node); parseTypeMemberSemicolon(); return finishNode(node); } @@ -6890,17 +7031,17 @@ var ts; else { nextToken(); } - if (token === 53 || token === 24) { + if (token === 54 || token === 24) { return true; } - if (token !== 52) { + if (token !== 53) { return false; } nextToken(); - return token === 53 || token === 24 || token === 20; + return token === 54 || token === 24 || token === 20; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(147, fullStart); + var node = createNode(149, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(16, parseParameter, 19, 20); @@ -6911,17 +7052,17 @@ var ts; function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); var name = parsePropertyName(); - var questionToken = parseOptionalToken(52); + var questionToken = parseOptionalToken(53); if (token === 17 || token === 25) { - var method = createNode(140, fullStart); + var method = createNode(142, fullStart); method.name = name; method.questionToken = questionToken; - fillSignature(53, false, false, false, method); + fillSignature(54, false, false, false, method); parseTypeMemberSemicolon(); return finishNode(method); } else { - var property = createNode(138, fullStart); + var property = createNode(140, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -6955,22 +7096,22 @@ var ts; nextToken(); return token === 17 || token === 25 || - token === 52 || token === 53 || + token === 54 || canParseSemicolon(); } function parseTypeMember() { switch (token) { case 17: case 25: - return parseSignatureMember(145); + return parseSignatureMember(147); case 19: return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) : parsePropertyOrMethodSignature(); - case 90: + case 92: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(146); + return parseSignatureMember(148); } case 9: case 8: @@ -6982,7 +7123,7 @@ var ts; return result; } } - if (isIdentifierOrKeyword()) { + if (ts.tokenIsIdentifierOrKeyword(token)) { return parsePropertyOrMethodSignature(); } } @@ -7000,7 +7141,7 @@ var ts; return token === 17 || token === 25; } function parseTypeLiteral() { - var node = createNode(153); + var node = createNode(155); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -7016,12 +7157,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(155); + var node = createNode(157); node.elementTypes = parseBracketedList(19, parseType, 19, 20); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(158); + var node = createNode(160); parseExpected(17); node.type = parseType(); parseExpected(18); @@ -7029,8 +7170,8 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 151) { - parseExpected(90); + if (kind === 153) { + parseExpected(92); } fillSignature(34, false, false, false, node); return finishNode(node); @@ -7041,16 +7182,17 @@ var ts; } function parseNonArrayType() { switch (token) { - case 115: + case 117: + case 130: case 128: - case 126: - case 118: - case 129: + case 120: + case 131: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); - case 101: + case 103: + case 97: return parseTokenNode(); - case 99: + case 101: return parseTypeQuery(); case 15: return parseTypeLiteral(); @@ -7064,17 +7206,18 @@ var ts; } function isStartOfType() { switch (token) { - case 115: + case 117: + case 130: case 128: - case 126: - case 118: - case 129: + case 120: + case 131: + case 103: + case 97: case 101: - case 99: case 15: case 19: case 25: - case 90: + case 92: return true; case 17: return lookAhead(isStartOfParenthesizedOrFunctionType); @@ -7090,7 +7233,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(19)) { parseExpected(20); - var node = createNode(154, type.pos); + var node = createNode(156, type.pos); node.elementType = type; type = finishNode(node); } @@ -7112,10 +7255,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(157, parseArrayTypeOrHigher, 45); + return parseUnionOrIntersectionType(159, parseArrayTypeOrHigher, 46); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(156, parseIntersectionTypeOrHigher, 46); + return parseUnionOrIntersectionType(158, parseIntersectionTypeOrHigher, 47); } function isStartOfFunctionType() { if (token === 25) { @@ -7130,8 +7273,8 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 53 || token === 24 || - token === 52 || token === 55 || + if (token === 54 || token === 24 || + token === 53 || token === 56 || isIdentifier() || ts.isModifier(token)) { return true; } @@ -7149,23 +7292,23 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(150); + return parseFunctionOrConstructorType(152); } - if (token === 90) { - return parseFunctionOrConstructorType(151); + if (token === 92) { + return parseFunctionOrConstructorType(153); } return parseUnionTypeOrHigher(); } function parseTypeAnnotation() { - return parseOptional(53) ? parseType() : undefined; + return parseOptional(54) ? parseType() : undefined; } function isStartOfLeftHandSideExpression() { switch (token) { + case 97: case 95: case 93: - case 91: - case 97: - case 82: + case 99: + case 84: case 8: case 9: case 11: @@ -7173,12 +7316,12 @@ var ts; case 17: case 19: case 15: - case 85: - case 71: - case 90: - case 38: - case 59: - case 67: + case 87: + case 73: + case 92: + case 39: + case 61: + case 69: return true; default: return isIdentifier(); @@ -7191,16 +7334,16 @@ var ts; switch (token) { case 35: case 36: + case 50: case 49: - case 48: - case 76: - case 99: + case 78: case 101: - case 40: + case 103: case 41: + case 42: case 25: - case 117: - case 112: + case 119: + case 114: return true; default: if (isBinaryOperator()) { @@ -7211,18 +7354,15 @@ var ts; } function isStartOfExpressionStatement() { return token !== 15 && - token !== 85 && - token !== 71 && - token !== 54 && + token !== 87 && + token !== 73 && + token !== 55 && isStartOfExpression(); } function allowInAndParseExpression() { return allowInAnd(parseExpression); } function parseExpression() { - // Expression[in]: - // AssignmentExpression[in] - // Expression[in] , AssignmentExpression[in] var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { setDecoratorContext(false); @@ -7238,24 +7378,15 @@ var ts; return expr; } function parseInitializer(inParameter) { - if (token !== 55) { + if (token !== 56) { if (scanner.hasPrecedingLineBreak() || (inParameter && token === 15) || !isStartOfExpression()) { return undefined; } } - parseExpected(55); + parseExpected(56); return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { - // AssignmentExpression[in,yield]: - // 1) ConditionalExpression[?in,?yield] - // 2) LeftHandSideExpression = AssignmentExpression[?in,?yield] - // 3) LeftHandSideExpression AssignmentOperator AssignmentExpression[?in,?yield] - // 4) ArrowFunctionExpression[?in,?yield] - // 5) [+Yield] YieldExpression[?In] - // - // Note: for ease of implementation we treat productions '2' and '3' as the same thing. - // (i.e. they're both BinaryExpressions with an assignment operator in it). if (isYieldExpression()) { return parseYieldExpression(); } @@ -7264,7 +7395,7 @@ var ts; return arrowExpression; } var expr = parseBinaryExpressionOrHigher(0); - if (expr.kind === 67 && token === 34) { + if (expr.kind === 69 && token === 34) { return parseSimpleArrowFunctionExpression(expr); } if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) { @@ -7273,7 +7404,7 @@ var ts; return parseConditionalExpressionRest(expr); } function isYieldExpression() { - if (token === 112) { + if (token === 114) { if (inYieldContext()) { return true; } @@ -7286,7 +7417,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(182); + var node = createNode(184); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token === 37 || isStartOfExpression())) { @@ -7300,8 +7431,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 34, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(172, identifier.pos); - var parameter = createNode(136, identifier.pos); + var node = createNode(174, identifier.pos); + var parameter = createNode(138, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -7331,7 +7462,7 @@ var ts; return finishNode(arrowFunction); } function isParenthesizedArrowFunctionExpression() { - if (token === 17 || token === 25 || token === 116) { + if (token === 17 || token === 25 || token === 118) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token === 34) { @@ -7340,7 +7471,7 @@ var ts; return 0; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token === 116) { + if (token === 118) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0; @@ -7356,7 +7487,7 @@ var ts; var third = nextToken(); switch (third) { case 34: - case 53: + case 54: case 15: return 1; default: @@ -7372,7 +7503,7 @@ var ts; if (!isIdentifier()) { return 0; } - if (nextToken() === 53) { + if (nextToken() === 54) { return 1; } return 2; @@ -7385,10 +7516,10 @@ var ts; if (sourceFile.languageVariant === 1) { var isArrowFunctionInJsx = lookAhead(function () { var third = nextToken(); - if (third === 81) { + if (third === 83) { var fourth = nextToken(); switch (fourth) { - case 55: + case 56: case 27: return false; default: @@ -7412,10 +7543,10 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(172); + var node = createNode(174); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 512); - fillSignature(53, false, isAsync, !allowAmbiguity, node); + fillSignature(54, false, isAsync, !allowAmbiguity, node); if (!node.parameters) { return undefined; } @@ -7429,8 +7560,8 @@ var ts; return parseFunctionBlock(false, isAsync, false); } if (token !== 23 && - token !== 85 && - token !== 71 && + token !== 87 && + token !== 73 && isStartOfStatement() && !isStartOfExpressionStatement()) { return parseFunctionBlock(false, isAsync, true); @@ -7440,15 +7571,15 @@ var ts; : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher); } function parseConditionalExpressionRest(leftOperand) { - var questionToken = parseOptionalToken(52); + var questionToken = parseOptionalToken(53); if (!questionToken) { return leftOperand; } - var node = createNode(180, leftOperand.pos); + var node = createNode(182, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); - node.colonToken = parseExpectedToken(53, false, ts.Diagnostics._0_expected, ts.tokenToString(53)); + node.colonToken = parseExpectedToken(54, false, ts.Diagnostics._0_expected, ts.tokenToString(54)); node.whenFalse = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -7457,19 +7588,22 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 88 || t === 132; + return t === 90 || t === 134; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { reScanGreaterToken(); var newPrecedence = getBinaryOperatorPrecedence(); - if (newPrecedence <= precedence) { + var consumeCurrentOperator = token === 38 ? + newPrecedence >= precedence : + newPrecedence > precedence; + if (!consumeCurrentOperator) { break; } - if (token === 88 && inDisallowInContext()) { + if (token === 90 && inDisallowInContext()) { break; } - if (token === 114) { + if (token === 116) { if (scanner.hasPrecedingLineBreak()) { break; } @@ -7485,22 +7619,22 @@ var ts; return leftOperand; } function isBinaryOperator() { - if (inDisallowInContext() && token === 88) { + if (inDisallowInContext() && token === 90) { return false; } return getBinaryOperatorPrecedence() > 0; } function getBinaryOperatorPrecedence() { switch (token) { - case 51: + case 52: return 1; - case 50: + case 51: return 2; - case 46: - return 3; case 47: + return 3; + case 48: return 4; - case 45: + case 46: return 5; case 30: case 31: @@ -7511,64 +7645,66 @@ var ts; case 27: case 28: case 29: - case 89: - case 88: - case 114: + case 91: + case 90: + case 116: return 7; - case 42: case 43: case 44: + case 45: return 8; case 35: case 36: return 9; case 37: - case 38: case 39: + case 40: return 10; + case 38: + return 11; } return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(179, left.pos); + var node = createNode(181, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(187, left.pos); + var node = createNode(189, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(177); + var node = createNode(179); node.operator = token; nextToken(); - node.operand = parseUnaryExpressionOrHigher(); + node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(173); + var node = createNode(175); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(174); + var node = createNode(176); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(175); + var node = createNode(177); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function isAwaitExpression() { - if (token === 117) { + if (token === 119) { if (inAwaitContext()) { return true; } @@ -7577,45 +7713,87 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(176); + var node = createNode(178); nextToken(); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseUnaryExpressionOrHigher() { if (isAwaitExpression()) { return parseAwaitExpression(); } + if (isIncrementExpression()) { + var incrementExpression = parseIncrementExpression(); + return token === 38 ? + parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) : + incrementExpression; + } + var unaryOperator = token; + var simpleUnaryExpression = parseSimpleUnaryExpression(); + if (token === 38) { + var diagnostic; + var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); + if (simpleUnaryExpression.kind === 171) { + parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); + } + else { + parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, ts.tokenToString(unaryOperator)); + } + } + return simpleUnaryExpression; + } + function parseSimpleUnaryExpression() { switch (token) { case 35: case 36: + case 50: case 49: - case 48: - case 40: - case 41: return parsePrefixUnaryExpression(); - case 76: + case 78: return parseDeleteExpression(); - case 99: - return parseTypeOfExpression(); case 101: + return parseTypeOfExpression(); + case 103: return parseVoidExpression(); case 25: - if (sourceFile.languageVariant !== 1) { - return parseTypeAssertion(); - } - if (lookAhead(nextTokenIsIdentifierOrKeyword)) { - return parseJsxElementOrSelfClosingElement(true); - } + return parseTypeAssertion(); default: - return parsePostfixExpressionOrHigher(); + return parseIncrementExpression(); } } - function parsePostfixExpressionOrHigher() { + function isIncrementExpression() { + switch (token) { + case 35: + case 36: + case 50: + case 49: + case 78: + case 101: + case 103: + return false; + case 25: + if (sourceFile.languageVariant !== 1) { + return false; + } + default: + return true; + } + } + function parseIncrementExpression() { + if (token === 41 || token === 42) { + var node = createNode(179); + node.operator = token; + nextToken(); + node.operand = parseLeftHandSideExpressionOrHigher(); + return finishNode(node); + } + else if (sourceFile.languageVariant === 1 && token === 25 && lookAhead(nextTokenIsIdentifierOrKeyword)) { + return parseJsxElementOrSelfClosingElement(true); + } var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); - if ((token === 40 || token === 41) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(178, expression.pos); + if ((token === 41 || token === 42) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(180, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -7624,7 +7802,7 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 93 + var expression = token === 95 ? parseSuperExpression() : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); @@ -7638,7 +7816,7 @@ var ts; if (token === 17 || token === 21 || token === 19) { return expression; } - var node = createNode(164, expression.pos); + var node = createNode(166, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(21, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -7646,26 +7824,26 @@ var ts; } function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); - if (opening.kind === 233) { - var node = createNode(231, opening.pos); + if (opening.kind === 235) { + var node = createNode(233, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); return finishNode(node); } else { - ts.Debug.assert(opening.kind === 232); + ts.Debug.assert(opening.kind === 234); return opening; } } function parseJsxText() { - var node = createNode(234, scanner.getStartPos()); + var node = createNode(236, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 234: + case 236: return parseJsxText(); case 15: return parseJsxExpression(false); @@ -7701,11 +7879,11 @@ var ts; var attributes = parseList(13, parseJsxAttribute); var node; if (token === 27) { - node = createNode(233, fullStart); + node = createNode(235, fullStart); scanJsxText(); } else { - parseExpected(38); + parseExpected(39); if (inExpressionContext) { parseExpected(27); } @@ -7713,7 +7891,7 @@ var ts; parseExpected(27, undefined, false); scanJsxText(); } - node = createNode(232, fullStart); + node = createNode(234, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -7724,7 +7902,7 @@ var ts; var elementName = parseIdentifierName(); while (parseOptional(21)) { scanJsxIdentifier(); - var node = createNode(133, elementName.pos); + var node = createNode(135, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); @@ -7732,7 +7910,7 @@ var ts; return elementName; } function parseJsxExpression(inExpressionContext) { - var node = createNode(238); + var node = createNode(240); parseExpected(15); if (token !== 16) { node.expression = parseExpression(); @@ -7751,9 +7929,9 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(236); + var node = createNode(238); node.name = parseIdentifierName(); - if (parseOptional(55)) { + if (parseOptional(56)) { switch (token) { case 9: node.initializer = parseLiteralNode(); @@ -7766,7 +7944,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(237); + var node = createNode(239); parseExpected(15); parseExpected(22); node.expression = parseExpression(); @@ -7774,7 +7952,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(235); + var node = createNode(237); parseExpected(26); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -7787,18 +7965,18 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(169); + var node = createNode(171); parseExpected(25); node.type = parseType(); parseExpected(27); - node.expression = parseUnaryExpressionOrHigher(); + node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseMemberExpressionRest(expression) { while (true) { var dotToken = parseOptionalToken(21); if (dotToken) { - var propertyAccess = createNode(164, expression.pos); + var propertyAccess = createNode(166, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(true); @@ -7806,7 +7984,7 @@ var ts; continue; } if (!inDecoratorContext() && parseOptional(19)) { - var indexedAccess = createNode(165, expression.pos); + var indexedAccess = createNode(167, expression.pos); indexedAccess.expression = expression; if (token !== 20) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -7820,7 +7998,7 @@ var ts; continue; } if (token === 11 || token === 12) { - var tagExpression = createNode(168, expression.pos); + var tagExpression = createNode(170, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 11 ? parseLiteralNode() @@ -7839,7 +8017,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(166, expression.pos); + var callExpr = createNode(168, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -7847,7 +8025,7 @@ var ts; continue; } else if (token === 17) { - var callExpr = createNode(166, expression.pos); + var callExpr = createNode(168, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -7880,18 +8058,18 @@ var ts; case 21: case 18: case 20: - case 53: + case 54: case 23: - case 52: + case 53: case 30: case 32: case 31: case 33: - case 50: case 51: - case 47: - case 45: + case 52: + case 48: case 46: + case 47: case 16: case 1: return true; @@ -7907,11 +8085,11 @@ var ts; case 9: case 11: return parseLiteralNode(); + case 97: case 95: case 93: - case 91: - case 97: - case 82: + case 99: + case 84: return parseTokenNode(); case 17: return parseParenthesizedExpression(); @@ -7919,19 +8097,19 @@ var ts; return parseArrayLiteralExpression(); case 15: return parseObjectLiteralExpression(); - case 116: + case 118: if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) { break; } return parseFunctionExpression(); - case 71: + case 73: return parseClassExpression(); - case 85: + case 87: return parseFunctionExpression(); - case 90: + case 92: return parseNewExpression(); - case 38: - case 59: + case 39: + case 61: if (reScanSlashToken() === 10) { return parseLiteralNode(); } @@ -7942,28 +8120,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(170); + var node = createNode(172); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); return finishNode(node); } function parseSpreadElement() { - var node = createNode(183); + var node = createNode(185); parseExpected(22); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 22 ? parseSpreadElement() : - token === 24 ? createNode(185) : + token === 24 ? createNode(187) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(162); + var node = createNode(164); parseExpected(19); if (scanner.hasPrecedingLineBreak()) node.flags |= 2048; @@ -7972,11 +8150,11 @@ var ts; return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { - if (parseContextualModifier(121)) { - return parseAccessorDeclaration(143, fullStart, decorators, modifiers); + if (parseContextualModifier(123)) { + return parseAccessorDeclaration(145, fullStart, decorators, modifiers); } - else if (parseContextualModifier(127)) { - return parseAccessorDeclaration(144, fullStart, decorators, modifiers); + else if (parseContextualModifier(129)) { + return parseAccessorDeclaration(146, fullStart, decorators, modifiers); } return undefined; } @@ -7992,27 +8170,33 @@ var ts; var tokenIsIdentifier = isIdentifier(); var nameToken = token; var propertyName = parsePropertyName(); - var questionToken = parseOptionalToken(52); + var questionToken = parseOptionalToken(53); if (asteriskToken || token === 17 || token === 25) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } - if ((token === 24 || token === 16) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(244, fullStart); + var isShorthandPropertyAssignment = tokenIsIdentifier && (token === 24 || token === 16 || token === 56); + if (isShorthandPropertyAssignment) { + var shorthandDeclaration = createNode(246, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; + var equalsToken = parseOptionalToken(56); + if (equalsToken) { + shorthandDeclaration.equalsToken = equalsToken; + shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher); + } return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(243, fullStart); + var propertyAssignment = createNode(245, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; - parseExpected(53); + parseExpected(54); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); return finishNode(propertyAssignment); } } function parseObjectLiteralExpression() { - var node = createNode(163); + var node = createNode(165); parseExpected(15); if (scanner.hasPrecedingLineBreak()) { node.flags |= 2048; @@ -8026,9 +8210,9 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(171); + var node = createNode(173); setModifiers(node, parseModifiers()); - parseExpected(85); + parseExpected(87); node.asteriskToken = parseOptionalToken(37); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512); @@ -8037,7 +8221,7 @@ var ts; isGenerator ? doInYieldContext(parseOptionalIdentifier) : isAsync ? doInAwaitContext(parseOptionalIdentifier) : parseOptionalIdentifier(); - fillSignature(53, isGenerator, isAsync, false, node); + fillSignature(54, isGenerator, isAsync, false, node); node.body = parseFunctionBlock(isGenerator, isAsync, false); if (saveDecoratorContext) { setDecoratorContext(true); @@ -8048,8 +8232,8 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(167); - parseExpected(90); + var node = createNode(169); + parseExpected(92); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token === 17) { @@ -8058,7 +8242,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(190); + var node = createNode(192); if (parseExpected(15, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -8086,25 +8270,25 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(192); + var node = createNode(194); parseExpected(23); return finishNode(node); } function parseIfStatement() { - var node = createNode(194); - parseExpected(86); + var node = createNode(196); + parseExpected(88); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(78) ? parseStatement() : undefined; + node.elseStatement = parseOptional(80) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(195); - parseExpected(77); + var node = createNode(197); + parseExpected(79); node.statement = parseStatement(); - parseExpected(102); + parseExpected(104); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); @@ -8112,8 +8296,8 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(196); - parseExpected(102); + var node = createNode(198); + parseExpected(104); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); @@ -8122,11 +8306,11 @@ var ts; } function parseForOrForInOrForOfStatement() { var pos = getNodePos(); - parseExpected(84); + parseExpected(86); parseExpected(17); var initializer = undefined; if (token !== 23) { - if (token === 100 || token === 106 || token === 72) { + if (token === 102 || token === 108 || token === 74) { initializer = parseVariableDeclarationList(true); } else { @@ -8134,22 +8318,22 @@ var ts; } } var forOrForInOrForOfStatement; - if (parseOptional(88)) { - var forInStatement = createNode(198, pos); + if (parseOptional(90)) { + var forInStatement = createNode(200, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(18); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(132)) { - var forOfStatement = createNode(199, pos); + else if (parseOptional(134)) { + var forOfStatement = createNode(201, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(18); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(197, pos); + var forStatement = createNode(199, pos); forStatement.initializer = initializer; parseExpected(23); if (token !== 23 && token !== 18) { @@ -8167,7 +8351,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 201 ? 68 : 73); + parseExpected(kind === 203 ? 70 : 75); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -8175,8 +8359,8 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(202); - parseExpected(92); + var node = createNode(204); + parseExpected(94); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); } @@ -8184,8 +8368,8 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(203); - parseExpected(103); + var node = createNode(205); + parseExpected(105); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); @@ -8193,30 +8377,30 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(239); - parseExpected(69); + var node = createNode(241); + parseExpected(71); node.expression = allowInAnd(parseExpression); - parseExpected(53); + parseExpected(54); node.statements = parseList(3, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(240); - parseExpected(75); - parseExpected(53); + var node = createNode(242); + parseExpected(77); + parseExpected(54); node.statements = parseList(3, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 69 ? parseCaseClause() : parseDefaultClause(); + return token === 71 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(204); - parseExpected(94); + var node = createNode(206); + parseExpected(96); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); - var caseBlock = createNode(218, scanner.getStartPos()); + var caseBlock = createNode(220, scanner.getStartPos()); parseExpected(15); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(16); @@ -8224,28 +8408,26 @@ var ts; return finishNode(node); } function parseThrowStatement() { - // ThrowStatement[Yield] : - // throw [no LineTerminator here]Expression[In, ?Yield]; - var node = createNode(206); - parseExpected(96); + var node = createNode(208); + parseExpected(98); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(207); - parseExpected(98); + var node = createNode(209); + parseExpected(100); node.tryBlock = parseBlock(false); - node.catchClause = token === 70 ? parseCatchClause() : undefined; - if (!node.catchClause || token === 83) { - parseExpected(83); + node.catchClause = token === 72 ? parseCatchClause() : undefined; + if (!node.catchClause || token === 85) { + parseExpected(85); node.finallyBlock = parseBlock(false); } return finishNode(node); } function parseCatchClause() { - var result = createNode(242); - parseExpected(70); + var result = createNode(244); + parseExpected(72); if (parseExpected(17)) { result.variableDeclaration = parseVariableDeclaration(); } @@ -8254,80 +8436,77 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(208); - parseExpected(74); + var node = createNode(210); + parseExpected(76); parseSemicolon(); return finishNode(node); } function parseExpressionOrLabeledStatement() { var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); - if (expression.kind === 67 && parseOptional(53)) { - var labeledStatement = createNode(205, fullStart); + if (expression.kind === 69 && parseOptional(54)) { + var labeledStatement = createNode(207, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(193, fullStart); + var expressionStatement = createNode(195, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); } } - function isIdentifierOrKeyword() { - return token >= 67; - } function nextTokenIsIdentifierOrKeywordOnSameLine() { nextToken(); - return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak(); + return ts.tokenIsIdentifierOrKeyword(token) && !scanner.hasPrecedingLineBreak(); } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); - return token === 85 && !scanner.hasPrecedingLineBreak(); + return token === 87 && !scanner.hasPrecedingLineBreak(); } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); - return (isIdentifierOrKeyword() || token === 8) && !scanner.hasPrecedingLineBreak(); + return (ts.tokenIsIdentifierOrKeyword(token) || token === 8) && !scanner.hasPrecedingLineBreak(); } function isDeclaration() { while (true) { switch (token) { - case 100: - case 106: - case 72: - case 85: - case 71: - case 79: + case 102: + case 108: + case 74: + case 87: + case 73: + case 81: return true; - case 105: - case 130: + case 107: + case 132: return nextTokenIsIdentifierOnSameLine(); - case 123: - case 124: + case 125: + case 126: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); - case 116: - case 120: + case 115: + case 118: + case 122: + case 110: + case 111: + case 112: nextToken(); if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 87: + case 89: nextToken(); return token === 9 || token === 37 || - token === 15 || isIdentifierOrKeyword(); - case 80: + token === 15 || ts.tokenIsIdentifierOrKeyword(token); + case 82: nextToken(); - if (token === 55 || token === 37 || - token === 15 || token === 75) { + if (token === 56 || token === 37 || + token === 15 || token === 77) { return true; } continue; - case 110: - case 108: - case 109: - case 111: case 113: nextToken(); continue; @@ -8341,44 +8520,44 @@ var ts; } function isStartOfStatement() { switch (token) { - case 54: + case 55: case 23: case 15: - case 100: - case 106: - case 85: - case 71: - case 79: - case 86: - case 77: case 102: - case 84: + case 108: + case 87: case 73: - case 68: - case 92: - case 103: + case 81: + case 88: + case 79: + case 104: + case 86: + case 75: + case 70: case 94: + case 105: case 96: case 98: - case 74: - case 70: - case 83: - return true; + case 100: + case 76: case 72: - case 80: - case 87: - return isStartOfDeclaration(); - case 116: - case 120: - case 105: - case 123: - case 124: - case 130: + case 85: return true; + case 74: + case 82: + case 89: + return isStartOfDeclaration(); + case 118: + case 122: + case 107: + case 125: + case 126: + case 132: + return true; + case 112: case 110: - case 108: - case 109: case 111: + case 113: return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); default: return isStartOfExpression(); @@ -8397,60 +8576,60 @@ var ts; return parseEmptyStatement(); case 15: return parseBlock(false); - case 100: + case 102: return parseVariableStatement(scanner.getStartPos(), undefined, undefined); - case 106: + case 108: if (isLetDeclaration()) { return parseVariableStatement(scanner.getStartPos(), undefined, undefined); } break; - case 85: - return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); - case 71: - return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); - case 86: - return parseIfStatement(); - case 77: - return parseDoStatement(); - case 102: - return parseWhileStatement(); - case 84: - return parseForOrForInOrForOfStatement(); - case 73: - return parseBreakOrContinueStatement(200); - case 68: - return parseBreakOrContinueStatement(201); - case 92: - return parseReturnStatement(); - case 103: - return parseWithStatement(); - case 94: - return parseSwitchStatement(); - case 96: - return parseThrowStatement(); - case 98: - case 70: - case 83: - return parseTryStatement(); - case 74: - return parseDebuggerStatement(); - case 54: - return parseDeclaration(); - case 116: - case 105: - case 130: - case 123: - case 124: - case 120: - case 72: - case 79: - case 80: case 87: - case 108: - case 109: + return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); + case 73: + return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); + case 88: + return parseIfStatement(); + case 79: + return parseDoStatement(); + case 104: + return parseWhileStatement(); + case 86: + return parseForOrForInOrForOfStatement(); + case 75: + return parseBreakOrContinueStatement(202); + case 70: + return parseBreakOrContinueStatement(203); + case 94: + return parseReturnStatement(); + case 105: + return parseWithStatement(); + case 96: + return parseSwitchStatement(); + case 98: + return parseThrowStatement(); + case 100: + case 72: + case 85: + return parseTryStatement(); + case 76: + return parseDebuggerStatement(); + case 55: + return parseDeclaration(); + case 118: + case 107: + case 132: + case 125: + case 126: + case 122: + case 74: + case 81: + case 82: + case 89: case 110: - case 113: case 111: + case 112: + case 115: + case 113: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -8463,33 +8642,33 @@ var ts; var decorators = parseDecorators(); var modifiers = parseModifiers(); switch (token) { - case 100: - case 106: - case 72: + case 102: + case 108: + case 74: return parseVariableStatement(fullStart, decorators, modifiers); - case 85: - return parseFunctionDeclaration(fullStart, decorators, modifiers); - case 71: - return parseClassDeclaration(fullStart, decorators, modifiers); - case 105: - return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 130: - return parseTypeAliasDeclaration(fullStart, decorators, modifiers); - case 79: - return parseEnumDeclaration(fullStart, decorators, modifiers); - case 123: - case 124: - return parseModuleDeclaration(fullStart, decorators, modifiers); case 87: + return parseFunctionDeclaration(fullStart, decorators, modifiers); + case 73: + return parseClassDeclaration(fullStart, decorators, modifiers); + case 107: + return parseInterfaceDeclaration(fullStart, decorators, modifiers); + case 132: + return parseTypeAliasDeclaration(fullStart, decorators, modifiers); + case 81: + return parseEnumDeclaration(fullStart, decorators, modifiers); + case 125: + case 126: + return parseModuleDeclaration(fullStart, decorators, modifiers); + case 89: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); - case 80: + case 82: nextToken(); - return token === 75 || token === 55 ? + return token === 77 || token === 56 ? parseExportAssignment(fullStart, decorators, modifiers) : parseExportDeclaration(fullStart, decorators, modifiers); default: if (decorators || modifiers) { - var node = createMissingNode(229, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(231, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8510,23 +8689,23 @@ var ts; } function parseArrayBindingElement() { if (token === 24) { - return createNode(185); + return createNode(187); } - var node = createNode(161); + var node = createNode(163); node.dotDotDotToken = parseOptionalToken(22); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(161); + var node = createNode(163); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); - if (tokenIsIdentifier && token !== 53) { + if (tokenIsIdentifier && token !== 54) { node.name = propertyName; } else { - parseExpected(53); + parseExpected(54); node.propertyName = propertyName; node.name = parseIdentifierOrPattern(); } @@ -8534,14 +8713,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(159); + var node = createNode(161); parseExpected(15); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(16); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(160); + var node = createNode(162); parseExpected(19); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(20); @@ -8560,7 +8739,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(209); + var node = createNode(211); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -8569,21 +8748,21 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(210); + var node = createNode(212); switch (token) { - case 100: + case 102: break; - case 106: + case 108: node.flags |= 16384; break; - case 72: + case 74: node.flags |= 32768; break; default: ts.Debug.fail(); } nextToken(); - if (token === 132 && lookAhead(canFollowContextualOfKeyword)) { + if (token === 134 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -8598,7 +8777,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 18; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(191, fullStart); + var node = createNode(193, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -8606,29 +8785,29 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(211, fullStart); + var node = createNode(213, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(85); + parseExpected(87); node.asteriskToken = parseOptionalToken(37); node.name = node.flags & 1024 ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512); - fillSignature(53, isGenerator, isAsync, false, node); + fillSignature(54, isGenerator, isAsync, false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return finishNode(node); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(142, pos); + var node = createNode(144, pos); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(119); - fillSignature(53, false, false, false, node); + parseExpected(121); + fillSignature(54, false, false, false, node); node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected); return finishNode(node); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(141, fullStart); + var method = createNode(143, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -8636,12 +8815,12 @@ var ts; method.questionToken = questionToken; var isGenerator = !!asteriskToken; var isAsync = !!(method.flags & 512); - fillSignature(53, isGenerator, isAsync, false, method); + fillSignature(54, isGenerator, isAsync, false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return finishNode(method); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(139, fullStart); + var property = createNode(141, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -8656,7 +8835,7 @@ var ts; function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) { var asteriskToken = parseOptionalToken(37); var name = parsePropertyName(); - var questionToken = parseOptionalToken(52); + var questionToken = parseOptionalToken(53); if (asteriskToken || token === 17 || token === 25) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } @@ -8672,16 +8851,16 @@ var ts; node.decorators = decorators; setModifiers(node, modifiers); node.name = parsePropertyName(); - fillSignature(53, false, false, false, node); + fillSignature(54, false, false, false, node); node.body = parseFunctionBlockOrSemicolon(false, false); return finishNode(node); } function isClassMemberModifier(idToken) { switch (idToken) { + case 112: case 110: - case 108: - case 109: case 111: + case 113: return true; default: return false; @@ -8689,7 +8868,7 @@ var ts; } function isClassMemberStart() { var idToken; - if (token === 54) { + if (token === 55) { return true; } while (ts.isModifier(token)) { @@ -8710,15 +8889,15 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 127 || idToken === 121) { + if (!ts.isKeyword(idToken) || idToken === 129 || idToken === 123) { return true; } switch (token) { case 17: case 25: + case 54: + case 56: case 53: - case 55: - case 52: return true; default: return canParseSemicolon(); @@ -8730,14 +8909,14 @@ var ts; var decorators; while (true) { var decoratorStart = getNodePos(); - if (!parseOptional(54)) { + if (!parseOptional(55)) { break; } if (!decorators) { decorators = []; decorators.pos = scanner.getStartPos(); } - var decorator = createNode(137, decoratorStart); + var decorator = createNode(139, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -8771,7 +8950,7 @@ var ts; function parseModifiersForArrowFunction() { var flags = 0; var modifiers; - if (token === 116) { + if (token === 118) { var modifierStart = scanner.getStartPos(); var modifierKind = token; nextToken(); @@ -8786,7 +8965,7 @@ var ts; } function parseClassElement() { if (token === 23) { - var result = createNode(189); + var result = createNode(191); nextToken(); return finishNode(result); } @@ -8797,13 +8976,13 @@ var ts; if (accessor) { return accessor; } - if (token === 119) { + if (token === 121) { return parseConstructorDeclaration(fullStart, decorators, modifiers); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(fullStart, decorators, modifiers); } - if (isIdentifierOrKeyword() || + if (ts.tokenIsIdentifierOrKeyword(token) || token === 9 || token === 8 || token === 37 || @@ -8811,23 +8990,23 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_8 = createMissingNode(67, true, ts.Diagnostics.Declaration_expected); + var name_8 = createMissingNode(69, true, ts.Diagnostics.Declaration_expected); return parsePropertyDeclaration(fullStart, decorators, modifiers, name_8, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 184); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 186); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 212); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 214); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(71); - node.name = parseOptionalIdentifier(); + parseExpected(73); + node.name = parseNameOfClassDeclarationOrExpression(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); if (parseExpected(15)) { @@ -8839,9 +9018,15 @@ var ts; } return finishNode(node); } + function parseNameOfClassDeclarationOrExpression() { + return isIdentifier() && !isImplementsClause() + ? parseIdentifier() + : undefined; + } + function isImplementsClause() { + return token === 106 && lookAhead(nextTokenIsIdentifierOrKeyword); + } function parseHeritageClauses(isClassHeritageClause) { - // ClassTail[Yield,Await] : (Modified) See 14.5 - // ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt } if (isHeritageClause()) { return parseList(20, parseHeritageClause); } @@ -8851,8 +9036,8 @@ var ts; return parseList(20, parseHeritageClause); } function parseHeritageClause() { - if (token === 81 || token === 104) { - var node = createNode(241); + if (token === 83 || token === 106) { + var node = createNode(243); node.token = token; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -8861,7 +9046,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(186); + var node = createNode(188); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); @@ -8869,16 +9054,16 @@ var ts; return finishNode(node); } function isHeritageClause() { - return token === 81 || token === 104; + return token === 83 || token === 106; } function parseClassMembers() { return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(213, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(105); + parseExpected(107); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(false); @@ -8886,28 +9071,28 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(214, fullStart); + var node = createNode(216, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(130); + parseExpected(132); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - parseExpected(55); + parseExpected(56); node.type = parseType(); parseSemicolon(); return finishNode(node); } function parseEnumMember() { - var node = createNode(245, scanner.getStartPos()); + var node = createNode(247, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215, fullStart); + var node = createNode(217, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(79); + parseExpected(81); node.name = parseIdentifier(); if (parseExpected(15)) { node.members = parseDelimitedList(6, parseEnumMember); @@ -8919,7 +9104,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(217, scanner.getStartPos()); + var node = createNode(219, scanner.getStartPos()); if (parseExpected(15)) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -8930,18 +9115,19 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(216, fullStart); + var node = createNode(218, fullStart); + var namespaceFlag = flags & 131072; node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(21) - ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1) + ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1 | namespaceFlag) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(216, fullStart); + var node = createNode(218, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -8950,11 +9136,11 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (parseOptional(124)) { + if (parseOptional(126)) { flags |= 131072; } else { - parseExpected(123); + parseExpected(125); if (token === 9) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } @@ -8962,64 +9148,58 @@ var ts; return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 125 && + return token === 127 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 17; } function nextTokenIsSlash() { - return nextToken() === 38; + return nextToken() === 39; } function nextTokenIsCommaOrFromKeyword() { nextToken(); return token === 24 || - token === 131; + token === 133; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { - parseExpected(87); + parseExpected(89); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 24 && token !== 131) { - var importEqualsDeclaration = createNode(219, fullStart); + if (token !== 24 && token !== 133) { + var importEqualsDeclaration = createNode(221, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; - parseExpected(55); + parseExpected(56); importEqualsDeclaration.moduleReference = parseModuleReference(); parseSemicolon(); return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(220, fullStart); + var importDeclaration = createNode(222, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || token === 37 || token === 15) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(131); + parseExpected(133); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - // ImportClause: - // ImportedDefaultBinding - // NameSpaceImport - // NamedImports - // ImportedDefaultBinding, NameSpaceImport - // ImportedDefaultBinding, NamedImports - var importClause = createNode(221, fullStart); + var importClause = createNode(223, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(24)) { - importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(223); + importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(225); } return finishNode(importClause); } @@ -9029,8 +9209,8 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(230); - parseExpected(125); + var node = createNode(232); + parseExpected(127); parseExpected(17); node.expression = parseModuleSpecifier(); parseExpected(18); @@ -9044,22 +9224,22 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(222); + var namespaceImport = createNode(224); parseExpected(37); - parseExpected(114); + parseExpected(116); namespaceImport.name = parseIdentifier(); return finishNode(namespaceImport); } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(21, kind === 223 ? parseImportSpecifier : parseExportSpecifier, 15, 16); + node.elements = parseBracketedList(21, kind === 225 ? parseImportSpecifier : parseExportSpecifier, 15, 16); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(228); + return parseImportOrExportSpecifier(230); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(224); + return parseImportOrExportSpecifier(226); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -9067,9 +9247,9 @@ var ts; var checkIdentifierStart = scanner.getTokenPos(); var checkIdentifierEnd = scanner.getTextPos(); var identifierName = parseIdentifierName(); - if (token === 114) { + if (token === 116) { node.propertyName = identifierName; - parseExpected(114); + parseExpected(116); checkIdentifierIsKeyword = ts.isKeyword(token) && !isIdentifier(); checkIdentifierStart = scanner.getTokenPos(); checkIdentifierEnd = scanner.getTextPos(); @@ -9078,23 +9258,23 @@ var ts; else { node.name = identifierName; } - if (kind === 224 && checkIdentifierIsKeyword) { + if (kind === 226 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(226, fullStart); + var node = createNode(228, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(37)) { - parseExpected(131); + parseExpected(133); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(227); - if (token === 131 || (token === 9 && !scanner.hasPrecedingLineBreak())) { - parseExpected(131); + node.exportClause = parseNamedImportsOrExports(229); + if (token === 133 || (token === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(133); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -9102,14 +9282,14 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(225, fullStart); + var node = createNode(227, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (parseOptional(55)) { + if (parseOptional(56)) { node.isExportEquals = true; } else { - parseExpected(75); + parseExpected(77); } node.expression = parseAssignmentExpressionOrHigher(); parseSemicolon(); @@ -9172,10 +9352,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 219 && node.moduleReference.kind === 230 - || node.kind === 220 - || node.kind === 225 - || node.kind === 226 + || node.kind === 221 && node.moduleReference.kind === 232 + || node.kind === 222 + || node.kind === 227 + || node.kind === 228 ? node : undefined; }); @@ -9185,18 +9365,18 @@ var ts; function isJSDocType() { switch (token) { case 37: - case 52: + case 53: case 17: case 19: - case 48: + case 49: case 15: - case 85: + case 87: case 22: - case 90: - case 95: + case 92: + case 97: return true; } - return isIdentifierOrKeyword(); + return ts.tokenIsIdentifierOrKeyword(token); } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { @@ -9210,7 +9390,7 @@ var ts; function parseJSDocTypeExpression(start, length) { scanner.setText(sourceText, start, length); token = nextToken(); - var result = createNode(247); + var result = createNode(249); parseExpected(15); result.type = parseJSDocTopLevelType(); parseExpected(16); @@ -9220,13 +9400,13 @@ var ts; JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression; function parseJSDocTopLevelType() { var type = parseJSDocType(); - if (token === 46) { - var unionType = createNode(251, type.pos); + if (token === 47) { + var unionType = createNode(253, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } - if (token === 55) { - var optionalType = createNode(258, type.pos); + if (token === 56) { + var optionalType = createNode(260, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -9237,20 +9417,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token === 19) { - var arrayType = createNode(250, type.pos); + var arrayType = createNode(252, type.pos); arrayType.elementType = type; nextToken(); parseExpected(20); type = finishNode(arrayType); } - else if (token === 52) { - var nullableType = createNode(253, type.pos); + else if (token === 53) { + var nullableType = createNode(255, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } - else if (token === 48) { - var nonNullableType = createNode(254, type.pos); + else if (token === 49) { + var nonNullableType = createNode(256, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -9265,80 +9445,80 @@ var ts; switch (token) { case 37: return parseJSDocAllType(); - case 52: + case 53: return parseJSDocUnknownOrNullableType(); case 17: return parseJSDocUnionType(); case 19: return parseJSDocTupleType(); - case 48: + case 49: return parseJSDocNonNullableType(); case 15: return parseJSDocRecordType(); - case 85: + case 87: return parseJSDocFunctionType(); case 22: return parseJSDocVariadicType(); - case 90: + case 92: return parseJSDocConstructorType(); - case 95: + case 97: return parseJSDocThisType(); - case 115: + case 117: + case 130: case 128: - case 126: - case 118: - case 129: - case 101: + case 120: + case 131: + case 103: return parseTokenNode(); } return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(262); + var result = createNode(264); nextToken(); - parseExpected(53); + parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(261); + var result = createNode(263); nextToken(); - parseExpected(53); + parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(260); + var result = createNode(262); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(259); + var result = createNode(261); nextToken(); parseExpected(17); result.parameters = parseDelimitedList(22, parseJSDocParameter); checkForTrailingComma(result.parameters); parseExpected(18); - if (token === 53) { + if (token === 54) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(136); + var parameter = createNode(138); parameter.type = parseJSDocType(); return finishNode(parameter); } function parseJSDocOptionalType(type) { - var result = createNode(258, type.pos); + var result = createNode(260, type.pos); nextToken(); result.type = type; return finishNode(result); } function parseJSDocTypeReference() { - var result = createNode(257); + var result = createNode(259); result.name = parseSimplePropertyName(); while (parseOptional(21)) { if (token === 25) { @@ -9367,13 +9547,13 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(133, left.pos); + var result = createNode(135, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(255); + var result = createNode(257); nextToken(); result.members = parseDelimitedList(24, parseJSDocRecordMember); checkForTrailingComma(result.members); @@ -9381,22 +9561,22 @@ var ts; return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(256); + var result = createNode(258); result.name = parseSimplePropertyName(); - if (token === 53) { + if (token === 54) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(254); + var result = createNode(256); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(252); + var result = createNode(254); nextToken(); result.types = parseDelimitedList(25, parseJSDocType); checkForTrailingComma(result.types); @@ -9410,7 +9590,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(251); + var result = createNode(253); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(18); @@ -9421,14 +9601,14 @@ var ts; var types = []; types.pos = firstType.pos; types.push(firstType); - while (parseOptional(46)) { + while (parseOptional(47)) { types.push(parseJSDocType()); } types.end = scanner.getStartPos(); return types; } function parseJSDocAllType() { - var result = createNode(248); + var result = createNode(250); nextToken(); return finishNode(result); } @@ -9439,13 +9619,13 @@ var ts; token === 16 || token === 18 || token === 27 || - token === 55 || - token === 46) { - var result = createNode(249, pos); + token === 56 || + token === 47) { + var result = createNode(251, pos); return finishNode(result); } else { - var result = createNode(253, pos); + var result = createNode(255, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -9516,7 +9696,7 @@ var ts; if (!tags) { return undefined; } - var result = createNode(263, start); + var result = createNode(265, start); result.tags = tags; return finishNode(result, end); } @@ -9527,7 +9707,7 @@ var ts; } function parseTag() { ts.Debug.assert(content.charCodeAt(pos - 1) === 64); - var atToken = createNode(54, pos - 1); + var atToken = createNode(55, pos - 1); atToken.end = pos; var tagName = scanIdentifier(); if (!tagName) { @@ -9553,7 +9733,7 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(264, atToken.pos); + var result = createNode(266, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result, pos); @@ -9604,7 +9784,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(265, atToken.pos); + var result = createNode(267, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -9614,27 +9794,27 @@ var ts; return finishNode(result, pos); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 266; })) { + if (ts.forEach(tags, function (t) { return t.kind === 268; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(266, atToken.pos); + var result = createNode(268, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 267; })) { + if (ts.forEach(tags, function (t) { return t.kind === 269; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(267, atToken.pos); + var result = createNode(269, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 268; })) { + if (ts.forEach(tags, function (t) { return t.kind === 270; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = []; @@ -9647,7 +9827,7 @@ var ts; parseErrorAtPosition(startPos, 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(135, name_9.pos); + var typeParameter = createNode(137, name_9.pos); typeParameter.name = name_9; finishNode(typeParameter, pos); typeParameters.push(typeParameter); @@ -9658,7 +9838,7 @@ var ts; pos++; } typeParameters.end = pos; - var result = createNode(268, atToken.pos); + var result = createNode(270, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -9679,7 +9859,7 @@ var ts; if (startPos === pos) { return undefined; } - var result = createNode(67, startPos); + var result = createNode(69, startPos); result.text = content.substring(startPos, pos); return finishNode(result, pos); } @@ -9755,7 +9935,7 @@ var ts; switch (node.kind) { case 9: case 8: - case 67: + case 69: return true; } return false; @@ -9969,21 +10149,20 @@ var ts; } })(IncrementalParser || (IncrementalParser = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { ts.bindTime = 0; function getModuleInstanceState(node) { - if (node.kind === 213 || node.kind === 214) { + if (node.kind === 215 || node.kind === 216) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 220 || node.kind === 219) && !(node.flags & 1)) { + else if ((node.kind === 222 || node.kind === 221) && !(node.flags & 1)) { return 0; } - else if (node.kind === 217) { + else if (node.kind === 219) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -9999,7 +10178,7 @@ var ts; }); return state; } - else if (node.kind === 216) { + else if (node.kind === 218) { return getModuleInstanceState(node.body); } else { @@ -10018,6 +10197,7 @@ var ts; var container; var blockScopeContainer; var lastContainer; + var seenThisKeyword; var inStrictMode = !!file.externalModuleIndicator; var symbolCount = 0; var Symbol = ts.objectAllocator.getSymbolConstructor(); @@ -10051,10 +10231,10 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 216 && node.name.kind === 9) { + if (node.kind === 218 && node.name.kind === 9) { return "\"" + node.name.text + "\""; } - if (node.name.kind === 134) { + if (node.name.kind === 136) { var nameExpression = node.name.expression; ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); @@ -10062,22 +10242,22 @@ var ts; return node.name.text; } switch (node.kind) { - case 142: + case 144: return "__constructor"; - case 150: - case 145: - return "__call"; - case 151: - case 146: - return "__new"; + case 152: case 147: + return "__call"; + case 153: + case 148: + return "__new"; + case 149: return "__index"; - case 226: + case 228: return "__export"; - case 225: + case 227: return node.isExportEquals ? "export=" : "default"; - case 211: - case 212: + case 213: + case 214: return node.flags & 1024 ? "default" : undefined; } } @@ -10086,7 +10266,8 @@ var ts; } function declareSymbol(symbolTable, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var name = node.flags & 1024 && parent ? "default" : getDeclarationName(node); + var isDefaultExport = node.flags & 1024; + var name = isDefaultExport && parent ? "default" : getDeclarationName(node); var symbol; if (name !== undefined) { symbol = ts.hasProperty(symbolTable, name) @@ -10102,6 +10283,11 @@ var ts; var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.flags & 1024) { + message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + } + }); ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); @@ -10119,7 +10305,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 228 || (node.kind === 219 && hasExportModifier)) { + if (node.kind === 230 || (node.kind === 221 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -10158,44 +10344,51 @@ var ts; blockScopeContainer = node; blockScopeContainer.locals = undefined; } - ts.forEachChild(node, bind); + if (node.kind === 215) { + seenThisKeyword = false; + ts.forEachChild(node, bind); + node.flags = seenThisKeyword ? node.flags | 524288 : node.flags & ~524288; + } + else { + ts.forEachChild(node, bind); + } container = saveContainer; parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } function getContainerFlags(node) { switch (node.kind) { - case 184: - case 212: - case 213: + case 186: + case 214: case 215: - case 153: - case 163: + case 217: + case 155: + case 165: return 1; + case 147: + case 148: + case 149: + case 143: + case 142: + case 213: + case 144: case 145: case 146: - case 147: - case 141: - case 140: - case 211: - case 142: - case 143: - case 144: - case 150: - case 151: - case 171: - case 172: - case 216: - case 246: - case 214: - return 5; - case 242: - case 197: - case 198: - case 199: + case 152: + case 153: + case 173: + case 174: case 218: + case 248: + case 216: + return 5; + case 244: + case 199: + case 200: + case 201: + case 220: return 2; - case 190: + case 192: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -10211,33 +10404,33 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 216: + case 218: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 246: + case 248: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 184: - case 212: + case 186: + case 214: return declareClassMember(node, symbolFlags, symbolExcludes); - case 215: + case 217: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 153: - case 163: - case 213: + case 155: + case 165: + case 215: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 150: - case 151: + case 152: + case 153: + case 147: + case 148: + case 149: + case 143: + case 142: + case 144: case 145: case 146: - case 147: - case 141: - case 140: - case 142: - case 143: - case 144: - case 211: - case 171: - case 172: - case 214: + case 213: + case 173: + case 174: + case 216: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -10261,11 +10454,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 246 ? node : node.body; - if (body.kind === 246 || body.kind === 217) { + var body = node.kind === 248 ? node : node.body; + if (body.kind === 248 || body.kind === 219) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 226 || stat.kind === 225) { + if (stat.kind === 228 || stat.kind === 227) { return true; } } @@ -10320,11 +10513,11 @@ var ts; var seen = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.name.kind !== 67) { + if (prop.name.kind !== 69) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 243 || prop.kind === 244 || prop.kind === 141 + var currentKind = prop.kind === 245 || prop.kind === 246 || prop.kind === 143 ? 1 : 2; var existingKind = seen[identifier.text]; @@ -10346,10 +10539,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 216: + case 218: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 246: + case 248: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -10367,8 +10560,8 @@ var ts; } function checkStrictModeIdentifier(node) { if (inStrictMode && - node.originalKeywordKind >= 104 && - node.originalKeywordKind <= 112 && + node.originalKeywordKind >= 106 && + node.originalKeywordKind <= 114 && !ts.isIdentifierName(node)) { if (!file.parseDiagnostics.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); @@ -10395,17 +10588,17 @@ var ts; } } function checkStrictModeDeleteExpression(node) { - if (inStrictMode && node.expression.kind === 67) { + if (inStrictMode && node.expression.kind === 69) { var span = ts.getErrorSpanForNode(file, node.expression); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 67 && + return node.kind === 69 && (node.text === "eval" || node.text === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 67) { + if (name && name.kind === 69) { var identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { var span = ts.getErrorSpanForNode(file, name); @@ -10439,7 +10632,7 @@ var ts; } function checkStrictModePrefixUnaryExpression(node) { if (inStrictMode) { - if (node.operator === 40 || node.operator === 41) { + if (node.operator === 41 || node.operator === 42) { checkStrictModeEvalOrArguments(node, node.operand); } } @@ -10468,17 +10661,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 246: - case 217: + case 248: + case 219: updateStrictModeStatementList(node.statements); return; - case 190: + case 192: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 212: - case 184: + case 214: + case 186: inStrictMode = true; return; } @@ -10501,88 +10694,91 @@ var ts; } function bindWorker(node) { switch (node.kind) { - case 67: + case 69: return checkStrictModeIdentifier(node); - case 179: + case 181: return checkStrictModeBinaryExpression(node); - case 242: + case 244: return checkStrictModeCatchClause(node); - case 173: + case 175: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 178: + case 180: return checkStrictModePostfixUnaryExpression(node); - case 177: + case 179: return checkStrictModePrefixUnaryExpression(node); - case 203: + case 205: return checkStrictModeWithStatement(node); - case 135: + case 97: + seenThisKeyword = true; + return; + case 137: return declareSymbolAndAddToSymbolTable(node, 262144, 530912); - case 136: - return bindParameter(node); - case 209: - case 161: - return bindVariableDeclarationOrBindingElement(node); - case 139: case 138: - return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); - case 243: - case 244: - return bindPropertyOrMethodOrAccessor(node, 4, 107455); - case 245: - return bindPropertyOrMethodOrAccessor(node, 8, 107455); - case 145: - case 146: - case 147: - return declareSymbolAndAddToSymbolTable(node, 131072, 0); + return bindParameter(node); + case 211: + case 163: + return bindVariableDeclarationOrBindingElement(node); case 141: case 140: + return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); + case 245: + case 246: + return bindPropertyOrMethodOrAccessor(node, 4, 107455); + case 247: + return bindPropertyOrMethodOrAccessor(node, 8, 107455); + case 147: + case 148: + case 149: + return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 143: + case 142: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); - case 211: + case 213: checkStrictModeFunctionName(node); return declareSymbolAndAddToSymbolTable(node, 16, 106927); - case 142: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); - case 143: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); case 144: + return declareSymbolAndAddToSymbolTable(node, 16384, 0); + case 145: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 146: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 150: - case 151: - return bindFunctionOrConstructorType(node); + case 152: case 153: + return bindFunctionOrConstructorType(node); + case 155: return bindAnonymousDeclaration(node, 2048, "__type"); - case 163: + case 165: return bindObjectLiteralExpression(node); - case 171: - case 172: + case 173: + case 174: checkStrictModeFunctionName(node); var bindingName = node.name ? node.name.text : "__function"; return bindAnonymousDeclaration(node, 16, bindingName); - case 184: - case 212: - return bindClassLikeDeclaration(node); - case 213: - return bindBlockScopedDeclaration(node, 64, 792960); + case 186: case 214: - return bindBlockScopedDeclaration(node, 524288, 793056); + return bindClassLikeDeclaration(node); case 215: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 64, 792960); case 216: + return bindBlockScopedDeclaration(node, 524288, 793056); + case 217: + return bindEnumDeclaration(node); + case 218: return bindModuleDeclaration(node); - case 219: - case 222: - case 224: - case 228: - return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); case 221: - return bindImportClause(node); + case 224: case 226: + case 230: + return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + case 223: + return bindImportClause(node); + case 228: return bindExportDeclaration(node); - case 225: + case 227: return bindExportAssignment(node); - case 246: + case 248: return bindSourceFileIfExternalModule(); } } @@ -10596,7 +10792,7 @@ var ts; if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } - else if (node.expression.kind === 67) { + else if (node.expression.kind === 69) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } else { @@ -10617,7 +10813,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 212) { + if (node.kind === 214) { bindBlockScopedDeclaration(node, 32, 899519); } else { @@ -10670,7 +10866,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 1, 107455); } if (node.flags & 112 && - node.parent.kind === 142 && + node.parent.kind === 144 && ts.isClassLike(node.parent.parent)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); @@ -10683,7 +10879,6 @@ var ts; } } })(ts || (ts = {})); -/// var ts; (function (ts) { var nextSymbolId = 1; @@ -10709,17 +10904,19 @@ var ts; var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); var typeCount = 0; + var symbolCount = 0; var emptyArray = []; var emptySymbols = {}; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0; + var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 ? 5 : 0; var emitResolver = createResolver(); var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, - getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, + getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; }, getTypeCount: function () { return typeCount; }, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, @@ -10865,6 +11062,7 @@ var ts; diagnostics.add(diagnostic); } function createSymbol(flags, name) { + symbolCount++; return new Symbol(flags, name); } function getExcludedSymbolFlags(flags) { @@ -10993,10 +11191,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 246); + return ts.getAncestor(node, 248); } function isGlobalSourceFile(node) { - return node.kind === 246 && !ts.isExternalModule(node); + return node.kind === 248 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -11013,17 +11211,54 @@ var ts; } } } - function isDefinedBefore(node1, node2) { - var file1 = ts.getSourceFileOfNode(node1); - var file2 = ts.getSourceFileOfNode(node2); - if (file1 === file2) { - return node1.pos <= node2.pos; + function isBlockScopedNameDeclaredBeforeUse(declaration, usage) { + var declarationFile = ts.getSourceFileOfNode(declaration); + var useFile = ts.getSourceFileOfNode(usage); + if (declarationFile !== useFile) { + if (modulekind || (!compilerOptions.outFile && !compilerOptions.out)) { + return true; + } + var sourceFiles = host.getSourceFiles(); + return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } - if (!compilerOptions.outFile && !compilerOptions.out) { - return true; + if (declaration.pos <= usage.pos) { + return declaration.kind !== 211 || + !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return isUsedInFunctionOrNonStaticProperty(declaration, usage); + function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { + var container = ts.getEnclosingBlockScopeContainer(declaration); + if (declaration.parent.parent.kind === 193 || + declaration.parent.parent.kind === 199) { + return isSameScopeDescendentOf(usage, declaration, container); + } + else if (declaration.parent.parent.kind === 201 || + declaration.parent.parent.kind === 200) { + var expression = declaration.parent.parent.expression; + return isSameScopeDescendentOf(usage, expression, container); + } + } + function isUsedInFunctionOrNonStaticProperty(declaration, usage) { + var container = ts.getEnclosingBlockScopeContainer(declaration); + var current = usage; + while (current) { + if (current === container) { + return false; + } + if (ts.isFunctionLike(current)) { + return true; + } + var initializerOfNonStaticProperty = current.parent && + current.parent.kind === 141 && + (current.parent.flags & 128) === 0 && + current.parent.initializer === current; + if (initializerOfNonStaticProperty) { + return true; + } + current = current.parent; + } + return false; } - var sourceFiles = host.getSourceFiles(); - return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2); } function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { var result; @@ -11044,16 +11279,16 @@ var ts; } } switch (location.kind) { - case 246: + case 248: if (!ts.isExternalModule(location)) break; - case 216: + case 218: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 246 || - (location.kind === 216 && location.name.kind === 9)) { + if (location.kind === 248 || + (location.kind === 218 && location.name.kind === 9)) { if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 228)) { + ts.getDeclarationOfKind(moduleExports[name], 230)) { break; } result = moduleExports["default"]; @@ -11067,13 +11302,13 @@ var ts; break loop; } break; - case 215: + case 217: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; - case 139: - case 138: + case 141: + case 140: if (ts.isClassLike(location.parent) && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -11083,9 +11318,9 @@ var ts; } } break; - case 212: - case 184: - case 213: + case 214: + case 186: + case 215: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 128) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -11093,7 +11328,7 @@ var ts; } break loop; } - if (location.kind === 184 && meaning & 32) { + if (location.kind === 186 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -11101,28 +11336,28 @@ var ts; } } break; - case 134: + case 136: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 213) { + if (ts.isClassLike(grandparent) || grandparent.kind === 215) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 141: - case 140: - case 142: case 143: + case 142: case 144: - case 211: - case 172: + case 145: + case 146: + case 213: + case 174: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 171: + case 173: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -11135,8 +11370,8 @@ var ts; } } break; - case 137: - if (location.parent && location.parent.kind === 136) { + case 139: + if (location.parent && location.parent.kind === 138) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -11162,8 +11397,11 @@ var ts; error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); return undefined; } - if (meaning & 2 && result.flags & 2) { - checkResolvedBlockScopedVariable(result, errorLocation); + if (meaning & 2) { + var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result); + if (exportOrLocalSymbol.flags & 2) { + checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation); + } } } return result; @@ -11172,21 +11410,7 @@ var ts; ts.Debug.assert((result.flags & 2) !== 0); var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); - if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 209); - var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 191 || - variableDeclaration.parent.parent.kind === 197) { - isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); - } - else if (variableDeclaration.parent.parent.kind === 199 || - variableDeclaration.parent.parent.kind === 198) { - var expression = variableDeclaration.parent.parent.expression; - isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); - } - } - if (isUsedBeforeDeclaration) { + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 211), errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -11203,10 +11427,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 219) { + if (node.kind === 221) { return node; } - while (node && node.kind !== 220) { + while (node && node.kind !== 222) { node = node.parent; } return node; @@ -11216,7 +11440,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 230) { + if (node.moduleReference.kind === 232) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -11305,17 +11529,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 219: - return getTargetOfImportEqualsDeclaration(node); case 221: + return getTargetOfImportEqualsDeclaration(node); + case 223: return getTargetOfImportClause(node); - case 222: - return getTargetOfNamespaceImport(node); case 224: + return getTargetOfNamespaceImport(node); + case 226: return getTargetOfImportSpecifier(node); - case 228: + case 230: return getTargetOfExportSpecifier(node); - case 225: + case 227: return getTargetOfExportAssignment(node); } } @@ -11357,10 +11581,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 225) { + if (node.kind === 227) { checkExpressionCached(node.expression); } - else if (node.kind === 228) { + else if (node.kind === 230) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -11370,17 +11594,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 219); + importDeclaration = ts.getAncestor(entityName, 221); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 67 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 69 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 67 || entityName.parent.kind === 133) { + if (entityName.kind === 69 || entityName.parent.kind === 135) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 219); + ts.Debug.assert(entityName.parent.kind === 221); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -11392,16 +11616,16 @@ var ts; return undefined; } var symbol; - if (name.kind === 67) { + if (name.kind === 69) { var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; symbol = resolveName(name, name.text, meaning, ignoreErrors ? undefined : message, name); if (!symbol) { return undefined; } } - else if (name.kind === 133 || name.kind === 164) { - var left = name.kind === 133 ? name.left : name.expression; - var right = name.kind === 133 ? name.right : name.name; + else if (name.kind === 135 || name.kind === 166) { + var left = name.kind === 135 ? name.left : name.expression; + var right = name.kind === 135 ? name.right : name.name; var namespace = resolveEntityName(left, 1536, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -11420,9 +11644,6 @@ var ts; ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveAlias(symbol); } - function isExternalModuleNameRelative(moduleName) { - return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; - } function resolveExternalModuleName(location, moduleReferenceExpression) { if (moduleReferenceExpression.kind !== 9) { return; @@ -11430,10 +11651,10 @@ var ts; var moduleReferenceLiteral = moduleReferenceExpression; var searchPath = ts.getDirectoryPath(getSourceFile(location).fileName); var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); - if (!moduleName) { + if (moduleName === undefined) { return; } - var isRelative = isExternalModuleNameRelative(moduleName); + var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512); if (symbol) { @@ -11537,7 +11758,7 @@ var ts; var members = node.members; for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; - if (member.kind === 142 && ts.nodeIsPresent(member.body)) { + if (member.kind === 144 && ts.nodeIsPresent(member.body)) { return member; } } @@ -11602,17 +11823,17 @@ var ts; } } switch (location_1.kind) { - case 246: + case 248: if (!ts.isExternalModule(location_1)) { break; } - case 216: + case 218: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 212: - case 213: + case 214: + case 215: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -11645,7 +11866,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -11674,7 +11895,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 230)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -11729,8 +11950,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 216 && declaration.name.kind === 9) || - (declaration.kind === 246 && ts.isExternalModule(declaration)); + return (declaration.kind === 218 && declaration.name.kind === 9) || + (declaration.kind === 248 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -11762,11 +11983,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 152) { + if (entityName.parent.kind === 154) { meaning = 107455 | 1048576; } - else if (entityName.kind === 133 || entityName.kind === 164 || - entityName.parent.kind === 219) { + else if (entityName.kind === 135 || entityName.kind === 166 || + entityName.parent.kind === 221) { meaning = 1536; } else { @@ -11817,10 +12038,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 158) { + while (node.kind === 160) { node = node.parent; } - if (node.kind === 214) { + if (node.kind === 216) { return getSymbolOfNode(node); } } @@ -11834,10 +12055,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 184: + case 186: return "(Anonymous class)"; - case 171: - case 172: + case 173: + case 174: return "(Anonymous function)"; } } @@ -11898,6 +12119,7 @@ var ts; } function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, symbolStack) { var globalFlagsToPass = globalFlags & 16; + var inObjectTypeLiteral = false; return writeType(type, globalFlags); function writeType(type, flags) { if (type.flags & 16777343) { @@ -11905,6 +12127,12 @@ var ts; ? "any" : type.intrinsicName); } + else if (type.flags & 33554432) { + if (inObjectTypeLiteral) { + writer.reportInaccessibleThisError(); + } + writer.writeKeyword("this"); + } else if (type.flags & 4096) { writeTypeReference(type, flags); } @@ -11943,9 +12171,9 @@ var ts; writeType(types[i], delimiter === 24 ? 0 : 64); } } - function writeSymbolTypeReference(symbol, typeArguments, pos, end) { - if (!isReservedMemberName(symbol.name)) { - buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056); + function writeSymbolTypeReference(symbol, typeArguments, pos, end, flags) { + if (symbol.flags & 32 || !isReservedMemberName(symbol.name)) { + buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056, 0, flags); } if (pos < end) { writePunctuation(writer, 25); @@ -11959,7 +12187,7 @@ var ts; } } function writeTypeReference(type, flags) { - var typeArguments = type.typeArguments; + var typeArguments = type.typeArguments || emptyArray; if (type.target === globalArrayType && !(flags & 1)) { writeType(typeArguments[0], 64); writePunctuation(writer, 19); @@ -11977,12 +12205,13 @@ var ts; i++; } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_3); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_3, typeArguments, start, i); + writeSymbolTypeReference(parent_3, typeArguments, start, i, flags); writePunctuation(writer, 21); } } } - writeSymbolTypeReference(type.symbol, typeArguments, i, typeArguments.length); + var typeParameterCount = (type.target.typeParameters || emptyArray).length; + writeSymbolTypeReference(type.symbol, typeArguments, i, typeParameterCount, flags); } } function writeTupleType(type) { @@ -11994,7 +12223,7 @@ var ts; if (flags & 64) { writePunctuation(writer, 17); } - writeTypeList(type.types, type.flags & 16384 ? 46 : 45); + writeTypeList(type.types, type.flags & 16384 ? 47 : 46); if (flags & 64) { writePunctuation(writer, 18); } @@ -12014,7 +12243,7 @@ var ts; buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793056, 0, flags); } else { - writeKeyword(writer, 115); + writeKeyword(writer, 117); } } else { @@ -12035,7 +12264,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 246 || declaration.parent.kind === 217; + return declaration.parent.kind === 248 || declaration.parent.kind === 219; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -12044,7 +12273,7 @@ var ts; } } function writeTypeofSymbol(type, typeFormatFlags) { - writeKeyword(writer, 99); + writeKeyword(writer, 101); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } @@ -12078,7 +12307,7 @@ var ts; if (flags & 64) { writePunctuation(writer, 17); } - writeKeyword(writer, 90); + writeKeyword(writer, 92); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, symbolStack); if (flags & 64) { @@ -12087,6 +12316,8 @@ var ts; return; } } + var saveInObjectTypeLiteral = inObjectTypeLiteral; + inObjectTypeLiteral = true; writePunctuation(writer, 15); writer.writeLine(); writer.increaseIndent(); @@ -12098,7 +12329,7 @@ var ts; } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - writeKeyword(writer, 90); + writeKeyword(writer, 92); writeSpace(writer); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); writePunctuation(writer, 23); @@ -12107,11 +12338,11 @@ var ts; if (resolved.stringIndexType) { writePunctuation(writer, 19); writer.writeParameter(getIndexerParameterName(resolved, 0, "x")); - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); - writeKeyword(writer, 128); + writeKeyword(writer, 130); writePunctuation(writer, 20); - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); writeType(resolved.stringIndexType, 0); writePunctuation(writer, 23); @@ -12120,11 +12351,11 @@ var ts; if (resolved.numberIndexType) { writePunctuation(writer, 19); writer.writeParameter(getIndexerParameterName(resolved, 1, "x")); - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); - writeKeyword(writer, 126); + writeKeyword(writer, 128); writePunctuation(writer, 20); - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); writeType(resolved.numberIndexType, 0); writePunctuation(writer, 23); @@ -12139,7 +12370,7 @@ var ts; var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { - writePunctuation(writer, 52); + writePunctuation(writer, 53); } buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); writePunctuation(writer, 23); @@ -12149,9 +12380,9 @@ var ts; else { buildSymbolDisplay(p, writer); if (p.flags & 536870912) { - writePunctuation(writer, 52); + writePunctuation(writer, 53); } - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); writeType(t, 0); writePunctuation(writer, 23); @@ -12160,6 +12391,7 @@ var ts; } writer.decreaseIndent(); writePunctuation(writer, 16); + inObjectTypeLiteral = saveInObjectTypeLiteral; } } function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { @@ -12173,7 +12405,7 @@ var ts; var constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); - writeKeyword(writer, 81); + writeKeyword(writer, 83); writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } @@ -12185,9 +12417,9 @@ var ts; } appendSymbolNameOnly(p, writer); if (isOptionalParameter(parameterNode)) { - writePunctuation(writer, 52); + writePunctuation(writer, 53); } - writePunctuation(writer, 53); + writePunctuation(writer, 54); writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } @@ -12234,14 +12466,14 @@ var ts; writePunctuation(writer, 34); } else { - writePunctuation(writer, 53); + writePunctuation(writer, 54); } writeSpace(writer); var returnType; if (signature.typePredicate) { writer.writeParameter(signature.typePredicate.parameterName); writeSpace(writer); - writeKeyword(writer, 122); + writeKeyword(writer, 124); writeSpace(writer); returnType = signature.typePredicate.type; } @@ -12275,12 +12507,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 216) { + if (node.kind === 218) { if (node.name.kind === 9) { return node; } } - else if (node.kind === 246) { + else if (node.kind === 248) { return ts.isExternalModule(node) ? node : undefined; } } @@ -12323,59 +12555,59 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 161: + case 163: return isDeclarationVisible(node.parent.parent); - case 209: + case 211: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 216: - case 212: - case 213: + case 218: case 214: - case 211: case 215: - case 219: + case 216: + case 213: + case 217: + case 221: var parent_4 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 219 && parent_4.kind !== 246 && ts.isInAmbientContext(parent_4))) { + !(node.kind !== 221 && parent_4.kind !== 248 && ts.isInAmbientContext(parent_4))) { return isGlobalSourceFile(parent_4); } return isDeclarationVisible(parent_4); - case 139: - case 138: - case 143: - case 144: case 141: case 140: + case 145: + case 146: + case 143: + case 142: if (node.flags & (32 | 64)) { return false; } - case 142: - case 146: - case 145: + case 144: + case 148: case 147: - case 136: - case 217: - case 150: - case 151: - case 153: case 149: - case 154: + case 138: + case 219: + case 152: + case 153: case 155: + case 151: case 156: case 157: case 158: + case 159: + case 160: return isDeclarationVisible(node.parent); - case 221: - case 222: + case 223: case 224: + case 226: return false; - case 135: - case 246: + case 137: + case 248: return true; - case 225: + case 227: return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -12391,10 +12623,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 225) { + if (node.parent && node.parent.kind === 227) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 228) { + else if (node.parent.kind === 230) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -12469,7 +12701,7 @@ var ts; } function getDeclarationContainer(node) { node = ts.getRootDeclaration(node); - return node.kind === 209 ? node.parent.parent.parent : node.parent; + return node.kind === 211 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -12482,9 +12714,13 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1) !== 0; } + function getTypeForBindingElementParent(node) { + var symbol = getSymbolOfNode(node); + return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node); + } function getTypeForBindingElement(declaration) { var pattern = declaration.parent; - var parentType = getTypeForVariableLikeDeclaration(pattern.parent); + var parentType = getTypeForBindingElementParent(pattern.parent); if (parentType === unknownType) { return unknownType; } @@ -12495,7 +12731,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 159) { + if (pattern.kind === 161) { var name_11 = declaration.propertyName || declaration.name; type = getTypeOfPropertyOfType(parentType, name_11.text) || isNumericLiteralName(name_11.text) && getIndexTypeOfType(parentType, 1) || @@ -12529,10 +12765,10 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 198) { + if (declaration.parent.parent.kind === 200) { return anyType; } - if (declaration.parent.parent.kind === 199) { + if (declaration.parent.parent.kind === 201) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -12541,10 +12777,10 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 136) { + if (declaration.kind === 138) { var func = declaration.parent; - if (func.kind === 144 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 143); + if (func.kind === 146 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 145); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -12557,56 +12793,56 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 244) { + if (declaration.kind === 246) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return getTypeFromBindingPattern(declaration.name, false); } return undefined; } - function getTypeFromBindingElement(element) { + function getTypeFromBindingElement(element, includePatternInType) { if (element.initializer) { return getWidenedType(checkExpressionCached(element.initializer)); } if (ts.isBindingPattern(element.name)) { - return getTypeFromBindingPattern(element.name); + return getTypeFromBindingPattern(element.name, includePatternInType); } return anyType; } - function getTypeFromObjectBindingPattern(pattern) { + function getTypeFromObjectBindingPattern(pattern, includePatternInType) { var members = {}; ts.forEach(pattern.elements, function (e) { var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); var name = e.propertyName || e.name; var symbol = createSymbol(flags, name.text); - symbol.type = getTypeFromBindingElement(e); + symbol.type = getTypeFromBindingElement(e, includePatternInType); + symbol.bindingElement = e; members[symbol.name] = symbol; }); - return createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + if (includePatternInType) { + result.pattern = pattern; + } + return result; } - function getTypeFromArrayBindingPattern(pattern) { - var hasSpreadElement = false; - var elementTypes = []; - ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 185 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); - if (e.dotDotDotToken) { - hasSpreadElement = true; - } - }); - if (!elementTypes.length) { + function getTypeFromArrayBindingPattern(pattern, includePatternInType) { + var elements = pattern.elements; + if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; } - else if (hasSpreadElement) { - var unionOfElements = getUnionType(elementTypes); - return languageVersion >= 2 ? createIterableType(unionOfElements) : createArrayType(unionOfElements); + var elementTypes = ts.map(elements, function (e) { return e.kind === 187 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + if (includePatternInType) { + var result = createNewTupleType(elementTypes); + result.pattern = pattern; + return result; } return createTupleType(elementTypes); } - function getTypeFromBindingPattern(pattern) { - return pattern.kind === 159 - ? getTypeFromObjectBindingPattern(pattern) - : getTypeFromArrayBindingPattern(pattern); + function getTypeFromBindingPattern(pattern, includePatternInType) { + return pattern.kind === 161 + ? getTypeFromObjectBindingPattern(pattern, includePatternInType) + : getTypeFromArrayBindingPattern(pattern, includePatternInType); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -12614,12 +12850,12 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 243 ? getWidenedType(type) : type; + return declaration.kind !== 245 ? getWidenedType(type) : type; } type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 136 && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 138 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -12632,10 +12868,10 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 242) { + if (declaration.parent.kind === 244) { return links.type = anyType; } - if (declaration.kind === 225) { + if (declaration.kind === 227) { return links.type = checkExpression(declaration.expression); } if (!pushTypeResolution(symbol, 0)) { @@ -12660,7 +12896,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 143) { + if (accessor.kind === 145) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -12676,8 +12912,8 @@ var ts; if (!pushTypeResolution(symbol, 0)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 143); - var setter = ts.getDeclarationOfKind(symbol, 144); + var getter = ts.getDeclarationOfKind(symbol, 145); + var setter = ts.getDeclarationOfKind(symbol, 146); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -12703,7 +12939,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 143); + var getter_1 = ts.getDeclarationOfKind(symbol, 145); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -12792,9 +13028,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 212 || node.kind === 184 || - node.kind === 211 || node.kind === 171 || - node.kind === 141 || node.kind === 172) { + if (node.kind === 214 || node.kind === 186 || + node.kind === 213 || node.kind === 173 || + node.kind === 143 || node.kind === 174) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -12803,15 +13039,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 213); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 215); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 213 || node.kind === 212 || - node.kind === 184 || node.kind === 214) { + if (node.kind === 215 || node.kind === 214 || + node.kind === 186 || node.kind === 216) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -12866,22 +13102,27 @@ var ts; } return type.resolvedBaseConstructorType; } + function hasClassBaseType(type) { + return !!ts.forEach(getBaseTypes(type), function (t) { return !!(t.symbol.flags & 32); }); + } function getBaseTypes(type) { + var isClass = type.symbol.flags & 32; + var isInterface = type.symbol.flags & 64; if (!type.resolvedBaseTypes) { - if (type.symbol.flags & 32) { + if (!isClass && !isInterface) { + ts.Debug.fail("type must be class or interface"); + } + if (isClass) { resolveBaseTypesOfClass(type); } - else if (type.symbol.flags & 64) { + if (isInterface) { resolveBaseTypesOfInterface(type); } - else { - ts.Debug.fail("type must be class or interface"); - } } return type.resolvedBaseTypes; } function resolveBaseTypesOfClass(type) { - type.resolvedBaseTypes = emptyArray; + type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; var baseContructorType = getBaseConstructorTypeOfClass(type); if (!(baseContructorType.flags & 80896)) { return; @@ -12910,20 +13151,30 @@ var ts; error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); return; } - type.resolvedBaseTypes = [baseType]; + if (type.resolvedBaseTypes === emptyArray) { + type.resolvedBaseTypes = [baseType]; + } + else { + type.resolvedBaseTypes.push(baseType); + } } function resolveBaseTypesOfInterface(type) { - type.resolvedBaseTypes = []; + type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 213 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 215 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (1024 | 2048)) { if (type !== baseType && !hasBaseType(baseType, type)) { - type.resolvedBaseTypes.push(baseType); + if (type.resolvedBaseTypes === emptyArray) { + type.resolvedBaseTypes = [baseType]; + } + else { + type.resolvedBaseTypes.push(baseType); + } } else { error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); @@ -12937,6 +13188,29 @@ var ts; } } } + function isIndependentInterface(symbol) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 215) { + if (declaration.flags & 524288) { + return false; + } + var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); + if (baseTypeNodes) { + for (var _b = 0; _b < baseTypeNodes.length; _b++) { + var node = baseTypeNodes[_b]; + if (ts.isSupportedExpressionWithTypeArguments(node)) { + var baseSymbol = resolveEntityName(node.expression, 793056, true); + if (!baseSymbol || !(baseSymbol.flags & 64) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) { + return false; + } + } + } + } + } + } + return true; + } function getDeclaredTypeOfClassOrInterface(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { @@ -12944,7 +13218,7 @@ var ts; var type = links.declaredType = createObjectType(kind, symbol); var outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol); var localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); - if (outerTypeParameters || localTypeParameters) { + if (outerTypeParameters || localTypeParameters || kind === 1024 || !isIndependentInterface(symbol)) { type.flags |= 4096; type.typeParameters = ts.concatenate(outerTypeParameters, localTypeParameters); type.outerTypeParameters = outerTypeParameters; @@ -12953,6 +13227,9 @@ var ts; type.instantiations[getTypeListId(type.typeParameters)] = type; type.target = type; type.typeArguments = type.typeParameters; + type.thisType = createType(512 | 33554432); + type.thisType.symbol = symbol; + type.thisType.constraint = getTypeWithThisArgument(type); } } return links.declaredType; @@ -12963,7 +13240,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 214); + var declaration = ts.getDeclarationOfKind(symbol, 216); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -12994,7 +13271,7 @@ var ts; if (!links.declaredType) { var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 135).constraint) { + if (!ts.getDeclarationOfKind(symbol, 137).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -13027,6 +13304,66 @@ var ts; } return unknownType; } + function isIndependentTypeReference(node) { + if (node.typeArguments) { + for (var _i = 0, _a = node.typeArguments; _i < _a.length; _i++) { + var typeNode = _a[_i]; + if (!isIndependentType(typeNode)) { + return false; + } + } + } + return true; + } + function isIndependentType(node) { + switch (node.kind) { + case 117: + case 130: + case 128: + case 120: + case 131: + case 103: + case 9: + return true; + case 156: + return isIndependentType(node.elementType); + case 151: + return isIndependentTypeReference(node); + } + return false; + } + function isIndependentVariableLikeDeclaration(node) { + return node.type && isIndependentType(node.type) || !node.type && !node.initializer; + } + function isIndependentFunctionLikeDeclaration(node) { + if (node.kind !== 144 && (!node.type || !isIndependentType(node.type))) { + return false; + } + for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + if (!isIndependentVariableLikeDeclaration(parameter)) { + return false; + } + } + return true; + } + function isIndependentMember(symbol) { + if (symbol.declarations && symbol.declarations.length === 1) { + var declaration = symbol.declarations[0]; + if (declaration) { + switch (declaration.kind) { + case 141: + case 140: + return isIndependentVariableLikeDeclaration(declaration); + case 143: + case 142: + case 144: + return isIndependentFunctionLikeDeclaration(declaration); + } + } + } + return false; + } function createSymbolTable(symbols) { var result = {}; for (var _i = 0; _i < symbols.length; _i++) { @@ -13035,11 +13372,11 @@ var ts; } return result; } - function createInstantiatedSymbolTable(symbols, mapper) { + function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) { var result = {}; for (var _i = 0; _i < symbols.length; _i++) { var symbol = symbols[_i]; - result[symbol.name] = instantiateSymbol(symbol, mapper); + result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); } return result; } @@ -13070,44 +13407,54 @@ var ts; } return type; } - function resolveClassOrInterfaceMembers(type) { - var target = resolveDeclaredMembers(type); - var members = target.symbol.members; - var callSignatures = target.declaredCallSignatures; - var constructSignatures = target.declaredConstructSignatures; - var stringIndexType = target.declaredStringIndexType; - var numberIndexType = target.declaredNumberIndexType; - var baseTypes = getBaseTypes(target); + function getTypeWithThisArgument(type, thisArgument) { + if (type.flags & 4096) { + return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); + } + return type; + } + function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) { + var mapper = identityMapper; + var members = source.symbol.members; + var callSignatures = source.declaredCallSignatures; + var constructSignatures = source.declaredConstructSignatures; + var stringIndexType = source.declaredStringIndexType; + var numberIndexType = source.declaredNumberIndexType; + if (!ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { + mapper = createTypeMapper(typeParameters, typeArguments); + members = createInstantiatedSymbolTable(source.declaredProperties, mapper, typeParameters.length === 1); + callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature); + constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature); + stringIndexType = instantiateType(source.declaredStringIndexType, mapper); + numberIndexType = instantiateType(source.declaredNumberIndexType, mapper); + } + var baseTypes = getBaseTypes(source); if (baseTypes.length) { - members = createSymbolTable(target.declaredProperties); + if (members === source.symbol.members) { + members = createSymbolTable(source.declaredProperties); + } + var thisArgument = ts.lastOrUndefined(typeArguments); for (var _i = 0; _i < baseTypes.length; _i++) { var baseType = baseTypes[_i]; - addInheritedMembers(members, getPropertiesOfObjectType(baseType)); - callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(baseType, 0)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(baseType, 1)); - stringIndexType = stringIndexType || getIndexTypeOfType(baseType, 0); - numberIndexType = numberIndexType || getIndexTypeOfType(baseType, 1); + var instantiatedBaseType = thisArgument ? getTypeWithThisArgument(instantiateType(baseType, mapper), thisArgument) : baseType; + addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); + stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0); + numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1); } } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } + function resolveClassOrInterfaceMembers(type) { + resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray); + } function resolveTypeReferenceMembers(type) { - var target = resolveDeclaredMembers(type.target); - var mapper = createTypeMapper(target.typeParameters, type.typeArguments); - var members = createInstantiatedSymbolTable(target.declaredProperties, mapper); - var callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature); - var constructSignatures = instantiateList(target.declaredConstructSignatures, mapper, instantiateSignature); - var stringIndexType = target.declaredStringIndexType ? instantiateType(target.declaredStringIndexType, mapper) : undefined; - var numberIndexType = target.declaredNumberIndexType ? instantiateType(target.declaredNumberIndexType, mapper) : undefined; - ts.forEach(getBaseTypes(target), function (baseType) { - var instantiatedBaseType = instantiateType(baseType, mapper); - addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); - callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); - constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); - stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0); - numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1); - }); - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + var source = resolveDeclaredMembers(type.target); + var typeParameters = ts.concatenate(source.typeParameters, [source.thisType]); + var typeArguments = type.typeArguments && type.typeArguments.length === typeParameters.length ? + type.typeArguments : ts.concatenate(type.typeArguments, [type]); + resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } function createSignature(declaration, typeParameters, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { var sig = new Signature(checker); @@ -13125,7 +13472,7 @@ var ts; return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); } function getDefaultConstructSignatures(classType) { - if (!getBaseTypes(classType).length) { + if (!hasClassBaseType(classType)) { return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, false, false)]; } var baseConstructorType = getBaseConstructorTypeOfClass(classType); @@ -13156,7 +13503,8 @@ var ts; return members; } function resolveTupleTypeMembers(type) { - var arrayType = resolveStructuredTypeMembers(createArrayType(getUnionType(type.elementTypes, true))); + var arrayElementType = getUnionType(type.elementTypes, true); + var arrayType = resolveStructuredTypeMembers(createTypeFromGenericGlobalType(globalArrayType, [arrayElementType, type])); var members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); @@ -13258,7 +13606,14 @@ var ts; var constructSignatures; var stringIndexType; var numberIndexType; - if (symbol.flags & 2048) { + if (type.target) { + members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, false); + callSignatures = instantiateList(getSignaturesOfType(type.target, 0), type.mapper, instantiateSignature); + constructSignatures = instantiateList(getSignaturesOfType(type.target, 1), type.mapper, instantiateSignature); + stringIndexType = instantiateType(getIndexTypeOfType(type.target, 0), type.mapper); + numberIndexType = instantiateType(getIndexTypeOfType(type.target, 1), type.mapper); + } + else if (symbol.flags & 2048) { members = symbol.members; callSignatures = getSignaturesOfSymbol(members["__call"]); constructSignatures = getSignaturesOfSymbol(members["__new"]); @@ -13294,7 +13649,10 @@ var ts; } function resolveStructuredTypeMembers(type) { if (!type.members) { - if (type.flags & (1024 | 2048)) { + if (type.flags & 4096) { + resolveTypeReferenceMembers(type); + } + else if (type.flags & (1024 | 2048)) { resolveClassOrInterfaceMembers(type); } else if (type.flags & 65536) { @@ -13309,9 +13667,6 @@ var ts; else if (type.flags & 32768) { resolveIntersectionTypeMembers(type); } - else { - resolveTypeReferenceMembers(type); - } } return type; } @@ -13518,7 +13873,9 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 142 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 144 ? + getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) + : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; @@ -13549,7 +13906,7 @@ var ts; } else if (declaration.type) { returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 148) { + if (declaration.type.kind === 150) { var typePredicateNode = declaration.type; typePredicate = { parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined, @@ -13559,8 +13916,8 @@ var ts; } } else { - if (declaration.kind === 143 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 144); + if (declaration.kind === 145 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 146); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -13578,19 +13935,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 150: - case 151: - case 211: - case 141: - case 140: + case 152: + case 153: + case 213: + case 143: case 142: + case 144: + case 147: + case 148: + case 149: case 145: case 146: - case 147: - case 143: - case 144: - case 171: - case 172: + case 173: + case 174: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -13660,7 +14017,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 142 || signature.declaration.kind === 146; + var isConstructor = signature.declaration.kind === 144 || signature.declaration.kind === 148; var type = createObjectType(65536 | 262144); type.members = emptySymbols; type.properties = emptyArray; @@ -13674,7 +14031,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 126 : 128; + var syntaxKind = kind === 1 ? 128 : 130; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -13703,30 +14060,33 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 135).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 137).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 135).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 137).parent); } function getTypeListId(types) { - switch (types.length) { - case 1: - return "" + types[0].id; - case 2: - return types[0].id + "," + types[1].id; - default: - var result = ""; - for (var i = 0; i < types.length; i++) { - if (i > 0) { - result += ","; + if (types) { + switch (types.length) { + case 1: + return "" + types[0].id; + case 2: + return types[0].id + "," + types[1].id; + default: + var result = ""; + for (var i = 0; i < types.length; i++) { + if (i > 0) { + result += ","; + } + result += types[i].id; } - result += types[i].id; - } - return result; + return result; + } } + return ""; } function getPropagatingFlagsOfTypes(types) { var result = 0; @@ -13740,7 +14100,7 @@ var ts; var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 | getPropagatingFlagsOfTypes(typeArguments); + var flags = 4096 | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -13756,13 +14116,13 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 135; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 137; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 149 && n.typeName.kind === 67) { + if (n.kind === 151 && n.typeName.kind === 69) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); @@ -13829,7 +14189,7 @@ var ts; function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var typeNameOrExpression = node.kind === 149 ? node.typeName : + var typeNameOrExpression = node.kind === 151 ? node.typeName : ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : undefined; var symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056) || unknownSymbol; @@ -13855,9 +14215,9 @@ var ts; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 212: - case 213: + case 214: case 215: + case 217: return declaration; } } @@ -13907,17 +14267,17 @@ var ts; ? createTypeReference(globalTypedPropertyDescriptorType, [propertyType]) : emptyObjectType; } - function createTypeFromGenericGlobalType(genericGlobalType, elementType) { - return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, [elementType]) : emptyObjectType; + function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { + return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } function createIterableType(elementType) { - return createTypeFromGenericGlobalType(globalIterableType, elementType); + return createTypeFromGenericGlobalType(globalIterableType, [elementType]); } function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(globalIterableIteratorType, elementType); + return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); } function createArrayType(elementType) { - return createTypeFromGenericGlobalType(globalArrayType, elementType); + return createTypeFromGenericGlobalType(globalArrayType, [elementType]); } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); @@ -13928,11 +14288,11 @@ var ts; } function createTupleType(elementTypes) { var id = getTypeListId(elementTypes); - var type = tupleTypes[id]; - if (!type) { - type = tupleTypes[id] = createObjectType(8192 | getPropagatingFlagsOfTypes(elementTypes)); - type.elementTypes = elementTypes; - } + return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); + } + function createNewTupleType(elementTypes) { + var type = createObjectType(8192 | getPropagatingFlagsOfTypes(elementTypes)); + type.elementTypes = elementTypes; return type; } function getTypeFromTupleTypeNode(node) { @@ -14074,46 +14434,67 @@ var ts; } return links.resolvedType; } + function getThisType(node) { + var container = ts.getThisContainer(node, false); + var parent = container && container.parent; + if (parent && (ts.isClassLike(parent) || parent.kind === 215)) { + if (!(container.flags & 128) && + (container.kind !== 144 || ts.isNodeDescendentOf(node, container.body))) { + return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; + } + } + error(node, ts.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface); + return unknownType; + } + function getTypeFromThisTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getThisType(node); + } + return links.resolvedType; + } function getTypeFromTypeNode(node) { switch (node.kind) { - case 115: + case 117: return anyType; - case 128: + case 130: return stringType; - case 126: + case 128: return numberType; - case 118: + case 120: return booleanType; - case 129: + case 131: return esSymbolType; - case 101: + case 103: return voidType; + case 97: + return getTypeFromThisTypeNode(node); case 9: return getTypeFromStringLiteral(node); - case 149: - return getTypeFromTypeReference(node); - case 148: - return booleanType; - case 186: - return getTypeFromTypeReference(node); - case 152: - return getTypeFromTypeQueryNode(node); - case 154: - return getTypeFromArrayTypeNode(node); - case 155: - return getTypeFromTupleTypeNode(node); - case 156: - return getTypeFromUnionTypeNode(node); - case 157: - return getTypeFromIntersectionTypeNode(node); - case 158: - return getTypeFromTypeNode(node.type); - case 150: case 151: + return getTypeFromTypeReference(node); + case 150: + return booleanType; + case 188: + return getTypeFromTypeReference(node); + case 154: + return getTypeFromTypeQueryNode(node); + case 156: + return getTypeFromArrayTypeNode(node); + case 157: + return getTypeFromTupleTypeNode(node); + case 158: + return getTypeFromUnionTypeNode(node); + case 159: + return getTypeFromIntersectionTypeNode(node); + case 160: + return getTypeFromTypeNode(node.type); + case 152: case 153: + case 155: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 67: - case 133: + case 69: + case 135: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -14217,7 +14598,7 @@ var ts; type: instantiateType(signature.typePredicate.type, mapper) }; } - var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; return result; @@ -14249,21 +14630,13 @@ var ts; mapper.instantiations = []; } var result = createObjectType(65536 | 131072, type.symbol); - result.properties = instantiateList(getPropertiesOfObjectType(type), mapper, instantiateSymbol); - result.members = createSymbolTable(result.properties); - result.callSignatures = instantiateList(getSignaturesOfType(type, 0), mapper, instantiateSignature); - result.constructSignatures = instantiateList(getSignaturesOfType(type, 1), mapper, instantiateSignature); - var stringIndexType = getIndexTypeOfType(type, 0); - var numberIndexType = getIndexTypeOfType(type, 1); - if (stringIndexType) - result.stringIndexType = instantiateType(stringIndexType, mapper); - if (numberIndexType) - result.numberIndexType = instantiateType(numberIndexType, mapper); + result.target = type; + result.mapper = mapper; mapper.instantiations[type.id] = result; return result; } function instantiateType(type, mapper) { - if (mapper !== identityMapper) { + if (type && mapper !== identityMapper) { if (type.flags & 512) { return mapper(type); } @@ -14287,27 +14660,27 @@ var ts; return type; } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 171: - case 172: + case 173: + case 174: return isContextSensitiveFunctionLikeDeclaration(node); - case 163: + case 165: return ts.forEach(node.properties, isContextSensitive); - case 162: + case 164: return ts.forEach(node.elements, isContextSensitive); - case 180: + case 182: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 179: - return node.operatorToken.kind === 51 && + case 181: + return node.operatorToken.kind === 52 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 243: + case 245: return isContextSensitive(node.initializer); - case 141: - case 140: + case 143: + case 142: return isContextSensitiveFunctionLikeDeclaration(node); - case 170: + case 172: return isContextSensitive(node.expression); } return false; @@ -14420,7 +14793,9 @@ var ts; } return 0; } - source = getRegularTypeOfObjectLiteral(source); + if (target.flags & 49152) { + source = getRegularTypeOfObjectLiteral(source); + } } var saveErrorInfo = errorInfo; if (source.flags & 16384) { @@ -14458,7 +14833,7 @@ var ts; } else { if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { return result; } } @@ -14480,7 +14855,7 @@ var ts; var result; if (source.flags & 80896 && target.flags & 80896) { if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, false)) { + if (result = typeArgumentsRelatedTo(source, target, false)) { return result; } } @@ -14590,9 +14965,14 @@ var ts; } return result; } - function typesRelatedTo(sources, targets, reportErrors) { + function typeArgumentsRelatedTo(source, target, reportErrors) { + var sources = source.typeArguments || emptyArray; + var targets = target.typeArguments || emptyArray; + if (sources.length !== targets.length && relation === identityRelation) { + return 0; + } var result = -1; - for (var i = 0, len = sources.length; i < len; i++) { + for (var i = 0; i < targets.length; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0; @@ -14819,8 +15199,8 @@ var ts; return result; function abstractSignatureRelatedTo(source, sourceSig, target, targetSig) { if (sourceSig && targetSig) { - var sourceDecl = source.symbol && ts.getDeclarationOfKind(source.symbol, 212); - var targetDecl = target.symbol && ts.getDeclarationOfKind(target.symbol, 212); + var sourceDecl = source.symbol && getClassLikeDeclarationOfSymbol(source.symbol); + var targetDecl = target.symbol && getClassLikeDeclarationOfSymbol(target.symbol); if (!sourceDecl) { return -1; } @@ -14828,8 +15208,8 @@ var ts; var targetErasedSignature = getErasedSignature(targetSig); var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 212); - var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 212); + var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && getClassLikeDeclarationOfSymbol(sourceReturnType.symbol); + var targetReturnDecl = targetReturnType && targetReturnType.symbol && getClassLikeDeclarationOfSymbol(targetReturnType.symbol); var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256; var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256; if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { @@ -15074,11 +15454,10 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - var sourceLen = source.parameters.length; var targetLen = target.parameters.length; for (var i = 0; i < targetLen; i++) { - var s = source.hasRestParameter && i === sourceLen - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = target.hasRestParameter && i === targetLen - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); var related = compareTypes(s, t); if (!related) { return 0; @@ -15090,6 +15469,9 @@ var ts; } return result; } + function isRestParameterIndex(signature, parameterIndex) { + return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; + } function isSupertypeOfEach(candidate, types) { for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; @@ -15152,6 +15534,7 @@ var ts; regularType.constructSignatures = type.constructSignatures; regularType.stringIndexType = type.stringIndexType; regularType.numberIndexType = type.numberIndexType; + type.regularType = regularType; } return regularType; } @@ -15242,22 +15625,22 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 139: - case 138: + case 141: + case 140: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 136: + case 138: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 211: - case 141: - case 140: + case 213: case 143: - case 144: - case 171: - case 172: + case 142: + case 145: + case 146: + case 173: + case 174: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -15353,9 +15736,10 @@ var ts; } } else if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - var sourceTypes = source.typeArguments; - var targetTypes = target.typeArguments; - for (var i = 0; i < sourceTypes.length; i++) { + var sourceTypes = source.typeArguments || emptyArray; + var targetTypes = target.typeArguments || emptyArray; + var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length; + for (var i = 0; i < count; i++) { inferFromTypes(sourceTypes[i], targetTypes[i]); } } @@ -15509,10 +15893,10 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 152: + case 154: return true; - case 67: - case 133: + case 69: + case 135: node = node.parent; continue; default: @@ -15552,12 +15936,12 @@ var ts; } return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 55 && node.operatorToken.kind <= 66) { + if (node.operatorToken.kind >= 56 && node.operatorToken.kind <= 68) { var n = node.left; - while (n.kind === 170) { + while (n.kind === 172) { n = n.expression; } - if (n.kind === 67 && getResolvedSymbol(n) === symbol) { + if (n.kind === 69 && getResolvedSymbol(n) === symbol) { return true; } } @@ -15571,55 +15955,55 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 179: + case 181: return isAssignedInBinaryExpression(node); - case 209: - case 161: - return isAssignedInVariableDeclaration(node); - case 159: - case 160: - case 162: + case 211: case 163: + return isAssignedInVariableDeclaration(node); + case 161: + case 162: case 164: case 165: case 166: case 167: + case 168: case 169: - case 187: - case 170: - case 177: - case 173: - case 176: - case 174: + case 171: + case 189: + case 172: + case 179: case 175: case 178: - case 182: + case 176: + case 177: case 180: - case 183: - case 190: - case 191: + case 184: + case 182: + case 185: + case 192: case 193: - case 194: case 195: case 196: case 197: case 198: case 199: - case 202: - case 203: + case 200: + case 201: case 204: - case 239: - case 240: case 205: case 206: - case 207: + case 241: case 242: - case 231: - case 232: - case 236: - case 237: + case 207: + case 208: + case 209: + case 244: case 233: + case 234: case 238: + case 239: + case 235: + case 240: return ts.forEachChild(node, isAssignedIn); } return false; @@ -15634,34 +16018,34 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 194: + case 196: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 180: + case 182: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 179: + case 181: if (child === node.right) { - if (node.operatorToken.kind === 50) { + if (node.operatorToken.kind === 51) { narrowedType = narrowType(type, node.left, true); } - else if (node.operatorToken.kind === 51) { + else if (node.operatorToken.kind === 52) { narrowedType = narrowType(type, node.left, false); } } break; - case 246: - case 216: - case 211: - case 141: - case 140: + case 248: + case 218: + case 213: case 143: - case 144: case 142: + case 145: + case 146: + case 144: break loop; } if (narrowedType !== type) { @@ -15675,12 +16059,12 @@ var ts; } return type; function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 174 || expr.right.kind !== 9) { + if (expr.left.kind !== 176 || expr.right.kind !== 9) { return type; } var left = expr.left; var right = expr.right; - if (left.expression.kind !== 67 || getResolvedSymbol(left.expression) !== symbol) { + if (left.expression.kind !== 69 || getResolvedSymbol(left.expression) !== symbol) { return type; } var typeInfo = primitiveTypeInfo[right.text]; @@ -15726,7 +16110,7 @@ var ts; } } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 67 || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 69 || getResolvedSymbol(expr.left) !== symbol) { return type; } var rightType = checkExpression(expr.right); @@ -15790,27 +16174,27 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 166: + case 168: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 170: + case 172: return narrowType(type, expr.expression, assumeTrue); - case 179: + case 181: var operator = expr.operatorToken.kind; if (operator === 32 || operator === 33) { return narrowTypeByEquality(type, expr, assumeTrue); } - else if (operator === 50) { + else if (operator === 51) { return narrowTypeByAnd(type, expr, assumeTrue); } - else if (operator === 51) { + else if (operator === 52) { return narrowTypeByOr(type, expr, assumeTrue); } - else if (operator === 89) { + else if (operator === 91) { return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 177: - if (expr.operator === 48) { + case 179: + if (expr.operator === 49) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -15822,7 +16206,7 @@ var ts; var symbol = getResolvedSymbol(node); if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 172) { + if (container.kind === 174) { if (languageVersion < 2) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } @@ -15853,15 +16237,15 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 242) { + symbol.valueDeclaration.parent.kind === 244) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 210) { + while (container.kind !== 212) { container = container.parent; } container = container.parent; - if (container.kind === 191) { + if (container.kind === 193) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -15879,7 +16263,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 139 || container.kind === 142) { + if (container.kind === 141 || container.kind === 144) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -15890,29 +16274,29 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 172) { + if (container.kind === 174) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 216: + case 218: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 215: + case 217: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 142: + case 144: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 139: - case 138: + case 141: + case 140: if (container.flags & 128) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 134: + case 136: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -15921,27 +16305,27 @@ var ts; } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); + return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; } return anyType; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 136) { + if (n.kind === 138) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 166 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 168 && node.parent.expression === node; var classDeclaration = ts.getContainingClass(node); var classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration)); var baseClassType = classType && getBaseTypes(classType)[0]; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 172) { + while (container && container.kind === 174) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -15967,7 +16351,7 @@ var ts; return unknownType; } if (!canUseSuperExpression) { - if (container && container.kind === 134) { + if (container && container.kind === 136) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { @@ -15978,7 +16362,7 @@ var ts; } return unknownType; } - if (container.kind === 142 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 144 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; } @@ -15990,24 +16374,24 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 142; + return container.kind === 144; } else { if (container && ts.isClassLike(container.parent)) { if (container.flags & 128) { - return container.kind === 141 || - container.kind === 140 || - container.kind === 143 || - container.kind === 144; + return container.kind === 143 || + container.kind === 142 || + container.kind === 145 || + container.kind === 146; } else { - return container.kind === 141 || + return container.kind === 143 || + container.kind === 142 || + container.kind === 145 || + container.kind === 146 || + container.kind === 141 || container.kind === 140 || - container.kind === 143 || - container.kind === 144 || - container.kind === 139 || - container.kind === 138 || - container.kind === 142; + container.kind === 144; } } } @@ -16015,8 +16399,8 @@ var ts; } } function getContextuallyTypedParameterType(parameter) { - if (isFunctionExpressionOrArrowFunction(parameter.parent)) { - var func = parameter.parent; + var func = parameter.parent; + if (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) { if (isContextSensitive(func)) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { @@ -16026,8 +16410,9 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && - funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (funcHasRestParameters && + indexOfParameter === (func.parameters.length - 1) && + isRestParameterIndex(contextualSignature, func.parameters.length - 1)) { return getTypeOfSymbol(ts.lastOrUndefined(contextualSignature.parameters)); } } @@ -16041,14 +16426,14 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 136) { + if (declaration.kind === 138) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; } } if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return getTypeFromBindingPattern(declaration.name, true); } } return undefined; @@ -16074,7 +16459,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 136 && node.parent.initializer === node) { + if (node.parent.kind === 138 && node.parent.initializer === node) { return true; } node = node.parent; @@ -16083,8 +16468,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 142 || - functionDecl.kind === 143 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 144))) { + functionDecl.kind === 144 || + functionDecl.kind === 145 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 146))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -16103,7 +16488,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 168) { + if (template.parent.kind === 170) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -16111,12 +16496,12 @@ var ts; function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; var operator = binaryExpression.operatorToken.kind; - if (operator >= 55 && operator <= 66) { + if (operator >= 56 && operator <= 68) { if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); } } - else if (operator === 51) { + else if (operator === 52) { var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); @@ -16203,7 +16588,7 @@ var ts; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } function getContextualTypeForJsxExpression(expr) { - if (expr.parent.kind === 236) { + if (expr.parent.kind === 238) { var attrib = expr.parent; var attrsType = getJsxElementAttributesType(attrib.parent); if (!attrsType || isTypeAny(attrsType)) { @@ -16213,7 +16598,7 @@ var ts; return getTypeOfPropertyOfType(attrsType, attrib.name.text); } } - if (expr.kind === 237) { + if (expr.kind === 239) { return getJsxElementAttributesType(expr.parent); } return undefined; @@ -16231,38 +16616,38 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 209: - case 136: - case 139: + case 211: case 138: - case 161: + case 141: + case 140: + case 163: return getContextualTypeForInitializerExpression(node); - case 172: - case 202: + case 174: + case 204: return getContextualTypeForReturnExpression(node); - case 182: + case 184: return getContextualTypeForYieldOperand(parent); - case 166: - case 167: - return getContextualTypeForArgument(parent, node); + case 168: case 169: - case 187: + return getContextualTypeForArgument(parent, node); + case 171: + case 189: return getTypeFromTypeNode(parent.type); - case 179: + case 181: return getContextualTypeForBinaryOperand(node); - case 243: + case 245: return getContextualTypeForObjectLiteralElement(parent); - case 162: + case 164: return getContextualTypeForElementExpression(node); - case 180: + case 182: return getContextualTypeForConditionalOperand(node); - case 188: - ts.Debug.assert(parent.parent.kind === 181); + case 190: + ts.Debug.assert(parent.parent.kind === 183); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 170: + case 172: return getContextualType(parent); - case 238: - case 237: + case 240: + case 239: return getContextualTypeForJsxExpression(parent); } return undefined; @@ -16277,7 +16662,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 171 || node.kind === 172; + return node.kind === 173 || node.kind === 174; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -16285,7 +16670,7 @@ var ts; : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); @@ -16325,13 +16710,13 @@ var ts; } function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 179 && parent.operatorToken.kind === 55 && parent.left === node) { + if (parent.kind === 181 && parent.operatorToken.kind === 56 && parent.left === node) { return true; } - if (parent.kind === 243) { + if (parent.kind === 245) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 162) { + if (parent.kind === 164) { return isAssignmentTarget(parent); } return false; @@ -16340,17 +16725,18 @@ var ts; var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } + function hasDefaultValue(node) { + return (node.kind === 163 && !!node.initializer) || + (node.kind === 181 && node.operatorToken.kind === 56); + } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; - if (!elements.length) { - return createArrayType(undefinedType); - } var hasSpreadElement = false; var elementTypes = []; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0; _i < elements.length; _i++) { var e = elements[_i]; - if (inDestructuringPattern && e.kind === 183) { + if (inDestructuringPattern && e.kind === 185) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); @@ -16362,18 +16748,41 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 183; + hasSpreadElement = hasSpreadElement || e.kind === 185; } if (!hasSpreadElement) { + if (inDestructuringPattern && elementTypes.length) { + var type = createNewTupleType(elementTypes); + type.pattern = node; + return type; + } var contextualType = getContextualType(node); - if (contextualType && contextualTypeIsTupleLikeType(contextualType) || inDestructuringPattern) { - return createTupleType(elementTypes); + if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { + var pattern = contextualType.pattern; + if (pattern && (pattern.kind === 162 || pattern.kind === 164)) { + var patternElements = pattern.elements; + for (var i = elementTypes.length; i < patternElements.length; i++) { + var patternElement = patternElements[i]; + if (hasDefaultValue(patternElement)) { + elementTypes.push(contextualType.elementTypes[i]); + } + else { + if (patternElement.kind !== 187) { + error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + elementTypes.push(unknownType); + } + } + } + if (elementTypes.length) { + return createTupleType(elementTypes); + } } } - return createArrayType(getUnionType(elementTypes)); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); } function isNumericName(name) { - return name.kind === 134 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 136 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 132); @@ -16398,30 +16807,49 @@ var ts; return links.resolvedType; } function checkObjectLiteral(node, contextualMapper) { - checkGrammarObjectLiteralExpression(node); + var inDestructuringPattern = isAssignmentTarget(node); + checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = {}; var propertiesArray = []; var contextualType = getContextualType(node); + var contextualTypeHasPattern = contextualType && contextualType.pattern && + (contextualType.pattern.kind === 161 || contextualType.pattern.kind === 165); var typeFlags = 0; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 243 || - memberDecl.kind === 244 || + if (memberDecl.kind === 245 || + memberDecl.kind === 246 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 243) { + if (memberDecl.kind === 245) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 141) { + else if (memberDecl.kind === 143) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 244); + ts.Debug.assert(memberDecl.kind === 246); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); + if (inDestructuringPattern) { + var isOptional = (memberDecl.kind === 245 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 246 && memberDecl.objectAssignmentInitializer); + if (isOptional) { + prop.flags |= 536870912; + } + } + else if (contextualTypeHasPattern) { + var impliedProp = getPropertyOfType(contextualType, member.name); + if (impliedProp) { + prop.flags |= impliedProp.flags & 536870912; + } + else if (!compilerOptions.suppressExcessPropertyErrors) { + error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); + } + } prop.declarations = member.declarations; prop.parent = member.parent; if (member.valueDeclaration) { @@ -16432,7 +16860,7 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 143 || memberDecl.kind === 144); + ts.Debug.assert(memberDecl.kind === 145 || memberDecl.kind === 146); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -16440,11 +16868,26 @@ var ts; } propertiesArray.push(member); } + if (contextualTypeHasPattern) { + for (var _b = 0, _c = getPropertiesOfType(contextualType); _b < _c.length; _b++) { + var prop = _c[_b]; + if (!ts.hasProperty(propertiesTable, prop.name)) { + if (!(prop.flags & 536870912)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable[prop.name] = prop; + propertiesArray.push(prop); + } + } + } var stringIndexType = getIndexType(0); var numberIndexType = getIndexType(1); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; result.flags |= 524288 | 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); + if (inDestructuringPattern) { + result.pattern = node; + } return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { @@ -16473,7 +16916,7 @@ var ts; if (lhs.kind !== rhs.kind) { return false; } - if (lhs.kind === 67) { + if (lhs.kind === 69) { return lhs.text === rhs.text; } return lhs.right.text === rhs.right.text && @@ -16490,17 +16933,17 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 238: + case 240: checkJsxExpression(child); break; - case 231: + case 233: checkJsxElement(child); break; - case 232: + case 234: checkJsxSelfClosingElement(child); break; default: - ts.Debug.assert(child.kind === 234); + ts.Debug.assert(child.kind === 236); } } return jsxElementType || anyType; @@ -16509,7 +16952,7 @@ var ts; return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 133) { + if (tagName.kind === 135) { return false; } else { @@ -16610,12 +17053,14 @@ var ts; var valueSymbol = resolveJsxTagName(node); if (valueSymbol && valueSymbol !== unknownSymbol) { links.jsxFlags |= 4; - getSymbolLinks(valueSymbol).referenced = true; + if (valueSymbol.flags & 8388608) { + markAliasSymbolAsReferenced(valueSymbol); + } } return valueSymbol || unknownSymbol; } function resolveJsxTagName(node) { - if (node.tagName.kind === 67) { + if (node.tagName.kind === 69) { var tag = node.tagName; var sym = getResolvedSymbol(tag); return sym.exportSymbol || sym; @@ -16755,11 +17200,11 @@ var ts; var nameTable = {}; var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 236) { + if (node.attributes[i].kind === 238) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 237); + ts.Debug.assert(node.attributes[i].kind === 239); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -16785,7 +17230,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 139; + return s.valueDeclaration ? s.valueDeclaration.kind : 141; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; @@ -16793,11 +17238,11 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(prop.parent); - if (left.kind === 93) { - var errorNode = node.kind === 164 ? + if (left.kind === 95) { + var errorNode = node.kind === 166 ? node.name : node.right; - if (getDeclarationKindFromSymbol(prop) !== 141) { + if (getDeclarationKindFromSymbol(prop) !== 143) { error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } @@ -16818,7 +17263,7 @@ var ts; } return true; } - if (left.kind === 93) { + if (left.kind === 95) { return true; } if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { @@ -16828,6 +17273,9 @@ var ts; if (flags & 128) { return true; } + if (type.flags & 33554432) { + type = getConstraintOfTypeParameter(type); + } if (!(getTargetType(type).flags & (1024 | 2048) && hasBaseType(type, enclosingClass))) { error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; @@ -16852,18 +17300,18 @@ var ts; var prop = getPropertyOfType(apparentType, right.text); if (!prop) { if (right.text) { - error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type)); + error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type.flags & 33554432 ? apparentType : type)); } return unknownType; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 32) { - checkClassPropertyAccess(node, left, type, prop); + checkClassPropertyAccess(node, left, apparentType, prop); } return getTypeOfSymbol(prop); } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 164 + var left = node.kind === 166 ? node.expression : node.left; var type = checkExpression(left); @@ -16878,7 +17326,7 @@ var ts; function checkIndexedAccess(node) { if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 167 && node.parent.expression === node) { + if (node.parent.kind === 169 && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -16937,6 +17385,12 @@ var ts; if (indexArgumentExpression.kind === 9 || indexArgumentExpression.kind === 8) { return indexArgumentExpression.text; } + if (indexArgumentExpression.kind === 167 || indexArgumentExpression.kind === 166) { + var value = getConstantValue(indexArgumentExpression); + if (value !== undefined) { + return value.toString(); + } + } if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { var rightHandSideName = indexArgumentExpression.name.text; return ts.getPropertyNameForKnownSymbolName(rightHandSideName); @@ -16974,10 +17428,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 168) { + if (node.kind === 170) { checkExpression(node.template); } - else if (node.kind !== 137) { + else if (node.kind !== 139) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -17028,7 +17482,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 183) { + if (arg && arg.kind === 185) { return i; } } @@ -17040,11 +17494,11 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 168) { + if (node.kind === 170) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 181) { + if (tagExpression.template.kind === 183) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -17056,7 +17510,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 137) { + else if (node.kind === 139) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, undefined, signature); @@ -17064,7 +17518,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 167); + ts.Debug.assert(callExpression.kind === 169); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; @@ -17078,7 +17532,7 @@ var ts; return false; } if (spreadArgIndex >= 0) { - return signature.hasRestParameter && spreadArgIndex >= signature.parameters.length - 1; + return isRestParameterIndex(signature, spreadArgIndex); } if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { return false; @@ -17117,7 +17571,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 185) { + if (arg === undefined || arg.kind !== 187) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -17164,7 +17618,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 185) { + if (arg === undefined || arg.kind !== 187) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -17183,16 +17637,16 @@ var ts; } function getEffectiveCallArguments(node) { var args; - if (node.kind === 168) { + if (node.kind === 170) { var template = node.template; args = [undefined]; - if (template.kind === 181) { + if (template.kind === 183) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 137) { + else if (node.kind === 139) { return undefined; } else { @@ -17201,18 +17655,21 @@ var ts; return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 137) { + if (node.kind === 139) { switch (node.parent.kind) { - case 212: - case 184: + case 214: + case 186: return 1; - case 139: - return 2; case 141: + return 2; case 143: - case 144: + case 145: + case 146: + if (languageVersion === 0) { + return 2; + } return signature.parameters.length >= 3 ? 3 : 2; - case 136: + case 138: return 3; } } @@ -17221,83 +17678,83 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - switch (node.kind) { - case 212: - case 184: + if (node.kind === 214) { + var classSymbol = getSymbolOfNode(node); + return getTypeOfSymbol(classSymbol); + } + if (node.kind === 138) { + node = node.parent; + if (node.kind === 144) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); - case 136: - node = node.parent; - if (node.kind === 142) { - var classSymbol_1 = getSymbolOfNode(node); - return getTypeOfSymbol(classSymbol_1); - } - case 139: - case 141: - case 143: - case 144: - return getParentTypeOfClassElement(node); - default: - ts.Debug.fail("Unsupported decorator target."); - return unknownType; + } } + if (node.kind === 141 || + node.kind === 143 || + node.kind === 145 || + node.kind === 146) { + return getParentTypeOfClassElement(node); + } + ts.Debug.fail("Unsupported decorator target."); + return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - switch (node.kind) { - case 212: - ts.Debug.fail("Class decorators should not have a second synthetic argument."); - return unknownType; - case 136: - node = node.parent; - if (node.kind === 142) { - return anyType; - } - case 139: - case 141: - case 143: - case 144: - var element = node; - switch (element.name.kind) { - case 67: - case 8: - case 9: - return getStringLiteralType(element.name); - case 134: - var nameType = checkComputedPropertyName(element.name); - if (allConstituentTypesHaveKind(nameType, 16777216)) { - return nameType; - } - else { - return stringType; - } - default: - ts.Debug.fail("Unsupported property name."); - return unknownType; - } - default: - ts.Debug.fail("Unsupported decorator target."); - return unknownType; + if (node.kind === 214) { + ts.Debug.fail("Class decorators should not have a second synthetic argument."); + return unknownType; } + if (node.kind === 138) { + node = node.parent; + if (node.kind === 144) { + return anyType; + } + } + if (node.kind === 141 || + node.kind === 143 || + node.kind === 145 || + node.kind === 146) { + var element = node; + switch (element.name.kind) { + case 69: + case 8: + case 9: + return getStringLiteralType(element.name); + case 136: + var nameType = checkComputedPropertyName(element.name); + if (allConstituentTypesHaveKind(nameType, 16777216)) { + return nameType; + } + else { + return stringType; + } + default: + ts.Debug.fail("Unsupported property name."); + return unknownType; + } + } + ts.Debug.fail("Unsupported decorator target."); + return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - switch (node.kind) { - case 212: - ts.Debug.fail("Class decorators should not have a third synthetic argument."); - return unknownType; - case 136: - return numberType; - case 139: - ts.Debug.fail("Property decorators should not have a third synthetic argument."); - return unknownType; - case 141: - case 143: - case 144: - var propertyType = getTypeOfNode(node); - return createTypedPropertyDescriptorType(propertyType); - default: - ts.Debug.fail("Unsupported decorator target."); - return unknownType; + if (node.kind === 214) { + ts.Debug.fail("Class decorators should not have a third synthetic argument."); + return unknownType; } + if (node.kind === 138) { + return numberType; + } + if (node.kind === 141) { + ts.Debug.fail("Property decorators should not have a third synthetic argument."); + return unknownType; + } + if (node.kind === 143 || + node.kind === 145 || + node.kind === 146) { + var propertyType = getTypeOfNode(node); + return createTypedPropertyDescriptorType(propertyType); + } + ts.Debug.fail("Unsupported decorator target."); + return unknownType; } function getEffectiveDecoratorArgumentType(node, argIndex) { if (argIndex === 0) { @@ -17313,26 +17770,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex, arg) { - if (node.kind === 137) { + if (node.kind === 139) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 168) { + else if (argIndex === 0 && node.kind === 170) { return globalTemplateStringsArrayType; } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 137 || - (argIndex === 0 && node.kind === 168)) { + if (node.kind === 139 || + (argIndex === 0 && node.kind === 170)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 137) { + if (node.kind === 139) { return node.expression; } - else if (argIndex === 0 && node.kind === 168) { + else if (argIndex === 0 && node.kind === 170) { return node.template; } else { @@ -17340,12 +17797,12 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 168; - var isDecorator = node.kind === 137; + var isTaggedTemplate = node.kind === 170; + var isDecorator = node.kind === 139; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; - if (node.expression.kind !== 93) { + if (node.expression.kind !== 95) { ts.forEach(typeArguments, checkSourceElement); } } @@ -17483,7 +17940,7 @@ var ts; } } function resolveCallExpression(node, candidatesOutArray) { - if (node.expression.kind === 93) { + if (node.expression.kind === 95) { var superType = checkSuperExpression(node.expression); if (superType !== unknownType) { var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); @@ -17528,7 +17985,7 @@ var ts; if (expressionType === unknownType) { return resolveErrorCall(node); } - var valueDecl = expressionType.symbol && ts.getDeclarationOfKind(expressionType.symbol, 212); + var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); if (valueDecl && valueDecl.flags & 256) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); @@ -17572,16 +18029,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 212: - case 184: + case 214: + case 186: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 136: + case 138: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 139: - return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; case 141: + return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; case 143: - case 144: + case 145: + case 146: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -17609,16 +18066,16 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 166) { + if (node.kind === 168) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 167) { + else if (node.kind === 169) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 168) { + else if (node.kind === 170) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } - else if (node.kind === 137) { + else if (node.kind === 139) { links.resolvedSignature = resolveDecorator(node, candidatesOutArray); } else { @@ -17630,15 +18087,15 @@ var ts; function checkCallExpression(node) { checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); var signature = getResolvedSignature(node); - if (node.expression.kind === 93) { + if (node.expression.kind === 95) { return voidType; } - if (node.kind === 167) { + if (node.kind === 169) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 142 && - declaration.kind !== 146 && - declaration.kind !== 151) { + declaration.kind !== 144 && + declaration.kind !== 148 && + declaration.kind !== 153) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -17673,16 +18130,30 @@ var ts; var contextualParameterType = getTypeAtPosition(context, i); assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); } - if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { + if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) { var parameter = ts.lastOrUndefined(signature.parameters); var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); } } + function assignBindingElementTypes(node) { + if (ts.isBindingPattern(node.name)) { + for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 187) { + if (element.name.kind === 69) { + getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); + } + assignBindingElementTypes(element); + } + } + } + } function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { var links = getSymbolLinks(parameter); if (!links.type) { links.type = instantiateType(contextualType, mapper); + assignBindingElementTypes(parameter.valueDeclaration); } else if (isInferentialContext(mapper)) { inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); @@ -17703,7 +18174,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 190) { + if (func.body.kind !== 192) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); @@ -17807,7 +18278,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 206); + return (body.statements.length === 1) && (body.statements[0].kind === 208); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -17816,7 +18287,7 @@ var ts; if (returnType === voidType || isTypeAny(returnType)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 190) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 192) { return; } var bodyBlock = func.body; @@ -17829,9 +18300,9 @@ var ts; error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 171) { + if (!hasGrammarError && node.kind === 173) { checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -17867,14 +18338,14 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 141 && node.kind !== 140) { + if (produceDiagnostics && node.kind !== 143 && node.kind !== 142) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 143 || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { emitAwaiter = true; @@ -17891,7 +18362,7 @@ var ts; if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 190) { + if (node.body.kind === 192) { checkSourceElement(node.body); } else { @@ -17923,17 +18394,17 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 67: { + case 69: { var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; } - case 164: { + case 166: { var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; } - case 165: + case 167: return true; - case 170: + case 172: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -17941,12 +18412,12 @@ var ts; } function isConstVariableReference(n) { switch (n.kind) { - case 67: - case 164: { + case 69: + case 166: { var symbol = findSymbol(n); return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 32768) !== 0; } - case 165: { + case 167: { var index = n.argumentExpression; var symbol = findSymbol(n.expression); if (symbol && index && index.kind === 9) { @@ -17956,7 +18427,7 @@ var ts; } return false; } - case 170: + case 172: return isConstVariableReference(n.expression); default: return false; @@ -18001,15 +18472,15 @@ var ts; switch (node.operator) { case 35: case 36: - case 49: + case 50: if (someConstituentTypeHasKind(operandType, 16777216)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; - case 48: + case 49: return booleanType; - case 40: case 41: + case 42: var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); @@ -18064,21 +18535,21 @@ var ts; function isConstEnumSymbol(symbol) { return (symbol.flags & 128) !== 0; } - function checkInstanceOfExpression(node, leftType, rightType) { + function checkInstanceOfExpression(left, right, leftType, rightType) { if (allConstituentTypesHaveKind(leftType, 16777726)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { - error(node.right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); + error(right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; } - function checkInExpression(node, leftType, rightType) { + function checkInExpression(left, right, leftType, rightType) { if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 | 132 | 16777216)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); + error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 | 512)) { - error(node.right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; } @@ -18086,7 +18557,7 @@ var ts; var properties = node.properties; for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 243 || p.kind === 244) { + if (p.kind === 245 || p.kind === 246) { var name_14 = p.name; var type = isTypeAny(sourceType) ? sourceType @@ -18094,7 +18565,12 @@ var ts; isNumericLiteralName(name_14.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { - checkDestructuringAssignment(p.initializer || name_14, type); + if (p.kind === 246) { + checkDestructuringAssignment(p, type); + } + else { + checkDestructuringAssignment(p.initializer || name_14, type); + } } else { error(name_14, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_14)); @@ -18111,8 +18587,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 185) { - if (e.kind !== 183) { + if (e.kind !== 187) { + if (e.kind !== 185) { var propName = "" + i; var type = isTypeAny(sourceType) ? sourceType @@ -18137,7 +18613,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 179 && restExpression.operatorToken.kind === 55) { + if (restExpression.kind === 181 && restExpression.operatorToken.kind === 56) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -18149,15 +18625,26 @@ var ts; } return sourceType; } - function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 179 && target.operatorToken.kind === 55) { + function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { + var target; + if (exprOrAssignment.kind === 246) { + var prop = exprOrAssignment; + if (prop.objectAssignmentInitializer) { + checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); + } + target = exprOrAssignment.name; + } + else { + target = exprOrAssignment; + } + if (target.kind === 181 && target.operatorToken.kind === 56) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 163) { + if (target.kind === 165) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 162) { + if (target.kind === 164) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -18170,33 +18657,38 @@ var ts; return sourceType; } function checkBinaryExpression(node, contextualMapper) { - var operator = node.operatorToken.kind; - if (operator === 55 && (node.left.kind === 163 || node.left.kind === 162)) { - return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); + return checkBinaryLikeExpression(node.left, node.operatorToken, node.right, contextualMapper, node); + } + function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { + var operator = operatorToken.kind; + if (operator === 56 && (left.kind === 165 || left.kind === 164)) { + return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } - var leftType = checkExpression(node.left, contextualMapper); - var rightType = checkExpression(node.right, contextualMapper); + var leftType = checkExpression(left, contextualMapper); + var rightType = checkExpression(right, contextualMapper); switch (operator) { case 37: - case 58: case 38: case 59: - case 39: case 60: - case 36: - case 57: - case 42: + case 39: case 61: - case 43: + case 40: case 62: - case 44: + case 36: + case 58: + case 43: case 63: - case 46: + case 44: + case 64: + case 45: case 65: case 47: + case 67: + case 48: + case 68: + case 46: case 66: - case 45: - case 64: if (leftType.flags & (32 | 64)) leftType = rightType; if (rightType.flags & (32 | 64)) @@ -18204,19 +18696,19 @@ var ts; var suggestedOperator; if ((leftType.flags & 8) && (rightType.flags & 8) && - (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { - error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); + (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) { + error(errorNode || operatorToken, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { - var leftOk = checkArithmeticOperandType(node.left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); - var rightOk = checkArithmeticOperandType(node.right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var leftOk = checkArithmeticOperandType(left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var rightOk = checkArithmeticOperandType(right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); if (leftOk && rightOk) { checkAssignmentOperator(numberType); } } return numberType; case 35: - case 56: + case 57: if (leftType.flags & (32 | 64)) leftType = rightType; if (rightType.flags & (32 | 64)) @@ -18240,7 +18732,7 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 56) { + if (operator === 57) { checkAssignmentOperator(resultType); } return resultType; @@ -18259,23 +18751,23 @@ var ts; reportOperatorError(); } return booleanType; - case 89: - return checkInstanceOfExpression(node, leftType, rightType); - case 88: - return checkInExpression(node, leftType, rightType); - case 50: - return rightType; + case 91: + return checkInstanceOfExpression(left, right, leftType, rightType); + case 90: + return checkInExpression(left, right, leftType, rightType); case 51: + return rightType; + case 52: return getUnionType([leftType, rightType]); - case 55: + case 56: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); case 24: return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216) ? node.left : - someConstituentTypeHasKind(rightType, 16777216) ? node.right : + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216) ? left : + someConstituentTypeHasKind(rightType, 16777216) ? right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); @@ -18285,29 +18777,29 @@ var ts; } function getSuggestedBooleanOperator(operator) { switch (operator) { - case 46: - case 65: - return 51; case 47: - case 66: + case 67: + return 52; + case 48: + case 68: return 33; - case 45: - case 64: - return 50; + case 46: + case 66: + return 51; default: return undefined; } } function checkAssignmentOperator(valueType) { - if (produceDiagnostics && operator >= 55 && operator <= 66) { - var ok = checkReferenceExpression(node.left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + if (produceDiagnostics && operator >= 56 && operator <= 68) { + var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); if (ok) { - checkTypeAssignableTo(valueType, leftType, node.left, undefined); + checkTypeAssignableTo(valueType, leftType, left, undefined); } } } function reportOperatorError() { - error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); + error(errorNode || operatorToken, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), typeToString(leftType), typeToString(rightType)); } } function isYieldExpressionInClass(node) { @@ -18383,14 +18875,14 @@ var ts; return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 134) { + if (node.name.kind === 136) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 134) { + if (node.name.kind === 136) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -18413,7 +18905,7 @@ var ts; } function checkExpression(node, contextualMapper) { var type; - if (node.kind === 133) { + if (node.kind === 135) { type = checkQualifiedName(node); } else { @@ -18421,9 +18913,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 164 && node.parent.expression === node) || - (node.parent.kind === 165 && node.parent.expression === node) || - ((node.kind === 67 || node.kind === 133) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 166 && node.parent.expression === node) || + (node.parent.kind === 167 && node.parent.expression === node) || + ((node.kind === 69 || node.kind === 135) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -18436,78 +18928,78 @@ var ts; } function checkExpressionWorker(node, contextualMapper) { switch (node.kind) { - case 67: + case 69: return checkIdentifier(node); - case 95: - return checkThisExpression(node); - case 93: - return checkSuperExpression(node); - case 91: - return nullType; case 97: - case 82: + return checkThisExpression(node); + case 95: + return checkSuperExpression(node); + case 93: + return nullType; + case 99: + case 84: return booleanType; case 8: return checkNumericLiteral(node); - case 181: + case 183: return checkTemplateExpression(node); case 9: case 11: return stringType; case 10: return globalRegExpType; - case 162: - return checkArrayLiteral(node, contextualMapper); - case 163: - return checkObjectLiteral(node, contextualMapper); case 164: - return checkPropertyAccessExpression(node); + return checkArrayLiteral(node, contextualMapper); case 165: - return checkIndexedAccess(node); + return checkObjectLiteral(node, contextualMapper); case 166: + return checkPropertyAccessExpression(node); case 167: - return checkCallExpression(node); + return checkIndexedAccess(node); case 168: - return checkTaggedTemplateExpression(node); - case 170: - return checkExpression(node.expression, contextualMapper); - case 184: - return checkClassExpression(node); - case 171: - case 172: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 174: - return checkTypeOfExpression(node); case 169: - case 187: - return checkAssertion(node); + return checkCallExpression(node); + case 170: + return checkTaggedTemplateExpression(node); + case 172: + return checkExpression(node.expression, contextualMapper); + case 186: + return checkClassExpression(node); case 173: - return checkDeleteExpression(node); - case 175: - return checkVoidExpression(node); + case 174: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case 176: - return checkAwaitExpression(node); + return checkTypeOfExpression(node); + case 171: + case 189: + return checkAssertion(node); + case 175: + return checkDeleteExpression(node); case 177: - return checkPrefixUnaryExpression(node); + return checkVoidExpression(node); case 178: - return checkPostfixUnaryExpression(node); + return checkAwaitExpression(node); case 179: - return checkBinaryExpression(node, contextualMapper); + return checkPrefixUnaryExpression(node); case 180: - return checkConditionalExpression(node, contextualMapper); - case 183: - return checkSpreadElementExpression(node, contextualMapper); - case 185: - return undefinedType; + return checkPostfixUnaryExpression(node); + case 181: + return checkBinaryExpression(node, contextualMapper); case 182: + return checkConditionalExpression(node, contextualMapper); + case 185: + return checkSpreadElementExpression(node, contextualMapper); + case 187: + return undefinedType; + case 184: return checkYieldExpression(node); - case 238: + case 240: return checkJsxExpression(node); - case 231: - return checkJsxElement(node); - case 232: - return checkJsxSelfClosingElement(node); case 233: + return checkJsxElement(node); + case 234: + return checkJsxSelfClosingElement(node); + case 235: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -18523,16 +19015,12 @@ var ts; } } function checkParameter(node) { - // Grammar checking - // It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs as the - // Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code - // or if its FunctionBody is strict code(11.1.5). checkGrammarDecorators(node) || checkGrammarModifiers(node); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (node.flags & 112) { func = ts.getContainingFunction(node); - if (!(func.kind === 142 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 144 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -18547,15 +19035,15 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 141 || - node.kind === 211 || - node.kind === 171; + return node.kind === 143 || + node.kind === 213 || + node.kind === 173; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { var param = parameterList[i]; - if (param.name.kind === 67 && + if (param.name.kind === 69 && param.name.text === parameter.text) { return i; } @@ -18565,30 +19053,30 @@ var ts; } function isInLegalTypePredicatePosition(node) { switch (node.parent.kind) { - case 172: - case 145: - case 211: - case 171: - case 150: - case 141: - case 140: + case 174: + case 147: + case 213: + case 173: + case 152: + case 143: + case 142: return node === node.parent.type; } return false; } function checkSignatureDeclaration(node) { - if (node.kind === 147) { + if (node.kind === 149) { checkGrammarIndexSignature(node); } - else if (node.kind === 150 || node.kind === 211 || node.kind === 151 || - node.kind === 145 || node.kind === 142 || - node.kind === 146) { + else if (node.kind === 152 || node.kind === 213 || node.kind === 153 || + node.kind === 147 || node.kind === 144 || + node.kind === 148) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === 148) { + if (node.type.kind === 150) { var typePredicate = getSignatureFromDeclaration(node).typePredicate; var typePredicateNode = node.type; if (isInLegalTypePredicatePosition(typePredicateNode)) { @@ -18607,19 +19095,19 @@ var ts; if (hasReportedError) { break; } - if (param.name.kind === 159 || - param.name.kind === 160) { + if (param.name.kind === 161 || + param.name.kind === 162) { (function checkBindingPattern(pattern) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.name.kind === 67 && + if (element.name.kind === 69 && element.name.text === typePredicate.parameterName) { error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, typePredicate.parameterName); hasReportedError = true; break; } - else if (element.name.kind === 160 || - element.name.kind === 159) { + else if (element.name.kind === 162 || + element.name.kind === 161) { checkBindingPattern(element.name); } } @@ -18643,10 +19131,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 146: + case 148: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 145: + case 147: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -18668,7 +19156,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 213) { + if (node.kind === 215) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -18683,7 +19171,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 128: + case 130: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -18691,7 +19179,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 126: + case 128: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -18731,7 +19219,7 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 166 && n.expression.kind === 93; + return n.kind === 168 && n.expression.kind === 95; } function containsSuperCallAsComputedPropertyName(n) { return n.name && containsSuperCall(n.name); @@ -18749,15 +19237,15 @@ var ts; return ts.forEachChild(n, containsSuperCall); } function markThisReferencesAsErrors(n) { - if (n.kind === 95) { + if (n.kind === 97) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 171 && n.kind !== 211) { + else if (n.kind !== 173 && n.kind !== 213) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 139 && + return n.kind === 141 && !(n.flags & 128) && !!n.initializer; } @@ -18777,7 +19265,7 @@ var ts; var superCallStatement; for (var _i = 0; _i < statements.length; _i++) { var statement = statements[_i]; - if (statement.kind === 193 && isSuperCallExpression(statement.expression)) { + if (statement.kind === 195 && isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; } @@ -18801,13 +19289,13 @@ var ts; function checkAccessorDeclaration(node) { if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 143) { + if (node.kind === 145) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 143 ? 144 : 143; + var otherKind = node.kind === 145 ? 146 : 145; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112) !== (otherAccessor.flags & 112))) { @@ -18892,9 +19380,9 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 213) { - ts.Debug.assert(signatureDeclarationNode.kind === 145 || signatureDeclarationNode.kind === 146); - var signatureKind = signatureDeclarationNode.kind === 145 ? 0 : 1; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 215) { + ts.Debug.assert(signatureDeclarationNode.kind === 147 || signatureDeclarationNode.kind === 148); + var signatureKind = signatureDeclarationNode.kind === 147 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -18912,7 +19400,10 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 213 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 215 && + n.parent.kind !== 214 && + n.parent.kind !== 186 && + ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -18988,10 +19479,12 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 141 || node.kind === 140); - ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); - var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(errorNode_1, diagnostic); + var reportError = (node.kind === 143 || node.kind === 142) && + (node.flags & 128) !== (subsequentNode.flags & 128); + if (reportError) { + var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + error(errorNode_1, diagnostic); + } return; } else if (ts.nodeIsPresent(subsequentNode.body)) { @@ -19020,11 +19513,11 @@ var ts; var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 213 || node.parent.kind === 153 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 215 || node.parent.kind === 155 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 211 || node.kind === 141 || node.kind === 140 || node.kind === 142) { + if (node.kind === 213 || node.kind === 143 || node.kind === 142 || node.kind === 144) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -19137,16 +19630,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 213: + case 215: return 2097152; - case 216: + case 218: return d.name.kind === 9 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 212: - case 215: + case 214: + case 217: return 2097152 | 1048576; - case 219: + case 221: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -19157,7 +19650,8 @@ var ts; } } function checkNonThenableType(type, location, message) { - if (!(type.flags & 1) && isTypeAssignableTo(type, getGlobalThenableType())) { + type = getWidenedType(type); + if (!isTypeAny(type) && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; @@ -19169,15 +19663,6 @@ var ts; return type; } function getPromisedType(promise) { - // - // { // promise - // then( // thenFunction - // onfulfilled: ( // onfulfilledParameterType - // value: T // valueParameterType - // ) => any - // ): any; - // } - // if (promise.flags & 1) { return undefined; } @@ -19253,9 +19738,12 @@ var ts; if (promiseType === unknownType && compilerOptions.isolatedModules) { return unknownType; } - var promiseConstructor = getMergedSymbol(promiseType.symbol); + var promiseConstructor = getNodeLinks(node.type).resolvedSymbol; if (!promiseConstructor || !symbolIsValue(promiseConstructor)) { - error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeToString(promiseType)); + var typeName = promiseConstructor + ? symbolToString(promiseConstructor) + : typeToString(promiseType); + error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); return unknownType; } var promiseConstructorType = getTypeOfSymbol(promiseConstructor); @@ -19281,22 +19769,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 212: + case 214: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 136: + case 138: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 139: + case 141: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 141: case 143: - case 144: + case 145: + case 146: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -19305,9 +19793,9 @@ var ts; checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo); } function checkTypeNodeAsExpression(node) { - if (node && node.kind === 149) { + if (node && node.kind === 151) { var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 149 ? 793056 : 1536; + var meaning = root.parent.kind === 151 ? 793056 : 1536; var rootSymbol = resolveName(root, root.text, meaning | 8388608, undefined, undefined); if (rootSymbol && rootSymbol.flags & 8388608) { var aliasTarget = resolveAlias(rootSymbol); @@ -19319,19 +19807,19 @@ var ts; } function checkTypeAnnotationAsExpression(node) { switch (node.kind) { - case 139: - checkTypeNodeAsExpression(node.type); - break; - case 136: - checkTypeNodeAsExpression(node.type); - break; case 141: checkTypeNodeAsExpression(node.type); break; + case 138: + checkTypeNodeAsExpression(node.type); + break; case 143: checkTypeNodeAsExpression(node.type); break; - case 144: + case 145: + checkTypeNodeAsExpression(node.type); + break; + case 146: checkTypeNodeAsExpression(ts.getSetAccessorTypeAnnotationNode(node)); break; } @@ -19354,24 +19842,24 @@ var ts; } if (compilerOptions.emitDecoratorMetadata) { switch (node.kind) { - case 212: + case 214: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 141: - checkParameterTypeAnnotationsAsExpressions(node); - case 144: case 143: - case 139: - case 136: + checkParameterTypeAnnotationsAsExpressions(node); + case 146: + case 145: + case 141: + case 138: checkTypeAnnotationAsExpression(node); break; } } emitDecorate = true; - if (node.kind === 136) { + if (node.kind === 138) { emitParam = true; } ts.forEach(node.decorators, checkDecorator); @@ -19389,12 +19877,9 @@ var ts; checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { - if (!compilerOptions.experimentalAsyncFunctions) { - error(node, ts.Diagnostics.Experimental_support_for_async_functions_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalAsyncFunctions_to_remove_this_warning); - } emitAwaiter = true; } - if (node.name && node.name.kind === 134) { + if (node.name && node.name.kind === 136) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -19429,11 +19914,11 @@ var ts; } } function checkBlock(node) { - if (node.kind === 190) { + if (node.kind === 192) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 217) { + if (ts.isFunctionBlock(node) || node.kind === 219) { checkFunctionAndClassExpressionBodies(node); } } @@ -19451,19 +19936,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 139 || - node.kind === 138 || - node.kind === 141 || + if (node.kind === 141 || node.kind === 140 || node.kind === 143 || - node.kind === 144) { + node.kind === 142 || + node.kind === 145 || + node.kind === 146) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 136 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 138 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -19477,7 +19962,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4) { - var isDeclaration_1 = node.kind !== 67; + var isDeclaration_1 = node.kind !== 69; if (isDeclaration_1) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -19498,7 +19983,7 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 67; + var isDeclaration_2 = node.kind !== 69; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -19511,22 +19996,19 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 216 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 218 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 246 && ts.isExternalModule(parent)) { + if (parent.kind === 248 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkVarDeclaredNamesNotShadowed(node) { - // - ScriptBody : StatementList - // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList - // also occurs in the VarDeclaredNames of StatementList. if ((ts.getCombinedNodeFlags(node) & 49152) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 209 && !node.initializer) { + if (node.kind === 211 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -19536,15 +20018,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 49152) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 210); - var container = varDeclList.parent.kind === 191 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 212); + var container = varDeclList.parent.kind === 193 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 190 && ts.isFunctionLike(container.parent) || - container.kind === 217 || - container.kind === 216 || - container.kind === 246); + (container.kind === 192 && ts.isFunctionLike(container.parent) || + container.kind === 219 || + container.kind === 218 || + container.kind === 248); if (!namesShareScope) { var name_15 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_15, name_15); @@ -19554,16 +20036,16 @@ var ts; } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 136) { + if (ts.getRootDeclaration(node).kind !== 138) { return; } var func = ts.getContainingFunction(node); visit(node.initializer); function visit(n) { - if (n.kind === 67) { + if (n.kind === 69) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 136) { + if (referencedSymbol.valueDeclaration.kind === 138) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -19583,7 +20065,7 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 134) { + if (node.name.kind === 136) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); @@ -19592,7 +20074,7 @@ var ts; if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 136 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 138 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -19620,9 +20102,9 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 139 && node.kind !== 138) { + if (node.kind !== 141 && node.kind !== 140) { checkExportsOnMergedDeclarations(node); - if (node.kind === 209 || node.kind === 161) { + if (node.kind === 211 || node.kind === 163) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -19643,7 +20125,7 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 163) { + if (node.modifiers && node.parent.kind === 165) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -19676,12 +20158,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 210) { + if (node.initializer && node.initializer.kind === 212) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 210) { + if (node.initializer.kind === 212) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -19696,13 +20178,13 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 210) { + if (node.initializer.kind === 212) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 162 || varExpr.kind === 163) { + if (varExpr.kind === 164 || varExpr.kind === 165) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -19717,7 +20199,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 210) { + if (node.initializer.kind === 212) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -19727,7 +20209,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 162 || varExpr.kind === 163) { + if (varExpr.kind === 164 || varExpr.kind === 165) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258)) { @@ -19889,7 +20371,7 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 143 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 144))); + return !!(node.kind === 145 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 146))); } function checkReturnStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { @@ -19907,10 +20389,10 @@ var ts; if (func.asteriskToken) { return; } - if (func.kind === 144) { + if (func.kind === 146) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } - else if (func.kind === 142) { + else if (func.kind === 144) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -19919,7 +20401,9 @@ var ts; if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); var awaitedType = checkAwaitedType(exprType, node.expression, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + if (promisedType) { + checkTypeAssignableTo(awaitedType, promisedType, node.expression); + } } else { checkTypeAssignableTo(exprType, returnType, node.expression); @@ -19943,7 +20427,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 240 && !hasDuplicateDefaultClause) { + if (clause.kind === 242 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -19955,7 +20439,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 239) { + if (produceDiagnostics && clause.kind === 241) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -19972,7 +20456,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 205 && current.label.text === node.label.text) { + if (current.kind === 207 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -19998,7 +20482,7 @@ var ts; var catchClause = node.catchClause; if (catchClause) { if (catchClause.variableDeclaration) { - if (catchClause.variableDeclaration.name.kind !== 67) { + if (catchClause.variableDeclaration.name.kind !== 69) { grammarErrorOnFirstToken(catchClause.variableDeclaration.name, ts.Diagnostics.Catch_clause_variable_name_must_be_an_identifier); } else if (catchClause.variableDeclaration.type) { @@ -20066,7 +20550,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 134 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 136 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -20119,9 +20603,6 @@ var ts; grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); - if (getSymbolOfNode(node).flags & 64 && !ts.isInAmbientContext(node)) { - error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface); - } ts.forEach(node.members, checkSourceElement); } function checkClassLikeDeclaration(node) { @@ -20136,6 +20617,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); var staticType = getTypeOfSymbol(symbol); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { @@ -20154,7 +20636,7 @@ var ts; } } } - checkTypeAssignableTo(type, baseType, node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) { var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); @@ -20167,7 +20649,8 @@ var ts; } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { - ts.forEach(implementedTypeNodes, function (typeRefNode) { + for (var _b = 0; _b < implementedTypeNodes.length; _b++) { + var typeRefNode = implementedTypeNodes[_b]; if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } @@ -20177,14 +20660,14 @@ var ts; if (t !== unknownType) { var declaredType = (t.flags & 4096) ? t.target : t; if (declaredType.flags & (1024 | 2048)) { - checkTypeAssignableTo(type, t, node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface); } } } - }); + } } if (produceDiagnostics) { checkIndexConstraints(type); @@ -20194,20 +20677,10 @@ var ts; function getTargetSymbol(s) { return s.flags & 16777216 ? getSymbolLinks(s).target : s; } + function getClassLikeDeclarationOfSymbol(symbol) { + return ts.forEach(symbol.declarations, function (d) { return ts.isClassLike(d) ? d : undefined; }); + } function checkKindsOfPropertyMemberOverrides(type, baseType) { - // TypeScript 1.0 spec (April 2014): 8.2.3 - // A derived class inherits all members from its base class it doesn't override. - // Inheritance means that a derived class implicitly contains all non - overridden members of the base class. - // Both public and private property members are inherited, but only public property members can be overridden. - // A property member in a derived class is said to override a property member in a base class - // when the derived class property member has the same name and kind(instance or static) - // as the base class property member. - // The type of an overriding property member must be assignable(section 3.8.4) - // to the type of the overridden property member, or otherwise a compile - time error occurs. - // Base class instance member functions can be overridden by derived class instance member functions, - // but not by other kinds of members. - // Base class instance member variables and accessors can be overridden by - // derived class instance member variables and accessors, but not by other kinds of members. var baseProperties = getPropertiesOfObjectType(baseType); for (var _i = 0; _i < baseProperties.length; _i++) { var baseProperty = baseProperties[_i]; @@ -20220,9 +20693,14 @@ var ts; ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); if (derived) { if (derived === base) { - var derivedClassDecl = ts.getDeclarationOfKind(type.symbol, 212); + var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 256 && (!derivedClassDecl || !(derivedClassDecl.flags & 256))) { - error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType)); + if (derivedClassDecl.kind === 186) { + error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); + } + else { + error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType)); + } } } else { @@ -20261,7 +20739,7 @@ var ts; } } function isAccessor(kind) { - return kind === 143 || kind === 144; + return kind === 145 || kind === 146; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -20298,7 +20776,7 @@ var ts; var ok = true; for (var _i = 0; _i < baseTypes.length; _i++) { var base = baseTypes[_i]; - var properties = getPropertiesOfObjectType(base); + var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); for (var _a = 0; _a < properties.length; _a++) { var prop = properties[_a]; if (!ts.hasProperty(seen, prop.name)) { @@ -20327,7 +20805,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 213); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 215); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -20335,20 +20813,13 @@ var ts; } if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); + var typeWithThis = getTypeWithThisArgument(type); if (checkInheritedPropertiesAreIdentical(type, node.name)) { - ts.forEach(getBaseTypes(type), function (baseType) { - checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); - }); - checkIndexConstraints(type); - } - } - if (symbol && symbol.declarations) { - for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - if (declaration.kind === 212 && !ts.isInAmbientContext(declaration)) { - error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface); - break; + for (var _i = 0, _a = getBaseTypes(type); _i < _a.length; _i++) { + var baseType = _a[_i]; + checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); } + checkIndexConstraints(type); } } } @@ -20376,10 +20847,15 @@ var ts; var autoValue = 0; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); - ts.forEach(node.members, function (member) { - if (member.name.kind !== 134 && isNumericLiteralName(member.name.text)) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.name.kind === 136) { + error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); + } + else if (isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } + var previousEnumMemberIsNonConstant = autoValue === undefined; var initializer = member.initializer; if (initializer) { autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient); @@ -20387,10 +20863,13 @@ var ts; else if (ambient && !enumIsConst) { autoValue = undefined; } + else if (previousEnumMemberIsNonConstant) { + error(member.name, ts.Diagnostics.Enum_member_must_have_initializer); + } if (autoValue !== undefined) { getNodeLinks(member).enumMemberValue = autoValue++; } - }); + } nodeLinks.flags |= 8192; } function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { @@ -20401,7 +20880,10 @@ var ts; if (enumIsConst) { error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); } - else if (!ambient) { + else if (ambient) { + error(initializer, ts.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression); + } + else { checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined); } } @@ -20417,7 +20899,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 177: + case 179: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -20425,10 +20907,10 @@ var ts; switch (e.operator) { case 35: return value_1; case 36: return -value_1; - case 49: return ~value_1; + case 50: return ~value_1; } return undefined; - case 179: + case 181: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -20438,37 +20920,37 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 46: return left | right; - case 45: return left & right; - case 43: return left >> right; - case 44: return left >>> right; - case 42: return left << right; - case 47: return left ^ right; + case 47: return left | right; + case 46: return left & right; + case 44: return left >> right; + case 45: return left >>> right; + case 43: return left << right; + case 48: return left ^ right; case 37: return left * right; - case 38: return left / right; + case 39: return left / right; case 35: return left + right; case 36: return left - right; - case 39: return left % right; + case 40: return left % right; } return undefined; case 8: return +e.text; - case 170: + case 172: return evalConstant(e.expression); - case 67: - case 165: - case 164: + case 69: + case 167: + case 166: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; var propertyName; - if (e.kind === 67) { + if (e.kind === 69) { enumType_1 = currentType; propertyName = e.text; } else { var expression; - if (e.kind === 165) { + if (e.kind === 167) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9) { return undefined; @@ -20482,10 +20964,10 @@ var ts; } var current = expression; while (current) { - if (current.kind === 67) { + if (current.kind === 69) { break; } - else if (current.kind === 164) { + else if (current.kind === 166) { current = current.expression; } else { @@ -20508,7 +20990,7 @@ var ts; if (member === propertyDecl) { return undefined; } - if (!isDefinedBefore(propertyDecl, member)) { + if (!isBlockScopedNameDeclaredBeforeUse(propertyDecl, member)) { reportError = false; error(e, ts.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums); return undefined; @@ -20522,7 +21004,7 @@ var ts; if (!produceDiagnostics) { return; } - checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarEnumDeclaration(node); + checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -20544,7 +21026,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 215) { + if (declaration.kind !== 217) { return false; } var enumDeclaration = declaration; @@ -20567,8 +21049,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 212 || - (declaration.kind === 211 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 214 || + (declaration.kind === 213 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -20619,7 +21101,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 212); + var mergedClass = ts.getDeclarationOfKind(symbol, 214); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -20627,9 +21109,9 @@ var ts; } if (isAmbientExternalModule) { if (!isGlobalSourceFile(node.parent)) { - error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules); + error(node.name, ts.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces); } - if (isExternalModuleNameRelative(node.name.text)) { + if (ts.isExternalModuleNameRelative(node.name.text)) { error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); } } @@ -20638,17 +21120,17 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 133) { + if (node.kind === 135) { node = node.left; } - else if (node.kind === 164) { + else if (node.kind === 166) { node = node.expression; } else { break; } } - ts.Debug.assert(node.kind === 67); + ts.Debug.assert(node.kind === 69); return node; } function checkExternalImportOrExportDeclaration(node) { @@ -20657,14 +21139,14 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 217 && node.parent.parent.name.kind === 9; - if (node.parent.kind !== 246 && !inAmbientExternalModule) { - error(moduleName, node.kind === 226 ? + var inAmbientExternalModule = node.parent.kind === 219 && node.parent.parent.name.kind === 9; + if (node.parent.kind !== 248 && !inAmbientExternalModule) { + error(moduleName, node.kind === 228 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } - if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { + if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) { error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); return false; } @@ -20678,7 +21160,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 228 ? + var message = node.kind === 230 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -20704,7 +21186,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 222) { + if (importClause.namedBindings.kind === 224) { checkImportBinding(importClause.namedBindings); } else { @@ -20739,8 +21221,8 @@ var ts; } } else { - if (languageVersion >= 2 && !ts.isInAmbientContext(node)) { - grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead); + if (modulekind === 5 && !ts.isInAmbientContext(node)) { + grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } } } @@ -20755,8 +21237,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 217 && node.parent.parent.name.kind === 9; - if (node.parent.kind !== 246 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 219 && node.parent.parent.name.kind === 9; + if (node.parent.kind !== 248 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -20769,7 +21251,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 246 && node.parent.kind !== 217 && node.parent.kind !== 216) { + if (node.parent.kind !== 248 && node.parent.kind !== 219 && node.parent.kind !== 218) { return grammarErrorOnFirstToken(node, errorMessage); } } @@ -20783,15 +21265,15 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 246 ? node.parent : node.parent.parent; - if (container.kind === 216 && container.name.kind === 67) { + var container = node.parent.kind === 248 ? node.parent : node.parent.parent; + if (container.kind === 218 && container.name.kind === 69) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } - if (node.expression.kind === 67) { + if (node.expression.kind === 69) { markExportAsReferenced(node); } else { @@ -20799,19 +21281,19 @@ var ts; } checkExternalModuleExports(container); if (node.isExportEquals && !ts.isInAmbientContext(node)) { - if (languageVersion >= 2) { - grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead); + if (modulekind === 5) { + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead); } - else if (compilerOptions.module === 4) { + else if (modulekind === 4) { grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); } } } function getModuleStatements(node) { - if (node.kind === 246) { + if (node.kind === 248) { return node.statements; } - if (node.kind === 216 && node.body.kind === 217) { + if (node.kind === 218 && node.body.kind === 219) { return node.body.statements; } return emptyArray; @@ -20848,183 +21330,182 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 216: - case 212: + case 218: + case 214: + case 215: case 213: - case 211: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 135: + case 137: return checkTypeParameter(node); - case 136: - return checkParameter(node); - case 139: case 138: - return checkPropertyDeclaration(node); - case 150: - case 151: - case 145: - case 146: - return checkSignatureDeclaration(node); - case 147: - return checkSignatureDeclaration(node); + return checkParameter(node); case 141: case 140: - return checkMethodDeclaration(node); - case 142: - return checkConstructorDeclaration(node); - case 143: - case 144: - return checkAccessorDeclaration(node); - case 149: - return checkTypeReferenceNode(node); - case 148: - return checkTypePredicate(node); + return checkPropertyDeclaration(node); case 152: - return checkTypeQuery(node); case 153: - return checkTypeLiteral(node); + case 147: + case 148: + return checkSignatureDeclaration(node); + case 149: + return checkSignatureDeclaration(node); + case 143: + case 142: + return checkMethodDeclaration(node); + case 144: + return checkConstructorDeclaration(node); + case 145: + case 146: + return checkAccessorDeclaration(node); + case 151: + return checkTypeReferenceNode(node); + case 150: + return checkTypePredicate(node); case 154: - return checkArrayType(node); + return checkTypeQuery(node); case 155: - return checkTupleType(node); + return checkTypeLiteral(node); case 156: + return checkArrayType(node); case 157: - return checkUnionOrIntersectionType(node); + return checkTupleType(node); case 158: + case 159: + return checkUnionOrIntersectionType(node); + case 160: return checkSourceElement(node.type); - case 211: - return checkFunctionDeclaration(node); - case 190: - case 217: - return checkBlock(node); - case 191: - return checkVariableStatement(node); - case 193: - return checkExpressionStatement(node); - case 194: - return checkIfStatement(node); - case 195: - return checkDoStatement(node); - case 196: - return checkWhileStatement(node); - case 197: - return checkForStatement(node); - case 198: - return checkForInStatement(node); - case 199: - return checkForOfStatement(node); - case 200: - case 201: - return checkBreakOrContinueStatement(node); - case 202: - return checkReturnStatement(node); - case 203: - return checkWithStatement(node); - case 204: - return checkSwitchStatement(node); - case 205: - return checkLabeledStatement(node); - case 206: - return checkThrowStatement(node); - case 207: - return checkTryStatement(node); - case 209: - return checkVariableDeclaration(node); - case 161: - return checkBindingElement(node); - case 212: - return checkClassDeclaration(node); case 213: - return checkInterfaceDeclaration(node); - case 214: - return checkTypeAliasDeclaration(node); - case 215: - return checkEnumDeclaration(node); - case 216: - return checkModuleDeclaration(node); - case 220: - return checkImportDeclaration(node); - case 219: - return checkImportEqualsDeclaration(node); - case 226: - return checkExportDeclaration(node); - case 225: - return checkExportAssignment(node); + return checkFunctionDeclaration(node); case 192: - checkGrammarStatementInAmbientContext(node); - return; + case 219: + return checkBlock(node); + case 193: + return checkVariableStatement(node); + case 195: + return checkExpressionStatement(node); + case 196: + return checkIfStatement(node); + case 197: + return checkDoStatement(node); + case 198: + return checkWhileStatement(node); + case 199: + return checkForStatement(node); + case 200: + return checkForInStatement(node); + case 201: + return checkForOfStatement(node); + case 202: + case 203: + return checkBreakOrContinueStatement(node); + case 204: + return checkReturnStatement(node); + case 205: + return checkWithStatement(node); + case 206: + return checkSwitchStatement(node); + case 207: + return checkLabeledStatement(node); case 208: + return checkThrowStatement(node); + case 209: + return checkTryStatement(node); + case 211: + return checkVariableDeclaration(node); + case 163: + return checkBindingElement(node); + case 214: + return checkClassDeclaration(node); + case 215: + return checkInterfaceDeclaration(node); + case 216: + return checkTypeAliasDeclaration(node); + case 217: + return checkEnumDeclaration(node); + case 218: + return checkModuleDeclaration(node); + case 222: + return checkImportDeclaration(node); + case 221: + return checkImportEqualsDeclaration(node); + case 228: + return checkExportDeclaration(node); + case 227: + return checkExportAssignment(node); + case 194: checkGrammarStatementInAmbientContext(node); return; - case 229: + case 210: + checkGrammarStatementInAmbientContext(node); + return; + case 231: return checkMissingDeclaration(node); } } function checkFunctionAndClassExpressionBodies(node) { switch (node.kind) { - case 171: - case 172: + case 173: + case 174: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 184: + case 186: ts.forEach(node.members, checkSourceElement); + ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; - case 141: - case 140: + case 143: + case 142: ts.forEach(node.decorators, checkFunctionAndClassExpressionBodies); ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 142: - case 143: case 144: - case 211: + case 145: + case 146: + case 213: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); break; - case 203: + case 205: checkFunctionAndClassExpressionBodies(node.expression); break; - case 137: - case 136: case 139: case 138: - case 159: - case 160: + case 141: + case 140: case 161: case 162: case 163: - case 243: case 164: case 165: + case 245: case 166: case 167: case 168: - case 181: - case 188: case 169: - case 187: case 170: - case 174: - case 175: + case 183: + case 190: + case 171: + case 189: + case 172: case 176: - case 173: case 177: case 178: + case 175: case 179: case 180: - case 183: + case 181: case 182: - case 190: - case 217: - case 191: + case 185: + case 184: + case 192: + case 219: case 193: - case 194: case 195: case 196: case 197: @@ -21033,29 +21514,31 @@ var ts; case 200: case 201: case 202: + case 203: case 204: - case 218: - case 239: - case 240: - case 205: case 206: - case 207: - case 242: - case 209: - case 210: - case 212: + case 220: case 241: - case 186: - case 215: - case 245: - case 225: - case 246: - case 238: - case 231: - case 232: - case 236: - case 237: + case 242: + case 207: + case 208: + case 209: + case 244: + case 211: + case 212: + case 214: + case 243: + case 188: + case 217: + case 247: + case 227: + case 248: + case 240: case 233: + case 234: + case 238: + case 239: + case 235: ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; } @@ -21133,7 +21616,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 203 && node.parent.statement === node) { + if (node.parent.kind === 205 && node.parent.statement === node) { return true; } node = node.parent; @@ -21155,28 +21638,28 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 246: + case 248: if (!ts.isExternalModule(location)) { break; } - case 216: + case 218: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 215: + case 217: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 184: + case 186: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 212: - case 213: + case 214: + case 215: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 171: + case 173: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -21209,42 +21692,42 @@ var ts; } } function isTypeDeclarationName(name) { - return name.kind === 67 && + return name.kind === 69 && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 135: - case 212: - case 213: + case 137: case 214: case 215: + case 216: + case 217: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 133) { + while (node.parent && node.parent.kind === 135) { node = node.parent; } - return node.parent && node.parent.kind === 149; + return node.parent && node.parent.kind === 151; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 164) { + while (node.parent && node.parent.kind === 166) { node = node.parent; } - return node.parent && node.parent.kind === 186; + return node.parent && node.parent.kind === 188; } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 133) { + while (nodeOnRightSide.parent.kind === 135) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 219) { + if (nodeOnRightSide.parent.kind === 221) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 225) { + if (nodeOnRightSide.parent.kind === 227) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -21256,10 +21739,10 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 225) { + if (entityName.parent.kind === 227) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 164) { + if (entityName.kind !== 166) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } @@ -21268,31 +21751,40 @@ var ts; entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { - var meaning = entityName.parent.kind === 186 ? 793056 : 1536; + var meaning = 0; + if (entityName.parent.kind === 188) { + meaning = 793056; + if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + meaning |= 107455; + } + } + else { + meaning = 1536; + } meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 233) || - (entityName.parent.kind === 232) || - (entityName.parent.kind === 235)) { + else if ((entityName.parent.kind === 235) || + (entityName.parent.kind === 234) || + (entityName.parent.kind === 237)) { return getJsxElementTagSymbol(entityName.parent); } else if (ts.isExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { return undefined; } - if (entityName.kind === 67) { + if (entityName.kind === 69) { var meaning = 107455 | 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 164) { + else if (entityName.kind === 166) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 133) { + else if (entityName.kind === 135) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -21301,14 +21793,14 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 149 ? 793056 : 1536; + var meaning = entityName.parent.kind === 151 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 236) { + else if (entityName.parent.kind === 238) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 148) { + if (entityName.parent.kind === 150) { return resolveEntityName(entityName, 1); } return undefined; @@ -21320,14 +21812,14 @@ var ts; if (ts.isDeclarationName(node)) { return getSymbolOfNode(node.parent); } - if (node.kind === 67) { + if (node.kind === 69) { if (isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 225 + return node.parent.kind === 227 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } - else if (node.parent.kind === 161 && - node.parent.parent.kind === 159 && + else if (node.parent.kind === 163 && + node.parent.parent.kind === 161 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -21337,29 +21829,29 @@ var ts; } } switch (node.kind) { - case 67: - case 164: - case 133: + case 69: + case 166: + case 135: return getSymbolOfEntityNameOrPropertyAccessExpression(node); + case 97: case 95: - case 93: - var type = checkExpression(node); + var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 119: + case 121: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 142) { + if (constructorDeclaration && constructorDeclaration.kind === 144) { return constructorDeclaration.parent.symbol; } return undefined; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 220 || node.parent.kind === 226) && + ((node.parent.kind === 222 || node.parent.kind === 228) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 8: - if (node.parent.kind === 165 && node.parent.argumentExpression === node) { + if (node.parent.kind === 167 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -21373,7 +21865,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 244) { + if (location && location.kind === 246) { return resolveEntityName(location.name, 107455); } return undefined; @@ -21473,11 +21965,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 246) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 248) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 216 || n.kind === 215) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 218 || n.kind === 217) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -21490,11 +21982,11 @@ var ts; } function isStatementWithLocals(node) { switch (node.kind) { - case 190: - case 218: - case 197: - case 198: + case 192: + case 220: case 199: + case 200: + case 201: return true; } return false; @@ -21520,22 +22012,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 219: case 221: - case 222: + case 223: case 224: - case 228: - return isAliasResolvedToValue(getSymbolOfNode(node)); case 226: + case 230: + return isAliasResolvedToValue(getSymbolOfNode(node)); + case 228: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 225: - return node.expression && node.expression.kind === 67 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; + case 227: + return node.expression && node.expression.kind === 69 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 246 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 248 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -21583,7 +22075,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 245) { + if (node.kind === 247) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -21669,21 +22161,6 @@ var ts; var symbol = getReferencedValueSymbol(reference); return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; } - function getBlockScopedVariableId(n) { - ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 161 || (n.parent.kind === 209 && n.parent.name === n); - var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || - getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, 107455 | 8388608, undefined, undefined); - var isLetOrConst = symbol && - (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 242; - if (isLetOrConst) { - getSymbolLinks(symbol); - return symbol.id; - } - return undefined; - } function instantiateSingleCallFunctionType(functionType, typeArguments) { if (functionType === unknownType) { return unknownType; @@ -21715,7 +22192,6 @@ var ts; isEntityNameVisible: isEntityNameVisible, getConstantValue: getConstantValue, collectLinkedAliases: collectLinkedAliases, - getBlockScopedVariableId: getBlockScopedVariableId, getReferencedValueDeclaration: getReferencedValueDeclaration, getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, isOptionalParameter: isOptionalParameter @@ -21796,10 +22272,7 @@ var ts; if (!ts.nodeCanBeDecorated(node)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } - else if (languageVersion < 1) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); - } - else if (node.kind === 143 || node.kind === 144) { + else if (node.kind === 145 || node.kind === 146) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -21809,38 +22282,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 143: + case 145: + case 146: case 144: - case 142: - case 139: - case 138: case 141: case 140: - case 147: - case 216: - case 220: - case 219: - case 226: - case 225: - case 136: + case 143: + case 142: + case 149: + case 218: + case 222: + case 221: + case 228: + case 227: + case 138: break; - case 211: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 116) && - node.parent.kind !== 217 && node.parent.kind !== 246) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); - } - break; - case 212: case 213: - case 191: - case 214: - if (node.modifiers && node.parent.kind !== 217 && node.parent.kind !== 246) { + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118) && + node.parent.kind !== 219 && node.parent.kind !== 248) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; + case 214: case 215: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 72) && - node.parent.kind !== 217 && node.parent.kind !== 246) { + case 193: + case 216: + if (node.modifiers && node.parent.kind !== 219 && node.parent.kind !== 248) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); + } + break; + case 217: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74) && + node.parent.kind !== 219 && node.parent.kind !== 248) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -21855,14 +22328,14 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { + case 112: + case 111: case 110: - case 109: - case 108: var text = void 0; - if (modifier.kind === 110) { + if (modifier.kind === 112) { text = "public"; } - else if (modifier.kind === 109) { + else if (modifier.kind === 111) { text = "protected"; lastProtected = modifier; } @@ -21879,11 +22352,11 @@ var ts; else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 217 || node.parent.kind === 246) { + else if (node.parent.kind === 219 || node.parent.kind === 248) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } else if (flags & 256) { - if (modifier.kind === 108) { + if (modifier.kind === 110) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } else { @@ -21892,17 +22365,17 @@ var ts; } flags |= ts.modifierToFlag(modifier.kind); break; - case 111: + case 113: if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 217 || node.parent.kind === 246) { + else if (node.parent.kind === 219 || node.parent.kind === 248) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 136) { + else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 256) { @@ -21911,7 +22384,7 @@ var ts; flags |= 128; lastStatic = modifier; break; - case 80: + case 82: if (flags & 1) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -21924,42 +22397,42 @@ var ts; else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 214) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 136) { + else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; break; - case 120: + case 122: if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 214) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 136) { + else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 217) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 219) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; lastDeclare = modifier; break; - case 113: + case 115: if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 212) { - if (node.kind !== 141) { + if (node.kind !== 214) { + if (node.kind !== 143) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); } - if (!(node.parent.kind === 212 && node.parent.flags & 256)) { + if (!(node.parent.kind === 214 && node.parent.flags & 256)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 128) { @@ -21971,14 +22444,14 @@ var ts; } flags |= 256; break; - case 116: + case 118: if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 136) { + else if (node.kind === 138) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 512; @@ -21986,7 +22459,7 @@ var ts; break; } } - if (node.kind === 142) { + if (node.kind === 144) { if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -22004,10 +22477,10 @@ var ts; } return; } - else if ((node.kind === 220 || node.kind === 219) && flags & 2) { + else if ((node.kind === 222 || node.kind === 221) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 136 && (flags & 112) && ts.isBindingPattern(node.name)) { + else if (node.kind === 138 && (flags & 112) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 512) { @@ -22019,10 +22492,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 141: - case 211: - case 171: - case 172: + case 143: + case 213: + case 173: + case 174: if (!node.asteriskToken) { return false; } @@ -22087,7 +22560,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 172) { + if (node.kind === 174) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -22122,7 +22595,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 128 && parameter.type.kind !== 126) { + if (parameter.type.kind !== 130 && parameter.type.kind !== 128) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -22154,7 +22627,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0; _i < args.length; _i++) { var arg = args[_i]; - if (arg.kind === 185) { + if (arg.kind === 187) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -22181,7 +22654,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 81) { + if (heritageClause.token === 83) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } @@ -22194,7 +22667,7 @@ var ts; seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 104); + ts.Debug.assert(heritageClause.token === 106); if (seenImplementsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); } @@ -22209,14 +22682,14 @@ var ts; if (node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 81) { + if (heritageClause.token === 83) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 104); + ts.Debug.assert(heritageClause.token === 106); return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); } checkGrammarHeritageClause(heritageClause); @@ -22225,19 +22698,19 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 134) { + if (node.kind !== 136) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 179 && computedPropertyName.expression.operatorToken.kind === 24) { + if (computedPropertyName.expression.kind === 181 && computedPropertyName.expression.operatorToken.kind === 24) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 211 || - node.kind === 171 || - node.kind === 141); + ts.Debug.assert(node.kind === 213 || + node.kind === 173 || + node.kind === 143); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -22254,7 +22727,7 @@ var ts; return grammarErrorOnNode(questionToken, message); } } - function checkGrammarObjectLiteralExpression(node) { + function checkGrammarObjectLiteralExpression(node, inDestructuring) { var seen = {}; var Property = 1; var GetAccessor = 2; @@ -22263,26 +22736,29 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_17 = prop.name; - if (prop.kind === 185 || - name_17.kind === 134) { + if (prop.kind === 187 || + name_17.kind === 136) { checkGrammarComputedPropertyName(name_17); continue; } + if (prop.kind === 246 && !inDestructuring && prop.objectAssignmentInitializer) { + return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); + } var currentKind = void 0; - if (prop.kind === 243 || prop.kind === 244) { + if (prop.kind === 245 || prop.kind === 246) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_17.kind === 8) { checkGrammarNumericLiteral(name_17); } currentKind = Property; } - else if (prop.kind === 141) { + else if (prop.kind === 143) { currentKind = Property; } - else if (prop.kind === 143) { + else if (prop.kind === 145) { currentKind = GetAccessor; } - else if (prop.kind === 144) { + else if (prop.kind === 146) { currentKind = SetAccesor; } else { @@ -22314,7 +22790,7 @@ var ts; var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 237) { + if (attr.kind === 239) { continue; } var jsxAttr = attr; @@ -22326,7 +22802,7 @@ var ts; return grammarErrorOnNode(name_18, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 238 && !initializer.expression) { + if (initializer && initializer.kind === 240 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -22335,24 +22811,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 210) { + if (forInOrOfStatement.initializer.kind === 212) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 198 + var diagnostic = forInOrOfStatement.kind === 200 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 198 + var diagnostic = forInOrOfStatement.kind === 200 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 198 + var diagnostic = forInOrOfStatement.kind === 200 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -22375,10 +22851,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 143 && accessor.parameters.length) { + else if (kind === 145 && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 144) { + else if (kind === 146) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -22403,7 +22879,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 134 && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (node.kind === 136 && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } @@ -22413,7 +22889,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 163) { + if (node.parent.kind === 165) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -22432,22 +22908,22 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 213) { + else if (node.parent.kind === 215) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 153) { + else if (node.parent.kind === 155) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { + case 199: + case 200: + case 201: case 197: case 198: - case 199: - case 195: - case 196: return true; - case 205: + case 207: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -22459,9 +22935,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 205: + case 207: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 200 + var isMisplacedContinueLabel = node.kind === 202 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -22469,8 +22945,8 @@ var ts; return false; } break; - case 204: - if (node.kind === 201 && !node.label) { + case 206: + if (node.kind === 203 && !node.label) { return false; } break; @@ -22483,13 +22959,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 201 + var message = node.kind === 203 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 201 + var message = node.kind === 203 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -22501,7 +22977,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 160 || node.name.kind === 159) { + if (node.name.kind === 162 || node.name.kind === 161) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -22510,7 +22986,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 198 && node.parent.parent.kind !== 199) { + if (node.parent.parent.kind !== 200 && node.parent.parent.kind !== 201) { if (ts.isInAmbientContext(node)) { if (node.initializer) { var equalsTokenLength = "=".length; @@ -22530,7 +23006,7 @@ var ts; return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { - if (name.kind === 67) { + if (name.kind === 69) { if (name.text === "let") { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } @@ -22539,7 +23015,7 @@ var ts; var elements = name.elements; for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; - if (element.kind !== 185) { + if (element.kind !== 187) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -22556,15 +23032,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 194: - case 195: case 196: - case 203: case 197: case 198: - case 199: - return false; case 205: + case 199: + case 200: + case 201: + return false; + case 207: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -22580,7 +23056,7 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 177) { + if (expression.kind === 179) { var unaryExpression = expression; if (unaryExpression.operator === 35 || unaryExpression.operator === 36) { expression = unaryExpression.operand; @@ -22591,32 +23067,6 @@ var ts; } return false; } - function checkGrammarEnumDeclaration(enumDecl) { - var enumIsConst = (enumDecl.flags & 32768) !== 0; - var hasError = false; - if (!enumIsConst) { - var inConstantEnumMemberSection = true; - var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { - var node = _a[_i]; - if (node.name.kind === 134) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); - } - else if (inAmbientContext) { - if (node.initializer && !isIntegerLiteral(node.initializer)) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers) || hasError; - } - } - else if (node.initializer) { - inConstantEnumMemberSection = isIntegerLiteral(node.initializer); - } - else if (!inConstantEnumMemberSection) { - hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Enum_member_must_have_initializer) || hasError; - } - } - } - return hasError; - } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -22642,7 +23092,7 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 67 && + return node.kind === 69 && (node.text === "eval" || node.text === "arguments"); } function checkGrammarConstructorTypeParameters(node) { @@ -22662,12 +23112,12 @@ var ts; return true; } } - else if (node.parent.kind === 213) { + else if (node.parent.kind === 215) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 153) { + else if (node.parent.kind === 155) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -22677,11 +23127,11 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 213 || - node.kind === 220 || - node.kind === 219 || - node.kind === 226 || - node.kind === 225 || + if (node.kind === 215 || + node.kind === 222 || + node.kind === 221 || + node.kind === 228 || + node.kind === 227 || (node.flags & 2) || (node.flags & (1 | 1024))) { return false; @@ -22691,7 +23141,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 191) { + if (ts.isDeclaration(decl) || decl.kind === 193) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -22710,7 +23160,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 190 || node.parent.kind === 217 || node.parent.kind === 246) { + if (node.parent.kind === 192 || node.parent.kind === 219 || node.parent.kind === 248) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -22736,7 +23186,6 @@ var ts; } ts.createTypeChecker = createTypeChecker; })(ts || (ts = {})); -/// var ts; (function (ts) { function getDeclarationDiagnostics(host, resolver, targetSourceFile) { @@ -22758,6 +23207,7 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; + var errorNameNode; var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var moduleElementDeclarationEmitInfo = []; @@ -22783,7 +23233,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 220); + ts.Debug.assert(aliasEmitInfo.node.kind === 222); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -22834,6 +23284,7 @@ var ts; function createAndSetNewTextWriterWithSymbolWriter() { var writer = ts.createTextWriter(newLine); writer.trackSymbol = trackSymbol; + writer.reportInaccessibleThisError = reportInaccessibleThisError; writer.writeKeyword = writer.write; writer.writeOperator = writer.write; writer.writePunctuation = writer.write; @@ -22856,10 +23307,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 209) { + if (declaration.kind === 211) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 223 || declaration.kind === 224 || declaration.kind === 221) { + else if (declaration.kind === 225 || declaration.kind === 226 || declaration.kind === 223) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -22870,7 +23321,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 220) { + if (moduleElementEmitInfo.node.kind === 222) { moduleElementEmitInfo.isVisible = true; } else { @@ -22878,12 +23329,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 216) { + if (nodeToCheck.kind === 218) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 216) { + if (nodeToCheck.kind === 218) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -22915,6 +23366,11 @@ var ts; function trackSymbol(symbol, enclosingDeclaration, meaning) { handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); } + function reportInaccessibleThisError() { + if (errorNameNode) { + diagnostics.push(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); + } + } function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; write(": "); @@ -22922,7 +23378,9 @@ var ts; emitType(type); } else { + errorNameNode = declaration.name; resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2, writer); + errorNameNode = undefined; } } function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) { @@ -22932,7 +23390,9 @@ var ts; emitType(signature.type); } else { + errorNameNode = signature.name; resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2, writer); + errorNameNode = undefined; } } function emitLines(nodes) { @@ -22970,62 +23430,63 @@ var ts; } function emitType(type) { switch (type.kind) { - case 115: + case 117: + case 130: case 128: - case 126: - case 118: - case 129: - case 101: + case 120: + case 131: + case 103: + case 97: case 9: return writeTextOfNode(currentSourceFile, type); - case 186: + case 188: return emitExpressionWithTypeArguments(type); - case 149: - return emitTypeReference(type); - case 152: - return emitTypeQuery(type); - case 154: - return emitArrayType(type); - case 155: - return emitTupleType(type); - case 156: - return emitUnionType(type); - case 157: - return emitIntersectionType(type); - case 158: - return emitParenType(type); - case 150: case 151: - return emitSignatureDeclarationWithJsDocComments(type); + return emitTypeReference(type); + case 154: + return emitTypeQuery(type); + case 156: + return emitArrayType(type); + case 157: + return emitTupleType(type); + case 158: + return emitUnionType(type); + case 159: + return emitIntersectionType(type); + case 160: + return emitParenType(type); + case 152: case 153: + return emitSignatureDeclarationWithJsDocComments(type); + case 155: return emitTypeLiteral(type); - case 67: + case 69: return emitEntityName(type); - case 133: + case 135: return emitEntityName(type); - case 148: + case 150: return emitTypePredicate(type); } function writeEntityName(entityName) { - if (entityName.kind === 67) { + if (entityName.kind === 69) { writeTextOfNode(currentSourceFile, entityName); } else { - var left = entityName.kind === 133 ? entityName.left : entityName.expression; - var right = entityName.kind === 133 ? entityName.right : entityName.name; + var left = entityName.kind === 135 ? entityName.left : entityName.expression; + var right = entityName.kind === 135 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentSourceFile, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 219 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 221 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 67 || node.expression.kind === 164); + ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 166); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -23101,7 +23562,7 @@ var ts; } } function emitExportAssignment(node) { - if (node.expression.kind === 67) { + if (node.expression.kind === 69) { write(node.isExportEquals ? "export = " : "export default "); writeTextOfNode(currentSourceFile, node.expression); } @@ -23119,7 +23580,7 @@ var ts; } write(";"); writeLine(); - if (node.expression.kind === 67) { + if (node.expression.kind === 69) { var nodes = resolver.collectLinkedAliases(node.expression); writeAsynchronousModuleElements(nodes); } @@ -23137,10 +23598,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 219 || - (node.parent.kind === 246 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 221 || + (node.parent.kind === 248 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 246) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 248) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -23149,7 +23610,7 @@ var ts; }); } else { - if (node.kind === 220) { + if (node.kind === 222) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -23167,23 +23628,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 211: - return writeFunctionDeclaration(node); - case 191: - return writeVariableStatement(node); case 213: - return writeInterfaceDeclaration(node); - case 212: - return writeClassDeclaration(node); - case 214: - return writeTypeAliasDeclaration(node); + return writeFunctionDeclaration(node); + case 193: + return writeVariableStatement(node); case 215: - return writeEnumDeclaration(node); + return writeInterfaceDeclaration(node); + case 214: + return writeClassDeclaration(node); case 216: + return writeTypeAliasDeclaration(node); + case 217: + return writeEnumDeclaration(node); + case 218: return writeModuleDeclaration(node); - case 219: + case 221: return writeImportEqualsDeclaration(node); - case 220: + case 222: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -23197,7 +23658,7 @@ var ts; if (node.flags & 1024) { write("default "); } - else if (node.kind !== 213) { + else if (node.kind !== 215) { write("declare "); } } @@ -23244,7 +23705,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 222) { + if (namedBindings.kind === 224) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -23270,7 +23731,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 222) { + if (node.importClause.namedBindings.kind === 224) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -23326,7 +23787,7 @@ var ts; write("module "); } writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 217) { + while (node.body.kind !== 219) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -23391,7 +23852,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 141 && (node.parent.flags & 32); + return node.parent.kind === 143 && (node.parent.flags & 32); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -23401,15 +23862,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 150 || - node.parent.kind === 151 || - (node.parent.parent && node.parent.parent.kind === 153)) { - ts.Debug.assert(node.parent.kind === 141 || - node.parent.kind === 140 || - node.parent.kind === 150 || - node.parent.kind === 151 || - node.parent.kind === 145 || - node.parent.kind === 146); + if (node.parent.kind === 152 || + node.parent.kind === 153 || + (node.parent.parent && node.parent.parent.kind === 155)) { + ts.Debug.assert(node.parent.kind === 143 || + node.parent.kind === 142 || + node.parent.kind === 152 || + node.parent.kind === 153 || + node.parent.kind === 147 || + node.parent.kind === 148); emitType(node.constraint); } else { @@ -23419,31 +23880,31 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 212: + case 214: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 213: + case 215: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 146: + case 148: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 145: + case 147: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 141: - case 140: + case 143: + case 142: if (node.parent.flags & 128) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 212) { + else if (node.parent.parent.kind === 214) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 211: + case 213: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -23471,12 +23932,12 @@ var ts; if (ts.isSupportedExpressionWithTypeArguments(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); } - else if (!isImplementsList && node.expression.kind === 91) { + else if (!isImplementsList && node.expression.kind === 93) { write("null"); } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 212) { + if (node.parent.parent.kind === 214) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; @@ -23556,16 +24017,16 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 209 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 211 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); - if ((node.kind === 139 || node.kind === 138) && ts.hasQuestionToken(node)) { + if ((node.kind === 141 || node.kind === 140) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 139 || node.kind === 138) && node.parent.kind === 153) { + if ((node.kind === 141 || node.kind === 140) && node.parent.kind === 155) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32)) { @@ -23574,14 +24035,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 209) { + if (node.kind === 211) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 139 || node.kind === 138) { + else if (node.kind === 141 || node.kind === 140) { if (node.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23589,7 +24050,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 214) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23615,7 +24076,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 185) { + if (element.kind !== 187) { elements.push(element); } } @@ -23681,7 +24142,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 143 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 145 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -23694,7 +24155,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 143 + return accessor.kind === 145 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -23703,7 +24164,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 144) { + if (accessorWithTypeAnnotation.kind === 146) { if (accessorWithTypeAnnotation.parent.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : @@ -23749,17 +24210,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 211) { + if (node.kind === 213) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 141) { + else if (node.kind === 143) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 211) { + if (node.kind === 213) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 142) { + else if (node.kind === 144) { write("constructor"); } else { @@ -23776,11 +24237,11 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 146 || node.kind === 151) { + if (node.kind === 148 || node.kind === 153) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 147) { + if (node.kind === 149) { write("["); } else { @@ -23789,20 +24250,20 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 147) { + if (node.kind === 149) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 150 || node.kind === 151; - if (isFunctionTypeOrConstructorType || node.parent.kind === 153) { + var isFunctionTypeOrConstructorType = node.kind === 152 || node.kind === 153; + if (isFunctionTypeOrConstructorType || node.parent.kind === 155) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 142 && !(node.flags & 32)) { + else if (node.kind !== 144 && !(node.flags & 32)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -23813,23 +24274,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 146: + case 148: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 145: + case 147: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 147: + case 149: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 141: - case 140: + case 143: + case 142: if (node.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23837,7 +24298,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 214) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -23850,7 +24311,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 211: + case 213: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -23882,9 +24343,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 150 || - node.parent.kind === 151 || - node.parent.parent.kind === 153) { + if (node.parent.kind === 152 || + node.parent.kind === 153 || + node.parent.parent.kind === 155) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -23900,22 +24361,22 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { - case 142: + case 144: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 146: + case 148: return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 145: + case 147: return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 141: - case 140: + case 143: + case 142: if (node.parent.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23923,7 +24384,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 212) { + else if (node.parent.parent.kind === 214) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23935,7 +24396,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 211: + case 213: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23946,12 +24407,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 159) { + if (bindingPattern.kind === 161) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 160) { + else if (bindingPattern.kind === 162) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -23970,10 +24431,10 @@ var ts; typeName: bindingElement.name } : undefined; } - if (bindingElement.kind === 185) { + if (bindingElement.kind === 187) { write(" "); } - else if (bindingElement.kind === 161) { + else if (bindingElement.kind === 163) { if (bindingElement.propertyName) { writeTextOfNode(currentSourceFile, bindingElement.propertyName); write(": "); @@ -23983,7 +24444,7 @@ var ts; emitBindingPattern(bindingElement.name); } else { - ts.Debug.assert(bindingElement.name.kind === 67); + ts.Debug.assert(bindingElement.name.kind === 69); if (bindingElement.dotDotDotToken) { write("..."); } @@ -23995,39 +24456,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 211: - case 216: - case 219: case 213: - case 212: - case 214: + case 218: + case 221: case 215: + case 214: + case 216: + case 217: return emitModuleElement(node, isModuleElementVisible(node)); - case 191: + case 193: return emitModuleElement(node, isVariableStatementVisible(node)); - case 220: + case 222: return emitModuleElement(node, !node.importClause); - case 226: + case 228: return emitExportDeclaration(node); + case 144: + case 143: case 142: + return writeFunctionDeclaration(node); + case 148: + case 147: + case 149: + return emitSignatureDeclarationWithJsDocComments(node); + case 145: + case 146: + return emitAccessorDeclaration(node); case 141: case 140: - return writeFunctionDeclaration(node); - case 146: - case 145: - case 147: - return emitSignatureDeclarationWithJsDocComments(node); - case 143: - case 144: - return emitAccessorDeclaration(node); - case 139: - case 138: return emitPropertyDeclaration(node); - case 245: + case 247: return emitEnumMemberDeclaration(node); - case 225: + case 227: return emitExportAssignment(node); - case 246: + case 248: return emitSourceFile(node); } } @@ -24064,5492 +24525,12 @@ var ts; } ts.writeDeclarationFile = writeDeclarationFile; })(ts || (ts = {})); -/// -/// var ts; (function (ts) { function isExternalModuleOrDeclarationFile(sourceFile) { return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); } ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; - function emitFiles(resolver, host, targetSourceFile) { - var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; - var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; - var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; - var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; - var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; - var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0; - var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; - var diagnostics = []; - var newLine = host.getNewLine(); - var jsxDesugaring = host.getCompilerOptions().jsx !== 1; - var shouldEmitJsx = function (s) { return (s.languageVariant === 1 && !jsxDesugaring); }; - if (targetSourceFile === undefined) { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - if (compilerOptions.outFile || compilerOptions.out) { - emitFile(compilerOptions.outFile || compilerOptions.out); - } - } - else { - if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); - emitFile(jsFilePath, targetSourceFile); - } - else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { - emitFile(compilerOptions.outFile || compilerOptions.out); - } - } - diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); - return { - emitSkipped: false, - diagnostics: diagnostics, - sourceMaps: sourceMapDataList - }; - function isNodeDescendentOf(node, ancestor) { - while (node) { - if (node === ancestor) - return true; - node = node.parent; - } - return false; - } - function isUniqueLocalName(name, container) { - for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { - if (node.locals && ts.hasProperty(node.locals, name)) { - if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { - return false; - } - } - } - return true; - } - function emitJavaScript(jsFilePath, root) { - var writer = ts.createTextWriter(newLine); - var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; - var currentSourceFile; - var exportFunctionForFile; - var generatedNameSet = {}; - var nodeToGeneratedName = []; - var computedPropertyNamesToGeneratedNames; - var extendsEmitted = false; - var decorateEmitted = false; - var paramEmitted = false; - var awaiterEmitted = false; - var tempFlags = 0; - var tempVariables; - var tempParameters; - var externalImports; - var exportSpecifiers; - var exportEquals; - var hasExportStars; - var writeEmittedFiles = writeJavaScriptFile; - var detachedCommentsInfo; - var writeComment = ts.writeCommentRange; - var emit = emitNodeWithCommentsAndWithoutSourcemap; - var emitStart = function (node) { }; - var emitEnd = function (node) { }; - var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - var scopeEmitEnd = function () { }; - var sourceMapData; - if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { - initializeEmitterWithSourceMaps(); - } - if (root) { - emitSourceFile(root); - } - else { - ts.forEach(host.getSourceFiles(), function (sourceFile) { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emitSourceFile(sourceFile); - } - }); - } - writeLine(); - writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); - return; - function emitSourceFile(sourceFile) { - currentSourceFile = sourceFile; - exportFunctionForFile = undefined; - emit(sourceFile); - } - function isUniqueName(name) { - return !resolver.hasGlobalName(name) && - !ts.hasProperty(currentSourceFile.identifiers, name) && - !ts.hasProperty(generatedNameSet, name); - } - function makeTempVariableName(flags) { - if (flags && !(tempFlags & flags)) { - var name_20 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_20)) { - tempFlags |= flags; - return name_20; - } - } - while (true) { - var count = tempFlags & 268435455; - tempFlags++; - if (count !== 8 && count !== 13) { - var name_21 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_21)) { - return name_21; - } - } - } - } - function makeUniqueName(baseName) { - if (baseName.charCodeAt(baseName.length - 1) !== 95) { - baseName += "_"; - } - var i = 1; - while (true) { - var generatedName = baseName + i; - if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; - } - i++; - } - } - function generateNameForModuleOrEnum(node) { - var name = node.name.text; - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); - } - function generateNameForImportOrExportDeclaration(node) { - var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 9 ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; - return makeUniqueName(baseName); - } - function generateNameForExportDefault() { - return makeUniqueName("default"); - } - function generateNameForClassExpression() { - return makeUniqueName("class"); - } - function generateNameForNode(node) { - switch (node.kind) { - case 67: - return makeUniqueName(node.text); - case 216: - case 215: - return generateNameForModuleOrEnum(node); - case 220: - case 226: - return generateNameForImportOrExportDeclaration(node); - case 211: - case 212: - case 225: - return generateNameForExportDefault(); - case 184: - return generateNameForClassExpression(); - } - } - function getGeneratedNameForNode(node) { - var id = ts.getNodeId(node); - return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); - } - function initializeEmitterWithSourceMaps() { - var sourceMapDir; - var sourceMapSourceIndex = -1; - var sourceMapNameIndexMap = {}; - var sourceMapNameIndices = []; - function getSourceMapNameIndex() { - return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; - } - var lastRecordedSourceMapSpan; - var lastEncodedSourceMapSpan = { - emittedLine: 1, - emittedColumn: 1, - sourceLine: 1, - sourceColumn: 1, - sourceIndex: 0 - }; - var lastEncodedNameIndex = 0; - function encodeLastRecordedSourceMapSpan() { - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { - return; - } - var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; - if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { - if (sourceMapData.sourceMapMappings) { - sourceMapData.sourceMapMappings += ","; - } - } - else { - for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { - sourceMapData.sourceMapMappings += ";"; - } - prevEncodedEmittedColumn = 1; - } - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); - if (lastRecordedSourceMapSpan.nameIndex >= 0) { - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); - lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; - } - lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; - sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); - function base64VLQFormatEncode(inValue) { - function base64FormatEncode(inValue) { - if (inValue < 64) { - return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); - } - throw TypeError(inValue + ": not a 64 based value"); - } - if (inValue < 0) { - inValue = ((-inValue) << 1) + 1; - } - else { - inValue = inValue << 1; - } - var encodedStr = ""; - do { - var currentDigit = inValue & 31; - inValue = inValue >> 5; - if (inValue > 0) { - currentDigit = currentDigit | 32; - } - encodedStr = encodedStr + base64FormatEncode(currentDigit); - } while (inValue > 0); - return encodedStr; - } - } - function recordSourceMapSpan(pos) { - var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); - sourceLinePos.line++; - sourceLinePos.character++; - var emittedLine = writer.getLine(); - var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine !== emittedLine || - lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { - encodeLastRecordedSourceMapSpan(); - lastRecordedSourceMapSpan = { - emittedLine: emittedLine, - emittedColumn: emittedColumn, - sourceLine: sourceLinePos.line, - sourceColumn: sourceLinePos.character, - nameIndex: getSourceMapNameIndex(), - sourceIndex: sourceMapSourceIndex - }; - } - else { - lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; - lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; - lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; - } - } - function recordEmitNodeStartSpan(node) { - recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); - } - function recordEmitNodeEndSpan(node) { - recordSourceMapSpan(node.end); - } - function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); - recordSourceMapSpan(tokenStartPos); - var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); - recordSourceMapSpan(tokenEndPos); - return tokenEndPos; - } - function recordNewSourceFileStart(node) { - var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; - sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true)); - sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; - sourceMapData.inputSourceFileNames.push(node.fileName); - if (compilerOptions.inlineSources) { - if (!sourceMapData.sourceMapSourcesContent) { - sourceMapData.sourceMapSourcesContent = []; - } - sourceMapData.sourceMapSourcesContent.push(node.text); - } - } - function recordScopeNameOfNode(node, scopeName) { - function recordScopeNameIndex(scopeNameIndex) { - sourceMapNameIndices.push(scopeNameIndex); - } - function recordScopeNameStart(scopeName) { - var scopeNameIndex = -1; - if (scopeName) { - var parentIndex = getSourceMapNameIndex(); - if (parentIndex !== -1) { - var name_22 = node.name; - if (!name_22 || name_22.kind !== 134) { - scopeName = "." + scopeName; - } - scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; - } - scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); - if (scopeNameIndex === undefined) { - scopeNameIndex = sourceMapData.sourceMapNames.length; - sourceMapData.sourceMapNames.push(scopeName); - sourceMapNameIndexMap[scopeName] = scopeNameIndex; - } - } - recordScopeNameIndex(scopeNameIndex); - } - if (scopeName) { - recordScopeNameStart(scopeName); - } - else if (node.kind === 211 || - node.kind === 171 || - node.kind === 141 || - node.kind === 140 || - node.kind === 143 || - node.kind === 144 || - node.kind === 216 || - node.kind === 212 || - node.kind === 215) { - if (node.name) { - var name_23 = node.name; - scopeName = name_23.kind === 134 - ? ts.getTextOfNode(name_23) - : node.name.text; - } - recordScopeNameStart(scopeName); - } - else { - recordScopeNameIndex(getSourceMapNameIndex()); - } - } - function recordScopeNameEnd() { - sourceMapNameIndices.pop(); - } - ; - function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { - recordSourceMapSpan(comment.pos); - ts.writeCommentRange(currentSourceFile, writer, comment, newLine); - recordSourceMapSpan(comment.end); - } - function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { - if (typeof JSON !== "undefined") { - var map_2 = { - version: version, - file: file, - sourceRoot: sourceRoot, - sources: sources, - names: names, - mappings: mappings - }; - if (sourcesContent !== undefined) { - map_2.sourcesContent = sourcesContent; - } - return JSON.stringify(map_2); - } - return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; - function serializeStringArray(list) { - var output = ""; - for (var i = 0, n = list.length; i < n; i++) { - if (i) { - output += ","; - } - output += "\"" + ts.escapeString(list[i]) + "\""; - } - return output; - } - } - function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { - encodeLastRecordedSourceMapSpan(); - var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); - sourceMapDataList.push(sourceMapData); - var sourceMapUrl; - if (compilerOptions.inlineSourceMap) { - var base64SourceMapText = ts.convertToBase64(sourceMapText); - sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; - } - else { - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); - sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; - } - writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); - } - var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); - sourceMapData = { - sourceMapFilePath: jsFilePath + ".map", - jsSourceMappingURL: sourceMapJsFile + ".map", - sourceMapFile: sourceMapJsFile, - sourceMapSourceRoot: compilerOptions.sourceRoot || "", - sourceMapSources: [], - inputSourceFileNames: [], - sourceMapNames: [], - sourceMapMappings: "", - sourceMapSourcesContent: undefined, - sourceMapDecodedMappings: [] - }; - sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); - if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) { - sourceMapData.sourceMapSourceRoot += ts.directorySeparator; - } - if (compilerOptions.mapRoot) { - sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (root) { - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); - } - if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { - sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); - sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true); - } - else { - sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); - } - } - else { - sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); - } - function emitNodeWithSourceMap(node) { - if (node) { - if (ts.nodeIsSynthesized(node)) { - return emitNodeWithoutSourceMap(node); - } - if (node.kind !== 246) { - recordEmitNodeStartSpan(node); - emitNodeWithoutSourceMap(node); - recordEmitNodeEndSpan(node); - } - else { - recordNewSourceFileStart(node); - emitNodeWithoutSourceMap(node); - } - } - } - function emitNodeWithCommentsAndWithSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); - } - writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithCommentsAndWithSourcemap; - emitStart = recordEmitNodeStartSpan; - emitEnd = recordEmitNodeEndSpan; - emitToken = writeTextWithSpanRecord; - scopeEmitStart = recordScopeNameOfNode; - scopeEmitEnd = recordScopeNameEnd; - writeComment = writeCommentRangeWithMap; - } - function writeJavaScriptFile(emitOutput, writeByteOrderMark) { - ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); - } - function createTempVariable(flags) { - var result = ts.createSynthesizedNode(67); - result.text = makeTempVariableName(flags); - return result; - } - function recordTempDeclaration(name) { - if (!tempVariables) { - tempVariables = []; - } - tempVariables.push(name); - } - function createAndRecordTempVariable(flags) { - var temp = createTempVariable(flags); - recordTempDeclaration(temp); - return temp; - } - function emitTempDeclarations(newLine) { - if (tempVariables) { - if (newLine) { - writeLine(); - } - else { - write(" "); - } - write("var "); - emitCommaList(tempVariables); - write(";"); - } - } - function emitTokenText(tokenKind, startPos, emitFn) { - var tokenString = ts.tokenToString(tokenKind); - if (emitFn) { - emitFn(); - } - else { - write(tokenString); - } - return startPos + tokenString.length; - } - function emitOptional(prefix, node) { - if (node) { - write(prefix); - emit(node); - } - } - function emitParenthesizedIf(node, parenthesized) { - if (parenthesized) { - write("("); - } - emit(node); - if (parenthesized) { - write(")"); - } - } - function emitTrailingCommaIfPresent(nodeList) { - if (nodeList.hasTrailingComma) { - write(","); - } - } - function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { - ts.Debug.assert(nodes.length > 0); - increaseIndent(); - if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { - if (spacesBetweenBraces) { - write(" "); - } - } - else { - writeLine(); - } - for (var i = 0, n = nodes.length; i < n; i++) { - if (i) { - if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { - write(", "); - } - else { - write(","); - writeLine(); - } - } - emit(nodes[i]); - } - if (nodes.hasTrailingComma && allowTrailingComma) { - write(","); - } - decreaseIndent(); - if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { - if (spacesBetweenBraces) { - write(" "); - } - } - else { - writeLine(); - } - } - function emitList(nodes, start, count, multiLine, trailingComma, leadingComma, noTrailingNewLine, emitNode) { - if (!emitNode) { - emitNode = emit; - } - for (var i = 0; i < count; i++) { - if (multiLine) { - if (i || leadingComma) { - write(","); - } - writeLine(); - } - else { - if (i || leadingComma) { - write(", "); - } - } - var node = nodes[start + i]; - emitTrailingCommentsOfPosition(node.pos); - emitNode(node); - leadingComma = true; - } - if (trailingComma) { - write(","); - } - if (multiLine && !noTrailingNewLine) { - writeLine(); - } - return count; - } - function emitCommaList(nodes) { - if (nodes) { - emitList(nodes, 0, nodes.length, false, false); - } - } - function emitLines(nodes) { - emitLinesStartingAt(nodes, 0); - } - function emitLinesStartingAt(nodes, startIndex) { - for (var i = startIndex; i < nodes.length; i++) { - writeLine(); - emit(nodes[i]); - } - } - function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 && text.length > 1) { - switch (text.charCodeAt(1)) { - case 98: - case 66: - case 111: - case 79: - return true; - } - } - return false; - } - function emitLiteral(node) { - var text = getLiteralText(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) { - writer.writeLiteral(text); - } - else if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { - write(node.text); - } - else { - write(text); - } - } - function getLiteralText(node) { - if (languageVersion < 2 && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText("\"", node.text, "\""); - } - if (node.parent) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - } - switch (node.kind) { - case 9: - return getQuotedEscapedLiteralText("\"", node.text, "\""); - case 11: - return getQuotedEscapedLiteralText("`", node.text, "`"); - case 12: - return getQuotedEscapedLiteralText("`", node.text, "${"); - case 13: - return getQuotedEscapedLiteralText("}", node.text, "${"); - case 14: - return getQuotedEscapedLiteralText("}", node.text, "`"); - case 8: - return node.text; - } - ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); - } - function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { - return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; - } - function emitDownlevelRawTemplateLiteral(node) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - var isLast = node.kind === 11 || node.kind === 14; - text = text.substring(1, text.length - (isLast ? 1 : 2)); - text = text.replace(/\r\n?/g, "\n"); - text = ts.escapeString(text); - write("\"" + text + "\""); - } - function emitDownlevelTaggedTemplateArray(node, literalEmitter) { - write("["); - if (node.template.kind === 11) { - literalEmitter(node.template); - } - else { - literalEmitter(node.template.head); - ts.forEach(node.template.templateSpans, function (child) { - write(", "); - literalEmitter(child.literal); - }); - } - write("]"); - } - function emitDownlevelTaggedTemplate(node) { - var tempVariable = createAndRecordTempVariable(0); - write("("); - emit(tempVariable); - write(" = "); - emitDownlevelTaggedTemplateArray(node, emit); - write(", "); - emit(tempVariable); - write(".raw = "); - emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral); - write(", "); - emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); - write("("); - emit(tempVariable); - if (node.template.kind === 181) { - ts.forEach(node.template.templateSpans, function (templateSpan) { - write(", "); - var needsParens = templateSpan.expression.kind === 179 - && templateSpan.expression.operatorToken.kind === 24; - emitParenthesizedIf(templateSpan.expression, needsParens); - }); - } - write("))"); - } - function emitTemplateExpression(node) { - if (languageVersion >= 2) { - ts.forEachChild(node, emit); - return; - } - var emitOuterParens = ts.isExpression(node.parent) - && templateNeedsParens(node, node.parent); - if (emitOuterParens) { - write("("); - } - var headEmitted = false; - if (shouldEmitTemplateHead()) { - emitLiteral(node.head); - headEmitted = true; - } - for (var i = 0, n = node.templateSpans.length; i < n; i++) { - var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 170 - && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; - if (i > 0 || headEmitted) { - write(" + "); - } - emitParenthesizedIf(templateSpan.expression, needsParens); - if (templateSpan.literal.text.length !== 0) { - write(" + "); - emitLiteral(templateSpan.literal); - } - } - if (emitOuterParens) { - write(")"); - } - function shouldEmitTemplateHead() { - // If this expression has an empty head literal and the first template span has a non-empty - // literal, then emitting the empty head literal is not necessary. - // `${ foo } and ${ bar }` - // can be emitted as - // foo + " and " + bar - // This is because it is only required that one of the first two operands in the emit - // output must be a string literal, so that the other operand and all following operands - // are forced into strings. - // - // If the first template span has an empty literal, then the head must still be emitted. - // `${ foo }${ bar }` - // must still be emitted as - // "" + foo + bar - ts.Debug.assert(node.templateSpans.length !== 0); - return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; - } - function templateNeedsParens(template, parent) { - switch (parent.kind) { - case 166: - case 167: - return parent.expression === template; - case 168: - case 170: - return false; - default: - return comparePrecedenceToBinaryPlus(parent) !== -1; - } - } - function comparePrecedenceToBinaryPlus(expression) { - switch (expression.kind) { - case 179: - switch (expression.operatorToken.kind) { - case 37: - case 38: - case 39: - return 1; - case 35: - case 36: - return 0; - default: - return -1; - } - case 182: - case 180: - return -1; - default: - return 1; - } - } - } - function emitTemplateSpan(span) { - emit(span.expression); - emit(span.literal); - } - function jsxEmitReact(node) { - function emitTagName(name) { - if (name.kind === 67 && ts.isIntrinsicJsxName(name.text)) { - write("\""); - emit(name); - write("\""); - } - else { - emit(name); - } - } - function emitAttributeName(name) { - if (/[A-Za-z_]+[\w*]/.test(name.text)) { - write("\""); - emit(name); - write("\""); - } - else { - emit(name); - } - } - function emitJsxAttribute(node) { - emitAttributeName(node.name); - write(": "); - if (node.initializer) { - emit(node.initializer); - } - else { - write("true"); - } - } - function emitJsxElement(openingNode, children) { - var syntheticReactRef = ts.createSynthesizedNode(67); - syntheticReactRef.text = 'React'; - syntheticReactRef.parent = openingNode; - emitLeadingComments(openingNode); - emitExpressionIdentifier(syntheticReactRef); - write(".createElement("); - emitTagName(openingNode.tagName); - write(", "); - if (openingNode.attributes.length === 0) { - write("null"); - } - else { - var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 237; })) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); - var haveOpenedObjectLiteral = false; - for (var i_1 = 0; i_1 < attrs.length; i_1++) { - if (attrs[i_1].kind === 237) { - if (i_1 === 0) { - write("{}, "); - } - if (haveOpenedObjectLiteral) { - write("}"); - haveOpenedObjectLiteral = false; - } - if (i_1 > 0) { - write(", "); - } - emit(attrs[i_1].expression); - } - else { - ts.Debug.assert(attrs[i_1].kind === 236); - if (haveOpenedObjectLiteral) { - write(", "); - } - else { - haveOpenedObjectLiteral = true; - if (i_1 > 0) { - write(", "); - } - write("{"); - } - emitJsxAttribute(attrs[i_1]); - } - } - if (haveOpenedObjectLiteral) - write("}"); - write(")"); - } - else { - write("{"); - for (var i = 0; i < attrs.length; i++) { - if (i > 0) { - write(", "); - } - emitJsxAttribute(attrs[i]); - } - write("}"); - } - } - if (children) { - for (var i = 0; i < children.length; i++) { - if (children[i].kind === 238 && !(children[i].expression)) { - continue; - } - if (children[i].kind === 234) { - var text = getTextToEmit(children[i]); - if (text !== undefined) { - write(", \""); - write(text); - write("\""); - } - } - else { - write(", "); - emit(children[i]); - } - } - } - write(")"); - emitTrailingComments(openingNode); - } - if (node.kind === 231) { - emitJsxElement(node.openingElement, node.children); - } - else { - ts.Debug.assert(node.kind === 232); - emitJsxElement(node); - } - } - function jsxEmitPreserve(node) { - function emitJsxAttribute(node) { - emit(node.name); - if (node.initializer) { - write("="); - emit(node.initializer); - } - } - function emitJsxSpreadAttribute(node) { - write("{..."); - emit(node.expression); - write("}"); - } - function emitAttributes(attribs) { - for (var i = 0, n = attribs.length; i < n; i++) { - if (i > 0) { - write(" "); - } - if (attribs[i].kind === 237) { - emitJsxSpreadAttribute(attribs[i]); - } - else { - ts.Debug.assert(attribs[i].kind === 236); - emitJsxAttribute(attribs[i]); - } - } - } - function emitJsxOpeningOrSelfClosingElement(node) { - write("<"); - emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 232)) { - write(" "); - } - emitAttributes(node.attributes); - if (node.kind === 232) { - write("/>"); - } - else { - write(">"); - } - } - function emitJsxClosingElement(node) { - write(""); - } - function emitJsxElement(node) { - emitJsxOpeningOrSelfClosingElement(node.openingElement); - for (var i = 0, n = node.children.length; i < n; i++) { - emit(node.children[i]); - } - emitJsxClosingElement(node.closingElement); - } - if (node.kind === 231) { - emitJsxElement(node); - } - else { - ts.Debug.assert(node.kind === 232); - emitJsxOpeningOrSelfClosingElement(node); - } - } - function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 161); - if (node.kind === 9) { - emitLiteral(node); - } - else if (node.kind === 134) { - if (ts.nodeIsDecorated(node.parent)) { - if (!computedPropertyNamesToGeneratedNames) { - computedPropertyNamesToGeneratedNames = []; - } - var generatedName = computedPropertyNamesToGeneratedNames[ts.getNodeId(node)]; - if (generatedName) { - write(generatedName); - return; - } - generatedName = createAndRecordTempVariable(0).text; - computedPropertyNamesToGeneratedNames[ts.getNodeId(node)] = generatedName; - write(generatedName); - write(" = "); - } - emit(node.expression); - } - else { - write("\""); - if (node.kind === 8) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - write("\""); - } - } - function isExpressionIdentifier(node) { - var parent = node.parent; - switch (parent.kind) { - case 162: - case 179: - case 166: - case 239: - case 134: - case 180: - case 137: - case 173: - case 195: - case 165: - case 225: - case 193: - case 186: - case 197: - case 198: - case 199: - case 194: - case 232: - case 233: - case 237: - case 238: - case 167: - case 170: - case 178: - case 177: - case 202: - case 244: - case 183: - case 204: - case 168: - case 188: - case 206: - case 169: - case 174: - case 175: - case 196: - case 203: - case 182: - return true; - case 161: - case 245: - case 136: - case 243: - case 139: - case 209: - return parent.initializer === node; - case 164: - return parent.expression === node; - case 172: - case 171: - return parent.body === node; - case 219: - return parent.moduleReference === node; - case 133: - return parent.left === node; - } - return false; - } - function emitExpressionIdentifier(node) { - if (resolver.getNodeCheckFlags(node) & 2048) { - write("_arguments"); - return; - } - var container = resolver.getReferencedExportContainer(node); - if (container) { - if (container.kind === 246) { - if (languageVersion < 2 && compilerOptions.module !== 4) { - write("exports."); - } - } - else { - write(getGeneratedNameForNode(container)); - write("."); - } - } - else if (languageVersion < 2) { - var declaration = resolver.getReferencedImportDeclaration(node); - if (declaration) { - if (declaration.kind === 221) { - write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 ? "[\"default\"]" : ".default"); - return; - } - else if (declaration.kind === 224) { - write(getGeneratedNameForNode(declaration.parent.parent.parent)); - write("."); - writeTextOfNode(currentSourceFile, declaration.propertyName || declaration.name); - return; - } - } - declaration = resolver.getReferencedNestedRedeclaration(node); - if (declaration) { - write(getGeneratedNameForNode(declaration.name)); - return; - } - } - if (ts.nodeIsSynthesized(node)) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - } - function isNameOfNestedRedeclaration(node) { - if (languageVersion < 2) { - var parent_6 = node.parent; - switch (parent_6.kind) { - case 161: - case 212: - case 215: - case 209: - return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); - } - } - return false; - } - function emitIdentifier(node) { - if (!node.parent) { - write(node.text); - } - else if (isExpressionIdentifier(node)) { - emitExpressionIdentifier(node); - } - else if (isNameOfNestedRedeclaration(node)) { - write(getGeneratedNameForNode(node)); - } - else if (ts.nodeIsSynthesized(node)) { - write(node.text); - } - else { - writeTextOfNode(currentSourceFile, node); - } - } - function emitThis(node) { - if (resolver.getNodeCheckFlags(node) & 2) { - write("_this"); - } - else { - write("this"); - } - } - function emitSuper(node) { - if (languageVersion >= 2) { - write("super"); - } - else { - var flags = resolver.getNodeCheckFlags(node); - if (flags & 256) { - write("_super.prototype"); - } - else { - write("_super"); - } - } - } - function emitObjectBindingPattern(node) { - write("{ "); - var elements = node.elements; - emitList(elements, 0, elements.length, false, elements.hasTrailingComma); - write(" }"); - } - function emitArrayBindingPattern(node) { - write("["); - var elements = node.elements; - emitList(elements, 0, elements.length, false, elements.hasTrailingComma); - write("]"); - } - function emitBindingElement(node) { - if (node.propertyName) { - emit(node.propertyName); - write(": "); - } - if (node.dotDotDotToken) { - write("..."); - } - if (ts.isBindingPattern(node.name)) { - emit(node.name); - } - else { - emitModuleMemberName(node); - } - emitOptional(" = ", node.initializer); - } - function emitSpreadElementExpression(node) { - write("..."); - emit(node.expression); - } - function emitYieldExpression(node) { - write(ts.tokenToString(112)); - if (node.asteriskToken) { - write("*"); - } - if (node.expression) { - write(" "); - emit(node.expression); - } - } - function emitAwaitExpression(node) { - var needsParenthesis = needsParenthesisForAwaitExpressionAsYield(node); - if (needsParenthesis) { - write("("); - } - write(ts.tokenToString(112)); - write(" "); - emit(node.expression); - if (needsParenthesis) { - write(")"); - } - } - function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 179 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { - return true; - } - else if (node.parent.kind === 180 && node.parent.condition === node) { - return true; - } - return false; - } - function needsParenthesisForPropertyAccessOrInvocation(node) { - switch (node.kind) { - case 67: - case 162: - case 164: - case 165: - case 166: - case 170: - return false; - } - return true; - } - function emitListWithSpread(elements, needsUniqueCopy, multiLine, trailingComma, useConcat) { - var pos = 0; - var group = 0; - var length = elements.length; - while (pos < length) { - if (group === 1 && useConcat) { - write(".concat("); - } - else if (group > 0) { - write(", "); - } - var e = elements[pos]; - if (e.kind === 183) { - e = e.expression; - emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); - pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 162) { - write(".slice()"); - } - } - else { - var i = pos; - while (i < length && elements[i].kind !== 183) { - i++; - } - write("["); - if (multiLine) { - increaseIndent(); - } - emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); - if (multiLine) { - decreaseIndent(); - } - write("]"); - pos = i; - } - group++; - } - if (group > 1) { - if (useConcat) { - write(")"); - } - } - } - function isSpreadElementExpression(node) { - return node.kind === 183; - } - function emitArrayLiteral(node) { - var elements = node.elements; - if (elements.length === 0) { - write("[]"); - } - else if (languageVersion >= 2 || !ts.forEach(elements, isSpreadElementExpression)) { - write("["); - emitLinePreservingList(node, node.elements, elements.hasTrailingComma, false); - write("]"); - } - else { - emitListWithSpread(elements, true, (node.flags & 2048) !== 0, elements.hasTrailingComma, true); - } - } - function emitObjectLiteralBody(node, numElements) { - if (numElements === 0) { - write("{}"); - return; - } - write("{"); - if (numElements > 0) { - var properties = node.properties; - if (numElements === properties.length) { - emitLinePreservingList(node, properties, languageVersion >= 1, true); - } - else { - var multiLine = (node.flags & 2048) !== 0; - if (!multiLine) { - write(" "); - } - else { - increaseIndent(); - } - emitList(properties, 0, numElements, multiLine, false); - if (!multiLine) { - write(" "); - } - else { - decreaseIndent(); - } - } - } - write("}"); - } - function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = (node.flags & 2048) !== 0; - var properties = node.properties; - write("("); - if (multiLine) { - increaseIndent(); - } - var tempVar = createAndRecordTempVariable(0); - emit(tempVar); - write(" = "); - emitObjectLiteralBody(node, firstComputedPropertyIndex); - for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { - writeComma(); - var property = properties[i]; - emitStart(property); - if (property.kind === 143 || property.kind === 144) { - var accessors = ts.getAllAccessorDeclarations(node.properties, property); - if (property !== accessors.firstAccessor) { - continue; - } - write("Object.defineProperty("); - emit(tempVar); - write(", "); - emitStart(node.name); - emitExpressionForPropertyName(property.name); - emitEnd(property.name); - write(", {"); - increaseIndent(); - if (accessors.getAccessor) { - writeLine(); - emitLeadingComments(accessors.getAccessor); - write("get: "); - emitStart(accessors.getAccessor); - write("function "); - emitSignatureAndBody(accessors.getAccessor); - emitEnd(accessors.getAccessor); - emitTrailingComments(accessors.getAccessor); - write(","); - } - if (accessors.setAccessor) { - writeLine(); - emitLeadingComments(accessors.setAccessor); - write("set: "); - emitStart(accessors.setAccessor); - write("function "); - emitSignatureAndBody(accessors.setAccessor); - emitEnd(accessors.setAccessor); - emitTrailingComments(accessors.setAccessor); - write(","); - } - writeLine(); - write("enumerable: true,"); - writeLine(); - write("configurable: true"); - decreaseIndent(); - writeLine(); - write("})"); - emitEnd(property); - } - else { - emitLeadingComments(property); - emitStart(property.name); - emit(tempVar); - emitMemberAccessForPropertyName(property.name); - emitEnd(property.name); - write(" = "); - if (property.kind === 243) { - emit(property.initializer); - } - else if (property.kind === 244) { - emitExpressionIdentifier(property.name); - } - else if (property.kind === 141) { - emitFunctionDeclaration(property); - } - else { - ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); - } - } - emitEnd(property); - } - writeComma(); - emit(tempVar); - if (multiLine) { - decreaseIndent(); - writeLine(); - } - write(")"); - function writeComma() { - if (multiLine) { - write(","); - writeLine(); - } - else { - write(", "); - } - } - } - function emitObjectLiteral(node) { - var properties = node.properties; - if (languageVersion < 2) { - var numProperties = properties.length; - var numInitialNonComputedProperties = numProperties; - for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 134) { - numInitialNonComputedProperties = i; - break; - } - } - var hasComputedProperty = numInitialNonComputedProperties !== properties.length; - if (hasComputedProperty) { - emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); - return; - } - } - emitObjectLiteralBody(node, properties.length); - } - function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(179, startsOnNewLine); - result.operatorToken = ts.createSynthesizedNode(operator); - result.left = left; - result.right = right; - return result; - } - function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(164); - result.expression = parenthesizeForAccess(expression); - result.dotToken = ts.createSynthesizedNode(21); - result.name = name; - return result; - } - function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(165); - result.expression = parenthesizeForAccess(expression); - result.argumentExpression = argumentExpression; - return result; - } - function parenthesizeForAccess(expr) { - while (expr.kind === 169 || expr.kind === 187) { - expr = expr.expression; - } - if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 167 && - expr.kind !== 8) { - return expr; - } - var node = ts.createSynthesizedNode(170); - node.expression = expr; - return node; - } - function emitComputedPropertyName(node) { - write("["); - emitExpressionForPropertyName(node); - write("]"); - } - function emitMethod(node) { - if (languageVersion >= 2 && node.asteriskToken) { - write("*"); - } - emit(node.name); - if (languageVersion < 2) { - write(": function "); - } - emitSignatureAndBody(node); - } - function emitPropertyAssignment(node) { - emit(node.name); - write(": "); - emitTrailingCommentsOfPosition(node.initializer.pos); - emit(node.initializer); - } - function isNamespaceExportReference(node) { - var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 246; - } - function emitShorthandPropertyAssignment(node) { - writeTextOfNode(currentSourceFile, node.name); - if (languageVersion < 2 || isNamespaceExportReference(node.name)) { - write(": "); - emit(node.name); - } - } - function tryEmitConstantValue(node) { - var constantValue = tryGetConstEnumValue(node); - if (constantValue !== undefined) { - write(constantValue.toString()); - if (!compilerOptions.removeComments) { - var propertyName = node.kind === 164 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); - write(" /* " + propertyName + " */"); - } - return true; - } - return false; - } - function tryGetConstEnumValue(node) { - if (compilerOptions.isolatedModules) { - return undefined; - } - return node.kind === 164 || node.kind === 165 - ? resolver.getConstantValue(node) - : undefined; - } - function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); - var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); - if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { - increaseIndent(); - writeLine(); - return true; - } - else { - if (valueToWriteWhenNotIndenting) { - write(valueToWriteWhenNotIndenting); - } - return false; - } - } - function emitPropertyAccess(node) { - if (tryEmitConstantValue(node)) { - return; - } - emit(node.expression); - var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); - var shouldEmitSpace; - if (!indentedBeforeDot) { - if (node.expression.kind === 8) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); - shouldEmitSpace = text.indexOf(ts.tokenToString(21)) < 0; - } - else { - var constantValue = tryGetConstEnumValue(node.expression); - shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; - } - } - if (shouldEmitSpace) { - write(" ."); - } - else { - write("."); - } - var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); - emit(node.name); - decreaseIndentIf(indentedBeforeDot, indentedAfterDot); - } - function emitQualifiedName(node) { - emit(node.left); - write("."); - emit(node.right); - } - function emitQualifiedNameAsExpression(node, useFallback) { - if (node.left.kind === 67) { - emitEntityNameAsExpression(node.left, useFallback); - } - else if (useFallback) { - var temp = createAndRecordTempVariable(0); - write("("); - emitNodeWithoutSourceMap(temp); - write(" = "); - emitEntityNameAsExpression(node.left, true); - write(") && "); - emitNodeWithoutSourceMap(temp); - } - else { - emitEntityNameAsExpression(node.left, false); - } - write("."); - emit(node.right); - } - function emitEntityNameAsExpression(node, useFallback) { - switch (node.kind) { - case 67: - if (useFallback) { - write("typeof "); - emitExpressionIdentifier(node); - write(" !== 'undefined' && "); - } - emitExpressionIdentifier(node); - break; - case 133: - emitQualifiedNameAsExpression(node, useFallback); - break; - } - } - function emitIndexedAccess(node) { - if (tryEmitConstantValue(node)) { - return; - } - emit(node.expression); - write("["); - emit(node.argumentExpression); - write("]"); - } - function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 183; }); - } - function skipParentheses(node) { - while (node.kind === 170 || node.kind === 169 || node.kind === 187) { - node = node.expression; - } - return node; - } - function emitCallTarget(node) { - if (node.kind === 67 || node.kind === 95 || node.kind === 93) { - emit(node); - return node; - } - var temp = createAndRecordTempVariable(0); - write("("); - emit(temp); - write(" = "); - emit(node); - write(")"); - return temp; - } - function emitCallWithSpread(node) { - var target; - var expr = skipParentheses(node.expression); - if (expr.kind === 164) { - target = emitCallTarget(expr.expression); - write("."); - emit(expr.name); - } - else if (expr.kind === 165) { - target = emitCallTarget(expr.expression); - write("["); - emit(expr.argumentExpression); - write("]"); - } - else if (expr.kind === 93) { - target = expr; - write("_super"); - } - else { - emit(node.expression); - } - write(".apply("); - if (target) { - if (target.kind === 93) { - emitThis(target); - } - else { - emit(target); - } - } - else { - write("void 0"); - } - write(", "); - emitListWithSpread(node.arguments, false, false, false, true); - write(")"); - } - function emitCallExpression(node) { - if (languageVersion < 2 && hasSpreadElement(node.arguments)) { - emitCallWithSpread(node); - return; - } - var superCall = false; - if (node.expression.kind === 93) { - emitSuper(node.expression); - superCall = true; - } - else { - emit(node.expression); - superCall = node.expression.kind === 164 && node.expression.expression.kind === 93; - } - if (superCall && languageVersion < 2) { - write(".call("); - emitThis(node.expression); - if (node.arguments.length) { - write(", "); - emitCommaList(node.arguments); - } - write(")"); - } - else { - write("("); - emitCommaList(node.arguments); - write(")"); - } - } - function emitNewExpression(node) { - write("new "); - if (languageVersion === 1 && - node.arguments && - hasSpreadElement(node.arguments)) { - write("("); - var target = emitCallTarget(node.expression); - write(".bind.apply("); - emit(target); - write(", [void 0].concat("); - emitListWithSpread(node.arguments, false, false, false, false); - write(")))"); - write("()"); - } - else { - emit(node.expression); - if (node.arguments) { - write("("); - emitCommaList(node.arguments); - write(")"); - } - } - } - function emitTaggedTemplateExpression(node) { - if (languageVersion >= 2) { - emit(node.tag); - write(" "); - emit(node.template); - } - else { - emitDownlevelTaggedTemplate(node); - } - } - function emitParenExpression(node) { - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 172) { - if (node.expression.kind === 169 || node.expression.kind === 187) { - var operand = node.expression.expression; - while (operand.kind === 169 || operand.kind === 187) { - operand = operand.expression; - } - if (operand.kind !== 177 && - operand.kind !== 175 && - operand.kind !== 174 && - operand.kind !== 173 && - operand.kind !== 178 && - operand.kind !== 167 && - !(operand.kind === 166 && node.parent.kind === 167) && - !(operand.kind === 171 && node.parent.kind === 166)) { - emit(operand); - return; - } - } - } - write("("); - emit(node.expression); - write(")"); - } - function emitDeleteExpression(node) { - write(ts.tokenToString(76)); - write(" "); - emit(node.expression); - } - function emitVoidExpression(node) { - write(ts.tokenToString(101)); - write(" "); - emit(node.expression); - } - function emitTypeOfExpression(node) { - write(ts.tokenToString(99)); - write(" "); - emit(node.expression); - } - function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { - if (!isCurrentFileSystemExternalModule() || node.kind !== 67 || ts.nodeIsSynthesized(node)) { - return false; - } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 209 || node.parent.kind === 161); - var targetDeclaration = isVariableDeclarationOrBindingElement - ? node.parent - : resolver.getReferencedValueDeclaration(node); - return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); - } - function emitPrefixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.operand); - write("\", "); - } - write(ts.tokenToString(node.operator)); - if (node.operand.kind === 177) { - var operand = node.operand; - if (node.operator === 35 && (operand.operator === 35 || operand.operator === 40)) { - write(" "); - } - else if (node.operator === 36 && (operand.operator === 36 || operand.operator === 41)) { - write(" "); - } - } - emit(node.operand); - if (exportChanged) { - write(")"); - } - } - function emitPostfixUnaryExpression(node) { - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); - if (exportChanged) { - write("(" + exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.operand); - write("\", "); - write(ts.tokenToString(node.operator)); - emit(node.operand); - if (node.operator === 40) { - write(") - 1)"); - } - else { - write(") + 1)"); - } - } - else { - emit(node.operand); - write(ts.tokenToString(node.operator)); - } - } - function shouldHoistDeclarationInSystemJsModule(node) { - return isSourceFileLevelDeclarationInSystemJsModule(node, false); - } - function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { - if (!node || languageVersion >= 2 || !isCurrentFileSystemExternalModule()) { - return false; - } - var current = node; - while (current) { - if (current.kind === 246) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); - } - else if (ts.isFunctionLike(current) || current.kind === 217) { - return false; - } - else { - current = current.parent; - } - } - } - function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 55 && - (node.left.kind === 163 || node.left.kind === 162)) { - emitDestructuring(node, node.parent.kind === 193); - } - else { - var exportChanged = node.operatorToken.kind >= 55 && - node.operatorToken.kind <= 66 && - isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.left); - write("\", "); - } - emit(node.left); - var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 ? " " : undefined); - write(ts.tokenToString(node.operatorToken.kind)); - var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); - emit(node.right); - decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); - if (exportChanged) { - write(")"); - } - } - } - function synthesizedNodeStartsOnNewLine(node) { - return ts.nodeIsSynthesized(node) && node.startsOnNewLine; - } - function emitConditionalExpression(node) { - emit(node.condition); - var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); - write("?"); - var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); - emit(node.whenTrue); - decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); - var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); - write(":"); - var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); - emit(node.whenFalse); - decreaseIndentIf(indentedBeforeColon, indentedAfterColon); - } - function decreaseIndentIf(value1, value2) { - if (value1) { - decreaseIndent(); - } - if (value2) { - decreaseIndent(); - } - } - function isSingleLineEmptyBlock(node) { - if (node && node.kind === 190) { - var block = node; - return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); - } - } - function emitBlock(node) { - if (isSingleLineEmptyBlock(node)) { - emitToken(15, node.pos); - write(" "); - emitToken(16, node.statements.end); - return; - } - emitToken(15, node.pos); - increaseIndent(); - scopeEmitStart(node.parent); - if (node.kind === 217) { - ts.Debug.assert(node.parent.kind === 216); - emitCaptureThisForNodeIfNecessary(node.parent); - } - emitLines(node.statements); - if (node.kind === 217) { - emitTempDeclarations(true); - } - decreaseIndent(); - writeLine(); - emitToken(16, node.statements.end); - scopeEmitEnd(); - } - function emitEmbeddedStatement(node) { - if (node.kind === 190) { - write(" "); - emit(node); - } - else { - increaseIndent(); - writeLine(); - emit(node); - decreaseIndent(); - } - } - function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 172); - write(";"); - } - function emitIfStatement(node) { - var endPos = emitToken(86, node.pos); - write(" "); - endPos = emitToken(17, endPos); - emit(node.expression); - emitToken(18, node.expression.end); - emitEmbeddedStatement(node.thenStatement); - if (node.elseStatement) { - writeLine(); - emitToken(78, node.thenStatement.end); - if (node.elseStatement.kind === 194) { - write(" "); - emit(node.elseStatement); - } - else { - emitEmbeddedStatement(node.elseStatement); - } - } - } - function emitDoStatement(node) { - write("do"); - emitEmbeddedStatement(node.statement); - if (node.statement.kind === 190) { - write(" "); - } - else { - writeLine(); - } - write("while ("); - emit(node.expression); - write(");"); - } - function emitWhileStatement(node) { - write("while ("); - emit(node.expression); - write(")"); - emitEmbeddedStatement(node.statement); - } - function tryEmitStartOfVariableDeclarationList(decl, startPos) { - if (shouldHoistVariable(decl, true)) { - return false; - } - var tokenKind = 100; - if (decl && languageVersion >= 2) { - if (ts.isLet(decl)) { - tokenKind = 106; - } - else if (ts.isConst(decl)) { - tokenKind = 72; - } - } - if (startPos !== undefined) { - emitToken(tokenKind, startPos); - write(" "); - } - else { - switch (tokenKind) { - case 100: - write("var "); - break; - case 106: - write("let "); - break; - case 72: - write("const "); - break; - } - } - return true; - } - function emitVariableDeclarationListSkippingUninitializedEntries(list) { - var started = false; - for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { - var decl = _b[_a]; - if (!decl.initializer) { - continue; - } - if (!started) { - started = true; - } - else { - write(", "); - } - emit(decl); - } - return started; - } - function emitForStatement(node) { - var endPos = emitToken(84, node.pos); - write(" "); - endPos = emitToken(17, endPos); - if (node.initializer && node.initializer.kind === 210) { - var variableDeclarationList = node.initializer; - var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); - if (startIsEmitted) { - emitCommaList(variableDeclarationList.declarations); - } - else { - emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); - } - } - else if (node.initializer) { - emit(node.initializer); - } - write(";"); - emitOptional(" ", node.condition); - write(";"); - emitOptional(" ", node.incrementor); - write(")"); - emitEmbeddedStatement(node.statement); - } - function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 199) { - return emitDownLevelForOfStatement(node); - } - var endPos = emitToken(84, node.pos); - write(" "); - endPos = emitToken(17, endPos); - if (node.initializer.kind === 210) { - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length >= 1) { - tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); - emit(variableDeclarationList.declarations[0]); - } - } - else { - emit(node.initializer); - } - if (node.kind === 198) { - write(" in "); - } - else { - write(" of "); - } - emit(node.expression); - emitToken(18, node.expression.end); - emitEmbeddedStatement(node.statement); - } - function emitDownLevelForOfStatement(node) { - // The following ES6 code: - // - // for (let v of expr) { } - // - // should be emitted as - // - // for (let _i = 0, _a = expr; _i < _a.length; _i++) { - // let v = _a[_i]; - // } - // - // where _a and _i are temps emitted to capture the RHS and the counter, - // respectively. - // When the left hand side is an expression instead of a let declaration, - // the "let v" is not emitted. - // When the left hand side is a let/const, the v is renamed if there is - // another v in scope. - // Note that all assignments to the LHS are emitted in the body, including - // all destructuring. - // Note also that because an extra statement is needed to assign to the LHS, - // for-of bodies are always emitted as blocks. - var endPos = emitToken(84, node.pos); - write(" "); - endPos = emitToken(17, endPos); - var rhsIsIdentifier = node.expression.kind === 67; - var counter = createTempVariable(268435456); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); - emitStart(node.expression); - write("var "); - emitNodeWithoutSourceMap(counter); - write(" = 0"); - emitEnd(node.expression); - if (!rhsIsIdentifier) { - write(", "); - emitStart(node.expression); - emitNodeWithoutSourceMap(rhsReference); - write(" = "); - emitNodeWithoutSourceMap(node.expression); - emitEnd(node.expression); - } - write("; "); - emitStart(node.initializer); - emitNodeWithoutSourceMap(counter); - write(" < "); - emitNodeWithCommentsAndWithoutSourcemap(rhsReference); - write(".length"); - emitEnd(node.initializer); - write("; "); - emitStart(node.initializer); - emitNodeWithoutSourceMap(counter); - write("++"); - emitEnd(node.initializer); - emitToken(18, node.expression.end); - write(" {"); - writeLine(); - increaseIndent(); - var rhsIterationValue = createElementAccessExpression(rhsReference, counter); - emitStart(node.initializer); - if (node.initializer.kind === 210) { - write("var "); - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length > 0) { - var declaration = variableDeclarationList.declarations[0]; - if (ts.isBindingPattern(declaration.name)) { - emitDestructuring(declaration, false, rhsIterationValue); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(declaration); - write(" = "); - emitNodeWithoutSourceMap(rhsIterationValue); - } - } - else { - emitNodeWithoutSourceMap(createTempVariable(0)); - write(" = "); - emitNodeWithoutSourceMap(rhsIterationValue); - } - } - else { - var assignmentExpression = createBinaryExpression(node.initializer, 55, rhsIterationValue, false); - if (node.initializer.kind === 162 || node.initializer.kind === 163) { - emitDestructuring(assignmentExpression, true, undefined); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); - } - } - emitEnd(node.initializer); - write(";"); - if (node.statement.kind === 190) { - emitLines(node.statement.statements); - } - else { - writeLine(); - emit(node.statement); - } - writeLine(); - decreaseIndent(); - write("}"); - } - function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 201 ? 68 : 73, node.pos); - emitOptional(" ", node.label); - write(";"); - } - function emitReturnStatement(node) { - emitToken(92, node.pos); - emitOptional(" ", node.expression); - write(";"); - } - function emitWithStatement(node) { - write("with ("); - emit(node.expression); - write(")"); - emitEmbeddedStatement(node.statement); - } - function emitSwitchStatement(node) { - var endPos = emitToken(94, node.pos); - write(" "); - emitToken(17, endPos); - emit(node.expression); - endPos = emitToken(18, node.expression.end); - write(" "); - emitCaseBlock(node.caseBlock, endPos); - } - function emitCaseBlock(node, startPos) { - emitToken(15, startPos); - increaseIndent(); - emitLines(node.clauses); - decreaseIndent(); - writeLine(); - emitToken(16, node.clauses.end); - } - function nodeStartPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); - } - function nodeEndPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, node2.end); - } - function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === - ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); - } - function emitCaseOrDefaultClause(node) { - if (node.kind === 239) { - write("case "); - emit(node.expression); - write(":"); - } - else { - write("default:"); - } - if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { - write(" "); - emit(node.statements[0]); - } - else { - increaseIndent(); - emitLines(node.statements); - decreaseIndent(); - } - } - function emitThrowStatement(node) { - write("throw "); - emit(node.expression); - write(";"); - } - function emitTryStatement(node) { - write("try "); - emit(node.tryBlock); - emit(node.catchClause); - if (node.finallyBlock) { - writeLine(); - write("finally "); - emit(node.finallyBlock); - } - } - function emitCatchClause(node) { - writeLine(); - var endPos = emitToken(70, node.pos); - write(" "); - emitToken(17, endPos); - emit(node.variableDeclaration); - emitToken(18, node.variableDeclaration ? node.variableDeclaration.end : endPos); - write(" "); - emitBlock(node.block); - } - function emitDebuggerStatement(node) { - emitToken(74, node.pos); - write(";"); - } - function emitLabelledStatement(node) { - emit(node.label); - write(": "); - emit(node.statement); - } - function getContainingModule(node) { - do { - node = node.parent; - } while (node && node.kind !== 216); - return node; - } - function emitContainingModuleName(node) { - var container = getContainingModule(node); - write(container ? getGeneratedNameForNode(container) : "exports"); - } - function emitModuleMemberName(node) { - emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 1) { - var container = getContainingModule(node); - if (container) { - write(getGeneratedNameForNode(container)); - write("."); - } - else if (languageVersion < 2 && compilerOptions.module !== 4) { - write("exports."); - } - } - emitNodeWithCommentsAndWithoutSourcemap(node.name); - emitEnd(node.name); - } - function createVoidZero() { - var zero = ts.createSynthesizedNode(8); - zero.text = "0"; - var result = ts.createSynthesizedNode(175); - result.expression = zero; - return result; - } - function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 246) { - ts.Debug.assert(!!(node.flags & 1024) || node.kind === 225); - if (compilerOptions.module === 1 || compilerOptions.module === 2 || compilerOptions.module === 3) { - if (!currentSourceFile.symbol.exports["___esModule"]) { - if (languageVersion === 1) { - write("Object.defineProperty(exports, \"__esModule\", { value: true });"); - writeLine(); - } - else if (languageVersion === 0) { - write("exports.__esModule = true;"); - writeLine(); - } - } - } - } - } - function emitExportMemberAssignment(node) { - if (node.flags & 1) { - writeLine(); - emitStart(node); - if (compilerOptions.module === 4 && node.parent === currentSourceFile) { - write(exportFunctionForFile + "(\""); - if (node.flags & 1024) { - write("default"); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(node.name); - } - write("\", "); - emitDeclarationName(node); - write(")"); - } - else { - if (node.flags & 1024) { - emitEs6ExportDefaultCompat(node); - if (languageVersion === 0) { - write("exports[\"default\"]"); - } - else { - write("exports.default"); - } - } - else { - emitModuleMemberName(node); - } - write(" = "); - emitDeclarationName(node); - } - emitEnd(node); - write(";"); - } - } - function emitExportMemberAssignments(name) { - if (compilerOptions.module === 4) { - return; - } - if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { - for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { - var specifier = _b[_a]; - writeLine(); - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); - write(";"); - } - } - } - function emitExportSpecifierInSystemModule(specifier) { - ts.Debug.assert(compilerOptions.module === 4); - if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { - return; - } - writeLine(); - emitStart(specifier.name); - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - write("\", "); - emitExpressionIdentifier(specifier.propertyName || specifier.name); - write(")"); - emitEnd(specifier.name); - write(";"); - } - function emitDestructuring(root, isAssignmentExpressionStatement, value) { - var emitCount = 0; - var canDefineTempVariablesInPlace = false; - if (root.kind === 209) { - var isExported = ts.getCombinedNodeFlags(root) & 1; - var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); - canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; - } - else if (root.kind === 136) { - canDefineTempVariablesInPlace = true; - } - if (root.kind === 179) { - emitAssignmentExpression(root); - } - else { - ts.Debug.assert(!isAssignmentExpressionStatement); - emitBindingElement(root, value); - } - function emitAssignment(name, value) { - if (emitCount++) { - write(", "); - } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 209 || name.parent.kind === 161); - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(name); - write("\", "); - } - if (isVariableDeclarationOrBindingElement) { - emitModuleMemberName(name.parent); - } - else { - emit(name); - } - write(" = "); - emit(value); - if (exportChanged) { - write(")"); - } - } - function ensureIdentifier(expr, reuseIdentifierExpressions) { - if (expr.kind === 67 && reuseIdentifierExpressions) { - return expr; - } - var identifier = createTempVariable(0); - if (!canDefineTempVariablesInPlace) { - recordTempDeclaration(identifier); - } - emitAssignment(identifier, expr); - return identifier; - } - function createDefaultValueCheck(value, defaultValue) { - value = ensureIdentifier(value, true); - var equals = ts.createSynthesizedNode(179); - equals.left = value; - equals.operatorToken = ts.createSynthesizedNode(32); - equals.right = createVoidZero(); - return createConditionalExpression(equals, defaultValue, value); - } - function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(180); - cond.condition = condition; - cond.questionToken = ts.createSynthesizedNode(52); - cond.whenTrue = whenTrue; - cond.colonToken = ts.createSynthesizedNode(53); - cond.whenFalse = whenFalse; - return cond; - } - function createNumericLiteral(value) { - var node = ts.createSynthesizedNode(8); - node.text = "" + value; - return node; - } - function createPropertyAccessForDestructuringProperty(object, propName) { - var syntheticName = ts.createSynthesizedNode(propName.kind); - syntheticName.text = propName.text; - if (syntheticName.kind !== 67) { - return createElementAccessExpression(object, syntheticName); - } - return createPropertyAccessExpression(object, syntheticName); - } - function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(166); - var sliceIdentifier = ts.createSynthesizedNode(67); - sliceIdentifier.text = "slice"; - call.expression = createPropertyAccessExpression(value, sliceIdentifier); - call.arguments = ts.createSynthesizedNodeArray(); - call.arguments[0] = createNumericLiteral(sliceIndex); - return call; - } - function emitObjectLiteralAssignment(target, value) { - var properties = target.properties; - if (properties.length !== 1) { - value = ensureIdentifier(value, true); - } - for (var _a = 0; _a < properties.length; _a++) { - var p = properties[_a]; - if (p.kind === 243 || p.kind === 244) { - var propName = p.name; - emitDestructuringAssignment(p.initializer || propName, createPropertyAccessForDestructuringProperty(value, propName)); - } - } - } - function emitArrayLiteralAssignment(target, value) { - var elements = target.elements; - if (elements.length !== 1) { - value = ensureIdentifier(value, true); - } - for (var i = 0; i < elements.length; i++) { - var e = elements[i]; - if (e.kind !== 185) { - if (e.kind !== 183) { - emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); - } - else if (i === elements.length - 1) { - emitDestructuringAssignment(e.expression, createSliceCall(value, i)); - } - } - } - } - function emitDestructuringAssignment(target, value) { - if (target.kind === 179 && target.operatorToken.kind === 55) { - value = createDefaultValueCheck(value, target.right); - target = target.left; - } - if (target.kind === 163) { - emitObjectLiteralAssignment(target, value); - } - else if (target.kind === 162) { - emitArrayLiteralAssignment(target, value); - } - else { - emitAssignment(target, value); - } - } - function emitAssignmentExpression(root) { - var target = root.left; - var value = root.right; - if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { - emit(value); - } - else if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, value); - } - else { - if (root.parent.kind !== 170) { - write("("); - } - value = ensureIdentifier(value, true); - emitDestructuringAssignment(target, value); - write(", "); - emit(value); - if (root.parent.kind !== 170) { - write(")"); - } - } - } - function emitBindingElement(target, value) { - if (target.initializer) { - value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; - } - else if (!value) { - value = createVoidZero(); - } - if (ts.isBindingPattern(target.name)) { - var pattern = target.name; - var elements = pattern.elements; - var numElements = elements.length; - if (numElements !== 1) { - value = ensureIdentifier(value, numElements !== 0); - } - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (pattern.kind === 159) { - var propName = element.propertyName || element.name; - emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); - } - else if (element.kind !== 185) { - if (!element.dotDotDotToken) { - emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); - } - else if (i === numElements - 1) { - emitBindingElement(element, createSliceCall(value, i)); - } - } - } - } - else { - emitAssignment(target.name, value); - } - } - } - function emitVariableDeclaration(node) { - if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2) { - emitDestructuring(node, false); - } - else { - emit(node.name); - emitOptional(" = ", node.initializer); - } - } - else { - var initializer = node.initializer; - if (!initializer && languageVersion < 2) { - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 16384) && - (getCombinedFlagsForIdentifier(node.name) & 16384); - if (isUninitializedLet && - node.parent.parent.kind !== 198 && - node.parent.parent.kind !== 199) { - initializer = createVoidZero(); - } - } - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(node.name); - write("\", "); - } - emitModuleMemberName(node); - emitOptional(" = ", initializer); - if (exportChanged) { - write(")"); - } - } - } - function emitExportVariableAssignments(node) { - if (node.kind === 185) { - return; - } - var name = node.name; - if (name.kind === 67) { - emitExportMemberAssignments(name); - } - else if (ts.isBindingPattern(name)) { - ts.forEach(name.elements, emitExportVariableAssignments); - } - } - function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 209 && node.parent.kind !== 161)) { - return 0; - } - return ts.getCombinedNodeFlags(node.parent); - } - function isES6ExportedDeclaration(node) { - return !!(node.flags & 1) && - languageVersion >= 2 && - node.parent.kind === 246; - } - function emitVariableStatement(node) { - var startIsEmitted = false; - if (node.flags & 1) { - if (isES6ExportedDeclaration(node)) { - write("export "); - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); - } - } - else { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); - } - if (startIsEmitted) { - emitCommaList(node.declarationList.declarations); - write(";"); - } - else { - var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); - if (atLeastOneItem) { - write(";"); - } - } - if (languageVersion < 2 && node.parent === currentSourceFile) { - ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); - } - } - function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { - if (!(node.flags & 1)) { - return true; - } - if (isES6ExportedDeclaration(node)) { - return true; - } - for (var _a = 0, _b = node.declarationList.declarations; _a < _b.length; _a++) { - var declaration = _b[_a]; - if (declaration.initializer) { - return true; - } - } - return false; - } - function emitParameter(node) { - if (languageVersion < 2) { - if (ts.isBindingPattern(node.name)) { - var name_24 = createTempVariable(0); - if (!tempParameters) { - tempParameters = []; - } - tempParameters.push(name_24); - emit(name_24); - } - else { - emit(node.name); - } - } - else { - if (node.dotDotDotToken) { - write("..."); - } - emit(node.name); - emitOptional(" = ", node.initializer); - } - } - function emitDefaultValueAssignments(node) { - if (languageVersion < 2) { - var tempIndex = 0; - ts.forEach(node.parameters, function (parameter) { - if (parameter.dotDotDotToken) { - return; - } - var paramName = parameter.name, initializer = parameter.initializer; - if (ts.isBindingPattern(paramName)) { - var hasBindingElements = paramName.elements.length > 0; - if (hasBindingElements || initializer) { - writeLine(); - write("var "); - if (hasBindingElements) { - emitDestructuring(parameter, false, tempParameters[tempIndex]); - } - else { - emit(tempParameters[tempIndex]); - write(" = "); - emit(initializer); - } - write(";"); - tempIndex++; - } - } - else if (initializer) { - writeLine(); - emitStart(parameter); - write("if ("); - emitNodeWithoutSourceMap(paramName); - write(" === void 0)"); - emitEnd(parameter); - write(" { "); - emitStart(parameter); - emitNodeWithCommentsAndWithoutSourcemap(paramName); - write(" = "); - emitNodeWithCommentsAndWithoutSourcemap(initializer); - emitEnd(parameter); - write("; }"); - } - }); - } - } - function emitRestParameter(node) { - if (languageVersion < 2 && ts.hasRestParameter(node)) { - var restIndex = node.parameters.length - 1; - var restParam = node.parameters[restIndex]; - if (ts.isBindingPattern(restParam.name)) { - return; - } - var tempName = createTempVariable(268435456).text; - writeLine(); - emitLeadingComments(restParam); - emitStart(restParam); - write("var "); - emitNodeWithCommentsAndWithoutSourcemap(restParam.name); - write(" = [];"); - emitEnd(restParam); - emitTrailingComments(restParam); - writeLine(); - write("for ("); - emitStart(restParam); - write("var " + tempName + " = " + restIndex + ";"); - emitEnd(restParam); - write(" "); - emitStart(restParam); - write(tempName + " < arguments.length;"); - emitEnd(restParam); - write(" "); - emitStart(restParam); - write(tempName + "++"); - emitEnd(restParam); - write(") {"); - increaseIndent(); - writeLine(); - emitStart(restParam); - emitNodeWithCommentsAndWithoutSourcemap(restParam.name); - write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); - emitEnd(restParam); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function emitAccessor(node) { - write(node.kind === 143 ? "get " : "set "); - emit(node.name); - emitSignatureAndBody(node); - } - function shouldEmitAsArrowFunction(node) { - return node.kind === 172 && languageVersion >= 2; - } - function emitDeclarationName(node) { - if (node.name) { - emitNodeWithCommentsAndWithoutSourcemap(node.name); - } - else { - write(getGeneratedNameForNode(node)); - } - } - function shouldEmitFunctionName(node) { - if (node.kind === 171) { - return !!node.name; - } - if (node.kind === 211) { - return !!node.name || languageVersion < 2; - } - } - function emitFunctionDeclaration(node) { - if (ts.nodeIsMissing(node.body)) { - return emitOnlyPinnedOrTripleSlashComments(node); - } - if (node.kind !== 141 && node.kind !== 140 && - node.parent && node.parent.kind !== 243 && - node.parent.kind !== 166) { - emitLeadingComments(node); - } - emitStart(node); - if (!shouldEmitAsArrowFunction(node)) { - if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 1024) { - write("default "); - } - } - write("function"); - if (languageVersion >= 2 && node.asteriskToken) { - write("*"); - } - write(" "); - } - if (shouldEmitFunctionName(node)) { - emitDeclarationName(node); - } - emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 211 && node.parent === currentSourceFile && node.name) { - emitExportMemberAssignments(node.name); - } - emitEnd(node); - if (node.kind !== 141 && node.kind !== 140) { - emitTrailingComments(node); - } - } - function emitCaptureThisForNodeIfNecessary(node) { - if (resolver.getNodeCheckFlags(node) & 4) { - writeLine(); - emitStart(node); - write("var _this = this;"); - emitEnd(node); - } - } - function emitSignatureParameters(node) { - increaseIndent(); - write("("); - if (node) { - var parameters = node.parameters; - var omitCount = languageVersion < 2 && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, false, false); - } - write(")"); - decreaseIndent(); - } - function emitSignatureParametersForArrow(node) { - if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { - emit(node.parameters[0]); - return; - } - emitSignatureParameters(node); - } - function emitAsyncFunctionBodyForES6(node) { - var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 172; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096) !== 0; - var args; - if (!isArrowFunction) { - write(" {"); - increaseIndent(); - writeLine(); - write("return"); - } - write(" __awaiter(this"); - if (hasLexicalArguments) { - write(", arguments"); - } - else { - write(", void 0"); - } - if (promiseConstructor) { - write(", "); - emitNodeWithoutSourceMap(promiseConstructor); - } - else { - write(", Promise"); - } - if (hasLexicalArguments) { - write(", function* (_arguments)"); - } - else { - write(", function* ()"); - } - emitFunctionBody(node); - write(")"); - if (!isArrowFunction) { - write(";"); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function emitFunctionBody(node) { - if (!node.body) { - write(" { }"); - } - else { - if (node.body.kind === 190) { - emitBlockFunctionBody(node, node.body); - } - else { - emitExpressionFunctionBody(node, node.body); - } - } - } - function emitSignatureAndBody(node) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - if (shouldEmitAsArrowFunction(node)) { - emitSignatureParametersForArrow(node); - write(" =>"); - } - else { - emitSignatureParameters(node); - } - var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync && languageVersion === 2) { - emitAsyncFunctionBodyForES6(node); - } - else { - emitFunctionBody(node); - } - if (!isES6ExportedDeclaration(node)) { - emitExportMemberAssignment(node); - } - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - } - function emitFunctionBodyPreamble(node) { - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - } - function emitExpressionFunctionBody(node, body) { - if (languageVersion < 2 || node.flags & 512) { - emitDownLevelExpressionFunctionBody(node, body); - return; - } - write(" "); - var current = body; - while (current.kind === 169) { - current = current.expression; - } - emitParenthesizedIf(body, current.kind === 163); - } - function emitDownLevelExpressionFunctionBody(node, body) { - write(" {"); - scopeEmitStart(node); - increaseIndent(); - var outPos = writer.getTextPos(); - emitDetachedComments(node.body); - emitFunctionBodyPreamble(node); - var preambleEmitted = writer.getTextPos() !== outPos; - decreaseIndent(); - if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { - write(" "); - emitStart(body); - write("return "); - emit(body); - emitEnd(body); - write(";"); - emitTempDeclarations(false); - write(" "); - } - else { - increaseIndent(); - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(body); - write(";"); - emitTrailingComments(node.body); - emitTempDeclarations(true); - decreaseIndent(); - writeLine(); - } - emitStart(node.body); - write("}"); - emitEnd(node.body); - scopeEmitEnd(); - } - function emitBlockFunctionBody(node, body) { - write(" {"); - scopeEmitStart(node); - var initialTextPos = writer.getTextPos(); - increaseIndent(); - emitDetachedComments(body.statements); - var startIndex = emitDirectivePrologues(body.statements, true); - emitFunctionBodyPreamble(node); - decreaseIndent(); - var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { - var statement = _b[_a]; - write(" "); - emit(statement); - } - emitTempDeclarations(false); - write(" "); - emitLeadingCommentsOfPosition(body.statements.end); - } - else { - increaseIndent(); - emitLinesStartingAt(body.statements, startIndex); - emitTempDeclarations(true); - writeLine(); - emitLeadingCommentsOfPosition(body.statements.end); - decreaseIndent(); - } - emitToken(16, body.statements.end); - scopeEmitEnd(); - } - function findInitialSuperCall(ctor) { - if (ctor.body) { - var statement = ctor.body.statements[0]; - if (statement && statement.kind === 193) { - var expr = statement.expression; - if (expr && expr.kind === 166) { - var func = expr.expression; - if (func && func.kind === 93) { - return statement; - } - } - } - } - } - function emitParameterPropertyAssignments(node) { - ts.forEach(node.parameters, function (param) { - if (param.flags & 112) { - writeLine(); - emitStart(param); - emitStart(param.name); - write("this."); - emitNodeWithoutSourceMap(param.name); - emitEnd(param.name); - write(" = "); - emit(param.name); - write(";"); - emitEnd(param); - } - }); - } - function emitMemberAccessForPropertyName(memberName) { - if (memberName.kind === 9 || memberName.kind === 8) { - write("["); - emitNodeWithCommentsAndWithoutSourcemap(memberName); - write("]"); - } - else if (memberName.kind === 134) { - emitComputedPropertyName(memberName); - } - else { - write("."); - emitNodeWithCommentsAndWithoutSourcemap(memberName); - } - } - function getInitializedProperties(node, isStatic) { - var properties = []; - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if (member.kind === 139 && isStatic === ((member.flags & 128) !== 0) && member.initializer) { - properties.push(member); - } - } - return properties; - } - function emitPropertyDeclarations(node, properties) { - for (var _a = 0; _a < properties.length; _a++) { - var property = properties[_a]; - emitPropertyDeclaration(node, property); - } - } - function emitPropertyDeclaration(node, property, receiver, isExpression) { - writeLine(); - emitLeadingComments(property); - emitStart(property); - emitStart(property.name); - if (receiver) { - emit(receiver); - } - else { - if (property.flags & 128) { - emitDeclarationName(node); - } - else { - write("this"); - } - } - emitMemberAccessForPropertyName(property.name); - emitEnd(property.name); - write(" = "); - emit(property.initializer); - if (!isExpression) { - write(";"); - } - emitEnd(property); - emitTrailingComments(property); - } - function emitMemberFunctionsForES5AndLower(node) { - ts.forEach(node.members, function (member) { - if (member.kind === 189) { - writeLine(); - write(";"); - } - else if (member.kind === 141 || node.kind === 140) { - if (!member.body) { - return emitOnlyPinnedOrTripleSlashComments(member); - } - writeLine(); - emitLeadingComments(member); - emitStart(member); - emitStart(member.name); - emitClassMemberPrefix(node, member); - emitMemberAccessForPropertyName(member.name); - emitEnd(member.name); - write(" = "); - emitFunctionDeclaration(member); - emitEnd(member); - write(";"); - emitTrailingComments(member); - } - else if (member.kind === 143 || member.kind === 144) { - var accessors = ts.getAllAccessorDeclarations(node.members, member); - if (member === accessors.firstAccessor) { - writeLine(); - emitStart(member); - write("Object.defineProperty("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write(", {"); - increaseIndent(); - if (accessors.getAccessor) { - writeLine(); - emitLeadingComments(accessors.getAccessor); - write("get: "); - emitStart(accessors.getAccessor); - write("function "); - emitSignatureAndBody(accessors.getAccessor); - emitEnd(accessors.getAccessor); - emitTrailingComments(accessors.getAccessor); - write(","); - } - if (accessors.setAccessor) { - writeLine(); - emitLeadingComments(accessors.setAccessor); - write("set: "); - emitStart(accessors.setAccessor); - write("function "); - emitSignatureAndBody(accessors.setAccessor); - emitEnd(accessors.setAccessor); - emitTrailingComments(accessors.setAccessor); - write(","); - } - writeLine(); - write("enumerable: true,"); - writeLine(); - write("configurable: true"); - decreaseIndent(); - writeLine(); - write("});"); - emitEnd(member); - } - } - }); - } - function emitMemberFunctionsForES6AndHigher(node) { - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if ((member.kind === 141 || node.kind === 140) && !member.body) { - emitOnlyPinnedOrTripleSlashComments(member); - } - else if (member.kind === 141 || - member.kind === 143 || - member.kind === 144) { - writeLine(); - emitLeadingComments(member); - emitStart(member); - if (member.flags & 128) { - write("static "); - } - if (member.kind === 143) { - write("get "); - } - else if (member.kind === 144) { - write("set "); - } - if (member.asteriskToken) { - write("*"); - } - emit(member.name); - emitSignatureAndBody(member); - emitEnd(member); - emitTrailingComments(member); - } - else if (member.kind === 189) { - writeLine(); - write(";"); - } - } - } - function emitConstructor(node, baseTypeElement) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - emitConstructorWorker(node, baseTypeElement); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - } - function emitConstructorWorker(node, baseTypeElement) { - var hasInstancePropertyWithInitializer = false; - ts.forEach(node.members, function (member) { - if (member.kind === 142 && !member.body) { - emitOnlyPinnedOrTripleSlashComments(member); - } - if (member.kind === 139 && member.initializer && (member.flags & 128) === 0) { - hasInstancePropertyWithInitializer = true; - } - }); - var ctor = ts.getFirstConstructorWithBody(node); - if (languageVersion >= 2 && !ctor && !hasInstancePropertyWithInitializer) { - return; - } - if (ctor) { - emitLeadingComments(ctor); - } - emitStart(ctor || node); - if (languageVersion < 2) { - write("function "); - emitDeclarationName(node); - emitSignatureParameters(ctor); - } - else { - write("constructor"); - if (ctor) { - emitSignatureParameters(ctor); - } - else { - if (baseTypeElement) { - write("(...args)"); - } - else { - write("()"); - } - } - } - var startIndex = 0; - write(" {"); - scopeEmitStart(node, "constructor"); - increaseIndent(); - if (ctor) { - startIndex = emitDirectivePrologues(ctor.body.statements, true); - emitDetachedComments(ctor.body.statements); - } - emitCaptureThisForNodeIfNecessary(node); - var superCall; - if (ctor) { - emitDefaultValueAssignments(ctor); - emitRestParameter(ctor); - if (baseTypeElement) { - superCall = findInitialSuperCall(ctor); - if (superCall) { - writeLine(); - emit(superCall); - } - } - emitParameterPropertyAssignments(ctor); - } - else { - if (baseTypeElement) { - writeLine(); - emitStart(baseTypeElement); - if (languageVersion < 2) { - write("_super.apply(this, arguments);"); - } - else { - write("super(...args);"); - } - emitEnd(baseTypeElement); - } - } - emitPropertyDeclarations(node, getInitializedProperties(node, false)); - if (ctor) { - var statements = ctor.body.statements; - if (superCall) { - statements = statements.slice(1); - } - emitLinesStartingAt(statements, startIndex); - } - emitTempDeclarations(true); - writeLine(); - if (ctor) { - emitLeadingCommentsOfPosition(ctor.body.statements.end); - } - decreaseIndent(); - emitToken(16, ctor ? ctor.body.statements.end : node.members.end); - scopeEmitEnd(); - emitEnd(ctor || node); - if (ctor) { - emitTrailingComments(ctor); - } - } - function emitClassExpression(node) { - return emitClassLikeDeclaration(node); - } - function emitClassDeclaration(node) { - return emitClassLikeDeclaration(node); - } - function emitClassLikeDeclaration(node) { - if (languageVersion < 2) { - emitClassLikeDeclarationBelowES6(node); - } - else { - emitClassLikeDeclarationForES6AndHigher(node); - } - } - function emitClassLikeDeclarationForES6AndHigher(node) { - var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 212) { - if (thisNodeIsDecorated) { - if (isES6ExportedDeclaration(node) && !(node.flags & 1024)) { - write("export "); - } - write("let "); - emitDeclarationName(node); - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 1024) { - write("default "); - } - } - } - var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 184; - var tempVariable; - if (isClassExpressionWithStaticProperties) { - tempVariable = createAndRecordTempVariable(0); - write("("); - increaseIndent(); - emit(tempVariable); - write(" = "); - } - write("class"); - if ((node.name || !(node.flags & 1024)) && !thisNodeIsDecorated) { - write(" "); - emitDeclarationName(node); - } - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); - if (baseTypeNode) { - write(" extends "); - emit(baseTypeNode.expression); - } - write(" {"); - increaseIndent(); - scopeEmitStart(node); - writeLine(); - emitConstructor(node, baseTypeNode); - emitMemberFunctionsForES6AndHigher(node); - decreaseIndent(); - writeLine(); - emitToken(16, node.members.end); - scopeEmitEnd(); - if (thisNodeIsDecorated) { - write(";"); - } - if (isClassExpressionWithStaticProperties) { - for (var _a = 0; _a < staticProperties.length; _a++) { - var property = staticProperties[_a]; - write(","); - writeLine(); - emitPropertyDeclaration(node, property, tempVariable, true); - } - write(","); - writeLine(); - emit(tempVariable); - decreaseIndent(); - write(")"); - } - else { - writeLine(); - emitPropertyDeclarations(node, staticProperties); - emitDecoratorsOfClass(node); - } - if (!isES6ExportedDeclaration(node) && (node.flags & 1)) { - writeLine(); - emitStart(node); - emitModuleMemberName(node); - write(" = "); - emitDeclarationName(node); - emitEnd(node); - write(";"); - } - else if (isES6ExportedDeclaration(node) && (node.flags & 1024) && thisNodeIsDecorated) { - writeLine(); - write("export default "); - emitDeclarationName(node); - write(";"); - } - } - function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 212) { - if (!shouldHoistDeclarationInSystemJsModule(node)) { - write("var "); - } - emitDeclarationName(node); - write(" = "); - } - write("(function ("); - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); - if (baseTypeNode) { - write("_super"); - } - write(") {"); - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - var saveComputedPropertyNamesToGeneratedNames = computedPropertyNamesToGeneratedNames; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - computedPropertyNamesToGeneratedNames = undefined; - increaseIndent(); - scopeEmitStart(node); - if (baseTypeNode) { - writeLine(); - emitStart(baseTypeNode); - write("__extends("); - emitDeclarationName(node); - write(", _super);"); - emitEnd(baseTypeNode); - } - writeLine(); - emitConstructor(node, baseTypeNode); - emitMemberFunctionsForES5AndLower(node); - emitPropertyDeclarations(node, getInitializedProperties(node, true)); - writeLine(); - emitDecoratorsOfClass(node); - writeLine(); - emitToken(16, node.members.end, function () { - write("return "); - emitDeclarationName(node); - }); - write(";"); - emitTempDeclarations(true); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; - decreaseIndent(); - writeLine(); - emitToken(16, node.members.end); - scopeEmitEnd(); - emitStart(node); - write(")("); - if (baseTypeNode) { - emit(baseTypeNode.expression); - } - write(")"); - if (node.kind === 212) { - write(";"); - } - emitEnd(node); - if (node.kind === 212) { - emitExportMemberAssignment(node); - } - if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { - emitExportMemberAssignments(node.name); - } - } - function emitClassMemberPrefix(node, member) { - emitDeclarationName(node); - if (!(member.flags & 128)) { - write(".prototype"); - } - } - function emitDecoratorsOfClass(node) { - emitDecoratorsOfMembers(node, 0); - emitDecoratorsOfMembers(node, 128); - emitDecoratorsOfConstructor(node); - } - function emitDecoratorsOfConstructor(node) { - var decorators = node.decorators; - var constructor = ts.getFirstConstructorWithBody(node); - var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); - if (!decorators && !hasDecoratedParameters) { - return; - } - writeLine(); - emitStart(node); - emitDeclarationName(node); - write(" = __decorate(["); - increaseIndent(); - writeLine(); - var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(constructor, argumentsWritten > 0); - emitSerializedTypeMetadata(node, argumentsWritten >= 0); - decreaseIndent(); - writeLine(); - write("], "); - emitDeclarationName(node); - write(");"); - emitEnd(node); - writeLine(); - } - function emitDecoratorsOfMembers(node, staticFlag) { - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if ((member.flags & 128) !== staticFlag) { - continue; - } - if (!ts.nodeCanBeDecorated(member)) { - continue; - } - if (!ts.nodeOrChildIsDecorated(member)) { - continue; - } - var decorators = void 0; - var functionLikeMember = void 0; - if (ts.isAccessor(member)) { - var accessors = ts.getAllAccessorDeclarations(node.members, member); - if (member !== accessors.firstAccessor) { - continue; - } - decorators = accessors.firstAccessor.decorators; - if (!decorators && accessors.secondAccessor) { - decorators = accessors.secondAccessor.decorators; - } - functionLikeMember = accessors.setAccessor; - } - else { - decorators = member.decorators; - if (member.kind === 141) { - functionLikeMember = member; - } - } - writeLine(); - emitStart(member); - if (member.kind !== 139) { - write("Object.defineProperty("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write(","); - increaseIndent(); - writeLine(); - } - write("__decorate(["); - increaseIndent(); - writeLine(); - var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { - emitStart(decorator); - emit(decorator.expression); - emitEnd(decorator); - }); - argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); - emitSerializedTypeMetadata(member, argumentsWritten > 0); - decreaseIndent(); - writeLine(); - write("], "); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - if (member.kind !== 139) { - write(", Object.getOwnPropertyDescriptor("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write("))"); - decreaseIndent(); - } - write(");"); - emitEnd(member); - writeLine(); - } - } - function emitDecoratorsOfParameters(node, leadingComma) { - var argumentsWritten = 0; - if (node) { - var parameterIndex = 0; - for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { - var parameter = _b[_a]; - if (ts.nodeIsDecorated(parameter)) { - var decorators = parameter.decorators; - argumentsWritten += emitList(decorators, 0, decorators.length, true, false, leadingComma, true, function (decorator) { - emitStart(decorator); - write("__param(" + parameterIndex + ", "); - emit(decorator.expression); - write(")"); - emitEnd(decorator); - }); - leadingComma = true; - } - ++parameterIndex; - } - } - return argumentsWritten; - } - function shouldEmitTypeMetadata(node) { - switch (node.kind) { - case 141: - case 143: - case 144: - case 139: - return true; - } - return false; - } - function shouldEmitReturnTypeMetadata(node) { - switch (node.kind) { - case 141: - return true; - } - return false; - } - function shouldEmitParamTypesMetadata(node) { - switch (node.kind) { - case 212: - case 141: - case 144: - return true; - } - return false; - } - function emitSerializedTypeOfNode(node) { - switch (node.kind) { - case 212: - write("Function"); - return; - case 139: - emitSerializedTypeNode(node.type); - return; - case 136: - emitSerializedTypeNode(node.type); - return; - case 143: - emitSerializedTypeNode(node.type); - return; - case 144: - emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - return; - } - if (ts.isFunctionLike(node)) { - write("Function"); - return; - } - write("void 0"); - } - function emitSerializedTypeNode(node) { - if (node) { - switch (node.kind) { - case 101: - write("void 0"); - return; - case 158: - emitSerializedTypeNode(node.type); - return; - case 150: - case 151: - write("Function"); - return; - case 154: - case 155: - write("Array"); - return; - case 148: - case 118: - write("Boolean"); - return; - case 128: - case 9: - write("String"); - return; - case 126: - write("Number"); - return; - case 129: - write("Symbol"); - return; - case 149: - emitSerializedTypeReferenceNode(node); - return; - case 152: - case 153: - case 156: - case 157: - case 115: - break; - default: - ts.Debug.fail("Cannot serialize unexpected type node."); - break; - } - } - write("Object"); - } - function emitSerializedTypeReferenceNode(node) { - var location = node.parent; - while (ts.isDeclaration(location) || ts.isTypeNode(location)) { - location = location.parent; - } - var typeName = ts.cloneEntityName(node.typeName); - typeName.parent = location; - var result = resolver.getTypeReferenceSerializationKind(typeName); - switch (result) { - case ts.TypeReferenceSerializationKind.Unknown: - var temp = createAndRecordTempVariable(0); - write("(typeof ("); - emitNodeWithoutSourceMap(temp); - write(" = "); - emitEntityNameAsExpression(typeName, true); - write(") === 'function' && "); - emitNodeWithoutSourceMap(temp); - write(") || Object"); - break; - case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: - emitEntityNameAsExpression(typeName, false); - break; - case ts.TypeReferenceSerializationKind.VoidType: - write("void 0"); - break; - case ts.TypeReferenceSerializationKind.BooleanType: - write("Boolean"); - break; - case ts.TypeReferenceSerializationKind.NumberLikeType: - write("Number"); - break; - case ts.TypeReferenceSerializationKind.StringLikeType: - write("String"); - break; - case ts.TypeReferenceSerializationKind.ArrayLikeType: - write("Array"); - break; - case ts.TypeReferenceSerializationKind.ESSymbolType: - if (languageVersion < 2) { - write("typeof Symbol === 'function' ? Symbol : Object"); - } - else { - write("Symbol"); - } - break; - case ts.TypeReferenceSerializationKind.TypeWithCallSignature: - write("Function"); - break; - case ts.TypeReferenceSerializationKind.ObjectType: - write("Object"); - break; - } - } - function emitSerializedParameterTypesOfNode(node) { - if (node) { - var valueDeclaration; - if (node.kind === 212) { - valueDeclaration = ts.getFirstConstructorWithBody(node); - } - else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { - valueDeclaration = node; - } - if (valueDeclaration) { - var parameters = valueDeclaration.parameters; - var parameterCount = parameters.length; - if (parameterCount > 0) { - for (var i = 0; i < parameterCount; i++) { - if (i > 0) { - write(", "); - } - if (parameters[i].dotDotDotToken) { - var parameterType = parameters[i].type; - if (parameterType.kind === 154) { - parameterType = parameterType.elementType; - } - else if (parameterType.kind === 149 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { - parameterType = parameterType.typeArguments[0]; - } - else { - parameterType = undefined; - } - emitSerializedTypeNode(parameterType); - } - else { - emitSerializedTypeOfNode(parameters[i]); - } - } - } - } - } - } - function emitSerializedReturnTypeOfNode(node) { - if (node && ts.isFunctionLike(node) && node.type) { - emitSerializedTypeNode(node.type); - return; - } - write("void 0"); - } - function emitSerializedTypeMetadata(node, writeComma) { - var argumentsWritten = 0; - if (compilerOptions.emitDecoratorMetadata) { - if (shouldEmitTypeMetadata(node)) { - if (writeComma) { - write(", "); - } - writeLine(); - write("__metadata('design:type', "); - emitSerializedTypeOfNode(node); - write(")"); - argumentsWritten++; - } - if (shouldEmitParamTypesMetadata(node)) { - if (writeComma || argumentsWritten) { - write(", "); - } - writeLine(); - write("__metadata('design:paramtypes', ["); - emitSerializedParameterTypesOfNode(node); - write("])"); - argumentsWritten++; - } - if (shouldEmitReturnTypeMetadata(node)) { - if (writeComma || argumentsWritten) { - write(", "); - } - writeLine(); - write("__metadata('design:returntype', "); - emitSerializedReturnTypeOfNode(node); - write(")"); - argumentsWritten++; - } - } - return argumentsWritten; - } - function emitInterfaceDeclaration(node) { - emitOnlyPinnedOrTripleSlashComments(node); - } - function shouldEmitEnumDeclaration(node) { - var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules; - } - function emitEnumDeclaration(node) { - if (!shouldEmitEnumDeclaration(node)) { - return; - } - if (!shouldHoistDeclarationInSystemJsModule(node)) { - if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); - } - } - writeLine(); - emitStart(node); - write("(function ("); - emitStart(node.name); - write(getGeneratedNameForNode(node)); - emitEnd(node.name); - write(") {"); - increaseIndent(); - scopeEmitStart(node); - emitLines(node.members); - decreaseIndent(); - writeLine(); - emitToken(16, node.members.end); - scopeEmitEnd(); - write(")("); - emitModuleMemberName(node); - write(" || ("); - emitModuleMemberName(node); - write(" = {}));"); - emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { - writeLine(); - emitStart(node); - write("var "); - emit(node.name); - write(" = "); - emitModuleMemberName(node); - emitEnd(node); - write(";"); - } - if (languageVersion < 2 && node.parent === currentSourceFile) { - if (compilerOptions.module === 4 && (node.flags & 1)) { - writeLine(); - write(exportFunctionForFile + "(\""); - emitDeclarationName(node); - write("\", "); - emitDeclarationName(node); - write(");"); - } - emitExportMemberAssignments(node.name); - } - } - function emitEnumMember(node) { - var enumParent = node.parent; - emitStart(node); - write(getGeneratedNameForNode(enumParent)); - write("["); - write(getGeneratedNameForNode(enumParent)); - write("["); - emitExpressionForPropertyName(node.name); - write("] = "); - writeEnumMemberDeclarationValue(node); - write("] = "); - emitExpressionForPropertyName(node.name); - emitEnd(node); - write(";"); - } - function writeEnumMemberDeclarationValue(member) { - var value = resolver.getConstantValue(member); - if (value !== undefined) { - write(value.toString()); - return; - } - else if (member.initializer) { - emit(member.initializer); - } - else { - write("undefined"); - } - } - function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 216) { - var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); - return recursiveInnerModule || moduleDeclaration.body; - } - } - function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); - } - function isModuleMergedWithES6Class(node) { - return languageVersion === 2 && !!(resolver.getNodeCheckFlags(node) & 32768); - } - function emitModuleDeclaration(node) { - var shouldEmit = shouldEmitModuleDeclaration(node); - if (!shouldEmit) { - return emitOnlyPinnedOrTripleSlashComments(node); - } - var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); - var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); - if (emitVarForModule) { - emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - } - write("var "); - emit(node.name); - write(";"); - emitEnd(node); - writeLine(); - } - emitStart(node); - write("(function ("); - emitStart(node.name); - write(getGeneratedNameForNode(node)); - emitEnd(node.name); - write(") "); - if (node.body.kind === 217) { - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - tempFlags = 0; - tempVariables = undefined; - emit(node.body); - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - } - else { - write("{"); - increaseIndent(); - scopeEmitStart(node); - emitCaptureThisForNodeIfNecessary(node); - writeLine(); - emit(node.body); - decreaseIndent(); - writeLine(); - var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(16, moduleBlock.statements.end); - scopeEmitEnd(); - } - write(")("); - if ((node.flags & 1) && !isES6ExportedDeclaration(node)) { - emit(node.name); - write(" = "); - } - emitModuleMemberName(node); - write(" || ("); - emitModuleMemberName(node); - write(" = {}));"); - emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.name.kind === 67 && node.parent === currentSourceFile) { - if (compilerOptions.module === 4 && (node.flags & 1)) { - writeLine(); - write(exportFunctionForFile + "(\""); - emitDeclarationName(node); - write("\", "); - emitDeclarationName(node); - write(");"); - } - emitExportMemberAssignments(node.name); - } - } - function tryRenameExternalModule(moduleName) { - if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { - return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; - } - return undefined; - } - function emitRequire(moduleName) { - if (moduleName.kind === 9) { - write("require("); - var text = tryRenameExternalModule(moduleName); - if (text) { - write(text); - } - else { - emitStart(moduleName); - emitLiteral(moduleName); - emitEnd(moduleName); - } - emitToken(18, moduleName.end); - } - else { - write("require()"); - } - } - function getNamespaceDeclarationNode(node) { - if (node.kind === 219) { - return node; - } - var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 222) { - return importClause.namedBindings; - } - } - function isDefaultImport(node) { - return node.kind === 220 && node.importClause && !!node.importClause.name; - } - function emitExportImportAssignments(node) { - if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { - emitExportMemberAssignments(node.name); - } - ts.forEachChild(node, emitExportImportAssignments); - } - function emitImportDeclaration(node) { - if (languageVersion < 2) { - return emitExternalImportDeclaration(node); - } - if (node.importClause) { - var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); - var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, true); - if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { - write("import "); - emitStart(node.importClause); - if (shouldEmitDefaultBindings) { - emit(node.importClause.name); - if (shouldEmitNamedBindings) { - write(", "); - } - } - if (shouldEmitNamedBindings) { - emitLeadingComments(node.importClause.namedBindings); - emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 222) { - write("* as "); - emit(node.importClause.namedBindings.name); - } - else { - write("{ "); - emitExportOrImportSpecifierList(node.importClause.namedBindings.elements, resolver.isReferencedAliasDeclaration); - write(" }"); - } - emitEnd(node.importClause.namedBindings); - emitTrailingComments(node.importClause.namedBindings); - } - emitEnd(node.importClause); - write(" from "); - emit(node.moduleSpecifier); - write(";"); - } - } - else { - write("import "); - emit(node.moduleSpecifier); - write(";"); - } - } - function emitExternalImportDeclaration(node) { - if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 219 && (node.flags & 1) !== 0; - var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (compilerOptions.module !== 2) { - emitLeadingComments(node); - emitStart(node); - if (namespaceDeclaration && !isDefaultImport(node)) { - if (!isExportedImport) - write("var "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - } - else { - var isNakedImport = 220 && !node.importClause; - if (!isNakedImport) { - write("var "); - write(getGeneratedNameForNode(node)); - write(" = "); - } - } - emitRequire(ts.getExternalModuleName(node)); - if (namespaceDeclaration && isDefaultImport(node)) { - write(", "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - write(getGeneratedNameForNode(node)); - } - write(";"); - emitEnd(node); - emitExportImportAssignments(node); - emitTrailingComments(node); - } - else { - if (isExportedImport) { - emitModuleMemberName(namespaceDeclaration); - write(" = "); - emit(namespaceDeclaration.name); - write(";"); - } - else if (namespaceDeclaration && isDefaultImport(node)) { - write("var "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - write(getGeneratedNameForNode(node)); - write(";"); - } - emitExportImportAssignments(node); - } - } - } - function emitImportEqualsDeclaration(node) { - if (ts.isExternalModuleImportEqualsDeclaration(node)) { - emitExternalImportDeclaration(node); - return; - } - if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { - emitLeadingComments(node); - emitStart(node); - var variableDeclarationIsHoisted = shouldHoistVariable(node, true); - var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, true); - if (!variableDeclarationIsHoisted) { - ts.Debug.assert(!isExported); - if (isES6ExportedDeclaration(node)) { - write("export "); - write("var "); - } - else if (!(node.flags & 1)) { - write("var "); - } - } - if (isExported) { - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.name); - write("\", "); - } - emitModuleMemberName(node); - write(" = "); - emit(node.moduleReference); - if (isExported) { - write(")"); - } - write(";"); - emitEnd(node); - emitExportImportAssignments(node); - emitTrailingComments(node); - } - } - function emitExportDeclaration(node) { - ts.Debug.assert(compilerOptions.module !== 4); - if (languageVersion < 2) { - if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { - emitStart(node); - var generatedName = getGeneratedNameForNode(node); - if (node.exportClause) { - if (compilerOptions.module !== 2) { - write("var "); - write(generatedName); - write(" = "); - emitRequire(ts.getExternalModuleName(node)); - write(";"); - } - for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { - var specifier = _b[_a]; - if (resolver.isValueAliasDeclaration(specifier)) { - writeLine(); - emitStart(specifier); - emitContainingModuleName(specifier); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - write(" = "); - write(generatedName); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); - write(";"); - emitEnd(specifier); - } - } - } - else { - writeLine(); - write("__export("); - if (compilerOptions.module !== 2) { - emitRequire(ts.getExternalModuleName(node)); - } - else { - write(generatedName); - } - write(");"); - } - emitEnd(node); - } - } - else { - if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { - write("export "); - if (node.exportClause) { - write("{ "); - emitExportOrImportSpecifierList(node.exportClause.elements, resolver.isValueAliasDeclaration); - write(" }"); - } - else { - write("*"); - } - if (node.moduleSpecifier) { - write(" from "); - emit(node.moduleSpecifier); - } - write(";"); - } - } - } - function emitExportOrImportSpecifierList(specifiers, shouldEmit) { - ts.Debug.assert(languageVersion >= 2); - var needsComma = false; - for (var _a = 0; _a < specifiers.length; _a++) { - var specifier = specifiers[_a]; - if (shouldEmit(specifier)) { - if (needsComma) { - write(", "); - } - if (specifier.propertyName) { - emit(specifier.propertyName); - write(" as "); - } - emit(specifier.name); - needsComma = true; - } - } - } - function emitExportAssignment(node) { - if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { - if (languageVersion >= 2) { - writeLine(); - emitStart(node); - write("export default "); - var expression = node.expression; - emit(expression); - if (expression.kind !== 211 && - expression.kind !== 212) { - write(";"); - } - emitEnd(node); - } - else { - writeLine(); - emitStart(node); - if (compilerOptions.module === 4) { - write(exportFunctionForFile + "(\"default\","); - emit(node.expression); - write(")"); - } - else { - emitEs6ExportDefaultCompat(node); - emitContainingModuleName(node); - if (languageVersion === 0) { - write("[\"default\"] = "); - } - else { - write(".default = "); - } - emit(node.expression); - } - write(";"); - emitEnd(node); - } - } - } - function collectExternalModuleInfo(sourceFile) { - externalImports = []; - exportSpecifiers = {}; - exportEquals = undefined; - hasExportStars = false; - for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { - var node = _b[_a]; - switch (node.kind) { - case 220: - if (!node.importClause || - resolver.isReferencedAliasDeclaration(node.importClause, true)) { - externalImports.push(node); - } - break; - case 219: - if (node.moduleReference.kind === 230 && resolver.isReferencedAliasDeclaration(node)) { - externalImports.push(node); - } - break; - case 226: - if (node.moduleSpecifier) { - if (!node.exportClause) { - externalImports.push(node); - hasExportStars = true; - } - else if (resolver.isValueAliasDeclaration(node)) { - externalImports.push(node); - } - } - else { - for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { - var specifier = _d[_c]; - var name_25 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_25] || (exportSpecifiers[name_25] = [])).push(specifier); - } - } - break; - case 225: - if (node.isExportEquals && !exportEquals) { - exportEquals = node; - } - break; - } - } - } - function emitExportStarHelper() { - if (hasExportStars) { - writeLine(); - write("function __export(m) {"); - increaseIndent(); - writeLine(); - write("for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];"); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function getLocalNameForExternalImport(node) { - var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (namespaceDeclaration && !isDefaultImport(node)) { - return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); - } - if (node.kind === 220 && node.importClause) { - return getGeneratedNameForNode(node); - } - if (node.kind === 226 && node.moduleSpecifier) { - return getGeneratedNameForNode(node); - } - } - function getExternalModuleNameText(importNode) { - var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 9) { - return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); - } - return undefined; - } - function emitVariableDeclarationsForImports() { - if (externalImports.length === 0) { - return; - } - writeLine(); - var started = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var importNode = externalImports[_a]; - var skipNode = importNode.kind === 226 || - (importNode.kind === 220 && !importNode.importClause); - if (skipNode) { - continue; - } - if (!started) { - write("var "); - started = true; - } - else { - write(", "); - } - write(getLocalNameForExternalImport(importNode)); - } - if (started) { - write(";"); - } - } - function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { - if (!hasExportStars) { - return undefined; - } - if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { - var hasExportDeclarationWithExportClause = false; - for (var _a = 0; _a < externalImports.length; _a++) { - var externalImport = externalImports[_a]; - if (externalImport.kind === 226 && externalImport.exportClause) { - hasExportDeclarationWithExportClause = true; - break; - } - } - if (!hasExportDeclarationWithExportClause) { - return emitExportStarFunction(undefined); - } - } - var exportedNamesStorageRef = makeUniqueName("exportedNames"); - writeLine(); - write("var " + exportedNamesStorageRef + " = {"); - increaseIndent(); - var started = false; - if (exportedDeclarations) { - for (var i = 0; i < exportedDeclarations.length; ++i) { - writeExportedName(exportedDeclarations[i]); - } - } - if (exportSpecifiers) { - for (var n in exportSpecifiers) { - for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { - var specifier = _c[_b]; - writeExportedName(specifier.name); - } - } - } - for (var _d = 0; _d < externalImports.length; _d++) { - var externalImport = externalImports[_d]; - if (externalImport.kind !== 226) { - continue; - } - var exportDecl = externalImport; - if (!exportDecl.exportClause) { - continue; - } - for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { - var element = _f[_e]; - writeExportedName(element.name || element.propertyName); - } - } - decreaseIndent(); - writeLine(); - write("};"); - return emitExportStarFunction(exportedNamesStorageRef); - function emitExportStarFunction(localNames) { - var exportStarFunction = makeUniqueName("exportStar"); - writeLine(); - write("function " + exportStarFunction + "(m) {"); - increaseIndent(); - writeLine(); - write("var exports = {};"); - writeLine(); - write("for(var n in m) {"); - increaseIndent(); - writeLine(); - write("if (n !== \"default\""); - if (localNames) { - write("&& !" + localNames + ".hasOwnProperty(n)"); - } - write(") exports[n] = m[n];"); - decreaseIndent(); - writeLine(); - write("}"); - writeLine(); - write(exportFunctionForFile + "(exports);"); - decreaseIndent(); - writeLine(); - write("}"); - return exportStarFunction; - } - function writeExportedName(node) { - if (node.kind !== 67 && node.flags & 1024) { - return; - } - if (started) { - write(","); - } - else { - started = true; - } - writeLine(); - write("'"); - if (node.kind === 67) { - emitNodeWithCommentsAndWithoutSourcemap(node); - } - else { - emitDeclarationName(node); - } - write("': true"); - } - } - function processTopLevelVariableAndFunctionDeclarations(node) { - var hoistedVars; - var hoistedFunctionDeclarations; - var exportedDeclarations; - visit(node); - if (hoistedVars) { - writeLine(); - write("var "); - var seen = {}; - for (var i = 0; i < hoistedVars.length; ++i) { - var local = hoistedVars[i]; - var name_26 = local.kind === 67 - ? local - : local.name; - if (name_26) { - var text = ts.unescapeIdentifier(name_26.text); - if (ts.hasProperty(seen, text)) { - continue; - } - else { - seen[text] = text; - } - } - if (i !== 0) { - write(", "); - } - if (local.kind === 212 || local.kind === 216 || local.kind === 215) { - emitDeclarationName(local); - } - else { - emit(local); - } - var flags = ts.getCombinedNodeFlags(local.kind === 67 ? local.parent : local); - if (flags & 1) { - if (!exportedDeclarations) { - exportedDeclarations = []; - } - exportedDeclarations.push(local); - } - } - write(";"); - } - if (hoistedFunctionDeclarations) { - for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { - var f = hoistedFunctionDeclarations[_a]; - writeLine(); - emit(f); - if (f.flags & 1) { - if (!exportedDeclarations) { - exportedDeclarations = []; - } - exportedDeclarations.push(f); - } - } - } - return exportedDeclarations; - function visit(node) { - if (node.flags & 2) { - return; - } - if (node.kind === 211) { - if (!hoistedFunctionDeclarations) { - hoistedFunctionDeclarations = []; - } - hoistedFunctionDeclarations.push(node); - return; - } - if (node.kind === 212) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - return; - } - if (node.kind === 215) { - if (shouldEmitEnumDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - } - return; - } - if (node.kind === 216) { - if (shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - } - return; - } - if (node.kind === 209 || node.kind === 161) { - if (shouldHoistVariable(node, false)) { - var name_27 = node.name; - if (name_27.kind === 67) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(name_27); - } - else { - ts.forEachChild(name_27, visit); - } - } - return; - } - if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node.name); - return; - } - if (ts.isBindingPattern(node)) { - ts.forEach(node.elements, visit); - return; - } - if (!ts.isDeclaration(node)) { - ts.forEachChild(node, visit); - } - } - } - function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { - if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { - return false; - } - return (ts.getCombinedNodeFlags(node) & 49152) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 246; - } - function isCurrentFileSystemExternalModule() { - return compilerOptions.module === 4 && ts.isExternalModule(currentSourceFile); - } - function emitSystemModuleBody(node, dependencyGroups, startIndex) { - emitVariableDeclarationsForImports(); - writeLine(); - var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); - var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); - writeLine(); - write("return {"); - increaseIndent(); - writeLine(); - emitSetters(exportStarFunction, dependencyGroups); - writeLine(); - emitExecute(node, startIndex); - decreaseIndent(); - writeLine(); - write("}"); - emitTempDeclarations(true); - } - function emitSetters(exportStarFunction, dependencyGroups) { - write("setters:["); - for (var i = 0; i < dependencyGroups.length; ++i) { - if (i !== 0) { - write(","); - } - writeLine(); - increaseIndent(); - var group = dependencyGroups[i]; - var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); - write("function (" + parameterName + ") {"); - increaseIndent(); - for (var _a = 0; _a < group.length; _a++) { - var entry = group[_a]; - var importVariableName = getLocalNameForExternalImport(entry) || ""; - switch (entry.kind) { - case 220: - if (!entry.importClause) { - break; - } - case 219: - ts.Debug.assert(importVariableName !== ""); - writeLine(); - write(importVariableName + " = " + parameterName + ";"); - writeLine(); - break; - case 226: - ts.Debug.assert(importVariableName !== ""); - if (entry.exportClause) { - writeLine(); - write(exportFunctionForFile + "({"); - writeLine(); - increaseIndent(); - for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { - if (i_2 !== 0) { - write(","); - writeLine(); - } - var e = entry.exportClause.elements[i_2]; - write("\""); - emitNodeWithCommentsAndWithoutSourcemap(e.name); - write("\": " + parameterName + "[\""); - emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); - write("\"]"); - } - decreaseIndent(); - writeLine(); - write("});"); - } - else { - writeLine(); - write(exportStarFunction + "(" + parameterName + ");"); - } - writeLine(); - break; - } - } - decreaseIndent(); - write("}"); - decreaseIndent(); - } - write("],"); - } - function emitExecute(node, startIndex) { - write("execute: function() {"); - increaseIndent(); - writeLine(); - for (var i = startIndex; i < node.statements.length; ++i) { - var statement = node.statements[i]; - switch (statement.kind) { - case 211: - case 220: - continue; - case 226: - if (!statement.moduleSpecifier) { - for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { - var element = _b[_a]; - emitExportSpecifierInSystemModule(element); - } - } - continue; - case 219: - if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { - continue; - } - default: - writeLine(); - emit(statement); - } - } - decreaseIndent(); - writeLine(); - write("}"); - } - function emitSystemModule(node, startIndex) { - collectExternalModuleInfo(node); - ts.Debug.assert(!exportFunctionForFile); - exportFunctionForFile = makeUniqueName("exports"); - writeLine(); - write("System.register("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - write("["); - var groupIndices = {}; - var dependencyGroups = []; - for (var i = 0; i < externalImports.length; ++i) { - var text = getExternalModuleNameText(externalImports[i]); - if (ts.hasProperty(groupIndices, text)) { - var groupIndex = groupIndices[text]; - dependencyGroups[groupIndex].push(externalImports[i]); - continue; - } - else { - groupIndices[text] = dependencyGroups.length; - dependencyGroups.push([externalImports[i]]); - } - if (i !== 0) { - write(", "); - } - write(text); - } - write("], function(" + exportFunctionForFile + ") {"); - writeLine(); - increaseIndent(); - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitSystemModuleBody(node, dependencyGroups, startIndex); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitAMDDependencies(node, includeNonAmdDependencies) { - // An AMD define function has the following shape: - // define(id?, dependencies?, factory); - // - // This has the shape of - // define(name, ["module1", "module2"], function (module1Alias) { - // The location of the alias in the parameter list in the factory function needs to - // match the position of the module name in the dependency list. - // - // To ensure this is true in cases of modules with no aliases, e.g.: - // `import "module"` or `` - // we need to add modules without alias names to the end of the dependencies list - var aliasedModuleNames = []; - var unaliasedModuleNames = []; - var importAliasNames = []; - for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { - var amdDependency = _b[_a]; - if (amdDependency.name) { - aliasedModuleNames.push("\"" + amdDependency.path + "\""); - importAliasNames.push(amdDependency.name); - } - else { - unaliasedModuleNames.push("\"" + amdDependency.path + "\""); - } - } - for (var _c = 0; _c < externalImports.length; _c++) { - var importNode = externalImports[_c]; - var externalModuleName = getExternalModuleNameText(importNode); - var importAliasName = getLocalNameForExternalImport(importNode); - if (includeNonAmdDependencies && importAliasName) { - aliasedModuleNames.push(externalModuleName); - importAliasNames.push(importAliasName); - } - else { - unaliasedModuleNames.push(externalModuleName); - } - } - write("[\"require\", \"exports\""); - if (aliasedModuleNames.length) { - write(", "); - write(aliasedModuleNames.join(", ")); - } - if (unaliasedModuleNames.length) { - write(", "); - write(unaliasedModuleNames.join(", ")); - } - write("], function (require, exports"); - if (importAliasNames.length) { - write(", "); - write(importAliasNames.join(", ")); - } - } - function emitAMDModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - writeLine(); - write("define("); - if (node.moduleName) { - write("\"" + node.moduleName + "\", "); - } - emitAMDDependencies(node, true); - write(") {"); - increaseIndent(); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(true); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitCommonJSModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(false); - } - function emitUMDModule(node, startIndex) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - writeLines("(function (deps, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(deps, factory);\n }\n})("); - emitAMDDependencies(node, false); - write(") {"); - increaseIndent(); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(true); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitES6Module(node, startIndex) { - externalImports = undefined; - exportSpecifiers = undefined; - exportEquals = undefined; - hasExportStars = false; - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - } - function emitExportEquals(emitAsReturn) { - if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) { - writeLine(); - emitStart(exportEquals); - write(emitAsReturn ? "return " : "module.exports = "); - emit(exportEquals.expression); - write(";"); - emitEnd(exportEquals); - } - } - function emitJsxElement(node) { - switch (compilerOptions.jsx) { - case 2: - jsxEmitReact(node); - break; - case 1: - default: - jsxEmitPreserve(node); - break; - } - } - function trimReactWhitespaceAndApplyEntities(node) { - var result = undefined; - var text = ts.getTextOfNode(node, true); - var firstNonWhitespace = 0; - var lastNonWhitespace = -1; - for (var i = 0; i < text.length; i++) { - var c = text.charCodeAt(i); - if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - result = (result ? result + "\" + ' ' + \"" : "") + part; - } - firstNonWhitespace = -1; - } - else if (!ts.isWhiteSpace(c)) { - lastNonWhitespace = i; - if (firstNonWhitespace === -1) { - firstNonWhitespace = i; - } - } - } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - result = (result ? result + "\" + ' ' + \"" : "") + part; - } - if (result) { - result = result.replace(/&(\w+);/g, function (s, m) { - if (entities[m] !== undefined) { - return String.fromCharCode(entities[m]); - } - else { - return s; - } - }); - } - return result; - } - function getTextToEmit(node) { - switch (compilerOptions.jsx) { - case 2: - var text = trimReactWhitespaceAndApplyEntities(node); - if (text === undefined || text.length === 0) { - return undefined; - } - else { - return text; - } - case 1: - default: - return ts.getTextOfNode(node, true); - } - } - function emitJsxText(node) { - switch (compilerOptions.jsx) { - case 2: - write("\""); - write(trimReactWhitespaceAndApplyEntities(node)); - write("\""); - break; - case 1: - default: - writer.writeLiteral(ts.getTextOfNode(node, true)); - break; - } - } - function emitJsxExpression(node) { - if (node.expression) { - switch (compilerOptions.jsx) { - case 1: - default: - write("{"); - emit(node.expression); - write("}"); - break; - case 2: - emit(node.expression); - break; - } - } - } - function emitDirectivePrologues(statements, startWithNewLine) { - for (var i = 0; i < statements.length; ++i) { - if (ts.isPrologueDirective(statements[i])) { - if (startWithNewLine || i > 0) { - writeLine(); - } - emit(statements[i]); - } - else { - return i; - } - } - return statements.length; - } - function writeLines(text) { - var lines = text.split(/\r\n|\r|\n/g); - for (var i = 0; i < lines.length; ++i) { - var line = lines[i]; - if (line.length) { - writeLine(); - write(line); - } - } - } - function emitEmitHelpers(node) { - if (!compilerOptions.noEmitHelpers) { - if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { - writeLines(extendsHelper); - extendsEmitted = true; - } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); - } - decorateEmitted = true; - } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32) { - writeLines(paramHelper); - paramEmitted = true; - } - if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64) { - writeLines(awaiterHelper); - awaiterEmitted = true; - } - } - } - function emitSourceFileNode(node) { - writeLine(); - emitShebang(); - emitDetachedComments(node); - var startIndex = emitDirectivePrologues(node.statements, false); - if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - if (languageVersion >= 2) { - emitES6Module(node, startIndex); - } - else if (compilerOptions.module === 2) { - emitAMDModule(node, startIndex); - } - else if (compilerOptions.module === 4) { - emitSystemModule(node, startIndex); - } - else if (compilerOptions.module === 3) { - emitUMDModule(node, startIndex); - } - else { - emitCommonJSModule(node, startIndex); - } - } - else { - externalImports = undefined; - exportSpecifiers = undefined; - exportEquals = undefined; - hasExportStars = false; - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - } - emitLeadingComments(node.endOfFileToken); - } - function emitNodeWithCommentsAndWithoutSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); - } - function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { - if (node) { - if (node.flags & 2) { - return emitOnlyPinnedOrTripleSlashComments(node); - } - if (isSpecializedCommentHandling(node)) { - return emitNodeWithoutSourceMap(node); - } - var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); - if (emitComments_1) { - emitLeadingComments(node); - } - emitNodeConsideringSourcemap(node); - if (emitComments_1) { - emitTrailingComments(node); - } - } - } - function emitNodeWithoutSourceMap(node) { - if (node) { - emitJavaScriptWorker(node); - } - } - function isSpecializedCommentHandling(node) { - switch (node.kind) { - case 213: - case 211: - case 220: - case 219: - case 214: - case 225: - return true; - } - } - function shouldEmitLeadingAndTrailingComments(node) { - switch (node.kind) { - case 191: - return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 216: - return shouldEmitModuleDeclaration(node); - case 215: - return shouldEmitEnumDeclaration(node); - } - ts.Debug.assert(!isSpecializedCommentHandling(node)); - if (node.kind !== 190 && - node.parent && - node.parent.kind === 172 && - node.parent.body === node && - compilerOptions.target <= 1) { - return false; - } - return true; - } - function emitJavaScriptWorker(node) { - switch (node.kind) { - case 67: - return emitIdentifier(node); - case 136: - return emitParameter(node); - case 141: - case 140: - return emitMethod(node); - case 143: - case 144: - return emitAccessor(node); - case 95: - return emitThis(node); - case 93: - return emitSuper(node); - case 91: - return write("null"); - case 97: - return write("true"); - case 82: - return write("false"); - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - return emitLiteral(node); - case 181: - return emitTemplateExpression(node); - case 188: - return emitTemplateSpan(node); - case 231: - case 232: - return emitJsxElement(node); - case 234: - return emitJsxText(node); - case 238: - return emitJsxExpression(node); - case 133: - return emitQualifiedName(node); - case 159: - return emitObjectBindingPattern(node); - case 160: - return emitArrayBindingPattern(node); - case 161: - return emitBindingElement(node); - case 162: - return emitArrayLiteral(node); - case 163: - return emitObjectLiteral(node); - case 243: - return emitPropertyAssignment(node); - case 244: - return emitShorthandPropertyAssignment(node); - case 134: - return emitComputedPropertyName(node); - case 164: - return emitPropertyAccess(node); - case 165: - return emitIndexedAccess(node); - case 166: - return emitCallExpression(node); - case 167: - return emitNewExpression(node); - case 168: - return emitTaggedTemplateExpression(node); - case 169: - return emit(node.expression); - case 187: - return emit(node.expression); - case 170: - return emitParenExpression(node); - case 211: - case 171: - case 172: - return emitFunctionDeclaration(node); - case 173: - return emitDeleteExpression(node); - case 174: - return emitTypeOfExpression(node); - case 175: - return emitVoidExpression(node); - case 176: - return emitAwaitExpression(node); - case 177: - return emitPrefixUnaryExpression(node); - case 178: - return emitPostfixUnaryExpression(node); - case 179: - return emitBinaryExpression(node); - case 180: - return emitConditionalExpression(node); - case 183: - return emitSpreadElementExpression(node); - case 182: - return emitYieldExpression(node); - case 185: - return; - case 190: - case 217: - return emitBlock(node); - case 191: - return emitVariableStatement(node); - case 192: - return write(";"); - case 193: - return emitExpressionStatement(node); - case 194: - return emitIfStatement(node); - case 195: - return emitDoStatement(node); - case 196: - return emitWhileStatement(node); - case 197: - return emitForStatement(node); - case 199: - case 198: - return emitForInOrForOfStatement(node); - case 200: - case 201: - return emitBreakOrContinueStatement(node); - case 202: - return emitReturnStatement(node); - case 203: - return emitWithStatement(node); - case 204: - return emitSwitchStatement(node); - case 239: - case 240: - return emitCaseOrDefaultClause(node); - case 205: - return emitLabelledStatement(node); - case 206: - return emitThrowStatement(node); - case 207: - return emitTryStatement(node); - case 242: - return emitCatchClause(node); - case 208: - return emitDebuggerStatement(node); - case 209: - return emitVariableDeclaration(node); - case 184: - return emitClassExpression(node); - case 212: - return emitClassDeclaration(node); - case 213: - return emitInterfaceDeclaration(node); - case 215: - return emitEnumDeclaration(node); - case 245: - return emitEnumMember(node); - case 216: - return emitModuleDeclaration(node); - case 220: - return emitImportDeclaration(node); - case 219: - return emitImportEqualsDeclaration(node); - case 226: - return emitExportDeclaration(node); - case 225: - return emitExportAssignment(node); - case 246: - return emitSourceFileNode(node); - } - } - function hasDetachedComments(pos) { - return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; - } - function getLeadingCommentsWithoutDetachedComments() { - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); - if (detachedCommentsInfo.length - 1) { - detachedCommentsInfo.pop(); - } - else { - detachedCommentsInfo = undefined; - } - return leadingComments; - } - function filterComments(ranges, onlyPinnedOrTripleSlashComments) { - if (ranges && onlyPinnedOrTripleSlashComments) { - ranges = ts.filter(ranges, isPinnedOrTripleSlashComment); - if (ranges.length === 0) { - return undefined; - } - } - return ranges; - } - function getLeadingCommentsToEmit(node) { - if (node.parent) { - if (node.parent.kind === 246 || node.pos !== node.parent.pos) { - if (hasDetachedComments(node.pos)) { - return getLeadingCommentsWithoutDetachedComments(); - } - else { - return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); - } - } - } - } - function getTrailingCommentsToEmit(node) { - if (node.parent) { - if (node.parent.kind === 246 || node.end !== node.parent.end) { - return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); - } - } - } - function emitOnlyPinnedOrTripleSlashComments(node) { - emitLeadingCommentsWorker(node, true); - } - function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, compilerOptions.removeComments); - } - function emitLeadingCommentsWorker(node, onlyPinnedOrTripleSlashComments) { - var leadingComments = filterComments(getLeadingCommentsToEmit(node), onlyPinnedOrTripleSlashComments); - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); - } - function emitTrailingComments(node) { - var trailingComments = filterComments(getTrailingCommentsToEmit(node), compilerOptions.removeComments); - ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); - } - function emitTrailingCommentsOfPosition(pos) { - var trailingComments = filterComments(ts.getTrailingCommentRanges(currentSourceFile.text, pos), compilerOptions.removeComments); - ts.emitComments(currentSourceFile, writer, trailingComments, true, newLine, writeComment); - } - function emitLeadingCommentsOfPosition(pos) { - var leadingComments; - if (hasDetachedComments(pos)) { - leadingComments = getLeadingCommentsWithoutDetachedComments(); - } - else { - leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); - } - leadingComments = filterComments(leadingComments, compilerOptions.removeComments); - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); - } - function emitDetachedComments(node) { - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); - if (leadingComments) { - var detachedComments = []; - var lastComment; - ts.forEach(leadingComments, function (comment) { - if (lastComment) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); - if (commentLine >= lastCommentLine + 2) { - return detachedComments; - } - } - detachedComments.push(comment); - lastComment = comment; - }); - if (detachedComments.length) { - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); - var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); - if (nodeLine >= lastCommentLine + 2) { - ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; - if (detachedCommentsInfo) { - detachedCommentsInfo.push(currentDetachedCommentInfo); - } - else { - detachedCommentsInfo = [currentDetachedCommentInfo]; - } - } - } - } - } - function emitShebang() { - var shebang = ts.getShebang(currentSourceFile.text); - if (shebang) { - write(shebang); - } - } - function isPinnedOrTripleSlashComment(comment) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { - return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; - } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && - currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { - return true; - } - } - } - function emitFile(jsFilePath, sourceFile) { - emitJavaScript(jsFilePath, sourceFile); - if (compilerOptions.declaration) { - ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); - } - } - } - ts.emitFiles = emitFiles; var entities = { "quot": 0x0022, "amp": 0x0026, @@ -29805,10 +24786,5549 @@ var ts; "hearts": 0x2665, "diams": 0x2666 }; + function emitFiles(resolver, host, targetSourceFile) { + var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; + var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; + var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; + var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; + var awaiterHelper = "\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {\n return new Promise(function (resolve, reject) {\n generator = generator.call(thisArg, _arguments);\n function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }\n function onfulfill(value) { try { step(\"next\", value); } catch (e) { reject(e); } }\n function onreject(value) { try { step(\"throw\", value); } catch (e) { reject(e); } }\n function step(verb, value) {\n var result = generator[verb](value);\n result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);\n }\n step(\"next\", void 0);\n });\n};"; + var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0; + var modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === 2 ? 5 : 0; + var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; + var diagnostics = []; + var newLine = host.getNewLine(); + var jsxDesugaring = host.getCompilerOptions().jsx !== 1; + var shouldEmitJsx = function (s) { return (s.languageVariant === 1 && !jsxDesugaring); }; + if (targetSourceFile === undefined) { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (ts.shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, shouldEmitJsx(sourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, sourceFile); + } + }); + if (compilerOptions.outFile || compilerOptions.out) { + emitFile(compilerOptions.outFile || compilerOptions.out); + } + } + else { + if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { + var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); + emitFile(jsFilePath, targetSourceFile); + } + else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { + emitFile(compilerOptions.outFile || compilerOptions.out); + } + } + diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); + return { + emitSkipped: false, + diagnostics: diagnostics, + sourceMaps: sourceMapDataList + }; + function isUniqueLocalName(name, container) { + for (var node = container; ts.isNodeDescendentOf(node, container); node = node.nextContainer) { + if (node.locals && ts.hasProperty(node.locals, name)) { + if (node.locals[name].flags & (107455 | 1048576 | 8388608)) { + return false; + } + } + } + return true; + } + function emitJavaScript(jsFilePath, root) { + var writer = ts.createTextWriter(newLine); + var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; + var currentSourceFile; + var exportFunctionForFile; + var generatedNameSet = {}; + var nodeToGeneratedName = []; + var computedPropertyNamesToGeneratedNames; + var extendsEmitted = false; + var decorateEmitted = false; + var paramEmitted = false; + var awaiterEmitted = false; + var tempFlags = 0; + var tempVariables; + var tempParameters; + var externalImports; + var exportSpecifiers; + var exportEquals; + var hasExportStars; + var writeEmittedFiles = writeJavaScriptFile; + var detachedCommentsInfo; + var writeComment = ts.writeCommentRange; + var emit = emitNodeWithCommentsAndWithoutSourcemap; + var emitStart = function (node) { }; + var emitEnd = function (node) { }; + var emitToken = emitTokenText; + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + var scopeEmitEnd = function () { }; + var sourceMapData; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; + var moduleEmitDelegates = (_a = {}, + _a[5] = emitES6Module, + _a[2] = emitAMDModule, + _a[4] = emitSystemModule, + _a[3] = emitUMDModule, + _a[1] = emitCommonJSModule, + _a + ); + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { + initializeEmitterWithSourceMaps(); + } + if (root) { + emitSourceFile(root); + } + else { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + emitSourceFile(sourceFile); + } + }); + } + writeLine(); + writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); + return; + function emitSourceFile(sourceFile) { + currentSourceFile = sourceFile; + exportFunctionForFile = undefined; + emit(sourceFile); + } + function isUniqueName(name) { + return !resolver.hasGlobalName(name) && + !ts.hasProperty(currentSourceFile.identifiers, name) && + !ts.hasProperty(generatedNameSet, name); + } + function makeTempVariableName(flags) { + if (flags && !(tempFlags & flags)) { + var name_20 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_20)) { + tempFlags |= flags; + return name_20; + } + } + while (true) { + var count = tempFlags & 268435455; + tempFlags++; + if (count !== 8 && count !== 13) { + var name_21 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); + if (isUniqueName(name_21)) { + return name_21; + } + } + } + } + function makeUniqueName(baseName) { + if (baseName.charCodeAt(baseName.length - 1) !== 95) { + baseName += "_"; + } + var i = 1; + while (true) { + var generatedName = baseName + i; + if (isUniqueName(generatedName)) { + return generatedNameSet[generatedName] = generatedName; + } + i++; + } + } + function generateNameForModuleOrEnum(node) { + var name = node.name.text; + return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + } + function generateNameForImportOrExportDeclaration(node) { + var expr = ts.getExternalModuleName(node); + var baseName = expr.kind === 9 ? + ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + return makeUniqueName(baseName); + } + function generateNameForExportDefault() { + return makeUniqueName("default"); + } + function generateNameForClassExpression() { + return makeUniqueName("class"); + } + function generateNameForNode(node) { + switch (node.kind) { + case 69: + return makeUniqueName(node.text); + case 218: + case 217: + return generateNameForModuleOrEnum(node); + case 222: + case 228: + return generateNameForImportOrExportDeclaration(node); + case 213: + case 214: + case 227: + return generateNameForExportDefault(); + case 186: + return generateNameForClassExpression(); + } + } + function getGeneratedNameForNode(node) { + var id = ts.getNodeId(node); + return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); + } + function initializeEmitterWithSourceMaps() { + var sourceMapDir; + var sourceMapSourceIndex = -1; + var sourceMapNameIndexMap = {}; + var sourceMapNameIndices = []; + function getSourceMapNameIndex() { + return sourceMapNameIndices.length ? ts.lastOrUndefined(sourceMapNameIndices) : -1; + } + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + var lastEncodedNameIndex = 0; + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; + } + } + else { + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; + } + prevEncodedEmittedColumn = 1; + } + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; + } + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + function base64VLQFormatEncode(inValue) { + function base64FormatEncode(inValue) { + if (inValue < 64) { + return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); + } + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; + } + else { + inValue = inValue << 1; + } + var encodedStr = ""; + do { + var currentDigit = inValue & 31; + inValue = inValue >> 5; + if (inValue > 0) { + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } + } + function recordSourceMapSpan(pos) { + var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); + var emittedColumn = writer.getColumn(); + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine !== emittedLine || + lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + encodeLastRecordedSourceMapSpan(); + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + nameIndex: getSourceMapNameIndex(), + sourceIndex: sourceMapSourceIndex + }; + } + else { + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + } + function recordEmitNodeStartSpan(node) { + recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); + } + function recordEmitNodeEndSpan(node) { + recordSourceMapSpan(node.end); + } + function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { + var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + recordSourceMapSpan(tokenStartPos); + var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); + recordSourceMapSpan(tokenEndPos); + return tokenEndPos; + } + function recordNewSourceFileStart(node) { + var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; + sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true)); + sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; + sourceMapData.inputSourceFileNames.push(node.fileName); + if (compilerOptions.inlineSources) { + if (!sourceMapData.sourceMapSourcesContent) { + sourceMapData.sourceMapSourcesContent = []; + } + sourceMapData.sourceMapSourcesContent.push(node.text); + } + } + function recordScopeNameOfNode(node, scopeName) { + function recordScopeNameIndex(scopeNameIndex) { + sourceMapNameIndices.push(scopeNameIndex); + } + function recordScopeNameStart(scopeName) { + var scopeNameIndex = -1; + if (scopeName) { + var parentIndex = getSourceMapNameIndex(); + if (parentIndex !== -1) { + var name_22 = node.name; + if (!name_22 || name_22.kind !== 136) { + scopeName = "." + scopeName; + } + scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; + } + scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); + if (scopeNameIndex === undefined) { + scopeNameIndex = sourceMapData.sourceMapNames.length; + sourceMapData.sourceMapNames.push(scopeName); + sourceMapNameIndexMap[scopeName] = scopeNameIndex; + } + } + recordScopeNameIndex(scopeNameIndex); + } + if (scopeName) { + recordScopeNameStart(scopeName); + } + else if (node.kind === 213 || + node.kind === 173 || + node.kind === 143 || + node.kind === 142 || + node.kind === 145 || + node.kind === 146 || + node.kind === 218 || + node.kind === 214 || + node.kind === 217) { + if (node.name) { + var name_23 = node.name; + scopeName = name_23.kind === 136 + ? ts.getTextOfNode(name_23) + : node.name.text; + } + recordScopeNameStart(scopeName); + } + else { + recordScopeNameIndex(getSourceMapNameIndex()); + } + } + function recordScopeNameEnd() { + sourceMapNameIndices.pop(); + } + ; + function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { + recordSourceMapSpan(comment.pos); + ts.writeCommentRange(currentSourceFile, writer, comment, newLine); + recordSourceMapSpan(comment.end); + } + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { + if (typeof JSON !== "undefined") { + var map_2 = { + version: version, + file: file, + sourceRoot: sourceRoot, + sources: sources, + names: names, + mappings: mappings + }; + if (sourcesContent !== undefined) { + map_2.sourcesContent = sourcesContent; + } + return JSON.stringify(map_2); + } + return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; + function serializeStringArray(list) { + var output = ""; + for (var i = 0, n = list.length; i < n; i++) { + if (i) { + output += ","; + } + output += "\"" + ts.escapeString(list[i]) + "\""; + } + return output; + } + } + function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { + encodeLastRecordedSourceMapSpan(); + var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); + sourceMapDataList.push(sourceMapData); + var sourceMapUrl; + if (compilerOptions.inlineSourceMap) { + var base64SourceMapText = ts.convertToBase64(sourceMapText); + sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; + } + else { + ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); + sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; + } + writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); + } + var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); + sourceMapData = { + sourceMapFilePath: jsFilePath + ".map", + jsSourceMappingURL: sourceMapJsFile + ".map", + sourceMapFile: sourceMapJsFile, + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapSourcesContent: undefined, + sourceMapDecodedMappings: [] + }; + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; + } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (root) { + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(root, host, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); + } + function emitNodeWithSourceMap(node) { + if (node) { + if (ts.nodeIsSynthesized(node)) { + return emitNodeWithoutSourceMap(node); + } + if (node.kind !== 248) { + recordEmitNodeStartSpan(node); + emitNodeWithoutSourceMap(node); + recordEmitNodeEndSpan(node); + } + else { + recordNewSourceFileStart(node); + emitNodeWithoutSourceMap(node); + } + } + } + function emitNodeWithCommentsAndWithSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } + writeEmittedFiles = writeJavaScriptAndSourceMapFile; + emit = emitNodeWithCommentsAndWithSourcemap; + emitStart = recordEmitNodeStartSpan; + emitEnd = recordEmitNodeEndSpan; + emitToken = writeTextWithSpanRecord; + scopeEmitStart = recordScopeNameOfNode; + scopeEmitEnd = recordScopeNameEnd; + writeComment = writeCommentRangeWithMap; + } + function writeJavaScriptFile(emitOutput, writeByteOrderMark) { + ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); + } + function createTempVariable(flags) { + var result = ts.createSynthesizedNode(69); + result.text = makeTempVariableName(flags); + return result; + } + function recordTempDeclaration(name) { + if (!tempVariables) { + tempVariables = []; + } + tempVariables.push(name); + } + function createAndRecordTempVariable(flags) { + var temp = createTempVariable(flags); + recordTempDeclaration(temp); + return temp; + } + function emitTempDeclarations(newLine) { + if (tempVariables) { + if (newLine) { + writeLine(); + } + else { + write(" "); + } + write("var "); + emitCommaList(tempVariables); + write(";"); + } + } + function emitTokenText(tokenKind, startPos, emitFn) { + var tokenString = ts.tokenToString(tokenKind); + if (emitFn) { + emitFn(); + } + else { + write(tokenString); + } + return startPos + tokenString.length; + } + function emitOptional(prefix, node) { + if (node) { + write(prefix); + emit(node); + } + } + function emitParenthesizedIf(node, parenthesized) { + if (parenthesized) { + write("("); + } + emit(node); + if (parenthesized) { + write(")"); + } + } + function emitTrailingCommaIfPresent(nodeList) { + if (nodeList.hasTrailingComma) { + write(","); + } + } + function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { + ts.Debug.assert(nodes.length > 0); + increaseIndent(); + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + for (var i = 0, n = nodes.length; i < n; i++) { + if (i) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + write(", "); + } + else { + write(","); + writeLine(); + } + } + emit(nodes[i]); + } + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + decreaseIndent(); + if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + function emitList(nodes, start, count, multiLine, trailingComma, leadingComma, noTrailingNewLine, emitNode) { + if (!emitNode) { + emitNode = emit; + } + for (var i = 0; i < count; i++) { + if (multiLine) { + if (i || leadingComma) { + write(","); + } + writeLine(); + } + else { + if (i || leadingComma) { + write(", "); + } + } + var node = nodes[start + i]; + emitTrailingCommentsOfPosition(node.pos); + emitNode(node); + leadingComma = true; + } + if (trailingComma) { + write(","); + } + if (multiLine && !noTrailingNewLine) { + writeLine(); + } + return count; + } + function emitCommaList(nodes) { + if (nodes) { + emitList(nodes, 0, nodes.length, false, false); + } + } + function emitLines(nodes) { + emitLinesStartingAt(nodes, 0); + } + function emitLinesStartingAt(nodes, startIndex) { + for (var i = startIndex; i < nodes.length; i++) { + writeLine(); + emit(nodes[i]); + } + } + function isBinaryOrOctalIntegerLiteral(node, text) { + if (node.kind === 8 && text.length > 1) { + switch (text.charCodeAt(1)) { + case 98: + case 66: + case 111: + case 79: + return true; + } + } + return false; + } + function emitLiteral(node) { + var text = getLiteralText(node); + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) { + writer.writeLiteral(text); + } + else if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { + write(node.text); + } + else { + write(text); + } + } + function getLiteralText(node) { + if (languageVersion < 2 && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { + return getQuotedEscapedLiteralText("\"", node.text, "\""); + } + if (node.parent) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + } + switch (node.kind) { + case 9: + return getQuotedEscapedLiteralText("\"", node.text, "\""); + case 11: + return getQuotedEscapedLiteralText("`", node.text, "`"); + case 12: + return getQuotedEscapedLiteralText("`", node.text, "${"); + case 13: + return getQuotedEscapedLiteralText("}", node.text, "${"); + case 14: + return getQuotedEscapedLiteralText("}", node.text, "`"); + case 8: + return node.text; + } + ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); + } + function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { + return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; + } + function emitDownlevelRawTemplateLiteral(node) { + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + var isLast = node.kind === 11 || node.kind === 14; + text = text.substring(1, text.length - (isLast ? 1 : 2)); + text = text.replace(/\r\n?/g, "\n"); + text = ts.escapeString(text); + write("\"" + text + "\""); + } + function emitDownlevelTaggedTemplateArray(node, literalEmitter) { + write("["); + if (node.template.kind === 11) { + literalEmitter(node.template); + } + else { + literalEmitter(node.template.head); + ts.forEach(node.template.templateSpans, function (child) { + write(", "); + literalEmitter(child.literal); + }); + } + write("]"); + } + function emitDownlevelTaggedTemplate(node) { + var tempVariable = createAndRecordTempVariable(0); + write("("); + emit(tempVariable); + write(" = "); + emitDownlevelTaggedTemplateArray(node, emit); + write(", "); + emit(tempVariable); + write(".raw = "); + emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral); + write(", "); + emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); + write("("); + emit(tempVariable); + if (node.template.kind === 183) { + ts.forEach(node.template.templateSpans, function (templateSpan) { + write(", "); + var needsParens = templateSpan.expression.kind === 181 + && templateSpan.expression.operatorToken.kind === 24; + emitParenthesizedIf(templateSpan.expression, needsParens); + }); + } + write("))"); + } + function emitTemplateExpression(node) { + if (languageVersion >= 2) { + ts.forEachChild(node, emit); + return; + } + var emitOuterParens = ts.isExpression(node.parent) + && templateNeedsParens(node, node.parent); + if (emitOuterParens) { + write("("); + } + var headEmitted = false; + if (shouldEmitTemplateHead()) { + emitLiteral(node.head); + headEmitted = true; + } + for (var i = 0, n = node.templateSpans.length; i < n; i++) { + var templateSpan = node.templateSpans[i]; + var needsParens = templateSpan.expression.kind !== 172 + && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + if (i > 0 || headEmitted) { + write(" + "); + } + emitParenthesizedIf(templateSpan.expression, needsParens); + if (templateSpan.literal.text.length !== 0) { + write(" + "); + emitLiteral(templateSpan.literal); + } + } + if (emitOuterParens) { + write(")"); + } + function shouldEmitTemplateHead() { + ts.Debug.assert(node.templateSpans.length !== 0); + return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; + } + function templateNeedsParens(template, parent) { + switch (parent.kind) { + case 168: + case 169: + return parent.expression === template; + case 170: + case 172: + return false; + default: + return comparePrecedenceToBinaryPlus(parent) !== -1; + } + } + function comparePrecedenceToBinaryPlus(expression) { + switch (expression.kind) { + case 181: + switch (expression.operatorToken.kind) { + case 37: + case 39: + case 40: + return 1; + case 35: + case 36: + return 0; + default: + return -1; + } + case 184: + case 182: + return -1; + default: + return 1; + } + } + } + function emitTemplateSpan(span) { + emit(span.expression); + emit(span.literal); + } + function jsxEmitReact(node) { + function emitTagName(name) { + if (name.kind === 69 && ts.isIntrinsicJsxName(name.text)) { + write("\""); + emit(name); + write("\""); + } + else { + emit(name); + } + } + function emitAttributeName(name) { + if (/[A-Za-z_]+[\w*]/.test(name.text)) { + write("\""); + emit(name); + write("\""); + } + else { + emit(name); + } + } + function emitJsxAttribute(node) { + emitAttributeName(node.name); + write(": "); + if (node.initializer) { + emit(node.initializer); + } + else { + write("true"); + } + } + function emitJsxElement(openingNode, children) { + var syntheticReactRef = ts.createSynthesizedNode(69); + syntheticReactRef.text = "React"; + syntheticReactRef.parent = openingNode; + emitLeadingComments(openingNode); + emitExpressionIdentifier(syntheticReactRef); + write(".createElement("); + emitTagName(openingNode.tagName); + write(", "); + if (openingNode.attributes.length === 0) { + write("null"); + } + else { + var attrs = openingNode.attributes; + if (ts.forEach(attrs, function (attr) { return attr.kind === 239; })) { + emitExpressionIdentifier(syntheticReactRef); + write(".__spread("); + var haveOpenedObjectLiteral = false; + for (var i_1 = 0; i_1 < attrs.length; i_1++) { + if (attrs[i_1].kind === 239) { + if (i_1 === 0) { + write("{}, "); + } + if (haveOpenedObjectLiteral) { + write("}"); + haveOpenedObjectLiteral = false; + } + if (i_1 > 0) { + write(", "); + } + emit(attrs[i_1].expression); + } + else { + ts.Debug.assert(attrs[i_1].kind === 238); + if (haveOpenedObjectLiteral) { + write(", "); + } + else { + haveOpenedObjectLiteral = true; + if (i_1 > 0) { + write(", "); + } + write("{"); + } + emitJsxAttribute(attrs[i_1]); + } + } + if (haveOpenedObjectLiteral) + write("}"); + write(")"); + } + else { + write("{"); + for (var i = 0; i < attrs.length; i++) { + if (i > 0) { + write(", "); + } + emitJsxAttribute(attrs[i]); + } + write("}"); + } + } + if (children) { + for (var i = 0; i < children.length; i++) { + if (children[i].kind === 240 && !(children[i].expression)) { + continue; + } + if (children[i].kind === 236) { + var text = getTextToEmit(children[i]); + if (text !== undefined) { + write(", \""); + write(text); + write("\""); + } + } + else { + write(", "); + emit(children[i]); + } + } + } + write(")"); + emitTrailingComments(openingNode); + } + if (node.kind === 233) { + emitJsxElement(node.openingElement, node.children); + } + else { + ts.Debug.assert(node.kind === 234); + emitJsxElement(node); + } + } + function jsxEmitPreserve(node) { + function emitJsxAttribute(node) { + emit(node.name); + if (node.initializer) { + write("="); + emit(node.initializer); + } + } + function emitJsxSpreadAttribute(node) { + write("{..."); + emit(node.expression); + write("}"); + } + function emitAttributes(attribs) { + for (var i = 0, n = attribs.length; i < n; i++) { + if (i > 0) { + write(" "); + } + if (attribs[i].kind === 239) { + emitJsxSpreadAttribute(attribs[i]); + } + else { + ts.Debug.assert(attribs[i].kind === 238); + emitJsxAttribute(attribs[i]); + } + } + } + function emitJsxOpeningOrSelfClosingElement(node) { + write("<"); + emit(node.tagName); + if (node.attributes.length > 0 || (node.kind === 234)) { + write(" "); + } + emitAttributes(node.attributes); + if (node.kind === 234) { + write("/>"); + } + else { + write(">"); + } + } + function emitJsxClosingElement(node) { + write(""); + } + function emitJsxElement(node) { + emitJsxOpeningOrSelfClosingElement(node.openingElement); + for (var i = 0, n = node.children.length; i < n; i++) { + emit(node.children[i]); + } + emitJsxClosingElement(node.closingElement); + } + if (node.kind === 233) { + emitJsxElement(node); + } + else { + ts.Debug.assert(node.kind === 234); + emitJsxOpeningOrSelfClosingElement(node); + } + } + function emitExpressionForPropertyName(node) { + ts.Debug.assert(node.kind !== 163); + if (node.kind === 9) { + emitLiteral(node); + } + else if (node.kind === 136) { + if (ts.nodeIsDecorated(node.parent)) { + if (!computedPropertyNamesToGeneratedNames) { + computedPropertyNamesToGeneratedNames = []; + } + var generatedName = computedPropertyNamesToGeneratedNames[ts.getNodeId(node)]; + if (generatedName) { + write(generatedName); + return; + } + generatedName = createAndRecordTempVariable(0).text; + computedPropertyNamesToGeneratedNames[ts.getNodeId(node)] = generatedName; + write(generatedName); + write(" = "); + } + emit(node.expression); + } + else { + write("\""); + if (node.kind === 8) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + write("\""); + } + } + function isExpressionIdentifier(node) { + var parent = node.parent; + switch (parent.kind) { + case 164: + case 189: + case 181: + case 168: + case 241: + case 136: + case 182: + case 139: + case 175: + case 197: + case 167: + case 227: + case 195: + case 188: + case 199: + case 200: + case 201: + case 196: + case 234: + case 235: + case 239: + case 240: + case 169: + case 172: + case 180: + case 179: + case 204: + case 246: + case 185: + case 206: + case 170: + case 190: + case 208: + case 171: + case 176: + case 177: + case 198: + case 205: + case 184: + return true; + case 163: + case 247: + case 138: + case 245: + case 141: + case 211: + return parent.initializer === node; + case 166: + return parent.expression === node; + case 174: + case 173: + return parent.body === node; + case 221: + return parent.moduleReference === node; + case 135: + return parent.left === node; + } + return false; + } + function emitExpressionIdentifier(node) { + if (resolver.getNodeCheckFlags(node) & 2048) { + write("_arguments"); + return; + } + var container = resolver.getReferencedExportContainer(node); + if (container) { + if (container.kind === 248) { + if (modulekind !== 5 && modulekind !== 4) { + write("exports."); + } + } + else { + write(getGeneratedNameForNode(container)); + write("."); + } + } + else { + if (modulekind !== 5) { + var declaration = resolver.getReferencedImportDeclaration(node); + if (declaration) { + if (declaration.kind === 223) { + write(getGeneratedNameForNode(declaration.parent)); + write(languageVersion === 0 ? "[\"default\"]" : ".default"); + return; + } + else if (declaration.kind === 226) { + write(getGeneratedNameForNode(declaration.parent.parent.parent)); + var name_24 = declaration.propertyName || declaration.name; + var identifier = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, name_24); + if (languageVersion === 0 && identifier === "default") { + write("[\"default\"]"); + } + else { + write("."); + write(identifier); + } + return; + } + } + } + if (languageVersion !== 2) { + var declaration = resolver.getReferencedNestedRedeclaration(node); + if (declaration) { + write(getGeneratedNameForNode(declaration.name)); + return; + } + } + } + if (ts.nodeIsSynthesized(node)) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + } + function isNameOfNestedRedeclaration(node) { + if (languageVersion < 2) { + var parent_6 = node.parent; + switch (parent_6.kind) { + case 163: + case 214: + case 217: + case 211: + return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); + } + } + return false; + } + function emitIdentifier(node) { + if (!node.parent) { + write(node.text); + } + else if (isExpressionIdentifier(node)) { + emitExpressionIdentifier(node); + } + else if (isNameOfNestedRedeclaration(node)) { + write(getGeneratedNameForNode(node)); + } + else if (ts.nodeIsSynthesized(node)) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + } + function emitThis(node) { + if (resolver.getNodeCheckFlags(node) & 2) { + write("_this"); + } + else { + write("this"); + } + } + function emitSuper(node) { + if (languageVersion >= 2) { + write("super"); + } + else { + var flags = resolver.getNodeCheckFlags(node); + if (flags & 256) { + write("_super.prototype"); + } + else { + write("_super"); + } + } + } + function emitObjectBindingPattern(node) { + write("{ "); + var elements = node.elements; + emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + write(" }"); + } + function emitArrayBindingPattern(node) { + write("["); + var elements = node.elements; + emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + write("]"); + } + function emitBindingElement(node) { + if (node.propertyName) { + emit(node.propertyName); + write(": "); + } + if (node.dotDotDotToken) { + write("..."); + } + if (ts.isBindingPattern(node.name)) { + emit(node.name); + } + else { + emitModuleMemberName(node); + } + emitOptional(" = ", node.initializer); + } + function emitSpreadElementExpression(node) { + write("..."); + emit(node.expression); + } + function emitYieldExpression(node) { + write(ts.tokenToString(114)); + if (node.asteriskToken) { + write("*"); + } + if (node.expression) { + write(" "); + emit(node.expression); + } + } + function emitAwaitExpression(node) { + var needsParenthesis = needsParenthesisForAwaitExpressionAsYield(node); + if (needsParenthesis) { + write("("); + } + write(ts.tokenToString(114)); + write(" "); + emit(node.expression); + if (needsParenthesis) { + write(")"); + } + } + function needsParenthesisForAwaitExpressionAsYield(node) { + if (node.parent.kind === 181 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + return true; + } + else if (node.parent.kind === 182 && node.parent.condition === node) { + return true; + } + return false; + } + function needsParenthesisForPropertyAccessOrInvocation(node) { + switch (node.kind) { + case 69: + case 164: + case 166: + case 167: + case 168: + case 172: + return false; + } + return true; + } + function emitListWithSpread(elements, needsUniqueCopy, multiLine, trailingComma, useConcat) { + var pos = 0; + var group = 0; + var length = elements.length; + while (pos < length) { + if (group === 1 && useConcat) { + write(".concat("); + } + else if (group > 0) { + write(", "); + } + var e = elements[pos]; + if (e.kind === 185) { + e = e.expression; + emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); + pos++; + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 164) { + write(".slice()"); + } + } + else { + var i = pos; + while (i < length && elements[i].kind !== 185) { + i++; + } + write("["); + if (multiLine) { + increaseIndent(); + } + emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } + write("]"); + pos = i; + } + group++; + } + if (group > 1) { + if (useConcat) { + write(")"); + } + } + } + function isSpreadElementExpression(node) { + return node.kind === 185; + } + function emitArrayLiteral(node) { + var elements = node.elements; + if (elements.length === 0) { + write("[]"); + } + else if (languageVersion >= 2 || !ts.forEach(elements, isSpreadElementExpression)) { + write("["); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, false); + write("]"); + } + else { + emitListWithSpread(elements, true, (node.flags & 2048) !== 0, elements.hasTrailingComma, true); + } + } + function emitObjectLiteralBody(node, numElements) { + if (numElements === 0) { + write("{}"); + return; + } + write("{"); + if (numElements > 0) { + var properties = node.properties; + if (numElements === properties.length) { + emitLinePreservingList(node, properties, languageVersion >= 1, true); + } + else { + var multiLine = (node.flags & 2048) !== 0; + if (!multiLine) { + write(" "); + } + else { + increaseIndent(); + } + emitList(properties, 0, numElements, multiLine, false); + if (!multiLine) { + write(" "); + } + else { + decreaseIndent(); + } + } + } + write("}"); + } + function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { + var multiLine = (node.flags & 2048) !== 0; + var properties = node.properties; + write("("); + if (multiLine) { + increaseIndent(); + } + var tempVar = createAndRecordTempVariable(0); + emit(tempVar); + write(" = "); + emitObjectLiteralBody(node, firstComputedPropertyIndex); + for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { + writeComma(); + var property = properties[i]; + emitStart(property); + if (property.kind === 145 || property.kind === 146) { + var accessors = ts.getAllAccessorDeclarations(node.properties, property); + if (property !== accessors.firstAccessor) { + continue; + } + write("Object.defineProperty("); + emit(tempVar); + write(", "); + emitStart(node.name); + emitExpressionForPropertyName(property.name); + emitEnd(property.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("})"); + emitEnd(property); + } + else { + emitLeadingComments(property); + emitStart(property.name); + emit(tempVar); + emitMemberAccessForPropertyName(property.name); + emitEnd(property.name); + write(" = "); + if (property.kind === 245) { + emit(property.initializer); + } + else if (property.kind === 246) { + emitExpressionIdentifier(property.name); + } + else if (property.kind === 143) { + emitFunctionDeclaration(property); + } + else { + ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); + } + } + emitEnd(property); + } + writeComma(); + emit(tempVar); + if (multiLine) { + decreaseIndent(); + writeLine(); + } + write(")"); + function writeComma() { + if (multiLine) { + write(","); + writeLine(); + } + else { + write(", "); + } + } + } + function emitObjectLiteral(node) { + var properties = node.properties; + if (languageVersion < 2) { + var numProperties = properties.length; + var numInitialNonComputedProperties = numProperties; + for (var i = 0, n = properties.length; i < n; i++) { + if (properties[i].name.kind === 136) { + numInitialNonComputedProperties = i; + break; + } + } + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; + } + } + emitObjectLiteralBody(node, properties.length); + } + function createBinaryExpression(left, operator, right, startsOnNewLine) { + var result = ts.createSynthesizedNode(181, startsOnNewLine); + result.operatorToken = ts.createSynthesizedNode(operator); + result.left = left; + result.right = right; + return result; + } + function createPropertyAccessExpression(expression, name) { + var result = ts.createSynthesizedNode(166); + result.expression = parenthesizeForAccess(expression); + result.dotToken = ts.createSynthesizedNode(21); + result.name = name; + return result; + } + function createElementAccessExpression(expression, argumentExpression) { + var result = ts.createSynthesizedNode(167); + result.expression = parenthesizeForAccess(expression); + result.argumentExpression = argumentExpression; + return result; + } + function parenthesizeForAccess(expr) { + while (expr.kind === 171 || expr.kind === 189) { + expr = expr.expression; + } + if (ts.isLeftHandSideExpression(expr) && + expr.kind !== 169 && + expr.kind !== 8) { + return expr; + } + var node = ts.createSynthesizedNode(172); + node.expression = expr; + return node; + } + function emitComputedPropertyName(node) { + write("["); + emitExpressionForPropertyName(node); + write("]"); + } + function emitMethod(node) { + if (languageVersion >= 2 && node.asteriskToken) { + write("*"); + } + emit(node.name); + if (languageVersion < 2) { + write(": function "); + } + emitSignatureAndBody(node); + } + function emitPropertyAssignment(node) { + emit(node.name); + write(": "); + emitTrailingCommentsOfPosition(node.initializer.pos); + emit(node.initializer); + } + function isNamespaceExportReference(node) { + var container = resolver.getReferencedExportContainer(node); + return container && container.kind !== 248; + } + function emitShorthandPropertyAssignment(node) { + writeTextOfNode(currentSourceFile, node.name); + if (languageVersion < 2 || isNamespaceExportReference(node.name)) { + write(": "); + emit(node.name); + } + if (languageVersion >= 2 && node.objectAssignmentInitializer) { + write(" = "); + emit(node.objectAssignmentInitializer); + } + } + function tryEmitConstantValue(node) { + var constantValue = tryGetConstEnumValue(node); + if (constantValue !== undefined) { + write(constantValue.toString()); + if (!compilerOptions.removeComments) { + var propertyName = node.kind === 166 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + write(" /* " + propertyName + " */"); + } + return true; + } + return false; + } + function tryGetConstEnumValue(node) { + if (compilerOptions.isolatedModules) { + return undefined; + } + return node.kind === 166 || node.kind === 167 + ? resolver.getConstantValue(node) + : undefined; + } + function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { + var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); + if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { + increaseIndent(); + writeLine(); + return true; + } + else { + if (valueToWriteWhenNotIndenting) { + write(valueToWriteWhenNotIndenting); + } + return false; + } + } + function emitPropertyAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); + var shouldEmitSpace; + if (!indentedBeforeDot) { + if (node.expression.kind === 8) { + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + shouldEmitSpace = text.indexOf(ts.tokenToString(21)) < 0; + } + else { + var constantValue = tryGetConstEnumValue(node.expression); + shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; + } + } + if (shouldEmitSpace) { + write(" ."); + } + else { + write("."); + } + var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); + emit(node.name); + decreaseIndentIf(indentedBeforeDot, indentedAfterDot); + } + function emitQualifiedName(node) { + emit(node.left); + write("."); + emit(node.right); + } + function emitQualifiedNameAsExpression(node, useFallback) { + if (node.left.kind === 69) { + emitEntityNameAsExpression(node.left, useFallback); + } + else if (useFallback) { + var temp = createAndRecordTempVariable(0); + write("("); + emitNodeWithoutSourceMap(temp); + write(" = "); + emitEntityNameAsExpression(node.left, true); + write(") && "); + emitNodeWithoutSourceMap(temp); + } + else { + emitEntityNameAsExpression(node.left, false); + } + write("."); + emit(node.right); + } + function emitEntityNameAsExpression(node, useFallback) { + switch (node.kind) { + case 69: + if (useFallback) { + write("typeof "); + emitExpressionIdentifier(node); + write(" !== 'undefined' && "); + } + emitExpressionIdentifier(node); + break; + case 135: + emitQualifiedNameAsExpression(node, useFallback); + break; + } + } + function emitIndexedAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + write("["); + emit(node.argumentExpression); + write("]"); + } + function hasSpreadElement(elements) { + return ts.forEach(elements, function (e) { return e.kind === 185; }); + } + function skipParentheses(node) { + while (node.kind === 172 || node.kind === 171 || node.kind === 189) { + node = node.expression; + } + return node; + } + function emitCallTarget(node) { + if (node.kind === 69 || node.kind === 97 || node.kind === 95) { + emit(node); + return node; + } + var temp = createAndRecordTempVariable(0); + write("("); + emit(temp); + write(" = "); + emit(node); + write(")"); + return temp; + } + function emitCallWithSpread(node) { + var target; + var expr = skipParentheses(node.expression); + if (expr.kind === 166) { + target = emitCallTarget(expr.expression); + write("."); + emit(expr.name); + } + else if (expr.kind === 167) { + target = emitCallTarget(expr.expression); + write("["); + emit(expr.argumentExpression); + write("]"); + } + else if (expr.kind === 95) { + target = expr; + write("_super"); + } + else { + emit(node.expression); + } + write(".apply("); + if (target) { + if (target.kind === 95) { + emitThis(target); + } + else { + emit(target); + } + } + else { + write("void 0"); + } + write(", "); + emitListWithSpread(node.arguments, false, false, false, true); + write(")"); + } + function emitCallExpression(node) { + if (languageVersion < 2 && hasSpreadElement(node.arguments)) { + emitCallWithSpread(node); + return; + } + var superCall = false; + if (node.expression.kind === 95) { + emitSuper(node.expression); + superCall = true; + } + else { + emit(node.expression); + superCall = node.expression.kind === 166 && node.expression.expression.kind === 95; + } + if (superCall && languageVersion < 2) { + write(".call("); + emitThis(node.expression); + if (node.arguments.length) { + write(", "); + emitCommaList(node.arguments); + } + write(")"); + } + else { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + function emitNewExpression(node) { + write("new "); + if (languageVersion === 1 && + node.arguments && + hasSpreadElement(node.arguments)) { + write("("); + var target = emitCallTarget(node.expression); + write(".bind.apply("); + emit(target); + write(", [void 0].concat("); + emitListWithSpread(node.arguments, false, false, false, false); + write(")))"); + write("()"); + } + else { + emit(node.expression); + if (node.arguments) { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + } + function emitTaggedTemplateExpression(node) { + if (languageVersion >= 2) { + emit(node.tag); + write(" "); + emit(node.template); + } + else { + emitDownlevelTaggedTemplate(node); + } + } + function emitParenExpression(node) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 174) { + if (node.expression.kind === 171 || node.expression.kind === 189) { + var operand = node.expression.expression; + while (operand.kind === 171 || operand.kind === 189) { + operand = operand.expression; + } + if (operand.kind !== 179 && + operand.kind !== 177 && + operand.kind !== 176 && + operand.kind !== 175 && + operand.kind !== 180 && + operand.kind !== 169 && + !(operand.kind === 168 && node.parent.kind === 169) && + !(operand.kind === 173 && node.parent.kind === 168) && + !(operand.kind === 8 && node.parent.kind === 166)) { + emit(operand); + return; + } + } + } + write("("); + emit(node.expression); + write(")"); + } + function emitDeleteExpression(node) { + write(ts.tokenToString(78)); + write(" "); + emit(node.expression); + } + function emitVoidExpression(node) { + write(ts.tokenToString(103)); + write(" "); + emit(node.expression); + } + function emitTypeOfExpression(node) { + write(ts.tokenToString(101)); + write(" "); + emit(node.expression); + } + function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 69 || ts.nodeIsSynthesized(node)) { + return false; + } + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 211 || node.parent.kind === 163); + var targetDeclaration = isVariableDeclarationOrBindingElement + ? node.parent + : resolver.getReferencedValueDeclaration(node); + return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); + } + function emitPrefixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + } + write(ts.tokenToString(node.operator)); + if (node.operand.kind === 179) { + var operand = node.operand; + if (node.operator === 35 && (operand.operator === 35 || operand.operator === 41)) { + write(" "); + } + else if (node.operator === 36 && (operand.operator === 36 || operand.operator === 42)) { + write(" "); + } + } + emit(node.operand); + if (exportChanged) { + write(")"); + } + } + function emitPostfixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + write("(" + exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + write(ts.tokenToString(node.operator)); + emit(node.operand); + if (node.operator === 41) { + write(") - 1)"); + } + else { + write(") + 1)"); + } + } + else { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + } + function shouldHoistDeclarationInSystemJsModule(node) { + return isSourceFileLevelDeclarationInSystemJsModule(node, false); + } + function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { + if (!node || languageVersion >= 2 || !isCurrentFileSystemExternalModule()) { + return false; + } + var current = node; + while (current) { + if (current.kind === 248) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); + } + else if (ts.isFunctionLike(current) || current.kind === 219) { + return false; + } + else { + current = current.parent; + } + } + } + function emitExponentiationOperator(node) { + var leftHandSideExpression = node.left; + if (node.operatorToken.kind === 60) { + var synthesizedLHS; + var shouldEmitParentheses = false; + if (ts.isElementAccessExpression(leftHandSideExpression)) { + shouldEmitParentheses = true; + write("("); + synthesizedLHS = ts.createSynthesizedNode(167, false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); + synthesizedLHS.expression = identifier; + if (leftHandSideExpression.argumentExpression.kind !== 8 && + leftHandSideExpression.argumentExpression.kind !== 9) { + var tempArgumentExpression = createAndRecordTempVariable(268435456); + synthesizedLHS.argumentExpression = tempArgumentExpression; + emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, true); + } + else { + synthesizedLHS.argumentExpression = leftHandSideExpression.argumentExpression; + } + write(", "); + } + else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { + shouldEmitParentheses = true; + write("("); + synthesizedLHS = ts.createSynthesizedNode(166, false); + var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); + synthesizedLHS.expression = identifier; + synthesizedLHS.dotToken = leftHandSideExpression.dotToken; + synthesizedLHS.name = leftHandSideExpression.name; + write(", "); + } + emit(synthesizedLHS || leftHandSideExpression); + write(" = "); + write("Math.pow("); + emit(synthesizedLHS || leftHandSideExpression); + write(", "); + emit(node.right); + write(")"); + if (shouldEmitParentheses) { + write(")"); + } + } + else { + write("Math.pow("); + emit(leftHandSideExpression); + write(", "); + emit(node.right); + write(")"); + } + } + function emitBinaryExpression(node) { + if (languageVersion < 2 && node.operatorToken.kind === 56 && + (node.left.kind === 165 || node.left.kind === 164)) { + emitDestructuring(node, node.parent.kind === 195); + } + else { + var exportChanged = node.operatorToken.kind >= 56 && + node.operatorToken.kind <= 68 && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.left); + write("\", "); + } + if (node.operatorToken.kind === 38 || node.operatorToken.kind === 60) { + emitExponentiationOperator(node); + } + else { + emit(node.left); + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 ? " " : undefined); + write(ts.tokenToString(node.operatorToken.kind)); + var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); + emit(node.right); + decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); + } + if (exportChanged) { + write(")"); + } + } + } + function synthesizedNodeStartsOnNewLine(node) { + return ts.nodeIsSynthesized(node) && node.startsOnNewLine; + } + function emitConditionalExpression(node) { + emit(node.condition); + var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); + write("?"); + var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); + emit(node.whenTrue); + decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); + var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); + write(":"); + var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); + emit(node.whenFalse); + decreaseIndentIf(indentedBeforeColon, indentedAfterColon); + } + function decreaseIndentIf(value1, value2) { + if (value1) { + decreaseIndent(); + } + if (value2) { + decreaseIndent(); + } + } + function isSingleLineEmptyBlock(node) { + if (node && node.kind === 192) { + var block = node; + return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); + } + } + function emitBlock(node) { + if (isSingleLineEmptyBlock(node)) { + emitToken(15, node.pos); + write(" "); + emitToken(16, node.statements.end); + return; + } + emitToken(15, node.pos); + increaseIndent(); + scopeEmitStart(node.parent); + if (node.kind === 219) { + ts.Debug.assert(node.parent.kind === 218); + emitCaptureThisForNodeIfNecessary(node.parent); + } + emitLines(node.statements); + if (node.kind === 219) { + emitTempDeclarations(true); + } + decreaseIndent(); + writeLine(); + emitToken(16, node.statements.end); + scopeEmitEnd(); + } + function emitEmbeddedStatement(node) { + if (node.kind === 192) { + write(" "); + emit(node); + } + else { + increaseIndent(); + writeLine(); + emit(node); + decreaseIndent(); + } + } + function emitExpressionStatement(node) { + emitParenthesizedIf(node.expression, node.expression.kind === 174); + write(";"); + } + function emitIfStatement(node) { + var endPos = emitToken(88, node.pos); + write(" "); + endPos = emitToken(17, endPos); + emit(node.expression); + emitToken(18, node.expression.end); + emitEmbeddedStatement(node.thenStatement); + if (node.elseStatement) { + writeLine(); + emitToken(80, node.thenStatement.end); + if (node.elseStatement.kind === 196) { + write(" "); + emit(node.elseStatement); + } + else { + emitEmbeddedStatement(node.elseStatement); + } + } + } + function emitDoStatement(node) { + write("do"); + emitEmbeddedStatement(node.statement); + if (node.statement.kind === 192) { + write(" "); + } + else { + writeLine(); + } + write("while ("); + emit(node.expression); + write(");"); + } + function emitWhileStatement(node) { + write("while ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function tryEmitStartOfVariableDeclarationList(decl, startPos) { + if (shouldHoistVariable(decl, true)) { + return false; + } + var tokenKind = 102; + if (decl && languageVersion >= 2) { + if (ts.isLet(decl)) { + tokenKind = 108; + } + else if (ts.isConst(decl)) { + tokenKind = 74; + } + } + if (startPos !== undefined) { + emitToken(tokenKind, startPos); + write(" "); + } + else { + switch (tokenKind) { + case 102: + write("var "); + break; + case 108: + write("let "); + break; + case 74: + write("const "); + break; + } + } + return true; + } + function emitVariableDeclarationListSkippingUninitializedEntries(list) { + var started = false; + for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { + var decl = _b[_a]; + if (!decl.initializer) { + continue; + } + if (!started) { + started = true; + } + else { + write(", "); + } + emit(decl); + } + return started; + } + function emitForStatement(node) { + var endPos = emitToken(86, node.pos); + write(" "); + endPos = emitToken(17, endPos); + if (node.initializer && node.initializer.kind === 212) { + var variableDeclarationList = node.initializer; + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + if (startIsEmitted) { + emitCommaList(variableDeclarationList.declarations); + } + else { + emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); + } + } + else if (node.initializer) { + emit(node.initializer); + } + write(";"); + emitOptional(" ", node.condition); + write(";"); + emitOptional(" ", node.incrementor); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitForInOrForOfStatement(node) { + if (languageVersion < 2 && node.kind === 201) { + return emitDownLevelForOfStatement(node); + } + var endPos = emitToken(86, node.pos); + write(" "); + endPos = emitToken(17, endPos); + if (node.initializer.kind === 212) { + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length >= 1) { + tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + emit(variableDeclarationList.declarations[0]); + } + } + else { + emit(node.initializer); + } + if (node.kind === 200) { + write(" in "); + } + else { + write(" of "); + } + emit(node.expression); + emitToken(18, node.expression.end); + emitEmbeddedStatement(node.statement); + } + function emitDownLevelForOfStatement(node) { + var endPos = emitToken(86, node.pos); + write(" "); + endPos = emitToken(17, endPos); + var rhsIsIdentifier = node.expression.kind === 69; + var counter = createTempVariable(268435456); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); + emitStart(node.expression); + write("var "); + emitNodeWithoutSourceMap(counter); + write(" = 0"); + emitEnd(node.expression); + if (!rhsIsIdentifier) { + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); + } + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write(" < "); + emitNodeWithCommentsAndWithoutSourcemap(rhsReference); + write(".length"); + emitEnd(node.initializer); + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write("++"); + emitEnd(node.initializer); + emitToken(18, node.expression.end); + write(" {"); + writeLine(); + increaseIndent(); + var rhsIterationValue = createElementAccessExpression(rhsReference, counter); + emitStart(node.initializer); + if (node.initializer.kind === 212) { + write("var "); + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length > 0) { + var declaration = variableDeclarationList.declarations[0]; + if (ts.isBindingPattern(declaration.name)) { + emitDestructuring(declaration, false, rhsIterationValue); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(declaration); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + emitNodeWithoutSourceMap(createTempVariable(0)); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + var assignmentExpression = createBinaryExpression(node.initializer, 56, rhsIterationValue, false); + if (node.initializer.kind === 164 || node.initializer.kind === 165) { + emitDestructuring(assignmentExpression, true, undefined); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); + } + } + emitEnd(node.initializer); + write(";"); + if (node.statement.kind === 192) { + emitLines(node.statement.statements); + } + else { + writeLine(); + emit(node.statement); + } + writeLine(); + decreaseIndent(); + write("}"); + } + function emitBreakOrContinueStatement(node) { + emitToken(node.kind === 203 ? 70 : 75, node.pos); + emitOptional(" ", node.label); + write(";"); + } + function emitReturnStatement(node) { + emitToken(94, node.pos); + emitOptional(" ", node.expression); + write(";"); + } + function emitWithStatement(node) { + write("with ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitSwitchStatement(node) { + var endPos = emitToken(96, node.pos); + write(" "); + emitToken(17, endPos); + emit(node.expression); + endPos = emitToken(18, node.expression.end); + write(" "); + emitCaseBlock(node.caseBlock, endPos); + } + function emitCaseBlock(node, startPos) { + emitToken(15, startPos); + increaseIndent(); + emitLines(node.clauses); + decreaseIndent(); + writeLine(); + emitToken(16, node.clauses.end); + } + function nodeStartPositionsAreOnSameLine(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function nodeEndPositionsAreOnSameLine(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === + ts.getLineOfLocalPosition(currentSourceFile, node2.end); + } + function nodeEndIsOnSameLineAsNodeStart(node1, node2) { + return ts.getLineOfLocalPosition(currentSourceFile, node1.end) === + ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function emitCaseOrDefaultClause(node) { + if (node.kind === 241) { + write("case "); + emit(node.expression); + write(":"); + } + else { + write("default:"); + } + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + write(" "); + emit(node.statements[0]); + } + else { + increaseIndent(); + emitLines(node.statements); + decreaseIndent(); + } + } + function emitThrowStatement(node) { + write("throw "); + emit(node.expression); + write(";"); + } + function emitTryStatement(node) { + write("try "); + emit(node.tryBlock); + emit(node.catchClause); + if (node.finallyBlock) { + writeLine(); + write("finally "); + emit(node.finallyBlock); + } + } + function emitCatchClause(node) { + writeLine(); + var endPos = emitToken(72, node.pos); + write(" "); + emitToken(17, endPos); + emit(node.variableDeclaration); + emitToken(18, node.variableDeclaration ? node.variableDeclaration.end : endPos); + write(" "); + emitBlock(node.block); + } + function emitDebuggerStatement(node) { + emitToken(76, node.pos); + write(";"); + } + function emitLabelledStatement(node) { + emit(node.label); + write(": "); + emit(node.statement); + } + function getContainingModule(node) { + do { + node = node.parent; + } while (node && node.kind !== 218); + return node; + } + function emitContainingModuleName(node) { + var container = getContainingModule(node); + write(container ? getGeneratedNameForNode(container) : "exports"); + } + function emitModuleMemberName(node) { + emitStart(node.name); + if (ts.getCombinedNodeFlags(node) & 1) { + var container = getContainingModule(node); + if (container) { + write(getGeneratedNameForNode(container)); + write("."); + } + else if (modulekind !== 5 && modulekind !== 4) { + write("exports."); + } + } + emitNodeWithCommentsAndWithoutSourcemap(node.name); + emitEnd(node.name); + } + function createVoidZero() { + var zero = ts.createSynthesizedNode(8); + zero.text = "0"; + var result = ts.createSynthesizedNode(177); + result.expression = zero; + return result; + } + function emitEs6ExportDefaultCompat(node) { + if (node.parent.kind === 248) { + ts.Debug.assert(!!(node.flags & 1024) || node.kind === 227); + if (modulekind === 1 || modulekind === 2 || modulekind === 3) { + if (!currentSourceFile.symbol.exports["___esModule"]) { + if (languageVersion === 1) { + write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + writeLine(); + } + else if (languageVersion === 0) { + write("exports.__esModule = true;"); + writeLine(); + } + } + } + } + } + function emitExportMemberAssignment(node) { + if (node.flags & 1) { + writeLine(); + emitStart(node); + if (modulekind === 4 && node.parent === currentSourceFile) { + write(exportFunctionForFile + "(\""); + if (node.flags & 1024) { + write("default"); + } + else { + emitNodeWithCommentsAndWithoutSourcemap(node.name); + } + write("\", "); + emitDeclarationName(node); + write(")"); + } + else { + if (node.flags & 1024) { + emitEs6ExportDefaultCompat(node); + if (languageVersion === 0) { + write("exports[\"default\"]"); + } + else { + write("exports.default"); + } + } + else { + emitModuleMemberName(node); + } + write(" = "); + emitDeclarationName(node); + } + emitEnd(node); + write(";"); + } + } + function emitExportMemberAssignments(name) { + if (modulekind === 4) { + return; + } + if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { + for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { + var specifier = _b[_a]; + writeLine(); + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); + write(";"); + } + } + } + function emitExportSpecifierInSystemModule(specifier) { + ts.Debug.assert(modulekind === 4); + if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { + return; + } + writeLine(); + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write("\", "); + emitExpressionIdentifier(specifier.propertyName || specifier.name); + write(")"); + emitEnd(specifier.name); + write(";"); + } + function emitAssignment(name, value, shouldEmitCommaBeforeAssignment) { + if (shouldEmitCommaBeforeAssignment) { + write(", "); + } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(name); + write("\", "); + } + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 211 || name.parent.kind === 163); + if (isVariableDeclarationOrBindingElement) { + emitModuleMemberName(name.parent); + } + else { + emit(name); + } + write(" = "); + emit(value); + if (exportChanged) { + write(")"); + } + } + function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment) { + var identifier = createTempVariable(0); + if (!canDefineTempVariablesInPlace) { + recordTempDeclaration(identifier); + } + emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment); + return identifier; + } + function emitDestructuring(root, isAssignmentExpressionStatement, value) { + var emitCount = 0; + var canDefineTempVariablesInPlace = false; + if (root.kind === 211) { + var isExported = ts.getCombinedNodeFlags(root) & 1; + var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); + canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; + } + else if (root.kind === 138) { + canDefineTempVariablesInPlace = true; + } + if (root.kind === 181) { + emitAssignmentExpression(root); + } + else { + ts.Debug.assert(!isAssignmentExpressionStatement); + emitBindingElement(root, value); + } + function ensureIdentifier(expr, reuseIdentifierExpressions) { + if (expr.kind === 69 && reuseIdentifierExpressions) { + return expr; + } + var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0); + emitCount++; + return identifier; + } + function createDefaultValueCheck(value, defaultValue) { + value = ensureIdentifier(value, true); + var equals = ts.createSynthesizedNode(181); + equals.left = value; + equals.operatorToken = ts.createSynthesizedNode(32); + equals.right = createVoidZero(); + return createConditionalExpression(equals, defaultValue, value); + } + function createConditionalExpression(condition, whenTrue, whenFalse) { + var cond = ts.createSynthesizedNode(182); + cond.condition = condition; + cond.questionToken = ts.createSynthesizedNode(53); + cond.whenTrue = whenTrue; + cond.colonToken = ts.createSynthesizedNode(54); + cond.whenFalse = whenFalse; + return cond; + } + function createNumericLiteral(value) { + var node = ts.createSynthesizedNode(8); + node.text = "" + value; + return node; + } + function createPropertyAccessForDestructuringProperty(object, propName) { + var syntheticName = ts.createSynthesizedNode(propName.kind); + syntheticName.text = propName.text; + if (syntheticName.kind !== 69) { + return createElementAccessExpression(object, syntheticName); + } + return createPropertyAccessExpression(object, syntheticName); + } + function createSliceCall(value, sliceIndex) { + var call = ts.createSynthesizedNode(168); + var sliceIdentifier = ts.createSynthesizedNode(69); + sliceIdentifier.text = "slice"; + call.expression = createPropertyAccessExpression(value, sliceIdentifier); + call.arguments = ts.createSynthesizedNodeArray(); + call.arguments[0] = createNumericLiteral(sliceIndex); + return call; + } + function emitObjectLiteralAssignment(target, value) { + var properties = target.properties; + if (properties.length !== 1) { + value = ensureIdentifier(value, true); + } + for (var _a = 0; _a < properties.length; _a++) { + var p = properties[_a]; + if (p.kind === 245 || p.kind === 246) { + var propName = p.name; + var target_1 = p.kind === 246 ? p : p.initializer || propName; + emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName)); + } + } + } + function emitArrayLiteralAssignment(target, value) { + var elements = target.elements; + if (elements.length !== 1) { + value = ensureIdentifier(value, true); + } + for (var i = 0; i < elements.length; i++) { + var e = elements[i]; + if (e.kind !== 187) { + if (e.kind !== 185) { + emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); + } + else if (i === elements.length - 1) { + emitDestructuringAssignment(e.expression, createSliceCall(value, i)); + } + } + } + } + function emitDestructuringAssignment(target, value) { + if (target.kind === 246) { + if (target.objectAssignmentInitializer) { + value = createDefaultValueCheck(value, target.objectAssignmentInitializer); + } + target = target.name; + } + else if (target.kind === 181 && target.operatorToken.kind === 56) { + value = createDefaultValueCheck(value, target.right); + target = target.left; + } + if (target.kind === 165) { + emitObjectLiteralAssignment(target, value); + } + else if (target.kind === 164) { + emitArrayLiteralAssignment(target, value); + } + else { + emitAssignment(target, value, emitCount > 0); + emitCount++; + } + } + function emitAssignmentExpression(root) { + var target = root.left; + var value = root.right; + if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { + emit(value); + } + else if (isAssignmentExpressionStatement) { + emitDestructuringAssignment(target, value); + } + else { + if (root.parent.kind !== 172) { + write("("); + } + value = ensureIdentifier(value, true); + emitDestructuringAssignment(target, value); + write(", "); + emit(value); + if (root.parent.kind !== 172) { + write(")"); + } + } + } + function emitBindingElement(target, value) { + if (target.initializer) { + value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; + } + else if (!value) { + value = createVoidZero(); + } + if (ts.isBindingPattern(target.name)) { + var pattern = target.name; + var elements = pattern.elements; + var numElements = elements.length; + if (numElements !== 1) { + value = ensureIdentifier(value, numElements !== 0); + } + for (var i = 0; i < numElements; i++) { + var element = elements[i]; + if (pattern.kind === 161) { + var propName = element.propertyName || element.name; + emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); + } + else if (element.kind !== 187) { + if (!element.dotDotDotToken) { + emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); + } + else if (i === numElements - 1) { + emitBindingElement(element, createSliceCall(value, i)); + } + } + } + } + else { + emitAssignment(target.name, value, emitCount > 0); + emitCount++; + } + } + } + function emitVariableDeclaration(node) { + if (ts.isBindingPattern(node.name)) { + if (languageVersion < 2) { + emitDestructuring(node, false); + } + else { + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + else { + var initializer = node.initializer; + if (!initializer && languageVersion < 2) { + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 16384) && + (getCombinedFlagsForIdentifier(node.name) & 16384); + if (isUninitializedLet && + node.parent.parent.kind !== 200 && + node.parent.parent.kind !== 201) { + initializer = createVoidZero(); + } + } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(node.name); + write("\", "); + } + emitModuleMemberName(node); + emitOptional(" = ", initializer); + if (exportChanged) { + write(")"); + } + } + } + function emitExportVariableAssignments(node) { + if (node.kind === 187) { + return; + } + var name = node.name; + if (name.kind === 69) { + emitExportMemberAssignments(name); + } + else if (ts.isBindingPattern(name)) { + ts.forEach(name.elements, emitExportVariableAssignments); + } + } + function getCombinedFlagsForIdentifier(node) { + if (!node.parent || (node.parent.kind !== 211 && node.parent.kind !== 163)) { + return 0; + } + return ts.getCombinedNodeFlags(node.parent); + } + function isES6ExportedDeclaration(node) { + return !!(node.flags & 1) && + modulekind === 5 && + node.parent.kind === 248; + } + function emitVariableStatement(node) { + var startIsEmitted = false; + if (node.flags & 1) { + if (isES6ExportedDeclaration(node)) { + write("export "); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + } + else { + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + if (startIsEmitted) { + emitCommaList(node.declarationList.declarations); + write(";"); + } + else { + var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); + if (atLeastOneItem) { + write(";"); + } + } + if (modulekind !== 5 && node.parent === currentSourceFile) { + ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); + } + } + function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { + if (!(node.flags & 1)) { + return true; + } + if (isES6ExportedDeclaration(node)) { + return true; + } + for (var _a = 0, _b = node.declarationList.declarations; _a < _b.length; _a++) { + var declaration = _b[_a]; + if (declaration.initializer) { + return true; + } + } + return false; + } + function emitParameter(node) { + if (languageVersion < 2) { + if (ts.isBindingPattern(node.name)) { + var name_25 = createTempVariable(0); + if (!tempParameters) { + tempParameters = []; + } + tempParameters.push(name_25); + emit(name_25); + } + else { + emit(node.name); + } + } + else { + if (node.dotDotDotToken) { + write("..."); + } + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + function emitDefaultValueAssignments(node) { + if (languageVersion < 2) { + var tempIndex = 0; + ts.forEach(node.parameters, function (parameter) { + if (parameter.dotDotDotToken) { + return; + } + var paramName = parameter.name, initializer = parameter.initializer; + if (ts.isBindingPattern(paramName)) { + var hasBindingElements = paramName.elements.length > 0; + if (hasBindingElements || initializer) { + writeLine(); + write("var "); + if (hasBindingElements) { + emitDestructuring(parameter, false, tempParameters[tempIndex]); + } + else { + emit(tempParameters[tempIndex]); + write(" = "); + emit(initializer); + } + write(";"); + tempIndex++; + } + } + else if (initializer) { + writeLine(); + emitStart(parameter); + write("if ("); + emitNodeWithoutSourceMap(paramName); + write(" === void 0)"); + emitEnd(parameter); + write(" { "); + emitStart(parameter); + emitNodeWithCommentsAndWithoutSourcemap(paramName); + write(" = "); + emitNodeWithCommentsAndWithoutSourcemap(initializer); + emitEnd(parameter); + write("; }"); + } + }); + } + } + function emitRestParameter(node) { + if (languageVersion < 2 && ts.hasRestParameter(node)) { + var restIndex = node.parameters.length - 1; + var restParam = node.parameters[restIndex]; + if (ts.isBindingPattern(restParam.name)) { + return; + } + var tempName = createTempVariable(268435456).text; + writeLine(); + emitLeadingComments(restParam); + emitStart(restParam); + write("var "); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); + write(" = [];"); + emitEnd(restParam); + emitTrailingComments(restParam); + writeLine(); + write("for ("); + emitStart(restParam); + write("var " + tempName + " = " + restIndex + ";"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + " < arguments.length;"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + "++"); + emitEnd(restParam); + write(") {"); + increaseIndent(); + writeLine(); + emitStart(restParam); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); + write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); + emitEnd(restParam); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitAccessor(node) { + write(node.kind === 145 ? "get " : "set "); + emit(node.name); + emitSignatureAndBody(node); + } + function shouldEmitAsArrowFunction(node) { + return node.kind === 174 && languageVersion >= 2; + } + function emitDeclarationName(node) { + if (node.name) { + emitNodeWithCommentsAndWithoutSourcemap(node.name); + } + else { + write(getGeneratedNameForNode(node)); + } + } + function shouldEmitFunctionName(node) { + if (node.kind === 173) { + return !!node.name; + } + if (node.kind === 213) { + return !!node.name || languageVersion < 2; + } + } + function emitFunctionDeclaration(node) { + if (ts.nodeIsMissing(node.body)) { + return emitCommentsOnNotEmittedNode(node); + } + if (node.kind !== 143 && node.kind !== 142 && + node.parent && node.parent.kind !== 245 && + node.parent.kind !== 168) { + emitLeadingComments(node); + } + emitStart(node); + if (!shouldEmitAsArrowFunction(node)) { + if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 1024) { + write("default "); + } + } + write("function"); + if (languageVersion >= 2 && node.asteriskToken) { + write("*"); + } + write(" "); + } + if (shouldEmitFunctionName(node)) { + emitDeclarationName(node); + } + emitSignatureAndBody(node); + if (modulekind !== 5 && node.kind === 213 && node.parent === currentSourceFile && node.name) { + emitExportMemberAssignments(node.name); + } + emitEnd(node); + if (node.kind !== 143 && node.kind !== 142) { + emitTrailingComments(node); + } + } + function emitCaptureThisForNodeIfNecessary(node) { + if (resolver.getNodeCheckFlags(node) & 4) { + writeLine(); + emitStart(node); + write("var _this = this;"); + emitEnd(node); + } + } + function emitSignatureParameters(node) { + increaseIndent(); + write("("); + if (node) { + var parameters = node.parameters; + var omitCount = languageVersion < 2 && ts.hasRestParameter(node) ? 1 : 0; + emitList(parameters, 0, parameters.length - omitCount, false, false); + } + write(")"); + decreaseIndent(); + } + function emitSignatureParametersForArrow(node) { + if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { + emit(node.parameters[0]); + return; + } + emitSignatureParameters(node); + } + function emitAsyncFunctionBodyForES6(node) { + var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); + var isArrowFunction = node.kind === 174; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096) !== 0; + var args; + if (!isArrowFunction) { + write(" {"); + increaseIndent(); + writeLine(); + write("return"); + } + write(" __awaiter(this"); + if (hasLexicalArguments) { + write(", arguments"); + } + else { + write(", void 0"); + } + if (promiseConstructor) { + write(", "); + emitNodeWithoutSourceMap(promiseConstructor); + } + else { + write(", Promise"); + } + if (hasLexicalArguments) { + write(", function* (_arguments)"); + } + else { + write(", function* ()"); + } + emitFunctionBody(node); + write(")"); + if (!isArrowFunction) { + write(";"); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitFunctionBody(node) { + if (!node.body) { + write(" { }"); + } + else { + if (node.body.kind === 192) { + emitBlockFunctionBody(node, node.body); + } + else { + emitExpressionFunctionBody(node, node.body); + } + } + } + function emitSignatureAndBody(node) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + if (shouldEmitAsArrowFunction(node)) { + emitSignatureParametersForArrow(node); + write(" =>"); + } + else { + emitSignatureParameters(node); + } + var isAsync = ts.isAsyncFunctionLike(node); + if (isAsync && languageVersion === 2) { + emitAsyncFunctionBodyForES6(node); + } + else { + emitFunctionBody(node); + } + if (!isES6ExportedDeclaration(node)) { + emitExportMemberAssignment(node); + } + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + function emitFunctionBodyPreamble(node) { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + function emitExpressionFunctionBody(node, body) { + if (languageVersion < 2 || node.flags & 512) { + emitDownLevelExpressionFunctionBody(node, body); + return; + } + write(" "); + var current = body; + while (current.kind === 171) { + current = current.expression; + } + emitParenthesizedIf(body, current.kind === 165); + } + function emitDownLevelExpressionFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + increaseIndent(); + var outPos = writer.getTextPos(); + emitDetachedComments(node.body); + emitFunctionBodyPreamble(node); + var preambleEmitted = writer.getTextPos() !== outPos; + decreaseIndent(); + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + write(" "); + emitStart(body); + write("return "); + emit(body); + emitEnd(body); + write(";"); + emitTempDeclarations(false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(body); + write(";"); + emitTrailingComments(node.body); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + } + emitStart(node.body); + write("}"); + emitEnd(node.body); + scopeEmitEnd(); + } + function emitBlockFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + var initialTextPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + var startIndex = emitDirectivePrologues(body.statements, true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== initialTextPos; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { + var statement = _b[_a]; + write(" "); + emit(statement); + } + emitTempDeclarations(false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(true); + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + emitToken(16, body.statements.end); + scopeEmitEnd(); + } + function findInitialSuperCall(ctor) { + if (ctor.body) { + var statement = ctor.body.statements[0]; + if (statement && statement.kind === 195) { + var expr = statement.expression; + if (expr && expr.kind === 168) { + var func = expr.expression; + if (func && func.kind === 95) { + return statement; + } + } + } + } + } + function emitParameterPropertyAssignments(node) { + ts.forEach(node.parameters, function (param) { + if (param.flags & 112) { + writeLine(); + emitStart(param); + emitStart(param.name); + write("this."); + emitNodeWithoutSourceMap(param.name); + emitEnd(param.name); + write(" = "); + emit(param.name); + write(";"); + emitEnd(param); + } + }); + } + function emitMemberAccessForPropertyName(memberName) { + if (memberName.kind === 9 || memberName.kind === 8) { + write("["); + emitNodeWithCommentsAndWithoutSourcemap(memberName); + write("]"); + } + else if (memberName.kind === 136) { + emitComputedPropertyName(memberName); + } + else { + write("."); + emitNodeWithCommentsAndWithoutSourcemap(memberName); + } + } + function getInitializedProperties(node, isStatic) { + var properties = []; + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if (member.kind === 141 && isStatic === ((member.flags & 128) !== 0) && member.initializer) { + properties.push(member); + } + } + return properties; + } + function emitPropertyDeclarations(node, properties) { + for (var _a = 0; _a < properties.length; _a++) { + var property = properties[_a]; + emitPropertyDeclaration(node, property); + } + } + function emitPropertyDeclaration(node, property, receiver, isExpression) { + writeLine(); + emitLeadingComments(property); + emitStart(property); + emitStart(property.name); + if (receiver) { + emit(receiver); + } + else { + if (property.flags & 128) { + emitDeclarationName(node); + } + else { + write("this"); + } + } + emitMemberAccessForPropertyName(property.name); + emitEnd(property.name); + write(" = "); + emit(property.initializer); + if (!isExpression) { + write(";"); + } + emitEnd(property); + emitTrailingComments(property); + } + function emitMemberFunctionsForES5AndLower(node) { + ts.forEach(node.members, function (member) { + if (member.kind === 191) { + writeLine(); + write(";"); + } + else if (member.kind === 143 || node.kind === 142) { + if (!member.body) { + return emitCommentsOnNotEmittedNode(member); + } + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + emitClassMemberPrefix(node, member); + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emitFunctionDeclaration(member); + emitEnd(member); + write(";"); + emitTrailingComments(member); + } + else if (member.kind === 145 || member.kind === 146) { + var accessors = ts.getAllAccessorDeclarations(node.members, member); + if (member === accessors.firstAccessor) { + writeLine(); + emitStart(member); + write("Object.defineProperty("); + emitStart(member.name); + emitClassMemberPrefix(node, member); + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("});"); + emitEnd(member); + } + } + }); + } + function emitMemberFunctionsForES6AndHigher(node) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if ((member.kind === 143 || node.kind === 142) && !member.body) { + emitCommentsOnNotEmittedNode(member); + } + else if (member.kind === 143 || + member.kind === 145 || + member.kind === 146) { + writeLine(); + emitLeadingComments(member); + emitStart(member); + if (member.flags & 128) { + write("static "); + } + if (member.kind === 145) { + write("get "); + } + else if (member.kind === 146) { + write("set "); + } + if (member.asteriskToken) { + write("*"); + } + emit(member.name); + emitSignatureAndBody(member); + emitEnd(member); + emitTrailingComments(member); + } + else if (member.kind === 191) { + writeLine(); + write(";"); + } + } + } + function emitConstructor(node, baseTypeElement) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + emitConstructorWorker(node, baseTypeElement); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + function emitConstructorWorker(node, baseTypeElement) { + var hasInstancePropertyWithInitializer = false; + ts.forEach(node.members, function (member) { + if (member.kind === 144 && !member.body) { + emitCommentsOnNotEmittedNode(member); + } + if (member.kind === 141 && member.initializer && (member.flags & 128) === 0) { + hasInstancePropertyWithInitializer = true; + } + }); + var ctor = ts.getFirstConstructorWithBody(node); + if (languageVersion >= 2 && !ctor && !hasInstancePropertyWithInitializer) { + return; + } + if (ctor) { + emitLeadingComments(ctor); + } + emitStart(ctor || node); + if (languageVersion < 2) { + write("function "); + emitDeclarationName(node); + emitSignatureParameters(ctor); + } + else { + write("constructor"); + if (ctor) { + emitSignatureParameters(ctor); + } + else { + if (baseTypeElement) { + write("(...args)"); + } + else { + write("()"); + } + } + } + var startIndex = 0; + write(" {"); + scopeEmitStart(node, "constructor"); + increaseIndent(); + if (ctor) { + startIndex = emitDirectivePrologues(ctor.body.statements, true); + emitDetachedComments(ctor.body.statements); + } + emitCaptureThisForNodeIfNecessary(node); + var superCall; + if (ctor) { + emitDefaultValueAssignments(ctor); + emitRestParameter(ctor); + if (baseTypeElement) { + superCall = findInitialSuperCall(ctor); + if (superCall) { + writeLine(); + emit(superCall); + } + } + emitParameterPropertyAssignments(ctor); + } + else { + if (baseTypeElement) { + writeLine(); + emitStart(baseTypeElement); + if (languageVersion < 2) { + write("_super.apply(this, arguments);"); + } + else { + write("super(...args);"); + } + emitEnd(baseTypeElement); + } + } + emitPropertyDeclarations(node, getInitializedProperties(node, false)); + if (ctor) { + var statements = ctor.body.statements; + if (superCall) { + statements = statements.slice(1); + } + emitLinesStartingAt(statements, startIndex); + } + emitTempDeclarations(true); + writeLine(); + if (ctor) { + emitLeadingCommentsOfPosition(ctor.body.statements.end); + } + decreaseIndent(); + emitToken(16, ctor ? ctor.body.statements.end : node.members.end); + scopeEmitEnd(); + emitEnd(ctor || node); + if (ctor) { + emitTrailingComments(ctor); + } + } + function emitClassExpression(node) { + return emitClassLikeDeclaration(node); + } + function emitClassDeclaration(node) { + return emitClassLikeDeclaration(node); + } + function emitClassLikeDeclaration(node) { + if (languageVersion < 2) { + emitClassLikeDeclarationBelowES6(node); + } + else { + emitClassLikeDeclarationForES6AndHigher(node); + } + if (modulekind !== 5 && node.parent === currentSourceFile && node.name) { + emitExportMemberAssignments(node.name); + } + } + function emitClassLikeDeclarationForES6AndHigher(node) { + var thisNodeIsDecorated = ts.nodeIsDecorated(node); + if (node.kind === 214) { + if (thisNodeIsDecorated) { + if (isES6ExportedDeclaration(node) && !(node.flags & 1024)) { + write("export "); + } + write("let "); + emitDeclarationName(node); + write(" = "); + } + else if (isES6ExportedDeclaration(node)) { + write("export "); + if (node.flags & 1024) { + write("default "); + } + } + } + var staticProperties = getInitializedProperties(node, true); + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 186; + var tempVariable; + if (isClassExpressionWithStaticProperties) { + tempVariable = createAndRecordTempVariable(0); + write("("); + increaseIndent(); + emit(tempVariable); + write(" = "); + } + write("class"); + if ((node.name || (node.flags & 1024 && staticProperties.length > 0)) && !thisNodeIsDecorated) { + write(" "); + emitDeclarationName(node); + } + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + write(" extends "); + emit(baseTypeNode.expression); + } + write(" {"); + increaseIndent(); + scopeEmitStart(node); + writeLine(); + emitConstructor(node, baseTypeNode); + emitMemberFunctionsForES6AndHigher(node); + decreaseIndent(); + writeLine(); + emitToken(16, node.members.end); + scopeEmitEnd(); + if (thisNodeIsDecorated) { + write(";"); + } + if (isClassExpressionWithStaticProperties) { + for (var _a = 0; _a < staticProperties.length; _a++) { + var property = staticProperties[_a]; + write(","); + writeLine(); + emitPropertyDeclaration(node, property, tempVariable, true); + } + write(","); + writeLine(); + emit(tempVariable); + decreaseIndent(); + write(")"); + } + else { + writeLine(); + emitPropertyDeclarations(node, staticProperties); + emitDecoratorsOfClass(node); + } + if (!isES6ExportedDeclaration(node) && (node.flags & 1)) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emitDeclarationName(node); + emitEnd(node); + write(";"); + } + else if (isES6ExportedDeclaration(node) && (node.flags & 1024) && thisNodeIsDecorated) { + writeLine(); + write("export default "); + emitDeclarationName(node); + write(";"); + } + } + function emitClassLikeDeclarationBelowES6(node) { + if (node.kind === 214) { + if (!shouldHoistDeclarationInSystemJsModule(node)) { + write("var "); + } + emitDeclarationName(node); + write(" = "); + } + write("(function ("); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + write("_super"); + } + write(") {"); + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + var saveComputedPropertyNamesToGeneratedNames = computedPropertyNamesToGeneratedNames; + tempFlags = 0; + tempVariables = undefined; + tempParameters = undefined; + computedPropertyNamesToGeneratedNames = undefined; + increaseIndent(); + scopeEmitStart(node); + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("__extends("); + emitDeclarationName(node); + write(", _super);"); + emitEnd(baseTypeNode); + } + writeLine(); + emitConstructor(node, baseTypeNode); + emitMemberFunctionsForES5AndLower(node); + emitPropertyDeclarations(node, getInitializedProperties(node, true)); + writeLine(); + emitDecoratorsOfClass(node); + writeLine(); + emitToken(16, node.members.end, function () { + write("return "); + emitDeclarationName(node); + }); + write(";"); + emitTempDeclarations(true); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; + decreaseIndent(); + writeLine(); + emitToken(16, node.members.end); + scopeEmitEnd(); + emitStart(node); + write(")("); + if (baseTypeNode) { + emit(baseTypeNode.expression); + } + write(")"); + if (node.kind === 214) { + write(";"); + } + emitEnd(node); + if (node.kind === 214) { + emitExportMemberAssignment(node); + } + } + function emitClassMemberPrefix(node, member) { + emitDeclarationName(node); + if (!(member.flags & 128)) { + write(".prototype"); + } + } + function emitDecoratorsOfClass(node) { + emitDecoratorsOfMembers(node, 0); + emitDecoratorsOfMembers(node, 128); + emitDecoratorsOfConstructor(node); + } + function emitDecoratorsOfConstructor(node) { + var decorators = node.decorators; + var constructor = ts.getFirstConstructorWithBody(node); + var hasDecoratedParameters = constructor && ts.forEach(constructor.parameters, ts.nodeIsDecorated); + if (!decorators && !hasDecoratedParameters) { + return; + } + writeLine(); + emitStart(node); + emitDeclarationName(node); + write(" = __decorate(["); + increaseIndent(); + writeLine(); + var decoratorCount = decorators ? decorators.length : 0; + var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { + emitStart(decorator); + emit(decorator.expression); + emitEnd(decorator); + }); + argumentsWritten += emitDecoratorsOfParameters(constructor, argumentsWritten > 0); + emitSerializedTypeMetadata(node, argumentsWritten >= 0); + decreaseIndent(); + writeLine(); + write("], "); + emitDeclarationName(node); + write(");"); + emitEnd(node); + writeLine(); + } + function emitDecoratorsOfMembers(node, staticFlag) { + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if ((member.flags & 128) !== staticFlag) { + continue; + } + if (!ts.nodeCanBeDecorated(member)) { + continue; + } + if (!ts.nodeOrChildIsDecorated(member)) { + continue; + } + var decorators = void 0; + var functionLikeMember = void 0; + if (ts.isAccessor(member)) { + var accessors = ts.getAllAccessorDeclarations(node.members, member); + if (member !== accessors.firstAccessor) { + continue; + } + decorators = accessors.firstAccessor.decorators; + if (!decorators && accessors.secondAccessor) { + decorators = accessors.secondAccessor.decorators; + } + functionLikeMember = accessors.setAccessor; + } + else { + decorators = member.decorators; + if (member.kind === 143) { + functionLikeMember = member; + } + } + writeLine(); + emitStart(member); + write("__decorate(["); + increaseIndent(); + writeLine(); + var decoratorCount = decorators ? decorators.length : 0; + var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { + emitStart(decorator); + emit(decorator.expression); + emitEnd(decorator); + }); + argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); + emitSerializedTypeMetadata(member, argumentsWritten > 0); + decreaseIndent(); + writeLine(); + write("], "); + emitStart(member.name); + emitClassMemberPrefix(node, member); + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + if (languageVersion > 0) { + if (member.kind !== 141) { + write(", null"); + } + else { + write(", void 0"); + } + } + write(");"); + emitEnd(member); + writeLine(); + } + } + function emitDecoratorsOfParameters(node, leadingComma) { + var argumentsWritten = 0; + if (node) { + var parameterIndex = 0; + for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { + var parameter = _b[_a]; + if (ts.nodeIsDecorated(parameter)) { + var decorators = parameter.decorators; + argumentsWritten += emitList(decorators, 0, decorators.length, true, false, leadingComma, true, function (decorator) { + emitStart(decorator); + write("__param(" + parameterIndex + ", "); + emit(decorator.expression); + write(")"); + emitEnd(decorator); + }); + leadingComma = true; + } + ++parameterIndex; + } + } + return argumentsWritten; + } + function shouldEmitTypeMetadata(node) { + switch (node.kind) { + case 143: + case 145: + case 146: + case 141: + return true; + } + return false; + } + function shouldEmitReturnTypeMetadata(node) { + switch (node.kind) { + case 143: + return true; + } + return false; + } + function shouldEmitParamTypesMetadata(node) { + switch (node.kind) { + case 214: + case 143: + case 146: + return true; + } + return false; + } + function emitSerializedTypeOfNode(node) { + switch (node.kind) { + case 214: + write("Function"); + return; + case 141: + emitSerializedTypeNode(node.type); + return; + case 138: + emitSerializedTypeNode(node.type); + return; + case 145: + emitSerializedTypeNode(node.type); + return; + case 146: + emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); + return; + } + if (ts.isFunctionLike(node)) { + write("Function"); + return; + } + write("void 0"); + } + function emitSerializedTypeNode(node) { + if (node) { + switch (node.kind) { + case 103: + write("void 0"); + return; + case 160: + emitSerializedTypeNode(node.type); + return; + case 152: + case 153: + write("Function"); + return; + case 156: + case 157: + write("Array"); + return; + case 150: + case 120: + write("Boolean"); + return; + case 130: + case 9: + write("String"); + return; + case 128: + write("Number"); + return; + case 131: + write("Symbol"); + return; + case 151: + emitSerializedTypeReferenceNode(node); + return; + case 154: + case 155: + case 158: + case 159: + case 117: + break; + default: + ts.Debug.fail("Cannot serialize unexpected type node."); + break; + } + } + write("Object"); + } + function emitSerializedTypeReferenceNode(node) { + var location = node.parent; + while (ts.isDeclaration(location) || ts.isTypeNode(location)) { + location = location.parent; + } + var typeName = ts.cloneEntityName(node.typeName); + typeName.parent = location; + var result = resolver.getTypeReferenceSerializationKind(typeName); + switch (result) { + case ts.TypeReferenceSerializationKind.Unknown: + var temp = createAndRecordTempVariable(0); + write("(typeof ("); + emitNodeWithoutSourceMap(temp); + write(" = "); + emitEntityNameAsExpression(typeName, true); + write(") === 'function' && "); + emitNodeWithoutSourceMap(temp); + write(") || Object"); + break; + case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: + emitEntityNameAsExpression(typeName, false); + break; + case ts.TypeReferenceSerializationKind.VoidType: + write("void 0"); + break; + case ts.TypeReferenceSerializationKind.BooleanType: + write("Boolean"); + break; + case ts.TypeReferenceSerializationKind.NumberLikeType: + write("Number"); + break; + case ts.TypeReferenceSerializationKind.StringLikeType: + write("String"); + break; + case ts.TypeReferenceSerializationKind.ArrayLikeType: + write("Array"); + break; + case ts.TypeReferenceSerializationKind.ESSymbolType: + if (languageVersion < 2) { + write("typeof Symbol === 'function' ? Symbol : Object"); + } + else { + write("Symbol"); + } + break; + case ts.TypeReferenceSerializationKind.TypeWithCallSignature: + write("Function"); + break; + case ts.TypeReferenceSerializationKind.ObjectType: + write("Object"); + break; + } + } + function emitSerializedParameterTypesOfNode(node) { + if (node) { + var valueDeclaration; + if (node.kind === 214) { + valueDeclaration = ts.getFirstConstructorWithBody(node); + } + else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { + valueDeclaration = node; + } + if (valueDeclaration) { + var parameters = valueDeclaration.parameters; + var parameterCount = parameters.length; + if (parameterCount > 0) { + for (var i = 0; i < parameterCount; i++) { + if (i > 0) { + write(", "); + } + if (parameters[i].dotDotDotToken) { + var parameterType = parameters[i].type; + if (parameterType.kind === 156) { + parameterType = parameterType.elementType; + } + else if (parameterType.kind === 151 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + parameterType = parameterType.typeArguments[0]; + } + else { + parameterType = undefined; + } + emitSerializedTypeNode(parameterType); + } + else { + emitSerializedTypeOfNode(parameters[i]); + } + } + } + } + } + } + function emitSerializedReturnTypeOfNode(node) { + if (node && ts.isFunctionLike(node) && node.type) { + emitSerializedTypeNode(node.type); + return; + } + write("void 0"); + } + function emitSerializedTypeMetadata(node, writeComma) { + var argumentsWritten = 0; + if (compilerOptions.emitDecoratorMetadata) { + if (shouldEmitTypeMetadata(node)) { + if (writeComma) { + write(", "); + } + writeLine(); + write("__metadata('design:type', "); + emitSerializedTypeOfNode(node); + write(")"); + argumentsWritten++; + } + if (shouldEmitParamTypesMetadata(node)) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:paramtypes', ["); + emitSerializedParameterTypesOfNode(node); + write("])"); + argumentsWritten++; + } + if (shouldEmitReturnTypeMetadata(node)) { + if (writeComma || argumentsWritten) { + write(", "); + } + writeLine(); + write("__metadata('design:returntype', "); + emitSerializedReturnTypeOfNode(node); + write(")"); + argumentsWritten++; + } + } + return argumentsWritten; + } + function emitInterfaceDeclaration(node) { + emitCommentsOnNotEmittedNode(node); + } + function shouldEmitEnumDeclaration(node) { + var isConstEnum = ts.isConst(node); + return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules; + } + function emitEnumDeclaration(node) { + if (!shouldEmitEnumDeclaration(node)) { + return; + } + if (!shouldHoistDeclarationInSystemJsModule(node)) { + if (!(node.flags & 1) || isES6ExportedDeclaration(node)) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + emitEnd(node); + write(";"); + } + } + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(getGeneratedNameForNode(node)); + emitEnd(node.name); + write(") {"); + increaseIndent(); + scopeEmitStart(node); + emitLines(node.members); + decreaseIndent(); + writeLine(); + emitToken(16, node.members.end); + scopeEmitEnd(); + write(")("); + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (!isES6ExportedDeclaration(node) && node.flags & 1 && !shouldHoistDeclarationInSystemJsModule(node)) { + writeLine(); + emitStart(node); + write("var "); + emit(node.name); + write(" = "); + emitModuleMemberName(node); + emitEnd(node); + write(";"); + } + if (modulekind !== 5 && node.parent === currentSourceFile) { + if (modulekind === 4 && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(");"); + } + emitExportMemberAssignments(node.name); + } + } + function emitEnumMember(node) { + var enumParent = node.parent; + emitStart(node); + write(getGeneratedNameForNode(enumParent)); + write("["); + write(getGeneratedNameForNode(enumParent)); + write("["); + emitExpressionForPropertyName(node.name); + write("] = "); + writeEnumMemberDeclarationValue(node); + write("] = "); + emitExpressionForPropertyName(node.name); + emitEnd(node); + write(";"); + } + function writeEnumMemberDeclarationValue(member) { + var value = resolver.getConstantValue(member); + if (value !== undefined) { + write(value.toString()); + return; + } + else if (member.initializer) { + emit(member.initializer); + } + else { + write("undefined"); + } + } + function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { + if (moduleDeclaration.body.kind === 218) { + var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); + return recursiveInnerModule || moduleDeclaration.body; + } + } + function shouldEmitModuleDeclaration(node) { + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); + } + function isModuleMergedWithES6Class(node) { + return languageVersion === 2 && !!(resolver.getNodeCheckFlags(node) & 32768); + } + function emitModuleDeclaration(node) { + var shouldEmit = shouldEmitModuleDeclaration(node); + if (!shouldEmit) { + return emitCommentsOnNotEmittedNode(node); + } + var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); + var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); + if (emitVarForModule) { + emitStart(node); + if (isES6ExportedDeclaration(node)) { + write("export "); + } + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); + } + emitStart(node); + write("(function ("); + emitStart(node.name); + write(getGeneratedNameForNode(node)); + emitEnd(node.name); + write(") "); + if (node.body.kind === 219) { + var saveTempFlags = tempFlags; + var saveTempVariables = tempVariables; + tempFlags = 0; + tempVariables = undefined; + emit(node.body); + tempFlags = saveTempFlags; + tempVariables = saveTempVariables; + } + else { + write("{"); + increaseIndent(); + scopeEmitStart(node); + emitCaptureThisForNodeIfNecessary(node); + writeLine(); + emit(node.body); + decreaseIndent(); + writeLine(); + var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; + emitToken(16, moduleBlock.statements.end); + scopeEmitEnd(); + } + write(")("); + if ((node.flags & 1) && !isES6ExportedDeclaration(node)) { + emit(node.name); + write(" = "); + } + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (!isES6ExportedDeclaration(node) && node.name.kind === 69 && node.parent === currentSourceFile) { + if (modulekind === 4 && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(");"); + } + emitExportMemberAssignments(node.name); + } + } + function tryRenameExternalModule(moduleName) { + if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { + return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; + } + return undefined; + } + function emitRequire(moduleName) { + if (moduleName.kind === 9) { + write("require("); + var text = tryRenameExternalModule(moduleName); + if (text) { + write(text); + } + else { + emitStart(moduleName); + emitLiteral(moduleName); + emitEnd(moduleName); + } + emitToken(18, moduleName.end); + } + else { + write("require()"); + } + } + function getNamespaceDeclarationNode(node) { + if (node.kind === 221) { + return node; + } + var importClause = node.importClause; + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 224) { + return importClause.namedBindings; + } + } + function isDefaultImport(node) { + return node.kind === 222 && node.importClause && !!node.importClause.name; + } + function emitExportImportAssignments(node) { + if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { + emitExportMemberAssignments(node.name); + } + ts.forEachChild(node, emitExportImportAssignments); + } + function emitImportDeclaration(node) { + if (modulekind !== 5) { + return emitExternalImportDeclaration(node); + } + if (node.importClause) { + var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); + var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, true); + if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { + write("import "); + emitStart(node.importClause); + if (shouldEmitDefaultBindings) { + emit(node.importClause.name); + if (shouldEmitNamedBindings) { + write(", "); + } + } + if (shouldEmitNamedBindings) { + emitLeadingComments(node.importClause.namedBindings); + emitStart(node.importClause.namedBindings); + if (node.importClause.namedBindings.kind === 224) { + write("* as "); + emit(node.importClause.namedBindings.name); + } + else { + write("{ "); + emitExportOrImportSpecifierList(node.importClause.namedBindings.elements, resolver.isReferencedAliasDeclaration); + write(" }"); + } + emitEnd(node.importClause.namedBindings); + emitTrailingComments(node.importClause.namedBindings); + } + emitEnd(node.importClause); + write(" from "); + emit(node.moduleSpecifier); + write(";"); + } + } + else { + write("import "); + emit(node.moduleSpecifier); + write(";"); + } + } + function emitExternalImportDeclaration(node) { + if (ts.contains(externalImports, node)) { + var isExportedImport = node.kind === 221 && (node.flags & 1) !== 0; + var namespaceDeclaration = getNamespaceDeclarationNode(node); + if (modulekind !== 2) { + emitLeadingComments(node); + emitStart(node); + if (namespaceDeclaration && !isDefaultImport(node)) { + if (!isExportedImport) + write("var "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + } + else { + var isNakedImport = 222 && !node.importClause; + if (!isNakedImport) { + write("var "); + write(getGeneratedNameForNode(node)); + write(" = "); + } + } + emitRequire(ts.getExternalModuleName(node)); + if (namespaceDeclaration && isDefaultImport(node)) { + write(", "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + write(getGeneratedNameForNode(node)); + } + write(";"); + emitEnd(node); + emitExportImportAssignments(node); + emitTrailingComments(node); + } + else { + if (isExportedImport) { + emitModuleMemberName(namespaceDeclaration); + write(" = "); + emit(namespaceDeclaration.name); + write(";"); + } + else if (namespaceDeclaration && isDefaultImport(node)) { + write("var "); + emitModuleMemberName(namespaceDeclaration); + write(" = "); + write(getGeneratedNameForNode(node)); + write(";"); + } + emitExportImportAssignments(node); + } + } + } + function emitImportEqualsDeclaration(node) { + if (ts.isExternalModuleImportEqualsDeclaration(node)) { + emitExternalImportDeclaration(node); + return; + } + if (resolver.isReferencedAliasDeclaration(node) || + (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + emitLeadingComments(node); + emitStart(node); + var variableDeclarationIsHoisted = shouldHoistVariable(node, true); + var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, true); + if (!variableDeclarationIsHoisted) { + ts.Debug.assert(!isExported); + if (isES6ExportedDeclaration(node)) { + write("export "); + write("var "); + } + else if (!(node.flags & 1)) { + write("var "); + } + } + if (isExported) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); + } + emitModuleMemberName(node); + write(" = "); + emit(node.moduleReference); + if (isExported) { + write(")"); + } + write(";"); + emitEnd(node); + emitExportImportAssignments(node); + emitTrailingComments(node); + } + } + function emitExportDeclaration(node) { + ts.Debug.assert(modulekind !== 4); + if (modulekind !== 5) { + if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { + emitStart(node); + var generatedName = getGeneratedNameForNode(node); + if (node.exportClause) { + if (modulekind !== 2) { + write("var "); + write(generatedName); + write(" = "); + emitRequire(ts.getExternalModuleName(node)); + write(";"); + } + for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { + var specifier = _b[_a]; + if (resolver.isValueAliasDeclaration(specifier)) { + writeLine(); + emitStart(specifier); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write(" = "); + write(generatedName); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); + write(";"); + emitEnd(specifier); + } + } + } + else { + writeLine(); + write("__export("); + if (modulekind !== 2) { + emitRequire(ts.getExternalModuleName(node)); + } + else { + write(generatedName); + } + write(");"); + } + emitEnd(node); + } + } + else { + if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { + write("export "); + if (node.exportClause) { + write("{ "); + emitExportOrImportSpecifierList(node.exportClause.elements, resolver.isValueAliasDeclaration); + write(" }"); + } + else { + write("*"); + } + if (node.moduleSpecifier) { + write(" from "); + emit(node.moduleSpecifier); + } + write(";"); + } + } + } + function emitExportOrImportSpecifierList(specifiers, shouldEmit) { + ts.Debug.assert(modulekind === 5); + var needsComma = false; + for (var _a = 0; _a < specifiers.length; _a++) { + var specifier = specifiers[_a]; + if (shouldEmit(specifier)) { + if (needsComma) { + write(", "); + } + if (specifier.propertyName) { + emit(specifier.propertyName); + write(" as "); + } + emit(specifier.name); + needsComma = true; + } + } + } + function emitExportAssignment(node) { + if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { + if (modulekind === 5) { + writeLine(); + emitStart(node); + write("export default "); + var expression = node.expression; + emit(expression); + if (expression.kind !== 213 && + expression.kind !== 214) { + write(";"); + } + emitEnd(node); + } + else { + writeLine(); + emitStart(node); + if (modulekind === 4) { + write(exportFunctionForFile + "(\"default\","); + emit(node.expression); + write(")"); + } + else { + emitEs6ExportDefaultCompat(node); + emitContainingModuleName(node); + if (languageVersion === 0) { + write("[\"default\"] = "); + } + else { + write(".default = "); + } + emit(node.expression); + } + write(";"); + emitEnd(node); + } + } + } + function collectExternalModuleInfo(sourceFile) { + externalImports = []; + exportSpecifiers = {}; + exportEquals = undefined; + hasExportStars = false; + for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { + var node = _b[_a]; + switch (node.kind) { + case 222: + if (!node.importClause || + resolver.isReferencedAliasDeclaration(node.importClause, true)) { + externalImports.push(node); + } + break; + case 221: + if (node.moduleReference.kind === 232 && resolver.isReferencedAliasDeclaration(node)) { + externalImports.push(node); + } + break; + case 228: + if (node.moduleSpecifier) { + if (!node.exportClause) { + externalImports.push(node); + hasExportStars = true; + } + else if (resolver.isValueAliasDeclaration(node)) { + externalImports.push(node); + } + } + else { + for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { + var specifier = _d[_c]; + var name_26 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_26] || (exportSpecifiers[name_26] = [])).push(specifier); + } + } + break; + case 227: + if (node.isExportEquals && !exportEquals) { + exportEquals = node; + } + break; + } + } + } + function emitExportStarHelper() { + if (hasExportStars) { + writeLine(); + write("function __export(m) {"); + increaseIndent(); + writeLine(); + write("for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];"); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function getLocalNameForExternalImport(node) { + var namespaceDeclaration = getNamespaceDeclarationNode(node); + if (namespaceDeclaration && !isDefaultImport(node)) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + } + if (node.kind === 222 && node.importClause) { + return getGeneratedNameForNode(node); + } + if (node.kind === 228 && node.moduleSpecifier) { + return getGeneratedNameForNode(node); + } + } + function getExternalModuleNameText(importNode) { + var moduleName = ts.getExternalModuleName(importNode); + if (moduleName.kind === 9) { + return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); + } + return undefined; + } + function emitVariableDeclarationsForImports() { + if (externalImports.length === 0) { + return; + } + writeLine(); + var started = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var importNode = externalImports[_a]; + var skipNode = importNode.kind === 228 || + (importNode.kind === 222 && !importNode.importClause); + if (skipNode) { + continue; + } + if (!started) { + write("var "); + started = true; + } + else { + write(", "); + } + write(getLocalNameForExternalImport(importNode)); + } + if (started) { + write(";"); + } + } + function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { + if (!hasExportStars) { + return undefined; + } + if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { + var hasExportDeclarationWithExportClause = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var externalImport = externalImports[_a]; + if (externalImport.kind === 228 && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } + } + if (!hasExportDeclarationWithExportClause) { + return emitExportStarFunction(undefined); + } + } + var exportedNamesStorageRef = makeUniqueName("exportedNames"); + writeLine(); + write("var " + exportedNamesStorageRef + " = {"); + increaseIndent(); + var started = false; + if (exportedDeclarations) { + for (var i = 0; i < exportedDeclarations.length; ++i) { + writeExportedName(exportedDeclarations[i]); + } + } + if (exportSpecifiers) { + for (var n in exportSpecifiers) { + for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { + var specifier = _c[_b]; + writeExportedName(specifier.name); + } + } + } + for (var _d = 0; _d < externalImports.length; _d++) { + var externalImport = externalImports[_d]; + if (externalImport.kind !== 228) { + continue; + } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + continue; + } + for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { + var element = _f[_e]; + writeExportedName(element.name || element.propertyName); + } + } + decreaseIndent(); + writeLine(); + write("};"); + return emitExportStarFunction(exportedNamesStorageRef); + function emitExportStarFunction(localNames) { + var exportStarFunction = makeUniqueName("exportStar"); + writeLine(); + write("function " + exportStarFunction + "(m) {"); + increaseIndent(); + writeLine(); + write("var exports = {};"); + writeLine(); + write("for(var n in m) {"); + increaseIndent(); + writeLine(); + write("if (n !== \"default\""); + if (localNames) { + write("&& !" + localNames + ".hasOwnProperty(n)"); + } + write(") exports[n] = m[n];"); + decreaseIndent(); + writeLine(); + write("}"); + writeLine(); + write(exportFunctionForFile + "(exports);"); + decreaseIndent(); + writeLine(); + write("}"); + return exportStarFunction; + } + function writeExportedName(node) { + if (node.kind !== 69 && node.flags & 1024) { + return; + } + if (started) { + write(","); + } + else { + started = true; + } + writeLine(); + write("'"); + if (node.kind === 69) { + emitNodeWithCommentsAndWithoutSourcemap(node); + } + else { + emitDeclarationName(node); + } + write("': true"); + } + } + function processTopLevelVariableAndFunctionDeclarations(node) { + var hoistedVars; + var hoistedFunctionDeclarations; + var exportedDeclarations; + visit(node); + if (hoistedVars) { + writeLine(); + write("var "); + var seen = {}; + for (var i = 0; i < hoistedVars.length; ++i) { + var local = hoistedVars[i]; + var name_27 = local.kind === 69 + ? local + : local.name; + if (name_27) { + var text = ts.unescapeIdentifier(name_27.text); + if (ts.hasProperty(seen, text)) { + continue; + } + else { + seen[text] = text; + } + } + if (i !== 0) { + write(", "); + } + if (local.kind === 214 || local.kind === 218 || local.kind === 217) { + emitDeclarationName(local); + } + else { + emit(local); + } + var flags = ts.getCombinedNodeFlags(local.kind === 69 ? local.parent : local); + if (flags & 1) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(local); + } + } + write(";"); + } + if (hoistedFunctionDeclarations) { + for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { + var f = hoistedFunctionDeclarations[_a]; + writeLine(); + emit(f); + if (f.flags & 1) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(f); + } + } + } + return exportedDeclarations; + function visit(node) { + if (node.flags & 2) { + return; + } + if (node.kind === 213) { + if (!hoistedFunctionDeclarations) { + hoistedFunctionDeclarations = []; + } + hoistedFunctionDeclarations.push(node); + return; + } + if (node.kind === 214) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 217) { + if (shouldEmitEnumDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 218) { + if (shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + } + return; + } + if (node.kind === 211 || node.kind === 163) { + if (shouldHoistVariable(node, false)) { + var name_28 = node.name; + if (name_28.kind === 69) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(name_28); + } + else { + ts.forEachChild(name_28, visit); + } + } + return; + } + if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node.name); + return; + } + if (ts.isBindingPattern(node)) { + ts.forEach(node.elements, visit); + return; + } + if (!ts.isDeclaration(node)) { + ts.forEachChild(node, visit); + } + } + } + function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { + if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { + return false; + } + return (ts.getCombinedNodeFlags(node) & 49152) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 248; + } + function isCurrentFileSystemExternalModule() { + return modulekind === 4 && ts.isExternalModule(currentSourceFile); + } + function emitSystemModuleBody(node, dependencyGroups, startIndex) { + emitVariableDeclarationsForImports(); + writeLine(); + var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); + var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); + writeLine(); + write("return {"); + increaseIndent(); + writeLine(); + emitSetters(exportStarFunction, dependencyGroups); + writeLine(); + emitExecute(node, startIndex); + decreaseIndent(); + writeLine(); + write("}"); + emitTempDeclarations(true); + } + function emitSetters(exportStarFunction, dependencyGroups) { + write("setters:["); + for (var i = 0; i < dependencyGroups.length; ++i) { + if (i !== 0) { + write(","); + } + writeLine(); + increaseIndent(); + var group = dependencyGroups[i]; + var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); + write("function (" + parameterName + ") {"); + increaseIndent(); + for (var _a = 0; _a < group.length; _a++) { + var entry = group[_a]; + var importVariableName = getLocalNameForExternalImport(entry) || ""; + switch (entry.kind) { + case 222: + if (!entry.importClause) { + break; + } + case 221: + ts.Debug.assert(importVariableName !== ""); + writeLine(); + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + break; + case 228: + ts.Debug.assert(importVariableName !== ""); + if (entry.exportClause) { + writeLine(); + write(exportFunctionForFile + "({"); + writeLine(); + increaseIndent(); + for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { + if (i_2 !== 0) { + write(","); + writeLine(); + } + var e = entry.exportClause.elements[i_2]; + write("\""); + emitNodeWithCommentsAndWithoutSourcemap(e.name); + write("\": " + parameterName + "[\""); + emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); + write("\"]"); + } + decreaseIndent(); + writeLine(); + write("});"); + } + else { + writeLine(); + write(exportStarFunction + "(" + parameterName + ");"); + } + writeLine(); + break; + } + } + decreaseIndent(); + write("}"); + decreaseIndent(); + } + write("],"); + } + function emitExecute(node, startIndex) { + write("execute: function() {"); + increaseIndent(); + writeLine(); + for (var i = startIndex; i < node.statements.length; ++i) { + var statement = node.statements[i]; + switch (statement.kind) { + case 213: + case 222: + continue; + case 228: + if (!statement.moduleSpecifier) { + for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { + var element = _b[_a]; + emitExportSpecifierInSystemModule(element); + } + } + continue; + case 221: + if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { + continue; + } + default: + writeLine(); + emit(statement); + } + } + decreaseIndent(); + writeLine(); + write("}"); + } + function emitSystemModule(node) { + collectExternalModuleInfo(node); + ts.Debug.assert(!exportFunctionForFile); + exportFunctionForFile = makeUniqueName("exports"); + writeLine(); + write("System.register("); + if (node.moduleName) { + write("\"" + node.moduleName + "\", "); + } + write("["); + var groupIndices = {}; + var dependencyGroups = []; + for (var i = 0; i < externalImports.length; ++i) { + var text = getExternalModuleNameText(externalImports[i]); + if (ts.hasProperty(groupIndices, text)) { + var groupIndex = groupIndices[text]; + dependencyGroups[groupIndex].push(externalImports[i]); + continue; + } + else { + groupIndices[text] = dependencyGroups.length; + dependencyGroups.push([externalImports[i]]); + } + if (i !== 0) { + write(", "); + } + write(text); + } + write("], function(" + exportFunctionForFile + ") {"); + writeLine(); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, true); + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitSystemModuleBody(node, dependencyGroups, startIndex); + decreaseIndent(); + writeLine(); + write("});"); + } + function getAMDDependencyNames(node, includeNonAmdDependencies) { + var aliasedModuleNames = []; + var unaliasedModuleNames = []; + var importAliasNames = []; + for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { + var amdDependency = _b[_a]; + if (amdDependency.name) { + aliasedModuleNames.push("\"" + amdDependency.path + "\""); + importAliasNames.push(amdDependency.name); + } + else { + unaliasedModuleNames.push("\"" + amdDependency.path + "\""); + } + } + for (var _c = 0; _c < externalImports.length; _c++) { + var importNode = externalImports[_c]; + var externalModuleName = getExternalModuleNameText(importNode); + var importAliasName = getLocalNameForExternalImport(importNode); + if (includeNonAmdDependencies && importAliasName) { + aliasedModuleNames.push(externalModuleName); + importAliasNames.push(importAliasName); + } + else { + unaliasedModuleNames.push(externalModuleName); + } + } + return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; + } + function emitAMDDependencies(node, includeNonAmdDependencies) { + var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies); + emitAMDDependencyList(dependencyNames); + write(", "); + emitAMDFactoryHeader(dependencyNames); + } + function emitAMDDependencyList(_a) { + var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; + write("[\"require\", \"exports\""); + if (aliasedModuleNames.length) { + write(", "); + write(aliasedModuleNames.join(", ")); + } + if (unaliasedModuleNames.length) { + write(", "); + write(unaliasedModuleNames.join(", ")); + } + write("]"); + } + function emitAMDFactoryHeader(_a) { + var importAliasNames = _a.importAliasNames; + write("function (require, exports"); + if (importAliasNames.length) { + write(", "); + write(importAliasNames.join(", ")); + } + write(") {"); + } + function emitAMDModule(node) { + emitEmitHelpers(node); + collectExternalModuleInfo(node); + writeLine(); + write("define("); + if (node.moduleName) { + write("\"" + node.moduleName + "\", "); + } + emitAMDDependencies(node, true); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, true); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + emitExportEquals(true); + decreaseIndent(); + writeLine(); + write("});"); + } + function emitCommonJSModule(node) { + var startIndex = emitDirectivePrologues(node.statements, false); + emitEmitHelpers(node); + collectExternalModuleInfo(node); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + emitExportEquals(false); + } + function emitUMDModule(node) { + emitEmitHelpers(node); + collectExternalModuleInfo(node); + var dependencyNames = getAMDDependencyNames(node, false); + writeLines("(function (factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define("); + emitAMDDependencyList(dependencyNames); + write(", factory);"); + writeLines(" }\n})("); + emitAMDFactoryHeader(dependencyNames); + increaseIndent(); + var startIndex = emitDirectivePrologues(node.statements, true); + emitExportStarHelper(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + emitExportEquals(true); + decreaseIndent(); + writeLine(); + write("});"); + } + function emitES6Module(node) { + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = false; + var startIndex = emitDirectivePrologues(node.statements, false); + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + } + function emitExportEquals(emitAsReturn) { + if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) { + writeLine(); + emitStart(exportEquals); + write(emitAsReturn ? "return " : "module.exports = "); + emit(exportEquals.expression); + write(";"); + emitEnd(exportEquals); + } + } + function emitJsxElement(node) { + switch (compilerOptions.jsx) { + case 2: + jsxEmitReact(node); + break; + case 1: + default: + jsxEmitPreserve(node); + break; + } + } + function trimReactWhitespaceAndApplyEntities(node) { + var result = undefined; + var text = ts.getTextOfNode(node, true); + var firstNonWhitespace = 0; + var lastNonWhitespace = -1; + for (var i = 0; i < text.length; i++) { + var c = text.charCodeAt(i); + if (ts.isLineBreak(c)) { + if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { + var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); + result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); + } + firstNonWhitespace = -1; + } + else if (!ts.isWhiteSpace(c)) { + lastNonWhitespace = i; + if (firstNonWhitespace === -1) { + firstNonWhitespace = i; + } + } + } + if (firstNonWhitespace !== -1) { + var part = text.substr(firstNonWhitespace); + result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); + } + if (result) { + result = result.replace(/&(\w+);/g, function (s, m) { + if (entities[m] !== undefined) { + return String.fromCharCode(entities[m]); + } + else { + return s; + } + }); + } + return result; + } + function getTextToEmit(node) { + switch (compilerOptions.jsx) { + case 2: + var text = trimReactWhitespaceAndApplyEntities(node); + if (text === undefined || text.length === 0) { + return undefined; + } + else { + return text; + } + case 1: + default: + return ts.getTextOfNode(node, true); + } + } + function emitJsxText(node) { + switch (compilerOptions.jsx) { + case 2: + write("\""); + write(trimReactWhitespaceAndApplyEntities(node)); + write("\""); + break; + case 1: + default: + writer.writeLiteral(ts.getTextOfNode(node, true)); + break; + } + } + function emitJsxExpression(node) { + if (node.expression) { + switch (compilerOptions.jsx) { + case 1: + default: + write("{"); + emit(node.expression); + write("}"); + break; + case 2: + emit(node.expression); + break; + } + } + } + function emitDirectivePrologues(statements, startWithNewLine) { + for (var i = 0; i < statements.length; ++i) { + if (ts.isPrologueDirective(statements[i])) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statements[i]); + } + else { + return i; + } + } + return statements.length; + } + function writeLines(text) { + var lines = text.split(/\r\n|\r|\n/g); + for (var i = 0; i < lines.length; ++i) { + var line = lines[i]; + if (line.length) { + writeLine(); + write(line); + } + } + } + function emitEmitHelpers(node) { + if (!compilerOptions.noEmitHelpers) { + if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { + writeLines(extendsHelper); + extendsEmitted = true; + } + if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 16) { + writeLines(decorateHelper); + if (compilerOptions.emitDecoratorMetadata) { + writeLines(metadataHelper); + } + decorateEmitted = true; + } + if (!paramEmitted && resolver.getNodeCheckFlags(node) & 32) { + writeLines(paramHelper); + paramEmitted = true; + } + if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & 64) { + writeLines(awaiterHelper); + awaiterEmitted = true; + } + } + } + function emitSourceFileNode(node) { + writeLine(); + emitShebang(); + emitDetachedComments(node); + if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { + var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[1]; + emitModule(node); + } + else { + var startIndex = emitDirectivePrologues(node.statements, false); + externalImports = undefined; + exportSpecifiers = undefined; + exportEquals = undefined; + hasExportStars = false; + emitEmitHelpers(node); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + } + emitLeadingComments(node.endOfFileToken); + } + function emitNodeWithCommentsAndWithoutSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); + } + function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { + if (node) { + if (node.flags & 2) { + return emitCommentsOnNotEmittedNode(node); + } + if (isSpecializedCommentHandling(node)) { + return emitNodeWithoutSourceMap(node); + } + var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); + if (emitComments_1) { + emitLeadingComments(node); + } + emitNodeConsideringSourcemap(node); + if (emitComments_1) { + emitTrailingComments(node); + } + } + } + function emitNodeWithoutSourceMap(node) { + if (node) { + emitJavaScriptWorker(node); + } + } + function isSpecializedCommentHandling(node) { + switch (node.kind) { + case 215: + case 213: + case 222: + case 221: + case 216: + case 227: + return true; + } + } + function shouldEmitLeadingAndTrailingComments(node) { + switch (node.kind) { + case 193: + return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); + case 218: + return shouldEmitModuleDeclaration(node); + case 217: + return shouldEmitEnumDeclaration(node); + } + ts.Debug.assert(!isSpecializedCommentHandling(node)); + if (node.kind !== 192 && + node.parent && + node.parent.kind === 174 && + node.parent.body === node && + compilerOptions.target <= 1) { + return false; + } + return true; + } + function emitJavaScriptWorker(node) { + switch (node.kind) { + case 69: + return emitIdentifier(node); + case 138: + return emitParameter(node); + case 143: + case 142: + return emitMethod(node); + case 145: + case 146: + return emitAccessor(node); + case 97: + return emitThis(node); + case 95: + return emitSuper(node); + case 93: + return write("null"); + case 99: + return write("true"); + case 84: + return write("false"); + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + return emitLiteral(node); + case 183: + return emitTemplateExpression(node); + case 190: + return emitTemplateSpan(node); + case 233: + case 234: + return emitJsxElement(node); + case 236: + return emitJsxText(node); + case 240: + return emitJsxExpression(node); + case 135: + return emitQualifiedName(node); + case 161: + return emitObjectBindingPattern(node); + case 162: + return emitArrayBindingPattern(node); + case 163: + return emitBindingElement(node); + case 164: + return emitArrayLiteral(node); + case 165: + return emitObjectLiteral(node); + case 245: + return emitPropertyAssignment(node); + case 246: + return emitShorthandPropertyAssignment(node); + case 136: + return emitComputedPropertyName(node); + case 166: + return emitPropertyAccess(node); + case 167: + return emitIndexedAccess(node); + case 168: + return emitCallExpression(node); + case 169: + return emitNewExpression(node); + case 170: + return emitTaggedTemplateExpression(node); + case 171: + return emit(node.expression); + case 189: + return emit(node.expression); + case 172: + return emitParenExpression(node); + case 213: + case 173: + case 174: + return emitFunctionDeclaration(node); + case 175: + return emitDeleteExpression(node); + case 176: + return emitTypeOfExpression(node); + case 177: + return emitVoidExpression(node); + case 178: + return emitAwaitExpression(node); + case 179: + return emitPrefixUnaryExpression(node); + case 180: + return emitPostfixUnaryExpression(node); + case 181: + return emitBinaryExpression(node); + case 182: + return emitConditionalExpression(node); + case 185: + return emitSpreadElementExpression(node); + case 184: + return emitYieldExpression(node); + case 187: + return; + case 192: + case 219: + return emitBlock(node); + case 193: + return emitVariableStatement(node); + case 194: + return write(";"); + case 195: + return emitExpressionStatement(node); + case 196: + return emitIfStatement(node); + case 197: + return emitDoStatement(node); + case 198: + return emitWhileStatement(node); + case 199: + return emitForStatement(node); + case 201: + case 200: + return emitForInOrForOfStatement(node); + case 202: + case 203: + return emitBreakOrContinueStatement(node); + case 204: + return emitReturnStatement(node); + case 205: + return emitWithStatement(node); + case 206: + return emitSwitchStatement(node); + case 241: + case 242: + return emitCaseOrDefaultClause(node); + case 207: + return emitLabelledStatement(node); + case 208: + return emitThrowStatement(node); + case 209: + return emitTryStatement(node); + case 244: + return emitCatchClause(node); + case 210: + return emitDebuggerStatement(node); + case 211: + return emitVariableDeclaration(node); + case 186: + return emitClassExpression(node); + case 214: + return emitClassDeclaration(node); + case 215: + return emitInterfaceDeclaration(node); + case 217: + return emitEnumDeclaration(node); + case 247: + return emitEnumMember(node); + case 218: + return emitModuleDeclaration(node); + case 222: + return emitImportDeclaration(node); + case 221: + return emitImportEqualsDeclaration(node); + case 228: + return emitExportDeclaration(node); + case 227: + return emitExportAssignment(node); + case 248: + return emitSourceFileNode(node); + } + } + function hasDetachedComments(pos) { + return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; + } + function getLeadingCommentsWithoutDetachedComments() { + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); + if (detachedCommentsInfo.length - 1) { + detachedCommentsInfo.pop(); + } + else { + detachedCommentsInfo = undefined; + } + return leadingComments; + } + function isPinnedComments(comment) { + return currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; + } + function isTripleSlashComment(comment) { + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47) { + var textSubStr = currentSourceFile.text.substring(comment.pos, comment.end); + return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || + textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? + true : false; + } + return false; + } + function getLeadingCommentsToEmit(node) { + if (node.parent) { + if (node.parent.kind === 248 || node.pos !== node.parent.pos) { + if (hasDetachedComments(node.pos)) { + return getLeadingCommentsWithoutDetachedComments(); + } + else { + return ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + } + } + } + } + function getTrailingCommentsToEmit(node) { + if (node.parent) { + if (node.parent.kind === 248 || node.end !== node.parent.end) { + return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + } + } + } + function emitCommentsOnNotEmittedNode(node) { + emitLeadingCommentsWorker(node, false); + } + function emitLeadingComments(node) { + return emitLeadingCommentsWorker(node, true); + } + function emitLeadingCommentsWorker(node, isEmittedNode) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (isEmittedNode) { + leadingComments = getLeadingCommentsToEmit(node); + } + else { + if (node.pos === 0) { + leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); + } + } + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitTrailingComments(node) { + if (compilerOptions.removeComments) { + return; + } + var trailingComments = getTrailingCommentsToEmit(node); + ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + } + function emitTrailingCommentsOfPosition(pos) { + if (compilerOptions.removeComments) { + return; + } + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, pos); + ts.emitComments(currentSourceFile, writer, trailingComments, true, newLine, writeComment); + } + function emitLeadingCommentsOfPositionWorker(pos) { + if (compilerOptions.removeComments) { + return; + } + var leadingComments; + if (hasDetachedComments(pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); + } + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitDetachedComments(node) { + var leadingComments; + if (compilerOptions.removeComments) { + if (node.pos === 0) { + leadingComments = ts.filter(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), isPinnedComments); + } + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + } + if (leadingComments) { + var detachedComments = []; + var lastComment; + ts.forEach(leadingComments, function (comment) { + if (lastComment) { + var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = ts.getLineOfLocalPosition(currentSourceFile, comment.pos); + if (commentLine >= lastCommentLine + 2) { + return detachedComments; + } + } + detachedComments.push(comment); + lastComment = comment; + }); + if (detachedComments.length) { + var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, ts.lastOrUndefined(detachedComments).end); + var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); + } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; + } + } + } + } + } + function emitShebang() { + var shebang = ts.getShebang(currentSourceFile.text); + if (shebang) { + write(shebang); + } + } + var _a; + } + function emitFile(jsFilePath, sourceFile) { + emitJavaScript(jsFilePath, sourceFile); + if (compilerOptions.declaration) { + ts.writeDeclarationFile(jsFilePath, sourceFile, host, resolver, diagnostics); + } + } + } + ts.emitFiles = emitFiles; })(ts || (ts = {})); -/// -/// -/// var ts; (function (ts) { ts.programTime = 0; @@ -29816,7 +30336,7 @@ var ts; ts.ioReadTime = 0; ts.ioWriteTime = 0; var emptyArray = []; - ts.version = "1.6.2"; + ts.version = "1.7.3"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -29854,11 +30374,11 @@ var ts; if (ts.getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { var failedLookupLocations = []; var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolvedFileName = loadNodeModuleFromFile(candidate, false, failedLookupLocations, host); + var resolvedFileName = loadNodeModuleFromFile(candidate, failedLookupLocations, host); if (resolvedFileName) { return { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations }; } - resolvedFileName = loadNodeModuleFromDirectory(candidate, false, failedLookupLocations, host); + resolvedFileName = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); return resolvedFileName ? { resolvedModule: { resolvedFileName: resolvedFileName }, failedLookupLocations: failedLookupLocations } : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; @@ -29868,13 +30388,8 @@ var ts; } } ts.nodeModuleNameResolver = nodeModuleNameResolver; - function loadNodeModuleFromFile(candidate, loadOnlyDts, failedLookupLocation, host) { - if (loadOnlyDts) { - return tryLoad(".d.ts"); - } - else { - return ts.forEach(ts.supportedExtensions, tryLoad); - } + function loadNodeModuleFromFile(candidate, failedLookupLocation, host) { + return ts.forEach(ts.moduleFileExtensions, tryLoad); function tryLoad(ext) { var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (host.fileExists(fileName)) { @@ -29886,7 +30401,7 @@ var ts; } } } - function loadNodeModuleFromDirectory(candidate, loadOnlyDts, failedLookupLocation, host) { + function loadNodeModuleFromDirectory(candidate, failedLookupLocation, host) { var packageJsonPath = ts.combinePaths(candidate, "package.json"); if (host.fileExists(packageJsonPath)) { var jsonContent; @@ -29898,7 +30413,7 @@ var ts; jsonContent = { typings: undefined }; } if (jsonContent.typings) { - var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), loadOnlyDts, failedLookupLocation, host); + var result = loadNodeModuleFromFile(ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host); if (result) { return result; } @@ -29907,7 +30422,7 @@ var ts; else { failedLookupLocation.push(packageJsonPath); } - return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), loadOnlyDts, failedLookupLocation, host); + return loadNodeModuleFromFile(ts.combinePaths(candidate, "index"), failedLookupLocation, host); } function loadModuleFromNodeModules(moduleName, directory, host) { var failedLookupLocations = []; @@ -29917,11 +30432,11 @@ var ts; if (baseName !== "node_modules") { var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadNodeModuleFromFile(candidate, true, failedLookupLocations, host); + var result = loadNodeModuleFromFile(candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } - result = loadNodeModuleFromDirectory(candidate, true, failedLookupLocations, host); + result = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host); if (result) { return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations: failedLookupLocations }; } @@ -29939,7 +30454,7 @@ var ts; return i === 0 || (i === 1 && name.charCodeAt(0) === 46); } function classicNameResolver(moduleName, containingFile, compilerOptions, host) { - if (moduleName.indexOf('!') != -1) { + if (moduleName.indexOf("!") != -1) { return { resolvedModule: undefined, failedLookupLocations: [] }; } var searchPath = ts.getDirectoryPath(containingFile); @@ -30248,7 +30763,7 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return filesByName.get(fileName); + return filesByName.get(fileName) || filesByName.get(ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory())); } function getDiagnosticsHelper(sourceFile, getDiagnostics, cancellationToken) { if (sourceFile) { @@ -30337,10 +30852,14 @@ var ts; var imports; for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; + collect(node, true); + } + file.imports = imports || emptyArray; + function collect(node, allowRelativeModuleNames) { switch (node.kind) { - case 220: - case 219: - case 226: + case 222: + case 221: + case 228: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; @@ -30348,24 +30867,19 @@ var ts; if (!moduleNameExpr.text) { break; } - (imports || (imports = [])).push(moduleNameExpr); + if (allowRelativeModuleNames || !ts.isExternalModuleNameRelative(moduleNameExpr.text)) { + (imports || (imports = [])).push(moduleNameExpr); + } break; - case 216: + case 218: if (node.name.kind === 9 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 9) { - var moduleName = ts.getExternalModuleImportEqualsDeclarationExpression(node); - if (moduleName) { - (imports || (imports = [])).push(moduleName); - } - } + collect(node, false); }); } break; } } - file.imports = imports || emptyArray; } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var diagnosticArgument; @@ -30408,48 +30922,46 @@ var ts; } } function findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { - var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); - if (filesByName.contains(canonicalName)) { - return getSourceFileFromCache(fileName, canonicalName, false); + if (filesByName.contains(fileName)) { + return getSourceFileFromCache(fileName, false); } - else { - var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); - var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); - if (filesByName.contains(canonicalAbsolutePath)) { - return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, true); - } - var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { - if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { - fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); - } - else { - fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); - } - }); - filesByName.set(canonicalName, file); - if (file) { - skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; - filesByName.set(canonicalAbsolutePath, file); - var basePath = ts.getDirectoryPath(fileName); - if (!options.noResolve) { - processReferencedFiles(file, basePath); - } - processImportedModules(file, basePath); - if (isDefaultLib) { - file.isDefaultLib = true; - files.unshift(file); - } - else { - files.push(file); - } - } - return file; + var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + if (filesByName.contains(normalizedAbsolutePath)) { + var file_1 = getSourceFileFromCache(normalizedAbsolutePath, true); + filesByName.set(fileName, file_1); + return file_1; } - function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) { - var file = filesByName.get(canonicalName); + var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + else { + fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + }); + filesByName.set(fileName, file); + if (file) { + skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; + filesByName.set(normalizedAbsolutePath, file); + var basePath = ts.getDirectoryPath(fileName); + if (!options.noResolve) { + processReferencedFiles(file, basePath); + } + processImportedModules(file, basePath); + if (isDefaultLib) { + file.isDefaultLib = true; + files.unshift(file); + } + else { + files.push(file); + } + } + return file; + function getSourceFileFromCache(fileName, useAbsolutePath) { + var file = filesByName.get(fileName); if (file && host.useCaseSensitiveFileNames()) { var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; - if (canonicalName !== sourceFileName) { + if (ts.normalizeSlashes(fileName) !== ts.normalizeSlashes(sourceFileName)) { if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { fileProcessingDiagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } @@ -30481,11 +30993,7 @@ var ts; if (importedFile && resolution.isExternalLibraryImport) { if (!ts.isExternalModule(importedFile)) { var start_2 = ts.getTokenPosOfNode(file.imports[i], file); - fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.File_0_is_not_a_module, importedFile.fileName)); - } - else if (!ts.fileExtensionIs(importedFile.fileName, ".d.ts")) { - var start_3 = ts.getTokenPosOfNode(file.imports[i], file); - fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_3, file.imports[i].end - start_3, ts.Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition)); + fileProcessingDiagnostics.add(ts.createFileDiagnostic(file, start_2, file.imports[i].end - start_2, ts.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); } else if (importedFile.referencedFiles.length) { var firstRef = importedFile.referencedFiles[0]; @@ -30610,8 +31118,8 @@ var ts; var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); programDiagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } - if (options.module && languageVersion >= 2) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); + if (options.module === 5 && languageVersion < 2) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower)); } if (options.outDir || options.sourceRoot || @@ -30645,17 +31153,10 @@ var ts; !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } - if (options.experimentalAsyncFunctions && - options.target !== 2) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower)); - } } } ts.createProgram = createProgram; })(ts || (ts = {})); -// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. -// See LICENSE.txt in the project root for complete license information. -/// var ts; (function (ts) { var BreakpointResolver; @@ -30694,98 +31195,98 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 195) { + if (node.parent.kind === 197) { return spanInPreviousNode(node); } - if (node.parent.kind === 197) { + if (node.parent.kind === 199) { return textSpan(node); } - if (node.parent.kind === 179 && node.parent.operatorToken.kind === 24) { + if (node.parent.kind === 181 && node.parent.operatorToken.kind === 24) { return textSpan(node); } - if (node.parent.kind === 172 && node.parent.body === node) { + if (node.parent.kind === 174 && node.parent.body === node) { return textSpan(node); } } switch (node.kind) { - case 191: + case 193: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 209: - case 139: - case 138: - return spanInVariableDeclaration(node); - case 136: - return spanInParameterDeclaration(node); case 211: case 141: case 140: + return spanInVariableDeclaration(node); + case 138: + return spanInParameterDeclaration(node); + case 213: case 143: - case 144: case 142: - case 171: - case 172: + case 145: + case 146: + case 144: + case 173: + case 174: return spanInFunctionDeclaration(node); - case 190: + case 192: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 217: + case 219: return spanInBlock(node); - case 242: + case 244: return spanInBlock(node.block); - case 193: + case 195: return textSpan(node.expression); - case 202: + case 204: return textSpan(node.getChildAt(0), node.expression); + case 198: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 197: + return spanInNode(node.statement); + case 210: + return textSpan(node.getChildAt(0)); case 196: return textSpan(node, ts.findNextToken(node.expression, node)); - case 195: - return spanInNode(node.statement); - case 208: - return textSpan(node.getChildAt(0)); - case 194: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 205: - return spanInNode(node.statement); - case 201: - case 200: - return textSpan(node.getChildAt(0), node.label); - case 197: - return spanInForStatement(node); - case 198: - case 199: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 204: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 239: - case 240: - return spanInNode(node.statements[0]); case 207: - return spanInBlock(node.tryBlock); + return spanInNode(node.statement); + case 203: + case 202: + return textSpan(node.getChildAt(0), node.label); + case 199: + return spanInForStatement(node); + case 200: + case 201: + return textSpan(node, ts.findNextToken(node.expression, node)); case 206: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 241: + case 242: + return spanInNode(node.statements[0]); + case 209: + return spanInBlock(node.tryBlock); + case 208: return textSpan(node, node.expression); - case 225: + case 227: return textSpan(node, node.expression); - case 219: + case 221: return textSpan(node, node.moduleReference); - case 220: + case 222: return textSpan(node, node.moduleSpecifier); - case 226: + case 228: return textSpan(node, node.moduleSpecifier); - case 216: + case 218: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 212: - case 215: - case 245: - case 166: - case 167: - return textSpan(node); - case 203: - return spanInNode(node.statement); - case 213: case 214: + case 217: + case 247: + case 168: + case 169: + return textSpan(node); + case 205: + return spanInNode(node.statement); + case 215: + case 216: return undefined; case 23: case 1: @@ -30800,22 +31301,22 @@ var ts; return spanInOpenParenToken(node); case 18: return spanInCloseParenToken(node); - case 53: + case 54: return spanInColonToken(node); case 27: case 25: return spanInGreaterThanOrLessThanToken(node); - case 102: + case 104: return spanInWhileKeyword(node); - case 78: - case 70: - case 83: + case 80: + case 72: + case 85: return spanInNextNode(node); default: - if (node.parent.kind === 243 && node.parent.name === node) { + if (node.parent.kind === 245 && node.parent.name === node) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 169 && node.parent.type === node) { + if (node.parent.kind === 171 && node.parent.type === node) { return spanInNode(node.parent.expression); } if (ts.isFunctionLike(node.parent) && node.parent.type === node) { @@ -30825,12 +31326,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 198 || - variableDeclaration.parent.parent.kind === 199) { + if (variableDeclaration.parent.parent.kind === 200 || + variableDeclaration.parent.parent.kind === 201) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 191; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 197 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 193; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 199 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -30876,7 +31377,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 212 && functionDeclaration.kind !== 142); + (functionDeclaration.parent.kind === 214 && functionDeclaration.kind !== 144); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -30896,23 +31397,23 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 216: + case 218: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 196: - case 194: case 198: - case 199: + case 196: + case 200: + case 201: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); - case 197: + case 199: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 210) { + if (forStatement.initializer.kind === 212) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -30931,34 +31432,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 215: + case 217: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 212: + case 214: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 218: + case 220: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 217: + case 219: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } - case 215: - case 212: + case 217: + case 214: return textSpan(node); - case 190: + case 192: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 242: + case 244: return spanInNode(ts.lastOrUndefined(node.parent.statements)); ; - case 218: + case 220: var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); if (lastClause) { @@ -30970,24 +31471,24 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 195) { + if (node.parent.kind === 197) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 171: - case 211: - case 172: - case 141: - case 140: + case 173: + case 213: + case 174: case 143: - case 144: case 142: - case 196: - case 195: + case 145: + case 146: + case 144: + case 198: case 197: + case 199: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -30995,19 +31496,19 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 243) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 245) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 169) { + if (node.parent.kind === 171) { return spanInNode(node.parent.expression); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 195) { + if (node.parent.kind === 197) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); @@ -31085,7 +31586,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 172; + return ts.isFunctionBlock(node) && node.parent.kind !== 174; } var depth = 0; var maxDepth = 20; @@ -31097,30 +31598,30 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 190: + case 192: if (!ts.isFunctionBlock(n)) { var parent_7 = n.parent; var openBrace = ts.findChildOfKind(n, 15, sourceFile); var closeBrace = ts.findChildOfKind(n, 16, sourceFile); - if (parent_7.kind === 195 || - parent_7.kind === 198 || + if (parent_7.kind === 197 || + parent_7.kind === 200 || + parent_7.kind === 201 || parent_7.kind === 199 || - parent_7.kind === 197 || - parent_7.kind === 194 || parent_7.kind === 196 || - parent_7.kind === 203 || - parent_7.kind === 242) { + parent_7.kind === 198 || + parent_7.kind === 205 || + parent_7.kind === 244) { addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_7.kind === 207) { + if (parent_7.kind === 209) { var tryStatement = parent_7; if (tryStatement.tryBlock === n) { addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 83, sourceFile); + var finallyKeyword = ts.findChildOfKind(tryStatement, 85, sourceFile); if (finallyKeyword) { addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n)); break; @@ -31136,23 +31637,23 @@ var ts; }); break; } - case 217: { + case 219: { var openBrace = ts.findChildOfKind(n, 15, sourceFile); var closeBrace = ts.findChildOfKind(n, 16, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 212: - case 213: + case 214: case 215: - case 163: - case 218: { + case 217: + case 165: + case 220: { var openBrace = ts.findChildOfKind(n, 15, sourceFile); var closeBrace = ts.findChildOfKind(n, 16, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 162: + case 164: var openBracket = ts.findChildOfKind(n, 19, sourceFile); var closeBracket = ts.findChildOfKind(n, 20, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -31178,10 +31679,10 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_28 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_28); + for (var name_29 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_29); if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_28); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_29); if (!matches) { continue; } @@ -31192,14 +31693,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_28); + matches = patternMatcher.getMatches(containers, name_29); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_28, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_29, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -31222,7 +31723,7 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 67 || + if (node.kind === 69 || node.kind === 9 || node.kind === 8) { return node.text; @@ -31236,7 +31737,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 134) { + else if (declaration.name.kind === 136) { return tryAddComputedPropertyName(declaration.name.expression, containers, true); } else { @@ -31253,7 +31754,7 @@ var ts; } return true; } - if (expression.kind === 164) { + if (expression.kind === 166) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -31264,7 +31765,7 @@ var ts; } function getContainers(declaration) { var containers = []; - if (declaration.name.kind === 134) { + if (declaration.name.kind === 136) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { return undefined; } @@ -31315,7 +31816,6 @@ var ts; NavigateTo.getNavigateToItems = getNavigateToItems; })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var NavigationBar; @@ -31328,14 +31828,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 216: + case 218: do { current = current.parent; - } while (current.kind === 216); - case 212: + } while (current.kind === 218); + case 214: + case 217: case 215: case 213: - case 211: indent++; } current = current.parent; @@ -31346,26 +31846,26 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 191: + case 193: ts.forEach(node.declarationList.declarations, visit); break; - case 159: - case 160: + case 161: + case 162: ts.forEach(node.elements, visit); break; - case 226: + case 228: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 220: + case 222: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 222) { + if (importClause.namedBindings.kind === 224) { childNodes.push(importClause.namedBindings); } else { @@ -31374,20 +31874,20 @@ var ts; } } break; - case 161: - case 209: + case 163: + case 211: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 212: + case 214: + case 217: case 215: + case 218: case 213: - case 216: - case 211: - case 219: - case 224: - case 228: + case 221: + case 226: + case 230: childNodes.push(node); break; } @@ -31422,17 +31922,17 @@ var ts; for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 212: + case 214: + case 217: case 215: - case 213: topLevelNodes.push(node); break; - case 216: + case 218: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 211: + case 213: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -31443,9 +31943,9 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 211) { - if (functionDeclaration.body && functionDeclaration.body.kind === 190) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 211 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 213) { + if (functionDeclaration.body && functionDeclaration.body.kind === 192) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 213 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -31498,7 +31998,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 136: + case 138: if (ts.isBindingPattern(node.name)) { break; } @@ -31506,34 +32006,34 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 143: + case 142: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); + case 145: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); + case 146: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); + case 149: + return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); + case 247: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 147: + return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); + case 148: + return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); case 141: case 140: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 143: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 144: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 147: - return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 245: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 145: - return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 146: - return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 139: - case 138: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 211: + case 213: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 209: - case 161: + case 211: + case 163: var variableDeclarationNode; - var name_29; - if (node.kind === 161) { - name_29 = node.name; + var name_30; + if (node.kind === 163) { + name_30 = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 209) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 211) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -31541,24 +32041,24 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_29 = node.name; + name_30 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_30), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_30), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_30), ts.ScriptElementKind.variableElement); } - case 142: + case 144: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 228: - case 224: - case 219: + case 230: + case 226: case 221: - case 222: + case 223: + case 224: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -31588,17 +32088,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 246: + case 248: return createSourceFileItem(node); - case 212: + case 214: return createClassItem(node); - case 215: + case 217: return createEnumItem(node); - case 213: + case 215: return createIterfaceItem(node); - case 216: + case 218: return createModuleItem(node); - case 211: + case 213: return createFunctionItem(node); } return undefined; @@ -31608,7 +32108,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 216) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 218) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -31620,7 +32120,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 190) { + if (node.body && node.body.kind === 192) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -31641,7 +32141,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 142 && member; + return member.kind === 144 && member; }); var nodes = removeDynamicallyNamedProperties(node); if (constructor) { @@ -31662,19 +32162,19 @@ var ts; } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 134; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 136; }); } function removeDynamicallyNamedProperties(node) { return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 216) { + while (node.body.kind === 218) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 246 + return node.kind === 248 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -32136,7 +32636,6 @@ var ts; return transition; } })(ts || (ts = {})); -/// var ts; (function (ts) { var SignatureHelp; @@ -32165,14 +32664,14 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 166) { + if (argumentInfo.invocation.kind !== 168) { return undefined; } var callExpression = argumentInfo.invocation; var expression = callExpression.expression; - var name = expression.kind === 67 + var name = expression.kind === 69 ? expression - : expression.kind === 164 + : expression.kind === 166 ? expression.name : undefined; if (!name || !name.text) { @@ -32201,7 +32700,7 @@ var ts; } } function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 166 || node.parent.kind === 167) { + if (node.parent.kind === 168 || node.parent.kind === 169) { var callExpression = node.parent; if (node.kind === 25 || node.kind === 17) { @@ -32232,23 +32731,23 @@ var ts; }; } } - else if (node.kind === 11 && node.parent.kind === 168) { + else if (node.kind === 11 && node.parent.kind === 170) { if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0); } } - else if (node.kind === 12 && node.parent.parent.kind === 168) { + else if (node.kind === 12 && node.parent.parent.kind === 170) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 181); + ts.Debug.assert(templateExpression.kind === 183); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 188 && node.parent.parent.parent.kind === 168) { + else if (node.parent.kind === 190 && node.parent.parent.parent.kind === 170) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 181); + ts.Debug.assert(templateExpression.kind === 183); if (node.kind === 14 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } @@ -32312,7 +32811,7 @@ var ts; var template = taggedTemplate.template; var applicableSpanStart = template.getStart(); var applicableSpanEnd = template.getEnd(); - if (template.kind === 181) { + if (template.kind === 183) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -32321,7 +32820,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 246; n = n.parent) { + for (var n = node; n.kind !== 248; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -32501,39 +33000,39 @@ var ts; return false; } switch (n.kind) { - case 212: - case 213: + case 214: case 215: - case 163: - case 159: - case 153: - case 190: case 217: - case 218: + case 165: + case 161: + case 155: + case 192: + case 219: + case 220: return nodeEndsWith(n, 16, sourceFile); - case 242: + case 244: return isCompletedNode(n.block, sourceFile); - case 167: + case 169: if (!n.arguments) { return true; } - case 166: - case 170: - case 158: - return nodeEndsWith(n, 18, sourceFile); - case 150: - case 151: - return isCompletedNode(n.type, sourceFile); - case 142: - case 143: - case 144: - case 211: - case 171: - case 141: - case 140: - case 146: - case 145: + case 168: case 172: + case 160: + return nodeEndsWith(n, 18, sourceFile); + case 152: + case 153: + return isCompletedNode(n.type, sourceFile); + case 144: + case 145: + case 146: + case 213: + case 173: + case 143: + case 142: + case 148: + case 147: + case 174: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -32541,61 +33040,62 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 18, sourceFile); - case 216: + case 218: return n.body && isCompletedNode(n.body, sourceFile); - case 194: + case 196: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 193: - return isCompletedNode(n.expression, sourceFile); + case 195: + return isCompletedNode(n.expression, sourceFile) || + hasChildOfKind(n, 23); + case 164: case 162: - case 160: - case 165: - case 134: - case 155: + case 167: + case 136: + case 157: return nodeEndsWith(n, 20, sourceFile); - case 147: + case 149: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 20, sourceFile); - case 239: - case 240: + case 241: + case 242: return false; - case 197: - case 198: case 199: - case 196: + case 200: + case 201: + case 198: return isCompletedNode(n.statement, sourceFile); - case 195: - var hasWhileKeyword = findChildOfKind(n, 102, sourceFile); + case 197: + var hasWhileKeyword = findChildOfKind(n, 104, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 18, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 152: + case 154: return isCompletedNode(n.exprName, sourceFile); - case 174: - case 173: + case 176: case 175: - case 182: - case 183: + case 177: + case 184: + case 185: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 168: + case 170: return isCompletedNode(n.template, sourceFile); - case 181: + case 183: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 188: + case 190: return ts.nodeIsPresent(n.literal); - case 177: - return isCompletedNode(n.operand, sourceFile); case 179: + return isCompletedNode(n.operand, sourceFile); + case 181: return isCompletedNode(n.right, sourceFile); - case 180: + case 182: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -32638,7 +33138,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 269 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 271 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -32718,7 +33218,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n) || n.kind === 234) { + if (isToken(n) || n.kind === 236) { return n; } var children = n.getChildren(); @@ -32726,16 +33226,16 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n) || n.kind === 234) { + if (isToken(n) || n.kind === 236) { return n; } var children = n.getChildren(); for (var i = 0, len = children.length; i < len; i++) { var child = children[i]; - if (position < child.end && (nodeHasTokens(child) || child.kind === 234)) { + if (position < child.end && (nodeHasTokens(child) || child.kind === 236)) { var start = child.getStart(sourceFile); var lookInPreviousChild = (start >= position) || - (child.kind === 234 && start === child.end); + (child.kind === 236 && start === child.end); if (lookInPreviousChild) { var candidate = findRightmostChildNodeWithTokens(children, i); return candidate && findRightmostToken(candidate); @@ -32745,7 +33245,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 246); + ts.Debug.assert(startNode !== undefined || n.kind === 248); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -32797,9 +33297,9 @@ var ts; var node = ts.getTokenAtPosition(sourceFile, position); if (isToken(node)) { switch (node.kind) { - case 100: - case 106: - case 72: + case 102: + case 108: + case 74: node = node.parent === undefined ? undefined : node.parent.parent; break; default: @@ -32845,21 +33345,21 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 149 || node.kind === 166) { + if (node.kind === 151 || node.kind === 168) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 212 || node.kind === 213) { + if (ts.isFunctionLike(node) || node.kind === 214 || node.kind === 215) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 && n.kind <= 132; + return n.kind >= 0 && n.kind <= 134; } ts.isToken = isToken; function isWord(kind) { - return kind === 67 || ts.isKeyword(kind); + return kind === 69 || ts.isKeyword(kind); } ts.isWord = isWord; function isPropertyName(kind) { @@ -32869,8 +33369,17 @@ var ts; return kind === 2 || kind === 3; } ts.isComment = isComment; + function isStringOrRegularExpressionOrTemplateLiteral(kind) { + if (kind === 9 + || kind === 10 + || ts.isTemplateLiteralKind(kind)) { + return true; + } + return false; + } + ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral; function isPunctuation(kind) { - return 15 <= kind && kind <= 66; + return 15 <= kind && kind <= 68; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position) { @@ -32880,9 +33389,9 @@ var ts; ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function isAccessibilityModifier(kind) { switch (kind) { + case 112: case 110: - case 108: - case 109: + case 111: return true; } return false; @@ -32908,7 +33417,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 136; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 138; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -32930,7 +33439,8 @@ var ts; increaseIndent: function () { indent++; }, decreaseIndent: function () { indent--; }, clear: resetWriter, - trackSymbol: function () { } + trackSymbol: function () { }, + reportInaccessibleThisError: function () { } }; function writeIndent() { if (lineStart) { @@ -33088,7 +33598,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 224 || location.parent.kind === 228) && + (location.parent.kind === 226 || location.parent.kind === 230) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -33104,14 +33614,16 @@ var ts; } ts.stripQuotes = stripQuotes; })(ts || (ts = {})); -/// -/// var ts; (function (ts) { var formatting; (function (formatting) { - var scanner = ts.createScanner(2, false); + var standardScanner = ts.createScanner(2, false, 0); + var jsxScanner = ts.createScanner(2, false, 1); + var scanner; function getFormattingScanner(sourceFile, startPos, endPos) { + ts.Debug.assert(scanner === undefined); + scanner = sourceFile.languageVariant === 1 ? jsxScanner : standardScanner; scanner.setText(sourceFile.text); scanner.setTextPos(startPos); var wasNewLine = true; @@ -33126,11 +33638,14 @@ var ts; isOnToken: isOnToken, lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, close: function () { + ts.Debug.assert(scanner !== undefined); lastTokenInfo = undefined; scanner.setText(undefined); + scanner = undefined; } }; function advance() { + ts.Debug.assert(scanner !== undefined); lastTokenInfo = undefined; var isStarted = scanner.getStartPos() !== startPos; if (isStarted) { @@ -33172,10 +33687,10 @@ var ts; if (node) { switch (node.kind) { case 29: - case 62: - case 63: + case 64: + case 65: + case 45: case 44: - case 43: return true; } } @@ -33184,11 +33699,11 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 236: - case 233: + case 238: case 235: - case 232: - return node.kind === 67; + case 237: + case 234: + return node.kind === 69; } } return false; @@ -33201,9 +33716,10 @@ var ts; container.kind === 14; } function startsWithSlashToken(t) { - return t === 38 || t === 59; + return t === 39 || t === 61; } function readTokenInfo(n) { + ts.Debug.assert(scanner !== undefined); if (!isOnToken()) { return { leadingTrivia: leadingTrivia, @@ -33243,7 +33759,7 @@ var ts; currentToken = scanner.reScanTemplateToken(); lastScanAction = 3; } - else if (expectedScanAction === 4 && currentToken === 67) { + else if (expectedScanAction === 4 && currentToken === 69) { currentToken = scanner.scanJsxIdentifier(); lastScanAction = 4; } @@ -33285,6 +33801,7 @@ var ts; return fixTokenKind(lastTokenInfo, n); } function isOnToken() { + ts.Debug.assert(scanner !== undefined); var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); return startPos < endPos && current !== 1 && !ts.isTrivia(current); @@ -33299,7 +33816,6 @@ var ts; formatting.getFormattingScanner = getFormattingScanner; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var formatting; @@ -33378,8 +33894,6 @@ var ts; formatting.FormattingContext = FormattingContext; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// -/// var ts; (function (ts) { var formatting; @@ -33401,8 +33915,6 @@ var ts; formatting.Rule = Rule; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// -/// var ts; (function (ts) { var formatting; @@ -33433,8 +33945,6 @@ var ts; formatting.RuleDescriptor = RuleDescriptor; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// -/// var ts; (function (ts) { var formatting; @@ -33462,7 +33972,6 @@ var ts; formatting.RuleOperation = RuleOperation; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var formatting; @@ -33496,28 +34005,24 @@ var ts; formatting.RuleOperationContext = RuleOperationContext; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var formatting; (function (formatting) { var Rules = (function () { function Rules() { - /// - /// Common Rules - /// this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1)); this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1)); this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); - this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 52), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); - this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2)); - this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(52, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); - this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(52, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2)); + this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); + this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); - this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16, 78), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16, 102), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16, 80), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16, 104), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.FromTokens([18, 20, 24, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); @@ -33525,9 +34030,9 @@ var ts; this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8)); this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([67, 3, 71]); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([69, 3, 73]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18, 3, 77, 98, 83, 78]); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18, 3, 79, 100, 85, 80]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); @@ -33535,37 +34040,37 @@ var ts; this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); - this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(40, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 40), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(40, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(41, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35, 40), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(41, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(42, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36, 42), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([100, 96, 90, 76, 92, 99]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([106, 72]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([102, 98, 92, 78, 94, 101, 119]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([108, 74]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); - this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(85, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(87, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); - this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(101, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); - this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(92, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18, 77, 78, 69]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([98, 83]), 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([121, 127]), 67), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(103, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(94, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18, 79, 80, 71]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([100, 85]), 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123, 129]), 69), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(119, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123, 125]), 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([113, 71, 120, 75, 79, 80, 81, 121, 104, 87, 105, 123, 124, 108, 110, 109, 127, 111]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([81, 104])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(121, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([125, 127]), 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115, 73, 122, 77, 81, 82, 83, 123, 106, 89, 107, 125, 126, 110, 112, 111, 129, 113, 132]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([83, 106])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22, 67), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(52, formatting.Shared.TokenRange.FromTokens([18, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22, 69), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.FromTokens([18, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); @@ -33573,27 +34078,18 @@ var ts; this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.FromTokens([17, 19, 27, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeAssertionContext), 8)); this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); - this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([113, 67, 80, 75, 71, 111, 110, 108, 109, 121, 127, 19, 37])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); - this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(85, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8)); - this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37, formatting.Shared.TokenRange.FromTokens([67, 17])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2)); - this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(112, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); - this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([112, 37]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2)); - this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(116, 85), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(116, 85), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterAwaitKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(117, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterAwaitKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(117, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterTypeKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(130, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterTypeKeyword = new formatting.Rule(formatting.RuleDescriptor.create3(130, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67, formatting.Shared.TokenRange.FromTokens([11, 12])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(67, formatting.Shared.TokenRange.FromTokens([11, 12])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBeforeBar = new formatting.Rule(formatting.RuleDescriptor.create3(46, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceBeforeBar = new formatting.Rule(formatting.RuleDescriptor.create3(46, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterBar = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 46), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBeforeAmpersand = new formatting.Rule(formatting.RuleDescriptor.create3(45, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterAmpersand = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 45), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(55, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([115, 69, 82, 77, 73, 113, 112, 110, 111, 123, 129, 19, 37])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); + this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(87, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8)); + this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37, formatting.Shared.TokenRange.FromTokens([69, 17])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2)); + this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(114, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); + this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([114, 37]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2)); + this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(118, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsSameLineTokenContext), 2)); + this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(118, 87), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(69, formatting.Shared.TokenRange.FromTokens([11, 12])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12, 13]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13, 14])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -33619,12 +34115,8 @@ var ts; this.NoSpaceBeforeOpenParenInFuncCall, this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, this.SpaceAfterVoidOperator, - this.SpaceBetweenAsyncAndFunctionKeyword, this.NoSpaceBetweenAsyncAndFunctionKeyword, - this.SpaceAfterAwaitKeyword, this.NoSpaceAfterAwaitKeyword, - this.SpaceAfterTypeKeyword, this.NoSpaceAfterTypeKeyword, - this.SpaceBetweenTagAndTemplateString, this.NoSpaceBetweenTagAndTemplateString, - this.SpaceBeforeBar, this.NoSpaceBeforeBar, this.SpaceAfterBar, this.NoSpaceAfterBar, - this.SpaceBeforeAmpersand, this.SpaceAfterAmpersand, + this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword, + this.SpaceBetweenTagAndTemplateString, this.NoSpaceAfterTemplateHeadAndMiddle, this.NoSpaceBeforeTemplateMiddleAndTail, this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, @@ -33676,44 +34168,46 @@ var ts; this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); - this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8)); + this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8)); } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_30 in o) { - if (o[name_30] === rule) { - return name_30; + for (var name_31 in o) { + if (o[name_31] === rule) { + return name_31; } } throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 197; + return context.contextNode.kind === 199; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 179: - case 180: - case 187: - case 148: + case 181: + case 182: + case 189: + case 150: + case 158: + case 159: return true; - case 161: - case 214: - case 219: - case 209: - case 136: - case 245: - case 139: + case 163: + case 216: + case 221: + case 211: case 138: - return context.currentTokenSpan.kind === 55 || context.nextTokenSpan.kind === 55; - case 198: - return context.currentTokenSpan.kind === 88 || context.nextTokenSpan.kind === 88; - case 199: - return context.currentTokenSpan.kind === 132 || context.nextTokenSpan.kind === 132; + case 247: + case 141: + case 140: + return context.currentTokenSpan.kind === 56 || context.nextTokenSpan.kind === 56; + case 200: + return context.currentTokenSpan.kind === 90 || context.nextTokenSpan.kind === 90; + case 201: + return context.currentTokenSpan.kind === 134 || context.nextTokenSpan.kind === 134; } return false; }; @@ -33721,25 +34215,9 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 180; + return context.contextNode.kind === 182; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { - //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. - //// - //// Ex: - //// if (1) { .... - //// * ) and { are on the same line so apply the rule. Here we don't care whether it's same or multi block context - //// - //// Ex: - //// if (1) - //// { ... } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we don't format. - //// - //// Ex: - //// if (1) - //// { ... - //// } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we format. return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; Rules.IsBeforeMultilineBlockContext = function (context) { @@ -33762,86 +34240,86 @@ var ts; return true; } switch (node.kind) { - case 190: - case 218: - case 163: - case 217: + case 192: + case 220: + case 165: + case 219: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 211: - case 141: - case 140: - case 143: - case 144: - case 145: - case 171: - case 142: - case 172: case 213: + case 143: + case 142: + case 145: + case 146: + case 147: + case 173: + case 144: + case 174: + case 215: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 211 || context.contextNode.kind === 171; + return context.contextNode.kind === 213 || context.contextNode.kind === 173; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 212: - case 184: - case 213: + case 214: + case 186: case 215: - case 153: - case 216: + case 217: + case 155: + case 218: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 212: - case 216: - case 215: - case 190: - case 242: + case 214: + case 218: case 217: - case 204: + case 192: + case 244: + case 219: + case 206: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 194: - case 204: - case 197: - case 198: - case 199: case 196: - case 207: - case 195: - case 203: - case 242: + case 206: + case 199: + case 200: + case 201: + case 198: + case 209: + case 197: + case 205: + case 244: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 163; + return context.contextNode.kind === 165; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 166; + return context.contextNode.kind === 168; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 167; + return context.contextNode.kind === 169; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -33849,6 +34327,9 @@ var ts; Rules.IsPreviousTokenNotComma = function (context) { return context.currentTokenSpan.kind !== 24; }; + Rules.IsArrowFunctionContext = function (context) { + return context.contextNode.kind === 174; + }; Rules.IsSameLineTokenContext = function (context) { return context.TokensAreOnSameLine(); }; @@ -33865,41 +34346,41 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 137; + return node.kind === 139; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 210 && + return context.currentTokenParent.kind === 212 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 216; + return context.contextNode.kind === 218; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 153; + return context.contextNode.kind === 155; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 25 && token.kind !== 27) { return false; } switch (parent.kind) { - case 149: - case 169: - case 212: - case 184: - case 213: - case 211: + case 151: case 171: - case 172: - case 141: - case 140: - case 145: - case 146: - case 166: - case 167: + case 214: case 186: + case 215: + case 213: + case 173: + case 174: + case 143: + case 142: + case 147: + case 148: + case 168: + case 169: + case 188: return true; default: return false; @@ -33910,20 +34391,19 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 169; + return context.contextNode.kind === 171; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 101 && context.currentTokenParent.kind === 175; + return context.currentTokenSpan.kind === 103 && context.currentTokenParent.kind === 177; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 182 && context.contextNode.expression !== undefined; + return context.contextNode.kind === 184 && context.contextNode.expression !== undefined; }; return Rules; })(); formatting.Rules = Rules; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var formatting; @@ -33939,7 +34419,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 132 + 1; + this.mapRowLength = 134 + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); var rulesBucketConstructionStateList = new Array(this.map.length); this.FillRules(rules, rulesBucketConstructionStateList); @@ -34060,7 +34540,6 @@ var ts; formatting.RulesBucket = RulesBucket; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var formatting; @@ -34116,7 +34595,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0; token <= 132; token++) { + for (var token = 0; token <= 134; token++) { result.push(token); } return result; @@ -34158,36 +34637,23 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); - TokenRange.Keywords = TokenRange.FromRange(68, 132); - TokenRange.BinaryOperators = TokenRange.FromRange(25, 66); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([88, 89, 132, 114, 122]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([40, 41, 49, 48]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 67, 17, 19, 15, 95, 90]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([67, 17, 95, 90]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([67, 18, 20, 90]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([67, 17, 95, 90]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([67, 18, 20, 90]); + TokenRange.Keywords = TokenRange.FromRange(70, 134); + TokenRange.BinaryOperators = TokenRange.FromRange(25, 68); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90, 91, 134, 116, 124]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([41, 42, 50, 49]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 69, 17, 19, 15, 97, 92]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([69, 17, 97, 92]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([69, 18, 20, 92]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([69, 17, 97, 92]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([69, 18, 20, 92]); TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([67, 126, 128, 118, 129, 101, 115]); + TokenRange.TypeNames = TokenRange.FromTokens([69, 128, 130, 120, 131, 103, 117]); return TokenRange; })(); Shared.TokenRange = TokenRange; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// var ts; (function (ts) { var formatting; @@ -34283,10 +34749,6 @@ var ts; formatting.RulesProvider = RulesProvider; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// -/// -/// -/// var ts; (function (ts) { var formatting; @@ -34356,17 +34818,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 212: - case 213: + case 214: + case 215: return ts.rangeContainsRange(parent.members, node); - case 216: + case 218: var body = parent.body; - return body && body.kind === 190 && ts.rangeContainsRange(body.statements, node); - case 246: - case 190: - case 217: + return body && body.kind === 192 && ts.rangeContainsRange(body.statements, node); + case 248: + case 192: + case 219: return ts.rangeContainsRange(parent.statements, node); - case 242: + case 244: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -34491,9 +34953,9 @@ var ts; if (indentation === -1) { if (isSomeBlock(node.kind)) { if (isSomeBlock(parent.kind) || - parent.kind === 246 || - parent.kind === 239 || - parent.kind === 240) { + parent.kind === 248 || + parent.kind === 241 || + parent.kind === 242) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -34526,30 +34988,31 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 212: return 71; - case 213: return 105; - case 211: return 85; - case 215: return 215; - case 143: return 121; - case 144: return 127; - case 141: + case 214: return 73; + case 215: return 107; + case 213: return 87; + case 217: return 217; + case 145: return 123; + case 146: return 129; + case 143: if (node.asteriskToken) { return 37; } - case 139: - case 136: + case 141: + case 138: return node.name.kind; } } function getDynamicIndentation(node, nodeStartLine, indentation, delta) { return { - getIndentationForComment: function (kind) { + getIndentationForComment: function (kind, tokenIndentation) { switch (kind) { case 16: case 20: + case 18: return indentation + delta; } - return indentation; + return tokenIndentation !== -1 ? tokenIndentation : indentation; }, getIndentationForToken: function (line, kind) { if (nodeStartLine !== line && node.decorators) { @@ -34564,9 +35027,9 @@ var ts; case 20: case 17: case 18: - case 78: - case 102: - case 54: + case 80: + case 104: + case 55: return indentation; default: return nodeStartLine !== line ? indentation + delta : indentation; @@ -34646,7 +35109,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 137 ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 139 ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; @@ -34718,8 +35181,12 @@ var ts; processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation); } if (indentToken) { - var indentNextTokenOrTrivia = true; + var tokenIndentation = (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) ? + dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind) : + -1; if (currentTokenInfo.leadingTrivia) { + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind, tokenIndentation); + var indentNextTokenOrTrivia = true; for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { @@ -34727,14 +35194,12 @@ var ts; } switch (triviaItem.kind) { case 3: - var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia); indentNextTokenOrTrivia = false; break; case 2: if (indentNextTokenOrTrivia) { - var commentIndentation_1 = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); - insertIndentation(triviaItem.pos, commentIndentation_1, false); + insertIndentation(triviaItem.pos, commentIndentation, false); indentNextTokenOrTrivia = false; } break; @@ -34744,8 +35209,7 @@ var ts; } } } - if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) { - var tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind); + if (tokenIndentation !== -1) { insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); lastIndentedLine = tokenStart.line; indentationOnLastIndentedLine = tokenIndentation; @@ -34877,7 +35341,7 @@ var ts; for (var line = line1; line < line2; ++line) { var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile); var lineEndPosition = ts.getEndLinePosition(line, sourceFile); - if (range && ts.isComment(range.kind) && range.pos <= lineEndPosition && range.end > lineEndPosition) { + if (range && (ts.isComment(range.kind) || ts.isStringOrRegularExpressionOrTemplateLiteral(range.kind)) && range.pos <= lineEndPosition && range.end > lineEndPosition) { continue; } var pos = lineEndPosition; @@ -34936,20 +35400,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 190: - case 217: + case 192: + case 219: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { + case 144: + case 213: + case 173: + case 143: case 142: - case 211: - case 171: - case 141: - case 140: - case 172: + case 174: if (node.typeParameters === list) { return 25; } @@ -34957,8 +35421,8 @@ var ts; return 17; } break; - case 166: - case 167: + case 168: + case 169: if (node.typeArguments === list) { return 25; } @@ -34966,7 +35430,7 @@ var ts; return 17; } break; - case 149: + case 151: if (node.typeArguments === list) { return 25; } @@ -35033,7 +35497,6 @@ var ts; formatting.getIndentationString = getIndentationString; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var ts; (function (ts) { var formatting; @@ -35044,21 +35507,31 @@ var ts; if (position > sourceFile.text.length) { return 0; } + if (options.IndentStyle === ts.IndentStyle.None) { + return 0; + } var precedingToken = ts.findPrecedingToken(position, sourceFile); if (!precedingToken) { return 0; } - var precedingTokenIsLiteral = precedingToken.kind === 9 || - precedingToken.kind === 10 || - precedingToken.kind === 11 || - precedingToken.kind === 12 || - precedingToken.kind === 13 || - precedingToken.kind === 14; + var precedingTokenIsLiteral = ts.isStringOrRegularExpressionOrTemplateLiteral(precedingToken.kind); if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; - if (precedingToken.kind === 24 && precedingToken.parent.kind !== 179) { + if (options.IndentStyle === ts.IndentStyle.Block) { + var current_1 = position; + while (current_1 > 0) { + var char = sourceFile.text.charCodeAt(current_1); + if (!ts.isWhiteSpace(char) && !ts.isLineBreak(char)) { + break; + } + current_1--; + } + var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); + return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); + } + if (precedingToken.kind === 24 && precedingToken.parent.kind !== 181) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -35156,7 +35629,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 246 || !parentAndChildShareLine); + (parent.kind === 248 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -35180,8 +35653,8 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 194 && parent.elseStatement === child) { - var elseKeyword = ts.findChildOfKind(parent, 78, sourceFile); + if (parent.kind === 196 && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 80, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; @@ -35192,23 +35665,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 149: + case 151: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 163: + case 165: return node.parent.properties; - case 162: + case 164: return node.parent.elements; - case 211: - case 171: - case 172: - case 141: - case 140: - case 145: - case 146: { + case 213: + case 173: + case 174: + case 143: + case 142: + case 147: + case 148: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -35219,8 +35692,8 @@ var ts; } break; } - case 167: - case 166: { + case 169: + case 168: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -35248,8 +35721,8 @@ var ts; if (node.kind === 18) { return -1; } - if (node.parent && (node.parent.kind === 166 || - node.parent.kind === 167) && + if (node.parent && (node.parent.kind === 168 || + node.parent.kind === 169) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -35267,10 +35740,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { + case 168: + case 169: case 166: case 167: - case 164: - case 165: node = node.expression; break; default: @@ -35325,42 +35798,43 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 212: - case 184: - case 213: - case 215: + case 195: case 214: - case 162: - case 190: + case 186: + case 215: case 217: - case 163: - case 153: - case 155: - case 218: - case 240: - case 239: - case 170: + case 216: case 164: + case 192: + case 219: + case 165: + case 155: + case 157: + case 220: + case 242: + case 241: + case 172: case 166: - case 167: - case 191: - case 209: - case 225: - case 202: - case 180: - case 160: - case 159: - case 231: - case 232: - case 140: - case 145: - case 146: - case 136: - case 150: - case 151: - case 158: case 168: - case 176: + case 169: + case 193: + case 211: + case 227: + case 204: + case 182: + case 162: + case 161: + case 233: + case 234: + case 142: + case 147: + case 148: + case 138: + case 152: + case 153: + case 160: + case 170: + case 178: return true; } return false; @@ -35370,20 +35844,20 @@ var ts; return true; } switch (parent) { - case 195: - case 196: - case 198: - case 199: case 197: - case 194: - case 211: - case 171: - case 141: - case 172: - case 142: + case 198: + case 200: + case 201: + case 199: + case 196: + case 213: + case 173: case 143: + case 174: case 144: - return child !== 190; + case 145: + case 146: + return child !== 192; default: return false; } @@ -35392,21 +35866,11 @@ var ts; })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); -/// var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -/// -/// -/// -/// -/// -/// -/// -/// -/// var ts; (function (ts) { ts.servicesVersion = "0.4"; @@ -35522,7 +35986,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(269, nodes.pos, nodes.end, 4096, this); + var list = createNode(271, nodes.pos, nodes.end, 4096, this); list._children = []; var pos = nodes.pos; for (var _i = 0; _i < nodes.length; _i++) { @@ -35541,7 +36005,7 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 133) { + if (this.kind >= 135) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos = this.pos; @@ -35588,7 +36052,7 @@ var ts; return undefined; } var child = children[0]; - return child.kind < 133 ? child : child.getFirstToken(sourceFile); + return child.kind < 135 ? child : child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -35596,7 +36060,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 133 ? child : child.getLastToken(sourceFile); + return child.kind < 135 ? child : child.getLastToken(sourceFile); }; return NodeObject; })(); @@ -35638,7 +36102,7 @@ var ts; ts.forEach(declarations, function (declaration, indexOfDeclaration) { if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); - if (canUseParsedParamTagComments && declaration.kind === 136) { + if (canUseParsedParamTagComments && declaration.kind === 138) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { @@ -35646,13 +36110,13 @@ var ts; } }); } - if (declaration.kind === 216 && declaration.body.kind === 216) { + if (declaration.kind === 218 && declaration.body.kind === 218) { return; } - while (declaration.kind === 216 && declaration.parent.kind === 216) { + while (declaration.kind === 218 && declaration.parent.kind === 218) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 209 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 211 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { ts.addRange(jsDocCommentParts, cleanedJsDocComment); @@ -35962,9 +36426,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 134) { + if (declaration.name.kind === 136) { var expr = declaration.name.expression; - if (expr.kind === 164) { + if (expr.kind === 166) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -35974,7 +36438,7 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 67 || + if (node.kind === 69 || node.kind === 9 || node.kind === 8) { return node.text; @@ -35984,9 +36448,9 @@ var ts; } function visit(node) { switch (node.kind) { - case 211: - case 141: - case 140: + case 213: + case 143: + case 142: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -36003,62 +36467,62 @@ var ts; ts.forEachChild(node, visit); } break; - case 212: - case 213: case 214: case 215: case 216: - case 219: - case 228: - case 224: - case 219: - case 221: - case 222: - case 143: - case 144: - case 153: - addDeclaration(node); - case 142: - case 191: - case 210: - case 159: - case 160: case 217: + case 218: + case 221: + case 230: + case 226: + case 221: + case 223: + case 224: + case 145: + case 146: + case 155: + addDeclaration(node); + case 144: + case 193: + case 212: + case 161: + case 162: + case 219: ts.forEachChild(node, visit); break; - case 190: + case 192: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 136: + case 138: if (!(node.flags & 112)) { break; } - case 209: - case 161: + case 211: + case 163: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 245: - case 139: - case 138: + case 247: + case 141: + case 140: addDeclaration(node); break; - case 226: + case 228: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 220: + case 222: var importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 222) { + if (importClause.namedBindings.kind === 224) { addDeclaration(importClause.namedBindings); } else { @@ -36085,6 +36549,12 @@ var ts; HighlightSpanKind.reference = "reference"; HighlightSpanKind.writtenReference = "writtenReference"; })(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {})); + (function (IndentStyle) { + IndentStyle[IndentStyle["None"] = 0] = "None"; + IndentStyle[IndentStyle["Block"] = 1] = "Block"; + IndentStyle[IndentStyle["Smart"] = 2] = "Smart"; + })(ts.IndentStyle || (ts.IndentStyle = {})); + var IndentStyle = ts.IndentStyle; (function (SymbolDisplayPartKind) { SymbolDisplayPartKind[SymbolDisplayPartKind["aliasName"] = 0] = "aliasName"; SymbolDisplayPartKind[SymbolDisplayPartKind["className"] = 1] = "className"; @@ -36200,14 +36670,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 171) { + if (declaration.kind === 173) { return true; } - if (declaration.kind !== 209 && declaration.kind !== 211) { + if (declaration.kind !== 211 && declaration.kind !== 213) { return false; } for (var parent_8 = declaration.parent; !ts.isFunctionBlock(parent_8); parent_8 = parent_8.parent) { - if (parent_8.kind === 246 || parent_8.kind === 217) { + if (parent_8.kind === 248 || parent_8.kind === 219) { return false; } } @@ -36318,7 +36788,7 @@ var ts; options.allowNonTsExtensions = true; options.noLib = true; options.noResolve = true; - var inputFileName = transpileOptions.fileName || "module.ts"; + var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts"); var sourceFile = ts.createSourceFile(inputFileName, input, options.target); if (transpileOptions.moduleName) { sourceFile.moduleName = transpileOptions.moduleName; @@ -36538,9 +37008,9 @@ var ts; scanner.setText(sourceText); var token = scanner.scan(); while (token !== 1) { - if (token === 120) { + if (token === 122) { token = scanner.scan(); - if (token === 123) { + if (token === 125) { token = scanner.scan(); if (token === 9) { recordAmbientExternalModule(); @@ -36548,25 +37018,25 @@ var ts; } } } - else if (token === 87) { + else if (token === 89) { token = scanner.scan(); if (token === 9) { recordModuleName(); continue; } else { - if (token === 67 || ts.isKeyword(token)) { + if (token === 69 || ts.isKeyword(token)) { token = scanner.scan(); - if (token === 131) { + if (token === 133) { token = scanner.scan(); if (token === 9) { recordModuleName(); continue; } } - else if (token === 55) { + else if (token === 56) { token = scanner.scan(); - if (token === 125) { + if (token === 127) { token = scanner.scan(); if (token === 17) { token = scanner.scan(); @@ -36591,7 +37061,7 @@ var ts; } if (token === 16) { token = scanner.scan(); - if (token === 131) { + if (token === 133) { token = scanner.scan(); if (token === 9) { recordModuleName(); @@ -36601,11 +37071,11 @@ var ts; } else if (token === 37) { token = scanner.scan(); - if (token === 114) { + if (token === 116) { token = scanner.scan(); - if (token === 67 || ts.isKeyword(token)) { + if (token === 69 || ts.isKeyword(token)) { token = scanner.scan(); - if (token === 131) { + if (token === 133) { token = scanner.scan(); if (token === 9) { recordModuleName(); @@ -36616,7 +37086,7 @@ var ts; } } } - else if (token === 80) { + else if (token === 82) { token = scanner.scan(); if (token === 15) { token = scanner.scan(); @@ -36625,7 +37095,7 @@ var ts; } if (token === 16) { token = scanner.scan(); - if (token === 131) { + if (token === 133) { token = scanner.scan(); if (token === 9) { recordModuleName(); @@ -36635,20 +37105,20 @@ var ts; } else if (token === 37) { token = scanner.scan(); - if (token === 131) { + if (token === 133) { token = scanner.scan(); if (token === 9) { recordModuleName(); } } } - else if (token === 87) { + else if (token === 89) { token = scanner.scan(); - if (token === 67 || ts.isKeyword(token)) { + if (token === 69 || ts.isKeyword(token)) { token = scanner.scan(); - if (token === 55) { + if (token === 56) { token = scanner.scan(); - if (token === 125) { + if (token === 127) { token = scanner.scan(); if (token === 17) { token = scanner.scan(); @@ -36674,7 +37144,7 @@ var ts; ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 205 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 207 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -36682,17 +37152,17 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 67 && - (node.parent.kind === 201 || node.parent.kind === 200) && + return node.kind === 69 && + (node.parent.kind === 203 || node.parent.kind === 202) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 67 && - node.parent.kind === 205 && + return node.kind === 69 && + node.parent.kind === 207 && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 205; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 207; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -36703,48 +37173,48 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 133 && node.parent.right === node; + return node.parent.kind === 135 && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 164 && node.parent.name === node; + return node && node.parent && node.parent.kind === 166 && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 166 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 168 && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 167 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 169 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 216 && node.parent.name === node; + return node.parent.kind === 218 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 67 && + return node.kind === 69 && ts.isFunctionLike(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 67 || node.kind === 9 || node.kind === 8) && - (node.parent.kind === 243 || node.parent.kind === 244) && node.parent.name === node; + return (node.kind === 69 || node.kind === 9 || node.kind === 8) && + (node.parent.kind === 245 || node.parent.kind === 246) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 || node.kind === 8) { switch (node.parent.kind) { - case 139: - case 138: - case 243: - case 245: case 141: case 140: + case 245: + case 247: case 143: - case 144: - case 216: + case 142: + case 145: + case 146: + case 218: return node.parent.name === node; - case 165: + case 167: return node.parent.argumentExpression === node; } } @@ -36782,7 +37252,7 @@ var ts; } } var keywordCompletions = []; - for (var i = 68; i <= 132; i++) { + for (var i = 70; i <= 134; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -36797,17 +37267,17 @@ var ts; return undefined; } switch (node.kind) { - case 246: - case 141: - case 140: - case 211: - case 171: + case 248: case 143: - case 144: - case 212: + case 142: case 213: + case 173: + case 145: + case 146: + case 214: case 215: - case 216: + case 217: + case 218: return node; } } @@ -36815,38 +37285,38 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 216: return ScriptElementKind.moduleElement; - case 212: return ScriptElementKind.classElement; - case 213: return ScriptElementKind.interfaceElement; - case 214: return ScriptElementKind.typeElement; - case 215: return ScriptElementKind.enumElement; - case 209: + case 218: return ScriptElementKind.moduleElement; + case 214: return ScriptElementKind.classElement; + case 215: return ScriptElementKind.interfaceElement; + case 216: return ScriptElementKind.typeElement; + case 217: return ScriptElementKind.enumElement; + case 211: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 211: return ScriptElementKind.functionElement; - case 143: return ScriptElementKind.memberGetAccessorElement; - case 144: return ScriptElementKind.memberSetAccessorElement; + case 213: return ScriptElementKind.functionElement; + case 145: return ScriptElementKind.memberGetAccessorElement; + case 146: return ScriptElementKind.memberSetAccessorElement; + case 143: + case 142: + return ScriptElementKind.memberFunctionElement; case 141: case 140: - return ScriptElementKind.memberFunctionElement; - case 139: - case 138: return ScriptElementKind.memberVariableElement; - case 147: return ScriptElementKind.indexSignatureElement; - case 146: return ScriptElementKind.constructSignatureElement; - case 145: return ScriptElementKind.callSignatureElement; - case 142: return ScriptElementKind.constructorImplementationElement; - case 135: return ScriptElementKind.typeParameterElement; - case 245: return ScriptElementKind.variableElement; - case 136: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 219: - case 224: + case 149: return ScriptElementKind.indexSignatureElement; + case 148: return ScriptElementKind.constructSignatureElement; + case 147: return ScriptElementKind.callSignatureElement; + case 144: return ScriptElementKind.constructorImplementationElement; + case 137: return ScriptElementKind.typeParameterElement; + case 247: return ScriptElementKind.variableElement; + case 138: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; case 221: - case 228: - case 222: + case 226: + case 223: + case 230: + case 224: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -37028,44 +37498,44 @@ var ts; return false; } switch (node.kind) { - case 219: + case 221: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 225: + case 227: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; - case 212: + case 214: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 241: + case 243: var heritageClause = node; - if (heritageClause.token === 104) { + if (heritageClause.token === 106) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return true; } break; - case 213: + case 215: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 216: + case 218: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 214: + case 216: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 141: - case 140: - case 142: case 143: + case 142: case 144: - case 171: - case 211: - case 172: - case 211: + case 145: + case 146: + case 173: + case 213: + case 174: + case 213: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -37073,20 +37543,20 @@ var ts; return true; } break; - case 191: + case 193: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 209: + case 211: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 166: - case 167: + case 168: + case 169: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start = expression.typeArguments.pos; @@ -37094,7 +37564,7 @@ var ts; return true; } break; - case 136: + case 138: var parameter = node; if (parameter.modifiers) { var start = parameter.modifiers.pos; @@ -37110,17 +37580,17 @@ var ts; return true; } break; - case 139: + case 141: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 215: + case 217: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 169: + case 171: var typeAssertionExpression = node; diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return true; - case 137: + case 139: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.decorators_can_only_be_used_in_a_ts_file)); return true; } @@ -37146,17 +37616,17 @@ var ts; for (var _i = 0; _i < modifiers.length; _i++) { var modifier = modifiers[_i]; switch (modifier.kind) { + case 112: case 110: - case 108: - case 109: - case 120: + case 111: + case 122: diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); return true; - case 111: - case 80: - case 72: - case 75: case 113: + case 82: + case 74: + case 77: + case 115: } } } @@ -37220,9 +37690,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { + case 269: case 267: - case 265: - case 266: + case 268: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -37243,13 +37713,14 @@ var ts; log("getCompletionData: Get previous token 1: " + (new Date().getTime() - start)); var contextToken = previousToken; if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) { - var start_4 = new Date().getTime(); + var start_3 = new Date().getTime(); contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile); - log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_4)); + log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start_3)); } var node = currentToken; var isRightOfDot = false; var isRightOfOpenTag = false; + var isStartingCloseTag = false; var location = ts.getTouchingPropertyName(sourceFile, position); if (contextToken) { if (isCompletionListBlocker(contextToken)) { @@ -37258,11 +37729,11 @@ var ts; } var parent_9 = contextToken.parent, kind = contextToken.kind; if (kind === 21) { - if (parent_9.kind === 164) { + if (parent_9.kind === 166) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_9.kind === 133) { + else if (parent_9.kind === 135) { node = contextToken.parent.left; isRightOfDot = true; } @@ -37270,9 +37741,14 @@ var ts; return undefined; } } - else if (kind === 25 && sourceFile.languageVariant === 1) { - isRightOfOpenTag = true; - location = contextToken; + else if (sourceFile.languageVariant === 1) { + if (kind === 25) { + isRightOfOpenTag = true; + location = contextToken; + } + else if (kind === 39 && contextToken.parent.kind === 237) { + isStartingCloseTag = true; + } } } var semanticStart = new Date().getTime(); @@ -37293,6 +37769,12 @@ var ts; isMemberCompletion = true; isNewIdentifierLocation = false; } + else if (isStartingCloseTag) { + var tagName = contextToken.parent.parent.openingElement.tagName; + symbols = [typeChecker.getSymbolAtLocation(tagName)]; + isMemberCompletion = true; + isNewIdentifierLocation = false; + } else { if (!tryGetGlobalSymbols()) { return undefined; @@ -37303,7 +37785,7 @@ var ts; function getTypeScriptMemberSymbols() { isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 67 || node.kind === 133 || node.kind === 164) { + if (node.kind === 69 || node.kind === 135 || node.kind === 166) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol && symbol.flags & 8388608) { symbol = typeChecker.getAliasedSymbol(symbol); @@ -37349,7 +37831,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType; - if ((jsxContainer.kind === 232) || (jsxContainer.kind === 233)) { + if ((jsxContainer.kind === 234) || (jsxContainer.kind === 235)) { attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); @@ -37383,49 +37865,64 @@ var ts; var start = new Date().getTime(); var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) || isSolelyIdentifierDefinitionLocation(contextToken) || - isDotOfNumericLiteral(contextToken); + isDotOfNumericLiteral(contextToken) || + isInJsxText(contextToken); log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); return result; } + function isInJsxText(contextToken) { + if (contextToken.kind === 236) { + return true; + } + if (contextToken.kind === 27 && contextToken.parent) { + if (contextToken.parent.kind === 235) { + return true; + } + if (contextToken.parent.kind === 237 || contextToken.parent.kind === 234) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 233; + } + } + return false; + } function isNewIdentifierDefinitionLocation(previousToken) { if (previousToken) { var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 24: - return containingNodeKind === 166 - || containingNodeKind === 142 - || containingNodeKind === 167 - || containingNodeKind === 162 - || containingNodeKind === 179 - || containingNodeKind === 150; + return containingNodeKind === 168 + || containingNodeKind === 144 + || containingNodeKind === 169 + || containingNodeKind === 164 + || containingNodeKind === 181 + || containingNodeKind === 152; case 17: - return containingNodeKind === 166 - || containingNodeKind === 142 - || containingNodeKind === 167 - || containingNodeKind === 170 - || containingNodeKind === 158; + return containingNodeKind === 168 + || containingNodeKind === 144 + || containingNodeKind === 169 + || containingNodeKind === 172 + || containingNodeKind === 160; case 19: - return containingNodeKind === 162 - || containingNodeKind === 147 - || containingNodeKind === 134; - case 123: - case 124: + return containingNodeKind === 164 + || containingNodeKind === 149 + || containingNodeKind === 136; + case 125: + case 126: return true; case 21: - return containingNodeKind === 216; + return containingNodeKind === 218; case 15: - return containingNodeKind === 212; - case 55: - return containingNodeKind === 209 - || containingNodeKind === 179; + return containingNodeKind === 214; + case 56: + return containingNodeKind === 211 + || containingNodeKind === 181; case 12: - return containingNodeKind === 181; + return containingNodeKind === 183; case 13: - return containingNodeKind === 188; + return containingNodeKind === 190; + case 112: case 110: - case 108: - case 109: - return containingNodeKind === 139; + case 111: + return containingNodeKind === 141; } switch (previousToken.getText()) { case "public": @@ -37440,9 +37937,9 @@ var ts; if (contextToken.kind === 9 || contextToken.kind === 10 || ts.isTemplateLiteralKind(contextToken.kind)) { - var start_5 = contextToken.getStart(); + var start_4 = contextToken.getStart(); var end = contextToken.getEnd(); - if (start_5 < position && position < end) { + if (start_4 < position && position < end) { return true; } if (position === end) { @@ -37456,12 +37953,12 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 163) { + if (objectLikeContainer.kind === 165) { isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 159) { + else if (objectLikeContainer.kind === 161) { isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); if (ts.isVariableLike(rootDeclaration)) { @@ -37487,9 +37984,9 @@ var ts; return true; } function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 223 ? - 220 : - 226; + var declarationKind = namedImportsOrExports.kind === 225 ? + 222 : + 228; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -37511,7 +38008,7 @@ var ts; case 15: case 24: var parent_10 = contextToken.parent; - if (parent_10 && (parent_10.kind === 163 || parent_10.kind === 159)) { + if (parent_10 && (parent_10.kind === 165 || parent_10.kind === 161)) { return parent_10; } break; @@ -37525,8 +38022,8 @@ var ts; case 15: case 24: switch (contextToken.parent.kind) { - case 223: - case 227: + case 225: + case 229: return contextToken.parent; } } @@ -37538,27 +38035,30 @@ var ts; var parent_11 = contextToken.parent; switch (contextToken.kind) { case 26: - case 38: - case 67: - case 236: - case 237: - if (parent_11 && (parent_11.kind === 232 || parent_11.kind === 233)) { + case 39: + case 69: + case 238: + case 239: + if (parent_11 && (parent_11.kind === 234 || parent_11.kind === 235)) { return parent_11; } + else if (parent_11.kind === 238) { + return parent_11.parent; + } break; case 9: - if (parent_11 && ((parent_11.kind === 236) || (parent_11.kind === 237))) { + if (parent_11 && ((parent_11.kind === 238) || (parent_11.kind === 239))) { return parent_11.parent; } break; case 16: if (parent_11 && - parent_11.kind === 238 && + parent_11.kind === 240 && parent_11.parent && - (parent_11.parent.kind === 236)) { + (parent_11.parent.kind === 238)) { return parent_11.parent.parent; } - if (parent_11 && parent_11.kind === 237) { + if (parent_11 && parent_11.kind === 239) { return parent_11.parent; } break; @@ -37568,16 +38068,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 171: - case 172: - case 211: - case 141: - case 140: + case 173: + case 174: + case 213: case 143: - case 144: + case 142: case 145: case 146: case 147: + case 148: + case 149: return true; } return false; @@ -37586,77 +38086,83 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 24: - return containingNodeKind === 209 || - containingNodeKind === 210 || - containingNodeKind === 191 || - containingNodeKind === 215 || - isFunction(containingNodeKind) || + return containingNodeKind === 211 || containingNodeKind === 212 || - containingNodeKind === 184 || - containingNodeKind === 213 || - containingNodeKind === 160 || - containingNodeKind === 214; + containingNodeKind === 193 || + containingNodeKind === 217 || + isFunction(containingNodeKind) || + containingNodeKind === 214 || + containingNodeKind === 186 || + containingNodeKind === 215 || + containingNodeKind === 162 || + containingNodeKind === 216; case 21: - return containingNodeKind === 160; - case 53: - return containingNodeKind === 161; + return containingNodeKind === 162; + case 54: + return containingNodeKind === 163; case 19: - return containingNodeKind === 160; + return containingNodeKind === 162; case 17: - return containingNodeKind === 242 || + return containingNodeKind === 244 || isFunction(containingNodeKind); case 15: - return containingNodeKind === 215 || - containingNodeKind === 213 || - containingNodeKind === 153; + return containingNodeKind === 217 || + containingNodeKind === 215 || + containingNodeKind === 155; case 23: - return containingNodeKind === 138 && + return containingNodeKind === 140 && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 213 || - contextToken.parent.parent.kind === 153); + (contextToken.parent.parent.kind === 215 || + contextToken.parent.parent.kind === 155); case 25: - return containingNodeKind === 212 || - containingNodeKind === 184 || - containingNodeKind === 213 || - containingNodeKind === 214 || + return containingNodeKind === 214 || + containingNodeKind === 186 || + containingNodeKind === 215 || + containingNodeKind === 216 || isFunction(containingNodeKind); - case 111: - return containingNodeKind === 139; + case 113: + return containingNodeKind === 141; case 22: - return containingNodeKind === 136 || + return containingNodeKind === 138 || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 160); - case 110: - case 108: - case 109: - return containingNodeKind === 136; - case 114: - containingNodeKind === 224 || - containingNodeKind === 228 || - containingNodeKind === 222; - case 71: - case 79: - case 105: - case 85: - case 100: - case 121: - case 127: - case 87: - case 106: - case 72: + contextToken.parent.parent.kind === 162); case 112: - case 130: + case 110: + case 111: + return containingNodeKind === 138; + case 116: + return containingNodeKind === 226 || + containingNodeKind === 230 || + containingNodeKind === 224; + case 73: + case 81: + case 107: + case 87: + case 102: + case 123: + case 129: + case 89: + case 108: + case 74: + case 114: + case 132: return true; } switch (contextToken.getText()) { + case "abstract": + case "async": case "class": - case "interface": + case "const": + case "declare": case "enum": case "function": - case "var": - case "static": + case "interface": case "let": - case "const": + case "private": + case "protected": + case "public": + case "static": + case "var": case "yield": return true; } @@ -37676,8 +38182,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_31 = element.propertyName || element.name; - exisingImportsOrExports[name_31.text] = true; + var name_32 = element.propertyName || element.name; + exisingImportsOrExports[name_32.text] = true; } if (ts.isEmpty(exisingImportsOrExports)) { return exportsOfModule; @@ -37691,16 +38197,16 @@ var ts; var existingMemberNames = {}; for (var _i = 0; _i < existingMembers.length; _i++) { var m = existingMembers[_i]; - if (m.kind !== 243 && - m.kind !== 244 && - m.kind !== 161) { + if (m.kind !== 245 && + m.kind !== 246 && + m.kind !== 163) { continue; } if (m.getStart() <= position && position <= m.getEnd()) { continue; } var existingName = void 0; - if (m.kind === 161 && m.propertyName) { + if (m.kind === 163 && m.propertyName) { existingName = m.propertyName.text; } else { @@ -37717,7 +38223,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 236) { + if (attr.kind === 238) { seenNames[attr.name.text] = true; } } @@ -37756,10 +38262,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameTable = getNameTable(sourceFile); - for (var name_32 in nameTable) { - if (!allNames[name_32]) { - allNames[name_32] = name_32; - var displayName = getCompletionEntryDisplayName(name_32, target, true); + for (var name_33 in nameTable) { + if (!allNames[name_33]) { + allNames[name_33] = name_33; + var displayName = getCompletionEntryDisplayName(name_33, target, true); if (displayName) { var entry = { name: displayName, @@ -37850,7 +38356,7 @@ var ts; function getSymbolKind(symbol, location) { var flags = symbol.getFlags(); if (flags & 32) - return ts.getDeclarationOfKind(symbol, 184) ? + return ts.getDeclarationOfKind(symbol, 186) ? ScriptElementKind.localClassElement : ScriptElementKind.classElement; if (flags & 384) return ScriptElementKind.enumElement; @@ -37946,14 +38452,14 @@ var ts; var signature; type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 164) { + if (location.parent && location.parent.kind === 166) { var right = location.parent.name; if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; } } var callExpression; - if (location.kind === 166 || location.kind === 167) { + if (location.kind === 168 || location.kind === 169) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -37965,9 +38471,9 @@ var ts; if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 167 || callExpression.expression.kind === 93; + var useConstructSignatures = callExpression.kind === 169 || callExpression.expression.kind === 95; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); - if (!ts.contains(allSignatures, signature.target || signature)) { + if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; } if (signature) { @@ -37980,7 +38486,7 @@ var ts; pushTypePart(symbolKind); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(90)); + displayParts.push(ts.keywordPart(92)); displayParts.push(ts.spacePart()); } addFullSymbolName(symbol); @@ -37995,10 +38501,10 @@ var ts; case ScriptElementKind.letElement: case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: - displayParts.push(ts.punctuationPart(53)); + displayParts.push(ts.punctuationPart(54)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(90)); + displayParts.push(ts.keywordPart(92)); displayParts.push(ts.spacePart()); } if (!(type.flags & 65536)) { @@ -38013,21 +38519,21 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || - (location.kind === 119 && location.parent.kind === 142)) { + (location.kind === 121 && location.parent.kind === 144)) { var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 142 ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 144 ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 142) { + if (functionDeclaration.kind === 144) { symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 145 && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 147 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -38036,11 +38542,11 @@ var ts; } } if (symbolFlags & 32 && !hasAddedSymbolInfo) { - if (ts.getDeclarationOfKind(symbol, 184)) { + if (ts.getDeclarationOfKind(symbol, 186)) { pushTypePart(ScriptElementKind.localClassElement); } else { - displayParts.push(ts.keywordPart(71)); + displayParts.push(ts.keywordPart(73)); } displayParts.push(ts.spacePart()); addFullSymbolName(symbol); @@ -38048,37 +38554,37 @@ var ts; } if ((symbolFlags & 64) && (semanticMeaning & 2)) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(105)); + displayParts.push(ts.keywordPart(107)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); } if (symbolFlags & 524288) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(130)); + displayParts.push(ts.keywordPart(132)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55)); + displayParts.push(ts.operatorPart(56)); displayParts.push(ts.spacePart()); ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration)); } if (symbolFlags & 384) { addNewLineIfDisplayPartsExist(); if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) { - displayParts.push(ts.keywordPart(72)); + displayParts.push(ts.keywordPart(74)); displayParts.push(ts.spacePart()); } - displayParts.push(ts.keywordPart(79)); + displayParts.push(ts.keywordPart(81)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } if (symbolFlags & 1536) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 216); - var isNamespace = declaration && declaration.name && declaration.name.kind === 67; - displayParts.push(ts.keywordPart(isNamespace ? 124 : 123)); + var declaration = ts.getDeclarationOfKind(symbol, 218); + var isNamespace = declaration && declaration.name && declaration.name.kind === 69; + displayParts.push(ts.keywordPart(isNamespace ? 126 : 125)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -38090,7 +38596,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(88)); + displayParts.push(ts.keywordPart(90)); displayParts.push(ts.spacePart()); if (symbol.parent) { addFullSymbolName(symbol.parent, enclosingDeclaration); @@ -38099,20 +38605,20 @@ var ts; else { var container = ts.getContainingFunction(location); if (container) { - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 135).parent; + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 137).parent; var signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 146) { - displayParts.push(ts.keywordPart(90)); + if (signatureDeclaration.kind === 148) { + displayParts.push(ts.keywordPart(92)); displayParts.push(ts.spacePart()); } - else if (signatureDeclaration.kind !== 145 && signatureDeclaration.name) { + else if (signatureDeclaration.kind !== 147 && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); } else { - var declaration = ts.getDeclarationOfKind(symbol, 135).parent; - displayParts.push(ts.keywordPart(130)); + var declaration = ts.getDeclarationOfKind(symbol, 137).parent; + displayParts.push(ts.keywordPart(132)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -38122,11 +38628,11 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 245) { + if (declaration.kind === 247) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55)); + displayParts.push(ts.operatorPart(56)); displayParts.push(ts.spacePart()); displayParts.push(ts.displayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral)); } @@ -38134,17 +38640,17 @@ var ts; } if (symbolFlags & 8388608) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(87)); + displayParts.push(ts.keywordPart(89)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 219) { + if (declaration.kind === 221) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55)); + displayParts.push(ts.operatorPart(56)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(125)); + displayParts.push(ts.keywordPart(127)); displayParts.push(ts.punctuationPart(17)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(18)); @@ -38153,7 +38659,7 @@ var ts; var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); if (internalAliasSymbol) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(55)); + displayParts.push(ts.operatorPart(56)); displayParts.push(ts.spacePart()); addFullSymbolName(internalAliasSymbol, enclosingDeclaration); } @@ -38169,7 +38675,7 @@ var ts; if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 || symbolKind === ScriptElementKind.localVariableElement) { - displayParts.push(ts.punctuationPart(53)); + displayParts.push(ts.punctuationPart(54)); displayParts.push(ts.spacePart()); if (type.symbol && type.symbol.flags & 262144) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { @@ -38267,11 +38773,11 @@ var ts; var symbol = typeChecker.getSymbolAtLocation(node); if (!symbol) { switch (node.kind) { - case 67: - case 164: - case 133: + case 69: + case 166: + case 135: + case 97: case 95: - case 93: var type = typeChecker.getTypeAtLocation(node); if (type) { return { @@ -38320,7 +38826,7 @@ var ts; } return result; function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { - if (isNewExpressionTarget(location) || location.kind === 119) { + if (isNewExpressionTarget(location) || location.kind === 121) { if (symbol.flags & 32) { for (var _i = 0, _a = symbol.getDeclarations(); _i < _a.length; _i++) { var declaration = _a[_i]; @@ -38343,8 +38849,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 142) || - (!selectConstructors && (d.kind === 211 || d.kind === 141 || d.kind === 140))) { + if ((selectConstructors && d.kind === 144) || + (!selectConstructors && (d.kind === 213 || d.kind === 143 || d.kind === 142))) { declarations.push(d); if (d.body) definition = d; @@ -38395,11 +38901,11 @@ var ts; } if (symbol.flags & 8388608) { var declaration = symbol.declarations[0]; - if (node.kind === 67 && node.parent === declaration) { + if (node.kind === 69 && node.parent === declaration) { symbol = typeChecker.getAliasedSymbol(symbol); } } - if (node.parent.kind === 244) { + if (node.parent.kind === 246) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -38470,9 +38976,9 @@ var ts; }; } function getSemanticDocumentHighlights(node) { - if (node.kind === 67 || + if (node.kind === 69 || + node.kind === 97 || node.kind === 95 || - node.kind === 93 || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, false, false); @@ -38521,77 +39027,77 @@ var ts; function getHighlightSpans(node) { if (node) { switch (node.kind) { - case 86: - case 78: - if (hasKind(node.parent, 194)) { + case 88: + case 80: + if (hasKind(node.parent, 196)) { return getIfElseOccurrences(node.parent); } break; - case 92: - if (hasKind(node.parent, 202)) { - return getReturnOccurrences(node.parent); - } - break; - case 96: - if (hasKind(node.parent, 206)) { - return getThrowOccurrences(node.parent); - } - break; - case 70: - if (hasKind(parent(parent(node)), 207)) { - return getTryCatchFinallyOccurrences(node.parent.parent); - } - break; - case 98: - case 83: - if (hasKind(parent(node), 207)) { - return getTryCatchFinallyOccurrences(node.parent); - } - break; case 94: if (hasKind(node.parent, 204)) { + return getReturnOccurrences(node.parent); + } + break; + case 98: + if (hasKind(node.parent, 208)) { + return getThrowOccurrences(node.parent); + } + break; + case 72: + if (hasKind(parent(parent(node)), 209)) { + return getTryCatchFinallyOccurrences(node.parent.parent); + } + break; + case 100: + case 85: + if (hasKind(parent(node), 209)) { + return getTryCatchFinallyOccurrences(node.parent); + } + break; + case 96: + if (hasKind(node.parent, 206)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; - case 69: - case 75: - if (hasKind(parent(parent(parent(node))), 204)) { + case 71: + case 77: + if (hasKind(parent(parent(parent(node))), 206)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; - case 68: - case 73: - if (hasKind(node.parent, 201) || hasKind(node.parent, 200)) { + case 70: + case 75: + if (hasKind(node.parent, 203) || hasKind(node.parent, 202)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; - case 84: - if (hasKind(node.parent, 197) || - hasKind(node.parent, 198) || - hasKind(node.parent, 199)) { + case 86: + if (hasKind(node.parent, 199) || + hasKind(node.parent, 200) || + hasKind(node.parent, 201)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 102: - case 77: - if (hasKind(node.parent, 196) || hasKind(node.parent, 195)) { + case 104: + case 79: + if (hasKind(node.parent, 198) || hasKind(node.parent, 197)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 119: - if (hasKind(node.parent, 142)) { - return getConstructorOccurrences(node.parent); - } - break; case 121: - case 127: - if (hasKind(node.parent, 143) || hasKind(node.parent, 144)) { + if (hasKind(node.parent, 144)) { + return getConstructorOccurrences(node.parent); + } + break; + case 123: + case 129: + if (hasKind(node.parent, 145) || hasKind(node.parent, 146)) { return getGetAndSetOccurrences(node.parent); } break; default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 191)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 193)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -38603,10 +39109,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 206) { + if (node.kind === 208) { statementAccumulator.push(node); } - else if (node.kind === 207) { + else if (node.kind === 209) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -38628,10 +39134,10 @@ var ts; var child = throwStatement; while (child.parent) { var parent_12 = child.parent; - if (ts.isFunctionBlock(parent_12) || parent_12.kind === 246) { + if (ts.isFunctionBlock(parent_12) || parent_12.kind === 248) { return parent_12; } - if (parent_12.kind === 207) { + if (parent_12.kind === 209) { var tryStatement = parent_12; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -38646,7 +39152,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 201 || node.kind === 200) { + if (node.kind === 203 || node.kind === 202) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -38662,15 +39168,15 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { switch (node_2.kind) { - case 204: - if (statement.kind === 200) { + case 206: + if (statement.kind === 202) { continue; } - case 197: - case 198: case 199: - case 196: - case 195: + case 200: + case 201: + case 198: + case 197: if (!statement.label || isLabeledBy(node_2, statement.label.text)) { return node_2; } @@ -38687,24 +39193,24 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 212 || - container.kind === 184 || - (declaration.kind === 136 && hasKind(container, 142)))) { - return undefined; - } - } - else if (modifier === 111) { - if (!(container.kind === 212 || container.kind === 184)) { - return undefined; - } - } - else if (modifier === 80 || modifier === 120) { - if (!(container.kind === 217 || container.kind === 246)) { + if (!(container.kind === 214 || + container.kind === 186 || + (declaration.kind === 138 && hasKind(container, 144)))) { return undefined; } } else if (modifier === 113) { - if (!(container.kind === 212 || declaration.kind === 212)) { + if (!(container.kind === 214 || container.kind === 186)) { + return undefined; + } + } + else if (modifier === 82 || modifier === 122) { + if (!(container.kind === 219 || container.kind === 248)) { + return undefined; + } + } + else if (modifier === 115) { + if (!(container.kind === 214 || declaration.kind === 214)) { return undefined; } } @@ -38715,8 +39221,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 217: - case 246: + case 219: + case 248: if (modifierFlag & 256) { nodes = declaration.members.concat(declaration); } @@ -38724,15 +39230,15 @@ var ts; nodes = container.statements; } break; - case 142: + case 144: nodes = container.parameters.concat(container.parent.members); break; - case 212: - case 184: + case 214: + case 186: nodes = container.members; if (modifierFlag & 112) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 142 && member; + return member.kind === 144 && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -38753,19 +39259,19 @@ var ts; return ts.map(keywords, getHighlightSpanForNode); function getFlagFromModifier(modifier) { switch (modifier) { - case 110: + case 112: return 16; - case 108: + case 110: return 32; - case 109: - return 64; case 111: - return 128; - case 80: - return 1; - case 120: - return 2; + return 64; case 113: + return 128; + case 82: + return 1; + case 122: + return 2; + case 115: return 256; default: ts.Debug.fail(); @@ -38785,13 +39291,13 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 143); - tryPushAccessorKeyword(accessorDeclaration.symbol, 144); + tryPushAccessorKeyword(accessorDeclaration.symbol, 145); + tryPushAccessorKeyword(accessorDeclaration.symbol, 146); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 121, 127); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 123, 129); }); } } } @@ -38800,18 +39306,18 @@ var ts; var keywords = []; ts.forEach(declarations, function (declaration) { ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 119); + return pushKeywordIf(keywords, token, 121); }); }); return ts.map(keywords, getHighlightSpanForNode); } function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 84, 102, 77)) { - if (loopNode.kind === 195) { + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 86, 104, 79)) { + if (loopNode.kind === 197) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 102)) { + if (pushKeywordIf(keywords, loopTokens[i], 104)) { break; } } @@ -38820,7 +39326,7 @@ var ts; var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 68, 73); + pushKeywordIf(keywords, statement.getFirstToken(), 70, 75); } }); return ts.map(keywords, getHighlightSpanForNode); @@ -38829,13 +39335,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { + case 199: + case 200: + case 201: case 197: case 198: - case 199: - case 195: - case 196: return getLoopBreakContinueOccurrences(owner); - case 204: + case 206: return getSwitchCaseDefaultOccurrences(owner); } } @@ -38843,13 +39349,13 @@ var ts; } function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 94); + pushKeywordIf(keywords, switchStatement.getFirstToken(), 96); ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 69, 75); + pushKeywordIf(keywords, clause.getFirstToken(), 71, 77); var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 68); + pushKeywordIf(keywords, statement.getFirstToken(), 70); } }); }); @@ -38857,13 +39363,13 @@ var ts; } function getTryCatchFinallyOccurrences(tryStatement) { var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 98); + pushKeywordIf(keywords, tryStatement.getFirstToken(), 100); if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 70); + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 72); } if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 83, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 83); + var finallyKeyword = ts.findChildOfKind(tryStatement, 85, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 85); } return ts.map(keywords, getHighlightSpanForNode); } @@ -38874,50 +39380,50 @@ var ts; } var keywords = []; ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 96); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 98); }); if (ts.isFunctionBlock(owner)) { ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 92); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 94); }); } return ts.map(keywords, getHighlightSpanForNode); } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 190))) { + if (!(func && hasKind(func.body, 192))) { return undefined; } var keywords = []; ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 92); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 94); }); ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 96); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 98); }); return ts.map(keywords, getHighlightSpanForNode); } function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 194) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 196) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 86); + pushKeywordIf(keywords, children[0], 88); for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 78)) { + if (pushKeywordIf(keywords, children[i], 80)) { break; } } - if (!hasKind(ifStatement.elseStatement, 194)) { + if (!hasKind(ifStatement.elseStatement, 196)) { break; } ifStatement = ifStatement.elseStatement; } var result = []; for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 78 && i < keywords.length - 1) { + if (keywords[i].kind === 80 && i < keywords.length - 1) { var elseKeyword = keywords[i]; var ifKeyword = keywords[i + 1]; var shouldCombindElseAndIf = true; @@ -38995,12 +39501,12 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 67 && + if (node.kind !== 69 && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } - ts.Debug.assert(node.kind === 67 || node.kind === 8 || node.kind === 9); + ts.Debug.assert(node.kind === 69 || node.kind === 8 || node.kind === 9); return getReferencedSymbolsForNode(node, program.getSourceFiles(), findInStrings, findInComments); } function getReferencedSymbolsForNode(node, sourceFiles, findInStrings, findInComments) { @@ -39014,10 +39520,10 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 95) { + if (node.kind === 97) { return getReferencesForThisKeyword(node, sourceFiles); } - if (node.kind === 93) { + if (node.kind === 95) { return getReferencesForSuperKeyword(node); } var symbol = typeChecker.getSymbolAtLocation(node); @@ -39068,7 +39574,7 @@ var ts; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 224 || declaration.kind === 228; + return declaration.kind === 226 || declaration.kind === 230; }); } function getInternedName(symbol, location, declarations) { @@ -39081,13 +39587,13 @@ var ts; } function getSymbolScope(symbol) { var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 171 || valueDeclaration.kind === 184)) { + if (valueDeclaration && (valueDeclaration.kind === 173 || valueDeclaration.kind === 186)) { return valueDeclaration; } if (symbol.flags & (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 212); + return ts.getAncestor(privateDeclaration, 214); } } if (symbol.flags & 8388608) { @@ -39108,7 +39614,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 246 && !ts.isExternalModule(container)) { + if (container.kind === 248 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -39167,7 +39673,7 @@ var ts; function isValidReferencePosition(node, searchSymbolName) { if (node) { switch (node.kind) { - case 67: + case 69: return node.getWidth() === searchSymbolName.length; case 9: if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || @@ -39255,13 +39761,13 @@ var ts; } var staticFlag = 128; switch (searchSpaceNode.kind) { - case 139: - case 138: case 141: case 140: - case 142: case 143: + case 142: case 144: + case 145: + case 146: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; @@ -39274,7 +39780,7 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 93) { + if (!node || node.kind !== 95) { return; } var container = ts.getSuperContainer(node, false); @@ -39289,32 +39795,32 @@ var ts; var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); var staticFlag = 128; switch (searchSpaceNode.kind) { - case 141: - case 140: + case 143: + case 142: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } - case 139: - case 138: - case 142: - case 143: + case 141: + case 140: case 144: + case 145: + case 146: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 246: + case 248: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 211: - case 171: + case 213: + case 173: break; default: return undefined; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 246) { + if (searchSpaceNode.kind === 248) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -39340,30 +39846,31 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 95) { + if (!node || node.kind !== 97) { return; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 171: - case 211: + case 173: + case 213: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 141: - case 140: + case 143: + case 142: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 212: + case 186: + case 214: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 246: - if (container.kind === 246 && !ts.isExternalModule(container)) { + case 248: + if (container.kind === 248 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -39398,11 +39905,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 212) { + if (declaration.kind === 214) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 213) { + else if (declaration.kind === 215) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -39452,17 +39959,17 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_33 = node.text; + var name_34 = node.text; if (contextualType) { if (contextualType.flags & 16384) { - var unionProperty = contextualType.getProperty(name_33); + var unionProperty = contextualType.getProperty(name_34); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_33); + var symbol = t.getProperty(name_34); if (symbol) { result_4.push(symbol); } @@ -39471,7 +39978,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_33); + var symbol_1 = contextualType.getProperty(name_34); if (symbol_1) { return [symbol_1]; } @@ -39511,17 +40018,17 @@ var ts; }; } function isWriteAccess(node) { - if (node.kind === 67 && ts.isDeclarationName(node)) { + if (node.kind === 69 && ts.isDeclarationName(node)) { return true; } var parent = node.parent; if (parent) { - if (parent.kind === 178 || parent.kind === 177) { + if (parent.kind === 180 || parent.kind === 179) { return true; } - else if (parent.kind === 179 && parent.left === node) { + else if (parent.kind === 181 && parent.left === node) { var operator = parent.operatorToken.kind; - return 55 <= operator && operator <= 66; + return 56 <= operator && operator <= 68; } } return false; @@ -39552,33 +40059,33 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 136: - case 209: - case 161: - case 139: case 138: - case 243: - case 244: - case 245: + case 211: + case 163: case 141: case 140: - case 142: + case 245: + case 246: + case 247: case 143: + case 142: case 144: - case 211: - case 171: - case 172: - case 242: - return 1; - case 135: + case 145: + case 146: case 213: - case 214: - case 153: - return 2; - case 212: + case 173: + case 174: + case 244: + return 1; + case 137: case 215: - return 1 | 2; case 216: + case 155: + return 2; + case 214: + case 217: + return 1 | 2; + case 218: if (node.name.kind === 9) { return 4 | 1; } @@ -39588,14 +40095,14 @@ var ts; else { return 4; } - case 223: - case 224: - case 219: - case 220: case 225: case 226: + case 221: + case 222: + case 227: + case 228: return 1 | 2 | 4; - case 246: + case 248: return 4 | 1; } return 1 | 2 | 4; @@ -39605,8 +40112,9 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 149 || - (node.parent.kind === 186 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)); + return node.parent.kind === 151 || + (node.parent.kind === 188 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + node.kind === 97 && !ts.isExpression(node); } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -39614,47 +40122,47 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 164) { - while (root.parent && root.parent.kind === 164) { + if (root.parent.kind === 166) { + while (root.parent && root.parent.kind === 166) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 186 && root.parent.parent.kind === 241) { + if (!isLastClause && root.parent.kind === 188 && root.parent.parent.kind === 243) { var decl = root.parent.parent.parent; - return (decl.kind === 212 && root.parent.parent.token === 104) || - (decl.kind === 213 && root.parent.parent.token === 81); + return (decl.kind === 214 && root.parent.parent.token === 106) || + (decl.kind === 215 && root.parent.parent.token === 83); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 133) { - while (root.parent && root.parent.kind === 133) { + if (root.parent.kind === 135) { + while (root.parent && root.parent.kind === 135) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 149 && !isLastClause; + return root.parent.kind === 151 && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 133) { + while (node.parent.kind === 135) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; } function getMeaningFromRightHandSideOfImportEquals(node) { - ts.Debug.assert(node.kind === 67); - if (node.parent.kind === 133 && + ts.Debug.assert(node.kind === 69); + if (node.parent.kind === 135 && node.parent.right === node && - node.parent.parent.kind === 219) { + node.parent.parent.kind === 221) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 225) { + if (node.parent.kind === 227) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -39688,15 +40196,15 @@ var ts; return; } switch (node.kind) { - case 164: - case 133: + case 166: + case 135: case 9: - case 82: - case 97: - case 91: + case 84: + case 99: case 93: case 95: - case 67: + case 97: + case 69: break; default: return; @@ -39707,7 +40215,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 216 && + if (nodeForStartPos.parent.parent.kind === 218 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -39734,10 +40242,10 @@ var ts; } function checkForClassificationCancellation(kind) { switch (kind) { - case 216: - case 212: + case 218: + case 214: + case 215: case 213: - case 211: cancellationToken.throwIfCancellationRequested(); } } @@ -39785,7 +40293,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 216 && + return declaration.kind === 218 && ts.getModuleInstanceState(declaration) === 1; }); } @@ -39794,7 +40302,7 @@ var ts; if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) { var kind = node.kind; checkForClassificationCancellation(kind); - if (kind === 67 && !ts.nodeIsMissing(node)) { + if (kind === 69 && !ts.nodeIsMissing(node)) { var identifier = node; if (classifiableNames[identifier.text]) { var symbol = typeChecker.getSymbolAtLocation(node); @@ -39918,16 +40426,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 265: + case 267: processJSDocParameterTag(tag); break; - case 268: + case 270: processJSDocTemplateTag(tag); break; - case 267: + case 269: processElement(tag.typeExpression); break; - case 266: + case 268: processElement(tag.typeExpression); break; } @@ -40007,17 +40515,17 @@ var ts; } if (ts.isPunctuation(tokenKind)) { if (token) { - if (tokenKind === 55) { - if (token.parent.kind === 209 || - token.parent.kind === 139 || - token.parent.kind === 136) { + if (tokenKind === 56) { + if (token.parent.kind === 211 || + token.parent.kind === 141 || + token.parent.kind === 138) { return 5; } } - if (token.parent.kind === 179 || - token.parent.kind === 177 || - token.parent.kind === 178 || - token.parent.kind === 180) { + if (token.parent.kind === 181 || + token.parent.kind === 179 || + token.parent.kind === 180 || + token.parent.kind === 182) { return 5; } } @@ -40035,35 +40543,35 @@ var ts; else if (ts.isTemplateLiteralKind(tokenKind)) { return 6; } - else if (tokenKind === 67) { + else if (tokenKind === 69) { if (token) { switch (token.parent.kind) { - case 212: + case 214: if (token.parent.name === token) { return 11; } return; - case 135: + case 137: if (token.parent.name === token) { return 15; } return; - case 213: + case 215: if (token.parent.name === token) { return 13; } return; - case 215: + case 217: if (token.parent.name === token) { return 12; } return; - case 216: + case 218: if (token.parent.name === token) { return 14; } return; - case 136: + case 138: if (token.parent.name === token) { return 17; } @@ -40177,19 +40685,40 @@ var ts; if (!tokenAtPos || tokenStart < position) { return undefined; } - var containingFunction = ts.getAncestor(tokenAtPos, 211); - if (!containingFunction || containingFunction.getStart() < position) { + var commentOwner; + findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { + switch (commentOwner.kind) { + case 213: + case 143: + case 144: + case 214: + case 193: + break findOwner; + case 248: + return undefined; + case 218: + if (commentOwner.parent.kind === 218) { + return undefined; + } + break findOwner; + } + } + if (!commentOwner || commentOwner.getStart() < position) { return undefined; } - var parameters = containingFunction.parameters; + var parameters = getParametersForJsDocOwningNode(commentOwner); var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); var newLine = host.getNewLine ? host.getNewLine() : "\r\n"; - var docParams = parameters.reduce(function (prev, cur, index) { - return prev + - indentationStr + " * @param " + (cur.name.kind === 67 ? cur.name.text : "param" + index) + newLine; - }, ""); + var docParams = ""; + for (var i = 0, numParams = parameters.length; i < numParams; i++) { + var currentName = parameters[i].name; + var paramName = currentName.kind === 69 ? + currentName.text : + "param" + i; + docParams += indentationStr + " * @param " + paramName + newLine; + } var preamble = "/**" + newLine + indentationStr + " * "; var result = preamble + newLine + @@ -40198,6 +40727,38 @@ var ts; (tokenStart === position ? newLine + indentationStr : ""); return { newText: result, caretOffset: preamble.length }; } + function getParametersForJsDocOwningNode(commentOwner) { + if (ts.isFunctionLike(commentOwner)) { + return commentOwner.parameters; + } + if (commentOwner.kind === 193) { + var varStatement = commentOwner; + var varDeclarations = varStatement.declarationList.declarations; + if (varDeclarations.length === 1 && varDeclarations[0].initializer) { + return getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer); + } + } + return emptyArray; + } + function getParametersFromRightHandSideOfAssignment(rightHandSide) { + while (rightHandSide.kind === 172) { + rightHandSide = rightHandSide.expression; + } + switch (rightHandSide.kind) { + case 173: + case 174: + return rightHandSide.parameters; + case 186: + for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.kind === 144) { + return member.parameters; + } + } + break; + } + return emptyArray; + } function getTodoComments(fileName, descriptors) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); @@ -40240,8 +40801,6 @@ var ts; return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); } function getTodoCommentsRegExp() { - // NOTE: ?: means 'non-capture group'. It allows us to have groups without having to - // filter them out later in the final result array. var singleLineCommentStart = /(?:\/\/+\s*)/.source; var multiLineCommentStart = /(?:\/\*+\s*)/.source; var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; @@ -40264,7 +40823,7 @@ var ts; var sourceFile = getValidSourceFile(fileName); var typeChecker = program.getTypeChecker(); var node = ts.getTouchingWord(sourceFile, position); - if (node && node.kind === 67) { + if (node && node.kind === 69) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { var declarations = symbol.getDeclarations(); @@ -40362,13 +40921,13 @@ var ts; sourceFile.nameTable = nameTable; function walk(node) { switch (node.kind) { - case 67: + case 69: nameTable[node.text] = node.text; break; case 9: case 8: if (ts.isDeclarationName(node) || - node.parent.kind === 230 || + node.parent.kind === 232 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -40381,31 +40940,31 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 165 && + node.parent.kind === 167 && node.parent.argumentExpression === node; } function createClassifier() { var scanner = ts.createScanner(2, false); var noRegexTable = []; - noRegexTable[67] = true; + noRegexTable[69] = true; noRegexTable[9] = true; noRegexTable[8] = true; noRegexTable[10] = true; - noRegexTable[95] = true; - noRegexTable[40] = true; + noRegexTable[97] = true; noRegexTable[41] = true; + noRegexTable[42] = true; noRegexTable[18] = true; noRegexTable[20] = true; noRegexTable[16] = true; - noRegexTable[97] = true; - noRegexTable[82] = true; + noRegexTable[99] = true; + noRegexTable[84] = true; var templateStack = []; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { - if (keyword2 === 121 || - keyword2 === 127 || - keyword2 === 119 || - keyword2 === 111) { + if (keyword2 === 123 || + keyword2 === 129 || + keyword2 === 121 || + keyword2 === 113) { return true; } return false; @@ -40500,31 +41059,31 @@ var ts; do { token = scanner.scan(); if (!ts.isTrivia(token)) { - if ((token === 38 || token === 59) && !noRegexTable[lastNonTriviaToken]) { + if ((token === 39 || token === 61) && !noRegexTable[lastNonTriviaToken]) { if (scanner.reScanSlashToken() === 10) { token = 10; } } else if (lastNonTriviaToken === 21 && isKeyword(token)) { - token = 67; + token = 69; } else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { - token = 67; + token = 69; } - else if (lastNonTriviaToken === 67 && + else if (lastNonTriviaToken === 69 && token === 25) { angleBracketStack++; } else if (token === 27 && angleBracketStack > 0) { angleBracketStack--; } - else if (token === 115 || + else if (token === 117 || + token === 130 || token === 128 || - token === 126 || - token === 118 || - token === 129) { + token === 120 || + token === 131) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { - token = 67; + token = 69; } } else if (token === 12) { @@ -40622,40 +41181,41 @@ var ts; function isBinaryExpressionOperatorToken(token) { switch (token) { case 37: - case 38: case 39: + case 40: case 35: case 36: - case 42: case 43: case 44: + case 45: case 25: case 27: case 28: case 29: - case 89: - case 88: + case 91: + case 90: + case 116: case 30: case 31: case 32: case 33: - case 45: - case 47: case 46: - case 50: + case 48: + case 47: case 51: - case 65: - case 64: + case 52: + case 67: case 66: - case 61: - case 62: + case 68: case 63: - case 56: + case 64: + case 65: case 57: case 58: case 59: - case 60: - case 55: + case 61: + case 62: + case 56: case 24: return true; default: @@ -40666,17 +41226,17 @@ var ts; switch (token) { case 35: case 36: + case 50: case 49: - case 48: - case 40: case 41: + case 42: return true; default: return false; } } function isKeyword(token) { - return token >= 68 && token <= 132; + return token >= 70 && token <= 134; } function classFromKind(token) { if (isKeyword(token)) { @@ -40685,7 +41245,7 @@ var ts; else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { return 5; } - else if (token >= 15 && token <= 66) { + else if (token >= 15 && token <= 68) { return 10; } switch (token) { @@ -40702,7 +41262,7 @@ var ts; case 5: case 4: return 8; - case 67: + case 69: default: if (ts.isTemplateLiteralKind(token)) { return 6; @@ -40728,7 +41288,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 246 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 248 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = -1; proto.end = -1; @@ -40744,10 +41304,6 @@ var ts; } initializeServices(); })(ts || (ts = {})); -/// -/// -/// -/// var ts; (function (ts) { var server; @@ -40764,6 +41320,22 @@ var ts; return spaceCache[n]; } server.generateSpaces = generateSpaces; + function generateIndentString(n, editorOptions) { + if (editorOptions.ConvertTabsToSpaces) { + return generateSpaces(n); + } + else { + var result = ""; + for (var i = 0; i < Math.floor(n / editorOptions.TabSize); i++) { + result += "\t"; + } + for (var i = 0; i < n % editorOptions.TabSize; i++) { + result += " "; + } + return result; + } + } + server.generateIndentString = generateIndentString; function compareNumber(a, b) { if (a < b) { return -1; @@ -40873,7 +41445,7 @@ var ts; }, _a[CommandNames.Open] = function (request) { var openArgs = request.arguments; - _this.openClientFile(openArgs.file); + _this.openClientFile(openArgs.file, openArgs.fileContent); return { responseRequired: false }; }, _a[CommandNames.Quickinfo] = function (request) { @@ -41306,9 +41878,9 @@ var ts; symbolDisplayString: displayString }; }; - Session.prototype.openClientFile = function (fileName) { + Session.prototype.openClientFile = function (fileName, fileContent) { var file = ts.normalizePath(fileName); - this.projectService.openClientFile(file); + this.projectService.openClientFile(file, fileContent); }; Session.prototype.getQuickInfo = function (line, offset, fileName) { var file = ts.normalizePath(fileName); @@ -41375,28 +41947,27 @@ var ts; IndentSize: formatOptions.IndentSize, TabSize: formatOptions.TabSize, NewLineCharacter: "\n", - ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces + ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces, + IndentStyle: ts.IndentStyle.Smart }; - var indentPosition = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions); + var preferredIndent = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions); + var hasIndent = 0; for (var i = 0, len = lineText.length; i < len; i++) { if (lineText.charAt(i) == " ") { - indentPosition--; + hasIndent++; } else if (lineText.charAt(i) == "\t") { - indentPosition -= editorOptions.IndentSize; + hasIndent += editorOptions.TabSize; } else { break; } } - if (indentPosition > 0) { - var spaces = generateSpaces(indentPosition); - edits.push({ span: ts.createTextSpanFromBounds(position, position), newText: spaces }); - } - else if (indentPosition < 0) { + if (preferredIndent !== hasIndent) { + var firstNoWhiteSpacePosition = lineInfo.offset + i; edits.push({ - span: ts.createTextSpanFromBounds(position, position - indentPosition), - newText: "" + span: ts.createTextSpanFromBounds(lineInfo.offset, firstNoWhiteSpacePosition), + newText: generateIndentString(preferredIndent, editorOptions) }); } } @@ -41528,6 +42099,9 @@ var ts; } }; Session.prototype.closeClientFile = function (fileName) { + if (!fileName) { + return; + } var file = ts.normalizePath(fileName); this.projectService.closeClientFile(file); }; @@ -41710,10 +42284,6 @@ var ts; server.Session = Session; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); -/// -/// -/// -/// var ts; (function (ts) { var server; @@ -41779,9 +42349,10 @@ var ts; this.host = host; this.project = project; this.ls = null; - this.filenameToScript = {}; this.roots = []; - this.resolvedModuleNames = ts.createFileMap(ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames)); + var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); + this.resolvedModuleNames = ts.createFileMap(getCanonicalFileName); + this.filenameToScript = ts.createFileMap(getCanonicalFileName); this.moduleResolutionHost = { fileExists: function (fileName) { return _this.fileExists(fileName); }, readFile: function (fileName) { return _this.host.readFile(fileName); } @@ -41860,34 +42431,31 @@ var ts; }; LSHost.prototype.removeReferencedFile = function (info) { if (!info.isOpen) { - this.filenameToScript[info.fileName] = undefined; + this.filenameToScript.remove(info.fileName); this.resolvedModuleNames.remove(info.fileName); } }; LSHost.prototype.getScriptInfo = function (filename) { - var scriptInfo = ts.lookUp(this.filenameToScript, filename); + var scriptInfo = this.filenameToScript.get(filename); if (!scriptInfo) { scriptInfo = this.project.openReferencedFile(filename); if (scriptInfo) { - this.filenameToScript[scriptInfo.fileName] = scriptInfo; + this.filenameToScript.set(scriptInfo.fileName, scriptInfo); } } - else { - } return scriptInfo; }; LSHost.prototype.addRoot = function (info) { - var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName); - if (!scriptInfo) { - this.filenameToScript[info.fileName] = info; + if (!this.filenameToScript.contains(info.fileName)) { + this.filenameToScript.set(info.fileName, info); this.roots.push(info); } }; LSHost.prototype.removeRoot = function (info) { - var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName); - if (scriptInfo) { - this.filenameToScript[info.fileName] = undefined; + if (!this.filenameToScript.contains(info.fileName)) { + this.filenameToScript.remove(info.fileName); this.roots = copyListRemovingItem(info, this.roots); + this.resolvedModuleNames.remove(info.fileName); } }; LSHost.prototype.saveTo = function (filename, tmpfilename) { @@ -41925,7 +42493,7 @@ var ts; return this.host.directoryExists(path); }; LSHost.prototype.lineToTextSpan = function (filename, line) { - var script = this.filenameToScript[filename]; + var script = this.filenameToScript.get(filename); var index = script.snap().index; var lineInfo = index.lineNumberToInfo(line + 1); var len; @@ -41939,13 +42507,13 @@ var ts; return ts.createTextSpan(lineInfo.offset, len); }; LSHost.prototype.lineOffsetToPosition = function (filename, line, offset) { - var script = this.filenameToScript[filename]; + var script = this.filenameToScript.get(filename); var index = script.snap().index; var lineInfo = index.lineNumberToInfo(line); return (lineInfo.offset + offset - 1); }; LSHost.prototype.positionToLineOffset = function (filename, position) { - var script = this.filenameToScript[filename]; + var script = this.filenameToScript.get(filename); var index = script.snap().index; var lineOffset = index.charOffsetToLineNumberAndPos(position); return { line: lineOffset.line, offset: lineOffset.offset + 1 }; @@ -41981,6 +42549,7 @@ var ts; function Project(projectService, projectOptions) { this.projectService = projectService; this.projectOptions = projectOptions; + this.directoriesWatchedForTsconfig = []; this.filenameToSourceFile = {}; this.updateGraphSeq = 0; this.openRefCount = 0; @@ -41996,6 +42565,9 @@ var ts; Project.prototype.openReferencedFile = function (filename) { return this.projectService.openFile(filename, false); }; + Project.prototype.getRootFiles = function () { + return this.compilerService.host.roots.map(function (info) { return info.fileName; }); + }; Project.prototype.getFileNames = function () { var sourceFiles = this.program.getSourceFiles(); return sourceFiles.map(function (sourceFile) { return sourceFile.fileName; }); @@ -42038,11 +42610,9 @@ var ts; return this.projectFilename; }; Project.prototype.addRoot = function (info) { - info.defaultProject = this; this.compilerService.host.addRoot(info); }; Project.prototype.removeRoot = function (info) { - info.defaultProject = undefined; this.compilerService.host.removeRoot(info); }; Project.prototype.filesToString = function () { @@ -42079,6 +42649,9 @@ var ts; this.configuredProjects = []; this.openFilesReferenced = []; this.openFileRootsConfigured = []; + this.directoryWatchersForTsconfig = {}; + this.directoryWatchersRefCount = {}; + this.timerForDetectingProjectFilelistChanges = {}; this.addDefaultHostConfiguration(); } ProjectService.prototype.addDefaultHostConfiguration = function () { @@ -42110,8 +42683,54 @@ var ts; } } }; + ProjectService.prototype.directoryWatchedForSourceFilesChanged = function (project, fileName) { + if (fileName && !ts.isSupportedSourceFileName(fileName)) { + return; + } + this.log("Detected source file changes: " + fileName); + this.startTimerForDetectingProjectFilelistChanges(project); + }; + ProjectService.prototype.startTimerForDetectingProjectFilelistChanges = function (project) { + var _this = this; + if (this.timerForDetectingProjectFilelistChanges[project.projectFilename]) { + clearTimeout(this.timerForDetectingProjectFilelistChanges[project.projectFilename]); + } + this.timerForDetectingProjectFilelistChanges[project.projectFilename] = setTimeout(function () { return _this.handleProjectFilelistChanges(project); }, 250); + }; + ProjectService.prototype.handleProjectFilelistChanges = function (project) { + var _this = this; + var _a = this.configFileToProjectOptions(project.projectFilename), succeeded = _a.succeeded, projectOptions = _a.projectOptions, error = _a.error; + var newRootFiles = projectOptions.files.map((function (f) { return _this.getCanonicalFileName(f); })); + var currentRootFiles = project.getRootFiles().map((function (f) { return _this.getCanonicalFileName(f); })); + if (!ts.arrayStructurallyIsEqualTo(currentRootFiles, newRootFiles)) { + this.updateConfiguredProject(project); + this.updateProjectStructure(); + } + }; + ProjectService.prototype.directoryWatchedForTsconfigChanged = function (fileName) { + var _this = this; + if (ts.getBaseFileName(fileName) != "tsconfig.json") { + this.log(fileName + " is not tsconfig.json"); + return; + } + this.log("Detected newly added tsconfig file: " + fileName); + var _a = this.configFileToProjectOptions(fileName), succeeded = _a.succeeded, projectOptions = _a.projectOptions, error = _a.error; + var rootFilesInTsconfig = projectOptions.files.map(function (f) { return _this.getCanonicalFileName(f); }); + var openFileRoots = this.openFileRoots.map(function (s) { return _this.getCanonicalFileName(s.fileName); }); + for (var _i = 0; _i < openFileRoots.length; _i++) { + var openFileRoot = openFileRoots[_i]; + if (rootFilesInTsconfig.indexOf(openFileRoot) >= 0) { + this.reloadProjects(); + return; + } + } + }; + ProjectService.prototype.getCanonicalFileName = function (fileName) { + var name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + return ts.normalizePath(name); + }; ProjectService.prototype.watchedProjectConfigFileChanged = function (project) { - this.log("Config File Changed: " + project.projectFilename); + this.log("Config file changed: " + project.projectFilename); this.updateConfiguredProject(project); this.updateProjectStructure(); }; @@ -42142,11 +42761,28 @@ var ts; this.psLogger.close(); }; ProjectService.prototype.createInferredProject = function (root) { - var iproj = new Project(this); - iproj.addRoot(root); - iproj.finishGraph(); - this.inferredProjects.push(iproj); - return iproj; + var _this = this; + var project = new Project(this); + project.addRoot(root); + var currentPath = ts.getDirectoryPath(root.fileName); + var parentPath = ts.getDirectoryPath(currentPath); + while (currentPath != parentPath) { + if (!project.projectService.directoryWatchersForTsconfig[currentPath]) { + this.log("Add watcher for: " + currentPath); + project.projectService.directoryWatchersForTsconfig[currentPath] = + this.host.watchDirectory(currentPath, function (fileName) { return _this.directoryWatchedForTsconfigChanged(fileName); }); + project.projectService.directoryWatchersRefCount[currentPath] = 1; + } + else { + project.projectService.directoryWatchersRefCount[currentPath] += 1; + } + project.directoriesWatchedForTsconfig.push(currentPath); + currentPath = parentPath; + parentPath = ts.getDirectoryPath(parentPath); + } + project.finishGraph(); + this.inferredProjects.push(project); + return project; }; ProjectService.prototype.fileDeletedInFilesystem = function (info) { this.psLogger.info(info.fileName + " deleted"); @@ -42157,6 +42793,9 @@ var ts; if (!info.isOpen) { this.filenameToScriptInfo[info.fileName] = undefined; var referencingProjects = this.findReferencingProjects(info); + if (info.defaultProject) { + info.defaultProject.removeRoot(info); + } for (var i = 0, len = referencingProjects.length; i < len; i++) { referencingProjects[i].removeReferencedFile(info); } @@ -42184,12 +42823,27 @@ var ts; } this.configuredProjects = configuredProjects; }; - ProjectService.prototype.removeConfiguredProject = function (project) { - project.projectFileWatcher.close(); - this.configuredProjects = copyListRemovingItem(project, this.configuredProjects); + ProjectService.prototype.removeProject = function (project) { + this.log("remove project: " + project.getRootFiles().toString()); + if (project.isConfiguredProject()) { + project.projectFileWatcher.close(); + project.directoryWatcher.close(); + this.configuredProjects = copyListRemovingItem(project, this.configuredProjects); + } + else { + for (var _i = 0, _a = project.directoriesWatchedForTsconfig; _i < _a.length; _i++) { + var directory = _a[_i]; + if (!(--project.projectService.directoryWatchersRefCount[directory])) { + this.log("Close directory watcher for: " + directory); + project.projectService.directoryWatchersForTsconfig[directory].close(); + delete project.projectService.directoryWatchersForTsconfig[directory]; + } + } + this.inferredProjects = copyListRemovingItem(project, this.inferredProjects); + } var fileNames = project.getFileNames(); - for (var _i = 0; _i < fileNames.length; _i++) { - var fileName = fileNames[_i]; + for (var _b = 0; _b < fileNames.length; _b++) { + var fileName = fileNames[_b]; var info = this.getScriptInfo(fileName); if (info.defaultProject == project) { info.defaultProject = undefined; @@ -42222,8 +42876,7 @@ var ts; for (var i = 0, len = this.openFileRoots.length; i < len; i++) { var r = this.openFileRoots[i]; if (info.defaultProject.getSourceFile(r)) { - this.inferredProjects = - copyListRemovingItem(r.defaultProject, this.inferredProjects); + this.removeProject(r.defaultProject); this.openFilesReferenced.push(r); r.defaultProject = info.defaultProject; } @@ -42238,6 +42891,7 @@ var ts; this.updateConfiguredProjectList(); }; ProjectService.prototype.closeOpenFile = function (info) { + info.svc.reloadFromFile(info.fileName); var openFileRoots = []; var removedProject; for (var i = 0, len = this.openFileRoots.length; i < len; i++) { @@ -42264,17 +42918,12 @@ var ts; this.openFileRootsConfigured = openFileRootsConfigured; } if (removedProject) { - if (removedProject.isConfiguredProject()) { - this.configuredProjects = copyListRemovingItem(removedProject, this.configuredProjects); - } - else { - this.inferredProjects = copyListRemovingItem(removedProject, this.inferredProjects); - } + this.removeProject(removedProject); var openFilesReferenced = []; var orphanFiles = []; for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { var f = this.openFilesReferenced[i]; - if (f.defaultProject === removedProject) { + if (f.defaultProject === removedProject || !f.defaultProject) { f.defaultProject = undefined; orphanFiles.push(f); } @@ -42315,6 +42964,7 @@ var ts; return referencingProjects; }; ProjectService.prototype.reloadProjects = function () { + this.log("reload projects."); for (var _i = 0, _a = this.openFileRoots; _i < _a.length; _i++) { var info = _a[_i]; this.openOrUpdateConfiguredProjectForFile(info.fileName); @@ -42356,13 +43006,21 @@ var ts; var rootFile = this.openFileRoots[i]; var rootedProject = rootFile.defaultProject; var referencingProjects = this.findReferencingProjects(rootFile, rootedProject); - if (referencingProjects.length === 0) { - rootFile.defaultProject = rootedProject; - openFileRoots.push(rootFile); + if (rootFile.defaultProject && rootFile.defaultProject.isConfiguredProject()) { + if (!rootedProject.isConfiguredProject()) { + this.removeProject(rootedProject); + } + this.openFileRootsConfigured.push(rootFile); } else { - this.inferredProjects = copyListRemovingItem(rootedProject, this.inferredProjects); - this.openFilesReferenced.push(rootFile); + if (referencingProjects.length === 0) { + rootFile.defaultProject = rootedProject; + openFileRoots.push(rootFile); + } + else { + this.removeProject(rootedProject); + this.openFilesReferenced.push(rootFile); + } } } this.openFileRoots = openFileRoots; @@ -42375,14 +43033,14 @@ var ts; filename = ts.normalizePath(filename); return ts.lookUp(this.filenameToScriptInfo, filename); }; - ProjectService.prototype.openFile = function (fileName, openedByClient) { + ProjectService.prototype.openFile = function (fileName, openedByClient, fileContent) { var _this = this; fileName = ts.normalizePath(fileName); var info = ts.lookUp(this.filenameToScriptInfo, fileName); if (!info) { var content; if (this.host.fileExists(fileName)) { - content = this.host.readFile(fileName); + content = fileContent || this.host.readFile(fileName); } if (!content) { if (openedByClient) { @@ -42400,6 +43058,9 @@ var ts; } } if (info) { + if (fileContent) { + info.svc.reload(fileContent); + } if (openedByClient) { info.isOpen = true; } @@ -42420,9 +43081,9 @@ var ts; } return undefined; }; - ProjectService.prototype.openClientFile = function (fileName) { + ProjectService.prototype.openClientFile = function (fileName, fileContent) { this.openOrUpdateConfiguredProjectForFile(fileName); - var info = this.openFile(fileName, true); + var info = this.openFile(fileName, true, fileContent); this.addOpenFile(info); this.printProjects(); return info; @@ -42533,12 +43194,12 @@ var ts; configFilename = ts.normalizePath(configFilename); var dirPath = ts.getDirectoryPath(configFilename); var contents = this.host.readFile(configFilename); - var rawConfig = ts.parseConfigFileText(configFilename, contents); + var rawConfig = ts.parseConfigFileTextToJson(configFilename, contents); if (rawConfig.error) { return { succeeded: false, error: rawConfig.error }; } else { - var parsedCommandLine = ts.parseConfigFile(rawConfig.config, this.host, dirPath); + var parsedCommandLine = ts.parseJsonConfigFileContent(rawConfig.config, this.host, dirPath); if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) { return { succeeded: false, error: { errorMsg: "tsconfig option errors" } }; } @@ -42561,26 +43222,28 @@ var ts; return error; } else { - var proj = this.createProject(configFilename, projectOptions); - for (var i = 0, len = projectOptions.files.length; i < len; i++) { - var rootFilename = projectOptions.files[i]; + var project = this.createProject(configFilename, projectOptions); + for (var _i = 0, _b = projectOptions.files; _i < _b.length; _i++) { + var rootFilename = _b[_i]; if (this.host.fileExists(rootFilename)) { var info = this.openFile(rootFilename, clientFileName == rootFilename); - proj.addRoot(info); + project.addRoot(info); } else { return { errorMsg: "specified file " + rootFilename + " not found" }; } } - proj.finishGraph(); - proj.projectFileWatcher = this.host.watchFile(configFilename, function (_) { return _this.watchedProjectConfigFileChanged(proj); }); - return { success: true, project: proj }; + project.finishGraph(); + project.projectFileWatcher = this.host.watchFile(configFilename, function (_) { return _this.watchedProjectConfigFileChanged(project); }); + this.log("Add recursive watcher for: " + ts.getDirectoryPath(configFilename)); + project.directoryWatcher = this.host.watchDirectory(ts.getDirectoryPath(configFilename), function (path) { return _this.directoryWatchedForSourceFilesChanged(project, path); }, true); + return { success: true, project: project }; } }; ProjectService.prototype.updateConfiguredProject = function (project) { if (!this.host.fileExists(project.projectFilename)) { this.log("Config file deleted"); - this.removeConfiguredProject(project); + this.removeProject(project); } else { var _a = this.configFileToProjectOptions(project.projectFilename), succeeded = _a.succeeded, projectOptions = _a.projectOptions, error = _a.error; @@ -42595,7 +43258,9 @@ var ts; for (var _i = 0; _i < fileNamesToRemove.length; _i++) { var fileName = fileNamesToRemove[_i]; var info = this.getScriptInfo(fileName); - project.removeRoot(info); + if (info) { + project.removeRoot(info); + } } for (var _b = 0; _b < fileNamesToAdd.length; _b++) { var fileName = fileNamesToAdd[_b]; @@ -42607,11 +43272,15 @@ var ts; if (info.isOpen) { if (this.openFileRoots.indexOf(info) >= 0) { this.openFileRoots = copyListRemovingItem(info, this.openFileRoots); + if (info.defaultProject && !info.defaultProject.isConfiguredProject()) { + this.removeProject(info.defaultProject); + } } if (this.openFilesReferenced.indexOf(info) >= 0) { this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced); } this.openFileRootsConfigured.push(info); + info.defaultProject = project; } } project.addRoot(info); @@ -42656,6 +43325,7 @@ var ts; TabSize: 4, NewLineCharacter: ts.sys ? ts.sys.newLine : '\n', ConvertTabsToSpaces: true, + IndentStyle: ts.IndentStyle.Smart, InsertSpaceAfterCommaDelimiter: true, InsertSpaceAfterSemicolonInForStatements: true, InsertSpaceBeforeAndAfterBinaryOperators: true, @@ -43496,8 +44166,6 @@ var ts; server.LineLeaf = LineLeaf; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); -/// -/// var ts; (function (ts) { var server; @@ -43573,79 +44241,6 @@ var ts; }; return Logger; })(); - var WatchedFileSet = (function () { - function WatchedFileSet(interval, chunkSize) { - if (interval === void 0) { interval = 2500; } - if (chunkSize === void 0) { chunkSize = 30; } - this.interval = interval; - this.chunkSize = chunkSize; - this.watchedFiles = []; - this.nextFileToCheck = 0; - } - WatchedFileSet.copyListRemovingItem = function (item, list) { - var copiedList = []; - for (var i = 0, len = list.length; i < len; i++) { - if (list[i] != item) { - copiedList.push(list[i]); - } - } - return copiedList; - }; - WatchedFileSet.getModifiedTime = function (fileName) { - return fs.statSync(fileName).mtime; - }; - WatchedFileSet.prototype.poll = function (checkedIndex) { - var watchedFile = this.watchedFiles[checkedIndex]; - if (!watchedFile) { - return; - } - fs.stat(watchedFile.fileName, function (err, stats) { - if (err) { - watchedFile.callback(watchedFile.fileName); - } - else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { - watchedFile.mtime = WatchedFileSet.getModifiedTime(watchedFile.fileName); - watchedFile.callback(watchedFile.fileName); - } - }); - }; - WatchedFileSet.prototype.startWatchTimer = function () { - var _this = this; - this.watchTimer = setInterval(function () { - var count = 0; - var nextToCheck = _this.nextFileToCheck; - var firstCheck = -1; - while ((count < _this.chunkSize) && (nextToCheck !== firstCheck)) { - _this.poll(nextToCheck); - if (firstCheck < 0) { - firstCheck = nextToCheck; - } - nextToCheck++; - if (nextToCheck === _this.watchedFiles.length) { - nextToCheck = 0; - } - count++; - } - _this.nextFileToCheck = nextToCheck; - }, this.interval); - }; - WatchedFileSet.prototype.addFile = function (fileName, callback) { - var file = { - fileName: fileName, - callback: callback, - mtime: WatchedFileSet.getModifiedTime(fileName) - }; - this.watchedFiles.push(file); - if (this.watchedFiles.length === 1) { - this.startWatchTimer(); - } - return file; - }; - WatchedFileSet.prototype.removeFile = function (file) { - this.watchedFiles = WatchedFileSet.copyListRemovingItem(file, this.watchedFiles); - }; - return WatchedFileSet; - })(); var IOSession = (function (_super) { __extends(IOSession, _super); function IOSession(host, logger) { @@ -43706,13 +44301,24 @@ var ts; return new Logger(fileName, detailLevel); } var logger = createLoggerFromEnv(); - var watchedFileSet = new WatchedFileSet(); - ts.sys.watchFile = function (fileName, callback) { - var watchedFile = watchedFileSet.addFile(fileName, callback); - return { - close: function () { return watchedFileSet.removeFile(watchedFile); } - }; - }; + var pending = []; + var canWrite = true; + function writeMessage(s) { + if (!canWrite) { + pending.push(s); + } + else { + canWrite = false; + process.stdout.write(new Buffer(s, "utf8"), setCanWriteFlagAndWriteMessageIfNecessary); + } + } + function setCanWriteFlagAndWriteMessageIfNecessary() { + canWrite = true; + if (pending.length) { + writeMessage(pending.shift()); + } + } + ts.sys.write = function (s) { return writeMessage(s); }; var ioSession = new IOSession(ts.sys, logger); process.on('uncaughtException', function (err) { ioSession.logError(err, "unknown"); @@ -43720,21 +44326,6 @@ var ts; ioSession.listen(); })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -/// var debugObjectHost = this; var ts; (function (ts) { @@ -44294,7 +44885,7 @@ var ts; var _this = this; return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { var text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); - var result = ts.parseConfigFileText(fileName, text); + var result = ts.parseConfigFileTextToJson(fileName, text); if (result.error) { return { options: {}, @@ -44302,7 +44893,7 @@ var ts; errors: [realizeDiagnostic(result.error, '\r\n')] }; } - var configFile = ts.parseConfigFile(result.config, _this.host, ts.getDirectoryPath(ts.normalizeSlashes(fileName))); + var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(ts.normalizeSlashes(fileName))); return { options: configFile.options, files: configFile.fileNames, @@ -44387,4 +44978,4 @@ var TypeScript; Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; })(Services = TypeScript.Services || (TypeScript.Services = {})); })(TypeScript || (TypeScript = {})); -var toolsVersion = "1.6"; +var toolsVersion = "1.7"; diff --git a/extensions/typescript/src/typescriptMain.ts b/extensions/typescript/src/typescriptMain.ts index 7ea1c5ef78f..8faf86d1ff7 100644 --- a/extensions/typescript/src/typescriptMain.ts +++ b/extensions/typescript/src/typescriptMain.ts @@ -53,7 +53,7 @@ function registerSupports(modeID: string, host: TypeScriptServiceClientHost, cli languages.registerDocumentHighlightProvider(modeID, new DocumentHighlightProvider(client)); languages.registerReferenceProvider(modeID, new ReferenceProvider(client)); languages.registerDocumentSymbolProvider(modeID, new DocumentSymbolProvider(client)); - languages.registerSignatureHelpProvider(modeID, new SignatureHelpProvider(client), '(', ';'); + languages.registerSignatureHelpProvider(modeID, new SignatureHelpProvider(client), '(', ','); languages.registerRenameProvider(modeID, new RenameProvider(client)); languages.registerDocumentRangeFormattingEditProvider(modeID, new FormattingProvider(client)); languages.registerOnTypeFormattingEditProvider(modeID, new FormattingProvider(client), ';', '}', '\n'); @@ -149,7 +149,9 @@ class TypeScriptServiceClientHost implements ITypescriptServiceClientHost { this.triggerAllDiagnostics(); }; let handleProjectChange = () => { - this.triggerAllDiagnostics(); + setTimeout(() => { + this.triggerAllDiagnostics(); + }, 1500); } let watcher = workspace.createFileSystemWatcher('**/tsconfig.json'); watcher.onDidCreate(handleProjectCreateOrDelete); diff --git a/extensions/vb/package.json b/extensions/vb/package.json index 446951158ec..9b9374ee2b4 100644 --- a/extensions/vb/package.json +++ b/extensions/vb/package.json @@ -6,7 +6,7 @@ "contributes": { "languages": [{ "id": "vb", - "extensions": [ ".vb" ], + "extensions": [ ".vb", ".brs" ], "aliases": [ "Visual Basic", "vb" ], "configuration": "./vb.configuration.json" }], @@ -20,4 +20,4 @@ "path": "./snippets/vb.json" }] } -} \ No newline at end of file +} diff --git a/extensions/vscode-api-tests/.vscode/launch.json b/extensions/vscode-api-tests/.vscode/launch.json new file mode 100644 index 00000000000..b6ed0f7a674 --- /dev/null +++ b/extensions/vscode-api-tests/.vscode/launch.json @@ -0,0 +1,17 @@ +// A launch configuration that compiles the extension and then opens it inside a new window +{ + "version": "0.1.0", + "configurations": [ + { + "name": "Launch Tests", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": ["${workspaceRoot}/../../", "${workspaceRoot}/testWorkspace", "--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out" ], + "stopOnEntry": false, + "sourceMaps": true, + "outDir": "out", + "preLaunchTask": "npm" + } + ] +} \ No newline at end of file diff --git a/extensions/vscode-api-tests/.vscode/tasks.json b/extensions/vscode-api-tests/.vscode/tasks.json new file mode 100644 index 00000000000..d31b15910ee --- /dev/null +++ b/extensions/vscode-api-tests/.vscode/tasks.json @@ -0,0 +1,30 @@ +// Available variables which can be used inside of strings. +// ${workspaceRoot}: the root folder of the team +// ${file}: the current opened file +// ${fileBasename}: the current opened file's basename +// ${fileDirname}: the current opened file's dirname +// ${fileExtname}: the current opened file's extension +// ${cwd}: the current working directory of the spawned process + +// A task runner that calls a custom npm script that compiles the extension. +{ + "version": "0.1.0", + + // we want to run npm + "command": "npm", + + // the command is a shell script + "isShellCommand": true, + + // show the output window only if unrecognized errors occur. + "showOutput": "silent", + + // we run the custom script "compile" as defined in package.json + "args": ["run", "compile", "--loglevel", "silent"], + + // The tsc compiler is started in watching mode + "isWatching": true, + + // use the standard tsc in watch mode problem matcher to find compile problems in the output. + "problemMatcher": "$tsc-watch" +} \ No newline at end of file diff --git a/extensions/vscode-api-tests/.vscodeignore b/extensions/vscode-api-tests/.vscodeignore index bf8da5ca33e..d9d9698a317 100644 --- a/extensions/vscode-api-tests/.vscodeignore +++ b/extensions/vscode-api-tests/.vscodeignore @@ -1,9 +1,6 @@ .vscode/** typings/** -out/test/** -test/** **/*.ts **/*.map .gitignore tsconfig.json -vsc-extension-quickstart.md diff --git a/extensions/vscode-api-tests/README.md b/extensions/vscode-api-tests/README.md deleted file mode 100644 index 7263e355bc6..00000000000 --- a/extensions/vscode-api-tests/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# README -## This is the README for your extension "vscode-api-tests" -------------------- -You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: - -* Split the editor (`Cmd+\` on OSX or `Ctrl+\` on Windows and Linux) -* Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux) -* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) to see a list of Markdown snippets - -### For more information -* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) -* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) - -** Enjoy!** diff --git a/extensions/vscode-api-tests/package.json b/extensions/vscode-api-tests/package.json index 0b1021c72d3..8b6055b5822 100644 --- a/extensions/vscode-api-tests/package.json +++ b/extensions/vscode-api-tests/package.json @@ -1,15 +1,18 @@ { "name": "vscode-api-tests", - "description": "", + "description": "API tests for VS Code", "version": "0.0.1", "publisher": "vscode", + "private": true, "engines": { "vscode": "*" }, "scripts": { + "compile": "node ./node_modules/vscode/bin/compile -watch -p ./", "vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../gulpfile.plugins.js compile-plugin:vscode-api-tests ./tsconfig.json" }, "devDependencies": { + "typescript": "^1.6.2", "vscode": "next" } } \ No newline at end of file diff --git a/extensions/vscode-api-tests/src/commands.test.ts b/extensions/vscode-api-tests/src/commands.test.ts new file mode 100644 index 00000000000..6d9453f3510 --- /dev/null +++ b/extensions/vscode-api-tests/src/commands.test.ts @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * 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 * as assert from 'assert'; +import * as fs from 'fs'; +import * as os from 'os'; +import {workspace, window, Position, commands} from 'vscode'; +import {createRandomFile, deleteFile, cleanUp} from './utils'; +import {join} from 'path'; + +suite("editor tests", () => { + + teardown(cleanUp); + + // test('calling command completes with the extension host updated properly', () => { + // return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => { + // return window.showTextDocument(doc).then(editor => { + // assert.equal(window.visibleTextEditors.length, 1); + // return commands.executeCommand('workbench.action.closeAllEditors').then(() => { + // assert.equal(window.visibleTextEditors.length, 0); + // }); + // }); + // }); + // }); +}); \ No newline at end of file diff --git a/extensions/vscode-api-tests/src/editor.test.ts b/extensions/vscode-api-tests/src/editor.test.ts new file mode 100644 index 00000000000..e3bb24f42c2 --- /dev/null +++ b/extensions/vscode-api-tests/src/editor.test.ts @@ -0,0 +1,41 @@ +/*--------------------------------------------------------------------------------------------- + * 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 * as assert from 'assert'; +import * as fs from 'fs'; +import * as os from 'os'; +import {workspace, window, Position} from 'vscode'; +import {createRandomFile, deleteFile, cleanUp} from './utils'; +import {join} from 'path'; + +suite("editor tests", () => { + + teardown(cleanUp); + + test('make edit', () => { + return createRandomFile().then(file => { + return workspace.openTextDocument(file).then(doc => { + return window.showTextDocument(doc).then((editor) => { + return editor.edit((builder) => { + builder.insert(new Position(0, 0), 'Hello World'); + }).then(applied => { + assert.ok(applied); + assert.equal(doc.getText(), 'Hello World'); + assert.ok(doc.isDirty); + + return doc.save().then(saved => { + assert.ok(saved); + assert.ok(!doc.isDirty); + + return deleteFile(file); + }); + }); + }); + }); + }); + }); +}); \ No newline at end of file diff --git a/extensions/vscode-api-tests/src/index.ts b/extensions/vscode-api-tests/src/index.ts index 84f3fc542f3..9147c171546 100644 --- a/extensions/vscode-api-tests/src/index.ts +++ b/extensions/vscode-api-tests/src/index.ts @@ -21,7 +21,8 @@ const testRunner = require('vscode/lib/testrunner'); // See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info testRunner.configure({ ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true // colored output from test results + useColors: process.platform !== 'win32', // colored output from test results (only windows cannot handle) + timeout: 10000 }); export= testRunner; \ No newline at end of file diff --git a/extensions/vscode-api-tests/src/utils.ts b/extensions/vscode-api-tests/src/utils.ts new file mode 100644 index 00000000000..a95bd1ff43d --- /dev/null +++ b/extensions/vscode-api-tests/src/utils.ts @@ -0,0 +1,88 @@ +/*--------------------------------------------------------------------------------------------- + * 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 * as assert from 'assert'; +import * as vscode from 'vscode'; +import * as fs from 'fs'; +import * as os from 'os'; +import {join} from 'path'; + +function rndName() { + return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10); +} + +export function createRandomFile(contents = ''): Thenable { + return new Promise((resolve, reject) => { + const tmpFile = join(os.tmpdir(), rndName()); + fs.writeFile(tmpFile, contents, (error) => { + if (error) { + return reject(error); + } + + resolve(vscode.Uri.file(tmpFile)); + }); + }); +} + +export function pathEquals(path1: string, path2: string): boolean { + if (process.platform !== 'linux') { + path1 = path1.toLowerCase(); + path2 = path2.toLowerCase(); + } + + return path1 === path2; +} + +export function deleteFile(file: vscode.Uri): Thenable { + return new Promise((resolve, reject) => { + fs.unlink(file.fsPath, (err) => { + if (err) { + reject(err); + } else { + resolve(true); + } + }); + }); +} + +export function cleanUp(): Thenable { + return new Promise((c, e) => { + if (vscode.window.visibleTextEditors.length === 0) { + return c(); + } + + // TODO: the visibleTextEditors variable doesn't seem to be + // up to date after a onDidChangeActiveTextEditor event, not + // even using a setTimeout 0... so we MUST poll :( + const interval = setInterval(() => { + if (vscode.window.visibleTextEditors.length > 0) { + return; + } + + clearInterval(interval); + c(); + }, 10); + + vscode.commands.executeCommand('workbench.action.closeAllEditors') + .then(() => vscode.commands.executeCommand('workbench.files.action.closeAllFiles')) + .then(null, err => { + clearInterval(interval); + e(err); + }); + }).then(() => { + assert.equal(vscode.window.visibleTextEditors.length, 0); + assert(!vscode.window.activeTextEditor); + + // TODO: we can't yet make this assertion because when + // the phost creates a document and makes no changes to it, + // the main side doesn't know about it and the phost side + // assumes it exists. Calling closeAllFiles will not + // remove it from textDocuments array. :( + + // assert.equal(vscode.workspace.textDocuments.length, 0); + }); +} \ No newline at end of file diff --git a/extensions/vscode-api-tests/src/window.test.ts b/extensions/vscode-api-tests/src/window.test.ts index 7b0a5142702..faff4a89cfa 100644 --- a/extensions/vscode-api-tests/src/window.test.ts +++ b/extensions/vscode-api-tests/src/window.test.ts @@ -6,12 +6,21 @@ 'use strict'; import * as assert from 'assert'; -import {window, workspace} from 'vscode'; +import {workspace, window} from 'vscode'; +import {join} from 'path'; +import {cleanUp, pathEquals} from './utils'; -suite("window namespace texts", () => { +suite("window namespace tests", () => { - // test('open document fires event', (done) => { - - // }); + teardown(cleanUp); + test('active text editor', () => { + return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => { + return window.showTextDocument(doc).then((editor) => { + const active = window.activeTextEditor; + assert.ok(active); + assert.ok(pathEquals(active.document.uri.fsPath, doc.uri.fsPath)); + }); + }); + }); }); \ No newline at end of file diff --git a/extensions/vscode-api-tests/src/workspace.test.ts b/extensions/vscode-api-tests/src/workspace.test.ts index 4a89e6b278a..1ec0533d7c1 100644 --- a/extensions/vscode-api-tests/src/workspace.test.ts +++ b/extensions/vscode-api-tests/src/workspace.test.ts @@ -6,27 +6,30 @@ 'use strict'; import * as assert from 'assert'; -import {workspace, TextDocument} from 'vscode'; -import {join} from 'path'; +import {workspace, TextDocument, window, Position, Uri} from 'vscode'; +import {createRandomFile, deleteFile, cleanUp, pathEquals} from './utils'; +import {join, basename} from 'path'; +import * as fs from 'fs'; +import * as os from 'os'; suite('workspace-namespace', () => { + teardown(cleanUp); + test('textDocuments', () => { assert.ok(Array.isArray(workspace.textDocuments)); assert.throws(() => workspace.textDocuments = null); }); test('rootPath', () => { - assert.equal(workspace.rootPath, join(__dirname, '../testWorkspace')); + assert.ok(pathEquals(workspace.rootPath, join(__dirname, '../testWorkspace'))); assert.throws(() => workspace.rootPath = 'farboo'); }); - test('openTextDocument', done => { - workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => { + test('openTextDocument', () => { + return workspace.openTextDocument(join(workspace.rootPath, './far.js')).then(doc => { assert.ok(doc); - done(); - }, err => { - done(err); + assert.equal(workspace.textDocuments.length, 1); }); }); @@ -38,17 +41,89 @@ suite('workspace-namespace', () => { }); }); - // test('createTextDocument', done => { + test('openTextDocument, untitled is dirty', function(done) { + if (process.platform === 'win32') { + return done(); // TODO@Joh this test fails on windows + } + + workspace.openTextDocument(Uri.parse('untitled://' + join(workspace.rootPath, './newfile.txt'))).then(doc => { + assert.equal(doc.uri.scheme, 'untitled'); + assert.ok(doc.isDirty); + done(); + }); + }); - // let text = 'Das Pferd isst keinen Reis.' - - // workspace.createTextDocument(text).then(doc => { - // assert.equal(doc.getText(), text); + // test('openTextDocument, untitled closes on save', function(done) { + // workspace.openTextDocument(Uri.parse('untitled://' + join(workspace.rootPath, './newfile2.txt'))).then(doc => { // assert.equal(doc.uri.scheme, 'untitled'); - // assert.equal(doc.languageId, 'plaintext'); - // done(); - // }, err => { - // done(err); + // assert.ok(doc.isDirty); + + // let closed: TextDocument, opened: TextDocument; + // let d0 = workspace.onDidCloseTextDocument(e => closed = e); + // let d1 = workspace.onDidOpenTextDocument(e => opened = e); + + // function donedone() { + // assert.ok(closed === doc); + // assert.equal(opened.uri.scheme, 'file'); + // assert.equal(opened.uri.toString(), 'file:///' + join(workspace.rootPath, './newfile2.txt')) + // d0.dispose(); + // d1.dispose(); + + // deleteFile(opened.uri).then(done, done); + // } + + // doc.save().then(donedone, done); // }); - // }); + // }) + + test('events: onDidOpenTextDocument, onDidChangeTextDocument, onDidSaveTextDocument', () => { + return createRandomFile().then(file => { + let disposables = []; + + let onDidOpenTextDocument = false; + disposables.push(workspace.onDidOpenTextDocument(e => { + assert.ok(pathEquals(e.uri.fsPath, file.fsPath)); + onDidOpenTextDocument = true; + })); + + let onDidChangeTextDocument = false; + disposables.push(workspace.onDidChangeTextDocument(e => { + assert.ok(pathEquals(e.document.uri.fsPath, file.fsPath)); + onDidChangeTextDocument = true; + })); + + let onDidSaveTextDocument = false; + disposables.push(workspace.onDidSaveTextDocument(e => { + assert.ok(pathEquals(e.uri.fsPath, file.fsPath)); + onDidSaveTextDocument = true; + })); + + return workspace.openTextDocument(file).then(doc => { + return window.showTextDocument(doc).then((editor) => { + return editor.edit((builder) => { + builder.insert(new Position(0, 0), 'Hello World'); + }).then(applied => { + return doc.save().then(saved => { + assert.ok(onDidOpenTextDocument); + assert.ok(onDidChangeTextDocument); + assert.ok(onDidSaveTextDocument); + + while (disposables.length) { + disposables.pop().dispose(); + } + + return deleteFile(file); + }); + }); + }); + }); + }); + }); + + test('findFiles', () => { + return workspace.findFiles('*.js', null).then((res) => { + assert.equal(res.length, 1); + assert.equal(basename(workspace.asRelativePath(res[0])), 'far.js'); + }); + }); }); \ No newline at end of file diff --git a/extensions/xml/package.json b/extensions/xml/package.json index 720107072d1..e3e9e0474c2 100644 --- a/extensions/xml/package.json +++ b/extensions/xml/package.json @@ -6,13 +6,70 @@ "contributes": { "languages": [{ "id": "xml", - "extensions": [ ".xml", ".dtd", ".ascx", ".csproj", ".config", ".wxi", ".wxl", ".wxs", ".xaml", ".svg", ".svgz" ], + "extensions": [ + ".ascx", + ".axml", + ".bpmn", + ".config", + ".cpt", + ".csl", + ".csproj", + ".csproj.user", + ".dita", + ".ditamap", + ".dtd", + ".dtml", + ".fsproj", + ".fxml", + ".iml", + ".isml", + ".jmx", + ".launch", + ".menu", + ".mxml", + ".nuspec", + ".opml", + ".owl", + ".proj", + ".pt", + ".pubxml", + ".pubxml.user", + ".rdf", + ".rng", + ".rss", + ".shproj", + ".storyboard", + ".svg", + ".targets", + ".tld", + ".vbproj", + ".vbproj.user", + ".vcxproj", + ".vcxproj.filters", + ".wsdl", + ".wxi", + ".wxl", + ".wxs", + ".xaml", + ".xbl", + ".xib", + ".xlf", + ".xliff", + ".xml", + ".xpdl", + ".xsd", + ".xul", + ".xoml" + ], "firstLine" : "(\\<\\?xml.*)|(\\=1.2.1 <2.0.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz" + }, + "nan": { + "version": "2.1.0", + "from": "nan@>=2.1.0 <3.0.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.1.0.tgz" + } + } } } } diff --git a/package.json b/package.json index 8d66870c809..b31c56c75aa 100644 --- a/package.json +++ b/package.json @@ -1,87 +1,97 @@ { - "name": "Code", - "version": "0.10.1", - "electronVersion": "0.34.1", - "author": { - "name": "Microsoft Corporation" - }, - "main": "./out/vs/workbench/electron-main/bootstrap", - "private": true, - "engines": { - "node": ">= 0.10.0 < 0.11.0" - }, - "scripts": { - "test": "node node_modules/mocha/bin/_mocha", - "postinstall": "npm --prefix extensions/csharp-o/ install extensions/csharp-o/" - }, - "dependencies": { - "applicationinsights": "0.15.6", - "chokidar": "1.0.5", - "emmet": "^1.3.0", - "getmac": "1.0.7", - "graceful-fs": "4.1.2", - "http-proxy-agent": "^0.2.6", - "https-proxy-agent": "^0.3.5", - "iconv-lite": "^0.4.13", - "sax": "^1.1.1", - "semver": "^4.2.0", - "vscode-textmate": "^1.0.6", - "winreg": "0.0.12", - "yauzl": "^2.3.1" - }, - "devDependencies": { - "async": "^1.4.0", - "atom-shell-installer-assets": "^0.2.0", - "azure-storage": "^0.3.1", - "clone": "^1.0.2", - "debounce": "^1.0.0", - "event-stream": "^3.1.7", - "express": "^4.13.1", - "glob": "^5.0.13", - "gulp": "^3.8.9", - "gulp-atom-electron": "^0.17.2", - "gulp-azure-storage": "^0.3.0", - "gulp-bom": "^1.0.0", - "gulp-concat": "^2.6.0", - "gulp-filter": "^3.0.0", - "gulp-insert": "^0.5.0", - "gulp-json-editor": "^2.2.1", - "gulp-minify-css": "^1.2.1", - "clean-css": "3.4.6", - "gulp-mocha": "^2.1.3", - "gulp-remote-src": "^0.4.0", - "gulp-rename": "^1.2.0", - "gulp-sourcemaps": "^1.6.0", - "gulp-tsb": "^1.7.3", - "gulp-uglify": "^1.4.1", - "gulp-util": "^3.0.6", - "gulp-symdest": "^1.0.0", - "gulp-vinyl-zip": "^1.1.0", - "gulp-watch": "^4.2.4", - "innosetup-compiler": "^5.5.60", - "istanbul": "^0.3.17", - "jsdom-no-contextify": "^3.1.0", - "json-comments": "^0.2.1", - "lazy.js": "^0.4.2", - "mime": "1.2.11", - "minimatch": "^2.0.10", - "mkdirp": "^0.5.0", - "mocha": "^2.2.5", - "object-assign": "^4.0.1", - "optimist": "0.3.5", - "queue": "3.0.6", - "rimraf": "^2.2.8", - "sinon": "^1.17.2", - "source-map": "^0.4.4", - "uglify-js": "2.4.8", - "underscore": "^1.8.2", - "vinyl": "^0.4.5" - }, - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/vscode.git" - }, - "bugs": { - "url": "https://github.com/Microsoft/vscode/issues" - } -} \ No newline at end of file + "name": "Code", + "version": "0.10.3", + "electronVersion": "0.34.5", + "author": { + "name": "Microsoft Corporation" + }, + "main": "./out/vs/workbench/electron-main/bootstrap", + "private": true, + "engines": { + "node": ">= 0.10.0 < 0.11.0" + }, + "scripts": { + "test": "node node_modules/mocha/bin/_mocha", + "preinstall": "node build/npm/preinstall.js", + "postinstall": "npm --prefix extensions/vscode-api-tests/ install extensions/vscode-api-tests/" + }, + "dependencies": { + "applicationinsights": "0.15.6", + "chokidar": "1.0.5", + "emmet": "^1.3.0", + "getmac": "1.0.7", + "graceful-fs": "4.1.2", + "http-proxy-agent": "^0.2.6", + "https-proxy-agent": "^0.3.5", + "iconv-lite": "^0.4.13", + "sax": "^1.1.1", + "semver": "^4.2.0", + "vscode-textmate": "^1.0.8", + "native-keymap": "^0.0.2", + "winreg": "0.0.12", + "yauzl": "^2.3.1" + }, + "devDependencies": { + "async": "^1.4.0", + "azure-storage": "^0.3.1", + "clean-css": "3.4.6", + "clone": "^1.0.2", + "debounce": "^1.0.0", + "event-stream": "^3.1.7", + "express": "^4.13.1", + "ghooks": "^1.0.1", + "glob": "^5.0.13", + "gulp": "^3.8.9", + "gulp-atom-electron": "^1.1.0", + "gulp-azure-storage": "^0.3.0", + "gulp-bom": "^1.0.0", + "gulp-concat": "^2.6.0", + "gulp-filter": "^3.0.0", + "gulp-insert": "^0.5.0", + "gulp-json-editor": "^2.2.1", + "gulp-minify-css": "^1.2.1", + "gulp-mocha": "^2.1.3", + "gulp-remote-src": "^0.4.0", + "gulp-rename": "^1.2.0", + "gulp-sourcemaps": "^1.6.0", + "gulp-symdest": "^1.0.0", + "gulp-tsb": "^1.7.3", + "gulp-uglify": "^1.4.1", + "gulp-util": "^3.0.6", + "gulp-vinyl-zip": "^1.1.0", + "gulp-watch": "^4.2.4", + "innosetup-compiler": "^5.5.60", + "istanbul": "^0.3.17", + "jsdom-no-contextify": "^3.1.0", + "json-comments": "^0.2.1", + "lazy.js": "^0.4.2", + "mime": "1.2.11", + "minimatch": "^2.0.10", + "mkdirp": "^0.5.0", + "mocha": "^2.2.5", + "object-assign": "^4.0.1", + "optimist": "0.3.5", + "queue": "3.0.6", + "rimraf": "^2.2.8", + "sinon": "^1.17.2", + "source-map": "^0.4.4", + "uglify-js": "2.4.8", + "underscore": "^1.8.2", + "vinyl": "^0.4.5" + }, + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/vscode.git" + }, + "bugs": { + "url": "https://github.com/Microsoft/vscode/issues" + }, + "config": { + "ghooks": { + "pre-commit": "node build/gulpfile.hygiene.js" + } + }, + "optionalDependencies": { + "windows-mutex": "^0.2.0" + } +} diff --git a/product.json b/product.json index a9977f2440b..e17a8d3020e 100644 --- a/product.json +++ b/product.json @@ -4,6 +4,7 @@ "win32ExeBasename": "CodeOSS", "companyName": "Microsoft Corporation", "copyright": "Copyright (C) 2015 Microsoft. All rights reserved", + "licenseUrl": "https://github.com/Microsoft/vscode/blob/master/LICENSE.txt", "darwinBundleIdentifier": "code.visualstudio.com.Code", "darwinApplicationCategoryType": "public.app-category.developer-tools", "darwinBundleDocumentTypes": [{ diff --git a/scripts/code.bat b/scripts/code.bat index 82a0e57162d..9f8ce705cdb 100644 --- a/scripts/code.bat +++ b/scripts/code.bat @@ -1,12 +1,24 @@ @echo off title VSCode Dev +pushd %~dp0\.. + +:: Node modules +if not exist node_modules call .\scripts\npm.bat install + +:: Get electron +node .\node_modules\gulp\bin\gulp.js electron + +:: Build +if not exist out node .\node_modules\gulp\bin\gulp.js compile + +:: Configuration set NODE_ENV=development set VSCODE_DEV=1 +set ELECTRON_DEFAULT_ERROR_MODE=1 set ELECTRON_ENABLE_LOGGING=1 set ELECTRON_ENABLE_STACK_DUMPING=1 -pushd %~dp0\.. -node .\node_modules\gulp\bin\gulp.js electron -..\Electron-Build\CodeOSS.exe . %* +:: Launch Code +.\.build\electron\CodeOSS.exe . %* popd diff --git a/scripts/code.sh b/scripts/code.sh index 44e2ff3ffb8..6f080650a64 100755 --- a/scripts/code.sh +++ b/scripts/code.sh @@ -7,17 +7,30 @@ else ROOT=$(dirname $(dirname $(readlink -f $0))) fi -# Configuration -export NODE_ENV=development -export VSCODE_DEV=1 -export ELECTRON_ENABLE_LOGGING=1 -export ELECTRON_ENABLE_STACK_DUMPING=1 +function code() { + cd $ROOT -# Prepare -cd $ROOT ; node node_modules/gulp/bin/gulp.js electron + # Node modules + test -d node_modules || ./scripts/npm.sh install -if [[ "$OSTYPE" == "darwin"* ]]; then - cd $ROOT; ../Electron-Build/Electron.app/Contents/MacOS/Electron . $* -else - cd $ROOT; ../Electron-Build/electron . $* -fi + # Get electron + node node_modules/gulp/bin/gulp.js electron + + # Build + test -d out || gulp compile + + # Configuration + export NODE_ENV=development + export VSCODE_DEV=1 + export ELECTRON_ENABLE_LOGGING=1 + export ELECTRON_ENABLE_STACK_DUMPING=1 + + # Launch Code + if [[ "$OSTYPE" == "darwin"* ]]; then + ./.build/electron/Electron.app/Contents/MacOS/Electron . $* + else + ./.build/electron/electron . $* + fi +} + +code $* diff --git a/src/bootstrap.js b/src/bootstrap.js index d3e6e707d23..43458652f50 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -63,16 +63,24 @@ if (!!process.send && process.env.PIPE_LOGGING === 'true') { return res; } + function safeSend(arg) { + try { + process.send(arg); + } catch (error) { + // Can happen if the parent channel is closed meanwhile + } + } + // Pass console logging to the outside so that we have it in the main side if told so if (process.env.VERBOSE_LOGGING === 'true') { - console.log = function () { process.send({ type: '__$console', severity: 'log', arguments: safeStringify(arguments) }); }; - console.warn = function () { process.send({ type: '__$console', severity: 'warn', arguments: safeStringify(arguments) }); }; + console.log = function () { safeSend({ type: '__$console', severity: 'log', arguments: safeStringify(arguments) }); }; + console.warn = function () { safeSend({ type: '__$console', severity: 'warn', arguments: safeStringify(arguments) }); }; } else { console.log = function () { /* ignore */ }; console.warn = function () { /* ignore */ }; } - console.error = function () { process.send({ type: '__$console', severity: 'error', arguments: safeStringify(arguments) }); }; + console.error = function () { safeSend({ type: '__$console', severity: 'error', arguments: safeStringify(arguments) }); }; // Let stdout, stderr and stdin be no-op streams. This prevents an issue where we would get an EBADF // error when we are inside a forked process and this process tries to access those channels. diff --git a/src/typings/https-proxy-agent.d.ts b/src/typings/https-proxy-agent.d.ts index d251b9f3130..b4be3e030b5 100644 --- a/src/typings/https-proxy-agent.d.ts +++ b/src/typings/https-proxy-agent.d.ts @@ -5,8 +5,19 @@ declare module 'https-proxy-agent' { + import * as tls from 'tls'; + + interface IHttpsProxyAgentOptions extends tls.ConnectionOptions { + host: string; + port: number; + secureProxy?: boolean; + secureEndpoint?: boolean; + } + class HttpsProxyAgent { constructor(proxy: string); + constructor(opts: IHttpsProxyAgentOptions); } + export = HttpsProxyAgent; } \ No newline at end of file diff --git a/extensions/csharp-o/src/typings/ref.d.ts b/src/typings/native-keymap.d.ts similarity index 54% rename from extensions/csharp-o/src/typings/ref.d.ts rename to src/typings/native-keymap.d.ts index 95498a3fb9c..af80ddaeaf3 100644 --- a/extensions/csharp-o/src/typings/ref.d.ts +++ b/src/typings/native-keymap.d.ts @@ -3,8 +3,16 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -/// -/// -/// -/// -/// \ No newline at end of file +declare module 'native-keymap' { + + export interface INativeKeyMap { + key_code: string; + value: string; + withShift: string; + withAltGr: string; + withShiftAltGr: string; + } + + export function getKeyMap(): INativeKeyMap[]; + +} \ No newline at end of file diff --git a/src/typings/windows-mutex.ts b/src/typings/windows-mutex.ts new file mode 100644 index 00000000000..039dffcc2ad --- /dev/null +++ b/src/typings/windows-mutex.ts @@ -0,0 +1,12 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +declare module 'windows-mutex' { + export class Mutex { + constructor(name: string); + isActive(): boolean; + release(): void; + } +} \ No newline at end of file diff --git a/src/vs/base/browser/browser.ts b/src/vs/base/browser/browser.ts index 31038fa56dc..513203741e1 100644 --- a/src/vs/base/browser/browser.ts +++ b/src/vs/base/browser/browser.ts @@ -55,7 +55,6 @@ var globals = (typeof self === 'object' ? self : global); var userAgent = globals.navigator ? globals.navigator.userAgent : ''; var isTest = !!globals.isTest; -var isPseudo = globals.document && globals.document.URL.match(/[^\?]*\?[^\#]*pseudo=true/); // DOCUMENTED FOR FUTURE REFERENCE: // When running IE11 in IE10 document mode, the code below will identify the browser as being IE10, diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts index 29fd964ea8a..88ac5bee779 100644 --- a/src/vs/base/browser/dom.ts +++ b/src/vs/base/browser/dom.ts @@ -1046,25 +1046,6 @@ export function removeScriptTags(html:string):string { return div.innerHTML; }; -export function parseSearch():{[key:string]:string} { - var result:{[key:string]:string} = {}; - var search = window.location.search; - if (search) { - var params = search.split(/[?&]/); - for (var i = 0; i < params.length; i++) { - var param = params[i]; - if (param) { - var keyValue = param.split('='); - if (keyValue.length === 2) { - result[keyValue[0]] = decodeURIComponent(keyValue[1]); - } - } - } - } - - return result; -} - export function append(parent: HTMLElement, child: T): T { parent.appendChild(child); return child; diff --git a/src/vs/base/browser/globalMouseMoveMonitor.ts b/src/vs/base/browser/globalMouseMoveMonitor.ts index bf6f02d77e4..de03d86bc42 100644 --- a/src/vs/base/browser/globalMouseMoveMonitor.ts +++ b/src/vs/base/browser/globalMouseMoveMonitor.ts @@ -38,45 +38,45 @@ export function standardMouseMoveMerger(lastEvent:IStandardMouseMoveEventData, c } export class GlobalMouseMoveMonitor implements Lifecycle.IDisposable { - + private hooks:Lifecycle.IDisposable[]; private mouseMoveEventMerger:IEventMerger; private mouseMoveCallback:IMouseMoveCallback; private onStopCallback:IOnStopCallback; - + constructor() { this.hooks = []; this.mouseMoveEventMerger = null; this.mouseMoveCallback = null; this.onStopCallback = null; } - + public dispose(): void { this.stopMonitoring(false); } - + public stopMonitoring(invokeStopCallback:boolean): void { if (!this.isMonitoring()) { // Not monitoring return; } - + // Unhook this.hooks = Lifecycle.disposeAll(this.hooks); this.mouseMoveEventMerger = null; this.mouseMoveCallback = null; var onStopCallback = this.onStopCallback; this.onStopCallback = null; - + if (invokeStopCallback) { onStopCallback(); } } - + public isMonitoring() { return this.hooks.length > 0; } - + public startMonitoring( mouseMoveEventMerger:IEventMerger, mouseMoveCallback:IMouseMoveCallback, @@ -89,7 +89,7 @@ export class GlobalMouseMoveMonitor implements Lifecycle.IDisposable { this.mouseMoveEventMerger = mouseMoveEventMerger; this.mouseMoveCallback = mouseMoveCallback; this.onStopCallback = onStopCallback; - + var windowChain = IframeUtils.getSameOriginWindowChain(); for (var i = 0; i < windowChain.length; i++) { this.hooks.push(DomUtils.addDisposableThrottledListener(windowChain[i].window.document, 'mousemove', @@ -98,7 +98,7 @@ export class GlobalMouseMoveMonitor implements Lifecycle.IDisposable { )); this.hooks.push(DomUtils.addDisposableListener(windowChain[i].window.document, 'mouseup', (e:MouseEvent) => this.stopMonitoring(true))); } - + if (IframeUtils.hasDifferentOriginAncestor()) { var lastSameOriginAncestor = windowChain[windowChain.length - 1]; // We might miss a mouse up if it happens outside the iframe diff --git a/src/vs/base/browser/idleMonitor.ts b/src/vs/base/browser/idleMonitor.ts index 5524eae01f7..f5637be62a8 100644 --- a/src/vs/base/browser/idleMonitor.ts +++ b/src/vs/base/browser/idleMonitor.ts @@ -17,7 +17,7 @@ export enum UserStatus { export var DEFAULT_IDLE_TIME = 60 * 60 * 1000; // 60 minutes export class IdleMonitor { - + private toDispose:Lifecycle.IDisposable[]; private lastActiveTime:number; private idleCheckTimeout:number; @@ -25,41 +25,41 @@ export class IdleMonitor { private eventEmitter:EventEmitter.EventEmitter; private instance:ReferenceCountedIdleMonitor; private idleTime:number; - + constructor(idleTime:number = DEFAULT_IDLE_TIME) { this.instance = ReferenceCountedIdleMonitor.INSTANCE; this.instance.increment(); - + this.status = null; this.idleCheckTimeout = -1; this.lastActiveTime = -1; this.idleTime = idleTime; - + this.toDispose = []; this.eventEmitter = new EventEmitter.EventEmitter(); this.toDispose.push(this.eventEmitter); this.toDispose.push({dispose: this.instance.addListener(() => this.onUserActive())}); this.onUserActive(); } - + public addOneTimeActiveListener(callback:()=>void): Lifecycle.IDisposable { return this.eventEmitter.addOneTimeDisposableListener('onActive', callback); } - + public addOneTimeIdleListener(callback:()=>void): Lifecycle.IDisposable { return this.eventEmitter.addOneTimeDisposableListener('onIdle', callback); } - + public getStatus(): UserStatus { return this.status; } - + public dispose(): void { this.cancelIdleCheck(); this.toDispose = Lifecycle.disposeAll(this.toDispose); this.instance.decrement(); } - + private onUserActive(): void { this.lastActiveTime = (new Date()).getTime(); if (this.status !== UserStatus.Active) { @@ -68,14 +68,14 @@ export class IdleMonitor { this.eventEmitter.emit('onActive'); } } - + private onUserIdle(): void { if (this.status !== UserStatus.Idle) { this.status = UserStatus.Idle; this.eventEmitter.emit('onIdle'); } } - + private scheduleIdleCheck(): void { if (this.idleCheckTimeout === -1) { var minimumTimeWhenUserCanBecomeIdle = this.lastActiveTime + this.idleTime; @@ -85,14 +85,14 @@ export class IdleMonitor { }, minimumTimeWhenUserCanBecomeIdle - (new Date()).getTime()); } } - + private cancelIdleCheck(): void { if (this.idleCheckTimeout !== -1) { clearTimeout(this.idleCheckTimeout); this.idleCheckTimeout = -1; } } - + private checkIfUserIsIdle(): void { var actualIdleTime = (new Date()).getTime() - this.lastActiveTime; if (actualIdleTime >= this.idleTime) { @@ -104,20 +104,20 @@ export class IdleMonitor { } class ReferenceCountedObject { - + private referenceCount:number; - + constructor() { this.referenceCount = 0; } - + public increment(): void { if (this.referenceCount === 0) { this.construct(); } this.referenceCount++; } - + public decrement(): void { if (this.referenceCount > 0) { this.referenceCount--; @@ -126,23 +126,23 @@ class ReferenceCountedObject { } } } - + public construct(): void { throw new Error('Implement me'); } - + public dispose(): void { throw new Error('Implement me'); } } class ReferenceCountedIdleMonitor extends ReferenceCountedObject { - + public static INSTANCE:ReferenceCountedIdleMonitor = new ReferenceCountedIdleMonitor(); - + private toDispose:Lifecycle.IDisposable[]; private eventEmitter:EventEmitter.EventEmitter; - + public construct(): void { this.toDispose = []; this.eventEmitter = new EventEmitter.EventEmitter(); @@ -151,15 +151,15 @@ class ReferenceCountedIdleMonitor extends ReferenceCountedObject { this.toDispose.push(DomUtils.addDisposableListener(BrowserService.getService().document, 'keydown', () => this.onUserActive())); this.onUserActive(); } - + public dispose(): void { this.toDispose = Lifecycle.disposeAll(this.toDispose); } - + private onUserActive(): void { this.eventEmitter.emit('onActive'); } - + public addListener(callback:()=>void):EventEmitter.ListenerUnbind { return this.eventEmitter.addListener('onActive', callback); } diff --git a/src/vs/base/browser/iframe.ts b/src/vs/base/browser/iframe.ts index 91a075e8861..d080ea4aeeb 100644 --- a/src/vs/base/browser/iframe.ts +++ b/src/vs/base/browser/iframe.ts @@ -25,7 +25,7 @@ function getParentWindowIfSameOrigin(w:Window): Window { if (!w.parent || w.parent === w) { return null; } - + // Cannot really tell if we have access to the parent window unless we try to access something in it try { var location = w.location; @@ -38,7 +38,7 @@ function getParentWindowIfSameOrigin(w:Window): Window { hasDifferentOriginAncestorFlag = true; return null; } - + return w.parent; } @@ -97,34 +97,34 @@ export function hasDifferentOriginAncestor(): boolean { * Returns the position of `childWindow` relative to `ancestorWindow` */ export function getPositionOfChildWindowRelativeToAncestorWindow(childWindow:Window, ancestorWindow:any) { - + if (!ancestorWindow || childWindow === ancestorWindow) { return { top: 0, left: 0 }; } - + var top = 0, left = 0; - + var windowChain = getSameOriginWindowChain(); - + for (var i = 0; i < windowChain.length; i++) { var windowChainEl = windowChain[i]; - + if (windowChainEl.window === ancestorWindow) { break; } - + if (!windowChainEl.iframeElement) { break; } - + var boundingRect = windowChainEl.iframeElement.getBoundingClientRect(); top += boundingRect.top; left += boundingRect.left; } - + return { top: top, left: left diff --git a/src/vs/base/browser/ui/inputbox/inputBox.ts b/src/vs/base/browser/ui/inputbox/inputBox.ts index 77c198e4600..70051e5d296 100644 --- a/src/vs/base/browser/ui/inputbox/inputBox.ts +++ b/src/vs/base/browser/ui/inputbox/inputBox.ts @@ -343,6 +343,9 @@ export class InputBox extends ee.EventEmitter { } public dispose(): void { + + this.toDispose = lifecycle.disposeAll(this.toDispose); + this._hideMessage(); this.element = null; diff --git a/src/vs/base/browser/ui/messagelist/messageList.css b/src/vs/base/browser/ui/messagelist/messageList.css index 29e3afb272b..2567d03bd71 100644 --- a/src/vs/base/browser/ui/messagelist/messageList.css +++ b/src/vs/base/browser/ui/messagelist/messageList.css @@ -24,7 +24,7 @@ box-shadow: 0 2px 8px #000; } -.hc-dark .global-message-list { +.hc-black .global-message-list { box-shadow: none; } diff --git a/src/vs/base/browser/ui/resourceviewer/resourceViewer.ts b/src/vs/base/browser/ui/resourceviewer/resourceViewer.ts index 00dad2a38ea..dd4454650a0 100644 --- a/src/vs/base/browser/ui/resourceviewer/resourceViewer.ts +++ b/src/vs/base/browser/ui/resourceviewer/resourceViewer.ts @@ -9,6 +9,7 @@ import 'vs/css!./resourceviewer'; import nls = require('vs/nls'); import strings = require('vs/base/common/strings'); import mimes = require('vs/base/common/mime'); +import URI from 'vs/base/common/uri'; import paths = require('vs/base/common/paths'); import {Builder, $} from 'vs/base/browser/builder'; import DOM = require('vs/base/browser/dom'); @@ -69,16 +70,16 @@ const mapExtToMediaMimes = { */ export class ResourceViewer { - public static show(name: string, url: string, container: Builder, scrollbar?: IScrollableElement): void { + public static show(name: string, resource: URI, container: Builder, scrollbar?: IScrollableElement): void { // Ensure CSS class $(container).addClass('monaco-resource-viewer'); // Lookup media mime if any let mime: string; - const ext = paths.extname(url); + const ext = paths.extname(resource.toString()); if (ext) { - mime = mapExtToMediaMimes[ext]; + mime = mapExtToMediaMimes[ext.toLowerCase()]; } if (!mime) { @@ -91,7 +92,7 @@ export class ResourceViewer { .empty() .style({ paddingLeft: '20px' }) // restore CSS value in case the user saw a PDF before where we remove padding .img({ - src: url + '?' + new Date().getTime() // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique + src: resource.toString() + '?' + new Date().getTime() // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique }).on(DOM.EventType.LOAD, () => { if (scrollbar) { scrollbar.onElementInternalDimensions(); @@ -106,7 +107,7 @@ export class ResourceViewer { .style({ padding: 0, margin: 0 }) // We really do not want any paddings or margins when displaying PDFs .element('object') .attr({ - data: url + '?' + new Date().getTime(), // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique + data: resource.toString() + '?' + new Date().getTime(), // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique width: '100%', height: '100%', type: mime @@ -120,7 +121,7 @@ export class ResourceViewer { .style({ paddingLeft: '20px' }) // restore CSS value in case the user saw a PDF before where we remove padding .element('audio') .attr({ - src: url + '?' + new Date().getTime(), // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique + src: resource.toString() + '?' + new Date().getTime(), // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique text: nls.localize('missingAudioSupport', "Sorry but playback of audio files is not supported."), controls: 'controls' }).on(DOM.EventType.LOAD, () => { @@ -137,7 +138,7 @@ export class ResourceViewer { .style({ paddingLeft: '20px' }) // restore CSS value in case the user saw a PDF before where we remove padding .element('video') .attr({ - src: url + '?' + new Date().getTime(), // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique + src: resource.toString() + '?' + new Date().getTime(), // We really want to avoid the browser from caching this resource, so we add a fake query param that is unique text: nls.localize('missingVideoSupport', "Sorry but playback of video files is not supported."), controls: 'controls' }).on(DOM.EventType.LOAD, () => { diff --git a/src/vs/base/common/async.ts b/src/vs/base/common/async.ts index 69a3650533b..423009848f9 100644 --- a/src/vs/base/common/async.ts +++ b/src/vs/base/common/async.ts @@ -224,7 +224,7 @@ export class Delayer { * Simply combine the two mail man strategies from the Throttler and Delayer * helpers, for an analogy. */ -export class ThrottledDelayer extends Delayer { +export class ThrottledDelayer extends Delayer> { private throttler: Throttler; @@ -234,7 +234,7 @@ export class ThrottledDelayer extends Delayer { this.throttler = new Throttler(); } - public trigger(promiseFactory: ITask, delay?: number): Promise { + public trigger(promiseFactory: ITask>, delay?: number): Promise { return super.trigger(() => this.throttler.queue(promiseFactory), delay); } } @@ -243,7 +243,7 @@ export class ThrottledDelayer extends Delayer { * Similar to the ThrottledDelayer, except it also guarantees that the promise * factory doesn't get called more often than every `minimumPeriod` milliseconds. */ -export class PeriodThrottledDelayer extends ThrottledDelayer { +export class PeriodThrottledDelayer extends ThrottledDelayer { private minimumPeriod: number; private periodThrottler: Throttler; @@ -255,7 +255,7 @@ export class PeriodThrottledDelayer extends ThrottledDelayer { this.periodThrottler = new Throttler(); } - public trigger(promiseFactory: ITask, delay?: number): Promise { + public trigger(promiseFactory: ITask>, delay?: number): Promise { return super.trigger(() => { return this.periodThrottler.queue(() => { return Promise.join([ diff --git a/src/vs/base/common/collections.ts b/src/vs/base/common/collections.ts index dba6af36976..0fd34ece7f5 100644 --- a/src/vs/base/common/collections.ts +++ b/src/vs/base/common/collections.ts @@ -94,7 +94,7 @@ export function contains(from:any, what:any):boolean { export function keys(from:IStringDictionary):IIterable; export function keys(from:INumberDictionary):IIterable; export function keys(from:any):IIterable { - + return { every: function(callback:(element:any)=>boolean):boolean { for (var key in from) { @@ -174,7 +174,7 @@ export function groupBy(data: T[], groupFn: (element: T) => string): IStringD * compatible with the JavaScript array. */ export interface IIterable { - + /** * Iterates over every element in the array * as long as the callback does not return some @@ -273,33 +273,33 @@ interface ICacheRow { * removes the older elements as new ones are inserted. */ export class LimitedSizeCache { - + private cache: { [id: string]: ICacheRow }; private order: string[]; - + constructor(private size: number) { this.cache = Object.create(null); this.order = []; } - + public get(id: string): T { var result = this.cache[id]; return result && result.element; } - + public put(id: string, element: T, onRemove: ()=>void): void { var existing = this.cache[id]; var row: ICacheRow = { element: element, onRemove: onRemove }; - + this.cache[id] = row; - + if (!existing) { this.order.push(id); } - + this.swipe(); } - + private swipe(): void { while (this.order.length > this.size) { var id = this.order.shift(); diff --git a/src/vs/base/common/flags.ts b/src/vs/base/common/flags.ts index 779cd213d0f..5ccc72dd7fe 100644 --- a/src/vs/base/common/flags.ts +++ b/src/vs/base/common/flags.ts @@ -6,18 +6,8 @@ import { globals } from 'vs/base/common/platform'; -function getWorkersCount(): number { - var defaultValue = 2; - var url_matches = (globals.location ? globals.location.search : '').match(/monaco-workers=(\d+)/i); - if (url_matches) { - defaultValue = parseInt(url_matches[1], 10); - } - return environment('workersCount', defaultValue); -} - -export const workersCount = getWorkersCount(); +export const workersCount = environment('workersCount', 2); export const enableTasks = environment('enableTasks'); -export const enableSendASmile = environment('enableSendASmile'); export const enableJavaScriptRewriting = environment('enableJavaScriptRewriting'); export const enableTypeScriptServiceMode = environment('enableTypeScriptServiceMode'); export const enableTypeScriptServiceModeForJS = environment('enableTypeScriptServiceModeForJS'); diff --git a/src/vs/base/common/graph.ts b/src/vs/base/common/graph.ts index 2272ff58a62..d091ce92dca 100644 --- a/src/vs/base/common/graph.ts +++ b/src/vs/base/common/graph.ts @@ -22,13 +22,13 @@ export function newNode(data:T):Node { } export class Graph { - + private _nodes:{[key:string]:Node} = Object.create(null); - + constructor(private _hashFn:(element:T)=>string) { // empty } - + public roots():Node[] { var ret:Node[] = []; collections.forEach(this._nodes, entry => { @@ -38,7 +38,7 @@ export class Graph { }); return ret; } - + public traverse(start:T, inwards:boolean, callback:(data:T)=>void):void { var startNode = this.lookup(start); if(!startNode) { @@ -46,7 +46,7 @@ export class Graph { } this._traverse(startNode, inwards, {}, callback); } - + private _traverse(node:Node, inwards:boolean, seen:{[key:string]:boolean}, callback:(data:T)=>void):void { var key = this._hashFn(node.data); if(collections.contains(seen, key)) { @@ -57,15 +57,15 @@ export class Graph { var nodes = inwards ? node.outgoing : node.incoming; collections.forEach(nodes, (entry) => this._traverse(entry.value, inwards, seen, callback)); } - + public insertEdge(from:T, to:T):void { var fromNode = this.lookupOrInsertNode(from), toNode = this.lookupOrInsertNode(to); - + fromNode.outgoing[this._hashFn(to)] = toNode; toNode.incoming[this._hashFn(from)] = fromNode; } - + public removeNode(data:T):void { var key = this._hashFn(data); delete this._nodes[key]; @@ -74,23 +74,23 @@ export class Graph { delete entry.value.incoming[key]; }); } - + public lookupOrInsertNode(data:T):Node { var key = this._hashFn(data), node = collections.lookup(this._nodes, key); - + if(!node) { node = newNode(data); this._nodes[key] = node; } - + return node; } - + public lookup(data:T):Node { return collections.lookup(this._nodes, this._hashFn(data)); } - + public get length():number { return Object.keys(this._nodes).length; } diff --git a/src/vs/base/common/http.ts b/src/vs/base/common/http.ts index 932bc57e1e4..63a1721b113 100644 --- a/src/vs/base/common/http.ts +++ b/src/vs/base/common/http.ts @@ -4,6 +4,8 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; +import nls = require('vs/nls'); + // Methods export var GET = 'GET'; export var POST = 'POST'; @@ -129,4 +131,31 @@ export function parseChunkedData(request:IXHRResponse, collection:IDataChunk[], collection.push(newDataChunk(responseText, offset, contentLengthPattern.lastIndex - 2, contentLength)); offset = contentLengthPattern.lastIndex + contentLength; } +} + +export function getErrorStatusDescription(status: number) : string { + if (status < 400) { + return void 0; + } + switch (status) { + case 400: return nls.localize('status.400', 'Bad request. The request cannot be fulfilled due to bad syntax.'); + case 401: return nls.localize('status.401', 'Unauthorized. The server is refusing to respond.'); + case 403: return nls.localize('status.403', 'Forbidden. The server is refusing to respond.'); + case 404: return nls.localize('status.404', 'Not Found. The requested location could not be found.'); + case 405: return nls.localize('status.405', 'Method not allowed. A request was made using a request method not supported by that location.'); + case 406: return nls.localize('status.406', 'Not Acceptable. The server can only generate a response that is not accepted by the client.'); + case 407: return nls.localize('status.407', 'Proxy Authentication Required. The client must first authenticate itself with the proxy.'); + case 408: return nls.localize('status.408', 'Request Timeout. The server timed out waiting for the request.'); + case 409: return nls.localize('status.409', 'Conflict. The request could not be completed because of a conflict in the request.'); + case 410: return nls.localize('status.410', 'Gone. The requested page is no longer available.'); + case 411: return nls.localize('status.411', 'Length Required. The "Content-Length" is not defined.'); + case 412: return nls.localize('status.412', 'Precondition Failed. The precondition given in the request evaluated to false by the server.'); + case 413: return nls.localize('status.413', 'Request Entity Too Large. The server will not accept the request, because the request entity is too large.'); + case 414: return nls.localize('status.414', 'Request-URI Too Long. The server will not accept the request, because the URL is too long.'); + case 415: return nls.localize('status.415', 'Unsupported Media Type. The server will not accept the request, because the media type is not supported.'); + case 500: return nls.localize('status.500', 'Internal Server Error.'); + case 501: return nls.localize('status.501', 'Not Implemented. The server either does not recognize the request method, or it lacks the ability to fulfill the request.'); + case 503: return nls.localize('status.503', 'Service Unavailable. The server is currently unavailable (overloaded or down).'); + default: return nls.localize('status.416', 'HTTP status code {0}', status); + } } \ No newline at end of file diff --git a/src/vs/base/common/injector.ts b/src/vs/base/common/injector.ts index fb5f113ae95..0a180e9f97f 100644 --- a/src/vs/base/common/injector.ts +++ b/src/vs/base/common/injector.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ 'use strict'; - + import Assert = require('vs/base/common/assert'); import Types = require('vs/base/common/types'); @@ -11,32 +11,32 @@ var inject = 'inject'; var injectLen = inject.length; export class Container { - + private map:{[name:string]:any;}; private parent:Container; - + constructor() { this.map = {}; this.parent = null; } - + public setParent(parent:Container):void { this.parent = parent; } - + public registerService(target:string, service:any):any { Assert.ok(!Types.isUndefinedOrNull(target)); Assert.ok(!Types.isUndefinedOrNull(service)); - + this.map[target.toLowerCase()] = service; - + return service; } - + // injects the denoted services to the target public injectTo(target:any):boolean { Assert.ok(!Types.isUndefinedOrNull(target)); - + // Support arrays var didInjectAtLeastOnce = false; if (Types.isArray(target)) { @@ -45,48 +45,48 @@ export class Container { }); return didInjectAtLeastOnce; } - + // inject services one by one for (var key in target) { if(key.indexOf(inject) !== 0) { continue; } - + var element = target[key]; if(!Types.isFunction(element)) { continue; } - + key = key.substring(injectLen).toLowerCase(); var service = this.findService(key, target); if(Types.isUndefinedOrNull(service)) { continue; } - + // call inject function element.apply(target, [service]); didInjectAtLeastOnce = true; } - + return didInjectAtLeastOnce; } - + public createChild():Container { var childContainer = new Container(); childContainer.setParent(this); - + return childContainer; } - + public findService(key:string, target:any=null):any { var result = this.map[key]; if((Types.isUndefinedOrNull(result) || target === result) && this.parent !== null) { result = this.parent.findService(key, target); } - + return result; } - + public dispose():void { this.map = null; this.parent = null; diff --git a/src/vs/base/common/keyCodes.ts b/src/vs/base/common/keyCodes.ts index 9a2729a8251..c2dcc38ef86 100644 --- a/src/vs/base/common/keyCodes.ts +++ b/src/vs/base/common/keyCodes.ts @@ -140,7 +140,12 @@ export enum KeyCode { /** * For the US standard keyboard, the ''"' key */ - US_QUOTE + US_QUOTE, + + /** + * Placed last to cover the length of the enum. + */ + MAX_VALUE } let TO_STRING_MAP: string[] = []; @@ -365,15 +370,22 @@ export class Keybinding { /** * Format the binding to a format appropiate for rendering in the UI */ - public static toLabel(value:number): string { + private static _toUSLabel(value:number): string { return _asString(value, (Platform.isMacintosh ? MacUIKeyLabelProvider.INSTANCE : ClassicUIKeyLabelProvider.INSTANCE)); } + /** + * Format the binding to a format appropiate for rendering in the UI + */ + private static _toCustomLabel(value:number, labelProvider:IKeyBindingLabelProvider): string { + return _asString(value, labelProvider); + } + /** * This prints the binding in a format suitable for electron's accelerators. * See https://github.com/atom/electron/blob/master/docs/api/accelerator.md */ - public static toElectronAccelerator(value:number): string { + private static _toElectronAccelerator(value:number): string { if (BinaryKeybindings.hasChord(value)) { // Electron cannot handle chords return null; @@ -385,7 +397,16 @@ export class Keybinding { * Format the binding to a format appropiate for the user settings file. */ public static toUserSettingsLabel(value:number): string { - return _asString(value, UserSettingsKeyLabelProvider.INSTANCE); + let result = _asString(value, UserSettingsKeyLabelProvider.INSTANCE); + result = result.toLowerCase().replace(/arrow/g, ''); + + if (Platform.isMacintosh) { + result = result.replace(/meta/g, 'cmd'); + } else if (Platform.isWindows) { + result = result.replace(/meta/g, 'win'); + } + + return result; } public value:number; @@ -417,8 +438,15 @@ export class Keybinding { /** * Format the binding to a format appropiate for rendering in the UI */ - public toLabel(): string { - return Keybinding.toLabel(this.value); + public _toUSLabel(): string { + return Keybinding._toUSLabel(this.value); + } + + /** + * Format the binding to a format appropiate for rendering in the UI + */ + public toCustomLabel(labelProvider:IKeyBindingLabelProvider): string { + return Keybinding._toCustomLabel(this.value, labelProvider); } /** @@ -426,7 +454,7 @@ export class Keybinding { * See https://github.com/atom/electron/blob/master/docs/api/accelerator.md */ public toElectronAccelerator(): string { - return Keybinding.toElectronAccelerator(this.value); + return Keybinding._toElectronAccelerator(this.value); } /** @@ -438,7 +466,7 @@ export class Keybinding { } -interface IKeyBindingLabelProvider { +export interface IKeyBindingLabelProvider { ctrlKeyLabel:string; shiftKeyLabel:string; altKeyLabel:string; @@ -480,7 +508,7 @@ class ElectronAcceleratorLabelProvider implements IKeyBindingLabelProvider { /** * Print for Mac UI */ -class MacUIKeyLabelProvider implements IKeyBindingLabelProvider { +export class MacUIKeyLabelProvider implements IKeyBindingLabelProvider { public static INSTANCE = new MacUIKeyLabelProvider(); private static leftArrowUnicodeLabel = String.fromCharCode(8592); @@ -514,7 +542,7 @@ class MacUIKeyLabelProvider implements IKeyBindingLabelProvider { /** * Print for Windows, Linux UI */ -class ClassicUIKeyLabelProvider implements IKeyBindingLabelProvider { +export class ClassicUIKeyLabelProvider implements IKeyBindingLabelProvider { public static INSTANCE = new ClassicUIKeyLabelProvider(); public ctrlKeyLabel = nls.localize('ctrlKey', "Ctrl"); diff --git a/src/vs/base/common/labels.ts b/src/vs/base/common/labels.ts index 80e8005d04f..fd30fb6ac1a 100644 --- a/src/vs/base/common/labels.ts +++ b/src/vs/base/common/labels.ts @@ -41,14 +41,14 @@ export function getPathLabel(arg1: uri|string, arg2?: uri|string|IWorkspaceProvi var absolutePath = getPath(arg1); if (basepath && paths.isEqualOrParent(absolutePath, basepath)) { - return paths.normalize(absolutePath.substr(basepath.length + 1 /* no leading slash/backslash */), platform.isNative); + return paths.normalize(strings.ltrim(absolutePath.substr(basepath.length), paths.nativeSep), true); } if (platform.isWindows && absolutePath[1] === ':') { - return paths.normalize(absolutePath.charAt(0).toUpperCase() + absolutePath.slice(1), platform.isNative); + return paths.normalize(absolutePath.charAt(0).toUpperCase() + absolutePath.slice(1), true); } - return paths.normalize(absolutePath, platform.isNative); + return paths.normalize(absolutePath, true); } function getPath(arg1: uri|string|IWorkspaceProvider): string { diff --git a/src/vs/base/common/marshalling.ts b/src/vs/base/common/marshalling.ts index 30dc89ca52d..fb03d036071 100644 --- a/src/vs/base/common/marshalling.ts +++ b/src/vs/base/common/marshalling.ts @@ -29,7 +29,7 @@ var currentDynamicContrib:IMarshallingContribution = null; export function canSerialize(obj: any): boolean { for (let contrib of marshallingContributions) { - if (contrib.canDeserialize(obj)) { + if (contrib.canSerialize(obj)) { return true; } } diff --git a/src/vs/base/common/network.ts b/src/vs/base/common/network.ts index 7b8552a3ab7..e862cd97207 100644 --- a/src/vs/base/common/network.ts +++ b/src/vs/base/common/network.ts @@ -8,35 +8,9 @@ import assert = require('vs/base/common/assert'); import objects = require('vs/base/common/objects'); import strings = require('vs/base/common/strings'); import hash = require('vs/base/common/hash'); -import marshalling = require('vs/base/common/marshalling'); import paths = require('vs/base/common/paths'); import URI from 'vs/base/common/uri'; -interface ISerializedURL { - $isURL: boolean; - $value: string; -} - -marshalling.registerMarshallingContribution({ - - canSerialize: (obj:any): boolean => { - return obj instanceof URL; - }, - - serialize: (url:URL, serialize:(obj:any)=>any): ISerializedURL => { - return url._toSerialized(); - }, - - canDeserialize: (obj:ISerializedURL): boolean => { - return obj.$isURL; - }, - - deserialize: (obj:ISerializedURL, deserialize:(obj:any)=>any): any => { - return new URL(obj.$value); - } -}); - - var _colon = ':'.charCodeAt(0), _slash = '/'.charCodeAt(0), _questionMark = '?'.charCodeAt(0), @@ -300,7 +274,13 @@ export class URL extends URI implements objects.IEqualable { } public static fromUri(value: URI): URL { - return new URL(value); + if (!value) { + return value; + } else if (value instanceof URL) { + return value; + } else { + return new URL(value); + } } private _spec:string; @@ -309,7 +289,7 @@ export class URL extends URI implements objects.IEqualable { constructor(spec: string); constructor(spec: URI); - constructor(stringOrURI: any) { + constructor(stringOrURI: string|URI) { super(); assert.ok(!!stringOrURI, 'spec must not be null'); if(typeof stringOrURI === 'string') { @@ -441,14 +421,6 @@ export class URL extends URI implements objects.IEqualable { public toJSON(): any { return this.toString(); } - - public _toSerialized(): any { - return { - $isURL: true, - // TODO@Alex: implement derived resources (embedded mirror models) better - $value: this.toString().replace(/URL_MARSHAL_REMOVE.*$/, '') - }; - } } export namespace schemas { diff --git a/src/vs/base/common/remote.ts b/src/vs/base/common/remote.ts index 5e90967b1fd..75e06166e22 100644 --- a/src/vs/base/common/remote.ts +++ b/src/vs/base/common/remote.ts @@ -51,63 +51,63 @@ export interface ISerializedProxy { } export class ProxiesMarshallingContribution implements marshalling.IMarshallingContribution { - + private _remoteCom:IProxyHelper; - + constructor(remoteCom:IProxyHelper) { this._remoteCom = remoteCom; } - + public canSerialize(obj:any): boolean { return (typeof obj.$__CREATE__PROXY__REQUEST === 'string'); } - + public serialize(obj:any, serialize:(obj:any)=>any): ISerializedProxy { var desc: IObjDescriptor = { methods: [], props: {} }; - + var keys = Object.keys(obj); for (var i = 0; i < keys.length; i++) { var key = keys[i]; - + if (typeof obj[key] === 'function') { desc.methods.push(key); } else { desc.props[key] = serialize(obj[key]); } } - + return { $isProxyDescriptor: true, proxyId: obj.$__CREATE__PROXY__REQUEST, desc: desc }; } - + public canDeserialize(obj:ISerializedProxy): boolean { return obj.$isProxyDescriptor === true; } - + public deserialize(obj:ISerializedProxy, deserialize:(obj:any)=>any): any { // this is an object var result: any = { $__IS_REMOTE_OBJ: true }; - + var methods = obj.desc.methods; for (var i = 0; i < methods.length; i++) { result[methods[i]] = createMethodProxy(this._remoteCom, obj.proxyId, methods[i]); } - + var props = obj.desc.props; for (var prop in props) { if (hasOwnProperty.call(props, prop)) { result[prop] = deserialize(props[prop]); } } - + return result; } } \ No newline at end of file diff --git a/src/vs/base/common/service.ts b/src/vs/base/common/service.ts index 0e756e33877..023a9a01096 100644 --- a/src/vs/base/common/service.ts +++ b/src/vs/base/common/service.ts @@ -155,7 +155,7 @@ export class Server { this.protocol.send( { id, data: { message: data.message, name: data.name, - stack: data.stack.split('\n') + stack: data.stack ? data.stack.split('\n') : void 0 }, type: ResponseType.Error }); } else { this.protocol.send( { id, data, type: ResponseType.ErrorObj }); @@ -282,17 +282,24 @@ export class Client { } private bufferRequest(request: IRequest): Promise { + let flushedRequest: Promise = null; + return new Promise((c, e, p) => { this.bufferedRequests.push(request); request.flush = () => { request.flush = null; - this.doRequest(request).done(c, e, p); + flushedRequest = this.doRequest(request).then(c, e, p); }; }, () => { request.flush = null; if (this.state !== ServiceState.Uninitialized) { + if (flushedRequest) { + flushedRequest.cancel(); + flushedRequest = null; + } + return; } diff --git a/src/vs/base/common/uri.ts b/src/vs/base/common/uri.ts index 7706c3a752b..15018d2f051 100644 --- a/src/vs/base/common/uri.ts +++ b/src/vs/base/common/uri.ts @@ -174,7 +174,7 @@ export default class URI { var ret = URI._parse(path); if (ret.scheme || ret.fragment || ret.query) { - throw new Error(); + throw new Error('Path contains a scheme, fragment or a query. Can not convert it to a file uri.'); } ret = ret.with('file', undefined, @@ -296,9 +296,9 @@ export default class URI { _authority: this._authority, _path: this._path, _query: this._query, - _fragment: this._fragment, + _fragment: this._fragment.replace(/URL_MARSHAL_REMOVE.*$/, ''), // TODO@Alex: implement derived resources (embedded mirror models) better _fsPath: this._fsPath, - _formatted: this._formatted + _formatted: this._formatted && this._formatted.replace(/#?URL_MARSHAL_REMOVE.*$/, ''), // TODO@Alex: implement derived resources (embedded mirror models) better }; } diff --git a/src/vs/base/common/worker/workerProtocol.ts b/src/vs/base/common/worker/workerProtocol.ts index 07e2a846b49..dafaf7d0578 100644 --- a/src/vs/base/common/worker/workerProtocol.ts +++ b/src/vs/base/common/worker/workerProtocol.ts @@ -77,15 +77,15 @@ export interface IRequester { } export class RemoteCom implements remote.IRemoteCom { - + private _requester: IRequester; private _bigHandler: remote.IManyHandler; - + constructor(requester:IRequester) { this._requester = requester; this._bigHandler = null; } - + public callOnRemote(proxyId: string, path: string, args:any[]): winjs.Promise { return this._requester.request('_proxyObj', { proxyId: proxyId, @@ -93,18 +93,18 @@ export class RemoteCom implements remote.IRemoteCom { args: args }); } - + public registerBigHandler(handler:remote.IManyHandler): void { this._bigHandler = handler; } - + public handleMessage(msg: { proxyId: string; path: string; args: any[]; }): winjs.Promise { if (!this._bigHandler) { throw new Error('got message before big handler attached!'); } return this._invokeHandler(msg.proxyId, msg.path, msg.args); } - + private _invokeHandler(rpcId:string, method:string, args:any[]): winjs.Promise { try { return winjs.TPromise.as(this._bigHandler.handle(rpcId, method, args)); diff --git a/src/vs/base/node/extfs.ts b/src/vs/base/node/extfs.ts index 4fc46053e96..8c81a8f1da2 100644 --- a/src/vs/base/node/extfs.ts +++ b/src/vs/base/node/extfs.ts @@ -27,7 +27,7 @@ export function readdir(path: string, callback: (error: Error, files: string[]) // Mac: uses NFD unicode form on disk, but we want NFC // See also https://github.com/nodejs/node/issues/2165 if (platform.isMacintosh) { - return fs.readdir(path, (error, children) => { + return readdirNormalize(path, (error, children) => { if (error) { return callback(error, null); } @@ -36,9 +36,24 @@ export function readdir(path: string, callback: (error: Error, files: string[]) }); } - return fs.readdir(path, callback); + return readdirNormalize(path, callback); }; +function readdirNormalize(path: string, callback: (error: Error, files: string[]) => void): void { + fs.readdir(path, (error, children) => { + if (error) { + return callback(error, null); + } + + // Bug in node: In some environments we get "." and ".." as entries from the call to readdir(). + // For example Sharepoint via WebDav on Windows includes them. We never want those + // entries in the result set though because they are not valid children of the folder + // for our concerns. + // See https://github.com/nodejs/node/issues/4002 + return callback(null, children.filter(c => c !== '.' && c !== '..')); + }) +} + export function mkdirp(path: string, mode: number, callback: (error: Error) => void): void { fs.exists(path, (exists) => { if (exists) { @@ -59,7 +74,13 @@ export function mkdirp(path: string, mode: number, callback: (error: Error) => v if (err) { callback(err); return; } if (mode) { - fs.mkdir(path, mode, callback); + fs.mkdir(path, mode, (error) => { + if (error) { + return callback(error); + } + + fs.chmod(path, mode, callback); // we need to explicitly chmod because of https://github.com/nodejs/node/issues/1104 + }); } else { fs.mkdir(path, null, callback); } @@ -82,7 +103,7 @@ export function copy(source: string, target: string, callback: (error: Error) => fs.stat(source, (error, stat) => { if (error) { return callback(error); } - if (!stat.isDirectory()) { return pipeFs(source, target, callback); } + if (!stat.isDirectory()) { return pipeFs(source, target, stat.mode & 511, callback); } if (copiedSources[source]) { return callback(null); // escape when there are cycles (can happen with symlinks) @@ -91,7 +112,7 @@ export function copy(source: string, target: string, callback: (error: Error) => } mkdirp(target, stat.mode & 511, (err) => { - fs.readdir(source, (err, files) => { + readdir(source, (err, files) => { loop(files, (file: string, clb: (error: Error) => void) => { copy(paths.join(source, file), paths.join(target, file), clb, copiedSources); }, callback); @@ -100,11 +121,11 @@ export function copy(source: string, target: string, callback: (error: Error) => }); } -function pipeFs(source: string, target: string, callback: (error: Error) => void): void { +function pipeFs(source: string, target: string, mode: number, callback: (error: Error) => void): void { var callbackHandled = false; var readStream = fs.createReadStream(source); - var writeStream = fs.createWriteStream(target); + var writeStream = fs.createWriteStream(target, { mode: mode }); var onError = (error: Error) => { if (!callbackHandled) { @@ -120,7 +141,8 @@ function pipeFs(source: string, target: string, callback: (error: Error) => void (writeStream).end(() => { // In this case the write stream is known to have an end signature with callback if (!callbackHandled) { callbackHandled = true; - callback(null); + + fs.chmod(target, mode, callback); // we need to explicitly chmod because of https://github.com/nodejs/node/issues/1104 } }); }); @@ -137,7 +159,7 @@ function pipeFs(source: string, target: string, callback: (error: Error) => void // after the rename, the contents are out of the workspace although not yet deleted. The greater benefit however is that this operation // will fail in case any file is used by another process. fs.unlink() in node will not bail if a file unlinked is used by another process. // However, the consequences are bad as outlined in all the related bugs from https://github.com/joyent/node/issues/7164 -export function del(path: string, tmpFolder: string, callback: (error: Error) => void, done?: (error:Error) => void): void { +export function del(path: string, tmpFolder: string, callback: (error: Error) => void, done?: (error: Error) => void): void { fs.exists(path, (exists) => { if (!exists) { return callback(null); @@ -204,7 +226,7 @@ function rmRecursive(path: string, callback: (error: Error) => void): void { fs.unlink(path, callback); } } else { - fs.readdir(path, (err, children) => { + readdir(path, (err, children) => { if (err || !children) { callback(err); } else if (children.length === 0) { diff --git a/src/vs/base/node/processes.ts b/src/vs/base/node/processes.ts index 10dcefcea83..7bda74d0eed 100644 --- a/src/vs/base/node/processes.ts +++ b/src/vs/base/node/processes.ts @@ -329,7 +329,7 @@ export abstract class AbstractProcess { } return result; }, (err) => { - return { sucess: true }; + return { success: true }; }); } diff --git a/src/vs/base/node/request.ts b/src/vs/base/node/request.ts index 8852d2c0941..62402ed0a56 100644 --- a/src/vs/base/node/request.ts +++ b/src/vs/base/node/request.ts @@ -11,8 +11,6 @@ import http = require('http'); import { Url, parse as parseUrl } from 'url'; import { createWriteStream } from 'fs'; import { assign } from 'vs/base/common/objects'; -import HttpProxyAgent = require('http-proxy-agent'); -import HttpsProxyAgent = require('https-proxy-agent'); export interface IRequestOptions { type?: string; @@ -100,36 +98,4 @@ export function json(opts: IRequestOptions): TPromise { pair.res.on('end', () => c(JSON.parse(buffer.join('')))); pair.res.on('error', e); })); -} - -function getSystemProxyURI(requestURL: Url): string { - if (requestURL.protocol === 'http:') { - return process.env.HTTP_PROXY || process.env.http_proxy || null; - } else if (requestURL.protocol === 'https:') { - return process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy || null; - } - - return null; -} - -export function getProxyAgent(rawRequestURL: string, proxyURL: string): any { - let requestURL = parseUrl(rawRequestURL); - let proxyEndpoint = parseUrl(proxyURL); - - if (!/^https?:$/.test(proxyEndpoint.protocol)) { - return null; - } - - return requestURL.protocol === 'http:' ? new HttpProxyAgent(proxyURL) : new HttpsProxyAgent(proxyURL); -} - -export function getSystemProxyAgent(rawRequestURL: string): any { - let requestURL = parseUrl(rawRequestURL); - let proxyURL = getSystemProxyURI(requestURL); - - if (!proxyURL) { - return null; - } - - return getProxyAgent(rawRequestURL, proxyURL); } \ No newline at end of file diff --git a/src/vs/base/node/service.cp.ts b/src/vs/base/node/service.cp.ts index 4bc07c8fcb7..ed14c03acf8 100644 --- a/src/vs/base/node/service.cp.ts +++ b/src/vs/base/node/service.cp.ts @@ -13,7 +13,7 @@ import { IServiceCtor, Server as IPCServer, Client as IPCClient, IServiceMap } f export class Server extends IPCServer { constructor() { super({ - send: r => process.send(r), + send: r => { try { process.send(r); } catch (e) { /* not much to do */ } }, onMessage: cb => process.on('message', cb) }); diff --git a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts index 2d60a6612aa..d7714d0f782 100644 --- a/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts +++ b/src/vs/base/parts/quickopen/browser/quickOpenWidget.ts @@ -15,7 +15,7 @@ import uuid = require('vs/base/common/uuid'); import {IQuickNavigateConfiguration, IAutoFocus, IContext, IModel, Mode} from 'vs/base/parts/quickopen/browser/quickOpen'; import {Filter, Renderer, DataSource, IModelProvider} from 'vs/base/parts/quickopen/browser/quickOpenViewer'; import {Dimension, Builder, $} from 'vs/base/browser/builder'; -import {ISelectionEvent, IFocusEvent, ITree} from 'vs/base/parts/tree/common/tree'; +import {ISelectionEvent, IFocusEvent, ITree, ContextMenuEvent} from 'vs/base/parts/tree/common/tree'; import {InputBox} from 'vs/base/browser/ui/inputbox/inputBox'; import {Tree} from 'vs/base/parts/tree/browser/treeImpl'; import {ProgressBar} from 'vs/base/browser/ui/progressbar/progressbar'; @@ -47,6 +47,17 @@ export interface IQuickOpenUsageLogger { publicLog(eventName: string, data?: any): void; } +export class QuickOpenController extends DefaultController { + + public onContextMenu(tree:ITree, element: any, event:ContextMenuEvent):boolean { + if (platform.isMacintosh) { + return this.onLeftClick(tree, element, event); // https://github.com/Microsoft/vscode/issues/1011 + } + + return super.onContextMenu(tree, element, event); + } +} + export class QuickOpenWidget implements IModelProvider { public static MAX_WIDTH = 600; // Max total width of quick open widget @@ -152,7 +163,7 @@ export class QuickOpenWidget implements IModelProvider { }, (div: Builder) => { this.tree = new Tree(div.getHTMLElement(), { dataSource: new DataSource(this), - controller: new DefaultController({ clickBehavior: ClickBehavior.ON_MOUSE_UP }), + controller: new QuickOpenController({ clickBehavior: ClickBehavior.ON_MOUSE_UP }), renderer: new Renderer(this), filter: new Filter(this) }, { @@ -343,7 +354,7 @@ export class QuickOpenWidget implements IModelProvider { // Reveal focus = this.tree.getFocus(); if (focus) { - revealToTop ? this.tree.reveal(focus, 0) : this.tree.reveal(focus); + revealToTop ? this.tree.reveal(focus, 0).done(null, errors.onUnexpectedError) : this.tree.reveal(focus).done(null, errors.onUnexpectedError); } } @@ -543,7 +554,7 @@ export class QuickOpenWidget implements IModelProvider { let entryToFocus = caseSensitiveMatch || caseInsensitiveMatch; if (entryToFocus) { this.tree.setFocus(entryToFocus); - this.tree.reveal(entryToFocus, 0); + this.tree.reveal(entryToFocus, 0).done(null, errors.onUnexpectedError); return; } @@ -552,14 +563,14 @@ export class QuickOpenWidget implements IModelProvider { // Second check for auto focus of first entry if (autoFocus.autoFocusFirstEntry) { this.tree.focusFirst(); - this.tree.reveal(this.tree.getFocus(), 0); + this.tree.reveal(this.tree.getFocus(), 0).done(null, errors.onUnexpectedError); } // Third check for specific index option else if (typeof autoFocus.autoFocusIndex === 'number') { if (entries.length > autoFocus.autoFocusIndex) { this.tree.focusNth(autoFocus.autoFocusIndex); - this.tree.reveal(this.tree.getFocus()); + this.tree.reveal(this.tree.getFocus()).done(null, errors.onUnexpectedError); } } diff --git a/src/vs/base/parts/tree/browser/treeDefaults.ts b/src/vs/base/parts/tree/browser/treeDefaults.ts index b8aa7e347d2..19bd9fca080 100644 --- a/src/vs/base/parts/tree/browser/treeDefaults.ts +++ b/src/vs/base/parts/tree/browser/treeDefaults.ts @@ -262,7 +262,7 @@ export class DefaultController implements _.IController { tree.clearHighlight(payload); } else { tree.focusPrevious(1, payload); - tree.reveal(tree.getFocus()); + tree.reveal(tree.getFocus()).done(null, errors.onUnexpectedError); } return true; } @@ -274,7 +274,7 @@ export class DefaultController implements _.IController { tree.clearHighlight(payload); } else { tree.focusPreviousPage(payload); - tree.reveal(tree.getFocus()); + tree.reveal(tree.getFocus()).done(null, errors.onUnexpectedError); } return true; } @@ -286,7 +286,7 @@ export class DefaultController implements _.IController { tree.clearHighlight(payload); } else { tree.focusNext(1, payload); - tree.reveal(tree.getFocus()); + tree.reveal(tree.getFocus()).done(null, errors.onUnexpectedError); } return true; } @@ -298,7 +298,7 @@ export class DefaultController implements _.IController { tree.clearHighlight(payload); } else { tree.focusNextPage(payload); - tree.reveal(tree.getFocus()); + tree.reveal(tree.getFocus()).done(null, errors.onUnexpectedError); } return true; } diff --git a/src/vs/base/parts/tree/common/treeModel.ts b/src/vs/base/parts/tree/common/treeModel.ts index 14215513dfa..0152bcab3a2 100644 --- a/src/vs/base/parts/tree/common/treeModel.ts +++ b/src/vs/base/parts/tree/common/treeModel.ts @@ -944,7 +944,7 @@ export class TreeModel extends Events.EventEmitter { var item = this.getItem(element); if (item) { - item.reveal(relativeTop); + return item.reveal(relativeTop); } }); } diff --git a/src/vs/base/test/common/network.test.ts b/src/vs/base/test/common/network.test.ts index afadd72bb84..49628900d92 100644 --- a/src/vs/base/test/common/network.test.ts +++ b/src/vs/base/test/common/network.test.ts @@ -5,6 +5,7 @@ 'use strict'; import * as assert from 'assert'; +import URI from 'vs/base/common/uri'; import { URL, ParsedUrl } from 'vs/base/common/network'; import { serialize, deserialize } from 'vs/base/common/marshalling'; @@ -20,6 +21,14 @@ function assertUrl(raw:string, scheme:string, domain:string, port:string, path:s assert.equal(url.getPath(), path, 'getPath ok for ' + raw); assert.equal(url.getQueryString(), queryString, 'getQueryString ok for ' + raw); assert.equal(url.getFragmentId(), fragmentId, 'getFragmentId ok for ' + raw); + + // check for equivalent behaviour + var uri = URI.parse(raw); + assert.equal(uri.scheme, scheme); + assert.equal(uri.authority, port ? domain + ':' + port : domain); + assert.equal(uri.path, path); + assert.equal(uri.query, queryString); + assert.equal(uri.fragment, fragmentId); } function assertCombine(base:string, relativeUrl:string, expectedUrl:string): void { @@ -210,7 +219,7 @@ suite('Network', () => { }); test('Bug 16793:# in folder name => mirror models get out of sync', function () { - var url = new URL('file:///C:/model/1#css'); - assert.equal(deserialize(serialize(url)).toString(), url.toString()); + var uri = URI.parse('file:///C:/model/1#css'); + assert.equal(deserialize(serialize(uri)).toString(), uri.toString()); }); }); diff --git a/src/vs/base/test/node/service/service.test.ts b/src/vs/base/test/node/service/service.test.ts index d8938792c14..bced4067324 100644 --- a/src/vs/base/test/node/service/service.test.ts +++ b/src/vs/base/test/node/service/service.test.ts @@ -8,22 +8,27 @@ import * as assert from 'assert'; import { Client } from 'vs/base/node/service.cp'; import uri from 'vs/base/common/uri'; +import {isPromiseCanceledError} from 'vs/base/common/errors'; import {TestService} from 'vs/base/test/node/service/testService'; +function createService() { + const server = new Client( + uri.parse(require.toUrl('bootstrap')).fsPath, + { + serverName: 'TestServer', + env: { AMD_ENTRYPOINT: 'vs/base/test/node/service/testApp', verbose: true } + } + ); + + return server.getService('TestService', TestService); +} + suite('Service', () => { test('createService', function(done: () => void) { this.timeout(5000); - const server = new Client( - uri.parse(require.toUrl('bootstrap')).fsPath, - { - serverName: 'TestServer', - env: { AMD_ENTRYPOINT: 'vs/base/test/node/service/testApp', verbose: true } - } - ); - - const testService = server.getService('TestService', TestService); + const testService = createService(); const res = testService.pong('ping'); res.then(r => { @@ -32,4 +37,23 @@ suite('Service', () => { done(); }); }); + + test('cancellation', function(done: () => void) { + this.timeout(5000); + + const testService = createService(); + const res = testService.cancelMe(); + + setTimeout(() => { + res.cancel(); + }, 50); + + res.then(r => { + assert.fail('Unexpected'); + done(); + }, (error) => { + assert.ok(isPromiseCanceledError(error)); + done(); + }); + }); }); \ No newline at end of file diff --git a/src/vs/base/test/node/service/testService.ts b/src/vs/base/test/node/service/testService.ts index 82232e71f34..f4ca6626756 100644 --- a/src/vs/base/test/node/service/testService.ts +++ b/src/vs/base/test/node/service/testService.ts @@ -13,4 +13,10 @@ export class TestService { outgoing: 'pong' }); } + + public cancelMe(): winjs.TPromise { + return winjs.Promise.timeout(100).then(() => { + return true; + }); + } } \ No newline at end of file diff --git a/src/vs/css.js b/src/vs/css.js index 7a02c971fee..d3650a5db86 100644 --- a/src/vs/css.js +++ b/src/vs/css.js @@ -2,14 +2,24 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + * Please make sure to make edits in the .ts file at https://github.com/Microsoft/vscode-loader/ + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------*/ /// /// 'use strict'; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } - __.prototype = b.prototype; - d.prototype = new __(); + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var _cssPluginGlobal = this; var CSSLoaderPlugin; @@ -405,8 +415,8 @@ var CSSLoaderPlugin; CSSLoaderPlugin.Utilities = Utilities; (function () { var cssLoader = null; - var isAtomShell = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions['electron'] !== 'undefined'); - if (typeof process !== 'undefined' && process.versions && !!process.versions.node && !isAtomShell) { + var isElectron = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions['electron'] !== 'undefined'); + if (typeof process !== 'undefined' && process.versions && !!process.versions.node && !isElectron) { cssLoader = new NodeCSSLoader(); } else if (typeof navigator !== 'undefined' && navigator.userAgent.indexOf('MSIE 9') >= 0) { diff --git a/src/vs/editor/browser/controller/mouseTarget.ts b/src/vs/editor/browser/controller/mouseTarget.ts index fd3e4b2a09b..2de5f48e1d3 100644 --- a/src/vs/editor/browser/controller/mouseTarget.ts +++ b/src/vs/editor/browser/controller/mouseTarget.ts @@ -121,7 +121,7 @@ var REGEX = (function() { IS_CHILD_OF_SCROLLABLE_ELEMENT: createRegExp(nodeWithClass(EditorBrowser.ClassNames.SCROLLABLE_ELEMENT)), IS_CHILD_OF_CONTENT_WIDGETS: createRegExp(anyNode(), anyNode(), EditorBrowser.ClassNames.CONTENT_WIDGETS), IS_CHILD_OF_OVERLAY_WIDGETS: createRegExp(EditorBrowser.ClassNames.OVERLAY_WIDGETS), - IS_CHILD_OF_VIEW_OVERLAYS: createRegExp('margin-view-overlays'), + IS_CHILD_OF_VIEW_OVERLAYS: createRegExp(EditorBrowser.ClassNames.MARGIN_VIEW_OVERLAYS), IS_CHILD_OF_VIEW_ZONES: createRegExp(anyNode(), anyNode(), EditorBrowser.ClassNames.VIEW_ZONES), }; })(); diff --git a/src/vs/editor/browser/editor.all.js b/src/vs/editor/browser/editor.all.js index f3ed8cb8ef5..71f01907ab0 100644 --- a/src/vs/editor/browser/editor.all.js +++ b/src/vs/editor/browser/editor.all.js @@ -36,6 +36,7 @@ define([ 'vs/editor/contrib/toggleTabFocusMode/common/toggleTabFocusMode', 'vs/editor/contrib/wordHighlighter/common/wordHighlighter', 'vs/editor/contrib/workerStatusReporter/browser/workerStatusReporter', + 'vs/editor/contrib/defineKeybinding/browser/defineKeybinding', // include these in the editor bundle because they are widely used by many languages 'vs/editor/common/languages.common' diff --git a/src/vs/editor/browser/editorBrowser.ts b/src/vs/editor/browser/editorBrowser.ts index ff27c0893ba..ec5e3dcd205 100644 --- a/src/vs/editor/browser/editorBrowser.ts +++ b/src/vs/editor/browser/editorBrowser.ts @@ -150,6 +150,7 @@ export var ClassNames = { SCROLLABLE_ELEMENT: 'editor-scrollable', CONTENT_WIDGETS: 'contentWidgets', OVERLAY_WIDGETS: 'overlayWidgets', + MARGIN_VIEW_OVERLAYS: 'margin-view-overlays', LINE_NUMBERS: 'line-numbers', GLYPH_MARGIN: 'glyph-margin', SCROLL_DECORATION: 'scroll-decoration', diff --git a/src/vs/editor/browser/standalone/simpleServices.ts b/src/vs/editor/browser/standalone/simpleServices.ts index 27d429ad076..033df7f943b 100644 --- a/src/vs/editor/browser/standalone/simpleServices.ts +++ b/src/vs/editor/browser/standalone/simpleServices.ts @@ -7,6 +7,7 @@ import {TPromise} from 'vs/base/common/winjs.base'; import Errors = require('vs/base/common/errors'); import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import EventEmitter = require('vs/base/common/eventEmitter'); import EditorBrowser = require('vs/editor/browser/editorBrowser'); import EditorCommon = require('vs/editor/common/editorCommon'); @@ -137,7 +138,7 @@ export class SimpleEditorService implements IEditorService { private findModel(editor:EditorCommon.ICommonCodeEditor, data:IResourceInput): EditorCommon.IModel { var model = editor.getModel(); - if(!model.getAssociatedResource().equals(data.resource)) { + if(model.getAssociatedResource().toString() !== data.resource.toString()) { return null; } @@ -207,10 +208,6 @@ export class SimpleEditorRequestService extends BaseRequestService { constructor(contextService: IWorkspaceContextService, telemetryService?: ITelemetryService) { super(contextService, telemetryService); } - - public getPath(service:string, requestUrl:Network.URL):string { - return requestUrl.toString(); // Standalone Editor talks about URLs that never have a path - } } export class StandaloneKeybindingService extends KeybindingService.KeybindingService { diff --git a/src/vs/editor/browser/standalone/standaloneCodeEditor.ts b/src/vs/editor/browser/standalone/standaloneCodeEditor.ts index 352171a1316..17a8867a0cb 100644 --- a/src/vs/editor/browser/standalone/standaloneCodeEditor.ts +++ b/src/vs/editor/browser/standalone/standaloneCodeEditor.ts @@ -13,7 +13,7 @@ import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); import standaloneServices = require('vs/editor/browser/standalone/standaloneServices'); import Platform = require('vs/platform/platform'); -import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import Model = require('vs/editor/common/model/model'); import Lifecycle = require('vs/base/common/lifecycle'); import MonarchTypes = require('vs/editor/common/modes/monarch/monarchTypes'); @@ -346,7 +346,7 @@ function prepareServices(domElement: HTMLElement, services: standaloneServices.I }; } -function createModelWithRegistryMode(modelService:IModelService, modeService:IModeService, value:string, modeName:string, associatedResource?:Network.URL): EditorCommon.IModel { +function createModelWithRegistryMode(modelService:IModelService, modeService:IModeService, value:string, modeName:string, associatedResource?:URI): EditorCommon.IModel { var modeInformation = modeService.lookup(modeName); if (modeInformation.length > 0) { // Force usage of the first existing mode @@ -362,13 +362,13 @@ function createModelWithRegistryMode(modelService:IModelService, modeService:IMo return modelService.createModel(value, modeService.getOrCreateMode(modeName), associatedResource); } -export function createModel(value:string, mode:string|MonarchTypes.ILanguage|Modes.IMode, associatedResource?:Network.URL|string): EditorCommon.IModel { +export function createModel(value:string, mode:string|MonarchTypes.ILanguage|Modes.IMode, associatedResource?:URI|string): EditorCommon.IModel { startup.initStaticServicesIfNecessary(); var modelService = standaloneServices.ensureStaticPlatformServices(null).modelService; - var resource:Network.URL; + var resource:URI; if (typeof associatedResource === 'string') { - resource = new Network.URL(associatedResource); + resource = URI.parse(associatedResource); } else { // must be a URL resource = associatedResource; diff --git a/src/vs/editor/browser/view/viewOverlays.ts b/src/vs/editor/browser/view/viewOverlays.ts index 9367901b992..e2e4a8131ef 100644 --- a/src/vs/editor/browser/view/viewOverlays.ts +++ b/src/vs/editor/browser/view/viewOverlays.ts @@ -216,9 +216,8 @@ export class MarginViewOverlays extends ViewOverlays { this._glyphMarginWidth = 0; this._scrollHeight = layoutProvider.getScrollHeight(); - this.domNode.className = 'margin-view-overlays monaco-editor-background'; + this.domNode.className = EditorBrowser.ClassNames.MARGIN_VIEW_OVERLAYS + ' monaco-editor-background'; DomUtils.StyleMutator.setWidth(this.domNode, 1); - this._updateDomNodeHeight(); this._hasVerticalScroll = true; } @@ -258,7 +257,6 @@ export class MarginViewOverlays extends ViewOverlays { this._requestModificationFrame(() => { DomUtils.StyleMutator.setWidth(this.domNode, layoutInfo.contentLeft); - this._updateDomNodeHeight(); var glyphMargin = this._getGlyphMarginDomNode(); if (glyphMargin) { @@ -288,9 +286,6 @@ export class MarginViewOverlays extends ViewOverlays { } this._hasVerticalScroll = false; } - } - - private _updateDomNodeHeight(): void { var height = Math.min(this._layoutProvider.getTotalHeight(), 1000000); DomUtils.StyleMutator.setHeight(this.domNode, height); } diff --git a/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts b/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts index d9ab47b0be4..92efce34b39 100644 --- a/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts +++ b/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts @@ -136,6 +136,7 @@ export class ViewCursors extends ViewPart { } public onConfigurationChanged(e:EditorCommon.IConfigurationChangedEvent): boolean { this._primaryCursor.onConfigurationChanged(e); + this._updateBlinking(); for (var i = 0, len = this._secondaryCursors.length; i < len; i++) { this._secondaryCursors[i].onConfigurationChanged(e); } @@ -172,7 +173,16 @@ export class ViewCursors extends ViewPart { private _getRenderType(): RenderType { if (this._editorHasFocus) { if (this._primaryCursor.getIsInEditableRange() && !this._context.configuration.editor.readOnly) { - return RenderType.Blink; + switch (this._context.configuration.editor.cursorBlinking) { + case ("blink"): + return RenderType.Blink; + case ("visible"): + return RenderType.Visible; + case ("hidden"): + return RenderType.Hidden; + default: + return RenderType.Blink; + } } return RenderType.Visible; } diff --git a/src/vs/editor/browser/widget/media/tokens.css b/src/vs/editor/browser/widget/media/tokens.css index aea5e863061..f9d93909685 100644 --- a/src/vs/editor/browser/widget/media/tokens.css +++ b/src/vs/editor/browser/widget/media/tokens.css @@ -70,7 +70,6 @@ .monaco-editor.vs .token.delimiter.html { color: #383838; } .monaco-editor.vs .token.metatag.content.html { color: red; } .monaco-editor.vs .token.metatag.html { color: gray; } -.monaco-editor.vs .token.tag.html { color: #800000; } .monaco-editor.vs .token.attribute.name.html { color: red; } .monaco-editor.vs .token.attribute.value.html { color: blue; } @@ -80,7 +79,6 @@ .monaco-editor.vs .token.delimiter.xml { color: blue; } .monaco-editor.vs .token.metatag.content.xml { color: red; } .monaco-editor.vs .token.metatag.xml { color: gray; } -.monaco-editor.vs .token.tag.xml { color: #800000; } .monaco-editor.vs .token.attribute.name.xml { color: red; } .monaco-editor.vs .token.attribute.value.xml { color: blue; } @@ -96,7 +94,6 @@ .monaco-editor.vs .token.delimiter.vs { color: #708870; } /* Jade */ -.monaco-editor.vs .token.tag.jade { color: #800000; } .monaco-editor.vs .token.tag.id.jade, .monaco-editor.vs .token.tag.class.jade { color: #4F76AC; } .monaco-editor.vs .token.interpolation.jade { color: magenta; } @@ -127,7 +124,7 @@ .monaco-editor.vs-dark .token.number.octal { color: #204070; } .monaco-editor.vs-dark .token.regexp { color: #B46695; } .monaco-editor.vs-dark .token.delimiter { color: #DCDCDC; } -.monaco-editor.vs-dark .token.tag { color: #D7BA7D; } +.monaco-editor.vs-dark .token.tag { color: #569CD6; } .monaco-editor.vs-dark .token.metatag { color: #DD6A6F; } .monaco-editor.vs-dark .token.annotation { color: #cc6666; } .monaco-editor.vs-dark .token.key { color: #9CDCFE; } @@ -173,7 +170,6 @@ /* HTML */ -.monaco-editor.vs-dark .token.tag.html { color: #569CD6; } .monaco-editor.vs-dark .token.delimiter.html { color: #808080; } .monaco-editor.vs-dark .token.metatag.content.html { color: #9CDCFE; } .monaco-editor.vs-dark .token.metatag.html { color: #569CD6; } @@ -181,7 +177,6 @@ .monaco-editor.vs-dark .token.string.html { color: #CE9178; } /* XML */ -.monaco-editor.vs-dark .token.tag.xml { color: #569CD6; } .monaco-editor.vs-dark .token.delimiter.xml { color: #808080; } .monaco-editor.vs-dark .token.metatag.content.xml { color: #9CDCFE; } .monaco-editor.vs-dark .token.metatag.xml { color: #569CD6; } @@ -199,7 +194,6 @@ .monaco-editor.vs-dark .token.attribute.value.vs { color: #C4C4C4; } /* Jade */ -.monaco-editor.vs-dark .token.tag.jade { color: #569CD6; } .monaco-editor.vs-dark .token.tag.id.jade, .monaco-editor.vs-dark .token.tag.class.jade { color: #4F76AC; } .monaco-editor.vs-dark .token.interpolation.jade { color: magenta; } @@ -208,100 +202,6 @@ /* -------------------------------- End vs-dark tokens -------------------------------- */ - - -/* -------------------------------- Begin hc-white tokens -------------------------------- */ -/* Tokens */ -.monaco-editor.hc-white .token { color: #000; } -.monaco-editor.hc-white .token.whitespace { color: #0000FF !important; } -.monaco-editor.hc-white .token.terminal { color: #e00000; } -.monaco-editor.hc-white .token.terminal.code1 { font-weight: bold; } -.monaco-editor.hc-white .token.variable { color: #001188; } -.monaco-editor.hc-white .token.variable.predefined { color: #4864AA; } -.monaco-editor.hc-white .token.constant { color: #dd0000; } -.monaco-editor.hc-white .token.string { color: #A31515; } -.monaco-editor.hc-white .token.string.escape { color: #A31515; } -.monaco-editor.hc-white .token.comment { color: #008000; } -.monaco-editor.hc-white .token.comment.shebang { color: #929292; } -.monaco-editor.hc-white .token.literal { color: #e00000; } -.monaco-editor.hc-white .token.literal.hex { color: #e07000; } - -.monaco-editor.hc-white .token.number { color: #000; } -.monaco-editor.hc-white .token.number.hex { color: #3030c0; } -.monaco-editor.hc-white .token.number.octal { color: #204070; } -.monaco-editor.hc-white .token.number.binary { color: #e07070; } -.monaco-editor.hc-white .token.regexp { color: #800000; } -.monaco-editor.hc-white .token.delimiter { color: #0000FF; } -.monaco-editor.hc-white .token.tag { color: #800000; } -.monaco-editor.hc-white .token.metatag { color: #e00000; } -.monaco-editor.hc-white .token.annotation { color: #cc6666; } -.monaco-editor.hc-white .token.key { color: #863B00; } -.monaco-editor.hc-white .token.attribute.name { color: #FF0000; } -.monaco-editor.hc-white .token.attribute.value { color: #0000FF; } -.monaco-editor.hc-white .token.info-token { color: #6796e6; } -.monaco-editor.hc-white .token.warn-token { color: #008000; } -.monaco-editor.hc-white .token.error-token { color: #FF0000; } -.monaco-editor.hc-white .token.debug-token { color: #b267e6; } -/* Keywords should come at the end in order to match cases like token.keyword.string */ -.monaco-editor.hc-white .token.keyword { color: #0000FF; } -.monaco-editor.hc-white .token.keyword.flow { color: #AF00DB; } - -/* PHP */ -.monaco-editor.hc-white .token.metatag.php { font-weight: bold; } - -/* Ruby */ -.monaco-editor.hc-white .token.predefined.ruby { color: #0000FF; } - -/* Markdown */ -.monaco-editor.hc-white .token.emphasis { font-style: italic;} -.monaco-editor.hc-white .token.strong { font-weight: bold; } -.monaco-editor.hc-white .token.header { color: navy ;} - -/* JSON */ -.monaco-editor.hc-white .token.string.key { color: #A31515; } -.monaco-editor.hc-white .token.string.value { color: #0451A5; } - -/* YAML */ -.monaco-editor.hc-white .token.string.yaml { color: #0451A5; } - -/* C# */ -.monaco-editor.hc-white .token.type { color: #008080; } -.monaco-editor.hc-white .token.identifier.method { color: #e07000; } - -/* SQL */ -.monaco-editor.hc-white .token.string.sql { color: #FF0000; } -.monaco-editor.hc-white .token.predefined.sql { color: #FF00FF; } -.monaco-editor.hc-white .token.operator.sql { color: #778899; } - - -/* HTML */ -.monaco-editor.hc-white .token.tag.html { color: #800000; } -.monaco-editor.hc-white .token.delimiter.html { color: #0000FF; } -.monaco-editor.hc-white .token.metatag.content.html { color: #FF0000; } -.monaco-editor.hc-white .token.metatag.html { color: #569CD6; } - -.monaco-editor.hc-white .token.string.html { color: blue; } - - -/* XML */ -.monaco-editor.hc-white .token.tag.xml { color: #800000; } -.monaco-editor.hc-white .token.delimiter.xml { color: #0000FF; } -.monaco-editor.hc-white .token.metatag.content.xml { color: #FF0000; } -.monaco-editor.hc-white .token.metatag.xml { color: #569CD6; } - -/* CSS */ -.monaco-editor.hc-white .token.attribute.name.css { color: #FF0000; } -.monaco-editor.hc-white .token.attribute.value.css { color: #0000FF; } -.monaco-editor.hc-white .token.tag.css { color: #800000; } -.monaco-editor.hc-white .token.delimiter.css { color: #000; } - -/* VSXML */ -.monaco-editor.hc-white .token.vs { color: #000; } - -/* -------------------------------- End hc-white tokens -------------------------------- */ - - - /* -------------------------------- Begin hc-black tokens -------------------------------- */ .monaco-editor.hc-black .token { color: #FFFFFF; } .monaco-editor.hc-black .token.whitespace { color: #FFFF00 !important; } @@ -311,8 +211,8 @@ .monaco-editor.hc-black .token.variable { color: #1AEBFF; } .monaco-editor.hc-black .token.variable.predefined { color: #1AEBFF; } .monaco-editor.hc-black .token.constant { color: #dd0000; } -.monaco-editor.hc-black .token.string { color: #C0C0C0; } -.monaco-editor.hc-black .token.string.escape { color: #C0C0C0; } +.monaco-editor.hc-black .token.string { color: #CE9178; } +.monaco-editor.hc-black .token.string.escape { color: #CE9178; } .monaco-editor.hc-black .token.comment { color: #008000; } .monaco-editor.hc-black .token.comment.shebang { color: #929292; } .monaco-editor.hc-black .token.comment.doc { color: #608B4E; } @@ -325,7 +225,7 @@ .monaco-editor.hc-black .token.number.binary { color: #FFFFFF; } .monaco-editor.hc-black .token.regexp { color: #C0C0C0; } .monaco-editor.hc-black .token.delimiter { color: #FFFF00; } -.monaco-editor.hc-black .token.tag { color: #FFA500; } +.monaco-editor.hc-black .token.tag { color: #569CD6; } .monaco-editor.hc-black .token.metatag { color: #569CD6; } .monaco-editor.hc-black .token.annotation { color: #569CD6; } .monaco-editor.hc-black .token.key { color: #9CDCFE; } @@ -371,7 +271,6 @@ /* HTML */ -.monaco-editor.hc-black .token.tag.html { color: #1AEBFF; } .monaco-editor.hc-black .token.delimiter.html { color: #FFFF00; } .monaco-editor.hc-black .token.metatag.content.html { color: #1AEBFF; } .monaco-editor.hc-black .token.metatag.html { color: #569CD6; } @@ -379,7 +278,6 @@ .monaco-editor.hc-black .token.string.html { color: #CE9178; } /* XML */ -.monaco-editor.hc-black .token.tag.xml { color: #1AEBFF; } .monaco-editor.hc-black .token.delimiter.xml { color: #FFFF00; } .monaco-editor.hc-black .token.metatag.content.xml { color: #1AEBFF; } .monaco-editor.hc-black .token.metatag.xml { color: #569CD6; } @@ -397,7 +295,7 @@ .monaco-editor.hc-black .token.attribute.value.vs { color: #C4C4C4; } /* Jade */ -.monaco-editor.hc-black .token.tag.jade { color: #569CD6; } +.monaco-editor.hc-black .token.tag.string.jade { color: #CE9178; } .monaco-editor.hc-black .token.tag.id.jade, .monaco-editor.hc-black .token.tag.class.jade { color: #4F76AC; } .monaco-editor.hc-black .token.interpolation.jade { color: magenta; } @@ -432,11 +330,14 @@ .monaco-editor.vs .token.constant { color: #dd0000; } .monaco-editor.vs .token.constant.language { color: #0000FF; } +.monaco-editor.vs .token.constant.entity { color: #A31515; } .monaco-editor.vs .token.constant.numeric { color: #09885A; } .monaco-editor.vs .token.constant.numeric.hex { color: #3030c0; } .monaco-editor.vs .token.constant.numeric.octal { color: #204070; } .monaco-editor.vs .token.constant.numeric.binary { color: #e07070; } .monaco-editor.vs .token.constant.regexp { color: #811f3f; } +.monaco-editor.vs .token.constant.rgb-value { color: #0451A5; } + /*.monaco-editor.vs .token.constant.character .monaco-editor.vs .token.constant.character.escape .monaco-editor.vs .token.constant.language.boolean @@ -450,9 +351,13 @@ .monaco-editor.vs .token.entity { color: #A31515; } .monaco-editor.vs .token.entity.name { color: #800000; } -.monaco-editor.vs .token.entity.name.function { color: #444444; } -.monaco-editor.vs .token.entity.name.punctuation { color: #000000; } +.monaco-editor.vs .token.entity.name.tag { color: #800000; } +.monaco-editor.vs .token.entity.name.function { color: #000000; } .monaco-editor.vs .token.entity.name.class { color: #2B91AF; } +.monaco-editor.vs .token.entity.name.selector { color: #800000; } +.monaco-editor.vs .token.entity.other.selector { color: #800000; } +.monaco-editor.vs .token.entity.other.attribute-name { color: red; } +.monaco-editor.vs .token.entity.other.attribute-name.css { color: #800000; } /*.monaco-editor.vs .token.entity.name.type .monaco-editor.vs .token.entity.name.tag @@ -481,17 +386,17 @@ .monaco-editor.vs .token.markup.other*/ .monaco-editor.vs .token.meta { color: #000000; } +.monaco-editor.vs .token.meta.selector { color: #800000; } +.monaco-editor.vs .token.meta.tag { color: #800000; } +.monaco-editor.vs .token.meta.preprocessor { color: #0000FF; } +.monaco-editor.vs .token.meta.preprocessor.string { color: #A31515; } +.monaco-editor.vs .token.meta.preprocessor.numeric { color: #09885A; } +.monaco-editor.vs .token.meta.cast { color: #2B91AF; } +.monaco-editor.vs .token.meta.parameter.type { color: #2B91AF; } +.monaco-editor.vs .token.meta.parameter.type.variable { color: #000000; } -.monaco-editor.vs .token.entity.meta.other.selector { color: #800000; } -.monaco-editor.vs .token.entity.meta.name.selector { color: #800000; } -.monaco-editor.vs .token.entity.other.attribute-name { color: #800000; } - -.monaco-editor.vs .token.entity.other.attribute-name.html { color: red; } -.monaco-editor.vs .token.property-name { color: darkred; } -.monaco-editor.vs .token.property-value { color: #0451A5; } - -.monaco-editor.vs .token.storage { color: gray }; -.monaco-editor.vs .token.storage.content { color: red }; +.monaco-editor.vs .token.storage { color: #0000FF; } +.monaco-editor.vs .token.storage.content { color: red; } .monaco-editor.vs .token.storage.type { color: #0000FF; } .monaco-editor.vs .token.storage.modifier { color: #0000FF; } .monaco-editor.vs .token.cast.storage.type, @@ -500,6 +405,7 @@ .monaco-editor.vs .token.var.annotation.storage.type { color: #2B91AF; } .monaco-editor.vs .token.string { color: #A31515; } +.monaco-editor.vs .token.string.tag { color: blue; } /*.monaco-editor.vs .token.string.quoted .monaco-editor.vs .token.string.quoted.single .monaco-editor.vs .token.string.quoted.double @@ -511,9 +417,12 @@ .monaco-editor.vs .token.string.regexp { color: #811f3f; } /*.monaco-editor.vs .token.string.other*/ -.monaco-editor.vs .token.support { color: #800000; } +.monaco-editor.vs .token.support { color: #0000FF; } +.monaco-editor.vs .token.support.function { color: #000000; } +.monaco-editor.vs .token.support.method { color: #000000; } .monaco-editor.vs .token.support.type { color: red; } .monaco-editor.vs .token.support.type.json { color: #A31515; } +.monaco-editor.vs .token.support.property-value { color: #0451A5; } /*.monaco-editor.vs .token.support.function .monaco-editor.vs .token.support.class .monaco-editor.vs .token.support.type @@ -528,9 +437,10 @@ /* Keywords should come at the end in order to match cases like token.keyword.string */ .monaco-editor.vs .token.keyword { color: #0000FF; } -.monaco-editor.vs .token.keyword.control { color: #AF00DB; } +.monaco-editor.vs .token.keyword.control { color: #0000FF; } .monaco-editor.vs .token.keyword.operator { color: #666666; } .monaco-editor.vs .token.keyword.operator.new { color: #0000FF; } +.monaco-editor.vs .token.keyword.other.unit { color: #09885A; } /*.monaco-editor.vs .token.keyword.operator .monaco-editor.vs .token.keyword.other*/ @@ -538,6 +448,8 @@ .monaco-editor.vs .token.punctuation.string { color: #A31515; } .monaco-editor.vs .token.punctuation.string.quoted.variable { color: #001188; } .monaco-editor.vs .token.punctuation.string.regexp { color: #811f3f; } +.monaco-editor.vs .token.punctuation.tag { color: #800000; } +.monaco-editor.vs .token.punctuation.string.tag { color: blue; } /* -------------------------------- Begin vs-dark tokens -------------------------------- */ .monaco-editor.vs-dark .token { color: #D4D4D4; } @@ -557,11 +469,13 @@ .monaco-editor.vs-dark .token.constant { color: #569CD6; } .monaco-editor.vs-dark .token.constant.language { color: #569CD6; } +.monaco-editor.vs-dark .token.constant.entity { color: #CE9178; } .monaco-editor.vs-dark .token.constant.numeric { color: #B5CEA8; } .monaco-editor.vs-dark .token.constant.numeric.hex { color: #5BB498; } .monaco-editor.vs-dark .token.constant.numeric.octal { color: #204070; } .monaco-editor.vs-dark .token.constant.numeric.binary { color: #e07070; } -.monaco-editor.vs-dark .token.constant.regexp { color: #B46695; } +.monaco-editor.vs-dark .token.constant.regexp { color: #646695; } +.monaco-editor.vs-dark .token.constant.rgb-value { color: #D4D4D4; } /*.monaco-editor.vs-dark .token.constant.character .monaco-editor.vs-dark .token.constant.character.escape .monaco-editor.vs-dark .token.constant.language.boolean @@ -575,9 +489,14 @@ .monaco-editor.vs-dark .token.entity { color: #9CDCFE; } .monaco-editor.vs-dark .token.entity.name { color: #569CD6; } +.monaco-editor.vs-dark .token.entity.name.tag { color: #569CD6; } .monaco-editor.vs-dark .token.entity.name.function { color: #DCDCAA; } -.monaco-editor.vs-dark .token.entity.name.punctuation { color: #DCDCAA; } .monaco-editor.vs-dark .token.entity.name.class { color: #4EC9B0; } +.monaco-editor.vs-dark .token.entity.name.selector { color: #569CD6; } + +.monaco-editor.vs-dark .token.entity.other.selector { color: #569CD6; } +.monaco-editor.vs-dark .token.entity.other.attribute-name { color: #9CDCFE; } +.monaco-editor.vs-dark .token.entity.other.attribute-name.css { color: #569CD6; } /* .monaco-editor.vs-dark .token.entity.name.type .monaco-editor.vs-dark .token.entity.name.tag @@ -604,17 +523,17 @@ .monaco-editor.vs-dark .token.markup.other*/ .monaco-editor.vs-dark .token.meta { color: #D4D4D4; } +.monaco-editor.vs-dark .token.meta.selector { color: #569CD6; } +.monaco-editor.vs-dark .token.meta.tag { color: #CE9178; } +.monaco-editor.vs-dark .token.meta.preprocessor { color: #569CD6; } +.monaco-editor.vs-dark .token.meta.preprocessor.string { color: #CE9178; } +.monaco-editor.vs-dark .token.meta.preprocessor.numeric { color: #B5CEA8; } +.monaco-editor.vs-dark .token.meta.cast { color: #569CD6; } +.monaco-editor.vs-dark .token.meta.parameter.type { color: #569CD6; } +.monaco-editor.vs-dark .token.meta.parameter.type.variable { color: #9CDCFE; } -.monaco-editor.vs-dark .token.entity.meta.other.selector { color: #569CD6; } -.monaco-editor.vs-dark .token.entity.meta.name.selector { color: #569CD6; } -.monaco-editor.vs-dark .token.entity.other.attribute-name { color: #569CD6; } - -.monaco-editor.vs-dark .token.token.entity.other.attribute-name.html { color: #9CDCFE; } -.monaco-editor.vs-dark .token.property-name { color: #9CDCFE; } -.monaco-editor.vs-dark .token.property-value { color: #CE9178; } - -.monaco-editor.vs-dark .token.storage { color: #569CD6 }; -.monaco-editor.vs-dark .token.storage.content { color: #9CDCFE }; +.monaco-editor.vs-dark .token.storage { color: #569CD6; } +.monaco-editor.vs-dark .token.storage.content { color: #9CDCFE; } .monaco-editor.vs-dark .token.storage.type { color: #569CD6; } .monaco-editor.vs-dark .token.storage.modifier { color: #569CD6; } .monaco-editor.vs-dark .token.annotation.storage.type, @@ -625,6 +544,7 @@ .monaco-editor.vs-dark .token.var.annotation.storage.type { color: #4EC9B0; } .monaco-editor.vs-dark .token.string { color: #CE9178; } +.monaco-editor.vs-dark .token.string.tag { color: #CE9178; } /*.monaco-editor.vs-dark .token.string.quoted .monaco-editor.vs-dark .token.string.quoted.single .monaco-editor.vs-dark .token.string.quoted.double @@ -636,8 +556,11 @@ .monaco-editor.vs-dark .token.string.regexp { color: #D16969; } /*.monaco-editor.vs-dark .token.string.other*/ -.monaco-editor.vs-dark .token.support { color: #D7BA7D; } +.monaco-editor.vs-dark .token.support { color: #569CD6; } +.monaco-editor.vs-dark .token.support.function { color: #D4D4D4; } +.monaco-editor.vs-dark .token.support.method { color: #D4D4D4; } .monaco-editor.vs-dark .token.support.type { color: #9CDCFE; } +.monaco-editor.vs-dark .token.support.property-value { color: #CE9178; } /*.monaco-editor.vs-dark .token.support.function .monaco-editor.vs-dark .token.support.class .monaco-editor.vs-dark .token.support.constant @@ -651,16 +574,20 @@ /* Keywords should come at the end in order to match cases like token.keyword.string */ .monaco-editor.vs-dark .token.keyword { color: #569CD6; } -.monaco-editor.vs-dark .token.keyword.control { color: #C586C0; } +.monaco-editor.vs-dark .token.keyword.control { color: #569CD6; } .monaco-editor.vs-dark .token.keyword.operator { color: #909090; } .monaco-editor.vs-dark .token.keyword.operator.new { color: #569CD6; } +.monaco-editor.vs-dark .token.keyword.other.unit { color: #B5CEA8; } /*.monaco-editor.vs-dark .token.keyword.operator .monaco-editor.vs-dark .token.keyword.other*/ -.monaco-editor.vs-dark .token.punctuation { color: #DCDCDC; } +.monaco-editor.vs-dark .token.punctuation { color: #DCDCDC; } .monaco-editor.vs-dark .token.punctuation.string { color: #CE9178; } .monaco-editor.vs-dark .token.punctuation.string.quoted.variable { color: #74B0DF; } .monaco-editor.vs-dark .token.punctuation.string.regexp { color: #D16969; } +.monaco-editor.vs-dark .token.punctuation.tag { color: #569CD6; } +.monaco-editor.vs-dark .token.punctuation.string.tag { color: #CE9178; } + /* -------------------------------- End vs-dark tokens -------------------------------- */ @@ -683,11 +610,13 @@ .monaco-editor.hc-black .token.constant { color: #569CD6; } .monaco-editor.hc-black .token.constant.language { color: #569CD6; } +.monaco-editor.hc-black .token.constant.entity { color: #CE9178; } .monaco-editor.hc-black .token.constant.numeric { color: #B5CEA8; } .monaco-editor.hc-black .token.constant.numeric.hex { color: #5BB498; } .monaco-editor.hc-black .token.constant.numeric.octal { color: #204070; } .monaco-editor.hc-black .token.constant.numeric.binary { color: #e07070; } .monaco-editor.hc-black .token.constant.regexp { color: #B46695; } +.monaco-editor.hc-black .token.constant.rgb-value { color: #D4D4D4; } /*.monaco-editor.hc-black .token.constant.character .monaco-editor.hc-black .token.constant.character.escape .monaco-editor.hc-black .token.constant.language.boolean @@ -701,9 +630,13 @@ .monaco-editor.hc-black .token.entity { color: #9CDCFE; } .monaco-editor.hc-black .token.entity.name { color: #569CD6; } +.monaco-editor.hc-black .token.entity.name.tag { color: #569CD6; } .monaco-editor.hc-black .token.entity.name.function { color: #DCDCAA; } -.monaco-editor.hc-black .token.entity.name.punctuation { color: #DCDCAA; } .monaco-editor.hc-black .token.entity.name.class { color: #4EC9B0; } +.monaco-editor.hc-black .token.entity.name.selector { color: #569CD6; } +.monaco-editor.hc-black .token.entity.other.selector { color: #569CD6; } +.monaco-editor.hc-black .token.entity.other.attribute-name { color: #9CDCFE; } +.monaco-editor.hc-black .token.entity.other.attribute-name.css { color: #569CD6; } /* .monaco-editor.hc-black .token.entity.name.type .monaco-editor.hc-black .token.entity.name.tag @@ -721,7 +654,7 @@ /*.monaco-editor.hc-black .token.markup.underline.link*/ .monaco-editor.hc-black .token.markup.bold { font-weight: bold; } .monaco-editor.hc-black .token.markup.heading { color: #6796e6; } -.monaco-editor.hc-black .token.markup.italic { font-style: italic;} +.monaco-editor.hc-black .token.markup.italic { font-style: italic; } /*.monaco-editor.hc-black .token.markup.list .monaco-editor.hc-black .token.markup.list.numbered .monaco-editor.hc-black .token.markup.list.unnumbered @@ -730,17 +663,17 @@ .monaco-editor.hc-black .token.markup.other*/ .monaco-editor.hc-black .token.meta { color: #D4D4D4; } +.monaco-editor.hc-black .token.meta.selector { color: #569CD6; } +.monaco-editor.hc-black .token.meta.tag { color: #CE9178; } +.monaco-editor.hc-black .token.meta.preprocessor { color: #569CD6; } +.monaco-editor.hc-black .token.meta.preprocessor.string { color: #CE9178; } +.monaco-editor.hc-black .token.meta.preprocessor.numeric { color: #B5CEA8; } +.monaco-editor.hc-black .token.meta.cast { color: #569CD6; } +.monaco-editor.hc-black .token.meta.parameter.type { color: #569CD6; } +.monaco-editor.hc-black .token.meta.parameter.type.variable { color: #9CDCFE; } -.monaco-editor.hc-black .token.entity.meta.other.selector { color: #569CD6; } -.monaco-editor.hc-black .token.entity.meta.name.selector { color: #569CD6; } -.monaco-editor.hc-black .token.entity.other.attribute-name { color: #569CD6; } -.monaco-editor.hc-black .token.entity.other.attribute-name.html { color: #9CDCFE; } - -.monaco-editor.hc-black .token.property-name { color: #9CDCFE; } -.monaco-editor.hc-black .token.property-value { color: #CE9178; } - -.monaco-editor.hc-black .token.storage { color: #569CD6 }; -.monaco-editor.hc-black .token.storage.content { color: #9CDCFE }; +.monaco-editor.hc-black .token.storage { color: #569CD6; } +.monaco-editor.hc-black .token.storage.content { color: #9CDCFE; } .monaco-editor.hc-black .token.storage.type { color: #569CD6; } .monaco-editor.hc-black .token.storage.modifier { color: #569CD6; } .monaco-editor.hc-black .token.annotation.storage.type, @@ -751,6 +684,7 @@ .monaco-editor.hc-black .token.var.annotation.storage.type { color: #4EC9B0; } .monaco-editor.hc-black .token.string { color: #CE9178; } +.monaco-editor.hc-black .token.string.tag { color: #CE9178; } /*.monaco-editor.hc-black .token.string.quoted .monaco-editor.hc-black .token.string.quoted.single .monaco-editor.hc-black .token.string.quoted.double @@ -762,8 +696,11 @@ .monaco-editor.hc-black .token.string.regexp { color: #D16969; } /*.monaco-editor.hc-black .token.string.other*/ -.monaco-editor.hc-black .token.support { color: #800000; } -.monaco-editor.vs-dark .token.support.type { color: #9CDCFE; } +.monaco-editor.hc-black .token.support { color: #569CD6; } +.monaco-editor.hc-black .token.support.function { color: #D4D4D4; } +.monaco-editor.hc-black .token.support.method { color: #D4D4D4; } +.monaco-editor.hc-black .token.support.type { color: #9CDCFE; } +.monaco-editor.hc-black .token.support.property-value { color: #CE9178; } /*.monaco-editor.hc-black .token.support.function .monaco-editor.hc-black .token.support.class .monaco-editor.hc-black .token.support.constant @@ -778,9 +715,10 @@ /* Keywords should come at the end in order to match cases like token.keyword.string */ .monaco-editor.hc-black .token.keyword { color: #569CD6; } -.monaco-editor.hc-black .token.keyword.control { color: #C586C0; } +.monaco-editor.hc-black .token.keyword.control { color: #569CD6; } .monaco-editor.hc-black .token.keyword.operator { color: #909090; } .monaco-editor.hc-black .token.keyword.operator.new { color: #569CD6; } +.monaco-editor.hc-black .token.keyword.other.unit { color: #B5CEA8; } /*.monaco-editor.hc-black .token.keyword.operator .monaco-editor.hc-black .token.keyword.other*/ @@ -788,5 +726,7 @@ .monaco-editor.hc-black .token.punctuation.string { color: #CE9178; } .monaco-editor.hc-black .token.punctuation.string.quoted.variable { color: #74B0DF; } .monaco-editor.hc-black .token.punctuation.string.regexp { color: #D16969; } +.monaco-editor.hc-black .token.punctuation.tag { color: #569CD6; } +.monaco-editor.hc-black .token.punctuation.string.tag { color: #CE9178; } /* -------------------------------- End hc-black tokens ----------------------------- */ \ No newline at end of file diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index bed0d3b74f5..b36b57d5ce6 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -141,6 +141,7 @@ class InternalEditorOptionsHelper { readOnly: toBoolean(opts.readOnly), scrollbar: scrollbar, overviewRulerLanes: toInteger(opts.overviewRulerLanes, 0, 3), + cursorBlinking: opts.cursorBlinking, hideCursorInOverviewRuler: toBoolean(opts.hideCursorInOverviewRuler), scrollBeyondLastLine: toBoolean(opts.scrollBeyondLastLine), wrappingIndent: opts.wrappingIndent, @@ -236,6 +237,7 @@ class InternalEditorOptionsHelper { readOnly: (prevOpts.readOnly !== newOpts.readOnly), scrollbar: (!this._scrollbarOptsEqual(prevOpts.scrollbar, newOpts.scrollbar)), overviewRulerLanes: (prevOpts.overviewRulerLanes !== newOpts.overviewRulerLanes), + cursorBlinking: (prevOpts.cursorBlinking !== newOpts.cursorBlinking), hideCursorInOverviewRuler: (prevOpts.hideCursorInOverviewRuler !== newOpts.hideCursorInOverviewRuler), scrollBeyondLastLine: (prevOpts.scrollBeyondLastLine !== newOpts.scrollBeyondLastLine), wrappingIndent: (prevOpts.wrappingIndent !== newOpts.wrappingIndent), @@ -794,6 +796,12 @@ configurationRegistry.registerConfiguration({ 'default': 3, 'description': nls.localize('overviewRulerLanes', "Controls the number of decorations that can show up at the same position in the overview ruler") }, + 'editor.cursorBlinking' : { + 'type': 'string', + 'enum': ['blink', 'visible', 'hidden'], + 'default': DefaultConfig.editor.cursorBlinking, + 'description': nls.localize('cursorBlinking', "Controls the cursor blinking animation.") + }, 'editor.hideCursorInOverviewRuler' : { 'type': 'boolean', 'default': DefaultConfig.editor.hideCursorInOverviewRuler, diff --git a/src/vs/editor/common/config/config.ts b/src/vs/editor/common/config/config.ts index 1f8133a8907..0d9e02fe0dd 100644 --- a/src/vs/editor/common/config/config.ts +++ b/src/vs/editor/common/config/config.ts @@ -155,7 +155,8 @@ registerCoreCommand(H.CursorUp, { registerCoreCommand(H.CursorUpSelect, { primary: KeyMod.Shift | KeyCode.UpArrow, secondary: [getWordNavigationKB(true, KeyCode.UpArrow)], - mac: { primary: KeyMod.Shift | KeyCode.UpArrow } + mac: { primary: KeyMod.Shift | KeyCode.UpArrow }, + linux: { primary: KeyMod.Shift | KeyCode.UpArrow } }); registerCoreCommand(H.CursorDown, { primary: KeyCode.DownArrow, @@ -164,7 +165,8 @@ registerCoreCommand(H.CursorDown, { registerCoreCommand(H.CursorDownSelect, { primary: KeyMod.Shift | KeyCode.DownArrow, secondary: [getWordNavigationKB(true, KeyCode.DownArrow)], - mac: { primary: KeyMod.Shift | KeyCode.DownArrow } + mac: { primary: KeyMod.Shift | KeyCode.DownArrow }, + linux: { primary: KeyMod.Shift | KeyCode.DownArrow } }); registerCoreCommand(H.CursorPageUp, { primary: KeyCode.PageUp diff --git a/src/vs/editor/common/config/defaultConfig.ts b/src/vs/editor/common/config/defaultConfig.ts index 0cdadde9ddf..28748ec4868 100644 --- a/src/vs/editor/common/config/defaultConfig.ts +++ b/src/vs/editor/common/config/defaultConfig.ts @@ -33,6 +33,7 @@ class ConfigClass implements IConfiguration { horizontalHasArrows: false }, overviewRulerLanes: 2, + cursorBlinking: 'blink', hideCursorInOverviewRuler: false, scrollBeyondLastLine: true, automaticLayout: false, diff --git a/src/vs/editor/common/core/position.ts b/src/vs/editor/common/core/position.ts index 6be595f7927..a0b8e7e1af6 100644 --- a/src/vs/editor/common/core/position.ts +++ b/src/vs/editor/common/core/position.ts @@ -54,7 +54,7 @@ export class Position implements EditorCommon.IEditorPosition { return new Position(pos.lineNumber, pos.column); } - public static isIPosition(obj: any): boolean { + public static isIPosition(obj: any): obj is EditorCommon.IPosition { return ( obj && (typeof obj.lineNumber === 'number') diff --git a/src/vs/editor/common/core/range.ts b/src/vs/editor/common/core/range.ts index 54978a06bcf..f1625a43a25 100644 --- a/src/vs/editor/common/core/range.ts +++ b/src/vs/editor/common/core/range.ts @@ -90,7 +90,7 @@ export class Range implements EditorCommon.IEditorRange { return new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn); } - public static isIRange(obj: any): boolean { + public static isIRange(obj: any): obj is EditorCommon.IRange { return ( obj && (typeof obj.startLineNumber === 'number') diff --git a/src/vs/editor/common/editorCommon.ts b/src/vs/editor/common/editorCommon.ts index b204985b86c..1c9e3a50597 100644 --- a/src/vs/editor/common/editorCommon.ts +++ b/src/vs/editor/common/editorCommon.ts @@ -10,7 +10,7 @@ import TokensBinaryEncoding = require('vs/editor/common/model/tokensBinaryEncodi import {IInstantiationService, INewConstructorSignature1, IConstructorSignature2, INewConstructorSignature2} from 'vs/platform/instantiation/common/instantiation'; import {IAction} from 'vs/base/common/actions'; import {IHTMLContentElement} from 'vs/base/common/htmlContent'; -import {URL} from 'vs/base/common/network'; +import URI from 'vs/base/common/uri'; import Event from 'vs/base/common/event'; import {IDisposable} from 'vs/base/common/lifecycle'; import {TPromise} from 'vs/base/common/winjs.base'; @@ -333,6 +333,11 @@ export interface ICommonEditorOptions { * Defaults to 2. */ overviewRulerLanes?:number; + /** + * Control the cursor blinking animation. + * Defaults to 'blink'. + */ + cursorBlinking?:string; /** * Should the cursor be hidden in the overview ruler. * Defaults to false. @@ -577,6 +582,7 @@ export interface IInternalEditorOptions { readOnly:boolean; scrollbar:IInternalEditorScrollbarOptions; overviewRulerLanes:number; + cursorBlinking:string; hideCursorInOverviewRuler:boolean; scrollBeyondLastLine:boolean; wrappingIndent: string; @@ -667,6 +673,7 @@ export interface IConfigurationChangedEvent { readOnly:boolean; scrollbar:boolean; overviewRulerLanes:boolean; + cursorBlinking:boolean; hideCursorInOverviewRuler:boolean; scrollBeyondLastLine:boolean; wrappingIndent:boolean; @@ -1452,6 +1459,18 @@ export interface ITokenizedModel extends ITextModel { * @param position The position at which to look for a bracket. */ matchBracket(position:IPosition, inaccurateResultAcceptable?:boolean): IMatchBracketResult; + + /** + * No mode supports allowed on this model because it is simply too large. + * (even tokenization would cause too much memory pressure) + */ + isTooLargeForHavingAMode(): boolean; + + /** + * Only basic mode supports allowed on this model because it is simply too large. + * (tokenization is allowed and other basic supports) + */ + isTooLargeForHavingARichMode(): boolean; } /** @@ -1703,7 +1722,7 @@ export interface IModel extends IEditableTextModel, ITextModelWithMarkers, IToke /** * Gets the resource associated with this editor model. */ - getAssociatedResource(): URL; + getAssociatedResource(): URI; /** * Search the model. @@ -1754,7 +1773,6 @@ export interface IModel extends IEditableTextModel, ITextModelWithMarkers, IToke onBeforeDetached(): void; - getURL(): URL; getModeId(): string; /** @@ -1772,7 +1790,7 @@ export interface IMirrorModel extends IEventEmitter, ITokenizedModel { getEmbeddedAtPosition(position:IPosition): IMirrorModel; getAllEmbedded(): IMirrorModel[]; - getAssociatedResource(): URL; + getAssociatedResource(): URI; getProperty(key:string): any; getOffsetFromPosition(position:IPosition): number; diff --git a/src/vs/editor/common/editorCommonExtensions.ts b/src/vs/editor/common/editorCommonExtensions.ts index 231adc2bdcb..4fce04b71b5 100644 --- a/src/vs/editor/common/editorCommonExtensions.ts +++ b/src/vs/editor/common/editorCommonExtensions.ts @@ -5,10 +5,13 @@ 'use strict'; import EditorCommon = require('vs/editor/common/editorCommon'); +import {onUnexpectedError, illegalArgument} from 'vs/base/common/errors'; +import URI from 'vs/base/common/uri'; +import {Position} from 'vs/editor/common/core/position'; import {ServicesAccessor} from 'vs/platform/instantiation/common/instantiation'; import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry'; +import {IModelService} from 'vs/editor/common/services/modelService'; import {Registry} from 'vs/platform/platform'; -import Errors = require('vs/base/common/errors'); import {KeybindingsRegistry,ICommandDescriptor} from 'vs/platform/keybinding/common/keybindingsRegistry'; import config = require('vs/editor/common/config/config'); import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation'; @@ -84,6 +87,38 @@ export module CommonEditorRegistry { KeybindingsRegistry.registerCommandDesc(commandDesc); } + + export function registerLanguageCommand(id: string, handler: (accessor: ServicesAccessor, args: { [n: string]: any }) => any) { + KeybindingsRegistry.registerCommandDesc({ + id, + handler(accessor, args: any[]) { + if (args && args.length > 1 || typeof args[0] !== 'object') { + throw illegalArgument(); + } + return handler(accessor, args && args[0]); + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib(), + primary: undefined, + context: undefined, + }); + } + + export function registerDefaultLanguageCommand(id: string, handler: (model: EditorCommon.IModel, position: EditorCommon.IPosition, args: { [n: string]: any }) => any) { + registerLanguageCommand(id, function(accessor, args) { + + const {resource, position} = args; + if (!URI.isURI(resource) || !Position.isIPosition(position)) { + throw illegalArgument(); + } + + const model = accessor.get(IModelService).getModel(resource); + if (!model) { + throw illegalArgument(); + } + + return handler(model, position, args); + }); + } } class SimpleEditorContributionDescriptor implements EditorCommon.ICommonEditorContributionDescriptor { @@ -193,7 +228,7 @@ function triggerEditorActionGlobal(actionId: string, accessor: ServicesAccessor, var action = activeEditor.getAction(actionId); if (action) { accessor.get(ITelemetryService).publicLog('editorActionInvoked', {name: action.label} ); - action.run().done(null, Errors.onUnexpectedError); + action.run().done(null, onUnexpectedError); } return; } diff --git a/src/vs/editor/common/model/mirrorModel.ts b/src/vs/editor/common/model/mirrorModel.ts index 2240bde5959..a2d511ff675 100644 --- a/src/vs/editor/common/model/mirrorModel.ts +++ b/src/vs/editor/common/model/mirrorModel.ts @@ -13,16 +13,21 @@ import {TextModelWithTokens} from 'vs/editor/common/model/textModelWithTokens'; import {ModelLine} from 'vs/editor/common/model/modelLine'; import EditorCommon = require('vs/editor/common/editorCommon'); import {IResourceService} from 'vs/editor/common/services/resourceService'; -import {URL} from 'vs/base/common/network'; +import URI from 'vs/base/common/uri'; import {disposeAll} from 'vs/base/common/lifecycle'; +export interface IMirrorModelEvents { + contentChanged: EditorCommon.IModelContentChangedEvent[]; + propertiesChanged: EditorCommon.IModelPropertiesChangedEvent; +} + export class AbstractMirrorModel extends TextModelWithTokens implements EditorCommon.IMirrorModel { _lineStarts:PrefixSumComputer; - _associatedResource:URL; + _associatedResource:URI; _extraProperties:{[key:string]:any;}; - constructor(allowedEventTypes:string[], versionId:number, value:EditorCommon.IRawText, mode:IMode|TPromise, associatedResource?:URL, properties?:{[key:string]:any;}) { + constructor(allowedEventTypes:string[], versionId:number, value:EditorCommon.IRawText, mode:IMode|TPromise, associatedResource?:URI, properties?:{[key:string]:any;}) { super(allowedEventTypes.concat([EditorCommon.EventType.ModelDispose]), value, false, mode); if(!properties) { @@ -65,7 +70,7 @@ export class AbstractMirrorModel extends TextModelWithTokens implements EditorCo super.dispose(); } - public getAssociatedResource(): URL { + public getAssociatedResource(): URI { if (this._isDisposed) { throw new Error('AbstractMirrorModel.getAssociatedResource: Model is disposed'); } @@ -244,7 +249,7 @@ export class MirrorModelEmbedded extends AbstractMirrorModel implements EditorCo private _actualModel:MirrorModel; - constructor(actualModel:MirrorModel, includeRanges:EditorCommon.IRange[], mode:IMode, url:URL) { + constructor(actualModel:MirrorModel, includeRanges:EditorCommon.IRange[], mode:IMode, url:URI) { super(['changed'], actualModel.getVersionId(), MirrorModelEmbedded._getMirrorValueWithinRanges(actualModel, includeRanges), mode, url); this._actualModel = actualModel; } @@ -310,7 +315,7 @@ class EmbeddedModeRange { } } -export function createMirrorModelFromString(resourceService:IResourceService, versionId:number, value:string, mode:IMode, associatedResource?:URL, properties?:{[key:string]:any;}): MirrorModel { +export function createMirrorModelFromString(resourceService:IResourceService, versionId:number, value:string, mode:IMode, associatedResource?:URI, properties?:{[key:string]:any;}): MirrorModel { return new MirrorModel(resourceService, versionId, TextModel.toRawText(value), mode, associatedResource, properties); } @@ -319,7 +324,7 @@ export class MirrorModel extends AbstractMirrorModel implements EditorCommon.IMi private _resourceService: IResourceService; private _embeddedModels: {[modeId:string]:MirrorModelEmbedded;}; - constructor(resourceService:IResourceService, versionId:number, value:EditorCommon.IRawText, mode:IMode|TPromise, associatedResource?:URL, properties?:{[key:string]:any;}) { + constructor(resourceService:IResourceService, versionId:number, value:EditorCommon.IRawText, mode:IMode|TPromise, associatedResource?:URI, properties?:{[key:string]:any;}) { super(['changed'], versionId, value, mode, associatedResource, properties); this._resourceService = resourceService; @@ -444,7 +449,7 @@ export class MirrorModel extends AbstractMirrorModel implements EditorCommon.IMi this._embeddedModels[newNestedModeId].setIncludedRanges(newModesRanges[newNestedModeId].ranges); } else { // TODO@Alex: implement derived resources (embedded mirror models) better - var embeddedModelUrl = new URL(this.getAssociatedResource().toString() + 'URL_MARSHAL_REMOVE' + newNestedModeId); + var embeddedModelUrl = this.getAssociatedResource().withFragment(this.getAssociatedResource().fragment + 'URL_MARSHAL_REMOVE' + newNestedModeId); this._embeddedModels[newNestedModeId] = new MirrorModelEmbedded(this, newModesRanges[newNestedModeId].ranges, newModesRanges[newNestedModeId].mode, embeddedModelUrl); this._resourceService.insert(this._embeddedModels[newNestedModeId].getAssociatedResource(), this._embeddedModels[newNestedModeId]); } @@ -453,51 +458,43 @@ export class MirrorModel extends AbstractMirrorModel implements EditorCommon.IMi return false; } - public onEvents(events:{ type:string; }[]) : boolean { + public onEvents(events:IMirrorModelEvents) : boolean { if (this._isDisposed) { throw new Error('MirrorModel.onEvents: Model is disposed'); } - var changed = false; - for (var i = 0, len = events.length; i < len; i++) { - var e = events[i]; - switch (e.type) { - case EditorCommon.EventType.ModelContentChanged: - var contentChangedEvent = e; + if (events.propertiesChanged) { + this._extraProperties = events.propertiesChanged.properties; + } - // Force recreating of line starts - this._lineStarts = null; + let changed = false; + for (let i = 0, len = events.contentChanged.length; i < len; i++) { + let contentChangedEvent = events.contentChanged[i]; - this._setVersionId(contentChangedEvent.versionId); - switch (contentChangedEvent.changeType) { - case EditorCommon.EventType.ModelContentChangedFlush: - this._onLinesFlushed(contentChangedEvent); - changed = true; - break; + // Force recreating of line starts + this._lineStarts = null; - case EditorCommon.EventType.ModelContentChangedLinesDeleted: - this._onLinesDeleted(contentChangedEvent); - changed = true; - break; - - case EditorCommon.EventType.ModelContentChangedLinesInserted: - this._onLinesInserted(contentChangedEvent); - changed = true; - break; - - case EditorCommon.EventType.ModelContentChangedLineChanged: - this._onLineChanged(contentChangedEvent); - changed = true; - break; - } + this._setVersionId(contentChangedEvent.versionId); + switch (contentChangedEvent.changeType) { + case EditorCommon.EventType.ModelContentChangedFlush: + this._onLinesFlushed(contentChangedEvent); + changed = true; break; - case EditorCommon.EventType.ModelPropertiesChanged: - this._extraProperties = (e).properties; + case EditorCommon.EventType.ModelContentChangedLinesDeleted: + this._onLinesDeleted(contentChangedEvent); + changed = true; break; - default: - console.warn('Unknown model event: ' + e.type); + case EditorCommon.EventType.ModelContentChangedLinesInserted: + this._onLinesInserted(contentChangedEvent); + changed = true; + break; + + case EditorCommon.EventType.ModelContentChangedLineChanged: + this._onLineChanged(contentChangedEvent); + changed = true; + break; } } diff --git a/src/vs/editor/common/model/model.ts b/src/vs/editor/common/model/model.ts index ea10e4871ce..75152c30345 100644 --- a/src/vs/editor/common/model/model.ts +++ b/src/vs/editor/common/model/model.ts @@ -9,7 +9,7 @@ import {IMode} from 'vs/editor/common/modes'; import {TextModel} from 'vs/editor/common/model/textModel'; import {EditableTextModel} from 'vs/editor/common/model/editableTextModel'; import EditorCommon = require('vs/editor/common/editorCommon'); -import {URL} from 'vs/base/common/network'; +import URI from 'vs/base/common/uri'; import Objects = require('vs/base/common/objects'); import {IDisposable} from 'vs/base/common/lifecycle'; @@ -39,7 +39,7 @@ export class Model extends EditableTextModel implements EditorCommon.IModel { public id:string; - private _associatedResource:URL; + private _associatedResource:URI; private _extraProperties:IPropertiesMap; private _attachedEditorCount:number; @@ -56,7 +56,7 @@ export class Model extends EditableTextModel implements EditorCommon.IModel { * The resource associated with this model. If the value is not provided an * unique in memory URL is constructed as the associated resource. */ - constructor(rawText:string, modeOrPromise:IMode|TPromise, associatedResource:URL=null) { + constructor(rawText:string, modeOrPromise:IMode|TPromise, associatedResource:URI=null) { super([ EditorCommon.EventType.ModelPropertiesChanged, EditorCommon.EventType.ModelDispose @@ -67,10 +67,11 @@ export class Model extends EditableTextModel implements EditorCommon.IModel { this.id = '$model' + MODEL_ID; if (typeof associatedResource === 'undefined' || associatedResource === null) { - associatedResource = new URL('inmemory://model/' + MODEL_ID); + this._associatedResource = URI.parse('inmemory://model/' + MODEL_ID); + } else { + this._associatedResource = associatedResource; } - this._associatedResource = associatedResource; if (aliveModels[String(this._associatedResource)]) { throw new Error('Cannot instantiate a second Model with the same URI!'); @@ -83,10 +84,6 @@ export class Model extends EditableTextModel implements EditorCommon.IModel { // console.log('ALIVE MODELS: ' + Object.keys(aliveModels).join('\n')); } - public getURL(): URL { - return this._associatedResource; - } - public getModeId(): string { return this.getMode().getId(); } @@ -129,7 +126,7 @@ export class Model extends EditableTextModel implements EditorCommon.IModel { return this._attachedEditorCount > 0; } - public getAssociatedResource(): URL { + public getAssociatedResource(): URI { if (this._isDisposed) { throw new Error('Model.getAssociatedResource: Model is disposed'); } diff --git a/src/vs/editor/common/model/textModelWithTokens.ts b/src/vs/editor/common/model/textModelWithTokens.ts index 5fe1014ad81..68bbe2e023f 100644 --- a/src/vs/editor/common/model/textModelWithTokens.ts +++ b/src/vs/editor/common/model/textModelWithTokens.ts @@ -185,7 +185,7 @@ export class TextModelWithTokens extends TextModel implements EditorCommon.IToke private static MODE_TOKENIZATION_FAILED_MSG = nls.localize('mode.tokenizationSupportFailed', "The mode has failed while tokenizing the input."); private static MODEL_SYNC_LIMIT = 5 * 1024 * 1024; // 5 MB - private static MODEL_TOKENIZATION_LIMIT = 50 * 1024 * 1024; // 50 MB + private static MODEL_TOKENIZATION_LIMIT = 20 * 1024 * 1024; // 20 MB private _shouldAutoTokenize:boolean; private _mode: Modes.IMode; @@ -262,12 +262,20 @@ export class TextModelWithTokens extends TextModel implements EditorCommon.IToke super.dispose(); } + public isTooLargeForHavingAMode(): boolean { + return this._shouldDenyMode; + } + + public isTooLargeForHavingARichMode(): boolean { + return this._shouldSimplifyMode; + } + private _massageMode(mode: Modes.IMode): Modes.IMode { - if (this._shouldDenyMode) { + if (this.isTooLargeForHavingAMode()) { return new NullMode(); } - if (this._shouldSimplifyMode) { - return new SimplifiedMode(mode); + if (this.isTooLargeForHavingARichMode()) { + return mode.toSimplifiedMode(); } return mode; } @@ -856,27 +864,3 @@ export class TextModelWithTokens extends TextModel implements EditorCommon.IToke return BracketsHelper.matchBracket(this, this.validatePosition(position), inaccurateResultAcceptable); } } - -class SimplifiedMode implements Modes.IMode { - - tokenizationSupport: Modes.ITokenizationSupport; - electricCharacterSupport: Modes.IElectricCharacterSupport; - commentsSupport: Modes.ICommentsSupport; - characterPairSupport: Modes.ICharacterPairSupport; - tokenTypeClassificationSupport: Modes.ITokenTypeClassificationSupport; - - private _id: string; - - constructor(sourceMode: Modes.IMode) { - this._id = 'vs.editor.modes.simplifiedMode:' + sourceMode.getId(); - this.tokenizationSupport = sourceMode.tokenizationSupport; - this.electricCharacterSupport = sourceMode.electricCharacterSupport; - this.commentsSupport = sourceMode.commentsSupport; - this.characterPairSupport = sourceMode.characterPairSupport; - this.tokenTypeClassificationSupport = sourceMode.tokenTypeClassificationSupport; - } - - public getId(): string { - return this._id; - } -} \ No newline at end of file diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index 0b901ead07e..4bd0910b8ff 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -5,11 +5,11 @@ 'use strict'; import {TPromise} from 'vs/base/common/winjs.base'; +import {IMatch} from 'vs/base/common/filters'; import {IMarker, IMarkerService} from 'vs/platform/markers/common/markers'; import EditorCommon = require('vs/editor/common/editorCommon'); import {IHTMLContentElement} from 'vs/base/common/htmlContent'; import URI from 'vs/base/common/uri'; -import {URL} from 'vs/base/common/network'; import {IDisposable} from 'vs/base/common/lifecycle'; import {AsyncDescriptor0} from 'vs/platform/instantiation/common/descriptors'; @@ -30,8 +30,8 @@ export interface IValidateParticipant extends IWorkerParticipant { } export interface ISuggestParticipant extends IWorkerParticipant { - filter?:(word:string, suggestion:ISuggestion) => boolean; - suggest?:(resource:URL, position:EditorCommon.IPosition, context?:any) => TPromise; + filter?:(word:string, suggestion:ISuggestion) => IMatch[]; + suggest?:(resource:URI, position:EditorCommon.IPosition, context?:any) => TPromise; } export enum Bracket { @@ -197,6 +197,11 @@ export interface IMode { getId(): string; + /** + * Return a mode "similar" to this one that strips any "smart" supports. + */ + toSimplifiedMode(): IMode; + addSupportChangedListener?(callback: (e: EditorCommon.IModeSupportChangedEvent) => void): IDisposable; /** @@ -375,23 +380,15 @@ export interface IComputeExtraInfoResult { className?: string; } export interface IExtraInfoSupport { - computeInfo(resource:URL, position:EditorCommon.IPosition):TPromise; + computeInfo(resource:URI, position:EditorCommon.IPosition):TPromise; } -/** - * Interface used to suggest words - */ -export interface IHighlight { - start:number; - end:number; -} - export interface ISuggestion { label: string; codeSnippet: string; type: string; - highlights?: IHighlight[]; + textEdit?: EditorCommon.ISingleEditOperation; typeLabel?: string; documentationLabel?: string; filterText?: string; @@ -399,31 +396,7 @@ export interface ISuggestion { noAutoAccept?: boolean; } -/** - * Returns true if the provided object looks like - * an ISuggestion. That means they are structural - * compatible. - */ -export function isISuggestion(obj:any):boolean { - if(obj === null || typeof obj !== 'object') { - return false; - } - if(typeof obj.label !== 'string' || typeof obj.codeSnippet !== 'string' || typeof obj.type !== 'string') { - return false; - } - if(obj.highlights && !Array.isArray(obj.highlights)) { - return false; - } - if(obj.typeLabel && typeof obj.typeLabel !== 'string') { - return false; - } - if(obj.documentationLabel && typeof obj.documentationLabel !== 'string') { - return false; - } - return true; -} - -export interface ISuggestions { +export interface ISuggestResult { currentWord: string; suggestions:ISuggestion[]; incomplete?: boolean; @@ -431,13 +404,13 @@ export interface ISuggestions { overwriteAfter?: number; } -export interface IFilter { +export interface ISuggestionFilter { // Should return whether `suggestion` is a good suggestion for `word` - (word:string, suggestion:ISuggestion):boolean; + (word: string, suggestion: ISuggestion): IMatch[]; } -export interface ISorter { - (one: ISuggestion, other: ISuggestion):number; +export interface ISuggestionSorter { + (one: ISuggestion, other: ISuggestion): number; } /** @@ -448,15 +421,15 @@ export interface ISuggestSupport { /** * Compute all completions for the given resource at the given position. */ - suggest(resource: URL, position: EditorCommon.IPosition, triggerCharacter?: string): TPromise; + suggest(resource: URI, position: EditorCommon.IPosition, triggerCharacter?: string): TPromise; /** * Compute more details for the given suggestion. */ - getSuggestionDetails?:(resource:URL, position:EditorCommon.IPosition, suggestion:ISuggestion)=>TPromise; + getSuggestionDetails?:(resource:URI, position:EditorCommon.IPosition, suggestion:ISuggestion)=>TPromise; - getFilter():IFilter; - getSorter?():ISorter; + getFilter():ISuggestionFilter; + getSorter?():ISuggestionSorter; getTriggerCharacters():string[]; shouldShowEmptySuggestionList():boolean; shouldAutotriggerSuggest(context:ILineContext, offset:number, triggeredByCharacter:string):boolean; @@ -466,10 +439,8 @@ export interface ISuggestSupport { * Interface used to quick fix typing errors while accesing member fields. */ export interface IQuickFix { - label: string; - id: any; + command: ICommand; score: number; - documentation?: string; } export interface IQuickFixResult { @@ -479,7 +450,8 @@ export interface IQuickFixResult { export interface IQuickFixSupport { getQuickFixes(resource: URI, range: IMarker | EditorCommon.IRange): TPromise; - runQuickFixAction(resource: URI, range: EditorCommon.IRange, id: any):TPromise; + //TODO@joh this should be removed in the furture such that we can trust the command and it's args + runQuickFixAction(resource: URI, range: EditorCommon.IRange, quickFix: IQuickFix):TPromise; } export interface IParameter { @@ -504,7 +476,7 @@ export interface IParameterHints { export interface IParameterHintsContribution { triggerCharacters: string[]; excludeTokens: string[]; - getParameterHints: (resource: URL, position: EditorCommon.IPosition) => TPromise; + getParameterHints: (resource: URI, position: EditorCommon.IPosition) => TPromise; } /** @@ -513,7 +485,7 @@ export interface IParameterHintsContribution { export interface IParameterHintsSupport { getParameterHintsTriggerCharacters(): string[]; shouldTriggerParameterHints(context: ILineContext, offset: number): boolean; - getParameterHints(resource: URL, position: EditorCommon.IPosition, triggerCharacter?: string): TPromise; + getParameterHints(resource: URI, position: EditorCommon.IPosition, triggerCharacter?: string): TPromise; } @@ -526,7 +498,7 @@ export interface IOccurence { * Interface used to find occurrences of a symbol */ export interface IOccurrencesSupport { - findOccurrences(resource:URL, position:EditorCommon.IPosition, strict?:boolean):TPromise; + findOccurrences(resource:URI, position:EditorCommon.IPosition, strict?:boolean):TPromise; } @@ -553,7 +525,7 @@ export interface IReferenceSupport { * @returns a list of reference of the symbol at the position in the * given resource. */ - findReferences(resource:URL, position:EditorCommon.IPosition, includeDeclaration:boolean):TPromise; + findReferences(resource:URI, position:EditorCommon.IPosition, includeDeclaration:boolean):TPromise; } /** @@ -561,12 +533,12 @@ export interface IReferenceSupport { */ export interface IDeclarationSupport { canFindDeclaration(context:ILineContext, offset:number):boolean; - findDeclaration(resource:URL, position:EditorCommon.IPosition):TPromise; + findDeclaration(resource:URI, position:EditorCommon.IPosition):TPromise; } export interface ITypeDeclarationSupport { canFindTypeDeclaration(context:ILineContext, offset:number):boolean; - findTypeDeclaration(resource:URL, position:EditorCommon.IPosition):TPromise; + findTypeDeclaration(resource:URI, position:EditorCommon.IPosition):TPromise; } /** @@ -582,7 +554,7 @@ export interface IOutlineEntry { } export interface IOutlineSupport { - getOutline(resource:URL):TPromise; + getOutline(resource:URI):TPromise; outlineGroupLabel?: { [name: string]: string; }; } @@ -594,7 +566,7 @@ export interface ILogicalSelectionEntry { range:EditorCommon.IRange; } export interface ILogicalSelectionSupport { - getRangesToPosition(resource:URL, position:EditorCommon.IPosition):TPromise; + getRangesToPosition(resource:URI, position:EditorCommon.IPosition):TPromise; } /** @@ -614,13 +586,13 @@ export interface IFormattingOptions { */ export interface IFormattingSupport { - formatDocument?: (resource: URL, options: IFormattingOptions) => TPromise; + formatDocument?: (resource: URI, options: IFormattingOptions) => TPromise; - formatRange?: (resource: URL, range: EditorCommon.IRange, options: IFormattingOptions) => TPromise; + formatRange?: (resource: URI, range: EditorCommon.IRange, options: IFormattingOptions) => TPromise; autoFormatTriggerCharacters?: string[]; - formatAfterKeystroke?: (resource: URL, position: EditorCommon.IPosition, ch: string, options: IFormattingOptions) => TPromise; + formatAfterKeystroke?: (resource: URI, position: EditorCommon.IPosition, ch: string, options: IFormattingOptions) => TPromise; } export interface IInplaceReplaceSupportResult { @@ -632,7 +604,7 @@ export interface IInplaceReplaceSupportResult { * Interface used to navigate with a value-set. */ export interface IInplaceReplaceSupport { - navigateValueSet(resource:URL, range:EditorCommon.IRange, up:boolean):TPromise; + navigateValueSet(resource:URI, range:EditorCommon.IRange, up:boolean):TPromise; } @@ -640,7 +612,7 @@ export interface IInplaceReplaceSupport { * Interface used to compute the diff between two models. */ export interface IDiffSupport { - computeDiff(original:URL, modified:URL, ignoreTrimWhitespace:boolean):TPromise; + computeDiff(original:URI, modified:URI, ignoreTrimWhitespace:boolean):TPromise; } @@ -648,14 +620,14 @@ export interface IDiffSupport { * Interface used to compute the diff between a model and its original version. */ export interface IDirtyDiffSupport { - computeDirtyDiff(resource:URL, ignoreTrimWhitespace:boolean):TPromise; + computeDirtyDiff(resource:URI, ignoreTrimWhitespace:boolean):TPromise; } /** * Interface used to get output for a language that supports transformation (e.g. markdown -> html) */ export interface IEmitOutputSupport { - getEmitOutput(resource:URL):TPromise; + getEmitOutput(resource:URI):TPromise; } export interface IEmitOutput { @@ -680,7 +652,7 @@ export interface ILink { } export interface ILinkSupport { - computeLinks(resource:URL):TPromise; + computeLinks(resource:URI):TPromise; } /** @@ -802,8 +774,7 @@ export interface ICommand { export interface ICodeLensSymbol { range: EditorCommon.IRange; id?: string; - kind?: string; - name?: string; + command?: ICommand; } /** @@ -811,7 +782,7 @@ export interface ICodeLensSymbol { */ export interface ICodeLensSupport { findCodeLensSymbols(resource: URI): TPromise; - resolveCodeLensSymbol(resource: URI, symbol: ICodeLensSymbol): TPromise; + resolveCodeLensSymbol(resource: URI, symbol: ICodeLensSymbol): TPromise; } export interface ITaskSummary { diff --git a/src/vs/editor/common/modes/abstractMode.ts b/src/vs/editor/common/modes/abstractMode.ts index ab68df67cc6..040fac79b3f 100644 --- a/src/vs/editor/common/modes/abstractMode.ts +++ b/src/vs/editor/common/modes/abstractMode.ts @@ -11,7 +11,7 @@ import {handleEvent} from 'vs/editor/common/modes/supports'; import {AbstractModeWorker} from 'vs/editor/common/modes/abstractModeWorker'; import Modes = require('vs/editor/common/modes'); import EditorCommon = require('vs/editor/common/editorCommon'); -import {URL} from 'vs/base/common/network'; +import URI from 'vs/base/common/uri'; import {IDisposable} from 'vs/base/common/lifecycle'; import {TPromise} from 'vs/base/common/winjs.base'; import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation'; @@ -49,6 +49,7 @@ export class AbstractMode implements Modes.IMode { // adapters end private _eventEmitter = new EventEmitter(); + private _simplifiedMode: Modes.IMode; constructor( descriptor:Modes.IModeDescriptor, @@ -73,6 +74,7 @@ export class AbstractMode implements Modes.IMode { this.tokenTypeClassificationSupport = this; this._workerPiecePromise = null; + this._simplifiedMode = null; } public getId(): string { @@ -86,6 +88,13 @@ export class AbstractMode implements Modes.IMode { } } + public toSimplifiedMode(): Modes.IMode { + if (!this._simplifiedMode) { + this._simplifiedMode = new SimplifiedMode(this); + } + return this._simplifiedMode; + } + private _getOrCreateWorker(): TPromise { if (!this._workerPiecePromise) { var workerDescriptor: AsyncDescriptor2 = this._getWorkerDescriptor(); @@ -129,7 +138,7 @@ export class AbstractMode implements Modes.IMode { return this._worker((w) => w.enableValidator()); } - public getFilter(): Modes.IFilter { + public getFilter(): Modes.ISuggestionFilter { return StrictPrefix; } @@ -153,7 +162,7 @@ export class AbstractMode implements Modes.IMode { } static $suggest = OneWorkerAttr(AbstractMode, AbstractMode.prototype.suggest); - public suggest(resource:URL, position:EditorCommon.IPosition):TPromise { + public suggest(resource:URI, position:EditorCommon.IPosition):TPromise { return this._worker((w) => w.suggest(resource, position)); } @@ -178,7 +187,7 @@ export class AbstractMode implements Modes.IMode { } public shouldAutotriggerSuggestImpl(context:Modes.ILineContext, offset:number, triggeredByCharacter:string):boolean { - return false; + return true; } public shouldShowEmptySuggestionList():boolean { @@ -186,27 +195,27 @@ export class AbstractMode implements Modes.IMode { } static $findOccurrences = OneWorkerAttr(AbstractMode, AbstractMode.prototype.findOccurrences); - public findOccurrences(resource:URL, position:EditorCommon.IPosition, strict:boolean = false): TPromise { + public findOccurrences(resource:URI, position:EditorCommon.IPosition, strict:boolean = false): TPromise { return this._worker((w) => w.findOccurrences(resource, position, strict)); } static $navigateValueSet = OneWorkerAttr(AbstractMode, AbstractMode.prototype.navigateValueSet); - public navigateValueSet(resource:URL, position:EditorCommon.IRange, up:boolean):TPromise { + public navigateValueSet(resource:URI, position:EditorCommon.IRange, up:boolean):TPromise { return this._worker((w) => w.inplaceReplaceSupport.navigateValueSet(resource, position, up)); } static $computeDiff = OneWorkerAttr(AbstractMode, AbstractMode.prototype.computeDiff); - public computeDiff(original:URL, modified:URL, ignoreTrimWhitespace:boolean):TPromise { + public computeDiff(original:URI, modified:URI, ignoreTrimWhitespace:boolean):TPromise { return this._worker((w) => w.computeDiff(original, modified, ignoreTrimWhitespace)); } static $computeDirtyDiff = OneWorkerAttr(AbstractMode, AbstractMode.prototype.computeDirtyDiff); - public computeDirtyDiff(resource:URL, ignoreTrimWhitespace:boolean):TPromise { + public computeDirtyDiff(resource:URI, ignoreTrimWhitespace:boolean):TPromise { return this._worker((w) => w.computeDirtyDiff(resource, ignoreTrimWhitespace)); } static $computeLinks = OneWorkerAttr(AbstractMode, AbstractMode.prototype.computeLinks); - public computeLinks(resource:URL):TPromise { + public computeLinks(resource:URI):TPromise { return this._worker((w) => w.computeLinks(resource)); } @@ -236,7 +245,84 @@ export class AbstractMode implements Modes.IMode { } } +class SimplifiedMode implements Modes.IMode { + tokenizationSupport: Modes.ITokenizationSupport; + electricCharacterSupport: Modes.IElectricCharacterSupport; + commentsSupport: Modes.ICommentsSupport; + characterPairSupport: Modes.ICharacterPairSupport; + tokenTypeClassificationSupport: Modes.ITokenTypeClassificationSupport; + onEnterSupport: Modes.IOnEnterSupport; + + private _sourceMode: Modes.IMode; + private _eventEmitter: EventEmitter; + private _id: string; + + constructor(sourceMode: Modes.IMode) { + this._sourceMode = sourceMode; + this._eventEmitter = new EventEmitter(); + this._id = 'vs.editor.modes.simplifiedMode:' + sourceMode.getId(); + this._assignSupports(); + + if (this._sourceMode.addSupportChangedListener) { + this._sourceMode.addSupportChangedListener((e) => { + if (e.tokenizationSupport || e.electricCharacterSupport || e.commentsSupport || e.characterPairSupport || e.tokenTypeClassificationSupport || e.onEnterSupport) { + this._assignSupports(); + let newEvent = SimplifiedMode._createModeSupportChangedEvent(e); + this._eventEmitter.emit('modeSupportChanged', newEvent); + } + }) + } + } + + public getId(): string { + return this._id; + } + + public toSimplifiedMode(): Modes.IMode { + return this; + } + + private _assignSupports(): void { + this.tokenizationSupport = this._sourceMode.tokenizationSupport; + this.electricCharacterSupport = this._sourceMode.electricCharacterSupport; + this.commentsSupport = this._sourceMode.commentsSupport; + this.characterPairSupport = this._sourceMode.characterPairSupport; + this.tokenTypeClassificationSupport = this._sourceMode.tokenTypeClassificationSupport; + this.onEnterSupport = this._sourceMode.onEnterSupport; + } + + private static _createModeSupportChangedEvent(originalModeEvent:EditorCommon.IModeSupportChangedEvent): EditorCommon.IModeSupportChangedEvent { + var event = { + codeLensSupport: false, + tokenizationSupport: originalModeEvent.tokenizationSupport, + occurrencesSupport:false, + declarationSupport:false, + typeDeclarationSupport:false, + navigateTypesSupport:false, + referenceSupport:false, + suggestSupport:false, + parameterHintsSupport:false, + extraInfoSupport:false, + outlineSupport:false, + logicalSelectionSupport:false, + formattingSupport:false, + inplaceReplaceSupport:false, + diffSupport:false, + dirtyDiffSupport:false, + emitOutputSupport:false, + linkSupport:false, + configSupport:false, + electricCharacterSupport: originalModeEvent.electricCharacterSupport, + commentsSupport: originalModeEvent.commentsSupport, + characterPairSupport: originalModeEvent.characterPairSupport, + tokenTypeClassificationSupport: originalModeEvent.tokenTypeClassificationSupport, + quickFixSupport:false, + onEnterSupport: originalModeEvent.onEnterSupport + }; + return event; + } +} export var isDigit:(character:string, base:number)=>boolean = (function () { diff --git a/src/vs/editor/common/modes/abstractModeWorker.ts b/src/vs/editor/common/modes/abstractModeWorker.ts index 39a2b30ea21..1115ba47ada 100644 --- a/src/vs/editor/common/modes/abstractModeWorker.ts +++ b/src/vs/editor/common/modes/abstractModeWorker.ts @@ -5,7 +5,7 @@ 'use strict'; import {IEventEmitter} from 'vs/base/common/eventEmitter'; -import {URL} from 'vs/base/common/network'; +import URI from 'vs/base/common/uri'; import {IMarkerService} from 'vs/platform/markers/common/markers'; import {IResourceService} from 'vs/editor/common/services/resourceService'; import {computeLinks} from 'vs/editor/common/modes/linkComputer'; @@ -28,7 +28,7 @@ function isISuggestParticipant(thing:any):boolean { export class AbstractModeWorker { - static filter: Modes.IFilter = DefaultFilter; + static filter: Modes.ISuggestionFilter = DefaultFilter; private _validationParticipants:Modes.IValidateParticipant[] = []; private _suggestParticipants:Modes.ISuggestParticipant[] = []; @@ -88,18 +88,18 @@ export class AbstractModeWorker { return TPromise.as(null); } - private _newValidate(changed:URL[], notChanged:URL[], dueToConfigurationChange:boolean): void { + private _newValidate(changed:URI[], notChanged:URI[], dueToConfigurationChange:boolean): void { this.doValidateOnChange(changed, notChanged, dueToConfigurationChange); for (var i = 0; i < changed.length; i++) { this.triggerValidateParticipation(changed[i], this._getContextForValidationParticipants(changed[i])); } } - public _getContextForValidationParticipants(resource:URL):any { + public _getContextForValidationParticipants(resource:URI):any { return null; } - public doValidateOnChange(changed:URL[], notChanged:URL[], dueToConfigurationChange:boolean): void { + public doValidateOnChange(changed:URI[], notChanged:URI[], dueToConfigurationChange:boolean): void { if (dueToConfigurationChange) { for (var i = 0; i < changed.length; i++) { this.doValidate(changed[i]); @@ -114,7 +114,7 @@ export class AbstractModeWorker { } } - public triggerValidateParticipation(resource:URL, context:any=null):void { + public triggerValidateParticipation(resource:URI, context:any=null):void { var model = this.resourceService.get(resource); this._validationParticipants.forEach(participant => { @@ -127,13 +127,13 @@ export class AbstractModeWorker { }); } - public doValidate(resource:URL): void { + public doValidate(resource:URI): void { return null; } // ---- suggestion --------------------------------------------------------------------------------------- - public suggest(resource:URL, position:EditorCommon.IPosition):TPromise { + public suggest(resource:URI, position:EditorCommon.IPosition):TPromise { return this._getSuggestContext(resource).then((context) => { var promises = [ this.doSuggest(resource, position) ]; @@ -143,16 +143,16 @@ export class AbstractModeWorker { }).then((values) => { // filter suggestions var accept = this.getSuggestionFilterMain(), - result:Modes.ISuggestions[] = []; + result:Modes.ISuggestResult[] = []; for (var i = 0, len = values.length; i < len; i++) { var value = values[i]; if(!value) { continue; } - result.push( { + result.push( { currentWord: value.currentWord, - suggestions: value.suggestions.filter((element) => accept(values[i].currentWord, element)), + suggestions: value.suggestions.filter((element) => !!accept(values[i].currentWord, element)), incomplete: value.incomplete, overwriteBefore: value.overwriteBefore, overwriteAfter: value.overwriteAfter @@ -161,14 +161,14 @@ export class AbstractModeWorker { return result; }, (error) => { - return [{ + return [{ currentWord: '', suggestions: [] }]; }); } - public _participantSuggests(resource:URL, position:EditorCommon.IPosition, context:any):TPromise[] { + public _participantSuggests(resource:URI, position:EditorCommon.IPosition, context:any):TPromise[] { return this._suggestParticipants.map((participant) => { try { return participant.suggest(resource, position, context); @@ -179,16 +179,16 @@ export class AbstractModeWorker { }); } - public _getSuggestContext(resource:URL):TPromise { + public _getSuggestContext(resource:URI):TPromise { return TPromise.as(undefined); } - public doSuggest(resource:URL, position:EditorCommon.IPosition):TPromise { + public doSuggest(resource:URI, position:EditorCommon.IPosition):TPromise { var model = this.resourceService.get(resource), currentWord = model.getWordUntilPosition(position).word; - var result:Modes.ISuggestions = { + var result:Modes.ISuggestResult = { currentWord: currentWord, suggestions: [] }; @@ -198,7 +198,7 @@ export class AbstractModeWorker { return TPromise.as(result); } - public suggestWords(resource:URL, position:EditorCommon.IPosition, mustHaveCurrentWord:boolean):Modes.ISuggestion[] { + public suggestWords(resource:URI, position:EditorCommon.IPosition, mustHaveCurrentWord:boolean):Modes.ISuggestion[] { var modelMirror = this.resourceService.get(resource); var currentWord = modelMirror.getWordUntilPosition(position).word; var allWords = modelMirror.getAllUniqueWords(currentWord); @@ -219,11 +219,11 @@ export class AbstractModeWorker { }); } - public suggestSnippets(resource:URL, position:EditorCommon.IPosition):Modes.ISuggestion[] { + public suggestSnippets(resource:URI, position:EditorCommon.IPosition):Modes.ISuggestion[] { return []; } - private getSuggestionFilterMain():Modes.IFilter { + private getSuggestionFilterMain():Modes.ISuggestionFilter { var filter = this.getSuggestionFilter(); // Collect Suggestion Participants @@ -236,13 +236,13 @@ export class AbstractModeWorker { return filter; } - public getSuggestionFilter():Modes.IFilter { + public getSuggestionFilter():Modes.ISuggestionFilter { return AbstractModeWorker.filter; } // ---- occurrences --------------------------------------------------------------- - public findOccurrences(resource:URL, position:EditorCommon.IPosition, strict?:boolean):TPromise { + public findOccurrences(resource:URI, position:EditorCommon.IPosition, strict?:boolean):TPromise { var model = this.resourceService.get(resource), wordAtPosition = model.getWordAtPosition(position), @@ -266,7 +266,7 @@ export class AbstractModeWorker { // ---- diff -------------------------------------------------------------------------- - public computeDiff(original:URL, modified:URL, ignoreTrimWhitespace:boolean):TPromise { + public computeDiff(original:URI, modified:URI, ignoreTrimWhitespace:boolean):TPromise { var originalModel = this.resourceService.get(original); var modifiedModel = this.resourceService.get(modified); if (originalModel !== null && modifiedModel !== null) { @@ -284,7 +284,7 @@ export class AbstractModeWorker { // ---- dirty diff -------------------------------------------------------------------- - public computeDirtyDiff(resource:URL, ignoreTrimWhitespace:boolean):TPromise { + public computeDirtyDiff(resource:URI, ignoreTrimWhitespace:boolean):TPromise { var model = this.resourceService.get(resource); var original = model.getProperty('original'); @@ -305,7 +305,7 @@ export class AbstractModeWorker { // ---- link detection ------------------------------------------------------------------ - public computeLinks(resource:URL):TPromise { + public computeLinks(resource:URI):TPromise { var model = this.resourceService.get(resource), links = computeLinks(model); diff --git a/src/vs/editor/common/modes/languageFeatureRegistry.ts b/src/vs/editor/common/modes/languageFeatureRegistry.ts index f2c129595f9..39592189e0b 100644 --- a/src/vs/editor/common/modes/languageFeatureRegistry.ts +++ b/src/vs/editor/common/modes/languageFeatureRegistry.ts @@ -12,7 +12,7 @@ import URI from 'vs/base/common/uri'; import {binarySearch} from 'vs/base/common/arrays'; import {IPosition, IModel} from 'vs/editor/common/editorCommon'; import {IDeclarationSupport, ILineContext, IReference} from 'vs/editor/common/modes'; -import {LanguageSelector, ModelLike, score} from 'vs/editor/common/modes/languageSelector'; +import {LanguageSelector, score} from 'vs/editor/common/modes/languageSelector'; interface Entry { selector: LanguageSelector; @@ -45,7 +45,7 @@ export default class LanguageFeatureRegistry { }; this._entries.push(entry); - this._candidate = undefined; + this._lastCandidate = undefined; this._onDidChange.fire(this._entries.length); return { @@ -54,7 +54,7 @@ export default class LanguageFeatureRegistry { let idx = this._entries.indexOf(entry); if (idx >= 0) { this._entries.splice(idx, 1); - this._candidate = undefined; + this._lastCandidate = undefined; this._onDidChange.fire(this._entries.length); entry = undefined; } @@ -67,38 +67,40 @@ export default class LanguageFeatureRegistry { return this.all(model).length > 0; } - all(model: IModel | ModelLike): T[]{ - let result: T[] = []; - if (model) { - this._updateScores(model); - // from registry - for (let entry of this._entries) { - if (entry._score > 0) { - result.push(entry.provider); - } - } - // from mode - if (isModel(model)) { - if (model.getMode() && model.getMode()[this._supportName]) { - result.push(model.getMode()[this._supportName]); - } + all(model: IModel): T[] { + if (!model || model.isTooLargeForHavingAMode()) { + return []; + } + + this._updateScores(model); + const result: T[] = []; + + // (1) from registry + for (let entry of this._entries) { + if (entry._score > 0) { + result.push(entry.provider); } } + // (2) from mode + if (model.getMode() && model.getMode()[this._supportName]) { + result.push(model.getMode()[this._supportName]); + } + return result; } - ordered(model: IModel|ModelLike): T[] { - let entries = this._orderedEntries(model); - return entries.map(item => item.provider); + ordered(model: IModel): T[] { + const result: T[] = []; + this._orderedForEach(model, entry => result.push(entry.provider)); + return result; } - orderedGroups(model: IModel | ModelLike): T[][] { - let entries = this._orderedEntries(model); - let result: T[][] = []; + orderedGroups(model: IModel): T[][] { + const result: T[][] = []; let lastBucket: T[]; let lastBucketScore: number; - for (let entry of entries) { + this._orderedForEach(model, entry => { if (lastBucket && lastBucketScore === entry._score) { lastBucket.push(entry.provider); } else { @@ -106,70 +108,68 @@ export default class LanguageFeatureRegistry { lastBucket = [entry.provider]; result.push(lastBucket); } - } + }); return result; } - private _orderedEntries(model: IModel | ModelLike): Entry[] { - let result: Entry[] = []; - if (model) { - if (this._updateScores(model)) { - this._sortByScore(); - } + private _orderedForEach(model: IModel, callback: (provider: Entry) => any): void { - // from registry - for (let entry of this._entries) { - if (entry._score > 0) { - result.push(entry); - } - } - - // from mode - if (isModel(model)) { - if (model.getMode() && model.getMode()[this._supportName]) { - - let entry: Entry = { - selector: undefined, - provider: model.getMode()[this._supportName], - _score: .5, - _time: 0 - }; - - let idx = binarySearch(result, entry, LanguageFeatureRegistry._compareByScoreAndTime); - result.splice(idx < 0 ? ~idx : idx, 0, entry); - } - } + if (!model || model.isTooLargeForHavingAMode()) { + return; } - return result; - } - private _candidate: ModelLike; + if (this._updateScores(model)) { + this._sortByScore(); + } - private _updateScores(model: IModel|ModelLike): boolean { + let supportIndex: number = -1; + let supportEntry: Entry; - let candidate: ModelLike; - if (isModel(model)) { - candidate = { - uri: model.getAssociatedResource(), - language: model.getModeId() + if (model.getMode() && model.getMode()[this._supportName]) { + supportEntry = { + selector: undefined, + provider: model.getMode()[this._supportName], + _score: .5, + _time: 0 }; - } else { - candidate = model; + supportIndex = ~binarySearch(this._entries, supportEntry, LanguageFeatureRegistry._compareByScoreAndTime); } - if (this._candidate - && this._candidate.language === candidate.language - && this._candidate.uri.toString() === candidate.uri.toString()) { + const to = Math.max(supportIndex + 1, this._entries.length); + for (let from = 0; from < to; from++) { + if (from === supportIndex) { + callback(supportEntry); + } else { + let entry = this._entries[from]; + if (entry._score > 0) { + callback(entry); + } + } + } + } + + private _lastCandidate: { uri: string; language: string; }; + + private _updateScores(model: IModel): boolean { + + let candidate = { + uri: model.getAssociatedResource().toString(), + language: model.getModeId() + }; + + if (this._lastCandidate + && this._lastCandidate.language === candidate.language + && this._lastCandidate.uri === candidate.uri) { // nothing has changed return; } - this._candidate = candidate; + this._lastCandidate = candidate; for (let entry of this._entries) { - entry._score = score(entry.selector, this._candidate); + entry._score = score(entry.selector, model.getAssociatedResource(), model.getModeId()); } return true; } @@ -192,7 +192,3 @@ export default class LanguageFeatureRegistry { } } } - -function isModel(thing: any): thing is IModel { - return typeof thing['getMode'] === 'function'; -} \ No newline at end of file diff --git a/src/vs/editor/common/modes/languageSelector.ts b/src/vs/editor/common/modes/languageSelector.ts index 059a7144ad3..d7a169f1d6b 100644 --- a/src/vs/editor/common/modes/languageSelector.ts +++ b/src/vs/editor/common/modes/languageSelector.ts @@ -6,6 +6,7 @@ 'use strict'; import URI from 'vs/base/common/uri'; +import {IModel} from 'vs/editor/common/editorCommon'; import {match as matchGlobPattern} from 'vs/base/common/glob'; export interface LanguageFilter { @@ -16,25 +17,20 @@ export interface LanguageFilter { export type LanguageSelector = string|LanguageFilter|(string|LanguageFilter)[]; -export interface ModelLike { - uri: URI; - language: string; +export default function matches(selection: LanguageSelector, uri: URI, language: string): boolean { + return score(selection, uri, language) > 0; } -export default function matches(selection: LanguageSelector, model: ModelLike): boolean { - return score(selection, model) > 0; -} - -export function score(selector: LanguageSelector, model: ModelLike): number { +export function score(selector: LanguageSelector, uri: URI, language: string): number { if (Array.isArray(selector)) { // for each - let values = (selector).map(item => score(item, model)); + let values = (selector).map(item => score(item, uri, language)); return Math.max(...values); } else if (typeof selector === 'string') { // compare language id - if (selector === model.language) { + if (selector === language) { return 10; } else if (selector === '*') { return 5; @@ -47,7 +43,7 @@ export function score(selector: LanguageSelector, model: ModelLike): number { // language id if (filter.language) { - if (filter.language === model.language) { + if (filter.language === language) { value += 10; } else if (filter.language === '*') { value += 5; @@ -58,7 +54,7 @@ export function score(selector: LanguageSelector, model: ModelLike): number { // scheme if (filter.scheme) { - if (filter.scheme === model.uri.scheme) { + if (filter.scheme === uri.scheme) { value += 10; } else { return 0; @@ -67,9 +63,9 @@ export function score(selector: LanguageSelector, model: ModelLike): number { // match fsPath with pattern if (filter.pattern) { - if (filter.pattern === model.uri.fsPath) { + if (filter.pattern === uri.fsPath) { value += 10; - } else if (matchGlobPattern(filter.pattern, model.uri.fsPath)) { + } else if (matchGlobPattern(filter.pattern, uri.fsPath)) { value += 5; } else { return 0; diff --git a/src/vs/editor/common/modes/lineStream.ts b/src/vs/editor/common/modes/lineStream.ts index 608b5aad7ff..b340ab62cb5 100644 --- a/src/vs/editor/common/modes/lineStream.ts +++ b/src/vs/editor/common/modes/lineStream.ts @@ -40,15 +40,15 @@ export class LineStream implements IStream { } private actualStringToArray(str:string):boolean[] { - var maxCharCode = 0; - for (var i = 0; i < str.length; i++) { - maxCharCode = str.charCodeAt(i); + let maxCharCode = 0; + for (let i = 0; i < str.length; i++) { + maxCharCode = Math.max(maxCharCode, str.charCodeAt(i)); } - var r = []; - for (i = 0; i < maxCharCode; i++) { + let r:boolean[] = []; + for (let i = 0; i <= maxCharCode; i++) { r[i] = false; } - for (i = 0; i < str.length; i++) { + for (let i = 0; i < str.length; i++) { r[str.charCodeAt(i)] = true; } return r; diff --git a/src/vs/editor/common/modes/modesFilters.ts b/src/vs/editor/common/modes/modesFilters.ts index 671847fe071..d9276237c18 100644 --- a/src/vs/editor/common/modes/modesFilters.ts +++ b/src/vs/editor/common/modes/modesFilters.ts @@ -4,32 +4,34 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import {IFilter, ISuggestion} from 'vs/editor/common/modes'; -import Filters = require('vs/base/common/filters'); +import {ISuggestionFilter, ISuggestion} from 'vs/editor/common/modes'; +import * as Filters from 'vs/base/common/filters'; +import {isFalsyOrEmpty} from 'vs/base/common/arrays'; -function wrapBaseFilter(filter:Filters.IFilter):IFilter { - return (word:string, suggestion:ISuggestion):boolean => { - var highlights = filter(word, suggestion.filterText || suggestion.label); - suggestion.highlights = highlights || []; - return !!highlights; +export type IMatch = Filters.IMatch; + +function wrapBaseFilter(filter: Filters.IFilter): ISuggestionFilter { + return (word: string, suggestion: ISuggestion): Filters.IMatch[] => { + const result = filter(word, suggestion.filterText || suggestion.label); + return isFalsyOrEmpty(result) ? undefined : result; }; } -export var StrictPrefix: IFilter = wrapBaseFilter(Filters.matchesStrictPrefix); -export var Prefix:IFilter = wrapBaseFilter(Filters.matchesPrefix); -export var CamelCase: IFilter = wrapBaseFilter(Filters.matchesCamelCase); -export var ContiguousSubString:IFilter = wrapBaseFilter(Filters.matchesContiguousSubString); +export var StrictPrefix: ISuggestionFilter = wrapBaseFilter(Filters.matchesStrictPrefix); +export var Prefix: ISuggestionFilter = wrapBaseFilter(Filters.matchesPrefix); +export var CamelCase: ISuggestionFilter = wrapBaseFilter(Filters.matchesCamelCase); +export var ContiguousSubString: ISuggestionFilter = wrapBaseFilter(Filters.matchesContiguousSubString); // Combined Filters -export function or(first:IFilter, second:IFilter):IFilter { - return (word:string, suggestion:ISuggestion):boolean => { +export function or(first: ISuggestionFilter, second: ISuggestionFilter): ISuggestionFilter { + return (word: string, suggestion: ISuggestion): Filters.IMatch[] => { return first(word, suggestion) || second(word, suggestion); }; } -export function and(first:IFilter, second:IFilter):IFilter { - return (word:string, suggestion:ISuggestion):boolean => { +export function and(first: ISuggestionFilter, second: ISuggestionFilter): ISuggestionFilter { + return (word: string, suggestion: ISuggestion): Filters.IMatch[] => { return first(word, suggestion) && second(word, suggestion); }; } diff --git a/src/vs/editor/common/modes/modesRegistry.ts b/src/vs/editor/common/modes/modesRegistry.ts index 09010df7a92..f0b486a5731 100644 --- a/src/vs/editor/common/modes/modesRegistry.ts +++ b/src/vs/editor/common/modes/modesRegistry.ts @@ -152,10 +152,10 @@ export function registerSnippets(modeId: string, path: string, snippets: Modes.I } snippetsByMode[path] = snippets; } -export function getSnippets(model: EditorCommon.IModel, position: EditorCommon.IPosition): Modes.ISuggestions { +export function getSnippets(model: EditorCommon.IModel, position: EditorCommon.IPosition): Modes.ISuggestResult { var word = model.getWordAtPosition(position); var currentPrefix = word ? word.word.substring(0, position.column - word.startColumn) : ''; - var result : Modes.ISuggestions = { + var result : Modes.ISuggestResult = { currentWord: currentPrefix, suggestions: [] } diff --git a/src/vs/editor/common/modes/monarch/monarchDefinition.ts b/src/vs/editor/common/modes/monarch/monarchDefinition.ts index 4b920eca4c2..ebf0e0f35c4 100644 --- a/src/vs/editor/common/modes/monarch/monarchDefinition.ts +++ b/src/vs/editor/common/modes/monarch/monarchDefinition.ts @@ -49,7 +49,7 @@ export function createCharacterPairContribution(lexer: MonarchCommonTypes.ILexer }; } -function _addSuggestionsAtPosition(model: EditorCommon.IModel, position:EditorCommon.IPosition, lexer: MonarchCommonTypes.ILexer, superSuggestions:Modes.ISuggestions[]): Modes.ISuggestions[] { +function _addSuggestionsAtPosition(model: EditorCommon.IModel, position:EditorCommon.IPosition, lexer: MonarchCommonTypes.ILexer, superSuggestions:Modes.ISuggestResult[]): Modes.ISuggestResult[] { var extra = lexer.suggestSupport.snippets; if (!extra || extra.length === 0) { return superSuggestions; diff --git a/src/vs/editor/common/modes/nullMode.ts b/src/vs/editor/common/modes/nullMode.ts index 4e6c80f0846..36e82233517 100644 --- a/src/vs/editor/common/modes/nullMode.ts +++ b/src/vs/editor/common/modes/nullMode.ts @@ -91,6 +91,10 @@ export class NullMode implements Modes.IMode { return NullMode.ID; } + public toSimplifiedMode(): Modes.IMode { + return this; + } + public getWordDefinition():RegExp { return NullMode.DEFAULT_WORD_REGEXP; } diff --git a/src/vs/editor/common/modes/supports.ts b/src/vs/editor/common/modes/supports.ts index 87f2c35e2a2..ba20bd853fa 100644 --- a/src/vs/editor/common/modes/supports.ts +++ b/src/vs/editor/common/modes/supports.ts @@ -16,7 +16,7 @@ import Modes = require('vs/editor/common/modes'); import EditorCommon = require('vs/editor/common/editorCommon'); import {IResourceService} from 'vs/editor/common/services/resourceService'; import {Arrays} from 'vs/editor/common/core/arrays'; -import {URL} from 'vs/base/common/network'; +import URI from 'vs/base/common/uri'; import {IDisposable} from 'vs/base/common/lifecycle'; export class Token implements Modes.IToken { @@ -566,7 +566,7 @@ export class BracketElectricCharacterSupport extends AbstractSupport implements export interface IDeclarationContribution { tokens?: string[]; - findDeclaration: (resource: URL, position: EditorCommon.IPosition) => TPromise; + findDeclaration: (resource: URI, position: EditorCommon.IPosition) => TPromise; } export class DeclarationSupport extends AbstractSupport implements Modes.IDeclarationSupport { @@ -594,14 +594,14 @@ export class DeclarationSupport extends AbstractSupport implements Modes.IDeclar }); } - public findDeclaration(resource: URL, position: EditorCommon.IPosition): TPromise{ + public findDeclaration(resource: URI, position: EditorCommon.IPosition): TPromise{ return this.contribution.findDeclaration(resource, position); } } export interface ITypeDeclarationContribution { tokens: string[]; - findTypeDeclaration: (resource: URL, position: EditorCommon.IPosition) => TPromise; + findTypeDeclaration: (resource: URI, position: EditorCommon.IPosition) => TPromise; } export class TypeDeclarationSupport extends AbstractSupport implements Modes.ITypeDeclarationSupport { @@ -629,14 +629,14 @@ export class TypeDeclarationSupport extends AbstractSupport implements Modes.ITy }); } - public findTypeDeclaration(resource: URL, position: EditorCommon.IPosition): TPromise { + public findTypeDeclaration(resource: URI, position: EditorCommon.IPosition): TPromise { return this.contribution.findTypeDeclaration(resource, position); } } export interface IReferenceContribution { tokens: string[]; - findReferences: (resource: URL, position: EditorCommon.IPosition, includeDeclaration: boolean) => TPromise; + findReferences: (resource: URI, position: EditorCommon.IPosition, includeDeclaration: boolean) => TPromise; } export class ReferenceSupport extends AbstractSupport implements Modes.IReferenceSupport { @@ -665,7 +665,7 @@ export class ReferenceSupport extends AbstractSupport implements Modes.IReferenc }); } - public findReferences(resource: URL, position: EditorCommon.IPosition, includeDeclaration: boolean): TPromise { + public findReferences(resource: URI, position: EditorCommon.IPosition, includeDeclaration: boolean): TPromise { return this.contribution.findReferences(resource, position, includeDeclaration); } } @@ -702,7 +702,7 @@ export class ParameterHintsSupport extends AbstractSupport implements Modes.IPar } }); } - public getParameterHints(resource: URL, position: EditorCommon.IPosition): TPromise { + public getParameterHints(resource: URI, position: EditorCommon.IPosition): TPromise { return this.contribution.getParameterHints(resource, position); } } @@ -714,8 +714,8 @@ export interface ISuggestContribution { sortBy?: ISortingTypeAndSeparator[]; - suggest: (resource: URL, position: EditorCommon.IPosition) => TPromise; - getSuggestionDetails? : (resource:URL, position:EditorCommon.IPosition, suggestion:Modes.ISuggestion) => TPromise; + suggest: (resource: URI, position: EditorCommon.IPosition) => TPromise; + getSuggestionDetails? : (resource:URI, position:EditorCommon.IPosition, suggestion:Modes.ISuggestion) => TPromise; } export interface ISortingTypeAndSeparator { @@ -729,8 +729,8 @@ export class SuggestSupport extends AbstractSupport implements Modes.ISuggestSup private sortByType: string[]; private separatorForType: string[]; // Must have identical size to the above - public suggest : (resource:URL, position:EditorCommon.IPosition) => TPromise; - public getSuggestionDetails : (resource:URL, position:EditorCommon.IPosition, suggestion:Modes.ISuggestion) => TPromise; + public suggest : (resource:URI, position:EditorCommon.IPosition) => TPromise; + public getSuggestionDetails : (resource:URI, position:EditorCommon.IPosition, suggestion:Modes.ISuggestion) => TPromise; constructor(mode: Modes.IMode, contribution : ISuggestContribution){ super(mode); @@ -772,11 +772,11 @@ export class SuggestSupport extends AbstractSupport implements Modes.ISuggestSup }); } - public getFilter(): Modes.IFilter { + public getFilter(): Modes.ISuggestionFilter { return DefaultFilter; } - public getSorter(): Modes.ISorter { + public getSorter(): Modes.ISuggestionSorter { return (one, other) => { if (this.sortByType.length > 0) { var oneTypeIndex = this.sortByType.indexOf(one.type); @@ -842,7 +842,7 @@ export class SuggestSupport extends AbstractSupport implements Modes.ISuggestSup } export interface IComposableSuggestContribution extends ISuggestContribution { - composeSuggest(resource:URL, position:EditorCommon.IPosition, superSuggestions:Modes.ISuggestions[]): TPromise; + composeSuggest(resource:URI, position:EditorCommon.IPosition, superSuggestions:Modes.ISuggestResult[]): TPromise; } export class ComposableSuggestSupport extends SuggestSupport { @@ -949,7 +949,7 @@ export var ReplaceSupport: IReplaceSupportHelper = new ReplaceSupportHelperImpl( export interface IInplaceReplaceSupportCustomization { textReplace?: (value: string, up: boolean) => string; - navigateValueSetFallback?: (resource: URL, range: EditorCommon.IRange, up: boolean) => TPromise; + navigateValueSetFallback?: (resource: URI, range: EditorCommon.IRange, up: boolean) => TPromise; } export class AbstractInplaceReplaceSupport implements Modes.IInplaceReplaceSupport { @@ -968,7 +968,7 @@ export class AbstractInplaceReplaceSupport implements Modes.IInplaceReplaceSuppo this.customization = customization; } - public navigateValueSet(resource:URL, range:EditorCommon.IRange, up:boolean):TPromise { + public navigateValueSet(resource:URI, range:EditorCommon.IRange, up:boolean):TPromise { var result = this.doNavigateValueSet(resource, range, up, true); if (result && result.value && result.range) { return TPromise.as(result); @@ -979,7 +979,7 @@ export class AbstractInplaceReplaceSupport implements Modes.IInplaceReplaceSuppo return this.customization.navigateValueSetFallback(resource, range, up); } - private doNavigateValueSet(resource:URL, range:EditorCommon.IRange, up:boolean, selection:boolean):Modes.IInplaceReplaceSupportResult { + private doNavigateValueSet(resource:URI, range:EditorCommon.IRange, up:boolean, selection:boolean):Modes.IInplaceReplaceSupportResult { var model = this.getModel(resource), result:Modes.IInplaceReplaceSupportResult = { range:null, value: null }, @@ -1055,7 +1055,7 @@ export class AbstractInplaceReplaceSupport implements Modes.IInplaceReplaceSuppo || ReplaceSupport.valueSetsReplace(this._defaultValueSet, value, up); } - protected getModel(resource:URL): EditorCommon.ITokenizedModel { + protected getModel(resource:URI): EditorCommon.ITokenizedModel { throw new Error('Not implemented'); } } @@ -1069,7 +1069,7 @@ export class WorkerInplaceReplaceSupport extends AbstractInplaceReplaceSupport { this.resourceService = resourceService; } - protected getModel(resource:URL): EditorCommon.ITokenizedModel { + protected getModel(resource:URI): EditorCommon.ITokenizedModel { return this.resourceService.get(resource); } } @@ -1082,7 +1082,7 @@ export class MainInplaceReplaceSupport extends AbstractInplaceReplaceSupport { this.modelService = modelService; } - protected getModel(resource:URL): EditorCommon.ITokenizedModel { + protected getModel(resource:URI): EditorCommon.ITokenizedModel { return this.modelService.getModel(resource); } } diff --git a/src/vs/editor/common/services/bulkEdit.ts b/src/vs/editor/common/services/bulkEdit.ts index 3033439dd72..e8dd5286e21 100644 --- a/src/vs/editor/common/services/bulkEdit.ts +++ b/src/vs/editor/common/services/bulkEdit.ts @@ -212,7 +212,7 @@ class BulkEditModel { var textEditorModel = model.textEditorModel, task: EditTask; - if (textEditorModel.getAssociatedResource().equals(this._sourceModel)) { + if (textEditorModel.getAssociatedResource().toString() === this._sourceModel.toString()) { this._sourceModelTask = new SourceModelEditTask(textEditorModel, this._sourceSelections); task = this._sourceModelTask; } else { diff --git a/src/vs/editor/common/services/modeServiceImpl.ts b/src/vs/editor/common/services/modeServiceImpl.ts index afbd2763e6d..6de4ab3cb1d 100644 --- a/src/vs/editor/common/services/modeServiceImpl.ts +++ b/src/vs/editor/common/services/modeServiceImpl.ts @@ -190,7 +190,7 @@ export class ModeServiceImpl implements IModeService { var c, e; var promise = new TPromise((cc,ee,pp) => { c = cc; e = ee; }); this._activationPromises[modeId] = promise; - + this._createMode(modeId).then((mode) => { this._instantiatedModes[modeId] = mode; delete this._activationPromises[modeId]; diff --git a/src/vs/editor/common/services/modelService.ts b/src/vs/editor/common/services/modelService.ts index 28f98765657..003bba40ba9 100644 --- a/src/vs/editor/common/services/modelService.ts +++ b/src/vs/editor/common/services/modelService.ts @@ -10,18 +10,15 @@ import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); import {EventProvider} from 'vs/base/common/eventProvider'; import URI from 'vs/base/common/uri'; -import {URL} from 'vs/base/common/network'; export var IModelService = createDecorator('modelService'); export interface IModelService { serviceId: ServiceIdentifier; - createModel(value:string, modeOrPromise:TPromise|Modes.IMode, resource: URL): EditorCommon.IModel; + createModel(value:string, modeOrPromise:TPromise|Modes.IMode, resource: URI): EditorCommon.IModel; - destroyModel(resource: URL): void; - - removeModel(model: EditorCommon.IModel): void; + destroyModel(resource: URI): void; getModels(): EditorCommon.IModel[]; diff --git a/src/vs/editor/common/services/modelServiceImpl.ts b/src/vs/editor/common/services/modelServiceImpl.ts index 3c985effdb7..7eda4db5c65 100644 --- a/src/vs/editor/common/services/modelServiceImpl.ts +++ b/src/vs/editor/common/services/modelServiceImpl.ts @@ -7,7 +7,7 @@ import {IEmitterEvent} from 'vs/base/common/eventEmitter'; import {IModeService} from 'vs/editor/common/services/modeService'; import {IMarker, IMarkerService} from 'vs/platform/markers/common/markers'; -import {MirrorModel} from 'vs/editor/common/model/mirrorModel'; +import {IMirrorModelEvents, MirrorModel} from 'vs/editor/common/model/mirrorModel'; import {Range} from 'vs/editor/common/core/range'; import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); @@ -18,70 +18,85 @@ import {AllWorkersAttr} from 'vs/platform/thread/common/threadService'; import {IHTMLContentElement} from 'vs/base/common/htmlContent'; import {EventSource} from 'vs/base/common/eventSource'; import URI from 'vs/base/common/uri'; -import {URL} from 'vs/base/common/network'; import Severity from 'vs/base/common/severity'; import {EventProvider} from 'vs/base/common/eventProvider'; -import {IDisposable} from 'vs/base/common/lifecycle'; +import {IDisposable, disposeAll} from 'vs/base/common/lifecycle'; import {TPromise} from 'vs/base/common/winjs.base'; import Errors = require('vs/base/common/errors'); import {anonymize} from 'vs/platform/telemetry/common/telemetry'; import {Model} from 'vs/editor/common/model/model'; export interface IRawModelData { - url:URL; + url:URI; versionId:number; value:EditorCommon.IRawText; properties:any; modeId:string; } -class BoundModel implements IDisposable { +function MODEL_ID(resource:URI): string { + return resource.toString(); +} - model:EditorCommon.IModel; - toUnbind:Function; - private _decorationIds: string[]; +class ModelData implements IDisposable { + model: EditorCommon.IModel; + isSyncedToWorkers: boolean; - constructor(model:EditorCommon.IModel) { + private _markerDecorations: string[]; + private _modelEventsListener: IDisposable; + + constructor(model: EditorCommon.IModel, eventsHandler:(modelData:ModelData, events:IEmitterEvent[])=>void) { this.model = model; - this.toUnbind = null; + this.isSyncedToWorkers = false; + + this._markerDecorations = []; + this._modelEventsListener = model.addBulkListener2((events) => eventsHandler(this, events)); } public dispose(): void { - - this._decorationIds = this.model.deltaDecorations(this._decorationIds, []); + this._markerDecorations = this.model.deltaDecorations(this._markerDecorations, []); + this._modelEventsListener.dispose(); + this._modelEventsListener = null; this.model = null; - - if (this.toUnbind) { - this.toUnbind(); - this.toUnbind = null; - } } - public deltaMarkers(markers:IMarker[]):void { + public getModelId(): string { + return MODEL_ID(this.model.getAssociatedResource()); + } + + public acceptMarkerDecorations(newDecorations:EditorCommon.IModelDeltaDecoration[]): void { + this._markerDecorations = this.model.deltaDecorations(this._markerDecorations, newDecorations); + } +} + +class ModelMarkerHandler { + + public static setMarkers(modelData:ModelData, markers:IMarker[]):void { // Limit to the first 500 errors/warnings markers = markers.slice(0, 500); - var newModelDecorations = markers.map(marker => { - return { - range: this._createDecorationRange(marker), + let newModelDecorations:EditorCommon.IModelDeltaDecoration[] = markers.map((marker) => { + return { + range: this._createDecorationRange(modelData.model, marker), options: this._createDecorationOption(marker) }; }); - this._decorationIds = this.model.deltaDecorations(this._decorationIds, newModelDecorations); + + modelData.acceptMarkerDecorations(newModelDecorations); } - private _createDecorationRange(rawMarker: IMarker): EditorCommon.IRange { - var marker = this.model.validateRange(new Range(rawMarker.startLineNumber, rawMarker.startColumn, rawMarker.endLineNumber, rawMarker.endColumn)); - var ret: EditorCommon.IEditorRange = new Range(marker.startLineNumber, marker.startColumn, marker.endLineNumber, marker.endColumn); + private static _createDecorationRange(model:EditorCommon.IModel, rawMarker: IMarker): EditorCommon.IRange { + let marker = model.validateRange(new Range(rawMarker.startLineNumber, rawMarker.startColumn, rawMarker.endLineNumber, rawMarker.endColumn)); + let ret: EditorCommon.IEditorRange = new Range(marker.startLineNumber, marker.startColumn, marker.endLineNumber, marker.endColumn); if (ret.isEmpty()) { - var word = this.model.getWordAtPosition(ret.getStartPosition()); + let word = model.getWordAtPosition(ret.getStartPosition()); if (word) { ret.startColumn = word.startColumn; ret.endColumn = word.endColumn; } else { - var maxColumn = this.model.getLineLastNonWhitespaceColumn(marker.startLineNumber) || - this.model.getLineMaxColumn(marker.startLineNumber); + let maxColumn = model.getLineLastNonWhitespaceColumn(marker.startLineNumber) || + model.getLineMaxColumn(marker.startLineNumber); if (maxColumn === 1) { // empty line @@ -96,7 +111,7 @@ class BoundModel implements IDisposable { } } } else if (rawMarker.endColumn === Number.MAX_VALUE && rawMarker.startColumn === 1 && ret.startLineNumber === ret.endLineNumber) { - var minColumn = this.model.getLineFirstNonWhitespaceColumn(rawMarker.startLineNumber); + let minColumn = model.getLineFirstNonWhitespaceColumn(rawMarker.startLineNumber); if (minColumn < ret.endColumn) { ret.startColumn = minColumn; rawMarker.startColumn = minColumn; @@ -105,7 +120,7 @@ class BoundModel implements IDisposable { return ret; } - private _createDecorationOption(marker:IMarker): EditorCommon.IModelDecorationOptions { + private static _createDecorationOption(marker:IMarker): EditorCommon.IModelDecorationOptions { let className: string; let color: string; @@ -151,14 +166,9 @@ class BoundModel implements IDisposable { } } -export interface IModelsEvents { - [url:string]: any[]; -} - export class ModelServiceImpl implements IModelService { public serviceId = IModelService; - private _models: {[modelId:string]:BoundModel;}; private _markerService: IMarkerService; private _markerServiceSubscription: IDisposable; private _threadService: IThreadService; @@ -167,9 +177,11 @@ export class ModelServiceImpl implements IModelService { private _onModelAdded: EventSource<(model: EditorCommon.IModel) => void>; private _onModelRemoved: EventSource<(model: EditorCommon.IModel) => void>; private _onModelModeChanged: EventSource<(model: EditorCommon.IModel, oldModeId:string) => void>; - private _accumulatedModelEvents: IModelsEvents; - private _lastSentModelEventsTime: number; - private _sendModelEventsTimerId: number; + + /** + * All the models known in the system. + */ + private _models: {[modelId:string]:ModelData;}; constructor(threadService: IThreadService, markerService: IMarkerService) { this._threadService = threadService; @@ -185,137 +197,75 @@ export class ModelServiceImpl implements IModelService { if(this._markerService) { this._markerServiceSubscription = this._markerService.onMarkerChanged(this._handleMarkerChange, this); } - - this._accumulatedModelEvents = {}; - this._lastSentModelEventsTime = -1; - this._sendModelEventsTimerId = -1; } public dispose(): void { if(this._markerServiceSubscription) { this._markerServiceSubscription.dispose(); } - if (this._sendModelEventsTimerId !== -1) { - clearTimeout(this._sendModelEventsTimerId); - this._sendModelEventsTimerId = -1; - } - } - - private _sendModelEvents(url:URL, events:any[]): void { - let modelId = url.toString(); - this._accumulatedModelEvents[modelId] = this._accumulatedModelEvents[modelId] || []; - this._accumulatedModelEvents[modelId] = this._accumulatedModelEvents[modelId].concat(events); - - this._sendModelEventsNow(); - // this._scheduleSendModelEvents(); - } - - // private _scheduleSendModelEvents(): void { - // if (this._sendModelEventsTimerId !== -1) { - // // sending model events already scheduled - // return; - // } - - // let elapsed = Date.now() - this._lastSentModelEventsTime; - // if (elapsed >= 100) { - // // more than 100ms have passed since last model events have been sent => send events now - // this._sendModelEventsNow(); - // } else { - // this._sendModelEventsTimerId = setTimeout(() => { - // this._sendModelEventsTimerId = -1; - // this._sendModelEventsNow(); - // }, 100 - elapsed); - // } - // } - - private _sendModelEventsNow(): void { - this._lastSentModelEventsTime = Date.now(); - - let sendingEvents = this._accumulatedModelEvents; - this._accumulatedModelEvents = {}; - this._workerHelper.$onModelsEvents(sendingEvents); } private _handleMarkerChange(changedResources: URI[]): void { - - changedResources.forEach(resource => { - var boundModel = this._models[resource.toString()]; - if (!boundModel) { + changedResources.forEach((resource) => { + let modelId = MODEL_ID(resource); + let modelData = this._models[modelId]; + if (!modelData) { return; } - boundModel.deltaMarkers(this._markerService.read({ resource: resource, take: 500 })); + ModelMarkerHandler.setMarkers(modelData, this._markerService.read({ resource: resource, take: 500 })); }); } // --- begin IModelService - public createModel(value:string, modeOrPromise:TPromise|Modes.IMode, resource: URL): EditorCommon.IModel { - var model = new Model(value, modeOrPromise, resource); - this.addModel(model); - return model; - } - - public addModel(model:EditorCommon.IModel): void { - var modelId = model.getAssociatedResource().toString(); + private _createModelData(value:string, modeOrPromise:TPromise|Modes.IMode, resource: URI): ModelData { + // create & save the model + let model = new Model(value, modeOrPromise, resource); + let modelId = MODEL_ID(model.getAssociatedResource()); if (this._models[modelId]) { // There already exists a model with this id => this is a programmer error - throw new Error('BoundModels: Cannot add model ' + anonymize(modelId) + ' because it already exists!'); + throw new Error('ModelService: Cannot add model ' + anonymize(modelId) + ' because it already exists!'); } - var boundModel = new BoundModel(model); + let modelData = new ModelData(model, (modelData, events) => this._onModelEvents(modelData, events)); + this._models[modelId] = modelData; - boundModel.toUnbind = model.addBulkListener((events) => this._onModelEvents(modelId, events)); - if(this._markerService) { - boundModel.deltaMarkers(this._markerService.read({ resource: model.getAssociatedResource() })); - } - this._models[modelId] = boundModel; - - // Create model in workers - this._workerHelper.$createModel(ModelServiceImpl._getBoundModelData(model)); - this._onModelAdded.fire(model); + return modelData; } - public removeModel(model:EditorCommon.IModel): void { - var modelId = model.getAssociatedResource().toString(); - - if (this._accumulatedModelEvents[modelId]) { - delete this._accumulatedModelEvents[modelId]; - } - - if (!this._models[modelId]) { - // There is no model with this id => this is a programmer error - throw new Error('BoundModels: Cannot remove model ' + anonymize(modelId) + ' because it doesn\'t exist!'); - } - - // Dispose model in workers - this._workerHelper.$disposeModel(model.getAssociatedResource()); - // this._modelDispose(model.getAssociatedResource()); - this._models[modelId].dispose(); - - delete this._models[modelId]; + public createModel(value:string, modeOrPromise:TPromise|Modes.IMode, resource: URI): EditorCommon.IModel { + let modelData = this._createModelData(value, modeOrPromise, resource); + let modelId = modelData.getModelId(); + // handle markers (marker service => model) if (this._markerService) { - var markers = this._markerService.read({ resource: model.getAssociatedResource() }), - owners: { [o: string]: any } = Object.create(null); - - markers.forEach(marker => owners[marker.owner] = this); - Object.keys(owners).forEach(owner => this._markerService.changeOne(owner, model.getAssociatedResource(), [])); + ModelMarkerHandler.setMarkers(modelData, this._markerService.read({ resource: modelData.model.getAssociatedResource() })); } - this._onModelRemoved.fire(model); + if (!modelData.model.isTooLargeForHavingARichMode()) { + // send this model to the workers + modelData.isSyncedToWorkers = true; + this._workerHelper.$_acceptNewModel(ModelServiceImpl._getBoundModelData(modelData.model)); + } + + this._onModelAdded.fire(modelData.model); + + return modelData.model; } - public destroyModel(resource: URL): void { - let model = this.getModel(resource); - if (model) { - model.destroy(); + public destroyModel(resource: URI): void { + // We need to support that not all models get disposed through this service (i.e. model.dispose() should work!) + let modelData = this._models[MODEL_ID(resource)]; + if (!modelData) { + return; } + modelData.model.dispose(); } public getModels(): EditorCommon.IModel[] { - var ret: EditorCommon.IModel[] = []; - for (var modelId in this._models) { + let ret: EditorCommon.IModel[] = []; + for (let modelId in this._models) { if (this._models.hasOwnProperty(modelId)) { ret.push(this._models[modelId].model); } @@ -323,12 +273,13 @@ export class ModelServiceImpl implements IModelService { return ret; } - public getModel(resource: URL): EditorCommon.IModel { - var boundModel = this._models[resource.toString()]; - if (boundModel) { - return boundModel.model; + public getModel(resource: URI): EditorCommon.IModel { + let modelId = MODEL_ID(resource); + let modelData = this._models[modelId]; + if (!modelData) { + return null; } - return null; + return modelData.model; } public get onModelAdded(): EventProvider<(model:EditorCommon.IModel)=>void> { @@ -345,6 +296,30 @@ export class ModelServiceImpl implements IModelService { // --- end IModelService + private _onModelDisposing(model:EditorCommon.IModel): void { + let modelId = MODEL_ID(model.getAssociatedResource()); + let modelData = this._models[modelId]; + + // TODO@Joh why are we removing markers here? + if (this._markerService) { + var markers = this._markerService.read({ resource: model.getAssociatedResource() }), + owners: { [o: string]: any } = Object.create(null); + + markers.forEach(marker => owners[marker.owner] = this); + Object.keys(owners).forEach(owner => this._markerService.changeOne(owner, model.getAssociatedResource(), [])); + } + + if (modelData.isSyncedToWorkers) { + // Dispose model in workers + this._workerHelper.$_acceptDidDisposeModel(model.getAssociatedResource()); + } + + delete this._models[modelId]; + modelData.dispose(); + + this._onModelRemoved.fire(model); + } + private static _getBoundModelData(model:EditorCommon.IModel): IRawModelData { return { url: model.getAssociatedResource(), @@ -355,67 +330,47 @@ export class ModelServiceImpl implements IModelService { }; } - private _onModelEvents(modelId:string, events:IEmitterEvent[]): void { + private _onModelEvents(modelData:ModelData, events:IEmitterEvent[]): void { + let eventsForWorkers: IMirrorModelEvents = { contentChanged: [], propertiesChanged: null }; - var resultingEvents:any[] = [], - changed = false, - i:number, - len:number; + for (let i = 0, len = events.length; i < len; i++) { + let e = events[i]; + let data = e.getData(); - for (i = 0, len = events.length; i < len; i++) { - var e = events[i]; - var data = e.getData(); switch (e.getType()) { - case EditorCommon.EventType.ModelDispose: - this.removeModel(this._models[modelId].model); + this._onModelDisposing(modelData.model); + // no more event processing return; case EditorCommon.EventType.ModelContentChanged: - switch (data.changeType) { - case EditorCommon.EventType.ModelContentChangedFlush: - resultingEvents.push(this._mixinProperties({ type: e.getType() }, data, ['changeType', 'detail', 'versionId'])); - break; - - case EditorCommon.EventType.ModelContentChangedLinesDeleted: - resultingEvents.push(this._mixinProperties({ type: e.getType() }, data, ['changeType', 'fromLineNumber', 'toLineNumber', 'versionId'])); - break; - - case EditorCommon.EventType.ModelContentChangedLinesInserted: - resultingEvents.push(this._mixinProperties({ type: e.getType() }, data, ['changeType', 'fromLineNumber', 'toLineNumber', 'detail', 'versionId'])); - break; - - case EditorCommon.EventType.ModelContentChangedLineChanged: - resultingEvents.push(this._mixinProperties({ type: e.getType() }, data, ['changeType', 'lineNumber', 'detail', 'versionId'])); - break; + if (modelData.isSyncedToWorkers) { + eventsForWorkers.contentChanged.push(data); } - changed = true; break; case EditorCommon.EventType.ModelPropertiesChanged: - resultingEvents.push(this._mixinProperties({ type: e.getType() }, data, ['properties'])); + if (modelData.isSyncedToWorkers) { + eventsForWorkers.propertiesChanged = data; + } break; case EditorCommon.EventType.ModelModeChanged: let modeChangedEvent = data; - this._workerHelper.$onModelModeChanged(modelId, modeChangedEvent.oldMode.getId(), modeChangedEvent.newMode.getId()); - this._onModelModeChanged.fire(this._models[modelId].model, modeChangedEvent.oldMode.getId()); + if (modelData.isSyncedToWorkers) { + // Forward mode change to all the workers + this._workerHelper.$_acceptDidChangeModelMode(modelData.getModelId(), modeChangedEvent.oldMode.getId(), modeChangedEvent.newMode.getId()); + } + this._onModelModeChanged.fire(modelData.model, modeChangedEvent.oldMode.getId()); break; } } - if (resultingEvents.length > 0) { + if (eventsForWorkers.contentChanged.length > 0 || eventsForWorkers.propertiesChanged) { // Forward events to all the workers - this._sendModelEvents(this._models[modelId].model.getAssociatedResource(), resultingEvents); + this._workerHelper.$_acceptModelEvents(modelData.getModelId(), eventsForWorkers); } } - - private _mixinProperties(dst:any, src:any, properties:string[]): any { - for (var i = 0; i < properties.length; i++) { - dst[properties[i]] = src[properties[i]]; - } - return dst; - } } @Remotable.WorkerContext('ModelServiceWorkerHelper', ThreadAffinity.All) @@ -432,9 +387,9 @@ export class ModelServiceWorkerHelper { this._modeService = modeService; } - public $createModel(data:IRawModelData): TPromise { + public $_acceptNewModel(data:IRawModelData): TPromise { // Create & insert the mirror model eagerly in the resource service - var mirrorModel = new MirrorModel(this._resourceService, data.versionId, data.value, null, data.url, data.properties); + let mirrorModel = new MirrorModel(this._resourceService, data.versionId, data.value, null, data.url, data.properties); this._resourceService.insert(mirrorModel.getAssociatedResource(), mirrorModel); // Block worker execution until the mode is instantiated @@ -452,8 +407,8 @@ export class ModelServiceWorkerHelper { }); } - public $onModelModeChanged(modelId:string, oldModeId:string, newModeId:string): TPromise { - var mirrorModel = this._resourceService.get(URI.parse(modelId)); + public $_acceptDidChangeModelMode(modelId:string, oldModeId:string, newModeId:string): TPromise { + let mirrorModel = this._resourceService.get(URI.parse(modelId)); // Block worker execution until the mode is instantiated return this._modeService.getOrCreateMode(newModeId).then((mode) => { @@ -470,31 +425,23 @@ export class ModelServiceWorkerHelper { }); } - public $disposeModel(url:URL): void { - var model = this._resourceService.get(url); + public $_acceptDidDisposeModel(url:URI): void { + let model = this._resourceService.get(url); this._resourceService.remove(url); if (model) { model.dispose(); } } - public $onModelsEvents(events:IModelsEvents): void { - let missingModels: string[] = []; - Object.keys(events).forEach((strURL:string) => { - var model = this._resourceService.get(new URL(strURL)); - if (!model) { - missingModels.push(strURL); - return; - } - try { - model.onEvents(events[strURL]); - } catch (err) { - Errors.onUnexpectedError(err); - } - }); - - if (missingModels.length > 0) { - throw new Error('Received model events for missing models ' + missingModels.map(anonymize).join(' AND ')); + public $_acceptModelEvents(modelId: string, events:IMirrorModelEvents): void { + let model = this._resourceService.get(URI.parse(modelId)); + if (!model) { + throw new Error('Received model events for missing model ' + anonymize(modelId)); + } + try { + model.onEvents(events); + } catch (err) { + Errors.onUnexpectedError(err); } } } diff --git a/src/vs/editor/common/services/resourceService.ts b/src/vs/editor/common/services/resourceService.ts index 37e09dbe24d..003c5e7ea21 100644 --- a/src/vs/editor/common/services/resourceService.ts +++ b/src/vs/editor/common/services/resourceService.ts @@ -9,7 +9,6 @@ import {ListenerUnbind, ListenerCallback, IEventEmitter, IEmitterEvent} from 'vs import EditorCommon = require('vs/editor/common/editorCommon'); import {EventProvider} from 'vs/base/common/eventProvider'; import URI from 'vs/base/common/uri'; -import {URL} from 'vs/base/common/network'; import {IDisposable} from 'vs/base/common/lifecycle'; // Resource Service @@ -21,17 +20,17 @@ export var ResourceEvents = { }; export interface IResourceAddedEvent { - url: URL; + url: URI; addedElement: EditorCommon.IMirrorModel; } export interface IResourceRemovedEvent { - url: URL; + url: URI; removedElement: EditorCommon.IMirrorModel; } export interface IResourceChangedEvent { - url: URL; + url: URI; originalEvents: IEmitterEvent[]; } diff --git a/src/vs/editor/common/services/resourceServiceImpl.ts b/src/vs/editor/common/services/resourceServiceImpl.ts index 0efdee0d0ae..a21cfae7d81 100644 --- a/src/vs/editor/common/services/resourceServiceImpl.ts +++ b/src/vs/editor/common/services/resourceServiceImpl.ts @@ -7,8 +7,8 @@ import {EventEmitter, IEmitterEvent, ListenerUnbind, ListenerCallback} from 'vs/base/common/eventEmitter'; import EditorCommon = require('vs/editor/common/editorCommon'); import {IResourceService, ResourceEvents, IResourceChangedEvent, IResourceAddedEvent, IResourceRemovedEvent} from 'vs/editor/common/services/resourceService'; -import {URL} from 'vs/base/common/network'; import {IDisposable} from 'vs/base/common/lifecycle'; +import URI from 'vs/base/common/uri'; export class ResourceService extends EventEmitter implements IResourceService { public serviceId = IResourceService; @@ -50,7 +50,7 @@ export class ResourceService extends EventEmitter implements IResourceService { return r; } - public insert(url:URL, element:EditorCommon.IMirrorModel): void { + public insert(url:URI, element:EditorCommon.IMirrorModel): void { // console.log('INSERT: ' + url.toString()); if (this.contains(url)) { // There already exists a model with this id => this is a programmer error @@ -69,7 +69,7 @@ export class ResourceService extends EventEmitter implements IResourceService { this.emit(ResourceEvents.ADDED, { url: url, addedElement: element }); } - public get(url:URL):EditorCommon.IMirrorModel { + public get(url:URI):EditorCommon.IMirrorModel { if(!this.data[url.toString()]) { return null; } @@ -82,11 +82,11 @@ export class ResourceService extends EventEmitter implements IResourceService { }); } - public contains(url:URL):boolean { + public contains(url:URI):boolean { return !!this.data[url.toString()]; } - public remove(url:URL):void { + public remove(url:URI):void { // console.log('REMOVE: ' + url.toString()); if(!this.contains(url)) { return; diff --git a/src/vs/editor/common/viewModel/prefixSumComputer.ts b/src/vs/editor/common/viewModel/prefixSumComputer.ts index 986e35fcd9d..a43856fae48 100644 --- a/src/vs/editor/common/viewModel/prefixSumComputer.ts +++ b/src/vs/editor/common/viewModel/prefixSumComputer.ts @@ -10,22 +10,22 @@ export interface IPrefixSumIndexOfResult { } export class PrefixSumComputer { - + /** * values[i] is the value at index i */ private values:number[]; - + /** * prefixSum[i] = SUM(heights[j]), 0 <= j <= i */ private prefixSum:number[]; - + /** * prefixSum[i], 0 <= i <= prefixSumValidIndex can be trusted */ private prefixSumValidIndex:number; - + constructor(values:number[]) { this.values = values; this.prefixSum = []; @@ -34,11 +34,11 @@ export class PrefixSumComputer { } this.prefixSumValidIndex = -1; } - + public getCount(): number { return this.values.length; } - + public insertValue(insertIndex:number, value:number): void { this.values.splice(insertIndex, 0, value); this.prefixSum.splice(insertIndex, 0, 0); @@ -46,20 +46,20 @@ export class PrefixSumComputer { this.prefixSumValidIndex = insertIndex - 1; } } - + public insertValues(insertIndex: number, values: number[]): void { if (values.length === 0) { return; } - + this.values = this.values.slice(0, insertIndex).concat(values).concat(this.values.slice(insertIndex)); this.prefixSum = this.prefixSum.slice(0, insertIndex).concat(PrefixSumComputer._zeroArray(values.length)).concat(this.prefixSum.slice(insertIndex)); - + if (insertIndex - 1 < this.prefixSumValidIndex) { this.prefixSumValidIndex = insertIndex - 1; } } - + private static _zeroArray(count: number): number[] { var r: number[] = new Array(count); for (var i = 0; i < count; i++) { @@ -67,7 +67,7 @@ export class PrefixSumComputer { } return r; } - + public changeValue(index:number, value:number): void { if (this.values[index] === value) { return; @@ -77,7 +77,7 @@ export class PrefixSumComputer { this.prefixSumValidIndex = index - 1; } } - + public removeValues(startIndex:number, cnt:number): void { this.values.splice(startIndex, cnt); this.prefixSum.splice(startIndex, cnt); @@ -85,14 +85,14 @@ export class PrefixSumComputer { this.prefixSumValidIndex = startIndex - 1; } } - + public getTotalValue(): number { if (this.values.length === 0) { return 0; } return this.getAccumulatedValue(this.values.length - 1); } - + public getAccumulatedValue(index:number): number { if (index < 0) { return 0; @@ -100,37 +100,37 @@ export class PrefixSumComputer { if (index <= this.prefixSumValidIndex) { return this.prefixSum[index]; } - + var startIndex = this.prefixSumValidIndex + 1; if (startIndex === 0) { this.prefixSum[0] = this.values[0]; startIndex++; } - + if (index >= this.values.length) { index = this.values.length - 1; } - + for (var i = startIndex; i <= index; i++) { this.prefixSum[i] = this.prefixSum[i - 1] + this.values[i]; } this.prefixSumValidIndex = Math.max(this.prefixSumValidIndex, index); return this.prefixSum[index]; } - + public getIndexOf(accumulatedValue:number, result:IPrefixSumIndexOfResult): void { var low = 0, high = this.values.length - 1, mid:number, midStart:number, midStop:number; - + while (low <= high) { mid = low + ( (high-low)/2 ) | 0; - + midStop = this.getAccumulatedValue(mid); midStart = midStop - this.values[mid]; - + if (accumulatedValue < midStart) { high = mid - 1; } else if (accumulatedValue >= midStop) { diff --git a/src/vs/editor/common/worker/validationHelper.ts b/src/vs/editor/common/worker/validationHelper.ts index 65eeacb0064..7bed70376c9 100644 --- a/src/vs/editor/common/worker/validationHelper.ts +++ b/src/vs/editor/common/worker/validationHelper.ts @@ -8,7 +8,7 @@ import {IEmitterEvent} from 'vs/base/common/eventEmitter'; import EditorCommon = require('vs/editor/common/editorCommon'); import {IResourceService, ResourceEvents, IResourceAddedEvent, IResourceRemovedEvent} from 'vs/editor/common/services/resourceService'; import {RunOnceScheduler} from 'vs/base/common/async'; -import {URL} from 'vs/base/common/network'; +import URI from 'vs/base/common/uri'; import {IDisposable, disposeAll} from 'vs/base/common/lifecycle'; export interface IValidationHelperFilter { @@ -16,7 +16,7 @@ export interface IValidationHelperFilter { } export interface IValidationHelperCallback { - (changed:URL[], notChanged:URL[], isDueToConfigurationChange:boolean): void; + (changed:URI[], notChanged:URI[], isDueToConfigurationChange:boolean): void; } class ValidationModel implements IDisposable { @@ -163,8 +163,8 @@ export class ValidationHelper implements IDisposable { return; } - var dirtyModels: URL[] = []; - var cleanModels: URL[] = []; + var dirtyModels: URI[] = []; + var cleanModels: URI[] = []; Object.keys(this._models) .map((modelUrl) => this._models[modelUrl]) diff --git a/src/vs/editor/contrib/codelens/browser/codelens.ts b/src/vs/editor/contrib/codelens/browser/codelens.ts index 84585d921fb..711c5883254 100644 --- a/src/vs/editor/contrib/codelens/browser/codelens.ts +++ b/src/vs/editor/contrib/codelens/browser/codelens.ts @@ -11,6 +11,7 @@ import nls = require('vs/nls'); import {format} from 'vs/base/common/strings'; import lifecycle = require('vs/base/common/lifecycle'); import schedulers = require('vs/base/common/async'); +import Severity from 'vs/base/common/severity'; import dom = require('vs/base/browser/dom'); import errors = require('vs/base/common/errors'); import EditorBrowser = require('vs/editor/browser/editorBrowser'); @@ -21,13 +22,10 @@ import referenceSearch = require('vs/editor/contrib/referenceSearch/browser/refe import {IModelService} from 'vs/editor/common/services/modelService'; import {IConfigurationService} from 'vs/platform/configuration/common/configuration'; import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService'; +import {IMessageService} from 'vs/platform/message/common/message'; import {Range} from 'vs/editor/common/core/range'; -import {CodeLensRegistry} from '../common/codelens'; +import {CodeLensRegistry, ICodeLensData, getCodeLensData} from '../common/codelens'; -interface ICodeLensData { - symbol: Modes.ICodeLensSymbol; - support: Modes.ICodeLensSupport; -} class CodeLensViewZone implements EditorBrowser.IViewZone { @@ -65,7 +63,7 @@ class CodeLensContentWidget implements EditorBrowser.IContentWidget { private _commands: { [id: string]: Modes.ICommand } = Object.create(null); public constructor(editor: EditorBrowser.ICodeEditor, symbolRange: EditorCommon.IEditorRange, - keybindingService: IKeybindingService) { + keybindingService: IKeybindingService, messageService: IMessageService) { this._id = 'codeLensWidget' + (++CodeLensContentWidget.ID); this._editor = editor; @@ -83,7 +81,9 @@ class CodeLensContentWidget implements EditorBrowser.IContentWidget { let command = this._commands[element.id]; if (command) { editor.focus(); - keybindingService.executeCommand(command.id, command.arguments); + keybindingService.executeCommand(command.id, command.arguments).done(undefined, err => { + messageService.show(Severity.Error, err); + }); } } }); @@ -103,16 +103,16 @@ class CodeLensContentWidget implements EditorBrowser.IContentWidget { } } - public withCommands(commands: Modes.ICommand[]): void { + public withCommands(symbols: Modes.ICodeLensSymbol[]): void { this._commands = Object.create(null); - if (!commands || !commands.length) { + if (!symbols || !symbols.length) { this._domNode.innerHTML = 'no commands'; return; } let html: string[] = []; - for (let i = 0; i < commands.length; i++) { - let command = commands[i]; + for (let i = 0; i < symbols.length; i++) { + let command = symbols[i].command; let part: string; if (command.id) { part = format('{1}', i, command.title); @@ -230,7 +230,7 @@ class CodeLens { public constructor(data: ICodeLensData[], editor: EditorBrowser.ICodeEditor, helper: CodeLensHelper, viewZoneChangeAccessor: EditorBrowser.IViewZoneChangeAccessor, - keybindingService: IKeybindingService) { + keybindingService: IKeybindingService, messageService: IMessageService) { this._editor = editor; this._data = data; @@ -255,7 +255,7 @@ class CodeLens { }); this._viewZone = new CodeLensViewZone(range.startLineNumber - 1); - this._contentWidget = new CodeLensContentWidget(editor, Range.lift(range), keybindingService); + this._contentWidget = new CodeLensContentWidget(editor, Range.lift(range), keybindingService, messageService); this._viewZoneId = viewZoneChangeAccessor.addZone(this._viewZone); this._editor.addContentWidget(this._contentWidget); @@ -303,8 +303,8 @@ class CodeLens { return this._data; } - public updateCommands(commands: Modes.ICommand[], currentModelsVersionId: number): void { - this._contentWidget.withCommands(commands); + public updateCommands(symbols: Modes.ICodeLensSymbol[], currentModelsVersionId: number): void { + this._contentWidget.withCommands(symbols); this._lastUpdateModelsVersionId = currentModelsVersionId; } @@ -347,19 +347,22 @@ export class CodeLensContribution implements EditorCommon.IEditorContribution { private _modelChangeCounter: number; private _configurationService: IConfigurationService; private _keybindingService: IKeybindingService; + private _messageService: IMessageService; private _codeLenseDisabledByMode: boolean; private _currentFindOccPromise:TPromise; constructor(editor: EditorBrowser.ICodeEditor, @IModelService modelService: IModelService, @IConfigurationService configurationService: IConfigurationService, - @IKeybindingService keybindingService: IKeybindingService) { + @IKeybindingService keybindingService: IKeybindingService, + @IMessageService messageService: IMessageService) { this._instanceCount = (++CodeLensContribution.INSTANCE_COUNT); this._editor = editor; this._modelService = modelService; this._configurationService = configurationService; this._keybindingService = keybindingService; + this._messageService = messageService; this._globalToDispose = []; this._localToDispose = []; @@ -428,22 +431,7 @@ export class CodeLensContribution implements EditorCommon.IEditorContribution { this._currentFindCodeLensSymbolsPromise.cancel(); } - let resource = model.getAssociatedResource(); - let symbols: ICodeLensData[] = []; - let promises = CodeLensRegistry.all(model).map(support => { - return support.findCodeLensSymbols(resource).then(result => { - if (!Array.isArray(result)) { - return; - } - for (let symbol of result) { - symbols.push({ symbol, support }); - } - }, err => { - errors.onUnexpectedError(err); - }); - }); - - this._currentFindCodeLensSymbolsPromise = TPromise.join(promises).then(() => symbols); + this._currentFindCodeLensSymbolsPromise = getCodeLensData(model); var counterValue = ++this._modelChangeCounter; this._currentFindCodeLensSymbolsPromise.then((result) => { @@ -572,7 +560,7 @@ export class CodeLensContribution implements EditorCommon.IEditorContribution { groupsIndex++; codeLensIndex++; } else { - this._lenses.splice(codeLensIndex, 0, new CodeLens(groups[groupsIndex], this._editor, helper, accessor, this._keybindingService)); + this._lenses.splice(codeLensIndex, 0, new CodeLens(groups[groupsIndex], this._editor, helper, accessor, this._keybindingService, this._messageService)); codeLensIndex++; groupsIndex++; } @@ -586,7 +574,7 @@ export class CodeLensContribution implements EditorCommon.IEditorContribution { // Create extra symbols while (groupsIndex < groups.length) { - this._lenses.push(new CodeLens(groups[groupsIndex], this._editor, helper, accessor, this._keybindingService)); + this._lenses.push(new CodeLens(groups[groupsIndex], this._editor, helper, accessor, this._keybindingService, this._messageService)); groupsIndex++; } @@ -628,17 +616,15 @@ export class CodeLensContribution implements EditorCommon.IEditorContribution { var resource = model.getAssociatedResource(); var promises = toResolve.map((request, i) => { - let commands = new Array(request.length); + let resolvedSymbols = new Array(request.length); let promises = request.map((request, i) => { - return request.support.resolveCodeLensSymbol(resource, request.symbol).then(command => { - if (command) { - commands[i] = command; - } + return request.support.resolveCodeLensSymbol(resource, request.symbol).then(symbol => { + resolvedSymbols[i] = symbol; }); }); return TPromise.join(promises).then(() => { - lenses[i].updateCommands(commands, currentModelsVersionId); + lenses[i].updateCommands(resolvedSymbols, currentModelsVersionId); }) }); diff --git a/src/vs/editor/contrib/codelens/common/codelens.ts b/src/vs/editor/contrib/codelens/common/codelens.ts index cf84481f124..09dda5ea9c4 100644 --- a/src/vs/editor/contrib/codelens/common/codelens.ts +++ b/src/vs/editor/contrib/codelens/common/codelens.ts @@ -5,14 +5,54 @@ 'use strict'; +import {onUnexpectedError, illegalArgument} from 'vs/base/common/errors'; import URI from 'vs/base/common/uri'; import {IAction, Action} from 'vs/base/common/actions'; +import {IModelService} from 'vs/editor/common/services/modelService'; import {TPromise} from 'vs/base/common/winjs.base'; -import {IRange, IPosition} from 'vs/editor/common/editorCommon'; +import {IModel, IRange, IPosition} from 'vs/editor/common/editorCommon'; import {Range} from 'vs/editor/common/core/range'; import {ICodeLensSupport, ICodeLensSymbol, ICommand} from 'vs/editor/common/modes'; +import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions'; import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; -const _registry = new LanguageFeatureRegistry('codeLensSupport'); +export const CodeLensRegistry = new LanguageFeatureRegistry('codeLensSupport'); -export {_registry as CodeLensRegistry} +export interface ICodeLensData { + symbol: ICodeLensSymbol; + support: ICodeLensSupport; +} + +export function getCodeLensData(model: IModel):TPromise { + + const symbols: ICodeLensData[] = []; + const promises = CodeLensRegistry.all(model).map(support => { + return support.findCodeLensSymbols(model.getAssociatedResource()).then(result => { + if (!Array.isArray(result)) { + return; + } + for (let symbol of result) { + symbols.push({ symbol, support }); + } + }, err => { + onUnexpectedError(err); + }); + }); + + return TPromise.join(promises).then(() => symbols); +} + +CommonEditorRegistry.registerLanguageCommand('_executeCodeLensProvider', function(accessor, args) { + + const {resource} = args; + if (!URI.isURI(resource)) { + throw illegalArgument(); + } + + const model = accessor.get(IModelService).getModel(resource); + if (!model) { + throw illegalArgument(); + } + + return getCodeLensData(model); +}); \ No newline at end of file diff --git a/src/vs/editor/contrib/comment/common/lineCommentCommand.ts b/src/vs/editor/contrib/comment/common/lineCommentCommand.ts index 3b591d5a045..714eecbacd2 100644 --- a/src/vs/editor/contrib/comment/common/lineCommentCommand.ts +++ b/src/vs/editor/contrib/comment/common/lineCommentCommand.ts @@ -104,7 +104,7 @@ export class LineCommentCommand implements EditorCommon.ICommand { /** * Analyze lines and decide which lines are relevant and what the toggle should do. - * Also, build up several offsets and lengths usefull in the generation of editor operations. + * Also, build up several offsets and lengths useful in the generation of editor operations. */ public static _analyzeLines(type:Type, model:ISimpleModel, lines:ILinePreflightData[], startLineNumber:number): IPreflightData { var lineData: ILinePreflightData, @@ -206,7 +206,7 @@ export class LineCommentCommand implements EditorCommon.ICommand { } /** - * Given a succesfull analysis, execute either insert line comments, either remove line comments + * Given a successful analysis, execute either insert line comments, either remove line comments */ private _executeLineComments(model:ISimpleModel, builder:EditorCommon.IEditOperationBuilder, data:IPreflightData, s:EditorCommon.IEditorSelection): void { @@ -267,7 +267,7 @@ export class LineCommentCommand implements EditorCommon.ICommand { } /** - * Given an unsuccesfull analysis, delegate to the block comment command + * Given an unsuccessful analysis, delegate to the block comment command */ private _executeBlockComment(model:EditorCommon.ITokenizedModel, builder:EditorCommon.IEditOperationBuilder, s:EditorCommon.IEditorSelection): void { var commentsSupport = model.getModeAtPosition(s.startLineNumber, s.startColumn).commentsSupport; diff --git a/src/vs/editor/contrib/contextmenu/browser/contextmenu.ts b/src/vs/editor/contrib/contextmenu/browser/contextmenu.ts index c4c0389241e..860bf0f7661 100644 --- a/src/vs/editor/contrib/contextmenu/browser/contextmenu.ts +++ b/src/vs/editor/contrib/contextmenu/browser/contextmenu.ts @@ -205,7 +205,7 @@ class ContextMenuController implements EditorCommon.IEditorContribution { getActionItem: (action) => { var keybinding = this._keybindingFor(action); if (keybinding) { - return new ActionBar.ActionItem(action, action, { label: true, keybinding: keybinding.toLabel() }); + return new ActionBar.ActionItem(action, action, { label: true, keybinding: this.keybindingService.getLabelFor(keybinding) }); } var customActionItem = action; diff --git a/src/vs/editor/contrib/defineKeybinding/browser/defineKeybinding.css b/src/vs/editor/contrib/defineKeybinding/browser/defineKeybinding.css new file mode 100644 index 00000000000..5c8e9edb53e --- /dev/null +++ b/src/vs/editor/contrib/defineKeybinding/browser/defineKeybinding.css @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +.monaco-editor .defineKeybindingLauncher { + font-family: 'Segoe WPC', 'Segoe UI', "SFUIText-Light", HelveticaNeue-Light, sans-serif, "Droid Sans Fallback"; + background: rgba(0,255,0,0.3); + padding: 10px; + border-radius: 5px; + cursor: pointer; +} + +.monaco-editor .defineKeybindingWidget { + font-family: 'Segoe WPC', 'Segoe UI', "SFUIText-Light", HelveticaNeue-Light, sans-serif, "Droid Sans Fallback"; + width: 340px; + height: 60px; + padding: 10px; +} + +.monaco-editor .defineKeybindingWidget .message { + width: 320px; + text-align: center; +} + +.monaco-editor .defineKeybindingWidget .input { + margin-top:10px; + width: 320px; + display: block; + text-align: center; +} + +/* Theming */ +.monaco-editor .defineKeybindingWidget { + background-color: #EFEFF2; + box-shadow: 0 2px 8px #A8A8A8; +} + +.monaco-editor.vs-dark .defineKeybindingWidget { + background-color: #2D2D30; + box-shadow: 0 2px 8px #000; +} \ No newline at end of file diff --git a/src/vs/editor/contrib/defineKeybinding/browser/defineKeybinding.ts b/src/vs/editor/contrib/defineKeybinding/browser/defineKeybinding.ts new file mode 100644 index 00000000000..8df557eb7de --- /dev/null +++ b/src/vs/editor/contrib/defineKeybinding/browser/defineKeybinding.ts @@ -0,0 +1,297 @@ +/*--------------------------------------------------------------------------------------------- + * 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 'vs/css!./defineKeybinding'; +import nls = require('vs/nls'); +import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions'; +import DomUtils = require('vs/base/browser/dom'); +import EditorBrowser = require('vs/editor/browser/editorBrowser'); +import EditorCommon = require('vs/editor/common/editorCommon'); +import {disposeAll, IDisposable} from 'vs/base/common/lifecycle'; +import {INullService} from 'vs/platform/instantiation/common/instantiation'; +import {StandardKeyboardEvent} from 'vs/base/browser/keyboardEvent'; +import {KeyMod, KeyCode, CommonKeybindings, Keybinding} from 'vs/base/common/keyCodes'; +import Snippet = require('vs/editor/contrib/snippet/common/snippet'); +import {EditorAction, Behaviour} from 'vs/editor/common/editorAction'; +import {CommonEditorRegistry, ContextKey, EditorActionDescriptor} from 'vs/editor/common/editorCommonExtensions'; +import {TPromise} from 'vs/base/common/winjs.base'; +import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService'; + +const NLS_LAUNCH_MESSAGE = nls.localize('defineKeybinding.start', "Define Keybinding"); +const NLS_DEFINE_MESSAGE = nls.localize('defineKeybinding.initial', "Press desired key combination and ENTER"); +const NLS_DEFINE_ACTION_LABEL = nls.localize('DefineKeybindingAction',"Define Keybinding"); + +export class DefineKeybindingController implements EditorCommon.IEditorContribution { + + static ID = 'editor.contrib.defineKeybinding'; + + static get(editor:EditorCommon.ICommonCodeEditor): DefineKeybindingController { + return editor.getContribution(DefineKeybindingController.ID); + } + + private _editor: EditorBrowser.ICodeEditor; + private _launchWidget: DefineKeybindingLauncherWidget; + private _defineWidget: DefineKeybindingWidget; + private _toDispose: IDisposable[]; + + constructor( + editor:EditorBrowser.ICodeEditor, + @IKeybindingService keybindingService:IKeybindingService + ) { + this._editor = editor; + this._toDispose = []; + this._launchWidget = new DefineKeybindingLauncherWidget(this._editor, keybindingService, () => this.launch()); + this._defineWidget = new DefineKeybindingWidget(this._editor, (keybinding) => this._onAccepted(keybinding)); + + this._toDispose.push(this._editor.addListener2(EditorCommon.EventType.ModelChanged, (e) => { + if (isInterestingEditorModel(this._editor)) { + this._launchWidget.show(); + } else { + this._launchWidget.hide(); + } + })); + } + + public getId(): string { + return DefineKeybindingController.ID; + } + + public dispose(): void { + this._toDispose = disposeAll(this._toDispose); + this._launchWidget.dispose(); + this._launchWidget = null; + this._defineWidget.dispose(); + this._defineWidget = null; + } + + public launch(): void { + if (isInterestingEditorModel(this._editor)) { + this._defineWidget.start(); + } + } + + private _onAccepted(keybinding:string): void { + let snippetText = [ + '{', + '\t"key": "' + keybinding + '",', + '\t"command": "{{commandId}}",', + '\t"when": "{{editorTextFocus}}"', + '}{{}}' + ].join('\n'); + + Snippet.get(this._editor).run(new Snippet.CodeSnippet(snippetText), 0, 0); + } +} + +class DefineKeybindingLauncherWidget implements EditorBrowser.IOverlayWidget { + + private static ID = 'editor.contrib.defineKeybindingLauncherWidget'; + + private _editor: EditorBrowser.ICodeEditor; + + private _domNode: HTMLElement; + private _toDispose: IDisposable[]; + + constructor(editor:EditorBrowser.ICodeEditor, keybindingService:IKeybindingService, onLaunch:()=>void) { + this._editor = editor; + this._domNode = document.createElement('div'); + this._domNode.className = 'defineKeybindingLauncher'; + this._domNode.style.display = 'none'; + let keybinding = keybindingService.lookupKeybindings(DefineKeybindingAction.ID); + let extra = ''; + if (keybinding.length > 0) { + extra += ' ('+keybindingService.getLabelFor(keybinding[0])+')'; + } + this._domNode.appendChild(document.createTextNode(NLS_LAUNCH_MESSAGE + extra)); + + this._toDispose = []; + this._toDispose.push(DomUtils.addDisposableListener(this._domNode, 'click', (e) => { + onLaunch(); + })) + + this._editor.addOverlayWidget(this); + } + + public dispose(): void { + this._editor.removeOverlayWidget(this); + this._toDispose = disposeAll(this._toDispose); + } + + public show(): void { + this._domNode.style.display = 'block'; + } + + public hide(): void { + this._domNode.style.display = 'none'; + } + + // ----- IOverlayWidget API + + public getId(): string { + return DefineKeybindingLauncherWidget.ID; + } + + public getDomNode(): HTMLElement { + return this._domNode; + } + + public getPosition(): EditorBrowser.IOverlayWidgetPosition { + return { + preference: EditorBrowser.OverlayWidgetPositionPreference.BOTTOM_RIGHT_CORNER + }; + } +} + +class DefineKeybindingWidget implements EditorBrowser.IContentWidget { + + private static ID = 'editor.contrib.defineKeybindingWidget'; + + private _editor: EditorBrowser.ICodeEditor; + + private _domNode: HTMLElement; + private _toDispose: IDisposable[]; + private _position: EditorCommon.IPosition; + + private _messageNode: HTMLElement; + private _inputNode: HTMLInputElement; + + private _lastKeybinding: Keybinding; + private _onAccepted: (keybinding:string) => void; + + constructor(editor:EditorBrowser.ICodeEditor, onAccepted:(keybinding:string) => void) { + this._editor = editor; + this._onAccepted = onAccepted; + this._toDispose = []; + this._position = null; + this._lastKeybinding = null; + + this._domNode = document.createElement('div'); + this._domNode.className = 'defineKeybindingWidget'; + + this._messageNode = document.createElement('div'); + this._messageNode.className = 'message'; + this._messageNode.innerText = NLS_DEFINE_MESSAGE; + this._domNode.appendChild(this._messageNode); + + this._inputNode = document.createElement('input'); + this._inputNode.className = 'input'; + this._domNode.appendChild(this._inputNode); + + this._toDispose.push(DomUtils.addDisposableListener(this._inputNode, 'keydown', (e) => { + let keyEvent = new StandardKeyboardEvent(e); + keyEvent.preventDefault(); + keyEvent.stopPropagation(); + + let kb = new Keybinding(keyEvent.asKeybinding()); + switch (kb.value) { + case CommonKeybindings.ENTER: + if (this._lastKeybinding) { + this._onAccepted(this._lastKeybinding.toUserSettingsLabel()); + } + this._stop(); + return; + + case CommonKeybindings.ESCAPE: + this._stop(); + return; + } + + this._lastKeybinding = kb; + + this._inputNode.value = this._lastKeybinding.toUserSettingsLabel().toLowerCase(); + this._inputNode.title = 'keyCode: ' + keyEvent.browserEvent.keyCode; + })); + + this._toDispose.push(DomUtils.addDisposableListener(this._inputNode, 'blur', (e) => this._stop())); + + this._editor.addContentWidget(this); + } + + public dispose(): void { + this._editor.removeContentWidget(this); + this._toDispose = disposeAll(this._toDispose); + } + + public getId(): string { + return DefineKeybindingWidget.ID; + } + + public getDomNode(): HTMLElement { + return this._domNode; + } + + public getPosition(): EditorBrowser.IContentWidgetPosition { + if (!this._position) { + return null; + } + return { + position: this._position, + preference: [EditorBrowser.ContentWidgetPositionPreference.BELOW] + }; + } + + public start(): void { + this._position = this._editor.getPosition(); + this._editor.revealPositionInCenterIfOutsideViewport(this._position); + this._editor.layoutContentWidget(this); + + // Force a view render + this._editor.getOffsetForColumn(this._position.lineNumber, this._position.column); + + this._lastKeybinding = null; + this._inputNode.value = ''; + this._inputNode.focus(); + } + + private _stop(): void { + this._editor.focus(); + this._position = null; + this._editor.layoutContentWidget(this); + } +} + +export class DefineKeybindingAction extends EditorAction { + + static ID = 'editor.action.defineKeybinding'; + + constructor(descriptor:EditorCommon.IEditorActionDescriptorData, editor:EditorCommon.ICommonCodeEditor, @INullService ns) { + super(descriptor, editor, Behaviour.WidgetFocus | Behaviour.UpdateOnModelChange | Behaviour.Writeable); + } + + public isSupported(): boolean { + if (!super.isSupported()) { + return false; + } + return isInterestingEditorModel(this.editor); + } + + public run(): TPromise { + var controller = DefineKeybindingController.get(this.editor); + controller.launch(); + return TPromise.as(true); + } + +} + +const INTERESTING_FILE = /keybindings\.json$/; +function isInterestingEditorModel(editor:EditorCommon.ICommonCodeEditor): boolean { + if (editor.getConfiguration().readOnly) { + return false; + } + let model = editor.getModel(); + if (!model) { + return false; + } + let url = model.getAssociatedResource().toString(); + return INTERESTING_FILE.test(url); +} + +EditorBrowserRegistry.registerEditorContribution(DefineKeybindingController); +CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(DefineKeybindingAction, DefineKeybindingAction.ID, NLS_DEFINE_ACTION_LABEL, { + context: ContextKey.EditorFocus, + primary: KeyMod.chord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_K) +})); \ No newline at end of file diff --git a/src/vs/editor/contrib/format/common/format.ts b/src/vs/editor/contrib/format/common/format.ts index 99b89717af0..681a9d7d0eb 100644 --- a/src/vs/editor/contrib/format/common/format.ts +++ b/src/vs/editor/contrib/format/common/format.ts @@ -5,10 +5,86 @@ 'use strict'; -import {IFormattingSupport} from 'vs/editor/common/modes'; +import {IFormattingSupport, IFormattingOptions} from 'vs/editor/common/modes'; import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; +import {onUnexpectedError, illegalArgument} from 'vs/base/common/errors'; +import URI from 'vs/base/common/uri'; +import {IAction, Action} from 'vs/base/common/actions'; +import {IModelService} from 'vs/editor/common/services/modelService'; +import {TPromise} from 'vs/base/common/winjs.base'; +import {IModel, IRange, IPosition, ISingleEditOperation} from 'vs/editor/common/editorCommon'; +import {Range} from 'vs/editor/common/core/range'; +import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions'; export const FormatRegistry = new LanguageFeatureRegistry('formattingSupport'); export const FormatOnTypeRegistry = new LanguageFeatureRegistry('formattingSupport'); -export {IFormattingSupport}; \ No newline at end of file +export {IFormattingSupport}; + +export function formatRange(model: IModel, range: IRange, options: IFormattingOptions): TPromise { + const [support] = FormatRegistry.ordered(model); + if (!support) { + return TPromise.as(undefined); + } + return support.formatRange(model.getAssociatedResource(), range, options); +} + +export function formatDocument(model: IModel, options: IFormattingOptions): TPromise { + const [support] = FormatRegistry.ordered(model); + if (!support) { + return TPromise.as(undefined); + } + if (typeof support.formatDocument !== 'function') { + if (typeof support.formatRange === 'function') { + return formatRange(model, model.getFullModelRange(), options); + } else { + return TPromise.as(undefined); + } + } + + return support.formatDocument(model.getAssociatedResource(), options); +} + +export function formatAfterKeystroke(model: IModel, position: IPosition, ch: string, options: IFormattingOptions): TPromise { + const [support] = FormatOnTypeRegistry.ordered(model); + if (!support) { + return TPromise.as(undefined); + } + if (support.autoFormatTriggerCharacters.indexOf(ch) < 0) { + return TPromise.as(undefined); + } + return support.formatAfterKeystroke(model.getAssociatedResource(), position, ch, options); +} + +CommonEditorRegistry.registerLanguageCommand('_executeFormatRangeProvider', function(accessor, args) { + const {resource, range, options} = args; + if (!URI.isURI(resource) || !Range.isIRange(range)) { + throw illegalArgument(); + } + const model = accessor.get(IModelService).getModel(resource); + if (!model) { + throw illegalArgument('resource'); + } + return formatRange(model, range, options); +}); + +CommonEditorRegistry.registerLanguageCommand('_executeFormatDocumentProvider', function(accessor, args) { + const {resource, options} = args; + if (!URI.isURI(resource)) { + throw illegalArgument('resource'); + } + const model = accessor.get(IModelService).getModel(resource); + if (!model) { + throw illegalArgument('resource'); + } + + return formatDocument(model, options) +}); + +CommonEditorRegistry.registerDefaultLanguageCommand('_executeFormatOnTypeProvider', function(model, position, args) { + const {ch, options } = args; + if (typeof ch !== 'string') { + throw illegalArgument('ch'); + } + return formatAfterKeystroke(model, position, ch, options); +}); diff --git a/src/vs/editor/contrib/format/common/formatActions.ts b/src/vs/editor/contrib/format/common/formatActions.ts index 83ddd947b62..bd5ab2c6b4e 100644 --- a/src/vs/editor/contrib/format/common/formatActions.ts +++ b/src/vs/editor/contrib/format/common/formatActions.ts @@ -15,7 +15,7 @@ import formatCommand = require('./formatCommand'); import {Range} from 'vs/editor/common/core/range'; import {INullService} from 'vs/platform/instantiation/common/instantiation'; import {KeyMod, KeyCode} from 'vs/base/common/keyCodes'; -import {FormatOnTypeRegistry, FormatRegistry, IFormattingSupport} from '../common/format'; +import {FormatOnTypeRegistry, FormatRegistry, IFormattingSupport, formatRange, formatDocument, formatAfterKeystroke} from '../common/format'; interface IFormatOnTypeResult { range: EditorCommon.IEditorRange; @@ -66,7 +66,7 @@ class FormatOnType implements EditorCommon.IEditorContribution { var model = this.editor.getModel(); // no support - var support = FormatOnTypeRegistry.ordered(model)[0]; + var [support] = FormatOnTypeRegistry.ordered(model); if (!support || !support.autoFormatTriggerCharacters) { return; } @@ -75,12 +75,12 @@ class FormatOnType implements EditorCommon.IEditorContribution { this.formattingOptions = this.editor.getIndentationOptions(); // register typing listeners that will trigger the format - support.autoFormatTriggerCharacters.forEach(char => { - this.callOnModel.push(this.editor.addTypingListener(char, this.trigger.bind(this, support, char))); + support.autoFormatTriggerCharacters.forEach(ch => { + this.callOnModel.push(this.editor.addTypingListener(ch, this.trigger.bind(this, ch))); }); } - private trigger(support: IFormattingSupport, char: string): void { + private trigger(ch: string): void { if (this.editor.getSelections().length > 1) { return; @@ -116,7 +116,7 @@ class FormatOnType implements EditorCommon.IEditorContribution { } }); - support.formatAfterKeystroke(model.getAssociatedResource(), position, char, this.formattingOptions).then((edits) => { + formatAfterKeystroke(model, position, ch, this.formattingOptions).then(edits => { unbind(); @@ -170,31 +170,19 @@ export class FormatAction extends EditorAction { public run(): TPromise { - var model = this.editor.getModel(), - formattingSupport = FormatRegistry.ordered(model)[0], - canFormatRange = typeof formattingSupport.formatRange === 'function', - canFormatDocument = typeof formattingSupport.formatDocument === 'function', - editorSelection = this.editor.getSelection(); + const model = this.editor.getModel(), + editorSelection = this.editor.getSelection(), + options = this.editor.getIndentationOptions(); - var options = this.editor.getIndentationOptions(), - formattingPromise: TPromise; + let formattingPromise: TPromise; - if(canFormatRange) { - // format a selection/range - var formatRange: EditorCommon.IEditorRange = editorSelection; - if(!formatRange.isEmpty()) { - // Fix the selection to include the entire line to improve formatting results - formatRange.startColumn = 1; - } else { - formatRange = model.getFullModelRange(); - } - formattingPromise = formattingSupport.formatRange(model.getAssociatedResource(), formatRange, options); - - } else if(canFormatDocument) { - // format the whole document - formattingPromise = formattingSupport.formatDocument(model.getAssociatedResource(), options); + if (editorSelection.isEmpty()) { + formattingPromise = formatDocument(model, options); } else { - // broken support? + formattingPromise = formatRange(model, editorSelection, options); + } + + if (!formattingPromise) { return TPromise.as(false); } diff --git a/src/vs/editor/contrib/format/common/formatCommand.ts b/src/vs/editor/contrib/format/common/formatCommand.ts index 65b1df24a17..37f0edce92c 100644 --- a/src/vs/editor/contrib/format/common/formatCommand.ts +++ b/src/vs/editor/contrib/format/common/formatCommand.ts @@ -23,8 +23,7 @@ export class EditOperationsCommand implements EditorCommon.ICommand { public getEditOperations(model: EditorCommon.ITokenizedModel, builder: EditorCommon.IEditOperationBuilder): void { this._edits // We know that this edit.range comes from the mirror model, so it should only contain \n and no \r's - .map((edit) => this.fixLineTerminators(edit, model) ) - .map((edit) => this.trimEdit(edit, model)) + .map((edit) => EditOperationsCommand.trimEdit(edit, model)) .filter((edit) => edit !== null) // produced above in case the edit.text is identical to the existing text .forEach((edit) => builder.addEditOperation(Range.lift(edit.range), edit.text)); @@ -50,9 +49,8 @@ export class EditOperationsCommand implements EditorCommon.ICommand { return helper.getTrackedSelection(this._selectionId); } - private fixLineTerminators(edit: EditorCommon.ISingleEditOperation, model: EditorCommon.ITokenizedModel) : EditorCommon.ISingleEditOperation { + static fixLineTerminators(edit: EditorCommon.ISingleEditOperation, model: EditorCommon.ITokenizedModel): void { edit.text = edit.text.replace(/\r\n|\r|\n/g, model.getEOL()); - return edit; } /** @@ -63,42 +61,48 @@ export class EditOperationsCommand implements EditorCommon.ICommand { * bug #15108. There the cursor was jumping since the tracked selection was in the middle of the range edit * and was lost. */ - private trimEdit(edit:EditorCommon.ISingleEditOperation, model: EditorCommon.ITokenizedModel): EditorCommon.ISingleEditOperation { + static trimEdit(edit:EditorCommon.ISingleEditOperation, model: EditorCommon.ITokenizedModel): EditorCommon.ISingleEditOperation { - var currentText = model.getValueInRange(edit.range); + this.fixLineTerminators(edit, model); + + return this._trimEdit(model.validateRange(edit.range), edit.text, edit.forceMoveMarkers, model); + } + + static _trimEdit(editRange:Range, editText:string, editForceMoveMarkers:boolean, model: EditorCommon.ITokenizedModel): EditorCommon.ISingleEditOperation { + + let currentText = model.getValueInRange(editRange); // Find the equal characters in the front - var commonPrefixLength = Strings.commonPrefixLength(edit.text, currentText); + let commonPrefixLength = Strings.commonPrefixLength(editText, currentText); - // If the two strings are identical, return no edit - if (commonPrefixLength === currentText.length && commonPrefixLength === edit.text.length) { + // If the two strings are identical, return no edit (no-op) + if (commonPrefixLength === currentText.length && commonPrefixLength === editText.length) { return null; } - // Only compute a common suffix if none of the strings is already fully contained in the prefix - var commonSuffixLength = 0; - if (commonPrefixLength !== currentText.length && commonPrefixLength !== edit.text.length) { - commonSuffixLength = Strings.commonSuffixLength(edit.text, currentText); + if (commonPrefixLength > 0) { + // Apply front trimming + let newStartPosition = model.modifyPosition(editRange.getStartPosition(), commonPrefixLength); + editRange = new Range(newStartPosition.lineNumber, newStartPosition.column, editRange.endLineNumber, editRange.endColumn); + editText = editText.substring(commonPrefixLength); + currentText = currentText.substr(commonPrefixLength); } - // Adjust start position - var newStartPosition = new Position(edit.range.startLineNumber, edit.range.startColumn); - newStartPosition = model.modifyPosition(newStartPosition, commonPrefixLength); + // Find the equal characters in the rear + let commonSuffixLength = Strings.commonSuffixLength(editText, currentText); - // Adjust end position - var newEndPosition = new Position(edit.range.endLineNumber, edit.range.endColumn); - newEndPosition = model.modifyPosition(newEndPosition, -commonSuffixLength); - - //Trim the text - var newText = edit.text.slice(commonPrefixLength, edit.text.length - commonSuffixLength); + if (commonSuffixLength > 0) { + // Apply rear trimming + let newEndPosition = model.modifyPosition(editRange.getEndPosition(), -commonSuffixLength); + editRange = new Range(editRange.startLineNumber, editRange.startColumn, newEndPosition.lineNumber, newEndPosition.column); + editText = editText.substring(0, editText.length - commonSuffixLength); + currentText = currentText.substring(0, currentText.length - commonSuffixLength); + } return { - text: newText, - range: { - startLineNumber:newStartPosition.lineNumber, - startColumn:newStartPosition.column, - endLineNumber:newEndPosition.lineNumber, - endColumn: newEndPosition.column - }}; + text: editText, + range: editRange, + forceMoveMarkers: editForceMoveMarkers + }; } } diff --git a/src/vs/editor/contrib/format/test/common/formatCommand.test.ts b/src/vs/editor/contrib/format/test/common/formatCommand.test.ts new file mode 100644 index 00000000000..897863c949c --- /dev/null +++ b/src/vs/editor/contrib/format/test/common/formatCommand.test.ts @@ -0,0 +1,295 @@ +/*--------------------------------------------------------------------------------------------- + * 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 assert = require('assert'); +import {Range} from 'vs/editor/common/core/range'; +import TU = require('vs/editor/test/common/commands/commandTestUtils'); +import {EditOperationsCommand} from 'vs/editor/contrib/format/common/formatCommand'; +import {Selection} from 'vs/editor/common/core/selection'; +import {Model} from 'vs/editor/common/model/model'; +import EditorCommon = require('vs/editor/common/editorCommon'); + +function editOp(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number, text:string[]): EditorCommon.ISingleEditOperation { + return { + range: new Range(startLineNumber, startColumn, endLineNumber, endColumn), + text: text.join('\n'), + forceMoveMarkers: false + }; +} + +suite('FormatCommand.trimEdit', () => { + function testTrimEdit(lines: string[], edit:EditorCommon.ISingleEditOperation, expected:EditorCommon.ISingleEditOperation): void { + let model = new Model(lines.join('\n'), null); + let actual = EditOperationsCommand.trimEdit(edit, model); + assert.deepEqual(actual, expected); + model.dispose(); + } + + test('single-line no-op', () => { + testTrimEdit( + [ + 'some text', + 'some other text' + ], + editOp(1,1,1,10, [ + 'some text' + ]), + null + ) + }); + + test('multi-line no-op 1', () => { + testTrimEdit( + [ + 'some text', + 'some other text' + ], + editOp(1,1,2,16, [ + 'some text', + 'some other text' + ]), + null + ) + }); + + test('multi-line no-op 2', () => { + testTrimEdit( + [ + 'some text', + 'some other text' + ], + editOp(1,1,2,1, [ + 'some text', + '' + ]), + null + ) + }); + + test('simple prefix, no suffix', () => { + testTrimEdit( + [ + 'some text', + 'some other text' + ], + editOp(1,1,1,10, [ + 'some interesting thing' + ]), + editOp(1,6,1,10, [ + 'interesting thing' + ]) + ) + }); + + test('whole line prefix, no suffix', () => { + testTrimEdit( + [ + 'some text', + 'some other text' + ], + editOp(1,1,1,10, [ + 'some text', + 'interesting thing' + ]), + editOp(1,10,1,10, [ + '', + 'interesting thing' + ]) + ) + }); + + test('multi-line prefix, no suffix', () => { + testTrimEdit( + [ + 'some text', + 'some other text' + ], + editOp(1,1,2,16, [ + 'some text', + 'some other interesting thing' + ]), + editOp(2,12,2,16, [ + 'interesting thing' + ]) + ) + }); + + test('no prefix, simple suffix', () => { + testTrimEdit( + [ + 'some text', + 'some other text' + ], + editOp(1,1,1,10, [ + 'interesting text' + ]), + editOp(1,1,1,5, [ + 'interesting' + ]) + ) + }); + + test('no prefix, whole line suffix', () => { + testTrimEdit( + [ + 'some text', + 'some other text' + ], + editOp(1,1,1,10, [ + 'interesting thing', + 'some text' + ]), + editOp(1,1,1,1, [ + 'interesting thing', + '' + ]) + ) + }); + + test('no prefix, multi-line suffix', () => { + testTrimEdit( + [ + 'some text', + 'some other text' + ], + editOp(1,1,2,16, [ + 'interesting thing text', + 'some other text' + ]), + editOp(1,1,1,5, [ + 'interesting thing' + ]) + ) + }); + + test('no overlapping prefix & suffix', () => { + testTrimEdit( + [ + 'some cool text' + ], + editOp(1,1,1,15, [ + 'some interesting text' + ]), + editOp(1,6,1,10, [ + 'interesting' + ]) + ) + }); + + test('overlapping prefix & suffix 1', () => { + testTrimEdit( + [ + 'some cool text' + ], + editOp(1,1,1,15, [ + 'some cool cool text' + ]), + editOp(1,11,1,11, [ + 'cool ' + ]) + ) + }); + + test('overlapping prefix & suffix 2', () => { + testTrimEdit( + [ + 'some cool cool text' + ], + editOp(1,1,1,29, [ + 'some cool text' + ]), + editOp(1,11,1,16, [ + '' + ]) + ) + }); +}); + +suite('FormatCommand', () => { + function testFormatCommand(lines: string[], selection: Selection, edits:EditorCommon.ISingleEditOperation[], expectedLines: string[], expectedSelection: Selection): void { + TU.testCommand(lines, null, selection, (sel) => new EditOperationsCommand(edits, sel), expectedLines, expectedSelection); + } + + test('no-op', () => { + testFormatCommand( + [ + 'some text', + 'some other text' + ], + new Selection(2,1,2,5), + [ + editOp(1, 1, 2, 16, [ + 'some text', + 'some other text' + ]) + ], + [ + 'some text', + 'some other text' + ], + new Selection(2,1,2,5) + ); + }); + + test('trim beginning', () => { + testFormatCommand( + [ + 'some text', + 'some other text' + ], + new Selection(2,1,2,5), + [ + editOp(1, 1, 2, 16, [ + 'some text', + 'some new other text' + ]) + ], + [ + 'some text', + 'some new other text' + ], + new Selection(2,1,2,5) + ); + }); + + test('issue #144', () => { + testFormatCommand( + [ + 'package caddy', + '', + 'func main() {', + '\tfmt.Println("Hello World! :)")', + '}', + '' + ], + new Selection(1,1,1,1), + [ + editOp(1, 1, 6, 1, [ + 'package caddy', + '', + 'import "fmt"', + '', + 'func main() {', + '\tfmt.Println("Hello World! :)")', + '}', + '' + ]) + ], + [ + 'package caddy', + '', + 'import "fmt"', + '', + 'func main() {', + '\tfmt.Println("Hello World! :)")', + '}', + '' + ], + new Selection(1,1,1,1) + ); + }); + +}); \ No newline at end of file diff --git a/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts b/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts index c468b874875..4a0068308a6 100644 --- a/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts +++ b/src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts @@ -34,35 +34,7 @@ import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry'; import {IEditorService} from 'vs/platform/editor/common/editor'; import {FindReferencesController} from 'vs/editor/contrib/referenceSearch/browser/referenceSearch'; import {IKeybindingService, IKeybindingContextKey} from 'vs/platform/keybinding/common/keybindingService'; -import FeatureRegistry from 'vs/editor/contrib/goToDeclaration/common/goToDeclaration'; - -function getDeclarationsAtPosition(editor: EditorCommon.ICommonCodeEditor, position = editor.getPosition()): TPromise { - - let references: Modes.IReference[] = []; - let promises: TPromise[] = []; - - let model = editor.getModel(); - - for (let provider of FeatureRegistry.all(model)) { - - let promise = provider.findDeclaration(model.getAssociatedResource(), - position); - - promises.push(promise.then(result => { - if (Array.isArray(result)) { - references.push(...result); - } else { - references.push(result); - } - }, err => { - Errors.onUnexpectedError(err); - })); - } - - return TPromise.join(promises).then(() => { - return coalesce(references); - }); -} +import {DeclarationRegistry, getDeclarationsAtPosition} from 'vs/editor/contrib/goToDeclaration/common/goToDeclaration'; export abstract class GoToTypeAction extends EditorAction { @@ -182,7 +154,7 @@ export class GoToDeclarationAction extends GoToTypeAction { } public isSupported(): boolean { - return FeatureRegistry.has(this.editor.getModel()) && super.isSupported(); + return DeclarationRegistry.has(this.editor.getModel()) && super.isSupported(); } public getEnablementState():boolean { @@ -193,7 +165,7 @@ export class GoToDeclarationAction extends GoToTypeAction { var model = this.editor.getModel(), position = this.editor.getSelection().getStartPosition(); - return FeatureRegistry.all(model).some(provider => { + return DeclarationRegistry.all(model).some(provider => { return provider.canFindDeclaration( model.getLineContext(position.lineNumber), position.column - 1); @@ -201,7 +173,7 @@ export class GoToDeclarationAction extends GoToTypeAction { } protected _resolve(resource: URI, position: EditorCommon.IPosition): TPromise { - return getDeclarationsAtPosition(this.editor); + return getDeclarationsAtPosition(this.editor.getModel(), this.editor.getPosition()); } } @@ -239,7 +211,8 @@ class GotoDefinitionWithMouseEditorContribution implements EditorCommon.IEditorC private decorations:string[]; private currentWordUnderMouse:EditorCommon.IWordAtPosition; private throttler:Async.Throttler; - private lastMouseEvent:EditorBrowser.IMouseEvent; + private lastMouseMoveEvent:EditorBrowser.IMouseEvent; + private hasTriggerKeyOnMouseDown:boolean; constructor(editor: EditorBrowser.ICodeEditor, @IRequestService requestService: IRequestService, @IMessageService messageService: IMessageService, @IEditorService editorService: IEditorService) { this.editorService = editorService; @@ -252,6 +225,7 @@ class GotoDefinitionWithMouseEditorContribution implements EditorCommon.IEditorC this.editor = editor; this.throttler = new Async.Throttler(); + this.toUnhook.push(this.editor.addListener(EditorCommon.EventType.MouseDown, (e:EditorBrowser.IMouseEvent) => this.onEditorMouseDown(e))); this.toUnhook.push(this.editor.addListener(EditorCommon.EventType.MouseUp, (e:EditorBrowser.IMouseEvent) => this.onEditorMouseUp(e))); this.toUnhook.push(this.editor.addListener(EditorCommon.EventType.MouseMove, (e:EditorBrowser.IMouseEvent) => this.onEditorMouseMove(e))); this.toUnhook.push(this.editor.addListener(EditorCommon.EventType.KeyDown, (e:Keyboard.StandardKeyboardEvent) => this.onEditorKeyDown(e))); @@ -263,7 +237,7 @@ class GotoDefinitionWithMouseEditorContribution implements EditorCommon.IEditorC } private onEditorMouseMove(mouseEvent: EditorBrowser.IMouseEvent, withKey?:Keyboard.StandardKeyboardEvent):void { - this.lastMouseEvent = mouseEvent; + this.lastMouseMoveEvent = mouseEvent; this.startFindDefinition(mouseEvent, withKey); } @@ -311,7 +285,7 @@ class GotoDefinitionWithMouseEditorContribution implements EditorCommon.IEditorC startColumn: word.startColumn, endLineNumber: position.lineNumber, endColumn: word.endColumn - }, nls.localize('multipleResults', "Click to show the {0} definitions for '{1}'.", results.length, this.currentWordUnderMouse.word), false); + }, nls.localize('multipleResults', "Click to show the {0} definitions found.", results.length), false); } // Single result @@ -410,20 +384,28 @@ class GotoDefinitionWithMouseEditorContribution implements EditorCommon.IEditorC } private onEditorKeyDown(e:Keyboard.StandardKeyboardEvent):void { - if (e.keyCode === GotoDefinitionWithMouseEditorContribution.TRIGGER_KEY_VALUE && this.lastMouseEvent) { - this.startFindDefinition(this.lastMouseEvent, e); + if (e.keyCode === GotoDefinitionWithMouseEditorContribution.TRIGGER_KEY_VALUE && this.lastMouseMoveEvent) { + this.startFindDefinition(this.lastMouseMoveEvent, e); } else if (e[GotoDefinitionWithMouseEditorContribution.TRIGGER_MODIFIER]) { this.removeDecorations(); // remove decorations if user holds another key with ctrl/cmd to prevent accident goto declaration } } private resetHandler():void { - this.lastMouseEvent = null; + this.lastMouseMoveEvent = null; this.removeDecorations(); } + private onEditorMouseDown(mouseEvent: EditorBrowser.IMouseEvent):void { + // We need to record if we had the trigger key on mouse down because someone might select something in the editor + // holding the mouse down and then while mouse is down start to press Ctrl/Cmd to start a copy operation and then + // release the mouse button without wanting to do the navigation. + // With this flag we prevent goto definition if the mouse was down before the trigger key was pressed. + this.hasTriggerKeyOnMouseDown = !!mouseEvent.event[GotoDefinitionWithMouseEditorContribution.TRIGGER_MODIFIER]; + } + private onEditorMouseUp(mouseEvent: EditorBrowser.IMouseEvent):void { - if (this.isEnabled(mouseEvent)) { + if (this.isEnabled(mouseEvent) && this.hasTriggerKeyOnMouseDown) { this.gotoDefinition(mouseEvent.target, mouseEvent.event.altKey).done(()=>{ this.removeDecorations(); }, (error:Error)=>{ @@ -446,7 +428,7 @@ class GotoDefinitionWithMouseEditorContribution implements EditorCommon.IEditorC (Browser.isIE11orEarlier || mouseEvent.event.detail <= 1) && // IE does not support event.detail properly mouseEvent.target.type === EditorCommon.MouseTargetType.CONTENT_TEXT && (mouseEvent.event[GotoDefinitionWithMouseEditorContribution.TRIGGER_MODIFIER] || (withKey && withKey.keyCode === GotoDefinitionWithMouseEditorContribution.TRIGGER_KEY_VALUE)) && - FeatureRegistry.has(this.editor.getModel()); + DeclarationRegistry.has(this.editor.getModel()); } private findDefinition(target:EditorBrowser.IMouseTarget):TPromise { @@ -455,7 +437,7 @@ class GotoDefinitionWithMouseEditorContribution implements EditorCommon.IEditorC return TPromise.as(null); } - return getDeclarationsAtPosition(this.editor, target.position); + return getDeclarationsAtPosition(this.editor.getModel(), target.position); } private gotoDefinition(target:EditorBrowser.IMouseTarget, sideBySide:boolean):TPromise { diff --git a/src/vs/editor/contrib/goToDeclaration/common/goToDeclaration.ts b/src/vs/editor/contrib/goToDeclaration/common/goToDeclaration.ts index e3226572277..c2839a915d3 100644 --- a/src/vs/editor/contrib/goToDeclaration/common/goToDeclaration.ts +++ b/src/vs/editor/contrib/goToDeclaration/common/goToDeclaration.ts @@ -5,9 +5,42 @@ 'use strict'; +import URI from 'vs/base/common/uri'; +import {TPromise} from 'vs/base/common/winjs.base'; +import {onUnexpectedError} from 'vs/base/common/errors'; +import {IModel, IPosition} from 'vs/editor/common/editorCommon'; import {IDeclarationSupport} from 'vs/editor/common/modes'; import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; +import {IReference} from 'vs/editor/common/modes'; +import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions'; -const FeatureRegistry = new LanguageFeatureRegistry('declarationSupport'); +export const DeclarationRegistry = new LanguageFeatureRegistry('declarationSupport'); -export default FeatureRegistry; \ No newline at end of file +export function getDeclarationsAtPosition(model: IModel, position: IPosition): TPromise { + + const resource = model.getAssociatedResource(); + const provider = DeclarationRegistry.ordered(model); + + // get results + const promises = provider.map((provider, idx) => { + return provider.findDeclaration(resource, position).then(result => { + return result; + }, err => { + onUnexpectedError(err); + }); + }); + + return TPromise.join(promises).then(allReferences => { + let result: IReference[] = []; + for (let references of allReferences) { + if (Array.isArray(references)) { + result.push(...references); + } else if (references) { + result.push(references); + } + } + return result; + }); +} + +CommonEditorRegistry.registerDefaultLanguageCommand('_executeDefinitionProvider', getDeclarationsAtPosition) \ No newline at end of file diff --git a/src/vs/editor/contrib/gotoError/browser/gotoError.ts b/src/vs/editor/contrib/gotoError/browser/gotoError.ts index b206a903bde..f8a16f9399f 100644 --- a/src/vs/editor/contrib/gotoError/browser/gotoError.ts +++ b/src/vs/editor/contrib/gotoError/browser/gotoError.ts @@ -276,9 +276,9 @@ class MarkerNavigationWidget extends ZoneWidget.ZoneWidget { } container.span({ class: 'quickfixentry', - text: fix.label + text: fix.command.title }).on(DOM.EventType.CLICK,() => { - mode.quickFixSupport.runQuickFixAction(this.editor.getModel().getAssociatedResource(), marker, fix.id).then(result => { + mode.quickFixSupport.runQuickFixAction(this.editor.getModel().getAssociatedResource(), marker, fix).then(result => { return bulkEdit(this._eventService, this._editorService, this.editor, result.edits); }); return true; @@ -399,7 +399,7 @@ class MarkerController implements EditorCommon.IEditorContribution { } private _onMarkerChanged(changedResources: URI[]): void { - if(!changedResources.some(r => this.editor.getModel().getAssociatedResource().equals(r))) { + if(!changedResources.some(r => this.editor.getModel().getAssociatedResource().toString() === r.toString())) { return; } this._model.setMarkers(this._getMarkers()); diff --git a/src/vs/editor/contrib/hover/browser/hover.css b/src/vs/editor/contrib/hover/browser/hover.css index a0091b4a6d4..abab1994f41 100644 --- a/src/vs/editor/contrib/hover/browser/hover.css +++ b/src/vs/editor/contrib/hover/browser/hover.css @@ -18,14 +18,14 @@ -ms-animation-name: fadeIn; animation-duration: 0.15s; animation-name: fadeIn; - + -webkit-user-select: text; -ms-user-select: text; -khtml-user-select: text; -moz-user-select: text; -o-user-select: text; user-select: text; - + overflow: hidden; } diff --git a/src/vs/editor/contrib/hover/browser/modesContentHover.ts b/src/vs/editor/contrib/hover/browser/modesContentHover.ts index 4fbfae8608b..e0e92c72331 100644 --- a/src/vs/editor/contrib/hover/browser/modesContentHover.ts +++ b/src/vs/editor/contrib/hover/browser/modesContentHover.ts @@ -15,8 +15,8 @@ import HoverWidget = require('./hoverWidgets'); import HtmlContent = require('vs/base/common/htmlContent'); import {renderHtml} from 'vs/base/browser/htmlContentRenderer'; import {tokenizeToHtmlContent} from 'vs/editor/common/modes/textToHtmlTokenizer'; -import ExtraInfoRegistry from '../common/hover'; import {Range} from 'vs/editor/common/core/range'; +import {ExtraInfoRegistry, getExtraInfoAtPosition} from '../common/hover'; class ModesContentComputer implements HoverOperation.IHoverComputer { @@ -46,27 +46,10 @@ class ModesContentComputer implements HoverOperation.IHoverComputer[] = []; - - for (let support of supports) { - promises.push(support.computeInfo(this._editor.getModel().getAssociatedResource(), { - lineNumber: this._range.startLineNumber, - column: this._range.startColumn, - }).then((result: Modes.IComputeExtraInfoResult) => { - if (result) { - let hasRange = (typeof result.range !== 'undefined'); - let hasValue = (typeof result.value !== 'undefined'); - let hasHtmlContent = (typeof result.htmlContent !== 'undefined' && result.htmlContent && result.htmlContent.length > 0); - if (hasRange && (hasValue || hasHtmlContent)) { - values.push(result); - } - } - })); - } - - return TPromise.join(promises).then(() => values); + return getExtraInfoAtPosition(model, { + lineNumber: this._range.startLineNumber, + column: this._range.startColumn + }); } public computeSync(): Modes.IComputeExtraInfoResult[] { diff --git a/src/vs/editor/contrib/hover/common/hover.ts b/src/vs/editor/contrib/hover/common/hover.ts index a811c6dac77..127e658672b 100644 --- a/src/vs/editor/contrib/hover/common/hover.ts +++ b/src/vs/editor/contrib/hover/common/hover.ts @@ -5,9 +5,38 @@ 'use strict'; -import {IExtraInfoSupport} from 'vs/editor/common/modes'; +import {IExtraInfoSupport, IComputeExtraInfoResult} from 'vs/editor/common/modes'; import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; +import {TPromise} from 'vs/base/common/winjs.base'; +import {coalesce} from 'vs/base/common/arrays'; +import {onUnexpectedError} from 'vs/base/common/errors'; +import {IPosition, IModel} from 'vs/editor/common/editorCommon'; +import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions'; -const ExtraInfoRegistry = new LanguageFeatureRegistry('extraInfoSupport'); +export const ExtraInfoRegistry = new LanguageFeatureRegistry('extraInfoSupport'); -export default ExtraInfoRegistry; \ No newline at end of file +export function getExtraInfoAtPosition(model: IModel, position: IPosition): TPromise { + + const resource = model.getAssociatedResource(); + const supports = ExtraInfoRegistry.ordered(model); + const values: IComputeExtraInfoResult[] = []; + + const promises = supports.map((support, idx) => { + return support.computeInfo(resource, position).then(result => { + if (result) { + let hasRange = (typeof result.range !== 'undefined'); + let hasValue = (typeof result.value !== 'undefined'); + let hasHtmlContent = (typeof result.htmlContent !== 'undefined' && result.htmlContent && result.htmlContent.length > 0); + if (hasRange && (hasValue || hasHtmlContent)) { + values[idx] = result; + } + } + }, err => { + onUnexpectedError(err); + }); + }); + + return TPromise.join(promises).then(() => coalesce(values)); +} + +CommonEditorRegistry.registerDefaultLanguageCommand('_executeHoverProvider', getExtraInfoAtPosition); \ No newline at end of file diff --git a/src/vs/editor/contrib/linesOperations/common/linesOperations.ts b/src/vs/editor/contrib/linesOperations/common/linesOperations.ts index e68ea47b55d..a451fd9df4c 100644 --- a/src/vs/editor/contrib/linesOperations/common/linesOperations.ts +++ b/src/vs/editor/contrib/linesOperations/common/linesOperations.ts @@ -242,12 +242,12 @@ CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(TrimTrailin CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(MoveLinesDownAction, MoveLinesDownAction.ID, nls.localize('lines.moveDown', "Move Line Down"), { context: ContextKey.EditorTextFocus, primary: KeyMod.Alt | KeyCode.DownArrow, - linux: { primary: KeyMod.CtrlCmd | KeyCode.DownArrow } + linux: { primary: KeyMod.Alt | KeyCode.DownArrow } })); CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(MoveLinesUpAction, MoveLinesUpAction.ID, nls.localize('lines.moveUp', "Move Line Up"), { context: ContextKey.EditorTextFocus, primary: KeyMod.Alt | KeyCode.UpArrow, - linux: { primary: KeyMod.CtrlCmd | KeyCode.UpArrow } + linux: { primary: KeyMod.Alt | KeyCode.UpArrow } })); CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(CopyLinesDownAction, CopyLinesDownAction.ID, nls.localize('lines.copyDown', "Copy Line Down"), { context: ContextKey.EditorTextFocus, diff --git a/src/vs/editor/contrib/links/browser/links.ts b/src/vs/editor/contrib/links/browser/links.ts index 531fd7a6d85..f31fc9951e6 100644 --- a/src/vs/editor/contrib/links/browser/links.ts +++ b/src/vs/editor/contrib/links/browser/links.ts @@ -10,7 +10,7 @@ import nls = require('vs/nls'); import {TPromise} from 'vs/base/common/winjs.base'; import Platform = require('vs/base/common/platform'); import Errors = require('vs/base/common/errors'); -import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import Keyboard = require('vs/base/browser/keyboardEvent'); import {CommonEditorRegistry, EditorActionDescriptor} from 'vs/editor/common/editorCommonExtensions'; import {EditorAction, Behaviour} from 'vs/editor/common/editorAction'; @@ -267,9 +267,9 @@ class LinkDetector { } } - var url: Network.URL; + var url: URI; try { - url = new Network.URL(absoluteUrl); + url = URI.parse(absoluteUrl); } catch (err) { // invalid url this.messageService.show(Severity.Warning, nls.localize('invalid.url', 'Invalid URI: cannot open {0}', absoluteUrl)); diff --git a/src/vs/editor/contrib/multicursor/common/multicursor.ts b/src/vs/editor/contrib/multicursor/common/multicursor.ts index e9e173fd690..0efb91e4821 100644 --- a/src/vs/editor/contrib/multicursor/common/multicursor.ts +++ b/src/vs/editor/contrib/multicursor/common/multicursor.ts @@ -32,10 +32,16 @@ class InsertCursorBelow extends HandlerEditorAction { CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(InsertCursorAbove, InsertCursorAbove.ID, nls.localize('mutlicursor.insertAbove', "Insert Cursor Above"), { context: ContextKey.EditorTextFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.UpArrow, - linux: { primary: KeyMod.CtrlCmd| KeyMod.WinCtrl | KeyCode.UpArrow } + linux: { + primary: KeyMod.Shift | KeyMod.Alt | KeyCode.UpArrow, + secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.UpArrow] + } })); CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(InsertCursorBelow, InsertCursorBelow.ID, nls.localize('mutlicursor.insertBelow', "Insert Cursor Below"), { context: ContextKey.EditorTextFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.DownArrow, - linux: { primary: KeyMod.CtrlCmd| KeyMod.WinCtrl | KeyCode.DownArrow } + linux: { + primary: KeyMod.Shift | KeyMod.Alt | KeyCode.DownArrow, + secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.DownArrow] + } })); diff --git a/src/vs/editor/contrib/parameterHints/browser/parameterHintsModel.ts b/src/vs/editor/contrib/parameterHints/browser/parameterHintsModel.ts index 9dee0382288..d767e66ca30 100644 --- a/src/vs/editor/contrib/parameterHints/browser/parameterHintsModel.ts +++ b/src/vs/editor/contrib/parameterHints/browser/parameterHintsModel.ts @@ -11,7 +11,7 @@ import async = require('vs/base/common/async'); import events = require('vs/base/common/eventEmitter'); import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); -import {ParameterHintsRegistry} from '../common/parameterHints'; +import {ParameterHintsRegistry, getParameterHints} from '../common/parameterHints'; import {sequence} from 'vs/base/common/async'; function hashParameterHints(hints: Modes.IParameterHints): string { @@ -50,7 +50,7 @@ export class ParameterHintsModel extends events.EventEmitter { private active: boolean; private hash: string; - private throttledDelayer: async.ThrottledDelayer; + private throttledDelayer: async.ThrottledDelayer; constructor(editor:EditorCommon.ICommonCodeEditor) { super(['cancel', 'hint', 'destroy']); @@ -59,7 +59,7 @@ export class ParameterHintsModel extends events.EventEmitter { this.toDispose = []; this.triggerCharactersListeners = []; - this.throttledDelayer = new async.ThrottledDelayer(ParameterHintsModel.DELAY); + this.throttledDelayer = new async.ThrottledDelayer(ParameterHintsModel.DELAY); this.active = false; this.hash = null; @@ -96,15 +96,8 @@ export class ParameterHintsModel extends events.EventEmitter { } public doTrigger(triggerCharacter: string): TPromise { - let model = this.editor.getModel(); - let support = ParameterHintsRegistry.ordered(model)[0]; - if (!support) { - return TPromise.as(false); - } - - return support.getParameterHints(model.getAssociatedResource(), this.editor.getPosition(), triggerCharacter).then((result: Modes.IParameterHints) => { + return getParameterHints(this.editor.getModel(), this.editor.getPosition(), triggerCharacter).then(result => { var hash = hashParameterHints(result); - if (!result || result.signatures.length === 0 || (this.hash && hash !== this.hash)) { this.cancel(); this.emit('cancel'); diff --git a/src/vs/editor/contrib/parameterHints/common/parameterHints.ts b/src/vs/editor/contrib/parameterHints/common/parameterHints.ts index 47b974a63f3..a7be3b7046c 100644 --- a/src/vs/editor/contrib/parameterHints/common/parameterHints.ts +++ b/src/vs/editor/contrib/parameterHints/common/parameterHints.ts @@ -5,7 +5,29 @@ 'use strict'; -import {IParameterHintsSupport} from 'vs/editor/common/modes'; +import {IParameterHintsSupport, IParameterHints} from 'vs/editor/common/modes'; +import {IModel, IPosition} from 'vs/editor/common/editorCommon'; +import {TPromise} from 'vs/base/common/winjs.base'; +import {onUnexpectedError, illegalArgument} from 'vs/base/common/errors'; import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; +import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions'; export const ParameterHintsRegistry = new LanguageFeatureRegistry('parameterHintsSupport'); + +export function getParameterHints(model:IModel, position:IPosition, triggerCharacter: string): TPromise { + + let support = ParameterHintsRegistry.ordered(model)[0]; + if (!support) { + return TPromise.as(undefined); + } + + return support.getParameterHints(model.getAssociatedResource(), position, triggerCharacter); +} + +CommonEditorRegistry.registerDefaultLanguageCommand('_executeSignatureHelpProvider', function(model, position, args) { + let {triggerCharacter} = args; + if (triggerCharacter && typeof triggerCharacter !== 'string') { + throw illegalArgument('triggerCharacter'); + } + return getParameterHints(model, position, triggerCharacter); +}); \ No newline at end of file diff --git a/src/vs/editor/contrib/quickFix/browser/quickFix.ts b/src/vs/editor/contrib/quickFix/browser/quickFix.ts index 3f708ee8392..5a252a4df89 100644 --- a/src/vs/editor/contrib/quickFix/browser/quickFix.ts +++ b/src/vs/editor/contrib/quickFix/browser/quickFix.ts @@ -24,7 +24,7 @@ import {IEventService} from 'vs/platform/event/common/event'; import {IEditorService} from 'vs/platform/editor/common/editor'; import {IMessageService} from 'vs/platform/message/common/message'; import {bulkEdit} from 'vs/editor/common/services/bulkEdit'; -import QuickFixRegistry, {IQuickFix2} from '../common/quickFix'; +import {QuickFixRegistry, IQuickFix2} from '../common/quickFix'; import {KeyMod, KeyCode} from 'vs/base/common/keyCodes'; export class QuickFixController implements EditorCommon.IEditorContribution { @@ -77,7 +77,7 @@ export class QuickFixController implements EditorCommon.IEditorContribution { return; } - fix.support.runQuickFixAction(this.editor.getModel().getAssociatedResource(), range, fix.id).then(result => { + fix.support.runQuickFixAction(this.editor.getModel().getAssociatedResource(), range, { command: fix.command, score: fix.score }).then(result => { if (result) { if (result.message) { this.messageService.show(Severity.Info, result.message); diff --git a/src/vs/editor/contrib/quickFix/browser/quickFixModel.ts b/src/vs/editor/contrib/quickFix/browser/quickFixModel.ts index f7fdff0c7eb..0f9fa159d43 100644 --- a/src/vs/editor/contrib/quickFix/browser/quickFixModel.ts +++ b/src/vs/editor/contrib/quickFix/browser/quickFixModel.ts @@ -16,7 +16,7 @@ import schedulers = require('vs/base/common/async'); import errors = require('vs/base/common/errors'); import {Range} from 'vs/editor/common/core/range'; import {IMarkerService, IMarker} from 'vs/platform/markers/common/markers'; -import QuickFixRegistry, {IQuickFix2} from '../common/quickFix'; +import {QuickFixRegistry, IQuickFix2, getQuickFixes} from '../common/quickFix'; import LightBulpWidget = require('./lightBulpWidget'); enum QuickFixSuggestState { @@ -124,7 +124,7 @@ export class QuickFixModel extends events.EventEmitter { return; } var associatedResource = model.getAssociatedResource(); - if (!changedResources.some(r => associatedResource.equals(r))) { + if (!changedResources.some(r => associatedResource.toString() === r.toString())) { return; } @@ -212,27 +212,7 @@ export class QuickFixModel extends events.EventEmitter { } this.quickFixRequestPromiseRange = range; - let quickFixes: IQuickFix2[] = []; - let promises = QuickFixRegistry.all(model).map(support => { - return support.getQuickFixes(model.getAssociatedResource(), range).then(result => { - if (!Array.isArray(result)) { - return - } - for (let fix of result) { - quickFixes.push({ - id: fix.id, - label: fix.label, - documentation: fix.documentation, - score: fix.score, - support - }); - } - }, err => { - errors.onUnexpectedError(err); - }); - }); - - this.quickFixRequestPromise = TPromise.join(promises).then(() => quickFixes); + this.quickFixRequestPromise = getQuickFixes(model, range); return this.quickFixRequestPromise; } diff --git a/src/vs/editor/contrib/quickFix/browser/quickFixSelectionWidget.ts b/src/vs/editor/contrib/quickFix/browser/quickFixSelectionWidget.ts index bc2a685d294..482a1446b22 100644 --- a/src/vs/editor/contrib/quickFix/browser/quickFixSelectionWidget.ts +++ b/src/vs/editor/contrib/quickFix/browser/quickFixSelectionWidget.ts @@ -24,8 +24,10 @@ import {IQuickFix2} from '../common/quickFix'; var $ = dom.emmet; -function isQuickFix(quickfix: any) : boolean { - return quickfix && quickfix.id && quickfix.label; +function isQuickFix(quickfix: any): quickfix is IQuickFix2 { + return quickfix + && typeof (quickfix).command === 'object' + && typeof ( quickfix).command.title === 'string'; } // To be used as a tree element when we want to show a message @@ -119,9 +121,9 @@ class Controller extends TreeDefaults.DefaultController { function getHeight(tree:Tree.ITree, element:any): number { var fix = element; - if (!(element instanceof Message) && !!fix.documentation && tree.isFocused(fix)) { - return 35; - } + // if (!(element instanceof Message) && !!fix.documentation && tree.isFocused(fix)) { + // return 35; + // } return 19; } @@ -159,8 +161,8 @@ class Renderer implements Tree.IRenderer { } var quickFix = element; - templateData.main.textContent = quickFix.label; - templateData.documentationLabel.textContent = quickFix.documentation || ''; + templateData.main.textContent = quickFix.command.title; + templateData.documentationLabel.textContent = /*quickFix.documentation ||*/ ''; } public disposeTemplate(tree: Tree.ITree, templateId: string, templateData: any): void { @@ -281,7 +283,7 @@ export class QuickFixSelectionWidget implements EditorBrowser.IContentWidget { this.updateWidgetHeight(); if (focus) { - this.tree.reveal(focus, (payload && payload.firstSuggestion) ? 0 : null); + return this.tree.reveal(focus, (payload && payload.firstSuggestion) ? 0 : null); } }, Errors.onUnexpectedError); })); diff --git a/src/vs/editor/contrib/quickFix/common/quickFix.ts b/src/vs/editor/contrib/quickFix/common/quickFix.ts index 3b17a46819b..e084770c029 100644 --- a/src/vs/editor/contrib/quickFix/common/quickFix.ts +++ b/src/vs/editor/contrib/quickFix/common/quickFix.ts @@ -5,13 +5,59 @@ 'use strict'; +import URI from 'vs/base/common/uri'; +import {Range} from 'vs/editor/common/core/range'; +import {IModel, IRange} from 'vs/editor/common/editorCommon'; +import {TPromise} from 'vs/base/common/winjs.base'; +import {onUnexpectedError, illegalArgument} from 'vs/base/common/errors'; import {IQuickFixSupport, IQuickFix} from 'vs/editor/common/modes'; +import {IModelService} from 'vs/editor/common/services/modelService'; +import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions'; import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; -const QuickFixRegistry = new LanguageFeatureRegistry('quickFixSupport'); - -export default QuickFixRegistry; +export const QuickFixRegistry = new LanguageFeatureRegistry('quickFixSupport'); export interface IQuickFix2 extends IQuickFix { support: IQuickFixSupport; -} \ No newline at end of file + id: string; +} + +export function getQuickFixes(model: IModel, range: IRange): TPromise { + + const quickFixes: IQuickFix2[] = []; + const promises = QuickFixRegistry.all(model).map(support => { + return support.getQuickFixes(model.getAssociatedResource(), range).then(result => { + if (!Array.isArray(result)) { + return + } + let c = 0; + for (let fix of result) { + quickFixes.push({ + command: fix.command, + score: fix.score, + id: `quickfix_#${c++}`, + support + }); + } + }, err => { + onUnexpectedError(err); + }); + }); + + return TPromise.join(promises).then(() => quickFixes); +} + +CommonEditorRegistry.registerLanguageCommand('_executeCodeActionProvider', function(accessor, args) { + + const {resource, range} = args; + if (!URI.isURI(resource) || !Range.isIRange(range)) { + throw illegalArgument(); + } + + const model = accessor.get(IModelService).getModel(resource); + if (!model) { + throw illegalArgument(); + } + + return getQuickFixes(model, range); +}); \ No newline at end of file diff --git a/src/vs/editor/contrib/quickOpen/browser/quickCommand.ts b/src/vs/editor/contrib/quickOpen/browser/quickCommand.ts index e4119a7a7da..f3f4c794cdc 100644 --- a/src/vs/editor/contrib/quickOpen/browser/quickCommand.ts +++ b/src/vs/editor/contrib/quickOpen/browser/quickCommand.ts @@ -113,7 +113,7 @@ export class QuickCommandAction extends EditorQuickOpen.BaseEditorQuickOpenActio continue; // do not show actions that are not supported in this context } - var keys = this._keybindingService.lookupKeybindings(editorAction.id).map(k => k.toLabel()); + var keys = this._keybindingService.lookupKeybindings(editorAction.id).map(k => this._keybindingService.getLabelFor(k)); if (action.label) { var highlights = Filters.matchesFuzzy(searchValue, action.label); diff --git a/src/vs/editor/contrib/quickOpen/common/quickOpen.ts b/src/vs/editor/contrib/quickOpen/common/quickOpen.ts index cf5c24c299e..b232934917f 100644 --- a/src/vs/editor/contrib/quickOpen/common/quickOpen.ts +++ b/src/vs/editor/contrib/quickOpen/common/quickOpen.ts @@ -5,14 +5,93 @@ 'use strict'; +import URI from 'vs/base/common/uri'; +import {onUnexpectedError, illegalArgument} from 'vs/base/common/errors'; +import {TPromise} from 'vs/base/common/winjs.base'; +import {Range} from 'vs/editor/common/core/range'; +import {IModel} from 'vs/editor/common/editorCommon'; import {IOutlineEntry, IOutlineSupport} from 'vs/editor/common/modes'; import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; +import {IModelService} from 'vs/editor/common/services/modelService'; +import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions'; -const QuickOutineRegistry = new LanguageFeatureRegistry('outlineSupport'); +const OutlineRegistry = new LanguageFeatureRegistry('outlineSupport'); export { + OutlineRegistry, IOutlineEntry, IOutlineSupport } -export default QuickOutineRegistry; \ No newline at end of file +export interface IOutline { + entries: IOutlineEntry[]; + outlineGroupLabel: { [n: string]: string; }; +} + +export function getOutlineEntries(model: IModel): TPromise { + + let groupLabels: { [n: string]: string } = Object.create(null); + let entries: IOutlineEntry[] = []; + + let promises = OutlineRegistry.all(model).map(support => { + + if (support.outlineGroupLabel) { + for (var key in support.outlineGroupLabel) { + if (Object.prototype.hasOwnProperty.call(support.outlineGroupLabel, key)) { + groupLabels[key] = support.outlineGroupLabel[key]; + } + } + } + + return support.getOutline(model.getAssociatedResource()).then(result => { + if (Array.isArray(result)) { + entries.push(...result); + } + }, err => { + onUnexpectedError(err); + }); + }); + + return TPromise.join(promises).then(() => { + let flatEntries: IOutlineEntry[] = []; + flatten(flatEntries, entries, ''); + flatEntries.sort(compareEntriesUsingStart); + + return { + entries: flatEntries, + outlineGroupLabel: groupLabels + } + }); +} + +function compareEntriesUsingStart(a: IOutlineEntry, b: IOutlineEntry): number{ + return Range.compareRangesUsingStarts(a.range, b.range); +} + +function flatten(bucket: IOutlineEntry[], entries: IOutlineEntry[], overrideContainerLabel: string): void { + for (let entry of entries) { + bucket.push({ + type: entry.type, + range: entry.range, + label: entry.label, + icon: entry.icon, + containerLabel: entry.containerLabel || overrideContainerLabel + }); + if (entry.children) { + flatten(bucket, entry.children, entry.label); + } + } +} + + +CommonEditorRegistry.registerLanguageCommand('_executeDocumentSymbolProvider', function(accessor, args) { + const {resource} = args; + if (!URI.isURI(resource)) { + throw illegalArgument('resource'); + } + const model = accessor.get(IModelService).getModel(resource); + if (!model) { + throw illegalArgument('resource'); + } + return getOutlineEntries(model); +}); \ No newline at end of file diff --git a/src/vs/editor/contrib/referenceSearch/browser/referenceSearch.ts b/src/vs/editor/contrib/referenceSearch/browser/referenceSearch.ts index eff53f50596..4f0846b52f8 100644 --- a/src/vs/editor/contrib/referenceSearch/browser/referenceSearch.ts +++ b/src/vs/editor/contrib/referenceSearch/browser/referenceSearch.ts @@ -30,7 +30,7 @@ import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; import {IKeybindingService, IKeybindingContextKey, ICommandHandler} from 'vs/platform/keybinding/common/keybindingService'; import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry'; import {KeyMod, KeyCode} from 'vs/base/common/keyCodes'; -import ReferenceSearchRegistry from '../common/referenceSearch'; +import {ReferenceRegistry, findReferences} from '../common/referenceSearch'; import IPeekViewService = peekView.IPeekViewService; export class FindReferencesController implements EditorCommon.IEditorContribution { @@ -265,7 +265,7 @@ export class ReferenceAction extends EditorAction { } public isSupported():boolean { - return ReferenceSearchRegistry.has(this.editor.getModel()) && super.isSupported(); + return ReferenceRegistry.has(this.editor.getModel()) && super.isSupported(); } public getEnablementState():boolean { @@ -278,7 +278,7 @@ export class ReferenceAction extends EditorAction { let context = model.getLineContext(position.lineNumber); let offset = position.column - 1; - return ReferenceSearchRegistry.all(model).some(support => { + return ReferenceRegistry.all(model).some(support => { return support.canFindReferences(context, offset); }); } @@ -292,22 +292,6 @@ export class ReferenceAction extends EditorAction { } } -function findReferences(model: EditorCommon.IModel, position: EditorCommon.IPosition): TPromise { - let references: Modes.IReference[] = []; - - // collect references from all providers - let promises = ReferenceSearchRegistry.all(model).map(provider => { - return provider.findReferences(model.getAssociatedResource(), position, true).then(result => { - if (Array.isArray(result)) { - references.push(...result); - } - }, err => { - errors.onUnexpectedError(err); - }); - }); - - return TPromise.join(promises).then(() => references); -} let findReferencesCommand: ICommandHandler = (accessor, args) => { diff --git a/src/vs/editor/contrib/referenceSearch/browser/referenceSearchWidget.ts b/src/vs/editor/contrib/referenceSearch/browser/referenceSearchWidget.ts index 6d2ad7c7091..c0e868875a3 100644 --- a/src/vs/editor/contrib/referenceSearch/browser/referenceSearchWidget.ts +++ b/src/vs/editor/contrib/referenceSearch/browser/referenceSearchWidget.ts @@ -602,9 +602,12 @@ export class ReferenceWidget extends peekViewWidget.PeekViewWidget { }, errors.onUnexpectedError); // show in tree - this.tree.reveal(reference); - this.tree.setSelection([reference]); - this.tree.setFocus(reference); + this.tree.reveal(reference) + .then(() => { + this.tree.setSelection([reference]); + this.tree.setFocus(reference); + }) + .done(null, errors.onUnexpectedError); } public dispose(): void { diff --git a/src/vs/editor/contrib/referenceSearch/common/referenceSearch.ts b/src/vs/editor/contrib/referenceSearch/common/referenceSearch.ts index d578fcbe0cc..143886d49fc 100644 --- a/src/vs/editor/contrib/referenceSearch/common/referenceSearch.ts +++ b/src/vs/editor/contrib/referenceSearch/common/referenceSearch.ts @@ -5,9 +5,37 @@ 'use strict'; -import {IReferenceSupport} from 'vs/editor/common/modes'; +import {IReferenceSupport, IReference} from 'vs/editor/common/modes'; +import {IModel, IPosition} from 'vs/editor/common/editorCommon'; +import {TPromise} from 'vs/base/common/winjs.base'; +import {onUnexpectedError} from 'vs/base/common/errors'; import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; +import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions'; -const ReferenceSearchRegistry = new LanguageFeatureRegistry('referenceSupport'); +export const ReferenceRegistry = new LanguageFeatureRegistry('referenceSupport'); -export default ReferenceSearchRegistry; \ No newline at end of file +export function findReferences(model: IModel, position: IPosition): TPromise { + + // collect references from all providers + const promises = ReferenceRegistry.ordered(model).map(provider => { + return provider.findReferences(model.getAssociatedResource(), position, true).then(result => { + if (Array.isArray(result)) { + return result; + } + }, err => { + onUnexpectedError(err); + }); + }); + + return TPromise.join(promises).then(references => { + let result: IReference[] = []; + for (let ref of references) { + if (ref) { + result.push(...ref); + } + } + return result; + }); +} + +CommonEditorRegistry.registerDefaultLanguageCommand('_executeReferenceProvider', findReferences); \ No newline at end of file diff --git a/src/vs/editor/contrib/rename/browser/rename2.ts b/src/vs/editor/contrib/rename/browser/rename2.ts index 95be4ac6cb4..e6a3abc2e6e 100644 --- a/src/vs/editor/contrib/rename/browser/rename2.ts +++ b/src/vs/editor/contrib/rename/browser/rename2.ts @@ -25,7 +25,7 @@ import {IKeybindingService, IKeybindingContextKey} from 'vs/platform/keybinding/ import {IEventService} from 'vs/platform/event/common/event'; import {IEditorService} from 'vs/platform/editor/common/editor'; import {KeyMod, KeyCode} from 'vs/base/common/keyCodes'; -import {RenameRegistry} from '../common/rename'; +import {RenameRegistry, rename} from '../common/rename'; export class RenameAction extends EditorAction { @@ -145,42 +145,12 @@ export class RenameAction extends EditorAction { // start recording of file changes so that we can figure out if a file that // is to be renamed conflicts with another (concurrent) modification - let sourceModel = this.editor.getModel().getAssociatedResource(); - let sourceSelections = this.editor.getSelections(); + let edit = createBulkEdit(this._eventService, this._editorService, this.editor); - let supports = RenameRegistry.ordered(this.editor.getModel()); - let hasResult = false; - let rejects: string[] = []; - - let factory = supports.map(support => { - return () => { - if (!hasResult) { - return support.rename(sourceModel, this.editor.getPosition(), newName).then(result => { - if (!result) { - // ignore - } else if (!result.rejectReason) { - hasResult = true; - return result; - } else { - rejects.push(result.rejectReason); - } - }); - } - }; - }); - - let edit = createBulkEdit(this._eventService, this._editorService, - this.editor); - - return sequence(factory).then(values => { - - let result = values[0]; - if (rejects.length > 0) { - return TPromise.wrapError(rejects.join('\n')); - } else if (!result) { - return TPromise.wrapError(nls.localize('no result', "No result.")); + return rename(this.editor.getModel(), this.editor.getPosition(), newName).then(result => { + if (result.rejectReason) { + return TPromise.wrapError(result.rejectReason); } - edit.add(result.edits); return edit; }); diff --git a/src/vs/editor/contrib/rename/browser/renameModel.ts b/src/vs/editor/contrib/rename/browser/renameModel.ts index 7fb5db09368..bff9a2d0bb6 100644 --- a/src/vs/editor/contrib/rename/browser/renameModel.ts +++ b/src/vs/editor/contrib/rename/browser/renameModel.ts @@ -180,7 +180,7 @@ export default class RenameModel { var textEditorModel = model.textEditorModel, task: EditTask; - if (textEditorModel.getAssociatedResource().equals(this._sourceModel)) { + if (textEditorModel.getAssociatedResource().toString() === this._sourceModel.toString()) { this._sourceModelTask = new SourceModelEditTask(textEditorModel, this._sourceSelections); task = this._sourceModelTask; } else { diff --git a/src/vs/editor/contrib/rename/common/rename.ts b/src/vs/editor/contrib/rename/common/rename.ts index a511e319128..07746e1bddc 100644 --- a/src/vs/editor/contrib/rename/common/rename.ts +++ b/src/vs/editor/contrib/rename/common/rename.ts @@ -5,7 +5,65 @@ 'use strict'; -import {IRenameSupport} from 'vs/editor/common/modes'; +import {IRenameSupport, IRenameResult} from 'vs/editor/common/modes'; +import {IModel, IPosition} from 'vs/editor/common/editorCommon'; +import {TPromise} from 'vs/base/common/winjs.base'; +import {localize} from 'vs/nls'; +import {sequence} from 'vs/base/common/async'; +import {onUnexpectedError, illegalArgument} from 'vs/base/common/errors'; import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; +import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions'; export const RenameRegistry = new LanguageFeatureRegistry('renameSupport'); + +export function rename(model: IModel, position: IPosition, newName: string): TPromise { + + const supports = RenameRegistry.ordered(model); + const resource = model.getAssociatedResource(); + const rejects: string[] = []; + let hasResult = false; + + const factory = supports.map(support => { + return () => { + if (!hasResult) { + return support.rename(resource, position, newName).then(result => { + if (!result) { + // ignore + } else if (!result.rejectReason) { + hasResult = true; + return result; + } else { + rejects.push(result.rejectReason); + } + }); + } + }; + }); + + return sequence(factory).then(values => { + let result = values[0]; + if (rejects.length > 0) { + return { + currentName: undefined, + edits: undefined, + rejectReason: rejects.join('\n') + }; + } else if (!result) { + return { + currentName: undefined, + edits: undefined, + rejectReason: localize('no result', "No result.") + }; + } else { + return result; + } + }); +} + +CommonEditorRegistry.registerDefaultLanguageCommand('_executeDocumentRenameProvider', function(model, position, args) { + let {newName} = args; + if (typeof newName !== 'string') { + throw illegalArgument('newName'); + } + return rename(model, position, newName); +}); \ No newline at end of file diff --git a/src/vs/editor/contrib/smartSelect/common/tokenSelectionSupport.ts b/src/vs/editor/contrib/smartSelect/common/tokenSelectionSupport.ts index 4fa7aa5f2f4..77a09320dfc 100644 --- a/src/vs/editor/contrib/smartSelect/common/tokenSelectionSupport.ts +++ b/src/vs/editor/contrib/smartSelect/common/tokenSelectionSupport.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import {TPromise} from 'vs/base/common/winjs.base'; import tokenTree = require('./tokenTree'); import EditorCommon = require('vs/editor/common/editorCommon'); @@ -20,7 +20,7 @@ class TokenSelectionSupport implements Modes.ILogicalSelectionSupport { this._modelService = modelService; } - public getRangesToPosition(resource: network.URL, position: EditorCommon.IPosition): TPromise { + public getRangesToPosition(resource: URI, position: EditorCommon.IPosition): TPromise { var model = this._modelService.getModel(resource), entries: Modes.ILogicalSelectionEntry[] = []; diff --git a/src/vs/editor/contrib/suggest/browser/suggestModel.ts b/src/vs/editor/contrib/suggest/browser/suggestModel.ts index 386fec8aa63..9aba39b6f35 100644 --- a/src/vs/editor/contrib/suggest/browser/suggestModel.ts +++ b/src/vs/editor/contrib/suggest/browser/suggestModel.ts @@ -6,18 +6,20 @@ import { TPromise } from 'vs/base/common/winjs.base'; import {sequence} from 'vs/base/common/async'; +import { assign } from 'vs/base/common/objects'; import { EventEmitter, ListenerUnbind } from 'vs/base/common/eventEmitter'; import {onUnexpectedError, isPromiseCanceledError} from 'vs/base/common/errors'; import strings = require('vs/base/common/strings'); import URI from 'vs/base/common/uri'; +import {isFalsyOrEmpty} from 'vs/base/common/arrays'; import timer = require('vs/base/common/timer'); import { getSnippets } from 'vs/editor/common/modes/modesRegistry'; import EditorCommon = require('vs/editor/common/editorCommon'); -import { ISuggestSupport, ISuggestions, ISuggestion, ISorter } from 'vs/editor/common/modes'; -import {DefaultFilter} from 'vs/editor/common/modes/modesFilters'; +import { ISuggestSupport, ISuggestResult, ISuggestion, ISuggestionSorter } from 'vs/editor/common/modes'; +import {DefaultFilter, IMatch} from 'vs/editor/common/modes/modesFilters'; import { CodeSnippet } from 'vs/editor/contrib/snippet/common/snippet'; import { IDisposable, disposeAll } from 'vs/base/common/lifecycle'; -import {SuggestRegistry} from '../common/suggest'; +import {SuggestRegistry, ISuggestResult2, suggest} from '../common/suggest'; enum SuggestState { NOT_ACTIVE = 0, @@ -35,12 +37,14 @@ export class CompletionItem { private static _idPool = 0; public id: string; - public support: ISuggestSupport; public suggestion: ISuggestion; - public container: ISuggestions; + public highlights: IMatch[]; + public support: ISuggestSupport; + public container: ISuggestResult; + private _resolveDetails:TPromise - constructor(support: ISuggestSupport, suggestion: ISuggestion, container:ISuggestions) { + constructor(support: ISuggestSupport, suggestion: ISuggestion, container:ISuggestResult) { this.id = '_completion_item_#' + CompletionItem._idPool++; this.support = support; this.suggestion = suggestion; @@ -53,7 +57,7 @@ export class CompletionItem { this._resolveDetails = TPromise.as(this); } else { this._resolveDetails = this.support.getSuggestionDetails(resource, position, this.suggestion).then(value => { - this.suggestion = value; + this.suggestion = assign(this.suggestion, value); return this; }, err => { if (isPromiseCanceledError(err)) { @@ -76,13 +80,13 @@ class RawModel { public size: number = 0; public incomplete: boolean = false; - insertSuggestions(rank: number, suggestions: ISuggestions[], support: ISuggestSupport): boolean { + insertSuggestions(rank: number, suggestions: ISuggestResult2[]): boolean { if (suggestions) { let items: CompletionItem[] = []; for (let _suggestions of suggestions) { for (let suggestionItem of _suggestions.suggestions) { - items.push(new CompletionItem(support, suggestionItem, _suggestions)); + items.push(new CompletionItem(_suggestions.support, suggestionItem, _suggestions)); } this.size += _suggestions.suggestions.length; @@ -95,36 +99,37 @@ class RawModel { select(ctx: SuggestionContext): CompletionItem[] { let result: CompletionItem[] = []; - let seen: { [codeSnippet: string]: boolean } = Object.create(null); for (let item of this._items) { - RawModel._sortAndFilter(ctx, result, seen, item); + RawModel._sortAndFilter(item, ctx, result); } return result; } - private static _sortAndFilter(ctx: SuggestionContext, bucket: CompletionItem[], seen: { [codeSnippet: string]: boolean }, items: CompletionItem[]): void { - if (items && items.length) { - let compare = RawModel._compare; - let filter = DefaultFilter; - let [item] = items; - if (item.support) { - compare = item.support.getSorter && item.support.getSorter() || compare; - filter = item.support.getFilter && item.support.getFilter() || DefaultFilter; - } - - items = items - .filter(item => { - if (!seen[item.suggestion.codeSnippet]) { - seen[item.suggestion.codeSnippet] = true; - return filter(ctx.wordBefore, item.suggestion) - } - }) - .sort((a, b) => { - return compare(a.suggestion, b.suggestion) - }); - - bucket.push(...items); + private static _sortAndFilter(items: CompletionItem[], ctx: SuggestionContext, bucket: CompletionItem[]): void { + if (isFalsyOrEmpty(items)) { + return; } + + // all items have the same (origin) support. derive sorter and filter + // from first + const [first] = items; + let compare = RawModel._compare; + let filter = DefaultFilter; + if (first.support) { + compare = first.support.getSorter && first.support.getSorter() || compare; + filter = first.support.getFilter && first.support.getFilter() || filter; + } + + items = items.filter(item => { + // set hightlight and filter those that have none + item.highlights = filter(ctx.wordBefore, item.suggestion); + return !isFalsyOrEmpty(item.highlights); + }).sort((a, b) => { + // sort suggestions by custom strategy + return compare(a.suggestion, b.suggestion) + }); + + bucket.push(...items); } private static _compare(a: ISuggestion, b: ISuggestion):number { @@ -384,35 +389,17 @@ export class SuggestModel extends EventEmitter { // Send mode request var $tRequest = timer.start(timer.Topic.EDITOR, 'suggest/REQUEST'); var position = this.editor.getPosition(); - var resource = model.getAssociatedResource(); let raw = new RawModel(); let rank = 0; - let factory = groups.map((supports, index) => { - return () => { - - // stop as soon as a group produced a result - if (raw.size !== 0) { - return; + this.requestPromise = suggest(model, position, triggerCharacter, groups).then(all => { + for (let suggestions of all) { + if (raw.insertSuggestions(rank, suggestions)) { + rank++; } - - // for each support in the group as for suggestions - let promises = supports.map(support => { - return support.suggest(resource, position, triggerCharacter).then(value => { - if (raw.insertSuggestions(rank, value, support)) { - rank++; - } - }, err => { - onUnexpectedError(err); - }); - }); - - return TPromise.join(promises); - }; + } }); - this.requestPromise = sequence(factory).then(() => { }); - this.requestPromise.then(() => { $tRequest.stop(); this.requestPromise = null; @@ -423,7 +410,7 @@ export class SuggestModel extends EventEmitter { var snippets = getSnippets(model, position); if (snippets && snippets.suggestions && snippets.suggestions.length > 0) { - raw.insertSuggestions(rank, [snippets], undefined); + raw.insertSuggestions(rank, [snippets]); } if(raw.size > 0) { @@ -491,7 +478,7 @@ export class SuggestModel extends EventEmitter { private onEditorConfigurationChange(): void { this.autoSuggestDelay = this.editor.getConfiguration().quickSuggestionsDelay; - if (isNaN(this.autoSuggestDelay) || (!this.autoSuggestDelay && this.autoSuggestDelay !== 0) || this.autoSuggestDelay > 2000 || this.autoSuggestDelay < 0) { + if (isNaN(this.autoSuggestDelay) || (!this.autoSuggestDelay && this.autoSuggestDelay !== 0) || this.autoSuggestDelay < 0) { this.autoSuggestDelay = 10; } } diff --git a/src/vs/editor/contrib/suggest/browser/suggestWidget.ts b/src/vs/editor/contrib/suggest/browser/suggestWidget.ts index 34ce3582176..3c75ee04a5c 100644 --- a/src/vs/editor/contrib/suggest/browser/suggestWidget.ts +++ b/src/vs/editor/contrib/suggest/browser/suggestWidget.ts @@ -203,7 +203,7 @@ class Renderer implements Tree.IRenderer { data.colorspan.style.backgroundColor = ''; } - data.highlightedLabel.set(suggestion.label, suggestion.highlights); + data.highlightedLabel.set(suggestion.label, ( element).highlights); data.typeLabel.textContent = suggestion.typeLabel || ''; data.documentationLabel.textContent = suggestion.documentationLabel || ''; } @@ -384,7 +384,7 @@ export class SuggestWidget implements EditorBrowser.IContentWidget { this.updateWidgetHeight(); if (focus) { - this.tree.reveal(focus, (payload && payload.firstSuggestion) ? 0 : null); + return this.tree.reveal(focus, (payload && payload.firstSuggestion) ? 0 : null); } }, Errors.onUnexpectedError); })); @@ -460,8 +460,6 @@ export class SuggestWidget implements EditorBrowser.IContentWidget { this.updateWidgetHeight(); this.show(); - this.resolveDetails(bestSuggestion); - this.telemetryData = this.telemetryData || {}; this.telemetryData.suggestionCount = suggestions.length; this.telemetryData.suggestedIndex = bestSuggestionIndex; diff --git a/src/vs/editor/contrib/suggest/common/suggest.ts b/src/vs/editor/contrib/suggest/common/suggest.ts index 5f86243c407..3b38cd5d408 100644 --- a/src/vs/editor/contrib/suggest/common/suggest.ts +++ b/src/vs/editor/contrib/suggest/common/suggest.ts @@ -4,11 +4,117 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import {ISuggestSupport} from 'vs/editor/common/modes'; +import {sequence} from 'vs/base/common/async'; +import {IModel, IPosition, IRange} from 'vs/editor/common/editorCommon'; +import {TPromise} from 'vs/base/common/winjs.base'; +import {mixin} from 'vs/base/common/objects'; +import {onUnexpectedError, illegalArgument} from 'vs/base/common/errors'; +import {ISuggestSupport, ISuggestResult} from 'vs/editor/common/modes'; import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; +import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions'; export var CONTEXT_SUGGEST_WIDGET_VISIBLE = 'suggestWidgetVisible'; export var CONTEXT_SUGGESTION_SUPPORTS_ACCEPT_ON_KEY = 'suggestionSupportsAcceptOnKey'; export var ACCEPT_SELECTED_SUGGESTION_CMD = 'acceptSelectedSuggestion'; export var SuggestRegistry = new LanguageFeatureRegistry('suggestSupport'); + +export interface ISuggestResult2 extends ISuggestResult { + support?: ISuggestSupport; +} + +export function suggest(model: IModel, position: IPosition, triggerCharacter: string, groups?: ISuggestSupport[][]): TPromise { + + if (!groups) { + groups = SuggestRegistry.orderedGroups(model); + } + + const resource = model.getAssociatedResource(); + const suggestions: ISuggestResult[][] = []; + + const factory = groups.map((supports, index) => { + return () => { + + // stop as soon as a group produced a result + if (suggestions.length > 0) { + return; + } + + // for each support in the group ask for suggestions + let promises = supports.map(support => { + return support.suggest(resource, position, triggerCharacter).then(values => { + + let result: ISuggestResult2[] = []; + for (let suggestResult of values) { + + if (!suggestResult + || !Array.isArray(suggestResult.suggestions) + || suggestResult.suggestions.length === 0) { + + continue; + } + + const suggestions2: ISuggestResult2 = { + support, + currentWord: suggestResult.currentWord, + incomplete: suggestResult.incomplete, + overwriteAfter: suggestResult.overwriteAfter, + overwriteBefore: suggestResult.overwriteBefore, + suggestions: suggestResult.suggestions + } + + const defaultRange: IRange = { + startLineNumber: position.lineNumber, + startColumn: position.column, + endLineNumber: position.lineNumber, + endColumn: position.column + }; + + if (typeof suggestResult.overwriteBefore === 'number' && suggestResult.overwriteBefore > 0) { + defaultRange.startColumn -= suggestResult.overwriteBefore; + } + if (typeof suggestResult.overwriteAfter === 'number' && suggestResult.overwriteAfter > 0) { + defaultRange.endColumn += suggestResult.overwriteAfter + } + + for (let suggestion of suggestResult.suggestions) { + if (!suggestion.textEdit) { + suggestion.textEdit = { + text: suggestion.codeSnippet, + range: defaultRange + }; + } + } + + // add additional properties + mixin(suggestions2, suggestResult, false); + result.push(suggestions2); + } + + return result; + + }, onUnexpectedError); + }); + + return TPromise.join(promises).then(values => { + for (let value of values) { + if (Array.isArray(value) && value.length > 0) { + suggestions.push(value); + } + } + }); + }; + }); + + return sequence(factory).then(() => suggestions); +} + +CommonEditorRegistry.registerDefaultLanguageCommand('_executeCompletionItemProvider', (model, position, args) => { + + let triggerCharacter = args['triggerCharacter']; + if (typeof triggerCharacter !== 'undefined' && typeof triggerCharacter !== 'string') { + throw illegalArgument('triggerCharacter'); + } + + return suggest(model, position, triggerCharacter); +}); \ No newline at end of file diff --git a/src/vs/editor/contrib/wordHighlighter/common/wordHighlighter.ts b/src/vs/editor/contrib/wordHighlighter/common/wordHighlighter.ts index 3b66e3ef597..45f31cc9be9 100644 --- a/src/vs/editor/contrib/wordHighlighter/common/wordHighlighter.ts +++ b/src/vs/editor/contrib/wordHighlighter/common/wordHighlighter.ts @@ -5,17 +5,47 @@ 'use strict'; import {TPromise} from 'vs/base/common/winjs.base'; +import URI from 'vs/base/common/uri'; import * as EditorCommon from 'vs/editor/common/editorCommon'; import {IOccurrencesSupport, IOccurence} from 'vs/editor/common/modes'; import {CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions'; import {Range} from 'vs/editor/common/core/range'; -import {onUnexpectedError} from 'vs/base/common/errors'; +import {onUnexpectedError, illegalArgument} from 'vs/base/common/errors'; import {INullService} from 'vs/platform/instantiation/common/instantiation'; import {sequence} from 'vs/base/common/async'; +import {IModelService} from 'vs/editor/common/services/modelService'; import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; -const DocumentHighlighterRegistry = new LanguageFeatureRegistry('occurrencesSupport'); -export default DocumentHighlighterRegistry; +export const OccurrencesRegistry = new LanguageFeatureRegistry('occurrencesSupport'); + +export function getOccurrencesAtPosition(model: EditorCommon.IModel, position: EditorCommon.IPosition):TPromise { + + const resource = model.getAssociatedResource(); + const orderedByScore = OccurrencesRegistry.ordered(model); + let foundResult = false; + + // in order of score ask the occurrences provider + // until someone response with a good result + // (good = none empty array) + return sequence(orderedByScore.map(provider => { + return () => { + if (!foundResult) { + return provider.findOccurrences(resource, position).then(data => { + if (Array.isArray(data) && data.length > 0) { + foundResult = true; + return data; + } + }, err => { + onUnexpectedError(err); + }); + } + } + })).then(values => { + return values[0] + }); +} + +CommonEditorRegistry.registerDefaultLanguageCommand('_executeDocumentHighlights', getOccurrencesAtPosition); class WordHighlighter { @@ -99,7 +129,7 @@ class WordHighlighter { } // no providers for this model - if(!DocumentHighlighterRegistry.has(this.model)) { + if(!OccurrencesRegistry.has(this.model)) { this._stopAll(); return; } @@ -175,25 +205,7 @@ class WordHighlighter { var myRequestId = ++this.workerRequestTokenId; this.workerRequestCompleted = false; - let foundResult = false; - let orderedByScore = DocumentHighlighterRegistry.ordered(this.model); - let resource = this.model.getAssociatedResource(); - let position = this.editor.getPosition(); - - // in order of score ask the occurrences provider - // until someone response with a good result - // (good = none empty array) - this.workerRequest = sequence(orderedByScore.map(provider => { - return () => { - if (!foundResult) { - return provider.findOccurrences(resource, position).then(data => { - if (Array.isArray(data) && data.length > 0) { - return data; - } - }); - } - } - })).then(values => values[0]); + this.workerRequest = getOccurrencesAtPosition(this.model, this.editor.getPosition()); this.workerRequest.then(data => { if (myRequestId === this.workerRequestTokenId) { diff --git a/src/vs/editor/css/hc-white-theme.css b/src/vs/editor/css/hc-white-theme.css deleted file mode 100644 index 1665544a9e6..00000000000 --- a/src/vs/editor/css/hc-white-theme.css +++ /dev/null @@ -1,130 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -/* The editor */ -.monaco-editor.hc-white, -.monaco-editor.hc-white .zone-widget .monaco-editor { - color: #000; - background: #fff; -} - -/* Background */ -.monaco-editor.hc-white .monaco-editor-background { - background: #fff; -} - -/* Highlight a line */ -.monaco-editor.hc-white .focus-mode { - background-color: #1E1E1E; - opacity: 0.333; -} - -/* Caret */ -.monaco-editor.hc-white .cursor { - background: #000; -} - -/* Current line */ -.monaco-editor.hc-white .current-line { - background: #fff; - border: 2px solid #EEE; - box-sizing: border-box; -} -.monaco-editor.hc-white.focused .current-line { - background: #fff; - border: 2px solid #EEE; - box-sizing: border-box; -} - -/* Highlight a line */ -.monaco-editor.hc-white .lineHighlight { - background-color: rgba(243, 240, 245, 0.2); -} - -/* Selection */ -.monaco-editor.hc-white .view-overlays.focused .selected-text { - background: #3399FF; -} -.monaco-editor.hc-white .view-overlays .selected-text { - background: #BFCDDB; -} - -/* Line Numbers */ -.monaco-editor.hc-white .line-numbers { - color: #2B91AF; -} - -/* Diff Editor overview */ -.monaco-diff-editor.hc-white .diffOverview { - background-color: #fff; -} -.monaco-scrollable-element.hc-white.modified-in-monaco-diff-editor .scrollbar { - background: rgba(0,0,0,0); -} - -/* ---------- Word Highlight ---------- */ -.monaco-editor.hc-white .wordHighlight { - background-color: #E2E6D6; -/* -webkit-animation-duration: 0.2s; - -webkit-animation-name: darkWordHighlight; - -moz-animation-duration: 0.2s; - -moz-animation-name: darkWordHighlight; - -ms-animation-duration: 0.2s; - -ms-animation-name: darkWordHighlight; - animation-duration: 0.2s; - animation-name: darkWordHighlight;*/ -} - -/*@-webkit-keyframes darkWordHighlight { from { background-color: inherit; } to { background-color: #E2E6D6; } } -@-moz-keyframes darkWordHighlight { from { background-color: inherit; } to { background-color: #E2E6D6; } } -@-ms-keyframes darkWordHighlight { from { background-color: inherit; } to { background-color: #E2E6D6; } } -@keyframes darkWordHighlight { from { background-color: inherit; } to { background-color: #E2E6D6; } }*/ - -/* Hover */ -.monaco-editor.hc-white .editor-hover { - color: #D5D8D6; - box-shadow: none; -} - -/* Bracket Match */ -.monaco-editor.hc-white .bracket-match { box-shadow: inset 0 0 0 1px #000; } - -/* Linked Editing */ -.monaco-editor.hc-white .linked-editing { box-shadow: inset 0 0 0 1px #000; } - -/* Snippets */ -.monaco-editor.hc-white .new-snippet { background-color: rgba(100, 105, 110, 0.1); } -.monaco-editor.hc-white .snippet-placeholder { background-color: rgba(124, 124, 124, 0.1); } -.monaco-editor.hc-white .finish-snippet-placeholder { outline: #525252 solid 1px; } - -/* Scrollbar */ -.monaco-scrollable-element.hc-white .slider { - background: rgba(121, 121, 121, .4); -} -.monaco-scrollable-element.hc-white .slider.active { - background: rgba(191, 191, 191, .4); -} - -/* RWC */ -.hc-white .monaco-findInput > .custom-checkbox { - color: #848484; - border-color: #848484; -} - -.hc-white .monaco-findInput > .custom-checkbox:hover { - color: #D4D4D4; - border-color: #D4D4D4; -} - -.hc-white .monaco-findInput > .custom-checkbox.checked { - color: #D4D4D4; - border-color: #D4D4D4; -} - -.monaco-editor.hc-white .findMatch { - background-color: #F6B94D; -} - - -/* Tokens colors are defined in tokens.css */ \ No newline at end of file diff --git a/src/vs/editor/standalone-languages/csharp.ts b/src/vs/editor/standalone-languages/csharp.ts index 4e8d11d72bd..d145275864a 100644 --- a/src/vs/editor/standalone-languages/csharp.ts +++ b/src/vs/editor/standalone-languages/csharp.ts @@ -51,7 +51,7 @@ export var language = { 'internal', 'private', 'abstract', 'sealed', 'static', 'struct', 'readonly', 'volatile', 'virtual', 'override', 'params', 'get', 'set', 'add', 'remove', 'operator', 'true', 'false', 'implicit', 'explicit', 'interface', 'enum', - 'null', 'async', 'await' + 'null', 'async', 'await','fixed','sizeof','stackalloc','unsafe' ], namespaceFollows: [ diff --git a/src/vs/editor/standalone-languages/lua.ts b/src/vs/editor/standalone-languages/lua.ts index 60dfc48facc..fca9794696c 100644 --- a/src/vs/editor/standalone-languages/lua.ts +++ b/src/vs/editor/standalone-languages/lua.ts @@ -18,7 +18,7 @@ export var language = { keywords: [ 'and', 'break', 'do', 'else', 'elseif', - 'end', 'false', 'for', 'function', 'if', + 'end', 'false', 'for', 'function', 'goto', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while' diff --git a/src/vs/editor/test/common/model/editableTextModel.test.ts b/src/vs/editor/test/common/model/editableTextModel.test.ts index eeae4109e0f..c1f09732675 100644 --- a/src/vs/editor/test/common/model/editableTextModel.test.ts +++ b/src/vs/editor/test/common/model/editableTextModel.test.ts @@ -13,7 +13,7 @@ import {TextModel} from 'vs/editor/common/model/textModel'; import {LineMarker, TextModelWithMarkers} from 'vs/editor/common/model/textModelWithMarkers'; import {ILineMarker} from 'vs/editor/common/model/modelLine'; import {PluginHostDocument} from 'vs/workbench/api/common/pluginHostDocuments'; -import {MirrorModel} from 'vs/editor/common/model/mirrorModel'; +import {MirrorModel, IMirrorModelEvents} from 'vs/editor/common/model/mirrorModel'; suite('EditorModel - EditableTextModel._getInverseEdits', () => { @@ -1139,6 +1139,41 @@ suite('EditorModel - EditableTextModel.applyEdits', () => { ); }); + test('issue #144', () => { + testApplyEdits( + [ + 'package caddy', + '', + 'func main() {', + '\tfmt.Println("Hello World! :)")', + '}', + '' + ], + [ + editOp(1, 1, 6, 1, [ + 'package caddy', + '', + 'import "fmt"', + '', + 'func main() {', + '\tfmt.Println("Hello World! :)")', + '}', + '' + ]) + ], + [ + 'package caddy', + '', + 'import "fmt"', + '', + 'func main() {', + '\tfmt.Println("Hello World! :)")', + '}', + '' + ] + ); + }); + function assertSyncedModels(text:string, callback:(model:EditableTextModel, assertMirrorModels:()=>void)=>void, setup:(model:EditableTextModel)=>void = null): void { var model = new EditableTextModel([], TextModel.toRawText(text), null); model.setEOL(EditorCommon.EndOfLineSequence.LF); @@ -1159,8 +1194,11 @@ suite('EditorModel - EditableTextModel.applyEdits', () => { console.warn('Model version id did not advance between edits (1)'); } mirrorModel1PrevVersionId = versionId; - (e).type = EditorCommon.EventType.ModelContentChanged; - mirrorModel1.onEvents([e]); + let mirrorModelEvents:IMirrorModelEvents = { + propertiesChanged: null, + contentChanged: [e] + }; + mirrorModel1.onEvents(mirrorModelEvents); }); model.addListener(EditorCommon.EventType.ModelContentChanged2, (e:EditorCommon.IModelContentChangedEvent2) => { diff --git a/src/vs/editor/test/common/model/mirrorModel.test.ts b/src/vs/editor/test/common/model/mirrorModel.test.ts index 60b60229cd2..bbc608fa292 100644 --- a/src/vs/editor/test/common/model/mirrorModel.test.ts +++ b/src/vs/editor/test/common/model/mirrorModel.test.ts @@ -21,6 +21,57 @@ function equalRange(left, right) { assert.ok(true, 'ranges'); }; +function contentChangedFlushEvent(detail: EditorCommon.IRawText): EditorCommon.IModelContentChangedFlushEvent { + return { + changeType: EditorCommon.EventType.ModelContentChangedFlush, + isRedoing: false, + isUndoing: false, + versionId: 0, + detail: detail + }; +} + +function contentChangedLinesDeletedEvent(fromLineNumber: number, toLineNumber: number): EditorCommon.IModelContentChangedLinesDeletedEvent { + return { + changeType: EditorCommon.EventType.ModelContentChangedLinesDeleted, + isRedoing: false, + isUndoing: false, + versionId: 0, + fromLineNumber: fromLineNumber, + toLineNumber: toLineNumber + }; +} + +function contentChangedLinesInsertedEvent(fromLineNumber: number, toLineNumber: number, detail: string): EditorCommon.IModelContentChangedLinesInsertedEvent { + return { + changeType: EditorCommon.EventType.ModelContentChangedLinesInserted, + isRedoing: false, + isUndoing: false, + versionId: 0, + fromLineNumber: fromLineNumber, + toLineNumber: toLineNumber, + detail: detail + }; +} + +function contentChangedLineChanged(lineNumber: number, detail: string): EditorCommon.IModelContentChangedLineChangedEvent { + return { + changeType: EditorCommon.EventType.ModelContentChangedLineChanged, + isRedoing: false, + isUndoing: false, + versionId: 0, + lineNumber: lineNumber, + detail: detail + }; +} + +function mirrorModelEvents(contentChanged:EditorCommon.IModelContentChangedEvent[]): MirrorModel.IMirrorModelEvents { + return { + propertiesChanged: null, + contentChanged: contentChanged + }; +} + suite('Editor Model - MirrorModel', () => { var mirrorModel:MirrorModel.MirrorModel; @@ -46,19 +97,16 @@ suite('Editor Model - MirrorModel', () => { assert.equal(mirrorModel.getLineStart(2), 6); assert.equal(mirrorModel.getLineStart(3), 12); - var e = { - type: EditorCommon.EventType.ModelContentChanged, - changeType: EditorCommon.EventType.ModelContentChangedFlush, - detail: { - lines: [ - 'foo', - 'bar' - ], - BOM: '', - EOL: '\n' - } - }; - mirrorModel.onEvents([e]); + mirrorModel.onEvents(mirrorModelEvents([contentChangedFlushEvent({ + length: -1, + lines: [ + 'foo', + 'bar' + ], + BOM: '', + EOL: '\n' + })])); + assert.equal(mirrorModel.getLineStart(1), 0); assert.equal(mirrorModel.getLineStart(2), 4); }); @@ -170,14 +218,9 @@ suite('Editor Model - MirrorModel Eventing', () => { }); test('delete single line', () => { - var e = { - type: EditorCommon.EventType.ModelContentChanged, - changeType: EditorCommon.EventType.ModelContentChangedLinesDeleted, - fromLineNumber: 3, - toLineNumber: 3 - }; assert.equal(mirrorModel.getLineContent(3), 'line three'); - mirrorModel.onEvents([e]); + + mirrorModel.onEvents(mirrorModelEvents([contentChangedLinesDeletedEvent(3, 3)])); assert.equal(mirrorModel.getLineContent(3), 'line four'); var words = mirrorModel.getAllWords(); @@ -191,13 +234,8 @@ suite('Editor Model - MirrorModel Eventing', () => { }); test('delete multiple lines', () => { - var e = { - type: EditorCommon.EventType.ModelContentChanged, - changeType: EditorCommon.EventType.ModelContentChangedLinesDeleted, - fromLineNumber: 1, - toLineNumber: 2 - }; - mirrorModel.onEvents([e]); + mirrorModel.onEvents(mirrorModelEvents([contentChangedLinesDeletedEvent(1, 2)])); + assert.equal(mirrorModel.getLineContent(1), 'line three'); assert.equal(mirrorModel.getLineContent(2), 'line four'); var words = mirrorModel.getAllWords(); @@ -220,13 +258,8 @@ suite('Editor Model - MirrorModel Eventing', () => { }); test('delete all lines', () => { - var e = { - type: EditorCommon.EventType.ModelContentChanged, - changeType: EditorCommon.EventType.ModelContentChangedLinesDeleted, - fromLineNumber: 1, - toLineNumber: 4 - }; - mirrorModel.onEvents([e]); + mirrorModel.onEvents(mirrorModelEvents([contentChangedLinesDeletedEvent(1, 4)])); + var words = mirrorModel.getAllWords(); assert.equal(words.length, 0); var wordsWithRanges = mirrorModel.getAllWordsWithRange(); @@ -234,16 +267,10 @@ suite('Editor Model - MirrorModel Eventing', () => { }); test('add single lines', () => { - var e = { - type: EditorCommon.EventType.ModelContentChanged, - changeType: EditorCommon.EventType.ModelContentChangedLinesInserted, - fromLineNumber: 1, - toLineNumber: 1, - detail: 'foo bar\nbar foo' - }; - assert.equal(mirrorModel.getLineContent(1), 'line one'); - mirrorModel.onEvents([e]); + + mirrorModel.onEvents(mirrorModelEvents([contentChangedLinesInsertedEvent(1, 1, 'foo bar\nbar foo')])); + assert.equal(mirrorModel.getLineContent(1), 'foo bar'); assert.equal(mirrorModel.getLineContent(2), 'line one'); @@ -257,16 +284,10 @@ suite('Editor Model - MirrorModel Eventing', () => { test('add multiple lines', () => { - var e = { - type: EditorCommon.EventType.ModelContentChanged, - changeType: EditorCommon.EventType.ModelContentChangedLinesInserted, - fromLineNumber: 1, - toLineNumber: 2, - detail: 'foo bar\nbar foo' - }; - assert.equal(mirrorModel.getLineContent(1), 'line one'); - mirrorModel.onEvents([e]); + + mirrorModel.onEvents(mirrorModelEvents([contentChangedLinesInsertedEvent(1, 2, 'foo bar\nbar foo')])); + assert.equal(mirrorModel.getLineContent(1), 'foo bar'); assert.equal(mirrorModel.getLineContent(2), 'bar foo'); assert.equal(mirrorModel.getLineContent(3), 'line one'); @@ -284,16 +305,11 @@ suite('Editor Model - MirrorModel Eventing', () => { }); test('change line', () => { - var e = { - type: EditorCommon.EventType.ModelContentChanged, - changeType: EditorCommon.EventType.ModelContentChangedLineChanged, - lineNumber: 1, - detail: 'foobar' - }; assert.equal(mirrorModel.getLineContent(1), 'line one'); var wordsWithRanges = mirrorModel.getAllWordsWithRange(); assert.equal(wordsWithRanges.length, 8); - mirrorModel.onEvents([e]); + + mirrorModel.onEvents(mirrorModelEvents([contentChangedLineChanged(1, 'foobar')])); assert.equal(mirrorModel.getLineContent(1), 'foobar'); wordsWithRanges = mirrorModel.getAllWordsWithRange(); @@ -305,19 +321,17 @@ suite('Editor Model - MirrorModel Eventing', () => { test('flush model', () => { assert.equal(mirrorModel.getLineContent(1), 'line one'); assert.equal(mirrorModel.getLineContent(2), 'line two'); - var e = { - type: EditorCommon.EventType.ModelContentChanged, - changeType: EditorCommon.EventType.ModelContentChangedFlush, - detail: { - lines: [ - 'foo', - 'bar' - ], - BOM: '', - EOL: '\n' - } - }; - mirrorModel.onEvents([e]); + + mirrorModel.onEvents(mirrorModelEvents([contentChangedFlushEvent({ + length: -1, + lines: [ + 'foo', + 'bar' + ], + BOM: '', + EOL: '\n' + })])); + assert.equal(mirrorModel.getLineContent(1), 'foo'); assert.equal(mirrorModel.getLineContent(2), 'bar'); var wordsWithRanges = mirrorModel.getAllWordsWithRange(); diff --git a/src/vs/editor/test/common/modes/languageSelector.test.ts b/src/vs/editor/test/common/modes/languageSelector.test.ts index dbc4c890356..885fda27243 100644 --- a/src/vs/editor/test/common/modes/languageSelector.test.ts +++ b/src/vs/editor/test/common/modes/languageSelector.test.ts @@ -7,45 +7,45 @@ import * as assert from 'assert'; import URI from 'vs/base/common/uri'; -import {score, ModelLike} from 'vs/editor/common/modes/languageSelector'; +import {score} from 'vs/editor/common/modes/languageSelector'; suite('LanguageSelector', function() { - let model: ModelLike = { + let model = { language: 'farboo', uri: URI.parse('file:///testbed/file.fb') } test('score, invalid selector', function() { - assert.equal(score({}, model), 0); - assert.equal(score(undefined, model), undefined); - assert.equal(score(null, model), undefined); - assert.equal(score('', model), 0); + assert.equal(score({}, model.uri, model.language), 0); + assert.equal(score(undefined, model.uri, model.language), undefined); + assert.equal(score(null, model.uri, model.language), undefined); + assert.equal(score('', model.uri, model.language), 0); }); test('score, any language', function() { - assert.equal(score({ language: '*'}, model), 5); - assert.equal(score('*', model), 5); + assert.equal(score({ language: '*'}, model.uri, model.language), 5); + assert.equal(score('*', model.uri, model.language), 5); }); test('score, filter', function() { - assert.equal(score('farboo', model), 10); - assert.equal(score({ language: 'farboo'}, model), 10); - assert.equal(score({ language: 'farboo', scheme: 'file' }, model), 20); - assert.equal(score({ language: 'farboo', scheme: 'http' }, model), 0); + assert.equal(score('farboo', model.uri, model.language), 10); + assert.equal(score({ language: 'farboo'}, model.uri, model.language), 10); + assert.equal(score({ language: 'farboo', scheme: 'file' }, model.uri, model.language), 20); + assert.equal(score({ language: 'farboo', scheme: 'http' }, model.uri, model.language), 0); - assert.equal(score({ pattern: '**/*.fb' }, model), 5); - // assert.equal(score({ pattern: '/testbed/file.fb' }, model), 10); fails on windows + assert.equal(score({ pattern: '**/*.fb' }, model.uri, model.language), 5); + // assert.equal(score({ pattern: '/testbed/file.fb' }, model.uri, model.language), 10); fails on windows }); test('score, max(filters)', function() { let match = { language: 'farboo', scheme: 'file' }; let fail = { language: 'farboo', scheme: 'http' }; - assert.equal(score(match, model), 20); - assert.equal(score(fail, model), 0); - assert.equal(score([match, fail], model), 20); - assert.equal(score(['farboo', '*'], model), 10); - assert.equal(score(['*', 'farboo'], model), 10); + assert.equal(score(match, model.uri, model.language), 20); + assert.equal(score(fail, model.uri, model.language), 0); + assert.equal(score([match, fail], model.uri, model.language), 20); + assert.equal(score(['farboo', '*'], model.uri, model.language), 10); + assert.equal(score(['*', 'farboo'], model.uri, model.language), 10); }); }); \ No newline at end of file diff --git a/src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts b/src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts index 525767021ac..7451b1737cc 100644 --- a/src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts +++ b/src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts @@ -84,4 +84,8 @@ class Mode implements modes.IMode { public getId(): string { return "testMode"; } + + public toSimplifiedMode(): modes.IMode { + return this; + } } diff --git a/src/vs/editor/test/common/modes/tokenization.test.ts b/src/vs/editor/test/common/modes/tokenization.test.ts index b1416d43323..3854a550cef 100644 --- a/src/vs/editor/test/common/modes/tokenization.test.ts +++ b/src/vs/editor/test/common/modes/tokenization.test.ts @@ -44,6 +44,10 @@ export class Mode implements modes.IMode { public getId(): string { return "testMode"; } + + public toSimplifiedMode(): modes.IMode { + return this; + } } @@ -114,6 +118,10 @@ export class SwitchingMode implements modes.IMode { return this._id; } + public toSimplifiedMode(): modes.IMode { + return this; + } + public addSupportChangedListener(callback: (e: EditorCommon.IModeSupportChangedEvent) => void): IDisposable { return EmptyDisposable; } diff --git a/src/vs/editor/test/common/modesTestUtils.ts b/src/vs/editor/test/common/modesTestUtils.ts index ef974978919..cdb3a85aa35 100644 --- a/src/vs/editor/test/common/modesTestUtils.ts +++ b/src/vs/editor/test/common/modesTestUtils.ts @@ -7,6 +7,25 @@ import modes = require('vs/editor/common/modes'); import {Arrays} from 'vs/editor/common/core/arrays'; +class SimpleTokenTypeClassificationMode implements modes.IMode { + + private _id:string; + public tokenTypeClassificationSupport: modes.ITokenTypeClassificationSupport; + + constructor(id:string, tokenTypeClassificationSupport: modes.ITokenTypeClassificationSupport) { + this._id = id; + this.tokenTypeClassificationSupport = tokenTypeClassificationSupport; + } + + public getId(): string { + return this._id; + } + + public toSimplifiedMode(): modes.IMode { + return this; + } +} + export function createMockMode(id:string, wordRegExp:RegExp = null):modes.IMode { var tokenTypeClassificationSupport: modes.ITokenTypeClassificationSupport; if (wordRegExp) { @@ -14,10 +33,7 @@ export function createMockMode(id:string, wordRegExp:RegExp = null):modes.IMode getWordDefinition: () => wordRegExp }; } - return { - getId: () => id, - tokenTypeClassificationSupport: tokenTypeClassificationSupport - }; + return new SimpleTokenTypeClassificationMode(id, tokenTypeClassificationSupport); } export interface TokenText { diff --git a/src/vs/editor/test/common/modesUtil.ts b/src/vs/editor/test/common/modesUtil.ts index 4726b0ae1b6..5ea5bb37704 100644 --- a/src/vs/editor/test/common/modesUtil.ts +++ b/src/vs/editor/test/common/modesUtil.ts @@ -87,11 +87,28 @@ export interface IOnEnterAsserter { indentsOutdents(oneLineAboveText:string, beforeText:string, afterText:string): void; } +class SimpleMode implements modes.IMode { + + private _id:string; + + constructor(id:string) { + this._id = id; + } + + public getId(): string { + return this._id; + } + + public toSimplifiedMode(): modes.IMode { + return this; + } +} + export function createOnEnterAsserter(modeId:string, onEnterSupport: modes.IOnEnterSupport): IOnEnterAsserter { var assertOne = (oneLineAboveText:string, beforeText:string, afterText:string, expected: modes.IndentAction) => { var model = new Model( [ oneLineAboveText, beforeText + afterText ].join('\n'), - { getId: () => modeId } + new SimpleMode(modeId) ); var actual = onEnterSupport.onEnter(model, { lineNumber: 2, column: beforeText.length + 1 }); if (expected === modes.IndentAction.None) { @@ -130,9 +147,7 @@ export function executeMonarchTokenizationTests(name:string, language:monarchTyp var modeService = servicesUtil.createMockModeService(); - var tokenizationSupport = monarchLexer.createTokenizationSupport(modeService, { - getId: () => 'mock.mode' - }, lexer); + var tokenizationSupport = monarchLexer.createTokenizationSupport(modeService, new SimpleMode('mock.mode'), lexer); executeTests(tokenizationSupport, tests); } diff --git a/src/vs/editor/test/common/services/resourceService.test.ts b/src/vs/editor/test/common/services/resourceService.test.ts index 726f705c10c..cffcb0c5fa8 100644 --- a/src/vs/editor/test/common/services/resourceService.test.ts +++ b/src/vs/editor/test/common/services/resourceService.test.ts @@ -5,7 +5,7 @@ 'use strict'; import assert = require('assert'); -import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import Emit = require('vs/base/common/eventEmitter'); import Service = require('vs/editor/common/services/resourceServiceImpl'); import MirrorModel = require('vs/editor/common/model/mirrorModel'); @@ -17,18 +17,18 @@ suite('Editor Services - ResourceService', () => { var service = new Service.ResourceService(); - service.insert(new Network.URL('test://1'), MirrorModel.createMirrorModelFromString(null, 1, 'hi', null)); + service.insert(URI.parse('test://1'), MirrorModel.createMirrorModelFromString(null, 1, 'hi', null)); assert.equal(service.all().length, 1); - service.insert(new Network.URL('test://2'), MirrorModel.createMirrorModelFromString(null, 1, 'hi', null)); + service.insert(URI.parse('test://2'), MirrorModel.createMirrorModelFromString(null, 1, 'hi', null)); assert.equal(service.all().length, 2); - assert.ok(service.contains(new Network.URL('test://1'))); - assert.ok(service.contains(new Network.URL('test://2'))); + assert.ok(service.contains(URI.parse('test://1'))); + assert.ok(service.contains(URI.parse('test://2'))); - service.remove(new Network.URL('test://1')); - service.remove(new Network.URL('test://1')); - service.remove(new Network.URL('test://2')); + service.remove(URI.parse('test://1')); + service.remove(URI.parse('test://1')); + service.remove(URI.parse('test://2')); assert.equal(service.all().length, 0); }); @@ -37,7 +37,7 @@ suite('Editor Services - ResourceService', () => { var eventCnt = 0; - var url = new Network.URL('far'); + var url = URI.parse('far'); var element = MirrorModel.createMirrorModelFromString(null, 1, 'hi', null); var service = new Service.ResourceService(); service.addListener(resourceService.ResourceEvents.ADDED, () => { @@ -58,7 +58,7 @@ suite('Editor Services - ResourceService', () => { var eventCnt = 0; - var url = new Network.URL('far'); + var url = URI.parse('far'); var element = MirrorModel.createMirrorModelFromString(null, 1, 'hi', null); var event = {}; diff --git a/src/vs/editor/test/common/testModes.ts b/src/vs/editor/test/common/testModes.ts index af9503e0d68..e9c097da553 100644 --- a/src/vs/editor/test/common/testModes.ts +++ b/src/vs/editor/test/common/testModes.ts @@ -76,6 +76,10 @@ export class TestingMode implements modes.IMode { public getId():string { return 'testing'; } + + public toSimplifiedMode(): modes.IMode { + return this; + } } export class AbstractIndentingMode extends TestingMode { diff --git a/src/vs/languages/css/common/css.ts b/src/vs/languages/css/common/css.ts index 1038124112e..00e31d1ae45 100644 --- a/src/vs/languages/css/common/css.ts +++ b/src/vs/languages/css/common/css.ts @@ -7,11 +7,12 @@ import WinJS = require('vs/base/common/winjs.base'); import supports = require('vs/editor/common/modes/supports'); import objects = require('vs/base/common/objects'); -import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); import {OneWorkerAttr} from 'vs/platform/thread/common/threadService'; import cssWorker = require('vs/languages/css/common/cssWorker'); +import cssTokenTypes = require('vs/languages/css/common/cssTokenTypes'); import {AbstractMode} from 'vs/editor/common/modes/abstractMode'; import {AbstractState} from 'vs/editor/common/modes/abstractState'; import {AsyncDescriptor2, createAsyncDescriptor2} from 'vs/platform/instantiation/common/descriptors'; @@ -32,6 +33,8 @@ export enum States { MetaInUrlFunction, } +export { cssTokenTypes }; + var identRegEx = /^-?-?([a-zA-Z]|(\\(([0-9a-fA-F]{1,6}\s?)|[^[0-9a-fA-F])))([\w\-]|(\\(([0-9a-fA-F]{1,6}\s?)|[^[0-9a-fA-F])))*/; export class State extends AbstractState { @@ -131,13 +134,13 @@ export class State extends AbstractState { switch (this.kind) { case States.ValuePostUrl: if (ch === '(') { - return this.nextState(States.ValueInUrlFunction, { type:'punctuation.parenthesis.css', bracket: Modes.Bracket.Open }); + return this.nextState(States.ValueInUrlFunction, { type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Open }); } this.kind = States.Value; break; case States.MetaPostUrl: if (ch === '(') { - return this.nextState(States.MetaInUrlFunction, { type:'punctuation.parenthesis.css', bracket: Modes.Bracket.Open }); + return this.nextState(States.MetaInUrlFunction, { type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Open }); } this.kind = States.Meta; break; @@ -155,32 +158,32 @@ export class State extends AbstractState { switch (this.kind) { case States.Selector: if (ch === '{') { - return this.nextState(States.Rule, { type:'punctuation.bracket.css', bracket: Modes.Bracket.Open }); + return this.nextState(States.Rule, { type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open }); } if (ch === '(' || ch === ')') { - return { type:'punctuation.parenthesis.css', bracket: ch === '(' ? Modes.Bracket.Open : Modes.Bracket.Close }; + return { type: 'punctuation.parenthesis.css', bracket: ch === '(' ? Modes.Bracket.Open : Modes.Bracket.Close }; } if (ch === '@' && !this.inMeta) { //@import, @media, @key-word-animation stream.advanceIfRegExp2(identRegEx); - return this.nextState(States.Meta, { type:'keyword.css' }); + return this.nextState(States.Meta, { type: cssTokenTypes.TOKEN_AT_KEYWORD + '.css' }); } if (ch === '}' && this.inMeta) { //@import, @media, @key-word-animation this.inMeta = false; - return this.nextState(States.Selector, { type:'punctuation.bracket.css', bracket: Modes.Bracket.Close }); + return this.nextState(States.Selector, { type: 'punctuation.bracket.css', bracket: Modes.Bracket.Close }); } if (/[\*\(\)\[\]\+>=\~\|;]/.test(ch)) { - return { type:'punctuation.css' }; + return { type: 'punctuation.css' }; } if (ch === '#') { stream.advanceIfRegExp2(identRegEx); - return { type:'entity.other.attribute-name.id.css' }; + return { type: cssTokenTypes.TOKEN_SELECTOR + '.id.css' }; } if (ch === '.') { stream.advanceIfRegExp2(identRegEx); - return { type:'entity.other.attribute-name.class.css' }; + return { type: cssTokenTypes.TOKEN_SELECTOR + '.class.css' }; } this.consumeIdent(stream); - return { type:'entity.name.tag.css' }; + return { type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' }; case States.Meta: if (ch === '{') { @@ -188,74 +191,74 @@ export class State extends AbstractState { if (this.inMeta) { nextState = States.Selector; } - return this.nextState(nextState, { type:'punctuation.bracket.css', bracket: Modes.Bracket.Open }); + return this.nextState(nextState, { type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open }); } if (ch === '(' || ch === ')') { - return { type:'punctuation.parenthesis.css', bracket: ch === '(' ? Modes.Bracket.Open : Modes.Bracket.Close }; + return { type: 'punctuation.parenthesis.css', bracket: ch === '(' ? Modes.Bracket.Open : Modes.Bracket.Close }; } if (ch === ';') { if (this.metaBraceCount === 0) { this.inMeta = false; } - return this.nextState(States.Selector, { type:'punctuation.css' }); + return this.nextState(States.Selector, { type: 'punctuation.css' }); } if ((ch === 'u' || ch === 'U') && stream.advanceIfStringCaseInsensitive2('rl')) { stream.advanceIfStringCaseInsensitive2('-prefix'); // support 'url-prefix' (part of @-mox-document) - return this.nextState(States.MetaPostUrl, { type:'meta.property-value.css' }); + return this.nextState(States.MetaPostUrl, { type: cssTokenTypes.TOKEN_VALUE + '.css' }); } if (/[\*\(\)\[\]\+>=\~\|]/.test(ch)) { - return { type:'punctuation.css' }; + return { type: 'punctuation.css' }; } this.inMeta = true; this.consumeIdent(stream); - return { type:'meta.property-value.css' }; + return { type: cssTokenTypes.TOKEN_VALUE + '.css' }; case States.Rule: if (ch === '}') { - return this.nextState(States.Selector, { type:'punctuation.bracket.css', bracket: Modes.Bracket.Close }); + return this.nextState(States.Selector, { type: 'punctuation.bracket.css', bracket: Modes.Bracket.Close }); } if (ch === ':') { - return this.nextState(States.Value, { type:'punctuation.css' }); + return this.nextState(States.Value, { type: 'punctuation.css' }); } if (ch === '(' || ch === ')') { - return { type:'punctuation.parenthesis.css', bracket: ch === '(' ? Modes.Bracket.Open : Modes.Bracket.Close }; + return { type: 'punctuation.parenthesis.css', bracket: ch === '(' ? Modes.Bracket.Open : Modes.Bracket.Close }; } this.consumeIdent(stream); - return { type:'support.type.property-name.css' }; + return { type: cssTokenTypes.TOKEN_PROPERTY + '.css' }; case States.Value: if (ch === '}') { - return this.nextState(States.Selector, { type:'punctuation.bracket.css', bracket: Modes.Bracket.Close }); + return this.nextState(States.Selector, { type: 'punctuation.bracket.css', bracket: Modes.Bracket.Close }); } if (ch === ';') { - return this.nextState(States.Rule, { type:'punctuation.css' }); + return this.nextState(States.Rule, { type: 'punctuation.css' }); } if ((ch === 'u' || ch === 'U') && stream.advanceIfStringCaseInsensitive2('rl')) { - return this.nextState(States.ValuePostUrl, { type:'meta.property-value.css' }); + return this.nextState(States.ValuePostUrl, { type: cssTokenTypes.TOKEN_VALUE + '.css' }); } if (ch === '(' || ch === ')') { - return { type:'punctuation.parenthesis.css', bracket: ch === '(' ? Modes.Bracket.Open : Modes.Bracket.Close }; + return { type: 'punctuation.parenthesis.css', bracket: ch === '(' ? Modes.Bracket.Open : Modes.Bracket.Close }; } if (ch === ',') { - return { type:'punctuation.css' }; + return { type: 'punctuation.css' }; } if (ch === '#') { stream.advanceIfRegExp2(/^[\w]*/); - return { type:'meta.property-value.hex.css' }; + return { type: cssTokenTypes.TOKEN_VALUE + '.hex.css' }; } if (/\d/.test(ch) || (/-|\+/.test(ch) && !stream.eos() && /\d/.test(stream.peek()))) { stream.advanceIfRegExp2(/^[\d\.]*/); - return this.nextState(States.Unit, { type:'meta.property-value.numeric.css' }); + return this.nextState(States.Unit, { type: cssTokenTypes.TOKEN_VALUE + '.numeric.css' }); } if (ch === '!') { - return { type:'meta.property-value.keyword.css' }; // ! + return { type: cssTokenTypes.TOKEN_VALUE + '.keyword.css' }; // ! } if ((ch === 'i' || ch === 'I') && stream.advanceIfStringCaseInsensitive2('mportant')) { - return { type:'meta.property-value.keyword.css' }; // important + return { type: cssTokenTypes.TOKEN_VALUE + '.keyword.css' }; // important } if (this.consumeIdent(stream)) { - return { type:'meta.property-value.css' }; + return { type: cssTokenTypes.TOKEN_VALUE + '.css' }; } break; @@ -263,7 +266,7 @@ export class State extends AbstractState { // css units - see: http://www.w3.org/TR/css3-values/#font-relative-lengths stream.goBack(1); if(stream.advanceIfRegExp2(/^(em|ex|ch|rem|vw|vh|vm|cm|mm|in|px|pt|pc|deg|grad|rad|turn|s|ms|Hz|kHz|%)/)) { - return { type:'meta.property-value.unit.css' }; + return { type: cssTokenTypes.TOKEN_VALUE + '.unit.css' }; } // no unit, back to value state this.nextState(States.Value, null); @@ -299,17 +302,17 @@ export class CSSMode extends AbstractMode { getInitialState: () => new State(this, States.Selector, false, null, false, 0) }, false, false); this.electricCharacterSupport = new supports.BracketElectricCharacterSupport(this, { brackets: [ - { tokenType:'punctuation.bracket.css', open: '{', close: '}', isElectric: true } + { tokenType: 'punctuation.bracket.css', open: '{', close: '}', isElectric: true } ] }); this.extraInfoSupport = this; this.referenceSupport = new supports.ReferenceSupport(this, { - tokens: ['support.type.property-name.css', 'meta.property-value.css', 'entity.name.tag.css'], + tokens: [cssTokenTypes.TOKEN_PROPERTY + '.css', cssTokenTypes.TOKEN_VALUE + '.css', cssTokenTypes.TOKEN_SELECTOR_TAG + '.css'], findReferences: (resource, position, /*unused*/includeDeclaration) => this.findReferences(resource, position)}); this.logicalSelectionSupport = this; this.outlineSupport = this; this.declarationSupport = new supports.DeclarationSupport(this, { - tokens: ['meta.property-value.css'], + tokens: [cssTokenTypes.TOKEN_VALUE + '.css'], findDeclaration: (resource, position) => this.findDeclaration(resource, position)}); this.characterPairSupport = new supports.CharacterPairSupport(this, { @@ -342,27 +345,27 @@ export class CSSMode extends AbstractMode { } static $findDeclaration = OneWorkerAttr(CSSMode, CSSMode.prototype.findDeclaration); - public findDeclaration(resource:Network.URL, position:EditorCommon.IPosition):WinJS.TPromise { + public findDeclaration(resource:URI, position:EditorCommon.IPosition):WinJS.TPromise { return this._worker((w) => w.findDeclaration(resource, position)); } static $computeInfo = OneWorkerAttr(CSSMode, CSSMode.prototype.computeInfo); - public computeInfo(resource:Network.URL, position:EditorCommon.IPosition): WinJS.TPromise { + public computeInfo(resource:URI, position:EditorCommon.IPosition): WinJS.TPromise { return this._worker((w) => w.computeInfo(resource, position)); } static $findReferences = OneWorkerAttr(CSSMode, CSSMode.prototype.findReferences); - public findReferences(resource:Network.URL, position:EditorCommon.IPosition):WinJS.TPromise { + public findReferences(resource:URI, position:EditorCommon.IPosition):WinJS.TPromise { return this._worker((w) => w.findReferences(resource, position)); } static $getRangesToPosition = OneWorkerAttr(CSSMode, CSSMode.prototype.getRangesToPosition); - public getRangesToPosition(resource:Network.URL, position:EditorCommon.IPosition):WinJS.TPromise { + public getRangesToPosition(resource:URI, position:EditorCommon.IPosition):WinJS.TPromise { return this._worker((w) => w.getRangesToPosition(resource, position)); } static $getOutline = OneWorkerAttr(CSSMode, CSSMode.prototype.getOutline); - public getOutline(resource:Network.URL):WinJS.TPromise { + public getOutline(resource:URI):WinJS.TPromise { return this._worker((w) => w.getOutline(resource)); } @@ -376,17 +379,17 @@ export class CSSMode extends AbstractMode { } static $findColorDeclarations = OneWorkerAttr(CSSMode, CSSMode.prototype.findColorDeclarations); - public findColorDeclarations(resource:Network.URL):WinJS.TPromise<{range:EditorCommon.IRange; value:string; }[]> { + public findColorDeclarations(resource:URI):WinJS.TPromise<{range:EditorCommon.IRange; value:string; }[]> { return this._worker((w) => w.findColorDeclarations(resource)); } static getQuickFixes = OneWorkerAttr(CSSMode, CSSMode.prototype.getQuickFixes); - public getQuickFixes(resource: Network.URL, marker: IMarker | EditorCommon.IRange): WinJS.TPromise{ + public getQuickFixes(resource: URI, marker: IMarker | EditorCommon.IRange): WinJS.TPromise{ return this._worker((w) => w.getQuickFixes(resource, marker)); } static runQuickFixAction = OneWorkerAttr(CSSMode, CSSMode.prototype.runQuickFixAction); - public runQuickFixAction(resource:Network.URL, range:EditorCommon.IRange, id: any):WinJS.TPromise{ + public runQuickFixAction(resource:URI, range:EditorCommon.IRange, id: any):WinJS.TPromise{ return this._worker((w) => w.runQuickFixAction(resource, range, id)); } } diff --git a/extensions/csharp-o/src/features/documentation.ts b/src/vs/languages/css/common/cssTokenTypes.ts similarity index 52% rename from extensions/csharp-o/src/features/documentation.ts rename to src/vs/languages/css/common/cssTokenTypes.ts index 46f25cd75b4..8fdd3436714 100644 --- a/extensions/csharp-o/src/features/documentation.ts +++ b/src/vs/languages/css/common/cssTokenTypes.ts @@ -4,27 +4,8 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; - -var _regExp = /<(\S*?).*?>((.|\r|\n)*?)<\/\1>/; - -/** - * remove xml-tags from string - */ -export function plain(doc: string): string { - - if (!doc) { - return doc; - } - - var newDoc: string; - - while (true) { - newDoc = doc.replace(_regExp,(m, g1, g2, g3) => g2); - if (newDoc === doc) { - break; - } - doc = newDoc; - } - - return newDoc; -} +export const TOKEN_SELECTOR = 'entity.name.selector'; +export const TOKEN_SELECTOR_TAG = 'entity.name.tag'; +export const TOKEN_PROPERTY = 'support.type.property-name'; +export const TOKEN_VALUE = 'support.property-value'; +export const TOKEN_AT_KEYWORD = 'keyword.control.at-rule'; diff --git a/src/vs/languages/css/common/cssWorker.ts b/src/vs/languages/css/common/cssWorker.ts index d9f718ac464..1fe1c45ad9e 100644 --- a/src/vs/languages/css/common/cssWorker.ts +++ b/src/vs/languages/css/common/cssWorker.ts @@ -5,6 +5,7 @@ 'use strict'; import nls = require('vs/nls'); +import URI from 'vs/base/common/uri'; import _severity from 'vs/base/common/severity'; import strings = require('vs/base/common/strings'); import winjs = require('vs/base/common/winjs.base'); @@ -71,7 +72,7 @@ export class CSSWorker extends AbstractModeWorker { return winjs.TPromise.as(false); } - public doValidate(resource: network.URL):void { + public doValidate(resource: URI):void { if (!this.validationEnabled) { this.markerService.changeOne(this._getMode().getId(), resource, []); return; @@ -115,7 +116,7 @@ export class CSSWorker extends AbstractModeWorker { return new cssIntellisense.CSSIntellisense(); } - public doSuggest(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public doSuggest(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this.languageService.join().then(() => { @@ -126,7 +127,7 @@ export class CSSWorker extends AbstractModeWorker { } - public getRangesToPosition(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public getRangesToPosition(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this.languageService.join().then(() => { @@ -154,7 +155,7 @@ export class CSSWorker extends AbstractModeWorker { }); } - public getOutline(resource:network.URL):winjs.TPromise { + public getOutline(resource:URI):winjs.TPromise { return this.languageService.join().then(() => { @@ -200,7 +201,7 @@ export class CSSWorker extends AbstractModeWorker { }); } - public computeInfo(resource:network.URL, position:EditorCommon.IPosition): winjs.TPromise { + public computeInfo(resource:URI, position:EditorCommon.IPosition): winjs.TPromise { return this.languageService.join().then(() => { @@ -229,7 +230,7 @@ export class CSSWorker extends AbstractModeWorker { }); } - public findDeclaration(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public findDeclaration(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this.languageService.join().then(() => { @@ -248,7 +249,7 @@ export class CSSWorker extends AbstractModeWorker { }); } - public findOccurrences(resource:network.URL, position:EditorCommon.IPosition, strict?:boolean):winjs.TPromise { + public findOccurrences(resource:URI, position:EditorCommon.IPosition, strict?:boolean):winjs.TPromise { return this.languageService.join().then(() => { @@ -265,7 +266,7 @@ export class CSSWorker extends AbstractModeWorker { }); } - public findReferences(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public findReferences(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this.languageService.join().then(() => { var model = this.resourceService.get(resource), @@ -281,7 +282,7 @@ export class CSSWorker extends AbstractModeWorker { }); } - public navigateValueSetFallback(resource:network.URL, range:EditorCommon.IRange, up:boolean):winjs.TPromise { + public navigateValueSetFallback(resource:URI, range:EditorCommon.IRange, up:boolean):winjs.TPromise { return this.languageService.join().then(() => { var model = this.resourceService.get(resource); @@ -341,7 +342,7 @@ export class CSSWorker extends AbstractModeWorker { }); } - public findColorDeclarations(resource:network.URL):winjs.Promise { + public findColorDeclarations(resource:URI):winjs.Promise { return this.languageService.join().then(() => { @@ -385,9 +386,12 @@ export class CSSWorker extends AbstractModeWorker { var score = strings.difference(propertyName, p); if (score >= propertyName.length / 2 /*score_lim*/) { result.push({ - label: nls.localize('css.quickfix.rename', "Rename to '{0}'", p), - id: JSON.stringify({ type: 'rename', name: p }), - score: score + command: { + id: 'css.renameProptery', + title: nls.localize('css.quickfix.rename', "Rename to '{0}'", p), + arguments: [{ type: 'rename', name: p }] + }, + score }); } } @@ -400,7 +404,7 @@ export class CSSWorker extends AbstractModeWorker { return result.slice(0, 3 /*max_result*/); } - public getQuickFixes(resource: network.URL, marker: IMarker | EditorCommon.IRange): winjs.TPromise { + public getQuickFixes(resource: URI, marker: IMarker | EditorCommon.IRange): winjs.TPromise { if (( marker).code !== lintRules.Rules.UnknownProperty.id) { return winjs.TPromise.as([]); } @@ -425,12 +429,12 @@ export class CSSWorker extends AbstractModeWorker { }); } - public runQuickFixAction(resource:network.URL, range:EditorCommon.IRange, id: any):winjs.TPromise{ - var command = JSON.parse(id); - switch (command.type) { + public runQuickFixAction(resource: URI, range: EditorCommon.IRange, quickFix: Modes.IQuickFix): winjs.TPromise{ + let [{type, name}] = quickFix.command.arguments; + switch (type) { case 'rename': { return winjs.TPromise.as({ - edits: [{ resource, range, newText: command.name }] + edits: [{ resource, range, newText: name }] }); } } diff --git a/src/vs/languages/css/common/parser/cssErrors.ts b/src/vs/languages/css/common/parser/cssErrors.ts index 111f1bc809e..c185d6ee869 100644 --- a/src/vs/languages/css/common/parser/cssErrors.ts +++ b/src/vs/languages/css/common/parser/cssErrors.ts @@ -10,7 +10,7 @@ import nodes = require('./cssNodes'); export class CSSIssueType implements nodes.IRule { id: string; message: string; - + public constructor(id:string, message: string) { this.id = id; this.message = message; diff --git a/src/vs/languages/css/common/parser/cssSymbols.ts b/src/vs/languages/css/common/parser/cssSymbols.ts index 391a9f4428a..61af2712a45 100644 --- a/src/vs/languages/css/common/parser/cssSymbols.ts +++ b/src/vs/languages/css/common/parser/cssSymbols.ts @@ -8,40 +8,40 @@ import nodes = require('./cssNodes'); import arrays = require('vs/base/common/arrays'); export class Scope { - + public parent:Scope; public children:Scope[]; - + public offset:number; public length:number; - + private symbols:Symbol[]; - + constructor(offset:number, length:number) { this.offset = offset; this.length = length; this.symbols = []; - + this.parent = null; this.children = []; } - + public addChild(scope:Scope):void { this.children.push(scope); scope.setParent(this); } - + public setParent(scope:Scope):void { this.parent = scope; } - + public findScope(offset:number, length:number=0):Scope { if (this.offset <= offset && this.offset + this.length > offset + length || this.offset === offset && this.length === length) { return this.findInScope(offset, length); } return null; } - + private findInScope(offset: number, length: number = 0): Scope { // find the first scope child that has an offset larger than offset + length var end = offset + length; @@ -50,18 +50,18 @@ export class Scope { // all scopes have offsets larger than our end return this; } - + var res = this.children[idx-1]; if (res.offset <= offset && res.offset + res.length >= offset + length) { return res.findInScope(offset, length); } return this; } - + public addSymbol(symbol:Symbol):void { this.symbols.push(symbol); } - + public getSymbol(name:string, type: nodes.ReferenceType):Symbol { for (var index = 0; index < this.symbols.length; index++) { var symbol = this.symbols[index]; @@ -71,14 +71,14 @@ export class Scope { } return null; } - + public getSymbols():Symbol[] { return this.symbols; } } export class GlobalScope extends Scope { - + constructor() { super(0, Number.MAX_VALUE); } @@ -87,11 +87,11 @@ export class GlobalScope extends Scope { export class Symbol { - + public name:string; public type:nodes.ReferenceType; public node:nodes.Node; - + constructor(name:string, node:nodes.Node, type: nodes.ReferenceType) { this.name = name; this.node = node; @@ -102,18 +102,18 @@ export class Symbol { export class ScopeBuilder implements nodes.IVisitor { public scope:Scope; - + constructor(scope:Scope) { this.scope = scope; } - + private addSymbol(node:nodes.Node, name:string, type: nodes.ReferenceType) : void { if (node.offset !== -1) { var current = this.scope.findScope(node.offset, node.length); current.addSymbol(new Symbol(name, node, type)); } } - + private addScope(node:nodes.Node) : Scope { if (node.offset !== -1) { var current = this.scope.findScope(node.offset, node.length); @@ -126,14 +126,14 @@ export class ScopeBuilder implements nodes.IVisitor { } return null; } - + private addSymbolToChildScope(scopeNode:nodes.Node, node:nodes.Node, name:string, type: nodes.ReferenceType): void { if (scopeNode && scopeNode.offset !== -1 ) { var current = this.addScope(scopeNode); // create the scope or gets the existing one current.addSymbol(new Symbol(name, node, type)); } } - + public visitNode(node:nodes.Node):boolean { switch (node.type) { case nodes.NodeType.Keyframe: @@ -171,7 +171,7 @@ export class ScopeBuilder implements nodes.IVisitor { } return true; } - + public visitRuleSet(node:nodes.RuleSet):boolean { var current = this.scope.findScope(node.offset, node.length); node.getSelectors().getChildren().forEach((node) => { @@ -187,14 +187,14 @@ export class ScopeBuilder implements nodes.IVisitor { export class Symbols { - + private global:Scope; - + constructor(node:nodes.Node) { this.global = new GlobalScope(); node.accept(new ScopeBuilder(this.global)); } - + public findSymbolsAtOffset(offset:number, referenceType: nodes.ReferenceType) : Symbol[] { var scope = this.global.findScope(offset, 0); var result : Symbol[] = []; @@ -212,7 +212,7 @@ export class Symbols { } return result; } - + private internalFindSymbol(node:nodes.Node, referenceTypes:nodes.ReferenceType[]): Symbol { var scopeNode = node; if (node.parent instanceof nodes.FunctionParameter && node.parent.getParent() instanceof nodes.BodyDeclaration) { @@ -244,7 +244,7 @@ export class Symbols { } return null; } - + private evaluateReferenceTypes(node: nodes.Node) : nodes.ReferenceType[] { if (node instanceof nodes.Identifier) { var referenceTypes = ( node).referenceTypes; @@ -274,7 +274,7 @@ export class Symbols { } return null; } - + public findSymbolFromNode(node: nodes.Node):Symbol { if (!node) { return null; @@ -282,14 +282,14 @@ export class Symbols { while (node.type === nodes.NodeType.Interpolation) { node = node.getParent(); } - + var referenceTypes = this.evaluateReferenceTypes(node); if (referenceTypes) { return this.internalFindSymbol(node, referenceTypes); } return null; } - + public matchesSymbol(node: nodes.Node, symbol: Symbol):boolean { if (!node) { return null; @@ -300,17 +300,17 @@ export class Symbols { if (symbol.name.length !== node.length || symbol.name !== node.getText()) { return false; } - + var referenceTypes = this.evaluateReferenceTypes(node); if (!referenceTypes || referenceTypes.indexOf(symbol.type) === -1) { return false; } - + var nodeSymbol = this.internalFindSymbol(node, referenceTypes); return nodeSymbol === symbol; } - - + + public findSymbol(name:string, type: nodes.ReferenceType, offset:number):Symbol { var scope = this.global.findScope(offset); while(scope) { diff --git a/src/vs/languages/css/common/services/browsers.js b/src/vs/languages/css/common/services/browsers.js index db363c7f33e..3742fce0850 100644 --- a/src/vs/languages/css/common/services/browsers.js +++ b/src/vs/languages/css/common/services/browsers.js @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ - + // file generated from css-schema.xml using css-exclude_generate_browserjs.js define(["require", "exports"], function(require, exports) { diff --git a/src/vs/languages/css/common/services/cssLanguageService.ts b/src/vs/languages/css/common/services/cssLanguageService.ts index bc1c9edb885..0c0c3c78006 100644 --- a/src/vs/languages/css/common/services/cssLanguageService.ts +++ b/src/vs/languages/css/common/services/cssLanguageService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import winjs = require('vs/base/common/winjs.base'); import nodes = require('vs/languages/css/common/parser/cssNodes'); import parser = require('vs/languages/css/common/parser/cssParser'); @@ -19,7 +19,7 @@ interface Entry { export interface ILanguageService { join():winjs.TPromise; - getStylesheet(resource:network.URL):nodes.Stylesheet; + getStylesheet(resource:URI):nodes.Stylesheet; } class PromiseWithTrigger extends winjs.TPromise { @@ -117,7 +117,7 @@ export class CSSLanguageService implements ILanguageService { return resource.getMode().getId() === this._cssModeId; } - private _isMyModel(url:network.URL): boolean { + private _isMyModel(url:URI): boolean { return this._isMyMirrorModel(this.resourceService.get(url)); } @@ -149,7 +149,7 @@ export class CSSLanguageService implements ILanguageService { // console.info('[less] updating ' + n + ' resources took ms' + (new Date().getTime() - t1)); } - public getStylesheet(resource:network.URL):nodes.Stylesheet { + public getStylesheet(resource:URI):nodes.Stylesheet { if(this.entries.hasOwnProperty(resource.toString())) { return this.entries[resource.toString()].node; } diff --git a/src/vs/languages/css/common/services/intelliSense.ts b/src/vs/languages/css/common/services/intelliSense.ts index 87af4670897..4f2506e34d8 100644 --- a/src/vs/languages/css/common/services/intelliSense.ts +++ b/src/vs/languages/css/common/services/intelliSense.ts @@ -8,7 +8,7 @@ import nodes = require('vs/languages/css/common/parser/cssNodes'); import cssSymbols = require('vs/languages/css/common/parser/cssSymbols'); import languageFacts = require('vs/languages/css/common/services/languageFacts'); import service = require('vs/languages/css/common/services/cssLanguageService'); -import network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); import nls = require('vs/nls'); @@ -45,7 +45,7 @@ export class CSSIntellisense { } - public getCompletionsAtPosition(languageService:service.ILanguageService, model: EditorCommon.IMirrorModel, resource:network.URL, position:EditorCommon.IPosition):Modes.ISuggestions { + public getCompletionsAtPosition(languageService:service.ILanguageService, model: EditorCommon.IMirrorModel, resource:URI, position:EditorCommon.IPosition):Modes.ISuggestResult { this.offset = model.getOffsetFromPosition(position); this.position = position; this.currentWord = model.getWordUntilPosition(position).word; @@ -105,7 +105,10 @@ export class CSSIntellisense { } public getCompletionsForDeclarationProperty(result:Modes.ISuggestion[]):Modes.ISuggestion[] { + return this.getPropertyProposals(result); + } + private getPropertyProposals(result:Modes.ISuggestion[]):Modes.ISuggestion[] { var properties = languageFacts.getProperties(); for (var key in properties) { @@ -341,7 +344,7 @@ export class CSSIntellisense { if (ruleSet && ruleSet.isNested()) { var selector = ruleSet.getSelectors().findFirstChildBeforeOffset(this.offset); if (selector && ruleSet.getSelectors().getChildren().indexOf(selector) === 0) { - this.getCompletionsForDeclarationProperty(result); + this.getPropertyProposals(result); } } return result; diff --git a/src/vs/languages/css/common/services/typeResolution.ts b/src/vs/languages/css/common/services/typeResolution.ts index edb68c25b52..b1f7967c6a8 100644 --- a/src/vs/languages/css/common/services/typeResolution.ts +++ b/src/vs/languages/css/common/services/typeResolution.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; +import URI from 'vs/base/common/uri'; import nodes = require('vs/languages/css/common/parser/cssNodes'); import service = require('vs/languages/css/common/services/cssLanguageService'); -import network = require('vs/base/common/network'); import languageFacts = require('vs/languages/css/common/services/languageFacts'); export enum Type { @@ -54,7 +54,7 @@ export class MultiType implements IType { } } -export function typeAtPosition(service:service.ILanguageService, resource:network.URL, offset:number):IType { +export function typeAtPosition(service:service.ILanguageService, resource:URI, offset:number):IType { return null; } diff --git a/src/vs/languages/css/test/common/css-worker.test.ts b/src/vs/languages/css/test/common/css-worker.test.ts index 7008b440d9f..2afa08b5c03 100644 --- a/src/vs/languages/css/test/common/css-worker.test.ts +++ b/src/vs/languages/css/test/common/css-worker.test.ts @@ -7,7 +7,7 @@ import assert = require('assert'); import mm = require('vs/editor/common/model/mirrorModel'); import cssWorker = require('vs/languages/css/common/cssWorker'); -import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import ResourceService = require('vs/editor/common/services/resourceServiceImpl'); import MarkerService = require('vs/platform/markers/common/markerService'); import EditorCommon = require('vs/editor/common/editorCommon'); @@ -19,7 +19,7 @@ import modesUtil = require('vs/editor/test/common/modesTestUtils'); import {NULL_THREAD_SERVICE} from 'vs/platform/test/common/nullThreadService'; import {IMarker} from 'vs/platform/markers/common/markers'; -export function mockMirrorModel(content:string, url:Network.URL = null) : mm.MirrorModel { +export function mockMirrorModel(content:string, url:URI = null) : mm.MirrorModel { return mm.createMirrorModelFromString(null, 0, content, modesUtil.createMockMode('mock.mode.id', /(#?-?\d*\.\d\w*%?)|([@#.:!]?[\w-?]+%?)|[@#.!]/g), url); } @@ -29,7 +29,7 @@ suite('Validation - CSS', () => { var source = ' #navigation a;'; var message = cssErrors.ParseError.LeftCurlyExpected.message; - var url = new Network.URL(Network.schemas.inMemory + '://localhost/vs/editor/common/model/mirrorModel/1'); + var url = URI.parse('inmemory://localhost/vs/editor/common/model/mirrorModel/1'); var mirrorModel:any= mockMirrorModel(source, url); var markerService = new MarkerService.MarkerService(NULL_THREAD_SERVICE); @@ -50,7 +50,7 @@ suite('Validation - CSS', () => { assert.equal(marker.message, message); }); - var mockCSSWorkerEnv = function (url: Network.URL, content: string): { worker: cssWorker.CSSWorker; model: mm.MirrorModel; markers: IMarker[]; } { + var mockCSSWorkerEnv = function (url: URI, content: string): { worker: cssWorker.CSSWorker; model: mm.MirrorModel; markers: IMarker[]; } { var resourceService = new ResourceService.ResourceService(); var model = mockMirrorModel(content, url); resourceService.insert(url, model); @@ -69,8 +69,8 @@ suite('Validation - CSS', () => { return { worker: worker, model: model, markers: markers }; }; - var testSuggestionsFor = function(value:string, stringBefore:string):WinJS.TPromise { - var url = new Network.URL('test://1'); + var testSuggestionsFor = function(value:string, stringBefore:string):WinJS.TPromise { + var url = URI.parse('test://1'); var env = mockCSSWorkerEnv(url, value); var idx = stringBefore ? value.indexOf(stringBefore) + stringBefore.length : 0; @@ -79,7 +79,7 @@ suite('Validation - CSS', () => { }; var testValueSetFor = function(value:string, selection:string, selectionLength: number, up: boolean):WinJS.TPromise { - var url = new Network.URL('test://1'); + var url = URI.parse('test://1'); var env = mockCSSWorkerEnv(url, value); var pos = env.model.getPositionFromOffset(value.indexOf(selection)); @@ -89,7 +89,7 @@ suite('Validation - CSS', () => { }; var testOccurrences = function (value: string, tokenBefore: string): WinJS.TPromise<{ occurrences: Modes.IOccurence[]; model: mm.MirrorModel; }> { - var url = new Network.URL('test://1'); + var url = URI.parse('test://1'); var env = mockCSSWorkerEnv(url, value); var pos = env.model.getPositionFromOffset(value.indexOf(tokenBefore) + tokenBefore.length); @@ -98,7 +98,7 @@ suite('Validation - CSS', () => { }; var testQuickFixes = function (value: string, tokenBefore: string): WinJS.TPromise<{ fixes: Modes.IQuickFix[]; model: mm.MirrorModel; }> { - var url = new Network.URL('test://1'); + var url = URI.parse('test://1'); var env = mockCSSWorkerEnv(url, value); var pos = env.model.getPositionFromOffset(value.indexOf(tokenBefore) + tokenBefore.length); @@ -109,7 +109,7 @@ suite('Validation - CSS', () => { return env.worker.getQuickFixes(url, markers[0]).then((fixes) => { return { fixes: fixes, model: env.model}; }); }; - var assertSuggestion= function(completion:Modes.ISuggestions, label:string, type?:string) { + var assertSuggestion= function(completion:Modes.ISuggestResult, label:string, type?:string) { var proposalsFound = completion.suggestions.filter(function(suggestion: Modes.ISuggestion) { return suggestion.label === label && (!type || suggestion.type === type); }); @@ -130,7 +130,7 @@ suite('Validation - CSS', () => { }; var assertQuickFix= function(fixes: Modes.IQuickFix[], model: mm.MirrorModel, expectedContent:string[]) { - var labels = fixes.map(f => f.label); + var labels = fixes.map(f => f.command.title); for (var index = 0; index < expectedContent.length; index++) { assert.ok(labels.indexOf(expectedContent[index]) !== -1, 'Quick fix not found: ' + expectedContent[index]); @@ -139,128 +139,128 @@ suite('Validation - CSS', () => { test('Intellisense', function(testDone): any { WinJS.Promise.join([ - testSuggestionsFor(' ', null).then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor(' ', null).then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, '@import'); assertSuggestion(completion, '@keyframes'); assertSuggestion(completion, 'div'); }), - testSuggestionsFor(' body {', null).then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor(' body {', null).then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, '@import'); assertSuggestion(completion, '@keyframes'); assertSuggestion(completion, 'html'); }), - testSuggestionsFor('body {', '{').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body {', '{').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, 'display'); assertSuggestion(completion, 'background'); }), - testSuggestionsFor('body { ver', 'ver').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { ver', 'ver').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, 'ver'); assertSuggestion(completion, 'vertical-align'); }), - testSuggestionsFor('body { vertical-align', 'vertical-ali').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align', 'vertical-ali').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, 'vertical-ali'); assertSuggestion(completion, 'vertical-align'); }), - testSuggestionsFor('body { vertical-align', 'vertical-align').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align', 'vertical-align').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, 'vertical-align'); assertSuggestion(completion, 'vertical-align'); }), - testSuggestionsFor('body { vertical-align: bottom;}', 'vertical-align').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align: bottom;}', 'vertical-align').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, 'vertical-align'); assertSuggestion(completion, 'vertical-align'); }), - testSuggestionsFor('body { vertical-align: bottom;}', 'vertical-align:').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align: bottom;}', 'vertical-align:').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, 'bottom'); assertSuggestion(completion, '0cm'); }), - testSuggestionsFor('body { vertical-align: bottom;}', 'vertical-align: ').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align: bottom;}', 'vertical-align: ').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, 'bottom'); assertSuggestion(completion, '0cm'); }), - testSuggestionsFor('body { vertical-align: bott', 'bott').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align: bott', 'bott').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, 'bott'); assertSuggestion(completion, 'bottom'); }), - testSuggestionsFor('body { vertical-align: bottom }', 'bott').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align: bottom }', 'bott').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, 'bott'); assertSuggestion(completion, 'bottom'); }), - testSuggestionsFor('body { vertical-align: bottom }', 'bottom').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align: bottom }', 'bottom').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, 'bottom'); assertSuggestion(completion, 'bottom'); }), - testSuggestionsFor('body { vertical-align: bottom; }', 'bottom').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align: bottom; }', 'bottom').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, 'bottom'); assertSuggestion(completion, 'bottom'); }), - testSuggestionsFor('body { vertical-align: bottom; }', 'bottom;').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align: bottom; }', 'bottom;').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, ''); assert.equal(completion.suggestions.length, 0); }), - testSuggestionsFor('body { vertical-align: bottom; }', 'bottom; ').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align: bottom; }', 'bottom; ').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, 'display'); }), - testSuggestionsFor('body { vertical-align: 9 }', '9').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align: 9 }', '9').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, '9'); assertSuggestion(completion, '9cm'); }), - testSuggestionsFor('body { vertical-align: 1.2 }', '1.2').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align: 1.2 }', '1.2').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, '1.2'); assertSuggestion(completion, '1.2em'); }), - testSuggestionsFor('body { vertical-align: 10 }', '1').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align: 10 }', '1').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, '1'); assertSuggestion(completion, '1cm'); }), - testSuggestionsFor('body { vertical-align: 10c }', '10c').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { vertical-align: 10c }', '10c').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, '10c'); assertSuggestion(completion, '10cm'); }), - testSuggestionsFor('body { notexisting: ;}', 'notexisting: ').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { notexisting: ;}', 'notexisting: ').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, ''); assert.equal(completion.suggestions.length, 0); // no matches }), - testSuggestionsFor('@import url("something.css");', '@').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('@import url("something.css");', '@').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, '@'); assert.equal(completion.suggestions.length, 0); // to be improved }), - testSuggestionsFor('body { border-right: ', 'right: ').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { border-right: ', 'right: ').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, 'cyan'); assertSuggestion(completion, 'dotted'); assertSuggestion(completion, '0em'); }), - testSuggestionsFor('body { border-right: cyan dotted 2em ', 'cyan').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { border-right: cyan dotted 2em ', 'cyan').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, 'cyan'); assertSuggestion(completion, 'cyan'); assertSuggestion(completion, 'darkcyan'); }), - testSuggestionsFor('body { border-right: dotted 2em ', '2em ').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { border-right: dotted 2em ', '2em ').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, 'cyan'); }), - testSuggestionsFor('body { trans ', 'trans').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('body { trans ', 'trans').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, 'trans'); assertSuggestion(completion, 'transition'); }), - testSuggestionsFor('.foo { background-color: #123456; } .bar { background-color: }', '.bar { background-color:').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('.foo { background-color: #123456; } .bar { background-color: }', '.bar { background-color:').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, '#123456', '##123456'); }), - testSuggestionsFor('.foo { unknown: foo; } .bar { unknown: }', '.bar { unknown:').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('.foo { unknown: foo; } .bar { unknown: }', '.bar { unknown:').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, 'foo', 'value'); }), - testSuggestionsFor('.foo { background-color: r', 'background-color: r').then(function(completion: Modes.ISuggestions): void { + testSuggestionsFor('.foo { background-color: r', 'background-color: r').then(function(completion: Modes.ISuggestResult): void { assert.equal(completion.currentWord, 'r'); assertSuggestion(completion, 'rgb', 'function'); assertSuggestion(completion, 'rgba', 'function'); diff --git a/src/vs/languages/css/test/common/css.test.ts b/src/vs/languages/css/test/common/css.test.ts index 529a0e8f182..9d737d39f0b 100644 --- a/src/vs/languages/css/test/common/css.test.ts +++ b/src/vs/languages/css/test/common/css.test.ts @@ -9,6 +9,7 @@ import cssMode = require('vs/languages/css/common/css'); import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); import modesUtil = require('vs/editor/test/common/modesUtil'); +import {cssTokenTypes} from 'vs/languages/css/common/css'; suite('CSS Colorizing', () => { @@ -31,7 +32,7 @@ suite('CSS Colorizing', () => { line: ' body ', tokens: [ { startIndex:0, type: '' }, - { startIndex:6, type: 'entity.name.tag.css' }, + { startIndex:6, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' }, { startIndex:10, type: '' } ]} ]); @@ -49,65 +50,65 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: 'body {', tokens: [ - { startIndex:0, type: 'entity.name.tag.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' }, { startIndex:4, type: '' }, { startIndex:5, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open } ]}, { line: ' margin: 0;', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.css' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:8, type: 'punctuation.css' }, { startIndex:9, type: '' }, - { startIndex:10, type: 'meta.property-value.numeric.css' }, + { startIndex:10, type: cssTokenTypes.TOKEN_VALUE + '.numeric.css' }, { startIndex:11, type: 'punctuation.css' } ]}, { line: ' padding: 3em 6em;', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.css' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:9, type: 'punctuation.css' }, { startIndex:10, type: '' }, - { startIndex:11, type: 'meta.property-value.numeric.css' }, - { startIndex:12, type: 'meta.property-value.unit.css' }, + { startIndex:11, type: cssTokenTypes.TOKEN_VALUE + '.numeric.css' }, + { startIndex:12, type: cssTokenTypes.TOKEN_VALUE + '.unit.css' }, { startIndex:14, type: '' }, - { startIndex:15, type: 'meta.property-value.numeric.css' }, - { startIndex:16, type: 'meta.property-value.unit.css' }, + { startIndex:15, type: cssTokenTypes.TOKEN_VALUE + '.numeric.css' }, + { startIndex:16, type: cssTokenTypes.TOKEN_VALUE + '.unit.css' }, { startIndex:18, type: 'punctuation.css' } ]}, { line: ' font-family: tahoma, arial, sans-serif;', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.css' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:13, type: 'punctuation.css' }, { startIndex:14, type: '' }, - { startIndex:15, type: 'meta.property-value.css' }, + { startIndex:15, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:21, type: 'punctuation.css' }, { startIndex:22, type: '' }, - { startIndex:23, type: 'meta.property-value.css' }, + { startIndex:23, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:28, type: 'punctuation.css' }, { startIndex:29, type: '' }, - { startIndex:30, type: 'meta.property-value.css' }, + { startIndex:30, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:40, type: 'punctuation.css' } ]}, { line: ' text-decoration: none !important;', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.css' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:17, type: 'punctuation.css' }, { startIndex:18, type: '' }, - { startIndex:19, type: 'meta.property-value.css' }, + { startIndex:19, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:23, type: '' }, - { startIndex:24, type: 'meta.property-value.keyword.css' }, + { startIndex:24, type: cssTokenTypes.TOKEN_VALUE + '.keyword.css' }, { startIndex:34, type: 'punctuation.css' } ]}, { line: ' color: #000', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.css' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:7, type: 'punctuation.css' }, { startIndex:8, type: '' }, - { startIndex:9, type: 'meta.property-value.hex.css' } + { startIndex:9, type: cssTokenTypes.TOKEN_VALUE + '.hex.css' } ]}, { line: ' }', tokens: [ @@ -125,17 +126,17 @@ suite('CSS Colorizing', () => { { startIndex:1, type: '' }, { startIndex:2, type: 'punctuation.bracket.css' }, { startIndex:3, type: '' }, - { startIndex:4, type: 'support.type.property-name.css' }, + { startIndex:4, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:11, type: 'punctuation.css' }, { startIndex:12, type: '' }, - { startIndex:13, type: 'meta.property-value.numeric.css' }, - { startIndex:14, type: 'meta.property-value.unit.css' }, + { startIndex:13, type: cssTokenTypes.TOKEN_VALUE + '.numeric.css' }, + { startIndex:14, type: cssTokenTypes.TOKEN_VALUE + '.unit.css' }, { startIndex:16, type: '' }, - { startIndex:17, type: 'meta.property-value.numeric.css' }, - { startIndex:19, type: 'meta.property-value.unit.css' }, + { startIndex:17, type: cssTokenTypes.TOKEN_VALUE + '.numeric.css' }, + { startIndex:19, type: cssTokenTypes.TOKEN_VALUE + '.unit.css' }, { startIndex:21, type: '' }, - { startIndex:22, type: 'meta.property-value.numeric.css' }, - { startIndex:26, type: 'meta.property-value.unit.css' }, + { startIndex:22, type: cssTokenTypes.TOKEN_VALUE + '.numeric.css' }, + { startIndex:26, type: cssTokenTypes.TOKEN_VALUE + '.unit.css' }, { startIndex:28, type: 'punctuation.css' }, { startIndex:29, type: '' }, { startIndex:30, type: 'punctuation.bracket.css' } @@ -151,7 +152,7 @@ suite('CSS Colorizing', () => { { startIndex:1, type: '' }, { startIndex:2, type: 'punctuation.bracket.css' }, { startIndex:3, type: '' }, - { startIndex:4, type: 'support.type.property-name.css' }, + { startIndex:4, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:11, type: 'punctuation.css' }, { startIndex:12, type: '' } ]} @@ -162,11 +163,11 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: 'h1 /*comment*/ p {', tokens: [ - { startIndex:0, type: 'entity.name.tag.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' }, { startIndex:2, type: '' }, { startIndex:3, type: 'comment.css' }, { startIndex:14, type: '' }, - { startIndex:15, type: 'entity.name.tag.css' }, + { startIndex:15, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' }, { startIndex:16, type: '' }, { startIndex:17, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open } ]} @@ -177,7 +178,7 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: 'h1 /*com', tokens: [ - { startIndex:0, type: 'entity.name.tag.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' }, { startIndex:2, type: '' }, { startIndex:3, type: 'comment.css' } ]}, { @@ -185,7 +186,7 @@ suite('CSS Colorizing', () => { tokens: [ { startIndex:0, type: 'comment.css' }, { startIndex:6, type: '' }, - { startIndex:7, type: 'entity.name.tag.css' } + { startIndex:7, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' } ]} ]); }); @@ -194,7 +195,7 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: '#myID {', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.id.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.id.css' }, { startIndex:5, type: '' }, { startIndex:6, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open } ]} @@ -205,7 +206,7 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: '.myID {', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.css' }, { startIndex:5, type: '' }, { startIndex:6, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open } ]} @@ -216,9 +217,9 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: '@import url("something.css");', tokens: [ - { startIndex:0, type: 'keyword.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.css' }, { startIndex:7, type: '' }, - { startIndex:8, type: 'meta.property-value.css' }, + { startIndex:8, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:11, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Open }, { startIndex:12, type: 'string.css' }, { startIndex:27, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Close }, @@ -234,7 +235,7 @@ suite('CSS Colorizing', () => { line: ' content: "";', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.css' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:9, type: 'punctuation.css' }, { startIndex:10, type: '' }, { startIndex:11, type: 'string.css' }, @@ -247,14 +248,14 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: '@font-face {', tokens: [ - { startIndex:0, type: 'keyword.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.css' }, { startIndex:10, type: '' }, { startIndex:11, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open } ]}, { line: ' font-family: "Opificio";', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.css' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:13, type: 'punctuation.css' }, { startIndex:14, type: '' }, { startIndex:15, type: 'string.css' }, @@ -277,29 +278,29 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: '@-webkit-keyframes infinite-spinning {', tokens: [ - { startIndex:0, type: 'keyword.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.css' }, { startIndex:18, type: '' }, - { startIndex:19, type: 'meta.property-value.css' }, + { startIndex:19, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:36, type: '' }, { startIndex:37, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open } ]}, { line: ' from {', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'entity.name.tag.css' }, + { startIndex:2, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' }, { startIndex:6, type: '' }, { startIndex:7, type: 'punctuation.bracket.css' } ]}, { line: ' -webkit-transform: rotate(0deg);', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.css' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:19, type: 'punctuation.css' }, { startIndex:20, type: '' }, - { startIndex:21, type: 'meta.property-value.css' }, + { startIndex:21, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:27, type: 'punctuation.parenthesis.css' }, - { startIndex:28, type: 'meta.property-value.numeric.css' }, - { startIndex:29, type: 'meta.property-value.unit.css' }, + { startIndex:28, type: cssTokenTypes.TOKEN_VALUE + '.numeric.css' }, + { startIndex:29, type: cssTokenTypes.TOKEN_VALUE + '.unit.css' }, { startIndex:32, type: 'punctuation.parenthesis.css' }, { startIndex:33, type: 'punctuation.css' } ]}, { @@ -311,20 +312,20 @@ suite('CSS Colorizing', () => { line: ' to {', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'entity.name.tag.css' }, + { startIndex:2, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' }, { startIndex:4, type: '' }, { startIndex:5, type: 'punctuation.bracket.css' } ]}, { line: ' -webkit-transform: rotate(360deg);', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.css' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:19, type: 'punctuation.css' }, { startIndex:20, type: '' }, - { startIndex:21, type: 'meta.property-value.css' }, + { startIndex:21, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:27, type: 'punctuation.parenthesis.css' }, - { startIndex:28, type: 'meta.property-value.numeric.css' }, - { startIndex:31, type: 'meta.property-value.unit.css' }, + { startIndex:28, type: cssTokenTypes.TOKEN_VALUE + '.numeric.css' }, + { startIndex:31, type: cssTokenTypes.TOKEN_VALUE + '.unit.css' }, { startIndex:34, type: 'punctuation.parenthesis.css' }, { startIndex:35, type: 'punctuation.css' } ]}, { @@ -344,9 +345,9 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: '@import url("something.css");', tokens: [ - { startIndex:0, type: 'keyword.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.css' }, { startIndex:7, type: '' }, - { startIndex:8, type: 'meta.property-value.css' }, + { startIndex:8, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:11, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Open }, { startIndex:12, type: 'string.css' }, { startIndex:27, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Close }, @@ -354,13 +355,13 @@ suite('CSS Colorizing', () => { ]}, { line: '.rule1{}', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.css' }, { startIndex:6, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open }, { startIndex:7, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Close } ]}, { line: '.rule2{}', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.css' }, { startIndex:6, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open }, { startIndex:7, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Close } ]} @@ -393,16 +394,16 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: '@import url("something.css");@import url("something.css");', tokens: [ - { startIndex:0, type: 'keyword.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.css' }, { startIndex:7, type: '' }, - { startIndex:8, type: 'meta.property-value.css' }, + { startIndex:8, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:11, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Open }, { startIndex:12, type: 'string.css' }, { startIndex:27, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Close }, { startIndex:28, type: 'punctuation.css' }, - { startIndex:29, type: 'keyword.css' }, + { startIndex:29, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.css' }, { startIndex:36, type: '' }, - { startIndex:37, type: 'meta.property-value.css' }, + { startIndex:37, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:40, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Open }, { startIndex:41, type: 'string.css' }, { startIndex:56, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Close }, @@ -416,27 +417,27 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: '.a{background:#f5f9fc !important}.b{font-family:"Helvetica Neue", Helvetica;height:31px;}', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.css' }, { startIndex:2, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open }, - { startIndex:3, type: 'support.type.property-name.css' }, + { startIndex:3, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:13, type: 'punctuation.css' }, - { startIndex:14, type: 'meta.property-value.hex.css' }, + { startIndex:14, type: cssTokenTypes.TOKEN_VALUE + '.hex.css' }, { startIndex:21, type: '' }, - { startIndex:22, type: 'meta.property-value.keyword.css' }, + { startIndex:22, type: cssTokenTypes.TOKEN_VALUE + '.keyword.css' }, { startIndex:32, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Close }, - { startIndex:33, type: 'entity.other.attribute-name.class.css' }, + { startIndex:33, type: cssTokenTypes.TOKEN_SELECTOR + '.class.css' }, { startIndex:35, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open }, - { startIndex:36, type: 'support.type.property-name.css' }, + { startIndex:36, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:47, type: 'punctuation.css' }, { startIndex:48, type: 'string.css' }, { startIndex:64, type: 'punctuation.css' }, { startIndex:65, type: '' }, - { startIndex:66, type: 'meta.property-value.css' }, + { startIndex:66, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:75, type: 'punctuation.css' }, - { startIndex:76, type: 'support.type.property-name.css' }, + { startIndex:76, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:82, type: 'punctuation.css' }, - { startIndex:83, type: 'meta.property-value.numeric.css' }, - { startIndex:85, type: 'meta.property-value.unit.css' }, + { startIndex:83, type: cssTokenTypes.TOKEN_VALUE + '.numeric.css' }, + { startIndex:85, type: cssTokenTypes.TOKEN_VALUE + '.unit.css' }, { startIndex:87, type: 'punctuation.css' }, { startIndex:88, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Close } ]} @@ -448,23 +449,23 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: '.even { background: #fff url(data:image/gif;base64,R0lGODlhBgASALMAAOfn5+rq6uvr6+zs7O7u7vHx8fPz8/b29vj4+P39/f///wAAAAAAAAAAAAAAAAAAACwAAAAABgASAAAIMAAVCBxIsKDBgwgTDkzAsKGAhxARSJx4oKJFAxgzFtjIkYDHjwNCigxAsiSAkygDAgA7) repeat-x bottom}', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.css' }, { startIndex:5, type: '' }, { startIndex:6, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open }, { startIndex:7, type: '' }, - { startIndex:8, type: 'support.type.property-name.css' }, + { startIndex:8, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:18, type: 'punctuation.css' }, { startIndex:19, type: '' }, - { startIndex:20, type: 'meta.property-value.hex.css' }, + { startIndex:20, type: cssTokenTypes.TOKEN_VALUE + '.hex.css' }, { startIndex:24, type: '' }, - { startIndex:25, type: 'meta.property-value.css' }, + { startIndex:25, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:28, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Open }, { startIndex:29, type: 'string.css' }, { startIndex:215, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Close }, { startIndex:216, type: '' }, - { startIndex:217, type: 'meta.property-value.css' }, + { startIndex:217, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:225, type: '' }, - { startIndex:226, type: 'meta.property-value.css' }, + { startIndex:226, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:232, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Close } ]} ]); @@ -475,11 +476,11 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: '.a{background:url(/a.jpg)}', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.css' }, { startIndex:2, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open }, - { startIndex:3, type: 'support.type.property-name.css' }, + { startIndex:3, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:13, type: 'punctuation.css' }, - { startIndex:14, type: 'meta.property-value.css' }, + { startIndex:14, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:17, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Open }, { startIndex:18, type: 'string.css' }, { startIndex:24, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Close }, @@ -492,7 +493,7 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: 'p{}', tokens: [ - { startIndex:0, type: 'entity.name.tag.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' }, { startIndex:1, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open }, { startIndex:2, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Close } ]} @@ -503,7 +504,7 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: 'p:nth() {}', tokens: [ - { startIndex:0, type: 'entity.name.tag.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' }, { startIndex:5, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Open }, { startIndex:6, type: 'punctuation.parenthesis.css', bracket: Modes.Bracket.Close }, { startIndex:7, type: '' }, @@ -538,12 +539,12 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: 'input[type= \\"submit\\"', tokens: [ - { startIndex:0, type: 'entity.name.tag.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' }, { startIndex:5, type: 'punctuation.css'}, - { startIndex:6, type: 'entity.name.tag.css' }, + { startIndex:6, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' }, { startIndex:10, type: 'punctuation.css'}, { startIndex:11, type: ''}, - { startIndex:12, type: 'entity.name.tag.css'} + { startIndex:12, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css'} ]} ]); }); @@ -552,10 +553,10 @@ suite('CSS Colorizing', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: '.rule {\\', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.css' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.css' }, { startIndex:5, type: ''}, { startIndex:6, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open }, - { startIndex:7, type: 'support.type.property-name.css'} + { startIndex:7, type: cssTokenTypes.TOKEN_PROPERTY + '.css'} ]} ]); }); diff --git a/src/vs/languages/html/common/OSSREADME.json b/src/vs/languages/html/common/OSSREADME.json new file mode 100644 index 00000000000..c98b0eb80a9 --- /dev/null +++ b/src/vs/languages/html/common/OSSREADME.json @@ -0,0 +1,19 @@ +// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS: +[{ + "name": "HTML 5.1 W3C Working Draft", + "version": "08 October 2015", + "license": "W3C Document License", + "repositoryURL": "http://www.w3.org/TR/2015/WD-html51-20151008/", + "licenseDetail": [ + "Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang). This software or document includes material copied ", + "from or derived from HTML 5.1 W3C Working Draft (http://www.w3.org/TR/2015/WD-html51-20151008/.)", + "", + "THIS DOCUMENT IS PROVIDED \"AS IS,\" AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT ", + "NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF ", + "THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY ", + "PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.", + "", + "COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE ", + "DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF." + ] +}] diff --git a/src/vs/languages/html/common/html.ts b/src/vs/languages/html/common/html.ts index a2164c183ff..f43779962fa 100644 --- a/src/vs/languages/html/common/html.ts +++ b/src/vs/languages/html/common/html.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; +import URI from 'vs/base/common/uri'; import modesExtensions = require('vs/editor/common/modes/modesRegistry'); import supports = require('vs/editor/common/modes/supports'); import arrays = require('vs/base/common/arrays'); @@ -23,6 +24,7 @@ import {OnEnterSupport} from 'vs/editor/common/modes/supports/onEnter'; import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation'; import {IThreadService } from 'vs/platform/thread/common/thread'; import * as htmlTokenTypes from 'vs/languages/html/common/htmlTokenTypes'; +import {EMPTY_ELEMENTS} from 'vs/languages/html/common/htmlEmptyTagsShared'; export { htmlTokenTypes }; // export to be used by Razor. We are the main module, so Razor should get ot from use. @@ -38,15 +40,8 @@ export enum States { AttributeValue } -// list of empty elements - for performance reasons we won't open a bracket for them -var emptyElements:string[] = ['area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; - -function isEmptyElement(e: string) : boolean { - return arrays.binarySearch(emptyElements, e,(s1: string, s2: string) => s1.localeCompare(s2)) >= 0; -} - -// list of element that embedd other content -var tagsEmbeddingContent:any = ['script', 'style']; +// list of elements that embed other content +var tagsEmbeddingContent:string[] = ['script', 'style']; @@ -307,7 +302,7 @@ export class HTMLMode extends AbstractMode i brackets: [], regexBrackets:[ { tokenType: htmlTokenTypes.getTag('$1'), - open: /<(?!(?:area|base|basefont|br|col|command|embed|frame|hr|img|input|link|meta|param|source|track|wbr))(\w[\w\d]*)([^\/>]*(?!\/)>)[^<]*$/i, + open: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'), closeComplete: '', close: /<\/(\w[\w\d]*)\s*>$/i }], caseInsensitive:true, @@ -460,52 +455,52 @@ export class HTMLMode extends AbstractMode i } static $formatDocument = OneWorkerAttr(HTMLMode, HTMLMode.prototype.formatDocument); - public formatDocument(resource:network.URL, options:Modes.IFormattingOptions):winjs.TPromise { + public formatDocument(resource:URI, options:Modes.IFormattingOptions):winjs.TPromise { return this._worker((w) => w.format(resource, null, options)); } static $formatRange = OneWorkerAttr(HTMLMode, HTMLMode.prototype.formatRange); - public formatRange(resource:network.URL, range:EditorCommon.IRange, options:Modes.IFormattingOptions):winjs.TPromise { + public formatRange(resource:URI, range:EditorCommon.IRange, options:Modes.IFormattingOptions):winjs.TPromise { return this._worker((w) => w.format(resource, range, options)); } static $computeInfo = OneWorkerAttr(HTMLMode, HTMLMode.prototype.computeInfo); - public computeInfo(resource:network.URL, position:EditorCommon.IPosition): winjs.TPromise { + public computeInfo(resource:URI, position:EditorCommon.IPosition): winjs.TPromise { return this._worker((w) => w.computeInfo(resource, position)); } static $findReferences = OneWorkerAttr(HTMLMode, HTMLMode.prototype.findReferences); - public findReferences(resource:network.URL, position:EditorCommon.IPosition, includeDeclaration:boolean): winjs.TPromise { + public findReferences(resource:URI, position:EditorCommon.IPosition, includeDeclaration:boolean): winjs.TPromise { return this._worker((w) => w.findReferences(resource, position, includeDeclaration)); } static $getRangesToPosition = OneWorkerAttr(HTMLMode, HTMLMode.prototype.getRangesToPosition); - public getRangesToPosition(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public getRangesToPosition(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this._worker((w) => w.getRangesToPosition(resource, position)); } static $findDeclaration = OneWorkerAttr(HTMLMode, HTMLMode.prototype.findDeclaration); - public findDeclaration(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public findDeclaration(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this._worker((w) => w.findDeclaration(resource, position)); } static $findOccurrences = OneWorkerAttr(HTMLMode, HTMLMode.prototype.findOccurrences); - public findOccurrences(resource:network.URL, position:EditorCommon.IPosition, strict:boolean = false): winjs.TPromise { + public findOccurrences(resource:URI, position:EditorCommon.IPosition, strict:boolean = false): winjs.TPromise { return this._worker((w) => w.findOccurrences(resource, position, strict)); } static $suggest = OneWorkerAttr(HTMLMode, HTMLMode.prototype.suggest); - public suggest(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public suggest(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this._worker((w) => w.suggest(resource, position)); } static $findColorDeclarations = OneWorkerAttr(HTMLMode, HTMLMode.prototype.findColorDeclarations); - public findColorDeclarations(resource:network.URL):winjs.TPromise<{range:EditorCommon.IRange; value:string; }[]> { + public findColorDeclarations(resource:URI):winjs.TPromise<{range:EditorCommon.IRange; value:string; }[]> { return this._worker((w) => w.findColorDeclarations(resource)); } static $getParameterHints = OneWorkerAttr(HTMLMode, HTMLMode.prototype.getParameterHints); - public getParameterHints(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public getParameterHints(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this._worker((w) => w.getParameterHints(resource, position)); } } diff --git a/src/vs/languages/html/common/htmlEmptyTagsShared.ts b/src/vs/languages/html/common/htmlEmptyTagsShared.ts new file mode 100644 index 00000000000..112868dad30 --- /dev/null +++ b/src/vs/languages/html/common/htmlEmptyTagsShared.ts @@ -0,0 +1,12 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import arrays = require('vs/base/common/arrays'); + +export const EMPTY_ELEMENTS:string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']; + +export function isEmptyElement(e: string) : boolean { + return arrays.binarySearch(EMPTY_ELEMENTS, e,(s1: string, s2: string) => s1.localeCompare(s2)) >= 0; +} diff --git a/src/vs/languages/html/common/htmlTags.ts b/src/vs/languages/html/common/htmlTags.ts index 1eed73db38a..91775707399 100644 --- a/src/vs/languages/html/common/htmlTags.ts +++ b/src/vs/languages/html/common/htmlTags.ts @@ -2,146 +2,317 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------------------------- + * Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang). This document includes material copied + * from or derived from HTML 5.1 W3C Working Draft (http://www.w3.org/TR/2015/WD-html51-20151008/.)" + *--------------------------------------------------------------------------------------------*/ import strings = require('vs/base/common/strings'); import arrays = require('vs/base/common/arrays'); - -var emptyElements:string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']; - -export function isEmptyElement(e: string) : boolean { - return arrays.binarySearch(emptyElements, e,(s1: string, s2: string) => s1.localeCompare(s2)) >= 0; -} +import nls = require('vs/nls'); +import {isEmptyElement} from 'vs/languages/html/common/htmlEmptyTagsShared'; export interface IHTMLTagProvider { - collectTags(collector: (tag:string) => void): void; + collectTags(collector: (tag:string, label:string) => void): void; collectAttributes(tag: string, collector: (attribute: string, type: string) => void): void; collectValues(tag: string, attribute: string, collector: (value: string) => void): void; } +export class HTMLTagSpecification { + constructor(public label: string, public attributes: string[] = []) {} +} + +// HTML tag information sourced from http://www.w3.org/TR/2015/WD-html51-20151008/ +export const HTML_TAGS : { [tag:string]: HTMLTagSpecification } = { + // The root element + html: new HTMLTagSpecification( + nls.localize('tags.html', 'The html element represents the root of an HTML document.'), + ['manifest']), + // Document metadata + head: new HTMLTagSpecification( + nls.localize('tags.head', 'The head element represents a collection of metadata for the Document.')), + title: new HTMLTagSpecification( + nls.localize('tags.title', 'The title element represents the document\'s title or name. Authors should use titles that identify their documents even when they are used out of context, for example in a user\'s history or bookmarks, or in search results. The document\'s title is often different from its first heading, since the first heading does not have to stand alone when taken out of context.')), + base: new HTMLTagSpecification( + nls.localize('tags.base', 'The base element allows authors to specify the document base URL for the purposes of resolving relative URLs, and the name of the default browsing context for the purposes of following hyperlinks. The element does not represent any content beyond this information.'), + ['href', 'target']), + link: new HTMLTagSpecification( + nls.localize('tags.link', 'The link element allows authors to link their document to other resources.'), + ['href', 'crossorigin:xo', 'rel', 'media', 'hreflang', 'type', 'sizes']), + meta: new HTMLTagSpecification( + nls.localize('tags.meta', 'The meta element represents various kinds of metadata that cannot be expressed using the title, base, link, style, and script elements.'), + ['name', 'http-equiv', 'content', 'charset']), + style: new HTMLTagSpecification( + nls.localize('tags.style', 'The style element allows authors to embed style information in their documents. The style element is one of several inputs to the styling processing model. The element does not represent content for the user.'), + ['media', 'nonce', 'type', 'scoped:v']), + // Sections + body: new HTMLTagSpecification( + nls.localize('tags.body', 'The body element represents the content of the document.'), + ['onafterprint', 'onbeforeprint', 'onbeforeunload', 'onhashchange', 'onlanguagechange', 'onmessage', 'onoffline', 'ononline', 'onpagehide', 'onpageshow', 'onpopstate', 'onstorage', 'onunload']), + article: new HTMLTagSpecification( + nls.localize('tags.article', 'The article element represents a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content. Each article should be identified, typically by including a heading (h1–h6 element) as a child of the article element.')), + section: new HTMLTagSpecification( + nls.localize('tags.section', 'The section element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content. Each section should be identified, typically by including a heading ( h1- h6 element) as a child of the section element.')), + nav: new HTMLTagSpecification( + nls.localize('tags.nav', 'The nav element represents a section of a page that links to other pages or to parts within the page: a section with navigation links.')), + aside: new HTMLTagSpecification( + nls.localize('tags.aside', 'The aside element represents a section of a page that consists of content that is tangentially related to the content around the aside element, and which could be considered separate from that content. Such sections are often represented as sidebars in printed typography.')), + h1: new HTMLTagSpecification( + nls.localize('tags.h1', 'The h1 element represents a section heading.')), + h2: new HTMLTagSpecification( + nls.localize('tags.h2', 'The h2 element represents a section heading.')), + h3: new HTMLTagSpecification( + nls.localize('tags.h3', 'The h3 element represents a section heading.')), + h4: new HTMLTagSpecification( + nls.localize('tags.h4', 'The h4 element represents a section heading.')), + h5: new HTMLTagSpecification( + nls.localize('tags.h5', 'The h5 element represents a section heading.')), + h6: new HTMLTagSpecification( + nls.localize('tags.h6', 'The h6 element represents a section heading.')), + header: new HTMLTagSpecification( + nls.localize('tags.header', 'The header element represents introductory content for its nearest ancestor sectioning content or sectioning root element. A header typically contains a group of introductory or navigational aids. When the nearest ancestor sectioning content or sectioning root element is the body element, then it applies to the whole page.')), + footer: new HTMLTagSpecification( + nls.localize('tags.footer', 'The footer element represents a footer for its nearest ancestor sectioning content or sectioning root element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like.')), + address: new HTMLTagSpecification( + nls.localize('tags.address', 'The address element represents the contact information for its nearest article or body element ancestor. If that is the body element, then the contact information applies to the document as a whole.')), + // Grouping content + p: new HTMLTagSpecification( + nls.localize('tags.p', 'The p element represents a paragraph.')), + hr: new HTMLTagSpecification( + nls.localize('tags.hr', 'The hr element represents a paragraph-level thematic break, e.g. a scene change in a story, or a transition to another topic within a section of a reference book.')), + pre: new HTMLTagSpecification( + nls.localize('tags.pre', 'The pre element represents a block of preformatted text, in which structure is represented by typographic conventions rather than by elements.')), + blockquote: new HTMLTagSpecification( + nls.localize('tags.blockquote', 'The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a footer or cite element, and optionally with in-line changes such as annotations and abbreviations.'), + ['cite']), + ol: new HTMLTagSpecification( + nls.localize('tags.ol', 'The ol element represents a list of items, where the items have been intentionally ordered, such that changing the order would change the meaning of the document.'), + ['reversed:v', 'start', 'type:lt']), + ul: new HTMLTagSpecification( + nls.localize('tags.ul', 'The ul element represents a list of items, where the order of the items is not important — that is, where changing the order would not materially change the meaning of the document.')), + li: new HTMLTagSpecification( + nls.localize('tags.li', 'The li element represents a list item. If its parent element is an ol, ul, or menu element, then the element is an item of the parent element\'s list, as defined for those elements. Otherwise, the list item has no defined list-related relationship to any other li element.'), + ['value']), + dl: new HTMLTagSpecification( + nls.localize('tags.dl', 'The dl element represents an association list consisting of zero or more name-value groups (a description list). A name-value group consists of one or more names (dt elements) followed by one or more values (dd elements), ignoring any nodes other than dt and dd elements. Within a single dl element, there should not be more than one dt element for each name.')), + dt: new HTMLTagSpecification( + nls.localize('tags.dt', 'The dt element represents the term, or name, part of a term-description group in a description list (dl element).')), + dd: new HTMLTagSpecification( + nls.localize('tags.dd', 'The dd element represents the description, definition, or value, part of a term-description group in a description list (dl element).')), + figure: new HTMLTagSpecification( + nls.localize('tags.figure', 'The figure element represents some flow content, optionally with a caption, that is self-contained (like a complete sentence) and is typically referenced as a single unit from the main flow of the document.')), + figcaption: new HTMLTagSpecification( + nls.localize('tags.figcaption', 'The figcaption element represents a caption or legend for the rest of the contents of the figcaption element\'s parent figure element, if any.')), + main: new HTMLTagSpecification( + nls.localize('tags.main', 'The main element represents the main content of the body of a document or application. The main content area consists of content that is directly related to or expands upon the central topic of a document or central functionality of an application.')), + div: new HTMLTagSpecification( + nls.localize('tags.div', 'The div element has no special meaning at all. It represents its children. It can be used with the class, lang, and title attributes to mark up semantics common to a group of consecutive elements.')), + // Text-level semantics + a: new HTMLTagSpecification( + nls.localize('tags.a', 'If the a element has an href attribute, then it represents a hyperlink (a hypertext anchor) labeled by its contents.'), + ['href', 'target', 'download', 'ping', 'rel', 'hreflang', 'type']), + em: new HTMLTagSpecification( + nls.localize('tags.em', 'The em element represents stress emphasis of its contents.')), + strong: new HTMLTagSpecification( + nls.localize('tags.strong', 'The strong element represents strong importance, seriousness, or urgency for its contents.')), + small: new HTMLTagSpecification( + nls.localize('tags.small', 'The small element represents side comments such as small print.')), + s: new HTMLTagSpecification( + nls.localize('tags.s', 'The s element represents contents that are no longer accurate or no longer relevant.')), + cite: new HTMLTagSpecification( + nls.localize('tags.cite', 'The cite element represents a reference to a creative work. It must include the title of the work or the name of the author(person, people or organization) or an URL reference, or a reference in abbreviated form as per the conventions used for the addition of citation metadata.')), + q: new HTMLTagSpecification( + nls.localize('tags.q', 'The q element represents some phrasing content quoted from another source.'), + ['cite']), + dfn: new HTMLTagSpecification( + nls.localize('tags.dfn', 'The dfn element represents the defining instance of a term. The paragraph, description list group, or section that is the nearest ancestor of the dfn element must also contain the definition(s) for the term given by the dfn element.')), + abbr: new HTMLTagSpecification( + nls.localize('tags.abbr', 'The abbr element represents an abbreviation or acronym, optionally with its expansion. The title attribute may be used to provide an expansion of the abbreviation. The attribute, if specified, must contain an expansion of the abbreviation, and nothing else.')), + ruby: new HTMLTagSpecification( + nls.localize('tags.ruby', 'The ruby element allows one or more spans of phrasing content to be marked with ruby annotations. Ruby annotations are short runs of text presented alongside base text, primarily used in East Asian typography as a guide for pronunciation or to include other annotations. In Japanese, this form of typography is also known as furigana. Ruby text can appear on either side, and sometimes both sides, of the base text, and it is possible to control its position using CSS. A more complete introduction to ruby can be found in the Use Cases & Exploratory Approaches for Ruby Markup document as well as in CSS Ruby Module Level 1. [RUBY-UC] [CSSRUBY]')), + rb: new HTMLTagSpecification( + nls.localize('tags.rb', 'The rb element marks the base text component of a ruby annotation. When it is the child of a ruby element, it doesn\'t represent anything itself, but its parent ruby element uses it as part of determining what it represents.')), + rt: new HTMLTagSpecification( + nls.localize('tags.rt', 'The rt element marks the ruby text component of a ruby annotation. When it is the child of a ruby element or of an rtc element that is itself the child of a ruby element, it doesn\'t represent anything itself, but its ancestor ruby element uses it as part of determining what it represents.')), + // is not yet supported by 2+ browsers + //rtc: new HTMLTagSpecification( + // nls.localize('tags.rtc', 'The rtc element marks a ruby text container for ruby text components in a ruby annotation. When it is the child of a ruby element it doesn\'t represent anything itself, but its parent ruby element uses it as part of determining what it represents.')), + rp: new HTMLTagSpecification( + nls.localize('tags.rp', 'The rp element is used to provide fallback text to be shown by user agents that don\'t support ruby annotations. One widespread convention is to provide parentheses around the ruby text component of a ruby annotation.')), + // is not yet supported by 2+ browsers + //data: new HTMLTagSpecification( + // nls.localize('tags.data', 'The data element represents its contents, along with a machine-readable form of those contents in the value attribute.')), + time: new HTMLTagSpecification( + nls.localize('tags.time', 'The time element represents its contents, along with a machine-readable form of those contents in the datetime attribute. The kind of content is limited to various kinds of dates, times, time-zone offsets, and durations, as described below.'), + ['datetime']), + code: new HTMLTagSpecification( + nls.localize('tags.code', 'The code element represents a fragment of computer code. This could be an XML element name, a file name, a computer program, or any other string that a computer would recognize.')), + var: new HTMLTagSpecification( + nls.localize('tags.var', 'The var element represents a variable. This could be an actual variable in a mathematical expression or programming context, an identifier representing a constant, a symbol identifying a physical quantity, a function parameter, or just be a term used as a placeholder in prose.')), + samp: new HTMLTagSpecification( + nls.localize('tags.samp', 'The samp element represents sample or quoted output from another program or computing system.')), + kbd: new HTMLTagSpecification( + nls.localize('tags.kbd', 'The kbd element represents user input (typically keyboard input, although it may also be used to represent other input, such as voice commands).')), + sub: new HTMLTagSpecification( + nls.localize('tags.sub', 'The sub element represents a subscript.')), + sup: new HTMLTagSpecification( + nls.localize('tags.sup', 'The sup element represents a superscript.')), + i: new HTMLTagSpecification( + nls.localize('tags.i', 'The i element represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose in a manner indicating a different quality of text, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, transliteration, a thought, or a ship name in Western texts.')), + b: new HTMLTagSpecification( + nls.localize('tags.b', 'The b element represents a span of text to which attention is being drawn for utilitarian purposes without conveying any extra importance and with no implication of an alternate voice or mood, such as key words in a document abstract, product names in a review, actionable words in interactive text-driven software, or an article lede.')), + u: new HTMLTagSpecification( + nls.localize('tags.u', 'The u element represents a span of text with an unarticulated, though explicitly rendered, non-textual annotation, such as labeling the text as being a proper name in Chinese text (a Chinese proper name mark), or labeling the text as being misspelt.')), + mark: new HTMLTagSpecification( + nls.localize('tags.mark', 'The mark element represents a run of text in one document marked or highlighted for reference purposes, due to its relevance in another context. When used in a quotation or other block of text referred to from the prose, it indicates a highlight that was not originally present but which has been added to bring the reader\'s attention to a part of the text that might not have been considered important by the original author when the block was originally written, but which is now under previously unexpected scrutiny. When used in the main prose of a document, it indicates a part of the document that has been highlighted due to its likely relevance to the user\'s current activity.')), + bdi: new HTMLTagSpecification( + nls.localize('tags.bdi', 'The bdi element represents a span of text that is to be isolated from its surroundings for the purposes of bidirectional text formatting. [BIDI]')), + bdo: new HTMLTagSpecification( + nls.localize('tags.dbo', 'The bdo element represents explicit text directionality formatting control for its children. It allows authors to override the Unicode bidirectional algorithm by explicitly specifying a direction override. [BIDI]')), + span: new HTMLTagSpecification( + nls.localize('tags.span', 'The span element doesn\'t mean anything on its own, but can be useful when used together with the global attributes, e.g. class, lang, or dir. It represents its children.')), + br: new HTMLTagSpecification( + nls.localize('tags.br', 'The br element represents a line break.')), + wbr: new HTMLTagSpecification( + nls.localize('tags.wbr', 'The wbr element represents a line break opportunity.')), + // Edits + ins: new HTMLTagSpecification( + nls.localize('tags.ins', 'The ins element represents an addition to the document.')), + del: new HTMLTagSpecification( + nls.localize('tags.del', 'The del element represents a removal from the document.'), + ['cite', 'datetime']), + // Embedded content + picture: new HTMLTagSpecification( + nls.localize('tags.picture', 'The picture element is a container which provides multiple sources to its contained img element to allow authors to declaratively control or give hints to the user agent about which image resource to use, based on the screen pixel density, viewport size, image format, and other factors. It represents its children.')), + img: new HTMLTagSpecification( + nls.localize('tags.img', 'An img element represents an image.'), + ['alt', 'src', 'srcset', 'crossorigin:xo', 'usemap', 'ismap:v', 'width', 'height']), + iframe: new HTMLTagSpecification( + nls.localize('tags.iframe', 'The iframe element represents a nested browsing context.'), + ['src', 'srcdoc', 'name', 'sandbox:sb', 'seamless:v', 'allowfullscreen:v', 'width', 'height']), + embed: new HTMLTagSpecification( + nls.localize('tags.embed', 'The embed element provides an integration point for an external (typically non-HTML) application or interactive content.'), + ['src', 'type', 'width', 'height']), + object: new HTMLTagSpecification( + nls.localize('tags.object', 'The object element can represent an external resource, which, depending on the type of the resource, will either be treated as an image, as a nested browsing context, or as an external resource to be processed by a plugin.'), + ['data', 'type', 'typemustmatch:v', 'name', 'usemap', 'form', 'width', 'height']), + param: new HTMLTagSpecification( + nls.localize('tags.param', 'The param element defines parameters for plugins invoked by object elements. It does not represent anything on its own.'), + ['name', 'value']), + video: new HTMLTagSpecification( + nls.localize('tags.video', 'A video element is used for playing videos or movies, and audio files with captions.'), + ['src', 'crossorigin:xo', 'poster', 'preload:pl', 'autoplay:v', 'mediagroup', 'loop:v', 'muted:v', 'controls:v', 'width', 'height']), + audio: new HTMLTagSpecification( + nls.localize('tags.audio', 'An audio element represents a sound or audio stream.'), + ['src', 'crossorigin:xo', 'preload:pl', 'autoplay:v', 'mediagroup', 'loop:v', 'muted:v', 'controls:v']), + source: new HTMLTagSpecification( + nls.localize('tags.source', 'The source element allows authors to specify multiple alternative media resources for media elements. It does not represent anything on its own.'), + // 'When the source element has a parent that is a picture element, the source element allows authors to specify multiple alternative source sets for img elements.' + ['src', 'type']), + track: new HTMLTagSpecification( + nls.localize('tags.track', 'The track element allows authors to specify explicit external timed text tracks for media elements. It does not represent anything on its own.'), + ['default:v', 'kind:tk', 'label', 'src', 'srclang']), + map: new HTMLTagSpecification( + nls.localize('tags.map', 'The map element, in conjunction with an img element and any area element descendants, defines an image map. The element represents its children.'), + ['name']), + area: new HTMLTagSpecification( + nls.localize('tags.area', 'The area element represents either a hyperlink with some text and a corresponding area on an image map, or a dead area on an image map.'), + ['alt', 'coords', 'shape:sh', 'href', 'target', 'download', 'ping', 'rel', 'hreflang', 'type']), + // Tabular data + table: new HTMLTagSpecification( + nls.localize('tags.table', 'The table element represents data with more than one dimension, in the form of a table.'), + ['sortable:v', 'border']), + caption: new HTMLTagSpecification( + nls.localize('tags.caption', 'The caption element represents the title of the table that is its parent, if it has a parent and that is a table element.')), + colgroup: new HTMLTagSpecification( + nls.localize('tags.colgroup', 'The colgroup element represents a group of one or more columns in the table that is its parent, if it has a parent and that is a table element.'), + ['span']), + col: new HTMLTagSpecification( + nls.localize('tags.col', 'If a col element has a parent and that is a colgroup element that itself has a parent that is a table element, then the col element represents one or more columns in the column group represented by that colgroup.'), + ['span']), + tbody: new HTMLTagSpecification( + nls.localize('tags.tbody', 'The tbody element represents a block of rows that consist of a body of data for the parent table element, if the tbody element has a parent and it is a table.')), + thead: new HTMLTagSpecification( + nls.localize('tags.thead', 'The thead element represents the block of rows that consist of the column labels (headers) for the parent table element, if the thead element has a parent and it is a table.')), + tfoot: new HTMLTagSpecification( + nls.localize('tags.tfoot', 'The tfoot element represents the block of rows that consist of the column summaries (footers) for the parent table element, if the tfoot element has a parent and it is a table.')), + tr: new HTMLTagSpecification( + nls.localize('tags.tr', 'The tr element represents a row of cells in a table.')), + td: new HTMLTagSpecification( + nls.localize('tags.td', 'The td element represents a data cell in a table.'), + ['colspan', 'rowspan', 'headers']), + th: new HTMLTagSpecification( + nls.localize('tags.th', 'The th element represents a header cell in a table.'), + ['colspan', 'rowspan', 'headers', 'scope:s', 'sorted', 'abbr']), + // Forms + form: new HTMLTagSpecification( + nls.localize('tags.form', 'The form element represents a collection of form-associated elements, some of which can represent editable values that can be submitted to a server for processing.'), + ['accept-charset', 'action', 'autocomplete:o', 'enctype:et', 'method:m', 'name', 'novalidate:v', 'target']), + label: new HTMLTagSpecification( + nls.localize('tags.label', 'The label element represents a caption in a user interface. The caption can be associated with a specific form control, known as the label element\'s labeled control, either using the for attribute, or by putting the form control inside the label element itself.'), + ['form', 'for']), + input: new HTMLTagSpecification( + nls.localize('tags.input', 'The input element represents a typed data field, usually with a form control to allow the user to edit the data.'), + ['accept', 'alt', 'autocomplete:o', 'autofocus:v', 'checked:v', 'dirname', 'disabled:v', 'form', 'formaction', 'formenctype:et', 'formmethod:fm', 'formnovalidate:v', 'formtarget', 'height', 'inputmode:im', 'list', 'max', 'maxlength', 'min', 'minlength', 'multiple:v', 'name', 'pattern', 'placeholder', 'readonly:v', 'required:v', 'size', 'src', 'step', 'type:t', 'value', 'width']), + button: new HTMLTagSpecification( + nls.localize('tags.button', 'The button element represents a button labeled by its contents.'), + ['autofocus:v', 'disabled:v', 'form', 'formaction', 'formenctype:et', 'formmethod:fm', 'formnovalidate:v', 'formtarget', 'name', 'type:bt', 'value']), + select: new HTMLTagSpecification( + nls.localize('tags.select', 'The select element represents a control for selecting amongst a set of options.'), + ['autocomplete:o', 'autofocus:v', 'disabled:v', 'form', 'multiple:v', 'name', 'required:v', 'size']), + datalist: new HTMLTagSpecification( + nls.localize('tags.datalist', 'The datalist element represents a set of option elements that represent predefined options for other controls. In the rendering, the datalist element represents nothing and it, along with its children, should be hidden.')), + optgroup: new HTMLTagSpecification( + nls.localize('tags.optgroup', 'The optgroup element represents a group of option elements with a common label.'), + ['disabled:v', 'label']), + option: new HTMLTagSpecification( + nls.localize('tags.option', 'The option element represents an option in a select element or as part of a list of suggestions in a datalist element.'), + ['disabled:v', 'label', 'selected:v', 'value']), + textarea: new HTMLTagSpecification( + nls.localize('tags.textarea', 'The textarea element represents a multiline plain text edit control for the element\'s raw value. The contents of the control represent the control\'s default value.'), + ['autocomplete:o', 'autofocus:v', 'cols', 'dirname', 'disabled:v', 'form', 'inputmode:im', 'maxlength', 'minlength', 'name', 'placeholder', 'readonly:v', 'required:v', 'rows', 'wrap:w']), + output: new HTMLTagSpecification( + nls.localize('tags.output', 'The output element represents the result of a calculation performed by the application, or the result of a user action.'), + ['for', 'form', 'name']), + progress: new HTMLTagSpecification( + nls.localize('tags.progress', 'The progress element represents the completion progress of a task. The progress is either indeterminate, indicating that progress is being made but that it is not clear how much more work remains to be done before the task is complete (e.g. because the task is waiting for a remote host to respond), or the progress is a number in the range zero to a maximum, giving the fraction of work that has so far been completed.'), + ['value', 'max']), + meter: new HTMLTagSpecification( + nls.localize('tags.meter', 'The meter element represents a scalar measurement within a known range, or a fractional value; for example disk usage, the relevance of a query result, or the fraction of a voting population to have selected a particular candidate.'), + ['value', 'min', 'max', 'low', 'high', 'optimum']), + fieldset: new HTMLTagSpecification( + nls.localize('tags.fieldset', 'The fieldset element represents a set of form controls optionally grouped under a common name.'), + ['disabled:v', 'form', 'name']), + legend: new HTMLTagSpecification( + nls.localize('tags.legend', 'The legend element represents a caption for the rest of the contents of the legend element\'s parent fieldset element, if any.')), + // Interactive elements + details: new HTMLTagSpecification( + nls.localize('tags.details', 'The details element represents a disclosure widget from which the user can obtain additional information or controls.'), + ['open:v']), + summary: new HTMLTagSpecification( + nls.localize('tags.summary', 'The summary element represents a summary, caption, or legend for the rest of the contents of the summary element\'s parent details element, if any.')), + // and are not yet supported by 2+ browsers + //menu: new HTMLTagSpecification( + // nls.localize('tags.menu', 'The menu element represents a list of commands.'), + // ['type:mt', 'label']), + //menuitem: new HTMLTagSpecification( + // nls.localize('tags.menuitem', 'The menuitem element represents a command that the user can invoke from a popup menu (either a context menu or the menu of a menu button).')), + dialog: new HTMLTagSpecification( + nls.localize('tags.dialog', 'The dialog element represents a part of an application that a user interacts with to perform a task, for example a dialog box, inspector, or window.')), + // Scripting + script: new HTMLTagSpecification( + nls.localize('tags.script', 'The script element allows authors to include dynamic script and data blocks in their documents. The element does not represent content for the user.'), + ['src', 'type', 'charset', 'async:v', 'defer:v', 'crossorigin:xo', 'nonce']), + noscript: new HTMLTagSpecification( + nls.localize('tags.noscript', 'The noscript element represents nothing if scripting is enabled, and represents its children if scripting is disabled. It is used to present different markup to user agents that support scripting and those that don\'t support scripting, by affecting how the document is parsed.')), + template: new HTMLTagSpecification( + nls.localize('tags.template', 'The template element is used to declare fragments of HTML that can be cloned and inserted in the document by script.')), + canvas: new HTMLTagSpecification( + nls.localize('tags.canvas', 'The canvas element provides scripts with a resolution-dependent bitmap canvas, which can be used for rendering graphs, game graphics, art, or other visual images on the fly.'), + ['width', 'height']) +}; + export function getHTML5TagProvider(): IHTMLTagProvider { - var none: string[] = []; - - var html5Tags : { [tag:string]: string[]} = { - html: ['manifest'], - head: none, - title: none, - noscript: none, - main: none, - section: none, - nav: none, - article: none, - aside: none, - h1: none, - h2: none, - h3: none, - h4: none, - h5: none, - h6: none, - hgroup: none, - header: none, - footer: none, - address: none, - p: none, - hr: none, - pre: none, - blockquote: ['cite'], - ol: ['reversed:v', 'start', 'type:lt'], - ul: none, - li: ['value'], - dl: none, - dt: none, - dd: none, - figure: none, - figcaption: none, - div: none, - a: ['href', 'target', 'download', 'ping', 'rel', 'hreflang', 'type'], - em: none, - strong: none, - small: none, - s: none, - cite: none, - q: ['cite'], - dfn: none, - abbr: none, - data: ['value'], - time: ['datetime'], - code: none, - var: none, - samp: none, - kbd: none, - sub: none, - sup: none, - i: none, - b: none, - u: none, - mark: none, - ruby: none, - rb: none, - rp: none, - rt: none, - rtc: none, - bdi: none, - bdo: none, - span: none, - br: none, - wbr: none, - ins: ['cite', 'datetime'], - del: ['cite', 'datetime'], - picture: none, - img: ['alt', 'src', 'srcset', 'crossorigin:xo', 'usemap', 'ismap:v', 'width', 'height'], - iframe: ['src', 'srcdoc', 'name', 'sandbox:sb', 'seamless:v', 'allowfullscreen:v', 'width', 'height'], - embed: ['src', 'type', 'width', 'height'], - object: ['data', 'type', 'typemustmatch:v', 'name', 'usemap', 'form', 'width', 'height'], - param: ['name', 'value'], - video: ['src', 'crossorigin:xo', 'poster', 'preload:pl', 'autoplay:v', 'mediagroup', 'loop:v', 'muted:v', 'controls:v', 'width', 'height'], - audio: ['src', 'crossorigin:xo', 'preload:pl', 'autoplay:v', 'mediagroup', 'loop:v', 'muted:v', 'controls:v'], - source: ['src', 'type'], - track: ['default:v', 'kind:tk', 'label', 'src', 'srclang'], - canvas: ['width', 'height'], - map: ['name'], - area: ['alt', 'coords', 'shape:sh', 'href', 'target', 'download', 'ping', 'rel', 'hreflang', 'type'], - base: ['href', 'target'], - link: ['href', 'crossorigin:xo', 'rel', 'media', 'hreflang', 'type', 'sizes'], - meta: ['name', 'http-equiv', 'content', 'charset'], - style: ['media', 'nonce', 'type', 'scoped:v'], - script: ['src', 'type', 'charset', 'async:v', 'defer:v', 'crossorigin:xo', 'nonce'], - template: none, - body: ['onafterprint', 'onbeforeprint', 'onbeforeunload', 'onhashchange', 'onlanguagechange', 'onmessage', 'onoffline', 'ononline', 'onpagehide', - 'onpageshow', 'onpopstate', 'onstorage', 'onunload'], - table: ['sortable:v', 'border'], - caption: none, - colgroup: ['span'], - col: ['span'], - tbody: none, - thead: none, - tfoot: none, - tr: none, - td: ['colspan', 'rowspan', 'headers'], - th: ['colspan', 'rowspan', 'headers', 'scope:s', 'sorted', 'abbr'], - form: ['accept-charset', 'action', 'autocomplete:o', 'enctype:et', 'method:m', 'name', 'novalidate:v', 'target'], - fieldset: ['disabled:v', 'form', 'name'], - legend: none, - label: ['form', 'for'], - input: ['accept', 'alt', 'autocomplete:o', 'autofocus:v', 'checked:v', 'dirname', 'disabled:v', 'form', 'formaction', 'formenctype:et', - 'formmethod:fm', 'formnovalidate:v', 'formtarget', 'height', 'inputmode:im', 'list', 'max', 'maxlength', 'min', 'minlength', 'multiple:v', 'name', - 'pattern', 'placeholder', 'readonly:v', 'required:v', 'size', 'src', 'step', 'type:t', 'value', 'width'], - button: ['autofocus:v', 'disabled:v', 'form', 'formaction', 'formenctype:et', 'formmethod:fm', 'formnovalidate:v', 'formtarget', 'name', 'type:bt', 'value'], - select: ['autocomplete:o', 'autofocus:v', 'disabled:v', 'form', 'multiple:v', 'name', 'required:v', 'size'], - datalist: none, - optgroup: ['disabled:v', 'label'], - option: ['disabled:v', 'label', 'selected:v', 'value'], - textarea: ['autocomplete:o', 'autofocus:v', 'cols', 'dirname', 'disabled:v', 'form', 'inputmode:im', 'maxlength', 'minlength', 'name', 'placeholder', 'readonly:v', 'required:v', 'rows', 'wrap:w'], - keygen: ['autofocus:v', 'challenge', 'disabled:v', 'form', 'keytype', 'name'], - output: ['for', 'form', 'name'], - progress: ['value', 'max'], - meter: ['value', 'min', 'max', 'low', 'high', 'optimum'], - details: ['open:v'], - summary: none, - menu: ['type:mt', 'label'], - menuitem: ['type:mit', 'label', 'icon', 'disabled:v', 'checked:v', 'radiogroup', 'default:v', 'command'], - dialog: ['open:v'] - }; - var globalAttributes = [ 'aria-activedescendant', 'aria-atomic:b', 'aria-autocomplete:autocomplete', 'aria-busy:b', 'aria-checked:tristate', 'aria-colcount', 'aria-colindex', 'aria-colspan', 'aria-controls', 'aria-current:current', 'aria-describedat', 'aria-describedby', 'aria-disabled:b', 'aria-dropeffect:dropeffect', 'aria-errormessage', 'aria-expanded:u', 'aria-flowto', 'aria-grabbed:u', 'aria-haspopup:b', 'aria-hidden:b', 'aria-invalid:invalid', 'aria-kbdshortcuts', @@ -194,9 +365,9 @@ export function getHTML5TagProvider(): IHTMLTagProvider { }; return { - collectTags: (collector: (tag: string) => void) => { - for (var tag in html5Tags) { - collector(tag); + collectTags: (collector: (tag: string, label: string) => void) => { + for (var tag in HTML_TAGS) { + collector(tag, HTML_TAGS[tag].label); } }, collectAttributes: (tag: string, collector: (attribute: string, type: string) => void) => { @@ -208,7 +379,7 @@ export function getHTML5TagProvider(): IHTMLTagProvider { collector(handler, 'event'); }); if (tag) { - var attributes = html5Tags[tag]; + var attributes = HTML_TAGS[tag].attributes; if (attributes) { attributes.forEach(attr => { var segments = attr.split(':'); @@ -234,7 +405,7 @@ export function getHTML5TagProvider(): IHTMLTagProvider { } }); }; - var attributes = html5Tags[tag]; + var attributes = HTML_TAGS[tag].attributes; if (attributes) { processAttributes(attributes); } diff --git a/src/vs/languages/html/common/htmlTokenTypes.ts b/src/vs/languages/html/common/htmlTokenTypes.ts index e8224bd31ae..e731e759cd4 100644 --- a/src/vs/languages/html/common/htmlTokenTypes.ts +++ b/src/vs/languages/html/common/htmlTokenTypes.ts @@ -6,9 +6,9 @@ import strings = require('vs/base/common/strings'); -export const DELIM_END = 'punctuation.tag.end.html'; -export const DELIM_START = 'punctuation.tag.begin.html'; -export const DELIM_ASSIGN = 'tag.assign.html'; +export const DELIM_END = 'punctuation.definition.meta.tag.end.html'; +export const DELIM_START = 'punctuation.definition.meta.tag.begin.html'; +export const DELIM_ASSIGN = 'meta.tag.assign.html'; export const ATTRIB_NAME = 'entity.other.attribute-name.html'; export const ATTRIB_VALUE = 'string.html'; export const COMMENT = 'comment.html.content'; diff --git a/src/vs/languages/html/common/htmlWorker.ts b/src/vs/languages/html/common/htmlWorker.ts index 8a765294aa7..ba897aefbbb 100644 --- a/src/vs/languages/html/common/htmlWorker.ts +++ b/src/vs/languages/html/common/htmlWorker.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; +import URI from 'vs/base/common/uri'; import winjs = require('vs/base/common/winjs.base'); import {AbstractModeWorker} from 'vs/editor/common/modes/abstractModeWorker'; import beautifyHTML = require('vs/languages/lib/common/beautify-html'); @@ -20,6 +21,7 @@ import {IMarkerService} from 'vs/platform/markers/common/markers'; import {IResourceService} from 'vs/editor/common/services/resourceService'; import {getScanner, IHTMLScanner} from 'vs/languages/html/common/htmlScanner'; import {isTag, DELIM_END, DELIM_START, DELIM_ASSIGN, ATTRIB_NAME, ATTRIB_VALUE} from 'vs/languages/html/common/htmlTokenTypes'; +import {isEmptyElement} from 'vs/languages/html/common/htmlEmptyTagsShared'; enum LinkDetectionState { LOOKING_FOR_HREF_OR_SRC = 1, @@ -53,7 +55,7 @@ export class HTMLWorker extends AbstractModeWorker { providers.push(htmlTags.getAngularTagProvider()); } - public format(resource: network.URL, range: EditorCommon.IRange, options: Modes.IFormattingOptions): winjs.TPromise { + public format(resource: URI, range: EditorCommon.IRange, options: Modes.IFormattingOptions): winjs.TPromise { return this._delegateToModeAtPosition(resource, Position.startPosition(range), (isEmbeddedMode, model) => { if (isEmbeddedMode && model.getMode().formattingSupport) { return model.getMode().formattingSupport.formatRange(model.getAssociatedResource(), range, options); @@ -63,7 +65,7 @@ export class HTMLWorker extends AbstractModeWorker { }); } - private formatHTML(resource: network.URL, range: EditorCommon.IRange, options: Modes.IFormattingOptions): winjs.TPromise { + private formatHTML(resource: URI, range: EditorCommon.IRange, options: Modes.IFormattingOptions): winjs.TPromise { var model = this.resourceService.get(resource); var value = range ? model.getValueInRange(range) : model.getValue(); @@ -79,7 +81,7 @@ export class HTMLWorker extends AbstractModeWorker { }]); } - _delegateToModeAtPosition(resource:network.URL, position:EditorCommon.IPosition, callback:(isEmbeddedMode:boolean, model:EditorCommon.IMirrorModel) => T): T { + _delegateToModeAtPosition(resource:URI, position:EditorCommon.IPosition, callback:(isEmbeddedMode:boolean, model:EditorCommon.IMirrorModel) => T): T { var model = this.resourceService.get(resource); if (!model) { @@ -97,7 +99,7 @@ export class HTMLWorker extends AbstractModeWorker { return callback(modeAtPosition.getId() !== this._getMode().getId(), modelAtPosition); } - _delegateToAllModes(resource:network.URL, callback:(models:EditorCommon.IMirrorModel[]) => T): T { + _delegateToAllModes(resource:URI, callback:(models:EditorCommon.IMirrorModel[]) => T): T { var model = this.resourceService.get(resource); if (!model) { @@ -107,7 +109,7 @@ export class HTMLWorker extends AbstractModeWorker { return callback(model.getAllEmbedded()); } - public computeInfo(resource:network.URL, position:EditorCommon.IPosition): winjs.TPromise { + public computeInfo(resource:URI, position:EditorCommon.IPosition): winjs.TPromise { return this._delegateToModeAtPosition(resource, position, (isEmbeddedMode, model) => { if (isEmbeddedMode && model.getMode().extraInfoSupport) { return model.getMode().extraInfoSupport.computeInfo(model.getAssociatedResource(), position); @@ -115,7 +117,7 @@ export class HTMLWorker extends AbstractModeWorker { }); } - public findReferences(resource:network.URL, position:EditorCommon.IPosition, includeDeclaration:boolean): winjs.TPromise { + public findReferences(resource:URI, position:EditorCommon.IPosition, includeDeclaration:boolean): winjs.TPromise { return this._delegateToModeAtPosition(resource, position, (isEmbeddedMode, model) => { if (isEmbeddedMode && model.getMode().referenceSupport) { return model.getMode().referenceSupport.findReferences(model.getAssociatedResource(), position, includeDeclaration); @@ -123,7 +125,7 @@ export class HTMLWorker extends AbstractModeWorker { }); } - public getRangesToPosition(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public getRangesToPosition(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this._delegateToModeAtPosition(resource, position, (isEmbeddedMode, model) => { if (isEmbeddedMode && model.getMode().logicalSelectionSupport) { return model.getMode().logicalSelectionSupport.getRangesToPosition(model.getAssociatedResource(), position); @@ -131,7 +133,7 @@ export class HTMLWorker extends AbstractModeWorker { }); } - public findDeclaration(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public findDeclaration(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this._delegateToModeAtPosition(resource, position, (isEmbeddedMode, model) => { if (isEmbeddedMode && model.getMode().declarationSupport) { return model.getMode().declarationSupport.findDeclaration(model.getAssociatedResource(), position); @@ -139,7 +141,7 @@ export class HTMLWorker extends AbstractModeWorker { }); } - public findColorDeclarations(resource:network.URL):winjs.TPromise<{range:EditorCommon.IRange; value:string; }[]> { + public findColorDeclarations(resource:URI):winjs.TPromise<{range:EditorCommon.IRange; value:string; }[]> { return this._delegateToAllModes(resource, (models) => { var allPromises: winjs.TPromise[] = []; @@ -157,7 +159,7 @@ export class HTMLWorker extends AbstractModeWorker { }); } - public getParameterHints(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public getParameterHints(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this._delegateToModeAtPosition(resource, position, (isEmbeddedMode, model) => { if (isEmbeddedMode && model.getMode().parameterHintsSupport) { return model.getMode().parameterHintsSupport.getParameterHints(model.getAssociatedResource(), position); @@ -174,7 +176,7 @@ export class HTMLWorker extends AbstractModeWorker { scanner.scanBack(); if (scanner.getTokenType() === DELIM_END) { closedTags[tag] = (closedTags[tag] || 0) + 1; - } else if (!htmlTags.isEmptyElement(tag)) { + } else if (!isEmptyElement(tag)) { if (closedTags[tag]) { closedTags[tag]--; } else { @@ -188,7 +190,7 @@ export class HTMLWorker extends AbstractModeWorker { return null; } - private collectTagSuggestions(scanner: IHTMLScanner, position: EditorCommon.IPosition, suggestions: Modes.ISuggestions): void { + private collectTagSuggestions(scanner: IHTMLScanner, position: EditorCommon.IPosition, suggestions: Modes.ISuggestResult): void { var model = scanner.getModel(); var contentAfter = model.getLineContent(position.lineNumber).substr(position.column - 1); var closeTag = isWhiteSpace(contentAfter) || strings.startsWith(contentAfter, '<') ? '>' : ''; @@ -231,11 +233,12 @@ export class HTMLWorker extends AbstractModeWorker { this._tagProviders.forEach((provider) => { - provider.collectTags((tag) => { + provider.collectTags((tag, label) => { suggestions.suggestions.push({ label: '/' + tag, codeSnippet: '/' + tag + closeTag, - type: 'property' + type: 'property', + documentationLabel: label }); }); }); @@ -244,11 +247,12 @@ export class HTMLWorker extends AbstractModeWorker { collectClosingTagSuggestion(false); this._tagProviders.forEach((provider) => { - provider.collectTags((tag) => { + provider.collectTags((tag, label) => { suggestions.suggestions.push({ label: tag, codeSnippet: tag, - type: 'property' + type: 'property', + documentationLabel: label }); }); }); @@ -256,11 +260,11 @@ export class HTMLWorker extends AbstractModeWorker { } - private collectContentSuggestions(suggestions: Modes.ISuggestions): void { + private collectContentSuggestions(suggestions: Modes.ISuggestResult): void { // disable the simple snippets in favor of the emmet templates } - private collectAttributeSuggestions(scanner: IHTMLScanner, suggestions: Modes.ISuggestions): void { + private collectAttributeSuggestions(scanner: IHTMLScanner, suggestions: Modes.ISuggestResult): void { var parentTag: string = null; do { if (isTag(scanner.getTokenType())) { @@ -287,7 +291,7 @@ export class HTMLWorker extends AbstractModeWorker { }); } - private collectAttributeValueSuggestions(scanner: IHTMLScanner, suggestions: Modes.ISuggestions): void { + private collectAttributeValueSuggestions(scanner: IHTMLScanner, suggestions: Modes.ISuggestResult): void { var needsQuotes = scanner.getTokenType() === DELIM_ASSIGN; var attribute: string = null; @@ -319,7 +323,7 @@ export class HTMLWorker extends AbstractModeWorker { }); } - public suggest(resource:network.URL, position:EditorCommon.IPosition, triggerCharacter?:string):winjs.TPromise { + public suggest(resource:URI, position:EditorCommon.IPosition, triggerCharacter?:string):winjs.TPromise { return this._delegateToModeAtPosition(resource, position, (isEmbeddedMode, model) => { if (isEmbeddedMode && model.getMode().suggestSupport) { return model.getMode().suggestSupport.suggest(model.getAssociatedResource(), position, triggerCharacter); @@ -329,16 +333,16 @@ export class HTMLWorker extends AbstractModeWorker { }); } - public suggestHTML(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public suggestHTML(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return super.suggest(resource, position); } - public doSuggest(resource: network.URL, position: EditorCommon.IPosition): winjs.TPromise { + public doSuggest(resource: URI, position: EditorCommon.IPosition): winjs.TPromise { var model = this.resourceService.get(resource), currentWord = model.getWordUntilPosition(position).word; - var suggestions: Modes.ISuggestions = { + var suggestions: Modes.ISuggestResult = { currentWord: currentWord, suggestions: [], }; @@ -401,7 +405,7 @@ export class HTMLWorker extends AbstractModeWorker { } private findMatchingBracket(tagname: string, scanner: IHTMLScanner) : EditorCommon.IRange { - if (htmlTags.isEmptyElement(tagname)) { + if (isEmptyElement(tagname)) { return null; } var tagCount = 0; @@ -456,7 +460,7 @@ export class HTMLWorker extends AbstractModeWorker { } - public findOccurrences(resource:network.URL, position:EditorCommon.IPosition, strict:boolean = false): winjs.TPromise { + public findOccurrences(resource:URI, position:EditorCommon.IPosition, strict:boolean = false): winjs.TPromise { return this._delegateToModeAtPosition(resource, position, (isEmbeddedMode, model) => { if (isEmbeddedMode && model.getMode().occurrencesSupport) { return model.getMode().occurrencesSupport.findOccurrences(model.getAssociatedResource(), position, strict); @@ -466,7 +470,7 @@ export class HTMLWorker extends AbstractModeWorker { }); } - public findOccurrencesHTML(resource:network.URL, position:EditorCommon.IPosition, strict?:boolean):winjs.TPromise { + public findOccurrencesHTML(resource:URI, position:EditorCommon.IPosition, strict?:boolean):winjs.TPromise { var model = this.resourceService.get(resource), wordAtPosition = model.getWordAtPosition(position), @@ -507,9 +511,12 @@ export class HTMLWorker extends AbstractModeWorker { .replace(/^"([^"]+)"$/,(substr, match1) => match1); } - public static _getWorkspaceUrl(modelAbsoluteUrl: network.URL, rootAbsoluteUrl: network.URL, tokenContent: string): string { + public static _getWorkspaceUrl(modelAbsoluteUri: URI, rootAbsoluteUri: URI, tokenContent: string): string { + var modelAbsoluteUrl = network.URL.fromUri(modelAbsoluteUri); + var rootAbsoluteUrl = network.URL.fromUri(rootAbsoluteUri); tokenContent = HTMLWorker._stripQuotes(tokenContent); + if (/^\s*javascript\:/i.test(tokenContent) || /^\s*\#/i.test(tokenContent)) { return null; } @@ -551,7 +558,7 @@ export class HTMLWorker extends AbstractModeWorker { return potentialResult; } - private createLink(modelAbsoluteUrl: network.URL, rootAbsoluteUrl: network.URL, tokenContent: string, lineNumber: number, startColumn: number, endColumn: number): Modes.ILink { + private createLink(modelAbsoluteUrl: URI, rootAbsoluteUrl: network.URL, tokenContent: string, lineNumber: number, startColumn: number, endColumn: number): Modes.ILink { var workspaceUrl = HTMLWorker._getWorkspaceUrl(modelAbsoluteUrl, rootAbsoluteUrl, tokenContent); if (!workspaceUrl) { return null; @@ -648,7 +655,7 @@ export class HTMLWorker extends AbstractModeWorker { return newLinks; } - public computeLinks(resource: network.URL): winjs.TPromise { + public computeLinks(resource: URI): winjs.TPromise { return super.computeLinks(resource).then((oldLinks) => { @@ -704,4 +711,3 @@ export class HTMLWorker extends AbstractModeWorker { function isWhiteSpace(s:string) : boolean { return /^\s*$/.test(s); } - diff --git a/src/vs/languages/html/test/common/html-worker.test.ts b/src/vs/languages/html/test/common/html-worker.test.ts index 2866715625f..15b4e3b1708 100644 --- a/src/vs/languages/html/test/common/html-worker.test.ts +++ b/src/vs/languages/html/test/common/html-worker.test.ts @@ -9,6 +9,7 @@ import mm = require('vs/editor/common/model/mirrorModel'); import html = require('vs/languages/html/common/html'); import htmlWorker = require('vs/languages/html/common/htmlWorker'); import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import ResourceService = require('vs/editor/common/services/resourceServiceImpl'); import MarkerService = require('vs/platform/markers/common/markerService'); import EditorCommon = require('vs/editor/common/editorCommon'); @@ -30,7 +31,7 @@ suite('HTML - worker', () => { }); }); - var mockHtmlWorkerEnv = function (url: Network.URL, content: string): { worker: htmlWorker.HTMLWorker; model: mm.MirrorModel; markers: IMarker[]; } { + var mockHtmlWorkerEnv = function (url: URI, content: string): { worker: htmlWorker.HTMLWorker; model: mm.MirrorModel; markers: IMarker[]; } { var resourceService = new ResourceService.ResourceService(); var model = mm.createMirrorModelFromString(null, 0, content, mode, url); @@ -50,19 +51,19 @@ suite('HTML - worker', () => { return { worker: worker, model: model, markers: markers }; }; - var testSuggestionsFor = function(value:string):WinJS.TPromise { + var testSuggestionsFor = function(value:string):WinJS.TPromise { var idx = value.indexOf('|'); var content = value.substr(0, idx) + value.substr(idx + 1); - var url = new Network.URL('test://1'); + var url = URI.parse('test://1'); var env = mockHtmlWorkerEnv(url, content); var position = env.model.getPositionFromOffset(idx); return env.worker.suggest(url, position).then(result => result[0]); }; - var assertSuggestion = function(completion: Modes.ISuggestions, label: string, type?: string, codeSnippet?: string) { + var assertSuggestion = function(completion: Modes.ISuggestResult, label: string, type?: string, codeSnippet?: string) { var proposalsFound = completion.suggestions.filter(function(suggestion: Modes.ISuggestion) { return suggestion.label === label && (!type || suggestion.type === type) && (!codeSnippet || suggestion.codeSnippet === codeSnippet); }); @@ -326,11 +327,11 @@ suite('HTML - worker', () => { }); function testLinkCreation(modelUrl:string, rootUrl:string, tokenContent:string, expected:string): void { - var _modelUrl = new Network.URL(modelUrl); - var _rootUrl = rootUrl === null ? null : new Network.URL(rootUrl); + var _modelUrl = URI.parse(modelUrl); + var _rootUrl = rootUrl === null ? null : URI.parse(rootUrl); var actual = htmlWorker.HTMLWorker._getWorkspaceUrl(_modelUrl, _rootUrl, tokenContent); - var _actual = actual === null ? null : new Network.URL(actual); - var _expected = expected === null ? null : new Network.URL(expected); + var _actual = actual === null ? null : URI.parse(actual); + var _expected = expected === null ? null : URI.parse(expected); assert.equal(String(_actual), String(_expected)); } diff --git a/src/vs/languages/javascript/common/javascript.contribution.ts b/src/vs/languages/javascript/common/javascript.contribution.ts index 5b40dec2f76..e6b079dab2d 100644 --- a/src/vs/languages/javascript/common/javascript.contribution.ts +++ b/src/vs/languages/javascript/common/javascript.contribution.ts @@ -103,7 +103,7 @@ if (!env.enableTypeScriptServiceModeForJS) { 'javascript.validate.lint.unknownTypeOfResults': { 'enum': ['ignore', 'warning', 'error'], 'default': defaults.validate.lint.unknownTypeOfResults, - 'description': nls.localize('lint.unknownTypeOfResults', "Unexpected output of the 'typeof'-operator."), + 'description': nls.localize('lint.unknownTypeOfResults', "Unexpected output of the 'typeof' operator."), }, 'javascript.validate.lint.semicolonsInsteadOfBlocks': { 'enum': ['ignore', 'warning', 'error'], @@ -171,7 +171,7 @@ if (!env.enableTypeScriptServiceModeForJS) { 'javascript.validate.lint.mixedTypesArithmetics': { 'enum': ['ignore', 'warning', 'error'], 'default': defaults.validate.lint.mixedTypesArithmetics, - 'description': nls.localize('lint.mixedTypesArithmetics', "Only use numbers for arthimetic operations."), + 'description': nls.localize('lint.mixedTypesArithmetics', "Only use numbers for arithmetic operations."), }, 'javascript.validate.lint.primitivesInInstanceOf': { 'enum': ['ignore', 'warning', 'error'], @@ -181,7 +181,7 @@ if (!env.enableTypeScriptServiceModeForJS) { 'javascript.validate.lint.newOnReturningFunctions': { 'enum': ['ignore', 'warning', 'error'], 'default': defaults.validate.lint.newOnReturningFunctions, - 'description': nls.localize('lint.newOnReturningFunctions', "Function with return-statement used as constructor."), + 'description': nls.localize('lint.newOnReturningFunctions', "Function with return statement used as constructor."), } } } diff --git a/src/vs/languages/javascript/common/javascriptWorker.ts b/src/vs/languages/javascript/common/javascriptWorker.ts index 5b5d36e3d6c..6f6cc39ee4b 100644 --- a/src/vs/languages/javascript/common/javascriptWorker.ts +++ b/src/vs/languages/javascript/common/javascriptWorker.ts @@ -85,7 +85,7 @@ export class JavaScriptWorker extends typeScriptWorker.TypeScriptWorker2 { } } - public doSuggest(resource: URI, position: EditorCommon.IPosition): winjs.TPromise { + public doSuggest(resource: URI, position: EditorCommon.IPosition): winjs.TPromise { var project = this._projectService.getProject(resource, this._fancyRewriters); position = project.translations.getTranslator(resource).to(position); diff --git a/src/vs/languages/json/common/features/jsonTokenTypes.ts b/src/vs/languages/json/common/features/jsonTokenTypes.ts index 199220f992a..9213ebf7509 100644 --- a/src/vs/languages/json/common/features/jsonTokenTypes.ts +++ b/src/vs/languages/json/common/features/jsonTokenTypes.ts @@ -8,10 +8,10 @@ export const TOKEN_DELIM_OBJECT = 'punctuation.bracket.json'; export const TOKEN_DELIM_ARRAY = 'punctuation.array.json'; export const TOKEN_DELIM_COLON = 'punctuation.colon.json'; export const TOKEN_DELIM_COMMA = 'punctuation.comma.json'; -export const TOKEN_VALUE_BOOLEAN= 'meta.property-value.keyword.json'; -export const TOKEN_VALUE_NULL= 'meta.property-value.constant.other.json'; -export const TOKEN_VALUE_STRING = 'meta.property-value.string.value.json'; -export const TOKEN_VALUE_NUMBER = 'meta.property-value.constant.numeric.json'; +export const TOKEN_VALUE_BOOLEAN= 'support.property-value.keyword.json'; +export const TOKEN_VALUE_NULL= 'support.property-value.constant.other.json'; +export const TOKEN_VALUE_STRING = 'support.property-value.string.value.json'; +export const TOKEN_VALUE_NUMBER = 'support.property-value.constant.numeric.json'; export const TOKEN_PROPERTY_NAME = 'support.type.property-name.json'; export const TOKEN_COMMENT_BLOCK = 'comment.block.json'; export const TOKEN_COMMENT_LINE = 'comment.line.json'; \ No newline at end of file diff --git a/src/vs/languages/json/common/json.ts b/src/vs/languages/json/common/json.ts index 4de145dd67e..518b89a36ca 100644 --- a/src/vs/languages/json/common/json.ts +++ b/src/vs/languages/json/common/json.ts @@ -6,7 +6,7 @@ import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); -import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import WinJS = require('vs/base/common/winjs.base'); import supports = require('vs/editor/common/modes/supports'); import Platform = require('vs/platform/platform'); @@ -124,22 +124,22 @@ export class JSONMode extends AbstractMode implements Mod } static $computeInfo = OneWorkerAttr(JSONMode, JSONMode.prototype.computeInfo); - public computeInfo(resource:Network.URL, position:EditorCommon.IPosition): WinJS.TPromise { + public computeInfo(resource:URI, position:EditorCommon.IPosition): WinJS.TPromise { return this._worker((w) => w.computeInfo(resource, position)); } static $getOutline = OneWorkerAttr(JSONMode, JSONMode.prototype.getOutline); - public getOutline(resource:Network.URL):WinJS.TPromise { + public getOutline(resource:URI):WinJS.TPromise { return this._worker((w) => w.getOutline(resource)); } static $formatDocument = OneWorkerAttr(JSONMode, JSONMode.prototype.formatDocument); - public formatDocument(resource:Network.URL, options:Modes.IFormattingOptions):WinJS.TPromise { + public formatDocument(resource:URI, options:Modes.IFormattingOptions):WinJS.TPromise { return this._worker((w) => w.format(resource, null, options)); } static $formatRange = OneWorkerAttr(JSONMode, JSONMode.prototype.formatRange); - public formatRange(resource:Network.URL, range:EditorCommon.IRange, options:Modes.IFormattingOptions):WinJS.TPromise { + public formatRange(resource:URI, range:EditorCommon.IRange, options:Modes.IFormattingOptions):WinJS.TPromise { return this._worker((w) => w.format(resource, range, options)); } diff --git a/src/vs/languages/json/common/jsonIntellisense.ts b/src/vs/languages/json/common/jsonIntellisense.ts index 0e3f1c9ae0b..be543416a21 100644 --- a/src/vs/languages/json/common/jsonIntellisense.ts +++ b/src/vs/languages/json/common/jsonIntellisense.ts @@ -6,7 +6,7 @@ import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); -import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import Parser = require('./parser/jsonParser'); import SchemaService = require('./jsonSchemaService'); import Types = require('vs/base/common/types'); @@ -29,7 +29,7 @@ export class JSONIntellisense { this.contributions = contributions; } - public doSuggest(resource: Network.URL, modelMirror: EditorCommon.IMirrorModel, position: EditorCommon.IPosition): WinJS.TPromise { + public doSuggest(resource: URI, modelMirror: EditorCommon.IMirrorModel, position: EditorCommon.IPosition): WinJS.TPromise { var currentWord = modelMirror.getWordUntilPosition(position).word; var parser = new Parser.JSONParser(); @@ -39,7 +39,7 @@ export class JSONIntellisense { var doc = parser.parse(modelMirror.getValue(), config); - var result: Modes.ISuggestions = { + var result: Modes.ISuggestResult = { currentWord: currentWord, incomplete: false, suggestions: [] @@ -67,6 +67,7 @@ export class JSONIntellisense { var node = doc.getNodeFromOffsetEndInclusive(offset); var addValue = true; var currentKey = currentWord; + var currentProperty : Parser.PropertyASTNode = null; if (node) { if (node.type === 'string') { @@ -76,6 +77,7 @@ export class JSONIntellisense { result.overwriteBefore = position.column - nodeRange.startColumn; result.overwriteAfter = nodeRange.endColumn - position.column; addValue = !(node.parent && (( node.parent).value)); + currentProperty = node.parent ? node.parent : null; currentKey = modelMirror.getValueInRange({ startColumn: nodeRange.startColumn + 1, startLineNumber: nodeRange.startLineNumber, endColumn: position.column, endLineNumber: position.lineNumber }); if (node.parent) { node = node.parent.parent; @@ -91,10 +93,16 @@ export class JSONIntellisense { if (node.start === offset) { return result; } + // don't suggest properties that are already present + var properties = ( node).properties; + properties.forEach(p => { + if (!currentProperty || currentProperty !== p) { + proposed[p.key.value] = true; + } + }); if (schema) { // property proposals with schema - var properties = ( node).properties; var isLast = properties.length === 0 || offset >= properties[properties.length - 1].start; collectionPromises.push(this.getPropertySuggestions(schema, doc, node, currentKey, addValue, isLast, collector)); diff --git a/src/vs/languages/json/common/jsonSchemaService.ts b/src/vs/languages/json/common/jsonSchemaService.ts index 6b14c1ae8f6..24be1adce97 100644 --- a/src/vs/languages/json/common/jsonSchemaService.ts +++ b/src/vs/languages/json/common/jsonSchemaService.ts @@ -5,6 +5,7 @@ import nls = require('vs/nls'); import Objects = require('vs/base/common/objects'); import Json = require('vs/base/common/json'); +import http = require('vs/base/common/http'); import {IJSONSchema} from 'vs/base/common/jsonSchema'; import Strings = require('vs/base/common/strings'); import URI from 'vs/base/common/uri'; @@ -332,6 +333,7 @@ export class JSONSchemaService implements IJSONSchemaService { } for (var pattern in this.contributionAssociations) { var fpa = this.getOrAddFilePatternAssociation(pattern); + this.contributionAssociations[pattern].forEach(schemaId => fpa.addSchema(schemaId)); } } @@ -356,18 +358,18 @@ export class JSONSchemaService implements IJSONSchemaService { request => { var content = request.responseText; if (!content) { - var errorMessage = nls.localize('json.schema.nocontent', 'Unable to load schema from \'{0}\': No content.', url) ; + var errorMessage = nls.localize('json.schema.nocontent', 'Unable to load schema from \'{0}\': No content.', toDisplayString(url)); return new UnresolvedSchema( {}, [ errorMessage ]); } var schemaContent: IJSONSchema = {}; var jsonErrors = []; schemaContent = Json.parse(content, errors); - var errors = jsonErrors.length ? [ nls.localize('json.schema.invalidFormat', 'Unable to parse content from \'{0}\': {1}.', url, jsonErrors[0])] : []; + var errors = jsonErrors.length ? [ nls.localize('json.schema.invalidFormat', 'Unable to parse content from \'{0}\': {1}.', toDisplayString(url), jsonErrors[0])] : []; return new UnresolvedSchema(schemaContent, errors); }, - error => { - var errorMessage = nls.localize('json.schema.unabletoload', 'Unable to load schema from \'{0}\': {1}.', url, error.statusText || error.toString()); + (error : http.IXHRResponse) => { + var errorMessage = nls.localize('json.schema.unabletoload', 'Unable to load schema from \'{0}\': {1}', toDisplayString(url), error.responseText || http.getErrorStatusDescription(error.status) || error.toString()); return new UnresolvedSchema( {}, [ errorMessage ]); } ); @@ -403,7 +405,8 @@ export class JSONSchemaService implements IJSONSchemaService { var resolveExternalLink = (node: any, uri: string, linkPath: string): WinJS.Promise => { return this.getOrAddSchemaHandle(uri).getUnresolvedSchema().then(unresolvedSchema => { if (unresolvedSchema.errors.length) { - resolveErrors.push(nls.localize('json.schema.problemloadingref', 'Problems loading reference \'{0}\': {1}.', uri + '#' + linkPath, unresolvedSchema.errors[0])); + var loc = linkPath ? uri + '#' + linkPath : uri; + resolveErrors.push(nls.localize('json.schema.problemloadingref', 'Problems loading reference \'{0}\': {1}', loc, unresolvedSchema.errors[0])); } resolveLink(node, unresolvedSchema.schema, linkPath); return resolveRefs(node, unresolvedSchema.schema); @@ -479,7 +482,7 @@ export class JSONSchemaService implements IJSONSchemaService { public createCombinedSchema(combinedSchemaId: string, schemaIds: string[]) : ISchemaHandle { if (schemaIds.length === 1) { - return this.schemasById[schemaIds[0]]; + return this.getOrAddSchemaHandle(schemaIds[0]); } else { var combinedSchema: IJSONSchema = { allOf: schemaIds.map(schemaId => ({ $ref: schemaId })) @@ -1562,4 +1565,16 @@ export class JSONSchemaService implements IJSONSchemaService { }); } +} + +function toDisplayString(url:string) { + try { + var uri = URI.parse(url); + if (uri.scheme === 'file') { + return uri.fsPath; + } + } catch (e) { + // ignore + } + return url; } \ No newline at end of file diff --git a/src/vs/languages/json/common/jsonWorker.ts b/src/vs/languages/json/common/jsonWorker.ts index a2593f2a9c3..f146d2e62bf 100644 --- a/src/vs/languages/json/common/jsonWorker.ts +++ b/src/vs/languages/json/common/jsonWorker.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; +import URI from 'vs/base/common/uri'; import Severity from 'vs/base/common/severity'; import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); @@ -137,7 +138,7 @@ export class JSONWorker extends AbstractModeWorker implements Modes.IExtraInfoSu return WinJS.TPromise.as(true); } - public doValidate(resource:Network.URL):void { + public doValidate(resource:URI):void { var modelMirror = this.resourceService.get(resource); var parser = new Parser.JSONParser(); var content = modelMirror.getValue(); @@ -161,19 +162,25 @@ export class JSONWorker extends AbstractModeWorker implements Modes.IExtraInfoSu result.validate(schema.schema); } } + var added : { [signature:string]: boolean} = {}; + var markerData: IMarkerData[] = []; - var markerData = result.errors.concat(result.warnings).map((error, idx) => { - - var startPosition = modelMirror.getPositionFromOffset(error.location.start); - var endPosition = modelMirror.getPositionFromOffset(error.location.end); - return < IMarkerData> { - message: error.message, - severity: idx >= result.errors.length ? Severity.Warning : Severity.Error, - startLineNumber: startPosition.lineNumber, - startColumn: startPosition.column, - endLineNumber: endPosition.lineNumber, - endColumn: endPosition.column - }; + result.errors.concat(result.warnings).forEach((error, idx) => { + // remove duplicated messages + var signature = error.location.start + ' ' + error.location.end + ' ' + error.message; + if (!added[signature]) { + added[signature] = true; + var startPosition = modelMirror.getPositionFromOffset(error.location.start); + var endPosition = modelMirror.getPositionFromOffset(error.location.end); + markerData.push({ + message: error.message, + severity: idx >= result.errors.length ? Severity.Warning : Severity.Error, + startLineNumber: startPosition.lineNumber, + startColumn: startPosition.column, + endLineNumber: endPosition.lineNumber, + endColumn: endPosition.column + }); + } }); this.markerService.changeOne(this._getMode().getId(), resource, markerData); @@ -182,13 +189,13 @@ export class JSONWorker extends AbstractModeWorker implements Modes.IExtraInfoSu } - public doSuggest(resource:Network.URL, position:EditorCommon.IPosition):WinJS.TPromise { + public doSuggest(resource:URI, position:EditorCommon.IPosition):WinJS.TPromise { var modelMirror = this.resourceService.get(resource); return this.jsonIntellisense.doSuggest(resource, modelMirror, position); } - public computeInfo(resource:Network.URL, position:EditorCommon.IPosition): WinJS.TPromise { + public computeInfo(resource:URI, position:EditorCommon.IPosition): WinJS.TPromise { var modelMirror = this.resourceService.get(resource); @@ -260,7 +267,7 @@ export class JSONWorker extends AbstractModeWorker implements Modes.IExtraInfoSu } - public getOutline(resource:Network.URL):WinJS.TPromise { + public getOutline(resource:URI):WinJS.TPromise { var modelMirror = this.resourceService.get(resource); var parser = new Parser.JSONParser(); @@ -316,12 +323,12 @@ export class JSONWorker extends AbstractModeWorker implements Modes.IExtraInfoSu return supports.ReplaceSupport.valueSetReplace(['true', 'false'], value, up); } - public format(resource: Network.URL, range: EditorCommon.IRange, options: Modes.IFormattingOptions): WinJS.TPromise { + public format(resource: URI, range: EditorCommon.IRange, options: Modes.IFormattingOptions): WinJS.TPromise { var model = this.resourceService.get(resource); return WinJS.TPromise.as(JSONFormatter.format(model, range, options)); } - public navigateValueSetFallback(resource:Network.URL, range:EditorCommon.IRange, up:boolean):WinJS.TPromise { + public navigateValueSetFallback(resource:URI, range:EditorCommon.IRange, up:boolean):WinJS.TPromise { var modelMirror = this.resourceService.get(resource); var offset = modelMirror.getOffsetFromPosition({ lineNumber: range.startLineNumber, column: range.startColumn }); diff --git a/src/vs/languages/json/common/parser/jsonParser.ts b/src/vs/languages/json/common/parser/jsonParser.ts index de0bb39c7f2..17f869c867e 100644 --- a/src/vs/languages/json/common/parser/jsonParser.ts +++ b/src/vs/languages/json/common/parser/jsonParser.ts @@ -113,8 +113,6 @@ export class ASTNode { location: { start: this.start, end: this.end }, message: nls.localize('typeArrayMismatchWarning', 'Incorrect type. Expected one of {0}', schema.type.join()) }); - } else if (schema.type.length > 0) { - validationResult.typeMatch = true; } } else if (schema.type) { @@ -123,8 +121,6 @@ export class ASTNode { location: { start: this.start, end: this.end }, message: nls.localize('typeMismatchWarning', 'Incorrect type. Expected "{0}"', schema.type) }); - } else { - validationResult.typeMatch = true; } } if (Array.isArray(schema.allOf)) { @@ -212,6 +208,8 @@ export class ASTNode { location: { start: this.start, end: this.end }, message: nls.localize('enumWarning', 'Value is not an accepted value. Valid values: {0}', JSON.stringify(schema.enum)) }); + } else { + validationResult.enumValueMatch = true; } } @@ -717,14 +715,14 @@ export class ValidationResult { public propertiesMatches: number; public propertiesValueMatches: number; - public typeMatch: boolean; + public enumValueMatch: boolean; constructor() { this.errors = []; this.warnings = []; this.propertiesMatches = 0; this.propertiesValueMatches = 0; - this.typeMatch = false; + this.enumValueMatch = false; } public hasErrors():boolean { @@ -745,7 +743,7 @@ export class ValidationResult { public mergePropertyMatch(propertyValidationResult: ValidationResult) : void { this.merge(propertyValidationResult); this.propertiesMatches++; - if (!propertyValidationResult.hasErrors()) { + if (propertyValidationResult.enumValueMatch || !propertyValidationResult.hasErrors() && propertyValidationResult.propertiesMatches) { this.propertiesValueMatches++; } } @@ -755,8 +753,8 @@ export class ValidationResult { if (hasErrors !== other.hasErrors()) { return hasErrors ? -1 : 1; } - if (this.typeMatch !== other.typeMatch) { - return other.typeMatch ? -1 : 1; + if (this.enumValueMatch !== other.enumValueMatch) { + return other.enumValueMatch ? -1 : 1; } if (this.propertiesValueMatches !== other.propertiesValueMatches) { return this.propertiesValueMatches - other.propertiesValueMatches; @@ -781,18 +779,10 @@ export class JSONDocument { return this.validationResult.errors; } - public set errors(errors:IError[]) { - this.validationResult.errors = errors; - } - public get warnings():IError[] { return this.validationResult.warnings; } - public set warnings(warnings:IError[]) { - this.validationResult.warnings = warnings; - } - public getNodeFromOffset(offset:number):ASTNode { return this.root && this.root.getNodeFromOffset(offset); } diff --git a/src/vs/languages/json/test/common/fixtures/Microsoft.Compute.json b/src/vs/languages/json/test/common/fixtures/Microsoft.Compute.json new file mode 100644 index 00000000000..c80631c076e --- /dev/null +++ b/src/vs/languages/json/test/common/fixtures/Microsoft.Compute.json @@ -0,0 +1,835 @@ +{ + "id": "http://schema.management.azure.com/schemas/2015-08-01/Microsoft.Compute.json#", + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Microsoft.Compute", + "description": "Microsoft Compute Resource Types", + "resourceDefinitions": { + "availabilitySets": { + "type": "object", + "properties": { + "type": { + "enum": [ + "Microsoft.Compute/availabilitySets" + ] + }, + "apiVersion": { + "enum": [ + "2015-05-01-preview", + "2015-06-15" + ] + }, + "properties": { + "type": "object", + "properties": { + "platformUpdateDomainCount": { + "type": "number" + }, + "platformFaultDomainCount": { + "type": "number" + } + } + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ] + }, + "virtualMachines": { + "type": "object", + "properties": { + "type": { + "enum": [ + "Microsoft.Compute/virtualMachines" + ] + }, + "apiVersion": { + "enum": [ + "2015-05-01-preview", + "2015-06-15" + ] + }, + "properties": { + "properties": { + "availabilitySet": { + "$ref": "#/definitions/id" + }, + "hardwareProfile": { + "$ref": "#/definitions/hardwareProfile" + }, + "storageProfile": { + "$ref": "#/definitions/storageProfile" + }, + "osProfile": { + "$ref": "#/definitions/osProfile" + }, + "networkProfile": { + "$ref": "#/definitions/networkProfile" + } + }, + "type": "object", + "required": [ + "hardwareProfile", + "storageProfile", + "networkProfile" + ] + }, + "resources": { + "type": "array", + "items": { + "allOf": [ + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/resourceBase" + }, + { + "oneOf": [ + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/Microsoft.Authorization.json#/definitions/locks" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/Microsoft.Resources.json#/definitions/links" + }, + { + "$ref": "#/resourceDefinitions/extensionsChild" + } + ] + } + ] + }, + "description": "Microsoft.Compute/virtualMachines: Resource Definition for Virtual Machines." + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ] + }, + "virtualMachineScaleSets": { + "type": "object", + "properties": { + "type": { + "enum": [ + "Microsoft.Compute/virtualMachineScaleSets" + ] + }, + "apiVersion": { + "enum": [ + "2015-05-01-preview", + "2015-06-15" + ] + }, + "sku": { + "$ref": "#/definitions/sku" + }, + "properties": { + "properties": { + "upgradePolicy": { + "$ref": "#/definitions/upgradePolicy" + }, + "virtualMachineProfile": { + "$ref": "#/definitions/virtualMachineProfile" + } + }, + "type": "object", + "required": [ + "upgradePolicy", + "virtualMachineProfile" + ] + } + }, + "required": [ + "sku", + "properties" + ] + }, + "extensions": { + "type": "object", + "properties": { + "type": { + "enum": [ + "Microsoft.Compute/virtualMachines/extensions" + ] + }, + "apiVersion": { + "enum": [ + "2015-05-01-preview", + "2015-06-15" + ] + }, + "properties": { + "properties": { + "publisher": { + "type": "string" + }, + "type": { + "type": "string" + }, + "typeHandlerVersion": { + "type": "string" + }, + "settings": { + "type": "object" + } + }, + "type": "object", + "required": [ + "publisher", + "type", + "typeHandlerVersion", + "settings" + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ] + }, + "extensionsChild": { + "type": "object", + "properties": { + "type": { + "enum": [ + "extensions" + ] + }, + "apiVersion": { + "enum": [ + "2015-05-01-preview", + "2015-06-15" + ] + }, + "properties": { + "properties": { + "publisher": { + "type": "string" + }, + "type": { + "type": "string" + }, + "typeHandlerVersion": { + "type": "string" + }, + "settings": { + "type": "object" + } + }, + "type": "object", + "required": [ + "publisher", + "type", + "typeHandlerVersion", + "settings" + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ] + } + }, + "definitions": { + "id": { + "properties": { + "id": { + "type": "string" + } + }, + "type": "object", + "required": [ + "id" + ] + }, + "networkInterfaces": { + "properties": { + "id": { + "type": "string" + }, + "properties": { + "properties": { + "primary": { + "type": "boolean" + } + }, + "type": "object", + "required": [ + "primary" + ] + } + }, + "type": "object", + "required": [ + "id" + ] + }, + "hardwareProfile": { + "properties": { + "vmSize": { + "type": "string" + } + }, + "type": "object", + "required": [ + "vmSize" + ] + }, + "imageReference": { + "properties": { + "publisher": { + "type": "string" + }, + "offer": { + "type": "string" + }, + "sku": { + "type": "string" + }, + "version": { + "type": "string", + "default": "latest" + } + }, + "type": "object", + "required": [ + "publisher", + "offer", + "sku", + "version" + ] + }, + "vhd": { + "properties": { + "uri": { + "type": "string" + } + }, + "type": "object", + "required": [ + "uri" + ] + }, + "osDisk": { + "properties": { + "osType": { + "type": "string" + }, + "name": { + "type": "string" + }, + "vhd": { + "$ref": "#/definitions/vhd" + }, + "image": { + "$ref": "#/definitions/vhd" + }, + "caching": { + "type": "string" + }, + "createOption": { + "type": "string" + } + }, + "type": "object", + "required": [ + "name", + "vhd", + "createOption" + ] + }, + "vhdUri": { + "properties": { + "uri": { + "type": "string" + } + }, + "type": "object", + "required": [ + "uri" + ] + }, + "dataDisk": { + "properties": { + "name": { + "type": "string" + }, + "diskSizeGB": { + "type": "string" + }, + "lun": { + "type": "number" + }, + "vhd": { + "$ref": "#/definitions/vhdUri" + }, + "caching": { + "type": "string" + }, + "createOption": { + "type": "string" + } + }, + "type": "object", + "required": [ + "name", + "lun", + "vhd", + "createOption" + ] + }, + "storageProfile": { + "properties": { + "imageReference": { + "$ref": "#/definitions/imageReference" + }, + "osDisk": { + "$ref": "#/definitions/osDisk" + }, + "dataDisks": { + "type": "array", + "items": { + "$ref": "#/definitions/dataDisk" + } + } + }, + "type": "object", + "required": [ + "osDisk" + ] + }, + "winRMListener": { + "properties": { + "protocol": { + "oneOf": [ + { + "enum": [ + "http", + "https" + ] + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + }, + "certificateUrl": { + "type": "string" + } + }, + "type": "object", + "required": [ + "protocol", + "certificateUrl" + ] + }, + "winRM": { + "properties": { + "listeners": { + "type": "array", + "items": { + "$ref": "#/definitions/winRMListener" + } + } + }, + "type": "object", + "required": [ + "listeners" + ] + }, + "additionalUnattendContent": { + "properties": { + "pass": { + "type": "string" + }, + "component": { + "type": "string" + }, + "settingName": { + "type": "string" + }, + "content": { + "type": "string" + } + }, + "type": "object", + "required": [ + "pass", + "component", + "settingName", + "content" + ] + }, + "windowsConfiguration": { + "properties": { + "provisionVMAgent": { + "type": "boolean" + }, + "winRM": { + "$ref": "#/definitions/winRM" + }, + "additionalUnattendContent": { + "type": "array", + "items": { + "$ref": "#/definitions/additionalUnattendContent" + } + }, + "enableAutomaticUpdates": { + "type": "boolean" + } + }, + "type": "object" + }, + "publicKey": { + "properties": { + "path": { + "type": "string" + }, + "keyData": { + "type": "string" + } + }, + "type": "object" + }, + "ssh": { + "properties": { + "publicKeys": { + "type": "array", + "items": { + "$ref": "#/definitions/publicKey" + } + } + }, + "type": "object" + }, + "linuxConfiguration": { + "properties": { + "disablePasswordAuthentication": { + "type": "string" + }, + "ssh": { + "$ref": "#/definitions/ssh" + } + }, + "type": "object" + }, + "vaultCertificateUrl": { + "properties": { + "certificateUrl": { + "type": "string" + } + }, + "type": "object", + "required": [ + "certificateUrl" + ] + }, + "secret": { + "properties": { + "sourceVault": { + "$ref": "#/definitions/id" + }, + "vaultCertificates": { + "type": "array", + "items": { + "$ref": "#/definitions/vaultCertificateUrl" + } + } + }, + "type": "object", + "required": [ + "sourceVault", + "vaultCertificates" + ] + }, + "osProfile": { + "properties": { + "computerName": { + "type": "string" + }, + "adminUsername": { + "type": "string" + }, + "adminPassword": { + "type": "string" + }, + "customData": { + "type": "string" + }, + "windowsConfiguration": { + "$ref": "#/definitions/windowsConfiguration" + }, + "linuxConfiguration": { + "$ref": "#/definitions/linuxConfiguration" + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/definitions/secret" + } + } + }, + "type": "object", + "required": [ + "computerName", + "adminUsername", + "adminPassword" + ] + }, + "networkProfile": { + "properties": { + "networkInterfaces": { + "type": "array", + "items": { + "$ref": "#/definitions/networkInterfaces" + } + } + }, + "type": "object", + "required": [ + "networkInterfaces" + ] + }, + "sku": { + "properties": { + "name": { + "type": "string" + }, + "tier": { + "type": "string" + }, + "capacity": { + "type": "integer" + } + }, + "type": "object", + "required": [ + "name", + "capacity" + ] + }, + "upgradePolicy": { + "properties": { + "mode": { + "type": "string" + } + }, + "type": "object", + "required": [ + "mode" + ] + }, + "virtualMachineScaleSetOsProfile": { + "properties": { + "computerNamePrefix": { + "type": "string" + }, + "adminUsername": { + "type": "string" + }, + "adminPassword": { + "type": "string" + }, + "customData": { + "type": "string" + }, + "windowsConfiguration": { + "$ref": "#/definitions/windowsConfiguration" + }, + "linuxConfiguration": { + "$ref": "#/definitions/linuxConfiguration" + }, + "secrets": { + "type": "array", + "items": { + "$ref": "#/definitions/secret" + } + } + }, + "type": "object", + "required": [ + "computerNamePrefix", + "adminUsername", + "adminPassword" + ] + }, + "virtualMachineScaleSetOSDisk": { + "properties": { + "osType": { + "type": "string" + }, + "name": { + "type": "string" + }, + "vhdContainers": { + "type": "array", + "items": { + "type": "string" + } + }, + "caching": { + "type": "string" + }, + "createOption": { + "type": "string" + } + }, + "type": "object", + "required": [ + "name", + "createOption" + ] + }, + "virtualMachineScaleSetStorageProfile": { + "properties": { + "imageReference": { + "oneOf": [ + { + "$ref": "#/definitions/imageReference" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + }, + "osDisk": { + "$ref": "#/definitions/virtualMachineScaleSetOSDisk" + } + }, + "type": "object", + "required": [ + "osDisk" + ] + }, + "virtualMachineScaleSetExtension": { + "properties": { + "name": { + "type": "string" + }, + "properties": { + "properties": { + "publisher": { + "type": "string" + }, + "type": { + "type": "string" + }, + "typeHandlerVersion": { + "type": "string" + }, + "settings": { + "type": "object" + } + }, + "type": "object", + "required": [ + "publisher", + "type", + "typeHandlerVersion" + ] + } + } + }, + "virtualMachineScaleSetExtensionProfile": { + "properties": { + "extensions": { + "type": "array", + "items": { + "$ref": "#/definitions/virtualMachineScaleSetExtension" + } + } + }, + "type": "object" + }, + "ipConfiguration": { + "properties": { + "name": { + "type": "string" + }, + "subnet": { + "$ref": "#/definitions/id" + }, + "loadBalancerBackendAddressPools": { + "type": "array", + "items": { + "$ref": "#/definitions/id" + } + } + }, + "type": "object", + "required": [ + "name", + "properties" + ] + }, + "networkInterfaceConfiguration": { + "properties": { + "name": { + "type": "string" + }, + "properties": { + "type": "object", + "properties": { + "primary": { + "type": "boolean" + }, + "ipConfigurations": { + "type": "array", + "items": { + "$ref": "#/definitions/ipConfiguration" + } + } + }, + "required": [ + "primary", + "ipConfigurations" + ] + } + }, + "type": "object", + "required": [ + "name", + "properties" + ] + }, + "virtualMachineScaleSetNetworkProfile": { + "properties": { + "networkInterfaceConfigurations": { + "type": "array", + "items": { + "$ref": "#/definitions/networkInterfaceConfiguration" + } + } + }, + "type": "object", + "required": [ + "networkInterfaceConfigurations" + ] + }, + "virtualMachineProfile": { + "properties": { + "osProfile": { + "$ref": "#/definitions/virtualMachineScaleSetOsProfile" + }, + "storageProfile": { + "$ref": "#/definitions/virtualMachineScaleSetStorageProfile" + }, + "extensionProfile": { + "$ref": "#/definitions/virtualMachineScaleSetExtensionProfile" + }, + "networkProfile": { + "$ref": "#/definitions/virtualMachineScaleSetNetworkProfile" + } + }, + "type": "object", + "required": [ + "osProfile", + "storageProfile", + "networkProfile" + ] + } + } +} diff --git a/src/vs/languages/json/test/common/fixtures/deploymentTemplate.json b/src/vs/languages/json/test/common/fixtures/deploymentTemplate.json index 87522f3d162..8f6a35da976 100644 --- a/src/vs/languages/json/test/common/fixtures/deploymentTemplate.json +++ b/src/vs/languages/json/test/common/fixtures/deploymentTemplate.json @@ -59,7 +59,10 @@ }, { "$ref": "http://schema.management.azure.com/schemas/2014-04-01-preview/Microsoft.Sql.json#/definitions/servers" - } + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-08-01/Microsoft.Compute.json#/resourceDefinitions/virtualMachines" + } ] } ] diff --git a/src/vs/languages/json/test/common/jsonworker.test.ts b/src/vs/languages/json/test/common/jsonworker.test.ts index 945ec46ce0c..98c2705f698 100644 --- a/src/vs/languages/json/test/common/jsonworker.test.ts +++ b/src/vs/languages/json/test/common/jsonworker.test.ts @@ -11,7 +11,7 @@ import resourceService = require('vs/editor/common/services/resourceServiceImpl' import {IResourceService} from 'vs/editor/common/services/resourceService'; import instantiationService = require('vs/platform/instantiation/common/instantiationService'); import mirrorModel = require('vs/editor/common/model/mirrorModel'); -import network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import SchemaService = require('vs/languages/json/common/jsonSchemaService'); import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); @@ -32,7 +32,7 @@ suite('JSON - Worker', () => { } }; - function mockWorkerEnv(url: network.URL, content: string): { worker: jsonworker.JSONWorker; model: EditorCommon.IMirrorModel; } { + function mockWorkerEnv(url: URI, content: string): { worker: jsonworker.JSONWorker; model: EditorCommon.IMirrorModel; } { var mm = mirrorModel.createMirrorModelFromString(null, 1, content, modesUtil.createMockMode('mock.mode.id'), url); var resourceModelMock: IResourceService = new resourceService.ResourceService(); @@ -55,8 +55,8 @@ suite('JSON - Worker', () => { } } - var testSuggestionsFor = function(value:string, stringAfter:string, schema?:jsonSchema.IJSONSchema):WinJS.TPromise { - var url = new network.URL('test://test.json'); + var testSuggestionsFor = function(value:string, stringAfter:string, schema?:jsonSchema.IJSONSchema):WinJS.TPromise { + var url = URI.parse('test://test.json'); var env = mockWorkerEnv(url, value); prepareSchemaServer(schema, env.worker); @@ -66,14 +66,14 @@ suite('JSON - Worker', () => { }; function testComputeInfo(content:string, schema:jsonSchema.IJSONSchema, position:EditorCommon.IPosition):WinJS.TPromise { - var url = new network.URL('test://test.json'); + var url = URI.parse('test://test.json'); var env = mockWorkerEnv(url, content); prepareSchemaServer(schema, env.worker); return env.worker.computeInfo(url, position); } var testValueSetFor = function(value:string, schema:jsonSchema.IJSONSchema, selection:string, selectionLength: number, up: boolean):WinJS.TPromise { - var url = new network.URL('test://test.json'); + var url = URI.parse('test://test.json'); var env = mockWorkerEnv(url, value); prepareSchemaServer(schema, env.worker); @@ -84,12 +84,12 @@ suite('JSON - Worker', () => { }; function getOutline(content: string):WinJS.TPromise { - var url = new network.URL('test'); + var url = URI.parse('test'); var workerEnv = mockWorkerEnv(url, content); return workerEnv.worker.getOutline(url); }; - var assertSuggestion= function(completion:Modes.ISuggestions, label:string, documentationLabel?: string) { + var assertSuggestion= function(completion:Modes.ISuggestResult, label:string, documentationLabel?: string) { var matches = completion.suggestions.filter(function(suggestion: Modes.ISuggestion) { return suggestion.label === label && (!documentationLabel || suggestion.documentationLabel === documentationLabel); }).length; @@ -179,9 +179,8 @@ suite('JSON - Worker', () => { assertSuggestion(result, 'name'); }), testSuggestionsFor('[ { "name": "John", "address": { "street" : "MH Road", "number" : 5 } }, { "name": "Jack", "address": { "street" : "100 Feet Road", /**/ }', '/**/').then((result) => { - assert.strictEqual(result.suggestions.length, 2); + assert.strictEqual(result.suggestions.length, 1); assertSuggestion(result, 'number'); - assertSuggestion(result, 'street'); }) ]).done(() => testDone(), (errors:any[]) => { testDone(errors.reduce((e1, e2) => e1 || e2)); @@ -216,8 +215,7 @@ suite('JSON - Worker', () => { assertSuggestion(result, '"xoo"'); }), testSuggestionsFor('[ { "data": "foo" }, { "data": "bar" }, { "data": "xoo" /**/ } ]', '/**/').then((result) => { - assert.strictEqual(result.suggestions.length, 1); - assertSuggestion(result, 'data'); + assert.strictEqual(result.suggestions.length, 0); }) ]).done(() => testDone(), (errors:any[]) => { testDone(errors.reduce((e1, e2) => e1 || e2)); @@ -260,8 +258,7 @@ suite('JSON - Worker', () => { assertSuggestion(result, 'a', 'A'); }), testSuggestionsFor('{ "a" = 1;/**/}', '/**/', schema).then((result) => { - assert.strictEqual(result.suggestions.length, 3); - assertSuggestion(result, 'a', 'A'); + assert.strictEqual(result.suggestions.length, 2); assertSuggestion(result, 'b', 'B'); assertSuggestion(result, 'c', 'C'); }) @@ -375,8 +372,7 @@ suite('JSON - Worker', () => { assertSuggestion(result, 'd', 'D'); }), testSuggestionsFor('{ "a": "", /**/}', '/**/', schema).then((result) => { - assert.strictEqual(result.suggestions.length, 2); - assertSuggestion(result, 'a', 'A'); + assert.strictEqual(result.suggestions.length, 1); assertSuggestion(result, 'b', 'B'); }) ]).done(() => testDone(), (errors:any[]) => { @@ -417,8 +413,7 @@ suite('JSON - Worker', () => { assertSuggestion(result, 'c'); }), testSuggestionsFor('{ "type": "appartment", /**/}', '/**/', schema).then((result) => { - assert.strictEqual(result.suggestions.length, 2); - assertSuggestion(result, 'type'); + assert.strictEqual(result.suggestions.length, 1); assertSuggestion(result, 'c'); }) ]).done(() => testDone(), (errors:any[]) => { @@ -480,9 +475,8 @@ suite('JSON - Worker', () => { assertSuggestion(result, 'd', 'D'); }), testSuggestionsFor('{ "b1": "", /**/}', '/**/', schema).then((result) => { - assert.strictEqual(result.suggestions.length, 3); + assert.strictEqual(result.suggestions.length, 2); assertSuggestion(result, 'a', 'A'); - assertSuggestion(result, 'b1', 'B1'); assertSuggestion(result, 'b2', 'B2'); }) ]).done(() => testDone(), (errors:any[]) => { @@ -490,6 +484,92 @@ suite('JSON - Worker', () => { }); }); + test('JSON suggest with oneOf and enums', function(testDone) { + + var schema:jsonSchema.IJSONSchema = { + oneOf: [{ + type: 'object', + properties: { + 'type' : { + type: 'string', + enum: [ '1', '2' ] + }, + 'a' : { + type: 'object', + properties: { + 'x': { + type: 'string' + }, + 'y': { + type: 'string' + } + }, + "required" : [ 'x', 'y'] + }, + 'b': {} + }, + }, { + type: 'object', + properties: { + 'type' : { + type: 'string', + enum: [ '3' ] + }, + 'a' : { + type: 'object', + properties: { + 'x': { + type: 'string' + }, + 'z': { + type: 'string' + } + }, + "required" : [ 'x', 'z'] + }, + 'c': {} + }, + }] + }; + WinJS.Promise.join([ + testSuggestionsFor('{/**/}', '/**/', schema).then((result) => { + assert.strictEqual(result.suggestions.length, 4); + assertSuggestion(result, 'type'); + assertSuggestion(result, 'a'); + assertSuggestion(result, 'b'); + assertSuggestion(result, 'c'); + }), + testSuggestionsFor('{ "type": /**/}', '/**/', schema).then((result) => { + assert.strictEqual(result.suggestions.length, 3); + assertSuggestion(result, '"1"'); + assertSuggestion(result, '"2"'); + assertSuggestion(result, '"3"'); + }), + testSuggestionsFor('{ "a": { "x": "", "y": "" }, "type": /**/}', '/**/', schema).then((result) => { + assert.strictEqual(result.suggestions.length, 2); + assertSuggestion(result, '"1"'); + assertSuggestion(result, '"2"'); + }), + testSuggestionsFor('{ "type": "1", "a" : { /**/ }', '/**/', schema).then((result) => { + assert.strictEqual(result.suggestions.length, 2); + assertSuggestion(result, 'x'); + assertSuggestion(result, 'y'); + }), + testSuggestionsFor('{ "type": "1", "a" : { "x": "", "z":"" }, /**/', '/**/', schema).then((result) => { + // both alternatives have errors: intellisense proposes all options + assert.strictEqual(result.suggestions.length, 2); + assertSuggestion(result, 'b'); + assertSuggestion(result, 'c'); + }), + testSuggestionsFor('{ "a" : { "x": "", "z":"" }, /**/', '/**/', schema).then((result) => { + assert.strictEqual(result.suggestions.length, 2); + assertSuggestion(result, 'type'); + assertSuggestion(result, 'c'); + }), + ]).done(() => testDone(), (errors:any[]) => { + testDone(errors.reduce((e1, e2) => e1 || e2)); + }); + }); test('JSON Compute Info', function(testDone) { diff --git a/src/vs/languages/json/test/common/parser.test.ts b/src/vs/languages/json/test/common/parser.test.ts index 9bdf43e88e3..09ac4551f9c 100644 --- a/src/vs/languages/json/test/common/parser.test.ts +++ b/src/vs/languages/json/test/common/parser.test.ts @@ -227,7 +227,8 @@ suite('JSON - Parsing', () => { test('Validate types', function() { var parser = new Parser.JSONParser(); - var result = parser.parse('{"number": 3.4, "integer": 42, "string": "some string", "boolean":true, "null":null, "object":{}, "array":[1, 2]}'); + var str = '{"number": 3.4, "integer": 42, "string": "some string", "boolean":true, "null":null, "object":{}, "array":[1, 2]}'; + var result = parser.parse(str); assert.strictEqual(result.errors.length, 0); @@ -237,13 +238,14 @@ suite('JSON - Parsing', () => { assert.strictEqual(result.warnings.length, 0); + result = parser.parse(str); result.validate({ type: 'array' }); assert.strictEqual(result.warnings.length, 1); - result.warnings = []; + result = parser.parse(str); result.validate({ type: 'object', @@ -274,6 +276,7 @@ suite('JSON - Parsing', () => { assert.strictEqual(result.warnings.length, 0); + result = parser.parse(str); result.validate({ type: 'object', properties: { @@ -302,8 +305,8 @@ suite('JSON - Parsing', () => { }); assert.strictEqual(result.warnings.length, 7); - result.warnings = []; + result = parser.parse(str); result.validate({ type: 'object', properties: { @@ -314,8 +317,8 @@ suite('JSON - Parsing', () => { }); assert.strictEqual(result.warnings.length, 1); - result.warnings = []; + result = parser.parse(str); result.validate({ type: 'object', properties: { @@ -327,6 +330,7 @@ suite('JSON - Parsing', () => { assert.strictEqual(result.warnings.length, 0); + result = parser.parse(str); result.validate({ type: 'object', properties: { @@ -341,6 +345,7 @@ suite('JSON - Parsing', () => { assert.strictEqual(result.warnings.length, 0); + result = parser.parse(str); result.validate({ type: 'object', properties: { @@ -370,6 +375,7 @@ suite('JSON - Parsing', () => { assert.strictEqual(result.warnings.length, 0); + result = parser.parse('{"integer": 42, "string": "some string", "boolean":true}'); result.validate({ type: 'object', required: ['notpresent'] @@ -396,6 +402,7 @@ suite('JSON - Parsing', () => { assert.strictEqual(result.warnings.length, 0); + result = parser.parse('[1, 2, 3]'); result.validate({ type: 'array', items: { @@ -405,8 +412,8 @@ suite('JSON - Parsing', () => { }); assert.strictEqual(result.warnings.length, 1); - result.warnings = []; + result = parser.parse('[1, 2, 3]'); result.validate({ type: 'array', items: { @@ -439,6 +446,7 @@ suite('JSON - Parsing', () => { assert.strictEqual(result.warnings.length, 0); + result = parser.parse('{"one":"test"}'); result.validate({ type: 'object', properties: { @@ -450,8 +458,8 @@ suite('JSON - Parsing', () => { }); assert.strictEqual(result.warnings.length, 1); - result.warnings = []; + result = parser.parse('{"one":"test"}'); result.validate({ type: 'object', properties: { @@ -463,8 +471,8 @@ suite('JSON - Parsing', () => { }); assert.strictEqual(result.warnings.length, 1); - result.warnings = []; + result = parser.parse('{"one":"test"}'); result.validate({ type: 'object', properties: { @@ -477,6 +485,7 @@ suite('JSON - Parsing', () => { assert.strictEqual(result.warnings.length, 0); + result = parser.parse('{"one":"test"}'); result.validate({ type: 'object', properties: { @@ -511,6 +520,8 @@ suite('JSON - Parsing', () => { assert.strictEqual(result.warnings.length, 0); + result = parser.parse('{"one": 13.45e+1}'); + result.validate({ type: 'object', properties: { @@ -522,8 +533,8 @@ suite('JSON - Parsing', () => { }); assert.strictEqual(result.warnings.length, 1, 'below minimum'); - result.warnings = []; + result = parser.parse('{"one": 13.45e+1}'); result.validate({ type: 'object', properties: { @@ -535,8 +546,8 @@ suite('JSON - Parsing', () => { }); assert.strictEqual(result.warnings.length, 1, 'above maximum'); - result.warnings = []; + result = parser.parse('{"one": 13.45e+1}'); result.validate({ type: 'object', properties: { @@ -549,8 +560,8 @@ suite('JSON - Parsing', () => { }); assert.strictEqual(result.warnings.length, 1, 'at exclusive mininum'); - result.warnings = []; + result = parser.parse('{"one": 13.45e+1}'); result.validate({ type: 'object', properties: { @@ -563,8 +574,8 @@ suite('JSON - Parsing', () => { }); assert.strictEqual(result.warnings.length, 1, 'at exclusive maximum'); - result.warnings = []; + result = parser.parse('{"one": 13.45e+1}'); result.validate({ type: 'object', properties: { diff --git a/src/vs/languages/json/test/node/schema.test.ts b/src/vs/languages/json/test/node/schema.test.ts index 341ce9c9b93..62a58a5f0ff 100644 --- a/src/vs/languages/json/test/node/schema.test.ts +++ b/src/vs/languages/json/test/node/schema.test.ts @@ -25,7 +25,8 @@ suite('JSON - schema', () => { 'http://schema.management.azure.com/schemas/2015-01-01/Microsoft.Resources.json': 'Microsoft.Resources.json', 'http://schema.management.azure.com/schemas/2014-04-01-preview/Microsoft.Sql.json': 'Microsoft.Sql.json', 'http://schema.management.azure.com/schemas/2014-06-01/Microsoft.Web.json': 'Microsoft.Web.json', - 'http://schema.management.azure.com/schemas/2014-04-01/SuccessBricks.ClearDB.json': 'SuccessBricks.ClearDB.json' + 'http://schema.management.azure.com/schemas/2014-04-01/SuccessBricks.ClearDB.json': 'SuccessBricks.ClearDB.json', + 'http://schema.management.azure.com/schemas/2015-08-01/Microsoft.Compute.json': 'Microsoft.Compute.json' } var requestServiceMock = { @@ -335,6 +336,55 @@ suite('JSON - schema', () => { }); }); + test('Schema contributions', function(testDone) { + var service = new SchemaService.JSONSchemaService(requestServiceMock); + + service.setSchemaContributions({ schemas: { + "http://myschemastore/myschemabar" : { + id: 'main', + type: 'object', + properties: { + foo: { + type: 'string' + } + } + } + }, schemaAssociations: { + '*.bar': ['http://myschemastore/myschemabar', 'http://myschemastore/myschemafoo'] + }}); + + var id2 = 'http://myschemastore/myschemafoo'; + var schema2:JsonSchema.IJSONSchema = { + type: 'object', + properties: { + child: { + type: 'string' + } + } + }; + + service.registerExternalSchema(id2, null, schema2); + + service.getSchemaForResource('main.bar', null).then(resolvedSchema => { + assert.deepEqual(resolvedSchema.errors, []); + assert.equal(2, resolvedSchema.schema.allOf.length); + + service.clearExternalSchemas(); + return service.getSchemaForResource('main.bar', null).then(resolvedSchema => { + assert.equal(resolvedSchema.errors.length, 1); + assert.ok(resolvedSchema.errors[0].indexOf("Problems loading reference 'http://myschemastore/myschemafoo'") === 0); + + service.clearExternalSchemas(); + service.registerExternalSchema(id2, null, schema2); + return service.getSchemaForResource('main.bar', null).then(resolvedSchema => { + assert.equal(resolvedSchema.errors.length, 0); + }); + }); + }).done(() => testDone(), (error) => { + testDone(error); + }); + }); + test('Resolving circular $refs', function(testDone) { var service : SchemaService.IJSONSchemaService = new SchemaService.JSONSchemaService(requestServiceMock); @@ -412,4 +462,76 @@ suite('JSON - schema', () => { }); + test('Validate Azure Resource Dfinition', function(testDone) { + + + var service : SchemaService.IJSONSchemaService = new SchemaService.JSONSchemaService(requestServiceMock); + + var input = { + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + { + "apiVersion": "2015-06-15", + "type": "Microsoft.Compute/virtualMachines", + "name": "a", + "location": "West US", + "properties": { + "hardwareProfile": { + "vmSize": "Small" + }, + "osProfile": { + "computername": "a", + "adminUsername": "a", + "adminPassword": "a" + }, + "storageProfile": { + "imageReference": { + "publisher": "a", + "offer": "a", + "sku": "a", + "version": "latest" + }, + "osDisk": { + "name": "osdisk", + "vhd": { + "uri": "[concat('http://', 'b','.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'),'.vhd')]" + }, + "caching": "ReadWrite", + "createOption": "FromImage" + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]" + } + ] + }, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": "true", + "storageUri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net')]" + } + } + } + } + ] + } + var parser = new Parser.JSONParser(); + var document = parser.parse(JSON.stringify(input)); + + service.getSchemaForResource('file://doc/mydoc.json', document).then(resolvedSchema => { + assert.deepEqual(resolvedSchema.errors, []); + + document.validate(resolvedSchema.schema); + + assert.equal(document.warnings.length, 1); + assert.equal(document.warnings[0].message, 'Missing property "computerName"'); + }).done(() => testDone(), (error) => { + testDone(error); + }); + + }); + }); diff --git a/src/vs/languages/less/common/less.ts b/src/vs/languages/less/common/less.ts index e1ac0ca30ff..a47b620fcbc 100644 --- a/src/vs/languages/less/common/less.ts +++ b/src/vs/languages/less/common/less.ts @@ -5,13 +5,14 @@ 'use strict'; import winjs = require('vs/base/common/winjs.base'); -import network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); import Monarch = require('vs/editor/common/modes/monarch/monarch'); import Types = require('vs/editor/common/modes/monarch/monarchTypes'); import Compile = require('vs/editor/common/modes/monarch/monarchCompile'); import lessWorker = require('vs/languages/less/common/lessWorker'); +import {cssTokenTypes} from 'vs/languages/css/common/css'; import supports = require('vs/editor/common/modes/supports'); import {AbstractMode} from 'vs/editor/common/modes/abstractMode'; import {OneWorkerAttr} from 'vs/platform/thread/common/threadService'; @@ -54,20 +55,20 @@ export var language: Types.ILanguage = { { include: '@keyword' }, { include: '@strings' }, { include: '@numbers' }, - ['[*_]?[a-zA-Z\\-\\s]+(?=:.*(;|(\\\\$)))', 'support.type.property-name', '@attribute'], + ['[*_]?[a-zA-Z\\-\\s]+(?=:.*(;|(\\\\$)))', cssTokenTypes.TOKEN_PROPERTY, '@attribute'], ['url(\\-prefix)?\\(', { token: 'function', bracket: '@open', next: '@urldeclaration'}], ['[{}()\\[\\]]', '@brackets'], ['[,:;]', 'punctuation'], - ['#@identifierPlus', 'entity.other.attribute-name.id'], - ['&', 'entity.other.attribute-name.placeholder-selector'], + ['#@identifierPlus', cssTokenTypes.TOKEN_SELECTOR + '.id'], + ['&', cssTokenTypes.TOKEN_SELECTOR_TAG], - ['\\.@identifierPlus(?=\\()', 'entity.other.attribute-name.class', '@attribute'], - ['\\.@identifierPlus', 'entity.other.attribute-name.class'], + ['\\.@identifierPlus(?=\\()', cssTokenTypes.TOKEN_SELECTOR + '.class', '@attribute'], + ['\\.@identifierPlus', cssTokenTypes.TOKEN_SELECTOR + '.class'], - ['@identifierPlus', 'entity.name.tag'], + ['@identifierPlus', cssTokenTypes.TOKEN_SELECTOR_TAG], { include: '@operators' }, ['@(@identifier(?=[:,\\)]))', 'variable', '@attribute'], @@ -111,9 +112,9 @@ export var language: Types.ILanguage = { { include: '@keyword' }, - ['[a-zA-Z\\-]+(?=\\()', 'meta.property-value', '@attribute'], + ['[a-zA-Z\\-]+(?=\\()', cssTokenTypes.TOKEN_VALUE, '@attribute'], ['>', 'operator', '@pop'], - ['@identifier', 'meta.property-value'], + ['@identifier', cssTokenTypes.TOKEN_VALUE], { include: '@operators' }, ['@(@identifier)', 'variable'], @@ -124,7 +125,7 @@ export var language: Types.ILanguage = { ['[,=:]', 'punctuation'], ['\\s', ''], - ['.', 'meta.property-value'] + ['.', cssTokenTypes.TOKEN_VALUE] ], comments: [ @@ -138,12 +139,12 @@ export var language: Types.ILanguage = { ], numbers: [ - ['(\\d*\\.)?\\d+([eE][\\-+]?\\d+)?', { token: 'meta.property-value.numeric', next: '@units' }], - ['#[0-9a-fA-F_]+(?!\\w)', 'meta.property-value.rgb-value'] + ['(\\d*\\.)?\\d+([eE][\\-+]?\\d+)?', { token: cssTokenTypes.TOKEN_VALUE + '.numeric', next: '@units' }], + ['#[0-9a-fA-F_]+(?!\\w)', cssTokenTypes.TOKEN_VALUE + '.rgb-value'] ], units: [ - ['((em|ex|ch|rem|vw|vh|vm|cm|mm|in|px|pt|pc|deg|grad|rad|turn|s|ms|Hz|kHz|%)\\b)?', 'meta.property-value.unit', '@pop'] + ['((em|ex|ch|rem|vw|vh|vm|cm|mm|in|px|pt|pc|deg|grad|rad|turn|s|ms|Hz|kHz|%)\\b)?', cssTokenTypes.TOKEN_VALUE + '.unit', '@pop'] ], strings: [ @@ -197,11 +198,11 @@ export class LESSMode extends Monarch.MonarchMode impleme this.extraInfoSupport = this; this.referenceSupport = new supports.ReferenceSupport(this, { - tokens: ['support.type.property-name.less', 'meta.property-value.less', 'variable.less', 'entity.other.attribute-name.class.less', 'entity.other.attribute-name.id.less', 'selector.less'], + tokens: [cssTokenTypes.TOKEN_PROPERTY + '.less', cssTokenTypes.TOKEN_VALUE + '.less', 'variable.less', cssTokenTypes.TOKEN_SELECTOR + '.class.less', cssTokenTypes.TOKEN_SELECTOR + '.id.less', 'selector.less'], findReferences: (resource, position, /*unused*/includeDeclaration) => this.findReferences(resource, position)}); this.logicalSelectionSupport = this; this.declarationSupport = new supports.DeclarationSupport(this, { - tokens: ['variable.less', 'entity.other.attribute-name.class.less', 'entity.other.attribute-name.id.less', 'selector.less'], + tokens: ['variable.less', cssTokenTypes.TOKEN_SELECTOR + '.class.less', cssTokenTypes.TOKEN_SELECTOR + '.id.less', 'selector.less'], findDeclaration: (resource, position) => this.findDeclaration(resource, position)}); this.outlineSupport = this; @@ -225,32 +226,32 @@ export class LESSMode extends Monarch.MonarchMode impleme } static $findReferences = OneWorkerAttr(LESSMode, LESSMode.prototype.findReferences); - public findReferences(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public findReferences(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this._worker((w) => w.findReferences(resource, position)); } static $getRangesToPosition = OneWorkerAttr(LESSMode, LESSMode.prototype.getRangesToPosition); - public getRangesToPosition(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public getRangesToPosition(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this._worker((w) => w.getRangesToPosition(resource, position)); } static $computeInfo = OneWorkerAttr(LESSMode, LESSMode.prototype.computeInfo); - public computeInfo(resource:network.URL, position:EditorCommon.IPosition): winjs.TPromise { + public computeInfo(resource:URI, position:EditorCommon.IPosition): winjs.TPromise { return this._worker((w) => w.computeInfo(resource, position)); } static $getOutline = OneWorkerAttr(LESSMode, LESSMode.prototype.getOutline); - public getOutline(resource:network.URL):winjs.TPromise { + public getOutline(resource:URI):winjs.TPromise { return this._worker((w) => w.getOutline(resource)); } static $findDeclaration = OneWorkerAttr(LESSMode, LESSMode.prototype.findDeclaration); - public findDeclaration(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public findDeclaration(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this._worker((w) => w.findDeclaration(resource, position)); } static $findColorDeclarations = OneWorkerAttr(LESSMode, LESSMode.prototype.findColorDeclarations); - public findColorDeclarations(resource:network.URL):winjs.TPromise<{range:EditorCommon.IRange; value:string; }[]> { + public findColorDeclarations(resource:URI):winjs.TPromise<{range:EditorCommon.IRange; value:string; }[]> { return this._worker((w) => w.findColorDeclarations(resource)); } } diff --git a/src/vs/languages/less/test/common/colorizer.test.ts b/src/vs/languages/less/test/common/colorizer.test.ts index 97d2e60e197..f451f209919 100644 --- a/src/vs/languages/less/test/common/colorizer.test.ts +++ b/src/vs/languages/less/test/common/colorizer.test.ts @@ -11,6 +11,7 @@ import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); import LESS = require('vs/languages/less/common/less'); import modesUtil = require('vs/editor/test/common/modesUtil'); +import {cssTokenTypes} from 'vs/languages/css/common/css'; suite('LESS-tokenization', () => { @@ -33,7 +34,7 @@ suite('LESS-tokenization', () => { tokens: [ { startIndex: 0, type: 'keyword.less' }, { startIndex: 8, type: 'punctuation.parenthesis.less' }, - { startIndex: 9, type: 'meta.property-value.numeric.less' }, + { startIndex: 9, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex: 11, type: 'punctuation.parenthesis.less' }, { startIndex: 12, type: 'punctuation.less' } ]}], @@ -52,7 +53,7 @@ suite('LESS-tokenization', () => { [{ line: 'whenn', tokens: [ - { startIndex: 0, type: 'entity.name.tag.less' } + { startIndex: 0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' } ]}], [{ @@ -69,8 +70,8 @@ suite('LESS-tokenization', () => { tokens: [ { startIndex: 0, type: 'keyword.less' }, { startIndex: 8, type: 'punctuation.parenthesis.less' }, - { startIndex: 9, type: 'meta.property-value.numeric.less' }, - { startIndex: 11, type: 'meta.property-value.unit.less' }, + { startIndex: 9, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, + { startIndex: 11, type: cssTokenTypes.TOKEN_VALUE + '.unit.less' }, { startIndex: 13, type: 'punctuation.parenthesis.less' }, { startIndex: 14, type: 'punctuation.less' } ]}], @@ -78,7 +79,7 @@ suite('LESS-tokenization', () => { [{ line: 'pxx', tokens: [ - { startIndex: 0, type: 'entity.name.tag.less' } + { startIndex: 0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' } ]}], // single line Strings @@ -164,7 +165,7 @@ suite('LESS-tokenization', () => { tokens: [ { startIndex:0, type: 'comment.less' }, { startIndex:13, type: '' }, - { startIndex:14, type: 'meta.property-value.numeric.less' }, + { startIndex:14, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:15, type: 'punctuation.less' } ]}], @@ -172,28 +173,28 @@ suite('LESS-tokenization', () => { [{ line: '0', tokens: [ - { startIndex:0, type: 'meta.property-value.numeric.less' } + { startIndex:0, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' } ]}], [{ line: ' 0', tokens: [ { startIndex:0, type: '' }, - { startIndex:1, type: 'meta.property-value.numeric.less' } + { startIndex:1, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' } ]}], [{ line: ' 0 ', tokens: [ { startIndex:0, type: '' }, - { startIndex:1, type: 'meta.property-value.numeric.less' }, + { startIndex:1, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:2, type: '' } ]}], [{ line: '0 ', tokens: [ - { startIndex:0, type: 'meta.property-value.numeric.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:1, type: '' } ]}], @@ -203,9 +204,9 @@ suite('LESS-tokenization', () => { { startIndex:0, type: 'variable.less' }, { startIndex:5, type: 'punctuation.less' }, { startIndex:6, type: '' }, - { startIndex:7, type: 'meta.property-value.numeric.less' }, + { startIndex:7, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:8, type: 'operator.less' }, - { startIndex:9, type: 'meta.property-value.numeric.less' } + { startIndex:9, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' } ]}], [{ @@ -214,9 +215,9 @@ suite('LESS-tokenization', () => { { startIndex:0, type: 'variable.less' }, { startIndex:5, type: 'punctuation.less' }, { startIndex:6, type: '' }, - { startIndex:7, type: 'meta.property-value.numeric.less' }, + { startIndex:7, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:10, type: 'operator.less' }, - { startIndex:11, type: 'meta.property-value.numeric.less' } + { startIndex:11, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' } ]}], [{ @@ -225,23 +226,23 @@ suite('LESS-tokenization', () => { { startIndex:0, type: 'variable.less' }, { startIndex:5, type: 'punctuation.less' }, { startIndex:6, type: '' }, - { startIndex:7, type: 'meta.property-value.numeric.less' }, + { startIndex:7, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:8, type: '' }, { startIndex:9, type: 'operator.less' }, { startIndex:10, type: '' }, - { startIndex:11, type: 'meta.property-value.numeric.less' } + { startIndex:11, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' } ]}], [{ line: '0123', tokens: [ - { startIndex:0, type: 'meta.property-value.numeric.less' } + { startIndex:0, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' } ]}], [{ line: '#012343', tokens: [ - { startIndex:0, type: 'meta.property-value.rgb-value.less' } + { startIndex:0, type: cssTokenTypes.TOKEN_VALUE + '.rgb-value.less' } ]}], // Bracket Matching @@ -249,20 +250,20 @@ suite('LESS-tokenization', () => { line: '[1,2,3]', tokens: [ { startIndex:0, type: 'punctuation.bracket.less', bracket: Modes.Bracket.Open }, - { startIndex:1, type: 'meta.property-value.numeric.less' }, + { startIndex:1, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:2, type: 'punctuation.less' }, - { startIndex:3, type: 'meta.property-value.numeric.less' }, + { startIndex:3, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:4, type: 'punctuation.less' }, - { startIndex:5, type: 'meta.property-value.numeric.less' }, + { startIndex:5, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:6, type: 'punctuation.bracket.less', bracket: Modes.Bracket.Close } ]}], [{ line: 'foo(123);', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:3, type: 'punctuation.parenthesis.less', bracket: Modes.Bracket.Open }, - { startIndex:4, type: 'meta.property-value.numeric.less' }, + { startIndex:4, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:7, type: 'punctuation.parenthesis.less', bracket: Modes.Bracket.Close }, { startIndex:8, type: 'punctuation.less' } ]}], @@ -312,7 +313,7 @@ suite('LESS-tokenization', () => { { startIndex:10, type: '' }, { startIndex:11, type: 'punctuation.less' }, { startIndex:12, type: '' }, - { startIndex:13, type: 'meta.property-value.numeric.less' }, + { startIndex:13, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:14, type: 'punctuation.less' }, { startIndex:15, type: '' }, { startIndex:16, type: 'comment.less' } @@ -321,7 +322,7 @@ suite('LESS-tokenization', () => { [{ line: '.something(@some, @other) when (iscolor(@other)) { aname// my commen', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:10, type: 'punctuation.parenthesis.less' }, { startIndex:11, type: 'variable.less' }, { startIndex:16, type: 'punctuation.less' }, @@ -340,14 +341,14 @@ suite('LESS-tokenization', () => { { startIndex:48, type: '' }, { startIndex:49, type: 'punctuation.curly.less' }, { startIndex:50, type: '' }, - { startIndex:51, type: 'entity.name.tag.less' }, + { startIndex:51, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:56, type: 'comment.less' } ]}], [{ line: '.something(@some//mycomment', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:10, type: 'punctuation.parenthesis.less' }, { startIndex:11, type: 'variable.less' }, { startIndex:16, type: 'comment.less' } @@ -360,7 +361,7 @@ suite('LESS-tokenization', () => { { startIndex:10, type: '' }, { startIndex:11, type: 'punctuation.less' }, { startIndex:12, type: '' }, - { startIndex:13, type: 'meta.property-value.rgb-value.less' }, + { startIndex:13, type: cssTokenTypes.TOKEN_VALUE + '.rgb-value.less' }, { startIndex:15, type: 'punctuation.less' } ]}], @@ -396,7 +397,7 @@ suite('LESS-tokenization', () => { { startIndex:10, type: 'punctuation.less' }, { startIndex:11, type: '' }, { startIndex:12, type: 'comment.less' }, - { startIndex:29, type: 'meta.property-value.numeric.less' }, + { startIndex:29, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:30, type: 'punctuation.less' } ]}], @@ -408,7 +409,7 @@ suite('LESS-tokenization', () => { { startIndex:11, type: '' }, { startIndex:12, type: 'comment.less' }, { startIndex:23, type: '' }, - { startIndex:24, type: 'meta.property-value.numeric.less' }, + { startIndex:24, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:25, type: 'punctuation.less' } ]}], @@ -444,7 +445,7 @@ suite('LESS-tokenization', () => { { startIndex:15, type: '' }, { startIndex:16, type: 'punctuation.less' }, { startIndex:17, type: '' }, - { startIndex:18, type: 'meta.property-value.numeric.less' }, + { startIndex:18, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:19, type: 'punctuation.less' } ]}], @@ -452,11 +453,11 @@ suite('LESS-tokenization', () => { [{ line: '.class { filter: ~"ms:alwaysHasItsOwnSyntax.For.Stuff()";', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:6, type: '' }, { startIndex:7, type: 'punctuation.curly.less' }, { startIndex:8, type: '' }, - { startIndex:9, type: 'support.type.property-name.less' }, + { startIndex:9, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:15, type: 'punctuation.less' }, { startIndex:16, type: '' }, { startIndex:17, type: 'string.punctuation.less' }, @@ -469,10 +470,10 @@ suite('LESS-tokenization', () => { [{ line: '.class {.mixin (@a) when (@a > 10), (@a < -10) { }', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:6, type: '' }, { startIndex:7, type: 'punctuation.curly.less' }, - { startIndex:8, type: 'entity.other.attribute-name.class.less' }, + { startIndex:8, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:14, type: '' }, { startIndex:15, type: 'punctuation.parenthesis.less' }, { startIndex:16, type: 'variable.less' }, @@ -485,7 +486,7 @@ suite('LESS-tokenization', () => { { startIndex:28, type: '' }, { startIndex:29, type: 'operator.less' }, { startIndex:30, type: '' }, - { startIndex:31, type: 'meta.property-value.numeric.less' }, + { startIndex:31, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:33, type: 'punctuation.parenthesis.less' }, { startIndex:34, type: 'punctuation.less' }, { startIndex:35, type: '' }, @@ -495,7 +496,7 @@ suite('LESS-tokenization', () => { { startIndex:40, type: 'operator.less' }, { startIndex:41, type: '' }, { startIndex:42, type: 'operator.less' }, - { startIndex:43, type: 'meta.property-value.numeric.less' }, + { startIndex:43, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:45, type: 'punctuation.parenthesis.less' }, { startIndex:46, type: '' }, { startIndex:47, type: 'punctuation.curly.less' }, @@ -506,7 +507,7 @@ suite('LESS-tokenization', () => { [{ line: '.truth (@a) when (@a = true) { }', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:6, type: '' }, { startIndex:7, type: 'punctuation.parenthesis.less' }, { startIndex:8, type: 'variable.less' }, @@ -530,7 +531,7 @@ suite('LESS-tokenization', () => { [{ line: '.max (@a, @b) when (@a > @b) { width: @a; }', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:4, type: '' }, { startIndex:5, type: 'punctuation.parenthesis.less' }, { startIndex:6, type: 'variable.less' }, @@ -551,7 +552,7 @@ suite('LESS-tokenization', () => { { startIndex:28, type: '' }, { startIndex:29, type: 'punctuation.curly.less' }, { startIndex:30, type: '' }, - { startIndex:31, type: 'support.type.property-name.less' }, + { startIndex:31, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:36, type: 'punctuation.less' }, { startIndex:37, type: '' }, { startIndex:38, type: 'variable.less' }, @@ -563,7 +564,7 @@ suite('LESS-tokenization', () => { [{ line: '.mixin (@a, @b: 0) when (isnumber(@b)) { }', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:6, type: '' }, { startIndex:7, type: 'punctuation.parenthesis.less' }, { startIndex:8, type: 'variable.less' }, @@ -572,7 +573,7 @@ suite('LESS-tokenization', () => { { startIndex:12, type: 'variable.less' }, { startIndex:14, type: 'punctuation.less' }, { startIndex:15, type: '' }, - { startIndex:16, type: 'meta.property-value.numeric.less' }, + { startIndex:16, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:17, type: 'punctuation.parenthesis.less' }, { startIndex:18, type: '' }, { startIndex:19, type: 'keyword.less' }, @@ -592,7 +593,7 @@ suite('LESS-tokenization', () => { [{ line: '.mixin (@a, @b: black) when (iscolor(@b)) { }', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:6, type: '' }, { startIndex:7, type: 'punctuation.parenthesis.less' }, { startIndex:8, type: 'variable.less' }, @@ -601,7 +602,7 @@ suite('LESS-tokenization', () => { { startIndex:12, type: 'variable.less' }, { startIndex:14, type: 'punctuation.less' }, { startIndex:15, type: '' }, - { startIndex:16, type: 'meta.property-value.less' }, + { startIndex:16, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:21, type: 'punctuation.parenthesis.less' }, { startIndex:22, type: '' }, { startIndex:23, type: 'keyword.less' }, @@ -640,46 +641,46 @@ suite('LESS-tokenization', () => { [{ line: '.box-shadow(inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6));', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:11, type: 'punctuation.parenthesis.less' }, - { startIndex:12, type: 'meta.property-value.less' }, + { startIndex:12, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:17, type: '' }, - { startIndex:18, type: 'meta.property-value.numeric.less' }, + { startIndex:18, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:19, type: '' }, - { startIndex:20, type: 'meta.property-value.numeric.less' }, - { startIndex:21, type: 'meta.property-value.unit.less' }, + { startIndex:20, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, + { startIndex:21, type: cssTokenTypes.TOKEN_VALUE + '.unit.less' }, { startIndex:23, type: '' }, - { startIndex:24, type: 'meta.property-value.numeric.less' }, - { startIndex:25, type: 'meta.property-value.unit.less' }, + { startIndex:24, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, + { startIndex:25, type: cssTokenTypes.TOKEN_VALUE + '.unit.less' }, { startIndex:27, type: '' }, - { startIndex:28, type: 'meta.property-value.less' }, + { startIndex:28, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:32, type: 'punctuation.parenthesis.less' }, - { startIndex:33, type: 'meta.property-value.numeric.less' }, + { startIndex:33, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:34, type: 'punctuation.less' }, - { startIndex:35, type: 'meta.property-value.numeric.less' }, + { startIndex:35, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:36, type: 'punctuation.less' }, - { startIndex:37, type: 'meta.property-value.numeric.less' }, + { startIndex:37, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:38, type: 'punctuation.less' }, - { startIndex:39, type: 'meta.property-value.numeric.less' }, + { startIndex:39, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:43, type: 'punctuation.parenthesis.less' }, { startIndex:44, type: 'punctuation.less' }, { startIndex:45, type: '' }, - { startIndex:46, type: 'meta.property-value.numeric.less' }, + { startIndex:46, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:47, type: '' }, - { startIndex:48, type: 'meta.property-value.numeric.less' }, + { startIndex:48, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:49, type: '' }, - { startIndex:50, type: 'meta.property-value.numeric.less' }, - { startIndex:51, type: 'meta.property-value.unit.less' }, + { startIndex:50, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, + { startIndex:51, type: cssTokenTypes.TOKEN_VALUE + '.unit.less' }, { startIndex:53, type: '' }, - { startIndex:54, type: 'meta.property-value.less' }, + { startIndex:54, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:58, type: 'punctuation.parenthesis.less' }, - { startIndex:59, type: 'meta.property-value.numeric.less' }, + { startIndex:59, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:61, type: 'punctuation.less' }, - { startIndex:62, type: 'meta.property-value.numeric.less' }, + { startIndex:62, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:65, type: 'punctuation.less' }, - { startIndex:66, type: 'meta.property-value.numeric.less' }, + { startIndex:66, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:69, type: 'punctuation.less' }, - { startIndex:70, type: 'meta.property-value.numeric.less' }, + { startIndex:70, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:72, type: 'punctuation.parenthesis.less' }, { startIndex:73, type: 'punctuation.parenthesis.less' }, { startIndex:74, type: 'punctuation.less' } @@ -689,9 +690,9 @@ suite('LESS-tokenization', () => { [{ line: 'input[type="radio"]', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:5, type: 'punctuation.bracket.less' }, - { startIndex:6, type: 'entity.name.tag.less' }, + { startIndex:6, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:10, type: 'operator.less' }, { startIndex:11, type: 'string.punctuation.less' }, { startIndex:12, type: 'string.less' }, @@ -711,7 +712,7 @@ suite('LESS-tokenization', () => { [{ line: 'some("\\42");', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:4, type: 'punctuation.parenthesis.less' }, { startIndex:5, type: 'string.punctuation.less' }, { startIndex:6, type: 'string.less' }, @@ -735,7 +736,7 @@ suite('LESS-tokenization', () => { [{ line: 'class^="icon-"', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:5, type: 'operator.less' }, { startIndex:7, type: 'string.punctuation.less' }, { startIndex:8, type: 'string.less' }, @@ -745,7 +746,7 @@ suite('LESS-tokenization', () => { [{ line: 'class*="icon-"', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:5, type: 'operator.less' }, { startIndex:7, type: 'string.punctuation.less' }, { startIndex:8, type: 'string.less' }, @@ -755,7 +756,7 @@ suite('LESS-tokenization', () => { [{ line: 'class~="icon-"', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:5, type: 'operator.less' }, { startIndex:7, type: 'string.punctuation.less' }, { startIndex:8, type: 'string.less' }, @@ -765,7 +766,7 @@ suite('LESS-tokenization', () => { [{ line: 'class ~ = "icon-"', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:5, type: '' }, { startIndex:6, type: 'operator.less' }, { startIndex:7, type: '' }, @@ -779,7 +780,7 @@ suite('LESS-tokenization', () => { [{ line: 'class|="icon-"', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:5, type: 'operator.less' }, { startIndex:7, type: 'string.punctuation.less' }, { startIndex:8, type: 'string.less' }, @@ -789,18 +790,18 @@ suite('LESS-tokenization', () => { [{ line: '.hide-text { font: 0/0 a; }', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:10, type: '' }, { startIndex:11, type: 'punctuation.curly.less' }, { startIndex:12, type: '' }, - { startIndex:13, type: 'support.type.property-name.less' }, + { startIndex:13, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:17, type: 'punctuation.less' }, { startIndex:18, type: '' }, - { startIndex:19, type: 'meta.property-value.numeric.less' }, + { startIndex:19, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:20, type: 'operator.less' }, - { startIndex:21, type: 'meta.property-value.numeric.less' }, + { startIndex:21, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:22, type: '' }, - { startIndex:23, type: 'meta.property-value.less' }, + { startIndex:23, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:24, type: 'punctuation.less' }, { startIndex:25, type: '' }, { startIndex:26, type: 'punctuation.curly.less' } @@ -810,7 +811,7 @@ suite('LESS-tokenization', () => { [{ line: '.translate3d(@x, @y, @z) { -webkit-transform: translate3d(@x, @y, @z); }', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:12, type: 'punctuation.parenthesis.less' }, { startIndex:13, type: 'variable.less' }, { startIndex:15, type: 'punctuation.less' }, @@ -823,10 +824,10 @@ suite('LESS-tokenization', () => { { startIndex:24, type: '' }, { startIndex:25, type: 'punctuation.curly.less' }, { startIndex:26, type: '' }, - { startIndex:27, type: 'support.type.property-name.less' }, + { startIndex:27, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:44, type: 'punctuation.less' }, { startIndex:45, type: '' }, - { startIndex:46, type: 'meta.property-value.less' }, + { startIndex:46, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:57, type: 'punctuation.parenthesis.less' }, { startIndex:58, type: 'variable.less' }, { startIndex:60, type: 'punctuation.less' }, @@ -845,20 +846,20 @@ suite('LESS-tokenization', () => { [{ line: '.dropdown-menu > li > a:hover > [class=" icon-"]', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:14, type: '' }, { startIndex:15, type: 'operator.less' }, { startIndex:16, type: '' }, - { startIndex:17, type: 'entity.name.tag.less' }, + { startIndex:17, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:19, type: '' }, { startIndex:20, type: 'operator.less' }, { startIndex:21, type: '' }, - { startIndex:22, type: 'entity.name.tag.less' }, + { startIndex:22, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:29, type: '' }, { startIndex:30, type: 'operator.less' }, { startIndex:31, type: '' }, { startIndex:32, type: 'punctuation.bracket.less' }, - { startIndex:33, type: 'entity.name.tag.less' }, + { startIndex:33, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:38, type: 'operator.less' }, { startIndex:39, type: 'string.punctuation.less' }, { startIndex:40, type: 'string.less' }, @@ -869,39 +870,39 @@ suite('LESS-tokenization', () => { [{ line: '.bw-gradient(@color: #F5F5F5, @start: 0, @stop: 255) { background: -webkit-gradient(color-stop(0, rgb(@start,@start,@start)), color-stop(1, rgb(@stop,@stop,@stop))); }', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:12, type: 'punctuation.parenthesis.less' }, { startIndex:13, type: 'variable.less' }, { startIndex:19, type: 'punctuation.less' }, { startIndex:20, type: '' }, - { startIndex:21, type: 'meta.property-value.rgb-value.less' }, + { startIndex:21, type: cssTokenTypes.TOKEN_VALUE + '.rgb-value.less' }, { startIndex:28, type: 'punctuation.less' }, { startIndex:29, type: '' }, { startIndex:30, type: 'variable.less' }, { startIndex:36, type: 'punctuation.less' }, { startIndex:37, type: '' }, - { startIndex:38, type: 'meta.property-value.numeric.less' }, + { startIndex:38, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:39, type: 'punctuation.less' }, { startIndex:40, type: '' }, { startIndex:41, type: 'variable.less' }, { startIndex:46, type: 'punctuation.less' }, { startIndex:47, type: '' }, - { startIndex:48, type: 'meta.property-value.numeric.less' }, + { startIndex:48, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:51, type: 'punctuation.parenthesis.less' }, { startIndex:52, type: '' }, { startIndex:53, type: 'punctuation.curly.less' }, { startIndex:54, type: '' }, - { startIndex:55, type: 'support.type.property-name.less' }, + { startIndex:55, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:65, type: 'punctuation.less' }, { startIndex:66, type: '' }, - { startIndex:67, type: 'meta.property-value.less' }, + { startIndex:67, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:83, type: 'punctuation.parenthesis.less' }, - { startIndex:84, type: 'meta.property-value.less' }, + { startIndex:84, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:94, type: 'punctuation.parenthesis.less' }, - { startIndex:95, type: 'meta.property-value.numeric.less' }, + { startIndex:95, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:96, type: 'punctuation.less' }, { startIndex:97, type: '' }, - { startIndex:98, type: 'meta.property-value.less' }, + { startIndex:98, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:101, type: 'punctuation.parenthesis.less' }, { startIndex:102, type: 'variable.less' }, { startIndex:108, type: 'punctuation.less' }, @@ -912,12 +913,12 @@ suite('LESS-tokenization', () => { { startIndex:123, type: 'punctuation.parenthesis.less' }, { startIndex:124, type: 'punctuation.less' }, { startIndex:125, type: '' }, - { startIndex:126, type: 'meta.property-value.less' }, + { startIndex:126, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:136, type: 'punctuation.parenthesis.less' }, - { startIndex:137, type: 'meta.property-value.numeric.less' }, + { startIndex:137, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:138, type: 'punctuation.less' }, { startIndex:139, type: '' }, - { startIndex:140, type: 'meta.property-value.less' }, + { startIndex:140, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:143, type: 'punctuation.parenthesis.less' }, { startIndex:144, type: 'variable.less' }, { startIndex:149, type: 'punctuation.less' }, @@ -937,7 +938,7 @@ suite('LESS-tokenization', () => { line: ' body ', tokens: [ { startIndex:0, type: '' }, - { startIndex:6, type: 'entity.name.tag.less' }, + { startIndex:6, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:10, type: '' } ]}], @@ -952,54 +953,54 @@ suite('LESS-tokenization', () => { [{ line: 'body {', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:4, type: '' }, { startIndex:5, type: 'punctuation.curly.less', bracket: Modes.Bracket.Open } ]}, { line: ' margin: 0;', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.less' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:8, type: 'punctuation.less' }, { startIndex:9, type: '' }, - { startIndex:10, type: 'meta.property-value.numeric.less' }, + { startIndex:10, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, { startIndex:11, type: 'punctuation.less' } ]}, { line: ' padding: 3em 6em;', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.less' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:9, type: 'punctuation.less' }, { startIndex:10, type: '' }, - { startIndex:11, type: 'meta.property-value.numeric.less' }, - { startIndex:12, type: 'meta.property-value.unit.less' }, + { startIndex:11, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, + { startIndex:12, type: cssTokenTypes.TOKEN_VALUE + '.unit.less' }, { startIndex:14, type: '' }, - { startIndex:15, type: 'meta.property-value.numeric.less' }, - { startIndex:16, type: 'meta.property-value.unit.less' }, + { startIndex:15, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, + { startIndex:16, type: cssTokenTypes.TOKEN_VALUE + '.unit.less' }, { startIndex:18, type: 'punctuation.less' } ]}, { line: ' font-family: tahoma, arial, sans-serif;', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.less' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:13, type: 'punctuation.less' }, { startIndex:14, type: '' }, - { startIndex:15, type: 'meta.property-value.less' }, + { startIndex:15, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:21, type: 'punctuation.less' }, { startIndex:22, type: '' }, - { startIndex:23, type: 'meta.property-value.less' }, + { startIndex:23, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:28, type: 'punctuation.less' }, { startIndex:29, type: '' }, - { startIndex:30, type: 'meta.property-value.less' }, + { startIndex:30, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:40, type: 'punctuation.less' } ]}, { line: ' text-decoration: none !important;', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.less' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:17, type: 'punctuation.less' }, { startIndex:18, type: '' }, - { startIndex:19, type: 'meta.property-value.less' }, + { startIndex:19, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:23, type: '' }, { startIndex:24, type: 'keyword.less' }, { startIndex:34, type: 'punctuation.less' } @@ -1007,10 +1008,10 @@ suite('LESS-tokenization', () => { line: ' color: #000;', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.less' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:7, type: 'punctuation.less' }, { startIndex:8, type: '' }, - { startIndex:9, type: 'meta.property-value.rgb-value.less' }, + { startIndex:9, type: cssTokenTypes.TOKEN_VALUE + '.rgb-value.less' }, { startIndex:13, type: 'punctuation.less' } ]}, { line: ' }', @@ -1027,19 +1028,19 @@ suite('LESS-tokenization', () => { { startIndex:1, type: '' }, { startIndex:2, type: 'punctuation.curly.less' }, { startIndex:3, type: '' }, - { startIndex:4, type: 'support.type.property-name.less' }, + { startIndex:4, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:11, type: 'punctuation.less' }, { startIndex:12, type: '' }, - { startIndex:13, type: 'meta.property-value.numeric.less' }, - { startIndex:14, type: 'meta.property-value.unit.less' }, + { startIndex:13, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, + { startIndex:14, type: cssTokenTypes.TOKEN_VALUE + '.unit.less' }, { startIndex:16, type: '' }, { startIndex:17, type: 'operator.less' }, - { startIndex:18, type: 'meta.property-value.numeric.less' }, - { startIndex:19, type: 'meta.property-value.unit.less' }, + { startIndex:18, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, + { startIndex:19, type: cssTokenTypes.TOKEN_VALUE + '.unit.less' }, { startIndex:21, type: '' }, { startIndex:22, type: 'operator.less' }, - { startIndex:23, type: 'meta.property-value.numeric.less' }, - { startIndex:26, type: 'meta.property-value.unit.less' }, + { startIndex:23, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, + { startIndex:26, type: cssTokenTypes.TOKEN_VALUE + '.unit.less' }, { startIndex:28, type: 'punctuation.less' }, { startIndex:29, type: '' }, { startIndex:30, type: 'punctuation.curly.less' } @@ -1050,11 +1051,11 @@ suite('LESS-tokenization', () => { [{ line: 'h1 /*comment*/ p {', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:2, type: '' }, { startIndex:3, type: 'comment.less' }, { startIndex:14, type: '' }, - { startIndex:15, type: 'entity.name.tag.less' }, + { startIndex:15, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:16, type: '' }, { startIndex:17, type: 'punctuation.curly.less', bracket: Modes.Bracket.Open } ]}], @@ -1065,7 +1066,7 @@ suite('LESS-tokenization', () => { [{ line: 'h1 /*com', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:2, type: '' }, { startIndex:3, type: 'comment.less' } ]}, { @@ -1073,7 +1074,7 @@ suite('LESS-tokenization', () => { tokens: [ { startIndex:0, type: 'comment.less' }, { startIndex:6, type: '' }, - { startIndex:7, type: 'entity.name.tag.less' } + { startIndex:7, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' } ]}], // CSS ID rule @@ -1084,7 +1085,7 @@ suite('LESS-tokenization', () => { [{ line: '#myID {', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.id.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.id.less' }, { startIndex:5, type: '' }, { startIndex:6, type: 'punctuation.curly.less', bracket: Modes.Bracket.Open } ]}], @@ -1095,7 +1096,7 @@ suite('LESS-tokenization', () => { [{ line: '.myID {', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:5, type: '' }, { startIndex:6, type: 'punctuation.curly.less', bracket: Modes.Bracket.Open } ]}], @@ -1125,7 +1126,7 @@ suite('LESS-tokenization', () => { line: ' content: "con\\', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.less' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:9, type: 'punctuation.less' }, { startIndex:10, type: '' }, { startIndex:11, type: 'string.punctuation.less', bracket: Modes.Bracket.Open }, @@ -1147,7 +1148,7 @@ suite('LESS-tokenization', () => { line: ' content: "";', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.less' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:9, type: 'punctuation.less' }, { startIndex:10, type: '' }, { startIndex:11, type: 'string.punctuation.less', bracket: Modes.Bracket.Open }, @@ -1162,7 +1163,7 @@ suite('LESS-tokenization', () => { line: ' _content: "";', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.less' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:10, type: 'punctuation.less' }, { startIndex:11, type: '' }, { startIndex:12, type: 'string.punctuation.less', bracket: Modes.Bracket.Open }, @@ -1184,7 +1185,7 @@ suite('LESS-tokenization', () => { line: ' font-family: "Opificio";', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.less' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:13, type: 'punctuation.less' }, { startIndex:14, type: '' }, { startIndex:15, type: 'string.punctuation.less', bracket: Modes.Bracket.Open }, @@ -1206,7 +1207,7 @@ suite('LESS-tokenization', () => { [{ line: 'p{}', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:1, type: 'punctuation.curly.less', bracket: Modes.Bracket.Open }, { startIndex:2, type: 'punctuation.curly.less', bracket: Modes.Bracket.Close } ]}], @@ -1214,7 +1215,7 @@ suite('LESS-tokenization', () => { [{ line: 'p:nth() {}', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:5, type: 'punctuation.parenthesis.less', bracket: Modes.Bracket.Open }, { startIndex:6, type: 'punctuation.parenthesis.less', bracket: Modes.Bracket.Close }, { startIndex:7, type: '' }, @@ -1270,13 +1271,13 @@ suite('LESS-tokenization', () => { ]}, { line: '.rule1{}', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:6, type: 'punctuation.curly.less', bracket: Modes.Bracket.Open }, { startIndex:7, type: 'punctuation.curly.less', bracket: Modes.Bracket.Close } ]}, { line: '.rule2{}', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:6, type: 'punctuation.curly.less', bracket: Modes.Bracket.Open }, { startIndex:7, type: 'punctuation.curly.less', bracket: Modes.Bracket.Close } ]}], @@ -1287,27 +1288,27 @@ suite('LESS-tokenization', () => { tokens: [ { startIndex:0, type: 'variable.less' }, { startIndex:18, type: '' }, - { startIndex:19, type: 'entity.name.tag.less' }, + { startIndex:19, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:36, type: '' }, { startIndex:37, type: 'punctuation.curly.less', bracket: Modes.Bracket.Open } ]}, { line: ' from {', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'entity.name.tag.less' }, + { startIndex:2, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:6, type: '' }, { startIndex:7, type: 'punctuation.curly.less' } ]}, { line: ' -webkit-transform: rotate(0deg);', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.less' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:19, type: 'punctuation.less' }, { startIndex:20, type: '' }, - { startIndex:21, type: 'meta.property-value.less' }, + { startIndex:21, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:27, type: 'punctuation.parenthesis.less' }, - { startIndex:28, type: 'meta.property-value.numeric.less' }, - { startIndex:29, type: 'meta.property-value.unit.less' }, + { startIndex:28, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, + { startIndex:29, type: cssTokenTypes.TOKEN_VALUE + '.unit.less' }, { startIndex:32, type: 'punctuation.parenthesis.less' }, { startIndex:33, type: 'punctuation.less' } ]}, { @@ -1319,20 +1320,20 @@ suite('LESS-tokenization', () => { line: ' to {', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'entity.name.tag.less' }, + { startIndex:2, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:4, type: '' }, { startIndex:5, type: 'punctuation.curly.less' } ]}, { line: ' -webkit-transform: rotate(360deg);', tokens: [ { startIndex:0, type: '' }, - { startIndex:2, type: 'support.type.property-name.less' }, + { startIndex:2, type: cssTokenTypes.TOKEN_PROPERTY + '.less' }, { startIndex:19, type: 'punctuation.less' }, { startIndex:20, type: '' }, - { startIndex:21, type: 'meta.property-value.less' }, + { startIndex:21, type: cssTokenTypes.TOKEN_VALUE + '.less' }, { startIndex:27, type: 'punctuation.parenthesis.less' }, - { startIndex:28, type: 'meta.property-value.numeric.less' }, - { startIndex:31, type: 'meta.property-value.unit.less' }, + { startIndex:28, type: cssTokenTypes.TOKEN_VALUE + '.numeric.less' }, + { startIndex:31, type: cssTokenTypes.TOKEN_VALUE + '.unit.less' }, { startIndex:34, type: 'punctuation.parenthesis.less' }, { startIndex:35, type: 'punctuation.less' } ]}, { @@ -1352,12 +1353,12 @@ suite('LESS-tokenization', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: 'input[type= \\"submit\\"', tokens: [ - { startIndex:0, type: 'entity.name.tag.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:5, type: 'punctuation.bracket.less'}, - { startIndex:6, type: 'entity.name.tag.less' }, + { startIndex:6, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less' }, { startIndex:10, type: 'operator.less'}, { startIndex:11, type: ''}, - { startIndex:12, type: 'entity.name.tag.less'} + { startIndex:12, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less'} ]} ]); }); @@ -1366,13 +1367,13 @@ suite('LESS-tokenization', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: '.\\34 hello { -moz-foo: --myvar }', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.class.less' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.class.less' }, { startIndex:10, type: ''}, { startIndex:11, type: 'punctuation.curly.less'}, { startIndex:12, type: ''}, - { startIndex:13, type: 'entity.name.tag.less'}, + { startIndex:13, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less'}, { startIndex:22, type: ''}, - { startIndex:23, type: 'entity.name.tag.less'}, + { startIndex:23, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.less'}, { startIndex:30, type: ''}, { startIndex:31, type: 'punctuation.curly.less'}, ]} diff --git a/src/vs/languages/less/test/common/intellisense.test.ts b/src/vs/languages/less/test/common/intellisense.test.ts index 0328d4e3481..a50d3893f96 100644 --- a/src/vs/languages/less/test/common/intellisense.test.ts +++ b/src/vs/languages/less/test/common/intellisense.test.ts @@ -7,7 +7,7 @@ import assert = require('assert'); import mm = require('vs/editor/common/model/mirrorModel'); import lessWorker = require('vs/languages/less/common/lessWorker'); -import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import ResourceService = require('vs/editor/common/services/resourceServiceImpl'); import WinJS = require('vs/base/common/winjs.base'); import EditorCommon = require('vs/editor/common/editorCommon'); @@ -20,9 +20,9 @@ suite('LESS - Intellisense', () => { //------------ TEST suggestions ---------------- - var testSuggestionsFor = function(value:string, stringBefore:string):WinJS.TPromise { + var testSuggestionsFor = function(value:string, stringBefore:string):WinJS.TPromise { var resourceService = new ResourceService.ResourceService(); - var url = new Network.URL('test://1'); + var url = URI.parse('test://1'); resourceService.insert(url, mm.createMirrorModelFromString(null, 0, value, modesUtil.createMockMode('mock.mode.id', /(-?\d*\.\d+)|([\w-]+)/g), url)); let services = servicesUtil2.createMockEditorWorkerServices({ @@ -43,7 +43,7 @@ suite('LESS - Intellisense', () => { return worker.suggest(url, position).then(result => result[0]); }; - var assertSuggestion= function(completion:Modes.ISuggestions, label:string) { + var assertSuggestion= function(completion:Modes.ISuggestResult, label:string) { var proposalsFound = completion.suggestions.filter(function(suggestion: Modes.ISuggestion) { return suggestion.label === label; }); @@ -54,24 +54,24 @@ suite('LESS - Intellisense', () => { test('LESS - Intellisense', function(testDone):any { WinJS.Promise.join([ - testSuggestionsFor('body { ', '{ ').then(function(completion:Modes.ISuggestions):void { + testSuggestionsFor('body { ', '{ ').then(function(completion:Modes.ISuggestResult):void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, 'display'); assertSuggestion(completion, 'background'); }), - testSuggestionsFor('body { ver', 'ver').then(function(completion:Modes.ISuggestions):void { + testSuggestionsFor('body { ver', 'ver').then(function(completion:Modes.ISuggestResult):void { assert.equal(completion.currentWord, 'ver'); assertSuggestion(completion, 'vertical-align'); }), - testSuggestionsFor('body { word-break: ', ': ').then(function(completion:Modes.ISuggestions):void { + testSuggestionsFor('body { word-break: ', ': ').then(function(completion:Modes.ISuggestResult):void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, 'keep-all'); }), - testSuggestionsFor('body { inner { vertical-align: }', ': ').then(function(completion:Modes.ISuggestions):void { + testSuggestionsFor('body { inner { vertical-align: }', ': ').then(function(completion:Modes.ISuggestResult):void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, 'bottom'); }), - testSuggestionsFor('@var1: 3; body { inner { vertical-align: }', 'align: ').then(function(completion:Modes.ISuggestions):void { + testSuggestionsFor('@var1: 3; body { inner { vertical-align: }', 'align: ').then(function(completion:Modes.ISuggestResult):void { assert.equal(completion.currentWord, ''); assertSuggestion(completion, '@var1'); }), diff --git a/src/vs/languages/markdown/common/markdown.ts b/src/vs/languages/markdown/common/markdown.ts index 45b2474ffe2..3109e33847b 100644 --- a/src/vs/languages/markdown/common/markdown.ts +++ b/src/vs/languages/markdown/common/markdown.ts @@ -7,6 +7,7 @@ import WinJS = require('vs/base/common/winjs.base'); import Monarch = require('vs/editor/common/modes/monarch/monarch'); import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import Types = require('vs/editor/common/modes/monarch/monarchTypes'); import Compile = require('vs/editor/common/modes/monarch/monarchCompile'); import EditorCommon = require('vs/editor/common/editorCommon'); @@ -204,7 +205,6 @@ export const language = }; export class MarkdownMode extends Monarch.MonarchMode implements Modes.IEmitOutputSupport { - private baseUrl: string; public emitOutputSupport: Modes.IEmitOutputSupport; @@ -219,9 +219,6 @@ export class MarkdownMode extends Monarch.MonarchMode { // TODO@Ben technical debt: worker cannot resolve paths absolute - return this._worker((w) => w.getEmitOutput(resource, this.baseUrl, absoluteWorkerResourcesPath)); + public getEmitOutput(resource: URI, absoluteWorkerResourcesPath?: string): WinJS.TPromise { // TODO@Ben technical debt: worker cannot resolve paths absolute + return this._worker((w) => w.getEmitOutput(resource, absoluteWorkerResourcesPath)); } protected _getWorkerDescriptor(): AsyncDescriptor2 { diff --git a/src/vs/languages/markdown/common/markdownWorker.ts b/src/vs/languages/markdown/common/markdownWorker.ts index bb9e9da5fa7..19ad6689811 100644 --- a/src/vs/languages/markdown/common/markdownWorker.ts +++ b/src/vs/languages/markdown/common/markdownWorker.ts @@ -6,7 +6,7 @@ import WinJS = require('vs/base/common/winjs.base'); import {AbstractModeWorker} from 'vs/editor/common/modes/abstractModeWorker'; -import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import Types = require('vs/base/common/types'); import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); @@ -101,7 +101,7 @@ export class MarkdownWorker extends AbstractModeWorker { private modeService: IModeService; constructor(mode: Modes.IMode, participants: Modes.IWorkerParticipant[], @IResourceService resourceService: IResourceService, - @IMarkerService markerService: IMarkerService, @IModeService modeService:IModeService) { + @IMarkerService markerService: IMarkerService, @IModeService modeService: IModeService) { super(mode, participants, resourceService, markerService); this.modeService = modeService; @@ -119,7 +119,7 @@ export class MarkdownWorker extends AbstractModeWorker { return WinJS.TPromise.as(false); } - public getEmitOutput(resource: Network.URL, baseUrl: string, absoluteWorkersResourcePath: string): WinJS.TPromise { // TODO@Ben technical debt: worker cannot resolve paths absolute + public getEmitOutput(resource: URI, absoluteWorkersResourcePath: string): WinJS.TPromise { // TODO@Ben technical debt: worker cannot resolve paths absolute let model = this.resourceService.get(resource); let cssLinks: string[] = this.cssLinks || []; @@ -127,7 +127,7 @@ export class MarkdownWorker extends AbstractModeWorker { let renderer = new Marked.marked.Renderer(); let $this = this; renderer.image = function(href: string, title: string, text: string): string { - let out = '' + text + '', (cssLinks.length === 0) ? '' : '', (cssLinks.length === 0) ? '' : '', - '', (this.theme === Theme.LIGHT) ? MarkdownWorker.LIGHT_SCROLLBAR_CSS : (this.theme === Theme.DARK) ? MarkdownWorker.DARK_SCROLLBAR_CSS : MarkdownWorker.HC_BLACK_SCROLLBAR_CSS, cssLinks.map((style) => { - return ''; + return ''; }).join('\n'), '', isMacintosh ? '' : '' @@ -213,26 +212,16 @@ export class MarkdownWorker extends AbstractModeWorker { }); } - private fixHref(resource: Network.URL, href: string, baseUrl: string): string { + private fixHref(resource: URI, href: string): string { if (href) { - let url = new Network.URL(href); - // URL is actually a path - if (!url.getScheme()) { - let path = href; - - // the user might have used windows backslash, but we only support slashes in URLs, so fix up - path = Strings.replaceAll(path, '\\', '/'); - - // Absolute path: resolve against base URL - if (path[0] === '/') { - return Paths.join(baseUrl, path); - } - - // Relative path: resolve against resource URL - let resourcePath = resource.getPath(); - return Paths.join(Paths.dirname(resourcePath), path); + // Return early if href is already a URL + if (URI.parse(href).scheme) { + return href; } + + // Otherwise convert to a file URI by joining the href with the resource location + return URI.file(Paths.join(Paths.dirname(resource.fsPath), href)).toString(); } return href; diff --git a/src/vs/languages/markdown/common/tokens.css b/src/vs/languages/markdown/common/tokens.css index 41acddee165..8af0921fc9c 100644 --- a/src/vs/languages/markdown/common/tokens.css +++ b/src/vs/languages/markdown/common/tokens.css @@ -41,9 +41,6 @@ /* PHP */ .monaco-editor.vs .token.metatag.php { font-weight: bold; } -.monaco-editor.vs .token.constant.php { color: #dd0000; } -.monaco-editor.vs .token.block.php { color: green; } -.monaco-editor.vs .token.variable.predefined.php { color: #ff8888; } /* Ruby */ .monaco-editor.vs .token.predefined.ruby { color: #0000FF; } @@ -73,15 +70,15 @@ .monaco-editor.vs .token.delimiter.html { color: #383838; } .monaco-editor.vs .token.metatag.content.html { color: red; } .monaco-editor.vs .token.metatag.html { color: gray; } -.monaco-editor.vs .token.tag.html { color: #800000; } .monaco-editor.vs .token.attribute.name.html { color: red; } .monaco-editor.vs .token.attribute.value.html { color: blue; } +.monaco-editor.vs .token.string.html { color: blue; } + /* XML */ .monaco-editor.vs .token.delimiter.xml { color: blue; } .monaco-editor.vs .token.metatag.content.xml { color: red; } .monaco-editor.vs .token.metatag.xml { color: gray; } -.monaco-editor.vs .token.tag.xml { color: #800000; } .monaco-editor.vs .token.attribute.name.xml { color: red; } .monaco-editor.vs .token.attribute.value.xml { color: blue; } @@ -97,7 +94,6 @@ .monaco-editor.vs .token.delimiter.vs { color: #708870; } /* Jade */ -.monaco-editor.vs .token.tag.jade { color: #800000; } .monaco-editor.vs .token.tag.id.jade, .monaco-editor.vs .token.tag.class.jade { color: #4F76AC; } .monaco-editor.vs .token.interpolation.jade { color: magenta; } @@ -128,7 +124,7 @@ .monaco-editor.vs-dark .token.number.octal { color: #204070; } .monaco-editor.vs-dark .token.regexp { color: #B46695; } .monaco-editor.vs-dark .token.delimiter { color: #DCDCDC; } -.monaco-editor.vs-dark .token.tag { color: #D7BA7D; } +.monaco-editor.vs-dark .token.tag { color: #569CD6; } .monaco-editor.vs-dark .token.metatag { color: #DD6A6F; } .monaco-editor.vs-dark .token.annotation { color: #cc6666; } .monaco-editor.vs-dark .token.key { color: #9CDCFE; } @@ -174,13 +170,13 @@ /* HTML */ -.monaco-editor.vs-dark .token.tag.html { color: #569CD6; } .monaco-editor.vs-dark .token.delimiter.html { color: #808080; } .monaco-editor.vs-dark .token.metatag.content.html { color: #9CDCFE; } .monaco-editor.vs-dark .token.metatag.html { color: #569CD6; } +.monaco-editor.vs-dark .token.string.html { color: #CE9178; } + /* XML */ -.monaco-editor.vs-dark .token.tag.xml { color: #569CD6; } .monaco-editor.vs-dark .token.delimiter.xml { color: #808080; } .monaco-editor.vs-dark .token.metatag.content.xml { color: #9CDCFE; } .monaco-editor.vs-dark .token.metatag.xml { color: #569CD6; } @@ -198,7 +194,6 @@ .monaco-editor.vs-dark .token.attribute.value.vs { color: #C4C4C4; } /* Jade */ -.monaco-editor.vs-dark .token.tag.jade { color: #569CD6; } .monaco-editor.vs-dark .token.tag.id.jade, .monaco-editor.vs-dark .token.tag.class.jade { color: #4F76AC; } .monaco-editor.vs-dark .token.interpolation.jade { color: magenta; } @@ -208,96 +203,6 @@ /* -------------------------------- End vs-dark tokens -------------------------------- */ - -/* -------------------------------- Begin hc-white tokens -------------------------------- */ -/* Tokens */ -.monaco-editor.hc-white .token { color: #000; } -.monaco-editor.hc-white .token.whitespace { color: #0000FF !important; } -.monaco-editor.hc-white .token.terminal { color: #e00000; } -.monaco-editor.hc-white .token.terminal.code1 { font-weight: bold; } -.monaco-editor.hc-white .token.variable { color: #001188; } -.monaco-editor.hc-white .token.variable.predefined { color: #4864AA; } -.monaco-editor.hc-white .token.constant { color: #dd0000; } -.monaco-editor.hc-white .token.string { color: #A31515; } -.monaco-editor.hc-white .token.string.escape { color: #A31515; } -.monaco-editor.hc-white .token.comment { color: #008000; } -.monaco-editor.hc-white .token.comment.shebang { color: #929292; } -.monaco-editor.hc-white .token.literal { color: #e00000; } -.monaco-editor.hc-white .token.literal.hex { color: #e07000; } - -.monaco-editor.hc-white .token.number { color: #000; } -.monaco-editor.hc-white .token.number.hex { color: #3030c0; } -.monaco-editor.hc-white .token.number.octal { color: #204070; } -.monaco-editor.hc-white .token.number.binary { color: #e07070; } -.monaco-editor.hc-white .token.regexp { color: #800000; } -.monaco-editor.hc-white .token.delimiter { color: #0000FF; } -.monaco-editor.hc-white .token.tag { color: #800000; } -.monaco-editor.hc-white .token.metatag { color: #e00000; } -.monaco-editor.hc-white .token.annotation { color: #cc6666; } -.monaco-editor.hc-white .token.key { color: #863B00; } -.monaco-editor.hc-white .token.attribute.name { color: #FF0000; } -.monaco-editor.hc-white .token.attribute.value { color: #0000FF; } -.monaco-editor.hc-white .token.info-token { color: #6796e6; } -.monaco-editor.hc-white .token.warn-token { color: #008000; } -.monaco-editor.hc-white .token.error-token { color: #FF0000; } -.monaco-editor.hc-white .token.debug-token { color: #b267e6; } -/* Keywords should come at the end in order to match cases like token.keyword.string */ -.monaco-editor.hc-white .token.keyword { color: #0000FF; } -.monaco-editor.hc-white .token.keyword.flow { color: #AF00DB; } - -/* PHP */ -.monaco-editor.hc-white .token.metatag.php { font-weight: bold; } - -/* Ruby */ -.monaco-editor.hc-white .token.predefined.ruby { color: #0000FF; } - -/* Markdown */ -.monaco-editor.hc-white .token.emphasis { font-style: italic;} -.monaco-editor.hc-white .token.strong { font-weight: bold; } -.monaco-editor.hc-white .token.header { color: navy ;} - -/* JSON */ -.monaco-editor.hc-white .token.string.key { color: #A31515; } -.monaco-editor.hc-white .token.string.value { color: #0451A5; } - -/* YAML */ -.monaco-editor.hc-white .token.string.yaml { color: #0451A5; } - -/* C# */ -.monaco-editor.hc-white .token.type { color: #008080; } -.monaco-editor.hc-white .token.identifier.method { color: #e07000; } - -/* SQL */ -.monaco-editor.hc-white .token.string.sql { color: #FF0000; } -.monaco-editor.hc-white .token.predefined.sql { color: #FF00FF; } -.monaco-editor.hc-white .token.operator.sql { color: #778899; } - - -/* HTML */ -.monaco-editor.hc-white .token.tag.html { color: #800000; } -.monaco-editor.hc-white .token.delimiter.html { color: #0000FF; } -.monaco-editor.hc-white .token.metatag.content.html { color: #FF0000; } -.monaco-editor.hc-white .token.metatag.html { color: #569CD6; } - -/* XML */ -.monaco-editor.hc-white .token.tag.xml { color: #800000; } -.monaco-editor.hc-white .token.delimiter.xml { color: #0000FF; } -.monaco-editor.hc-white .token.metatag.content.xml { color: #FF0000; } -.monaco-editor.hc-white .token.metatag.xml { color: #569CD6; } - -/* CSS */ -.monaco-editor.hc-white .token.attribute.name.css { color: #FF0000; } -.monaco-editor.hc-white .token.attribute.value.css { color: #0000FF; } -.monaco-editor.hc-white .token.tag.css { color: #800000; } -.monaco-editor.hc-white .token.delimiter.css { color: #000; } - -/* VSXML */ -.monaco-editor.hc-white .token.vs { color: #000; } - -/* -------------------------------- End hc-white tokens -------------------------------- */ - - - /* -------------------------------- Begin hc-black tokens -------------------------------- */ .monaco-editor.hc-black .token { color: #FFFFFF; } .monaco-editor.hc-black .token.whitespace { color: #FFFF00 !important; } @@ -307,8 +212,8 @@ .monaco-editor.hc-black .token.variable { color: #1AEBFF; } .monaco-editor.hc-black .token.variable.predefined { color: #1AEBFF; } .monaco-editor.hc-black .token.constant { color: #dd0000; } -.monaco-editor.hc-black .token.string { color: #C0C0C0; } -.monaco-editor.hc-black .token.string.escape { color: #C0C0C0; } +.monaco-editor.hc-black .token.string { color: #CE9178; } +.monaco-editor.hc-black .token.string.escape { color: #CE9178; } .monaco-editor.hc-black .token.comment { color: #008000; } .monaco-editor.hc-black .token.comment.shebang { color: #929292; } .monaco-editor.hc-black .token.comment.doc { color: #608B4E; } @@ -321,7 +226,7 @@ .monaco-editor.hc-black .token.number.binary { color: #FFFFFF; } .monaco-editor.hc-black .token.regexp { color: #C0C0C0; } .monaco-editor.hc-black .token.delimiter { color: #FFFF00; } -.monaco-editor.hc-black .token.tag { color: #FFA500; } +.monaco-editor.hc-black .token.tag { color: #569CD6; } .monaco-editor.hc-black .token.metatag { color: #569CD6; } .monaco-editor.hc-black .token.annotation { color: #569CD6; } .monaco-editor.hc-black .token.key { color: #9CDCFE; } @@ -367,13 +272,13 @@ /* HTML */ -.monaco-editor.hc-black .token.tag.html { color: #1AEBFF; } .monaco-editor.hc-black .token.delimiter.html { color: #FFFF00; } .monaco-editor.hc-black .token.metatag.content.html { color: #1AEBFF; } .monaco-editor.hc-black .token.metatag.html { color: #569CD6; } +.monaco-editor.hc-black .token.string.html { color: #CE9178; } + /* XML */ -.monaco-editor.hc-black .token.tag.xml { color: #1AEBFF; } .monaco-editor.hc-black .token.delimiter.xml { color: #FFFF00; } .monaco-editor.hc-black .token.metatag.content.xml { color: #1AEBFF; } .monaco-editor.hc-black .token.metatag.xml { color: #569CD6; } @@ -391,7 +296,7 @@ .monaco-editor.hc-black .token.attribute.value.vs { color: #C4C4C4; } /* Jade */ -.monaco-editor.hc-black .token.tag.jade { color: #569CD6; } +.monaco-editor.hc-black .token.tag.string.jade { color: #CE9178; } .monaco-editor.hc-black .token.tag.id.jade, .monaco-editor.hc-black .token.tag.class.jade { color: #4F76AC; } .monaco-editor.hc-black .token.interpolation.jade { color: magenta; } @@ -431,6 +336,8 @@ .monaco-editor.vs .token.constant.numeric.octal { color: #204070; } .monaco-editor.vs .token.constant.numeric.binary { color: #e07070; } .monaco-editor.vs .token.constant.regexp { color: #811f3f; } +.monaco-editor.vs .token.constant.rgb-value { color: #0451A5; } + /*.monaco-editor.vs .token.constant.character .monaco-editor.vs .token.constant.character.escape .monaco-editor.vs .token.constant.language.boolean @@ -443,10 +350,14 @@ .monaco-editor.vs .token.brace.curly*/ .monaco-editor.vs .token.entity { color: #A31515; } -.monaco-editor.vs .token.entity.name { color: #A31515; } -.monaco-editor.vs .token.entity.name.function { color: #000000; } -.monaco-editor.vs .token.entity.name.punctuation { color: #000000; } +.monaco-editor.vs .token.entity.name { color: #800000; } +.monaco-editor.vs .token.entity.name.tag { color: #800000; } +.monaco-editor.vs .token.entity.name.function { color: #444444; } .monaco-editor.vs .token.entity.name.class { color: #2B91AF; } +.monaco-editor.vs .token.entity.name.selector { color: #800000; } +.monaco-editor.vs .token.entity.other.selector { color: #800000; } +.monaco-editor.vs .token.entity.other.attribute-name { color: red; } +.monaco-editor.vs .token.entity.other.attribute-name.css { color: #800000; } /*.monaco-editor.vs .token.entity.name.type .monaco-editor.vs .token.entity.name.tag @@ -475,8 +386,11 @@ .monaco-editor.vs .token.markup.other*/ .monaco-editor.vs .token.meta { color: #000000; } +.monaco-editor.vs .token.meta.selector { color: #800000; } +.monaco-editor.vs .token.meta.tag { color: #800000; } -/*.monaco-editor.vs .token.storage*/ +.monaco-editor.vs .token.storage { color: gray }; +.monaco-editor.vs .token.storage.content { color: red }; .monaco-editor.vs .token.storage.type { color: #0000FF; } .monaco-editor.vs .token.storage.modifier { color: #0000FF; } .monaco-editor.vs .token.cast.storage.type, @@ -485,6 +399,7 @@ .monaco-editor.vs .token.var.annotation.storage.type { color: #2B91AF; } .monaco-editor.vs .token.string { color: #A31515; } +.monaco-editor.vs .token.string.tag { color: blue; } /*.monaco-editor.vs .token.string.quoted .monaco-editor.vs .token.string.quoted.single .monaco-editor.vs .token.string.quoted.double @@ -496,8 +411,11 @@ .monaco-editor.vs .token.string.regexp { color: #811f3f; } /*.monaco-editor.vs .token.string.other*/ -/*.monaco-editor.vs .token.support -.monaco-editor.vs .token.support.function +.monaco-editor.vs .token.support { color: #800000; } +.monaco-editor.vs .token.support.type { color: red; } +.monaco-editor.vs .token.support.type.json { color: #A31515; } +.monaco-editor.vs .token.support.property-value { color: #0451A5; } +/*.monaco-editor.vs .token.support.function .monaco-editor.vs .token.support.class .monaco-editor.vs .token.support.type .monaco-editor.vs .token.support.constant @@ -511,12 +429,19 @@ /* Keywords should come at the end in order to match cases like token.keyword.string */ .monaco-editor.vs .token.keyword { color: #0000FF; } -.monaco-editor.vs .token.keyword.control { color: #AF00DB; } +.monaco-editor.vs .token.keyword.control { color: #0000FF; } .monaco-editor.vs .token.keyword.operator { color: #666666; } .monaco-editor.vs .token.keyword.operator.new { color: #0000FF; } +.monaco-editor.vs .token.keyword.other.unit { color: #09885A; } /*.monaco-editor.vs .token.keyword.operator .monaco-editor.vs .token.keyword.other*/ +.monaco-editor.vs .token.punctuation { color: #000000; } +.monaco-editor.vs .token.punctuation.string { color: #A31515; } +.monaco-editor.vs .token.punctuation.string.quoted.variable { color: #001188; } +.monaco-editor.vs .token.punctuation.string.regexp { color: #811f3f; } +.monaco-editor.vs .token.punctuation.tag { color: #800000; } +.monaco-editor.vs .token.punctuation.string.tag { color: blue; } /* -------------------------------- Begin vs-dark tokens -------------------------------- */ .monaco-editor.vs-dark .token { color: #D4D4D4; } @@ -540,7 +465,8 @@ .monaco-editor.vs-dark .token.constant.numeric.hex { color: #5BB498; } .monaco-editor.vs-dark .token.constant.numeric.octal { color: #204070; } .monaco-editor.vs-dark .token.constant.numeric.binary { color: #e07070; } -.monaco-editor.vs-dark .token.constant.regexp { color: #B46695; } +.monaco-editor.vs-dark .token.constant.regexp { color: #646695; } +.monaco-editor.vs-dark .token.constant.rgb-value { color: #D4D4D4; } /*.monaco-editor.vs-dark .token.constant.character .monaco-editor.vs-dark .token.constant.character.escape .monaco-editor.vs-dark .token.constant.language.boolean @@ -553,10 +479,15 @@ .monaco-editor.vs-dark .token.brace.curly*/ .monaco-editor.vs-dark .token.entity { color: #9CDCFE; } -.monaco-editor.vs-dark .token.entity.name { color: #9CDCFE; } -.monaco-editor.vs-dark .token.entity.name.function { color: #DCDCDC; } -.monaco-editor.vs-dark .token.entity.name.punctuation { color: #DCDCDC; } +.monaco-editor.vs-dark .token.entity.name { color: #569CD6; } +.monaco-editor.vs-dark .token.entity.name.tag { color: #569CD6; } +.monaco-editor.vs-dark .token.entity.name.function { color: #DCDCAA; } .monaco-editor.vs-dark .token.entity.name.class { color: #4EC9B0; } +.monaco-editor.vs-dark .token.entity.name.selector { color: #569CD6; } + +.monaco-editor.vs-dark .token.entity.other.selector { color: #569CD6; } +.monaco-editor.vs-dark .token.entity.other.attribute-name { color: #9CDCFE; } +.monaco-editor.vs-dark .token.entity.other.attribute-name.css { color: #569CD6; } /* .monaco-editor.vs-dark .token.entity.name.type .monaco-editor.vs-dark .token.entity.name.tag @@ -583,8 +514,11 @@ .monaco-editor.vs-dark .token.markup.other*/ .monaco-editor.vs-dark .token.meta { color: #D4D4D4; } +.monaco-editor.vs-dark .token.meta.selector { color: #569CD6; } +.monaco-editor.vs-dark .token.meta.tag { color: #CE9178; } -/*.monaco-editor.vs-dark .token.storage*/ +.monaco-editor.vs-dark .token.storage { color: #569CD6 }; +.monaco-editor.vs-dark .token.storage.content { color: #9CDCFE }; .monaco-editor.vs-dark .token.storage.type { color: #569CD6; } .monaco-editor.vs-dark .token.storage.modifier { color: #569CD6; } .monaco-editor.vs-dark .token.annotation.storage.type, @@ -595,6 +529,7 @@ .monaco-editor.vs-dark .token.var.annotation.storage.type { color: #4EC9B0; } .monaco-editor.vs-dark .token.string { color: #CE9178; } +.monaco-editor.vs-dark .token.string.tag { color: #CE9178; } /*.monaco-editor.vs-dark .token.string.quoted .monaco-editor.vs-dark .token.string.quoted.single .monaco-editor.vs-dark .token.string.quoted.double @@ -606,10 +541,11 @@ .monaco-editor.vs-dark .token.string.regexp { color: #D16969; } /*.monaco-editor.vs-dark .token.string.other*/ -/*.monaco-editor.vs-dark .token.support -.monaco-editor.vs-dark .token.support.function +.monaco-editor.vs-dark .token.support { color: #A79873; } +.monaco-editor.vs-dark .token.support.type { color: #9CDCFE; } +.monaco-editor.vs-dark .token.support.property-value { color: #CE9178; } +/*.monaco-editor.vs-dark .token.support.function .monaco-editor.vs-dark .token.support.class -.monaco-editor.vs-dark .token.support.type .monaco-editor.vs-dark .token.support.constant .monaco-editor.vs-dark .token.support.variable .monaco-editor.vs-dark .token.support.other*/ @@ -621,12 +557,20 @@ /* Keywords should come at the end in order to match cases like token.keyword.string */ .monaco-editor.vs-dark .token.keyword { color: #569CD6; } -.monaco-editor.vs-dark .token.keyword.control { color: #C586C0; } +.monaco-editor.vs-dark .token.keyword.control { color: #569CD6; } .monaco-editor.vs-dark .token.keyword.operator { color: #909090; } .monaco-editor.vs-dark .token.keyword.operator.new { color: #569CD6; } +.monaco-editor.vs-dark .token.keyword.other.unit { color: #B5CEA8; } /*.monaco-editor.vs-dark .token.keyword.operator .monaco-editor.vs-dark .token.keyword.other*/ +.monaco-editor.vs-dark .token.punctuation { color: #DCDCDC; } +.monaco-editor.vs-dark .token.punctuation.string { color: #CE9178; } +.monaco-editor.vs-dark .token.punctuation.string.quoted.variable { color: #74B0DF; } +.monaco-editor.vs-dark .token.punctuation.string.regexp { color: #D16969; } +.monaco-editor.vs-dark .token.punctuation.tag { color: #569CD6; } +.monaco-editor.vs-dark .token.punctuation.string.tag { color: #CE9178; } + /* -------------------------------- End vs-dark tokens -------------------------------- */ @@ -654,6 +598,7 @@ .monaco-editor.hc-black .token.constant.numeric.octal { color: #204070; } .monaco-editor.hc-black .token.constant.numeric.binary { color: #e07070; } .monaco-editor.hc-black .token.constant.regexp { color: #B46695; } +.monaco-editor.hc-black .token.constant.rgb-value { color: #D4D4D4; } /*.monaco-editor.hc-black .token.constant.character .monaco-editor.hc-black .token.constant.character.escape .monaco-editor.hc-black .token.constant.language.boolean @@ -666,10 +611,14 @@ .monaco-editor.hc-black .token.brace.curly*/ .monaco-editor.hc-black .token.entity { color: #9CDCFE; } -.monaco-editor.hc-black .token.entity.name { color: #9CDCFE; } -.monaco-editor.hc-black .token.entity.name.function { color: #DCDCDC; } -.monaco-editor.hc-black .token.entity.name.punctuation { color: #DCDCDC; } +.monaco-editor.hc-black .token.entity.name { color: #569CD6; } +.monaco-editor.hc-black .token.entity.name.tag { color: #569CD6; } +.monaco-editor.hc-black .token.entity.name.function { color: #DCDCAA; } .monaco-editor.hc-black .token.entity.name.class { color: #4EC9B0; } +.monaco-editor.hc-black .token.entity.name.selector { color: #569CD6; } +.monaco-editor.hc-black .token.entity.other.selector { color: #569CD6; } +.monaco-editor.hc-black .token.entity.other.attribute-name { color: #9CDCFE; } +.monaco-editor.hc-black .token.entity.other.attribute-name.css { color: #569CD6; } /* .monaco-editor.hc-black .token.entity.name.type .monaco-editor.hc-black .token.entity.name.tag @@ -696,8 +645,11 @@ .monaco-editor.hc-black .token.markup.other*/ .monaco-editor.hc-black .token.meta { color: #D4D4D4; } +.monaco-editor.hc-black .token.meta.selector { color: #569CD6; } +.monaco-editor.hc-black .token.meta.tag { color: #CE9178; } -/*.monaco-editor.hc-black .token.storage*/ +.monaco-editor.hc-black .token.storage { color: #569CD6 }; +.monaco-editor.hc-black .token.storage.content { color: #9CDCFE }; .monaco-editor.hc-black .token.storage.type { color: #569CD6; } .monaco-editor.hc-black .token.storage.modifier { color: #569CD6; } .monaco-editor.hc-black .token.annotation.storage.type, @@ -708,6 +660,7 @@ .monaco-editor.hc-black .token.var.annotation.storage.type { color: #4EC9B0; } .monaco-editor.hc-black .token.string { color: #CE9178; } +.monaco-editor.hc-black .token.string.tag { color: #CE9178; } /*.monaco-editor.hc-black .token.string.quoted .monaco-editor.hc-black .token.string.quoted.single .monaco-editor.hc-black .token.string.quoted.double @@ -719,26 +672,35 @@ .monaco-editor.hc-black .token.string.regexp { color: #D16969; } /*.monaco-editor.hc-black .token.string.other*/ -/*.monaco-editor.hc-black .token.support -.monaco-editor.hc-black .token.support.function +.monaco-editor.hc-black .token.support { color: #800000; } +.monaco-editor.hc-black .token.support.type { color: #9CDCFE; } +.monaco-editor.hc-black .token.support.property-value { color: #CE9178; } +/*.monaco-editor.hc-black .token.support.function .monaco-editor.hc-black .token.support.class -.monaco-editor.hc-black .token.support.type .monaco-editor.hc-black .token.support.constant .monaco-editor.hc-black .token.support.variable .monaco-editor.hc-black .token.support.other*/ .monaco-editor.hc-black .token.variable.parameter { color: #9CDCFE; } /*.monaco-editor.hc-black .token.variable*/ -.monaco-editor.vs-dark .token.variable.language { color: #4864AA; } +.monaco-editor.hc-black .token.variable.language { color: #4864AA; } /*.monaco-editor.hc-black .token.variable.other*/ /* Keywords should come at the end in order to match cases like token.keyword.string */ .monaco-editor.hc-black .token.keyword { color: #569CD6; } -.monaco-editor.hc-black .token.keyword.control { color: #C586C0; } +.monaco-editor.hc-black .token.keyword.control { color: #569CD6; } .monaco-editor.hc-black .token.keyword.operator { color: #909090; } .monaco-editor.hc-black .token.keyword.operator.new { color: #569CD6; } +.monaco-editor.hc-black .token.keyword.other.unit { color: #B5CEA8; } /*.monaco-editor.hc-black .token.keyword.operator .monaco-editor.hc-black .token.keyword.other*/ +.monaco-editor.hc-black .token.punctuation { color: #DCDCDC; } +.monaco-editor.hc-black .token.punctuation.string { color: #CE9178; } +.monaco-editor.hc-black .token.punctuation.string.quoted.variable { color: #74B0DF; } +.monaco-editor.hc-black .token.punctuation.string.regexp { color: #D16969; } +.monaco-editor.hc-black .token.punctuation.tag { color: #569CD6; } +.monaco-editor.hc-black .token.punctuation.string.tag { color: #CE9178; } + /* -------------------------------- End hc-black tokens ----------------------------- */ \ No newline at end of file diff --git a/src/vs/languages/markdown/test/common/markdown.test.ts b/src/vs/languages/markdown/test/common/markdown.test.ts index 8590b5ba4e3..43c4e3eb00e 100644 --- a/src/vs/languages/markdown/test/common/markdown.test.ts +++ b/src/vs/languages/markdown/test/common/markdown.test.ts @@ -10,6 +10,7 @@ import markdownMode = require('vs/languages/markdown/common/markdown'); import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); import {htmlTokenTypes} from 'vs/languages/html/common/html'; +import {cssTokenTypes} from 'vs/languages/css/common/css'; suite('Markdown - tokenization', () => { @@ -56,14 +57,14 @@ suite('Markdown - tokenization', () => { line: '*bar*', tokens: [ { startIndex:0, type: htmlTokenTypes.getTag('style.md'), bracket: Modes.Bracket.Open }, - { startIndex:7, type: 'entity.name.tag.css' }, + { startIndex:7, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.css' }, { startIndex:10, type: '' }, { startIndex:11, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Open }, { startIndex:12, type: '' }, - { startIndex:13, type: 'support.type.property-name.css' }, + { startIndex:13, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:23, type: 'punctuation.css' }, { startIndex:24, type: '' }, - { startIndex:25, type: 'meta.property-value.css' }, + { startIndex:25, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:28, type: '' }, { startIndex:29, type: 'punctuation.bracket.css', bracket: Modes.Bracket.Close }, { startIndex:30, type: htmlTokenTypes.getTag('style.md'), bracket: Modes.Bracket.Close }, diff --git a/src/vs/languages/php/test/common/php.test.ts b/src/vs/languages/php/test/common/php.test.ts index 2a78b5a1bd4..2376fb53c81 100644 --- a/src/vs/languages/php/test/common/php.test.ts +++ b/src/vs/languages/php/test/common/php.test.ts @@ -14,6 +14,7 @@ import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); import modesUtil = require('vs/editor/test/common/modesUtil'); import {htmlTokenTypes} from 'vs/languages/html/common/html'; +import {cssTokenTypes} from 'vs/languages/css/common/css'; suite('Syntax Highlighting - PHP', () => { @@ -1767,9 +1768,9 @@ suite('Syntax Highlighting - PHP', () => { { startIndex:15, type: 'metatag.php' }, { startIndex:17, type: 'punctuation.bracket.css' }, { startIndex:18, type: '' }, - { startIndex:19, type: 'support.type.property-name.css' }, + { startIndex:19, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:24, type: 'punctuation.css' }, - { startIndex:25, type: 'meta.property-value.css' }, + { startIndex:25, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:29, type: 'punctuation.css' }, { startIndex:30, type: '' }, { startIndex:31, type: 'punctuation.bracket.css' }, @@ -1787,9 +1788,9 @@ suite('Syntax Highlighting - PHP', () => { { startIndex:15, type: 'metatag.php' }, { startIndex:17, type: 'punctuation.bracket.css' }, { startIndex:18, type: '' }, - { startIndex:19, type: 'support.type.property-name.css' }, + { startIndex:19, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:24, type: 'punctuation.css' }, - { startIndex:25, type: 'meta.property-value.css' }, + { startIndex:25, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:29, type: 'punctuation.css' }, { startIndex:30, type: '' }, { startIndex:31, type: 'punctuation.bracket.css' }, @@ -1814,9 +1815,9 @@ suite('Syntax Highlighting - PHP', () => { { startIndex:23, type: '' }, { startIndex:24, type: 'punctuation.bracket.css' }, { startIndex:25, type: '' }, - { startIndex:26, type: 'support.type.property-name.css' }, + { startIndex:26, type: cssTokenTypes.TOKEN_PROPERTY + '.css' }, { startIndex:31, type: 'punctuation.css' }, - { startIndex:32, type: 'meta.property-value.css' }, + { startIndex:32, type: cssTokenTypes.TOKEN_VALUE + '.css' }, { startIndex:36, type: 'punctuation.css' }, { startIndex:37, type: '' }, { startIndex:38, type: 'punctuation.bracket.css' }, diff --git a/src/vs/languages/sass/common/sass.ts b/src/vs/languages/sass/common/sass.ts index 1a23c29aca4..eda8f9169f9 100644 --- a/src/vs/languages/sass/common/sass.ts +++ b/src/vs/languages/sass/common/sass.ts @@ -8,11 +8,12 @@ import Monarch = require('vs/editor/common/modes/monarch/monarch'); import Types = require('vs/editor/common/modes/monarch/monarchTypes'); import Compile = require('vs/editor/common/modes/monarch/monarchCompile'); import winjs = require('vs/base/common/winjs.base'); -import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); import sassWorker = require('vs/languages/sass/common/sassWorker'); import supports = require('vs/editor/common/modes/supports'); +import {cssTokenTypes} from 'vs/languages/css/common/css'; import {AbstractMode} from 'vs/editor/common/modes/abstractMode'; import {OneWorkerAttr} from 'vs/platform/thread/common/threadService'; import {AsyncDescriptor2, createAsyncDescriptor2} from 'vs/platform/instantiation/common/descriptors'; @@ -47,9 +48,9 @@ export var language = { tokenizer: { root: [ { include: '@selector' }, - ['[@](charset|namespace)', { token: 'keyword.control.at-rule', next: '@declarationbody'}], - ['[@](function)', { token: 'keyword.control.at-rule', next: '@functiondeclaration'}], - ['[@](mixin)', { token: 'keyword.control.at-rule', next: '@mixindeclaration'}], + ['[@](charset|namespace)', { token: cssTokenTypes.TOKEN_AT_KEYWORD, next: '@declarationbody'}], + ['[@](function)', { token: cssTokenTypes.TOKEN_AT_KEYWORD, next: '@functiondeclaration'}], + ['[@](mixin)', { token: cssTokenTypes.TOKEN_AT_KEYWORD, next: '@mixindeclaration'}], ], selector: [ @@ -57,29 +58,29 @@ export var language = { { include: '@import' }, { include: '@variabledeclaration' }, { include: '@warndebug' }, // sass: log statements - ['[@](include)', { token: 'keyword.control.at-rule', next: '@includedeclaration'}], // sass: include statement - ['[@](keyframes|-webkit-keyframes|-moz-keyframes|-o-keyframes)', { token: 'keyword.control.at-rule', next: '@keyframedeclaration'}], - ['[@](page|content|font-face|-moz-document)', { token: 'keyword.control.at-rule'}], // sass: placeholder for includes + ['[@](include)', { token: cssTokenTypes.TOKEN_AT_KEYWORD, next: '@includedeclaration'}], // sass: include statement + ['[@](keyframes|-webkit-keyframes|-moz-keyframes|-o-keyframes)', { token: cssTokenTypes.TOKEN_AT_KEYWORD, next: '@keyframedeclaration'}], + ['[@](page|content|font-face|-moz-document)', { token: cssTokenTypes.TOKEN_AT_KEYWORD}], // sass: placeholder for includes ['url(\\-prefix)?\\(', { token: 'support.function.name', bracket: '@open', next: '@urldeclaration'}], { include: '@controlstatement' }, // sass control statements { include: '@selectorname' }, - ['[&\\*]', 'entity.name.tag'], // selector symbols + ['[&\\*]', cssTokenTypes.TOKEN_SELECTOR_TAG], // selector symbols ['[>\\+,]', 'punctuation'], // selector operators ['\\[', { token: 'punctuation.bracket', bracket: '@open', next: '@selectorattribute' }], ['{', { token: 'punctuation.curly', bracket: '@open', next: '@selectorbody' }], ], selectorbody: [ - ['[*_]?@identifier@ws:(?=(\\s|\\d|[^{;}]*[;}]))', 'support.type.property-name', '@rulevalue'], // rule definition: to distinguish from a nested selector check for whitespace, number or a semicolon + ['[*_]?@identifier@ws:(?=(\\s|\\d|[^{;}]*[;}]))', cssTokenTypes.TOKEN_PROPERTY, '@rulevalue'], // rule definition: to distinguish from a nested selector check for whitespace, number or a semicolon { include: '@selector'}, // sass: nested selectors - ['[@](extend)', { token: 'keyword.control.at-rule', next: '@extendbody'}], // sass: extend other selectors - ['[@](return)', { token: 'keyword.control.at-rule', next: '@declarationbody'}], + ['[@](extend)', { token: cssTokenTypes.TOKEN_AT_KEYWORD, next: '@extendbody'}], // sass: extend other selectors + ['[@](return)', { token: cssTokenTypes.TOKEN_AT_KEYWORD, next: '@declarationbody'}], ['}', { token: 'punctuation.curly', bracket: '@close', next: '@pop'}], ], selectorname: [ ['#{', { token: 'support.function.interpolation', bracket: '@open', next: '@variableinterpolation' }], // sass: interpolation - ['(\\.|#(?=[^{])|%|(@identifier)|:)+', 'entity.other.attribute-name'], // selector (.foo, div, ...) + ['(\\.|#(?=[^{])|%|(@identifier)|:)+', cssTokenTypes.TOKEN_SELECTOR], // selector (.foo, div, ...) ], selectorattribute: [ @@ -111,17 +112,17 @@ export var language = { ], nestedproperty: [ - ['[*_]?@identifier@ws:', 'support.type.property-name', '@rulevalue'], + ['[*_]?@identifier@ws:', cssTokenTypes.TOKEN_PROPERTY, '@rulevalue'], { include: '@comments' }, ['}', { token: 'punctuation.curly', bracket: '@close', next: '@pop'}], ], warndebug: [ - ['[@](warn|debug)', { token: 'keyword.control.at-rule', next: '@declarationbody'}], + ['[@](warn|debug)', { token: cssTokenTypes.TOKEN_AT_KEYWORD, next: '@declarationbody'}], ], import: [ - ['[@](import)', { token: 'keyword.control.at-rule', next: '@declarationbody'}], + ['[@](import)', { token: cssTokenTypes.TOKEN_AT_KEYWORD, next: '@declarationbody'}], ], variabledeclaration: [ // sass variables @@ -174,7 +175,7 @@ export var language = { ], name: [ - ['@identifier', 'meta.property-value'], + ['@identifier', cssTokenTypes.TOKEN_VALUE], ], numbers: [ @@ -200,7 +201,7 @@ export var language = { ], parameterdeclaration: [ - ['\\$@identifier@ws:', 'support.type.property-name'], + ['\\$@identifier@ws:', cssTokenTypes.TOKEN_PROPERTY], ['\\.\\.\\.', 'keyword.operator'], // var args in declaration [',', 'punctuation'], { include: '@term' }, @@ -237,7 +238,7 @@ export var language = { ], functionbody: [ - ['[@](return)', { token: 'keyword.control.at-rule'}], + ['[@](return)', { token: cssTokenTypes.TOKEN_AT_KEYWORD}], { include: '@variabledeclaration' }, { include: '@term' }, { include: '@controlstatement' }, @@ -250,7 +251,7 @@ export var language = { ], functionarguments: [ - ['\\$@identifier@ws:', 'support.type.property-name'], + ['\\$@identifier@ws:', cssTokenTypes.TOKEN_PROPERTY], ['[,]', 'punctuation'], { include: '@term' }, ['\\)', { token: 'support.function.name', bracket: '@close', next: '@pop'}], @@ -299,11 +300,11 @@ export class SASSMode extends Monarch.MonarchMode impleme this.extraInfoSupport = this; this.referenceSupport = new supports.ReferenceSupport(this, { - tokens: ['support.type.property-name.sass', 'meta.property-value.sass', 'variable.decl.sass', 'variable.ref.sass', 'support.function.name.sass', 'support.type.property-name.sass', 'entity.other.attribute-name.sass'], + tokens: [cssTokenTypes.TOKEN_PROPERTY + '.sass', cssTokenTypes.TOKEN_VALUE + '.sass', 'variable.decl.sass', 'variable.ref.sass', 'support.function.name.sass', cssTokenTypes.TOKEN_PROPERTY + '.sass', cssTokenTypes.TOKEN_SELECTOR + '.sass'], findReferences: (resource, position, /*unused*/includeDeclaration) => this.findReferences(resource, position)}); this.logicalSelectionSupport = this; this.declarationSupport = new supports.DeclarationSupport(this, { - tokens: ['variable.decl.sass', 'variable.ref.sass', 'support.function.name.sass', 'support.type.property-name.sass', 'entity.other.attribute-name.sass'], + tokens: ['variable.decl.sass', 'variable.ref.sass', 'support.function.name.sass', cssTokenTypes.TOKEN_PROPERTY + '.sass', cssTokenTypes.TOKEN_SELECTOR + '.sass'], findDeclaration: (resource, position) => this.findDeclaration(resource, position)}); this.outlineSupport = this; @@ -327,32 +328,32 @@ export class SASSMode extends Monarch.MonarchMode impleme } static $findReferences = OneWorkerAttr(SASSMode, SASSMode.prototype.findReferences); - public findReferences(resource:Network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public findReferences(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this._worker((w) => w.findReferences(resource, position)); } static $getRangesToPosition = OneWorkerAttr(SASSMode, SASSMode.prototype.getRangesToPosition); - public getRangesToPosition(resource:Network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public getRangesToPosition(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this._worker((w) => w.getRangesToPosition(resource, position)); } static $computeInfo = OneWorkerAttr(SASSMode, SASSMode.prototype.computeInfo); - public computeInfo(resource:Network.URL, position:EditorCommon.IPosition): winjs.TPromise { + public computeInfo(resource:URI, position:EditorCommon.IPosition): winjs.TPromise { return this._worker((w) => w.computeInfo(resource, position)); } static $getOutline = OneWorkerAttr(SASSMode, SASSMode.prototype.getOutline); - public getOutline(resource:Network.URL):winjs.TPromise { + public getOutline(resource:URI):winjs.TPromise { return this._worker((w) => w.getOutline(resource)); } static $findDeclaration = OneWorkerAttr(SASSMode, SASSMode.prototype.findDeclaration); - public findDeclaration(resource:Network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public findDeclaration(resource:URI, position:EditorCommon.IPosition):winjs.TPromise { return this._worker((w) => w.findDeclaration(resource, position)); } static $findColorDeclarations = OneWorkerAttr(SASSMode, SASSMode.prototype.findColorDeclarations); - public findColorDeclarations(resource:Network.URL):winjs.TPromise<{range:EditorCommon.IRange; value:string; }[]> { + public findColorDeclarations(resource:URI):winjs.TPromise<{range:EditorCommon.IRange; value:string; }[]> { return this._worker((w) => w.findColorDeclarations(resource)); } } \ No newline at end of file diff --git a/src/vs/languages/sass/common/services/intelliSense.ts b/src/vs/languages/sass/common/services/intelliSense.ts index f0e4bb82118..77d7929a549 100644 --- a/src/vs/languages/sass/common/services/intelliSense.ts +++ b/src/vs/languages/sass/common/services/intelliSense.ts @@ -148,9 +148,9 @@ export class SASSIntellisense extends cssIntellisense.CSSIntellisense { return super.getColorProposals(entry, result); } - public getCompletionsForDeclarations(declarations: nodes.Declarations, result: Modes.ISuggestion[]): Modes.ISuggestion[]{ + public getCompletionsForDeclarationProperty(result: Modes.ISuggestion[]): Modes.ISuggestion[]{ this.getCompletionsForSelector(null, result); - return super.getCompletionsForDeclarations(declarations, result); + return super.getCompletionsForDeclarationProperty(result); } } diff --git a/src/vs/languages/sass/test/common/sass-worker.test.ts b/src/vs/languages/sass/test/common/sass-worker.test.ts index e274a6a1030..6e620edaa7a 100644 --- a/src/vs/languages/sass/test/common/sass-worker.test.ts +++ b/src/vs/languages/sass/test/common/sass-worker.test.ts @@ -7,7 +7,7 @@ import assert = require('assert'); import mm = require('vs/editor/common/model/mirrorModel'); import sassWorker = require('vs/languages/sass/common/sassWorker'); -import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import ResourceService = require('vs/editor/common/services/resourceServiceImpl'); import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); @@ -17,7 +17,7 @@ import modesUtil = require('vs/editor/test/common/modesTestUtils'); suite('SASS - Worker', () => { - var mockSASSWorkerEnv = function (url:Network.URL, content: string) : { worker: sassWorker.SassWorker; model: mm.MirrorModel } { + var mockSASSWorkerEnv = function (url:URI, content: string) : { worker: sassWorker.SassWorker; model: mm.MirrorModel } { var resourceService = new ResourceService.ResourceService(); var model = mm.createMirrorModelFromString(null, 0, content, modesUtil.createMockMode('mock.mode.id', /(#?-?\d*\.\d\w*%?)|([$@#!]?[\w-?]+%?)|[$@#!]/g), url); resourceService.insert(url, model); @@ -30,8 +30,8 @@ suite('SASS - Worker', () => { return { worker: worker, model: model }; }; - var testSuggestionsFor = function(value:string, stringBefore:string):WinJS.TPromise { - var url = new Network.URL('test://1'); + var testSuggestionsFor = function(value:string, stringBefore:string):WinJS.TPromise { + var url = URI.parse('test://1'); var env = mockSASSWorkerEnv(url, value); var idx = stringBefore ? value.indexOf(stringBefore) + stringBefore.length : 0; @@ -40,7 +40,7 @@ suite('SASS - Worker', () => { }; var testValueSetFor = function(value:string, selection:string, selectionLength: number, up: boolean):WinJS.TPromise { - var url = new Network.URL('test://1'); + var url = URI.parse('test://1'); var env = mockSASSWorkerEnv(url, value); var pos = env.model.getPositionFromOffset(value.indexOf(selection)); @@ -50,7 +50,7 @@ suite('SASS - Worker', () => { }; var testOccurrences = function(value:string, tokenBefore:string):WinJS.TPromise<{ occurrences: Modes.IOccurence[]; model: mm.MirrorModel }> { - var url = new Network.URL('test://1'); + var url = URI.parse('test://1'); var env = mockSASSWorkerEnv(url, value); var pos = env.model.getPositionFromOffset(value.indexOf(tokenBefore) + tokenBefore.length); @@ -58,7 +58,7 @@ suite('SASS - Worker', () => { return env.worker.findOccurrences(url, pos).then((occurrences) => { return { occurrences: occurrences, model: env.model}; }); }; - var assertSuggestion= function(completion:Modes.ISuggestions, label:string, type?:string) { + var assertSuggestion= function(completion:Modes.ISuggestResult, label:string, type?:string) { var proposalsFound = completion.suggestions.filter(function(suggestion: Modes.ISuggestion) { return suggestion.label === label && (!type || suggestion.type === type); }); @@ -112,6 +112,11 @@ suite('SASS - Worker', () => { testSuggestionsFor('.foo { .', '{ .').then((completion) => { assert.equal(completion.currentWord, ''); assertSuggestion(completion, '.foo'); + }), + // issue #250 + testSuggestionsFor('.foo { display: block;', 'block;').then((completion) => { + assert.equal(completion.currentWord, ''); + assert.equal(0, completion.suggestions.length); }) ]).done(() => testDone(), (errors:any[]) => { testDone(errors.reduce((e1, e2) => e1 || e2)); diff --git a/src/vs/languages/sass/test/common/sass.test.ts b/src/vs/languages/sass/test/common/sass.test.ts index da9645d70c4..f0daeda289d 100644 --- a/src/vs/languages/sass/test/common/sass.test.ts +++ b/src/vs/languages/sass/test/common/sass.test.ts @@ -8,6 +8,7 @@ import 'vs/languages/sass/common/sass.contribution'; import SASS = require('vs/languages/sass/common/sass'); import modesUtil = require('vs/editor/test/common/modesUtil'); import Modes = require('vs/editor/common/modes'); +import {cssTokenTypes} from 'vs/languages/css/common/css'; suite('Sass Colorizer', () => { @@ -28,45 +29,45 @@ suite('Sass Colorizer', () => { [{ line: '#main {\n width: 97%;\n p, div {\n font-size: 2em;\n a { font-weight: bold; }\n }\n pre { font-size: 3em; }\n}', tokens: [ - { startIndex: 0, type: 'entity.other.attribute-name.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 5, type: '' }, { startIndex: 6, type: 'punctuation.curly.sass' }, { startIndex: 7, type: '' }, - { startIndex: 10, type: 'support.type.property-name.sass' }, + { startIndex: 10, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 16, type: '' }, { startIndex: 17, type: 'constant.numeric.sass' }, { startIndex: 20, type: 'punctuation.sass' }, { startIndex: 21, type: '' }, - { startIndex: 24, type: 'entity.other.attribute-name.sass' }, + { startIndex: 24, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 25, type: 'punctuation.sass' }, { startIndex: 26, type: '' }, - { startIndex: 27, type: 'entity.other.attribute-name.sass' }, + { startIndex: 27, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 30, type: '' }, { startIndex: 31, type: 'punctuation.curly.sass' }, { startIndex: 32, type: '' }, - { startIndex: 37, type: 'support.type.property-name.sass' }, + { startIndex: 37, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 47, type: '' }, { startIndex: 48, type: 'constant.numeric.sass' }, { startIndex: 51, type: 'punctuation.sass' }, { startIndex: 52, type: '' }, - { startIndex: 57, type: 'entity.other.attribute-name.sass' }, + { startIndex: 57, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 58, type: '' }, { startIndex: 59, type: 'punctuation.curly.sass' }, { startIndex: 60, type: '' }, - { startIndex: 61, type: 'support.type.property-name.sass' }, + { startIndex: 61, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 73, type: '' }, - { startIndex: 74, type: 'meta.property-value.sass' }, + { startIndex: 74, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 78, type: 'punctuation.sass' }, { startIndex: 79, type: '' }, { startIndex: 80, type: 'punctuation.curly.sass' }, { startIndex: 81, type: '' }, { startIndex: 84, type: 'punctuation.curly.sass' }, { startIndex: 85, type: '' }, - { startIndex: 88, type: 'entity.other.attribute-name.sass' }, + { startIndex: 88, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 91, type: '' }, { startIndex: 92, type: 'punctuation.curly.sass' }, { startIndex: 93, type: '' }, - { startIndex: 94, type: 'support.type.property-name.sass' }, + { startIndex: 94, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 104, type: '' }, { startIndex: 105, type: 'constant.numeric.sass' }, { startIndex: 108, type: 'punctuation.sass' }, @@ -80,32 +81,32 @@ suite('Sass Colorizer', () => { [{ line: '#main {\n color: black;\n a {\n font-weight: bold;\n &:hover { color: red; }\n }\n}', tokens: [ - { startIndex: 0, type: 'entity.other.attribute-name.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 5, type: '' }, { startIndex: 6, type: 'punctuation.curly.sass' }, { startIndex: 7, type: '' }, - { startIndex: 10, type: 'support.type.property-name.sass' }, + { startIndex: 10, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 16, type: '' }, - { startIndex: 17, type: 'meta.property-value.sass' }, + { startIndex: 17, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 22, type: 'punctuation.sass' }, { startIndex: 23, type: '' }, - { startIndex: 26, type: 'entity.other.attribute-name.sass' }, + { startIndex: 26, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 27, type: '' }, { startIndex: 28, type: 'punctuation.curly.sass' }, { startIndex: 29, type: '' }, - { startIndex: 34, type: 'support.type.property-name.sass' }, + { startIndex: 34, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 46, type: '' }, - { startIndex: 47, type: 'meta.property-value.sass' }, + { startIndex: 47, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 51, type: 'punctuation.sass' }, { startIndex: 52, type: '' }, - { startIndex: 57, type: 'entity.name.tag.sass' }, - { startIndex: 58, type: 'entity.other.attribute-name.sass' }, + { startIndex: 57, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.sass' }, + { startIndex: 58, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 64, type: '' }, { startIndex: 65, type: 'punctuation.curly.sass' }, { startIndex: 66, type: '' }, - { startIndex: 67, type: 'support.type.property-name.sass' }, + { startIndex: 67, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 73, type: '' }, - { startIndex: 74, type: 'meta.property-value.sass' }, + { startIndex: 74, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 77, type: 'punctuation.sass' }, { startIndex: 78, type: '' }, { startIndex: 79, type: 'punctuation.curly.sass' }, @@ -119,11 +120,11 @@ suite('Sass Colorizer', () => { [{ line: '.funky {\n font: 2px/3px {\n family: fantasy;\n size: 30em;\n weight: bold;\n }\n color: black;\n}', tokens: [ - { startIndex: 0, type: 'entity.other.attribute-name.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 6, type: '' }, { startIndex: 7, type: 'punctuation.curly.sass' }, { startIndex: 8, type: '' }, - { startIndex: 11, type: 'support.type.property-name.sass' }, + { startIndex: 11, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 16, type: '' }, { startIndex: 17, type: 'constant.numeric.sass' }, { startIndex: 20, type: 'keyword.operator.sass' }, @@ -131,26 +132,26 @@ suite('Sass Colorizer', () => { { startIndex: 24, type: '' }, { startIndex: 25, type: 'punctuation.curly.sass' }, { startIndex: 26, type: '' }, - { startIndex: 31, type: 'support.type.property-name.sass' }, + { startIndex: 31, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 38, type: '' }, - { startIndex: 39, type: 'meta.property-value.sass' }, + { startIndex: 39, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 46, type: 'punctuation.sass' }, { startIndex: 47, type: '' }, - { startIndex: 52, type: 'support.type.property-name.sass' }, + { startIndex: 52, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 57, type: '' }, { startIndex: 58, type: 'constant.numeric.sass' }, { startIndex: 62, type: 'punctuation.sass' }, { startIndex: 63, type: '' }, - { startIndex: 68, type: 'support.type.property-name.sass' }, + { startIndex: 68, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 75, type: '' }, - { startIndex: 76, type: 'meta.property-value.sass' }, + { startIndex: 76, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 80, type: 'punctuation.sass' }, { startIndex: 81, type: '' }, { startIndex: 84, type: 'punctuation.curly.sass' }, { startIndex: 85, type: '' }, - { startIndex: 88, type: 'support.type.property-name.sass' }, + { startIndex: 88, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 94, type: '' }, - { startIndex: 95, type: 'meta.property-value.sass' }, + { startIndex: 95, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 100, type: 'punctuation.sass' }, { startIndex: 101, type: '' }, { startIndex: 102, type: 'punctuation.curly.sass' } @@ -160,57 +161,57 @@ suite('Sass Colorizer', () => { [{ line: 'tr.default {\n foo: { // properties\n foo : 1;\n }\n foo: 1px; // rule\n foo.bar { // selector\n foo : 1;\n }\n foo:bar { // selector\n foo : 1;\n }\n foo: 1px; // rule\n}', tokens: [ - { startIndex: 0, type: 'entity.other.attribute-name.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 10, type: '' }, { startIndex: 11, type: 'punctuation.curly.sass' }, { startIndex: 12, type: '' }, - { startIndex: 15, type: 'support.type.property-name.sass' }, + { startIndex: 15, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 19, type: '' }, { startIndex: 20, type: 'punctuation.curly.sass' }, { startIndex: 21, type: '' }, { startIndex: 22, type: 'comment.sass' }, { startIndex: 35, type: '' }, - { startIndex: 40, type: 'support.type.property-name.sass' }, + { startIndex: 40, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 45, type: '' }, { startIndex: 46, type: 'constant.numeric.sass' }, { startIndex: 47, type: 'punctuation.sass' }, { startIndex: 48, type: '' }, { startIndex: 51, type: 'punctuation.curly.sass' }, { startIndex: 52, type: '' }, - { startIndex: 55, type: 'support.type.property-name.sass' }, + { startIndex: 55, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 59, type: '' }, { startIndex: 60, type: 'constant.numeric.sass' }, { startIndex: 63, type: 'punctuation.sass' }, { startIndex: 64, type: '' }, { startIndex: 65, type: 'comment.sass' }, { startIndex: 72, type: '' }, - { startIndex: 75, type: 'entity.other.attribute-name.sass' }, + { startIndex: 75, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 82, type: '' }, { startIndex: 83, type: 'punctuation.curly.sass' }, { startIndex: 84, type: '' }, { startIndex: 85, type: 'comment.sass' }, { startIndex: 96, type: '' }, - { startIndex: 101, type: 'support.type.property-name.sass' }, + { startIndex: 101, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 106, type: '' }, { startIndex: 107, type: 'constant.numeric.sass' }, { startIndex: 108, type: 'punctuation.sass' }, { startIndex: 109, type: '' }, { startIndex: 112, type: 'punctuation.curly.sass' }, { startIndex: 113, type: '' }, - { startIndex: 116, type: 'entity.other.attribute-name.sass' }, + { startIndex: 116, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 123, type: '' }, { startIndex: 124, type: 'punctuation.curly.sass' }, { startIndex: 125, type: '' }, { startIndex: 126, type: 'comment.sass' }, { startIndex: 137, type: '' }, - { startIndex: 142, type: 'support.type.property-name.sass' }, + { startIndex: 142, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 147, type: '' }, { startIndex: 148, type: 'constant.numeric.sass' }, { startIndex: 149, type: 'punctuation.sass' }, { startIndex: 150, type: '' }, { startIndex: 153, type: 'punctuation.curly.sass' }, { startIndex: 154, type: '' }, - { startIndex: 157, type: 'support.type.property-name.sass' }, + { startIndex: 157, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 161, type: '' }, { startIndex: 162, type: 'constant.numeric.sass' }, { startIndex: 165, type: 'punctuation.sass' }, @@ -224,11 +225,11 @@ suite('Sass Colorizer', () => { [{ line: 'tr.default {\n foo.bar {\n $foo: 1px\n }\n foo: {\n foo : white\n }\n foo.bar1 {\n @extend tr.default\n }\n foo.bar2 {\n @import "compass"\n }\n bar: black\n}', tokens: [ - { startIndex: 0, type: 'entity.other.attribute-name.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 10, type: '' }, { startIndex: 11, type: 'punctuation.curly.sass' }, { startIndex: 12, type: '' }, - { startIndex: 15, type: 'entity.other.attribute-name.sass' }, + { startIndex: 15, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 22, type: '' }, { startIndex: 23, type: 'punctuation.curly.sass' }, { startIndex: 24, type: '' }, @@ -238,31 +239,31 @@ suite('Sass Colorizer', () => { { startIndex: 38, type: '' }, { startIndex: 41, type: 'punctuation.curly.sass' }, { startIndex: 42, type: '' }, - { startIndex: 45, type: 'support.type.property-name.sass' }, + { startIndex: 45, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 49, type: '' }, { startIndex: 50, type: 'punctuation.curly.sass' }, { startIndex: 51, type: '' }, - { startIndex: 56, type: 'support.type.property-name.sass' }, + { startIndex: 56, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 61, type: '' }, - { startIndex: 62, type: 'meta.property-value.sass' }, + { startIndex: 62, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 67, type: '' }, { startIndex: 70, type: 'punctuation.curly.sass' }, { startIndex: 71, type: '' }, - { startIndex: 74, type: 'entity.other.attribute-name.sass' }, + { startIndex: 74, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 82, type: '' }, { startIndex: 83, type: 'punctuation.curly.sass' }, { startIndex: 84, type: '' }, - { startIndex: 89, type: 'keyword.control.at-rule.sass' }, + { startIndex: 89, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 96, type: '' }, - { startIndex: 97, type: 'entity.other.attribute-name.sass' }, + { startIndex: 97, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 107, type: '' }, { startIndex: 110, type: 'punctuation.curly.sass' }, { startIndex: 111, type: '' }, - { startIndex: 114, type: 'entity.other.attribute-name.sass' }, + { startIndex: 114, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 122, type: '' }, { startIndex: 123, type: 'punctuation.curly.sass' }, { startIndex: 124, type: '' }, - { startIndex: 129, type: 'keyword.control.at-rule.sass' }, + { startIndex: 129, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 136, type: '' }, { startIndex: 137, type: 'string.punctuation.sass' }, { startIndex: 138, type: 'string.sass' }, @@ -270,9 +271,9 @@ suite('Sass Colorizer', () => { { startIndex: 146, type: '' }, { startIndex: 149, type: 'punctuation.curly.sass' }, { startIndex: 150, type: '' }, - { startIndex: 153, type: 'support.type.property-name.sass' }, + { startIndex: 153, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 157, type: '' }, - { startIndex: 158, type: 'meta.property-value.sass' }, + { startIndex: 158, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 163, type: '' }, { startIndex: 164, type: 'punctuation.curly.sass' } ]}], @@ -281,21 +282,21 @@ suite('Sass Colorizer', () => { [{ line: 'legend {foo{a:s}margin-top:0;margin-bottom:#123;margin-top:s(1)}', tokens: [ - { startIndex: 0, type: 'entity.other.attribute-name.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 6, type: '' }, { startIndex: 7, type: 'punctuation.curly.sass' }, - { startIndex: 8, type: 'entity.other.attribute-name.sass' }, + { startIndex: 8, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 11, type: 'punctuation.curly.sass' }, - { startIndex: 12, type: 'support.type.property-name.sass' }, - { startIndex: 14, type: 'meta.property-value.sass' }, + { startIndex: 12, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, + { startIndex: 14, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 15, type: 'punctuation.curly.sass' }, - { startIndex: 16, type: 'support.type.property-name.sass' }, + { startIndex: 16, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 27, type: 'constant.numeric.sass' }, { startIndex: 28, type: 'punctuation.sass' }, - { startIndex: 29, type: 'support.type.property-name.sass' }, + { startIndex: 29, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 43, type: 'constant.rgb-value.sass' }, { startIndex: 47, type: 'punctuation.sass' }, - { startIndex: 48, type: 'support.type.property-name.sass' }, + { startIndex: 48, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 59, type: 'support.function.name.sass' }, { startIndex: 61, type: 'constant.numeric.sass' }, { startIndex: 62, type: 'support.function.name.sass' }, @@ -316,13 +317,13 @@ suite('Sass Colorizer', () => { { startIndex: 112, type: '' }, { startIndex: 113, type: 'comment.sass' }, { startIndex: 152, type: '' }, - { startIndex: 153, type: 'entity.other.attribute-name.sass' }, + { startIndex: 153, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 157, type: '' }, { startIndex: 158, type: 'punctuation.curly.sass' }, { startIndex: 159, type: '' }, - { startIndex: 160, type: 'support.type.property-name.sass' }, + { startIndex: 160, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 166, type: '' }, - { startIndex: 167, type: 'meta.property-value.sass' }, + { startIndex: 167, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 172, type: 'punctuation.sass' }, { startIndex: 173, type: '' }, { startIndex: 174, type: 'punctuation.curly.sass' }, @@ -333,13 +334,13 @@ suite('Sass Colorizer', () => { { startIndex: 263, type: '' }, { startIndex: 264, type: 'comment.sass' }, { startIndex: 313, type: '' }, - { startIndex: 314, type: 'entity.other.attribute-name.sass' }, + { startIndex: 314, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 315, type: '' }, { startIndex: 316, type: 'punctuation.curly.sass' }, { startIndex: 317, type: '' }, - { startIndex: 318, type: 'support.type.property-name.sass' }, + { startIndex: 318, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 324, type: '' }, - { startIndex: 325, type: 'meta.property-value.sass' }, + { startIndex: 325, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 330, type: 'punctuation.sass' }, { startIndex: 331, type: '' }, { startIndex: 332, type: 'punctuation.curly.sass' } @@ -363,7 +364,7 @@ suite('Sass Colorizer', () => { { startIndex: 37, type: 'literal.sass' }, { startIndex: 45, type: 'punctuation.sass' }, { startIndex: 46, type: '' }, - { startIndex: 47, type: 'entity.other.attribute-name.sass' }, + { startIndex: 47, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 52, type: '' }, { startIndex: 53, type: 'punctuation.curly.sass' }, { startIndex: 54, type: '' }, @@ -372,7 +373,7 @@ suite('Sass Colorizer', () => { { startIndex: 68, type: 'constant.numeric.sass' }, { startIndex: 71, type: 'punctuation.sass' }, { startIndex: 72, type: '' }, - { startIndex: 75, type: 'support.type.property-name.sass' }, + { startIndex: 75, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 81, type: '' }, { startIndex: 82, type: 'variable.ref.sass' }, { startIndex: 88, type: 'punctuation.sass' }, @@ -387,7 +388,7 @@ suite('Sass Colorizer', () => { { startIndex: 127, type: 'constant.numeric.sass' }, { startIndex: 131, type: 'punctuation.sass' }, { startIndex: 132, type: '' }, - { startIndex: 135, type: 'support.type.property-name.sass' }, + { startIndex: 135, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 140, type: '' }, { startIndex: 141, type: 'support.function.interpolation.sass' }, { startIndex: 143, type: 'variable.ref.sass' }, @@ -402,15 +403,15 @@ suite('Sass Colorizer', () => { { startIndex: 173, type: '' }, { startIndex: 174, type: 'variable.decl.sass' }, { startIndex: 180, type: '' }, - { startIndex: 181, type: 'meta.property-value.sass' }, + { startIndex: 181, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 184, type: 'punctuation.sass' }, { startIndex: 185, type: '' }, { startIndex: 186, type: 'variable.decl.sass' }, { startIndex: 192, type: '' }, - { startIndex: 193, type: 'meta.property-value.sass' }, + { startIndex: 193, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 199, type: 'punctuation.sass' }, { startIndex: 200, type: '' }, - { startIndex: 201, type: 'entity.other.attribute-name.sass' }, + { startIndex: 201, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 203, type: 'support.function.interpolation.sass' }, { startIndex: 205, type: 'variable.ref.sass' }, { startIndex: 210, type: 'support.function.interpolation.sass' }, @@ -420,9 +421,9 @@ suite('Sass Colorizer', () => { { startIndex: 216, type: 'support.function.interpolation.sass' }, { startIndex: 218, type: 'variable.ref.sass' }, { startIndex: 223, type: 'support.function.interpolation.sass' }, - { startIndex: 224, type: 'support.type.property-name.sass' }, + { startIndex: 224, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 231, type: '' }, - { startIndex: 232, type: 'meta.property-value.sass' }, + { startIndex: 232, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 236, type: 'punctuation.sass' }, { startIndex: 237, type: '' }, { startIndex: 238, type: 'punctuation.curly.sass' } @@ -457,11 +458,11 @@ suite('Sass Colorizer', () => { [{ line: 'p {\n width: (1em + 2em) * 3;\n color: #010203 + #040506;\n font-family: sans- + "serif";\n margin: 3px + 4px auto;\n content: "I ate #{5 + 10} pies!";\n color: hsl(0, 100%, 50%);\n color: hsl($hue: 0, $saturation: 100%, $lightness: 50%);\n}', tokens: [ - { startIndex: 0, type: 'entity.other.attribute-name.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 1, type: '' }, { startIndex: 2, type: 'punctuation.curly.sass' }, { startIndex: 3, type: '' }, - { startIndex: 6, type: 'support.type.property-name.sass' }, + { startIndex: 6, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 12, type: '' }, { startIndex: 13, type: 'punctuation.parenthesis.sass' }, { startIndex: 14, type: 'constant.numeric.sass' }, @@ -476,7 +477,7 @@ suite('Sass Colorizer', () => { { startIndex: 27, type: 'constant.numeric.sass' }, { startIndex: 28, type: 'punctuation.sass' }, { startIndex: 29, type: '' }, - { startIndex: 32, type: 'support.type.property-name.sass' }, + { startIndex: 32, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 38, type: '' }, { startIndex: 39, type: 'constant.rgb-value.sass' }, { startIndex: 46, type: '' }, @@ -485,9 +486,9 @@ suite('Sass Colorizer', () => { { startIndex: 49, type: 'constant.rgb-value.sass' }, { startIndex: 56, type: 'punctuation.sass' }, { startIndex: 57, type: '' }, - { startIndex: 60, type: 'support.type.property-name.sass' }, + { startIndex: 60, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 72, type: '' }, - { startIndex: 73, type: 'meta.property-value.sass' }, + { startIndex: 73, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 78, type: '' }, { startIndex: 79, type: 'keyword.operator.sass' }, { startIndex: 80, type: '' }, @@ -496,7 +497,7 @@ suite('Sass Colorizer', () => { { startIndex: 87, type: 'string.punctuation.sass' }, { startIndex: 88, type: 'punctuation.sass' }, { startIndex: 89, type: '' }, - { startIndex: 92, type: 'support.type.property-name.sass' }, + { startIndex: 92, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 99, type: '' }, { startIndex: 100, type: 'constant.numeric.sass' }, { startIndex: 103, type: '' }, @@ -504,17 +505,17 @@ suite('Sass Colorizer', () => { { startIndex: 105, type: '' }, { startIndex: 106, type: 'constant.numeric.sass' }, { startIndex: 109, type: '' }, - { startIndex: 110, type: 'meta.property-value.sass' }, + { startIndex: 110, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 114, type: 'punctuation.sass' }, { startIndex: 115, type: '' }, - { startIndex: 118, type: 'support.type.property-name.sass' }, + { startIndex: 118, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 126, type: '' }, { startIndex: 127, type: 'string.punctuation.sass' }, { startIndex: 128, type: 'string.sass' }, { startIndex: 149, type: 'string.punctuation.sass' }, { startIndex: 150, type: 'punctuation.sass' }, { startIndex: 151, type: '' }, - { startIndex: 154, type: 'support.type.property-name.sass' }, + { startIndex: 154, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 160, type: '' }, { startIndex: 161, type: 'support.function.name.sass' }, { startIndex: 165, type: 'constant.numeric.sass' }, @@ -527,20 +528,20 @@ suite('Sass Colorizer', () => { { startIndex: 177, type: 'support.function.name.sass' }, { startIndex: 178, type: 'punctuation.sass' }, { startIndex: 179, type: '' }, - { startIndex: 182, type: 'support.type.property-name.sass' }, + { startIndex: 182, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 188, type: '' }, { startIndex: 189, type: 'support.function.name.sass' }, - { startIndex: 193, type: 'support.type.property-name.sass' }, + { startIndex: 193, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 198, type: '' }, { startIndex: 199, type: 'constant.numeric.sass' }, { startIndex: 200, type: 'punctuation.sass' }, { startIndex: 201, type: '' }, - { startIndex: 202, type: 'support.type.property-name.sass' }, + { startIndex: 202, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 214, type: '' }, { startIndex: 215, type: 'constant.numeric.sass' }, { startIndex: 219, type: 'punctuation.sass' }, { startIndex: 220, type: '' }, - { startIndex: 221, type: 'support.type.property-name.sass' }, + { startIndex: 221, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 232, type: '' }, { startIndex: 233, type: 'constant.numeric.sass' }, { startIndex: 236, type: 'support.function.name.sass' }, @@ -563,7 +564,7 @@ suite('Sass Colorizer', () => { { startIndex: 34, type: 'constant.numeric.sass' }, { startIndex: 38, type: 'punctuation.sass' }, { startIndex: 39, type: '' }, - { startIndex: 40, type: 'keyword.control.at-rule.sass' }, + { startIndex: 40, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 49, type: '' }, { startIndex: 50, type: 'support.function.name.sass' }, { startIndex: 61, type: 'variable.ref.sass' }, @@ -571,7 +572,7 @@ suite('Sass Colorizer', () => { { startIndex: 64, type: '' }, { startIndex: 65, type: 'punctuation.curly.sass' }, { startIndex: 66, type: '' }, - { startIndex: 69, type: 'keyword.control.at-rule.sass' }, + { startIndex: 69, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 76, type: '' }, { startIndex: 77, type: 'variable.ref.sass' }, { startIndex: 79, type: '' }, @@ -596,11 +597,11 @@ suite('Sass Colorizer', () => { { startIndex: 121, type: '' }, { startIndex: 122, type: 'punctuation.curly.sass' }, { startIndex: 123, type: '' }, - { startIndex: 124, type: 'entity.other.attribute-name.sass' }, + { startIndex: 124, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 132, type: '' }, { startIndex: 133, type: 'punctuation.curly.sass' }, { startIndex: 134, type: '' }, - { startIndex: 135, type: 'support.type.property-name.sass' }, + { startIndex: 135, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 141, type: '' }, { startIndex: 142, type: 'support.function.name.sass' }, { startIndex: 153, type: 'constant.numeric.sass' }, @@ -614,7 +615,7 @@ suite('Sass Colorizer', () => { [{ line: '@import "foo.scss";\n$family: unquote("Droid+Sans");\n@import "rounded-corners" url("http://fonts.googleapis.com/css?family=#{$family}");\n#main {\n @import "example";\n}', tokens: [ - { startIndex: 0, type: 'keyword.control.at-rule.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 7, type: '' }, { startIndex: 8, type: 'string.punctuation.sass' }, { startIndex: 9, type: 'string.sass' }, @@ -630,7 +631,7 @@ suite('Sass Colorizer', () => { { startIndex: 49, type: 'support.function.name.sass' }, { startIndex: 50, type: 'punctuation.sass' }, { startIndex: 51, type: '' }, - { startIndex: 52, type: 'keyword.control.at-rule.sass' }, + { startIndex: 52, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 59, type: '' }, { startIndex: 60, type: 'string.punctuation.sass' }, { startIndex: 61, type: 'string.sass' }, @@ -643,11 +644,11 @@ suite('Sass Colorizer', () => { { startIndex: 133, type: 'support.function.name.sass' }, { startIndex: 134, type: 'punctuation.sass' }, { startIndex: 135, type: '' }, - { startIndex: 136, type: 'entity.other.attribute-name.sass' }, + { startIndex: 136, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 141, type: '' }, { startIndex: 142, type: 'punctuation.curly.sass' }, { startIndex: 143, type: '' }, - { startIndex: 146, type: 'keyword.control.at-rule.sass' }, + { startIndex: 146, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 153, type: '' }, { startIndex: 154, type: 'string.punctuation.sass' }, { startIndex: 155, type: 'string.sass' }, @@ -661,30 +662,30 @@ suite('Sass Colorizer', () => { [{ line: '.sidebar {\n width: 300px;\n @media screen and (orientation: landscape) {\n width: 500px;\n }\n}', tokens: [ - { startIndex: 0, type: 'entity.other.attribute-name.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 8, type: '' }, { startIndex: 9, type: 'punctuation.curly.sass' }, { startIndex: 10, type: '' }, - { startIndex: 13, type: 'support.type.property-name.sass' }, + { startIndex: 13, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 19, type: '' }, { startIndex: 20, type: 'constant.numeric.sass' }, { startIndex: 25, type: 'punctuation.sass' }, { startIndex: 26, type: '' }, { startIndex: 29, type: 'keyword.flow.control.at-rule.sass' }, { startIndex: 35, type: '' }, - { startIndex: 36, type: 'meta.property-value.sass' }, + { startIndex: 36, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 42, type: '' }, { startIndex: 43, type: 'keyword.operator.sass' }, { startIndex: 46, type: '' }, { startIndex: 47, type: 'punctuation.parenthesis.sass' }, - { startIndex: 48, type: 'meta.property-value.sass' }, + { startIndex: 48, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 59, type: '' }, - { startIndex: 61, type: 'meta.property-value.sass' }, + { startIndex: 61, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 70, type: 'punctuation.parenthesis.sass' }, { startIndex: 71, type: '' }, { startIndex: 72, type: 'punctuation.curly.sass' }, { startIndex: 73, type: '' }, - { startIndex: 78, type: 'support.type.property-name.sass' }, + { startIndex: 78, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 84, type: '' }, { startIndex: 85, type: 'constant.numeric.sass' }, { startIndex: 90, type: 'punctuation.sass' }, @@ -698,70 +699,70 @@ suite('Sass Colorizer', () => { [{ line: '.error {\n border: 1px #f00;\n background-color: #fdd;\n}\n.seriousError {\n @extend .error;\n border-width: 3px;\n}\n#context a%extreme {\n color: blue;\n font-weight: bold;\n font-size: 2em;\n}\n.notice {\n @extend %extreme !optional;\n}', tokens: [ - { startIndex: 0, type: 'entity.other.attribute-name.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 6, type: '' }, { startIndex: 7, type: 'punctuation.curly.sass' }, { startIndex: 8, type: '' }, - { startIndex: 11, type: 'support.type.property-name.sass' }, + { startIndex: 11, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 18, type: '' }, { startIndex: 19, type: 'constant.numeric.sass' }, { startIndex: 22, type: '' }, { startIndex: 23, type: 'constant.rgb-value.sass' }, { startIndex: 27, type: 'punctuation.sass' }, { startIndex: 28, type: '' }, - { startIndex: 31, type: 'support.type.property-name.sass' }, + { startIndex: 31, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 48, type: '' }, { startIndex: 49, type: 'constant.rgb-value.sass' }, { startIndex: 53, type: 'punctuation.sass' }, { startIndex: 54, type: '' }, { startIndex: 55, type: 'punctuation.curly.sass' }, { startIndex: 56, type: '' }, - { startIndex: 57, type: 'entity.other.attribute-name.sass' }, + { startIndex: 57, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 70, type: '' }, { startIndex: 71, type: 'punctuation.curly.sass' }, { startIndex: 72, type: '' }, - { startIndex: 75, type: 'keyword.control.at-rule.sass' }, + { startIndex: 75, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 82, type: '' }, - { startIndex: 83, type: 'entity.other.attribute-name.sass' }, + { startIndex: 83, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 89, type: 'punctuation.sass' }, { startIndex: 90, type: '' }, - { startIndex: 93, type: 'support.type.property-name.sass' }, + { startIndex: 93, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 106, type: '' }, { startIndex: 107, type: 'constant.numeric.sass' }, { startIndex: 110, type: 'punctuation.sass' }, { startIndex: 111, type: '' }, { startIndex: 112, type: 'punctuation.curly.sass' }, { startIndex: 113, type: '' }, - { startIndex: 114, type: 'entity.other.attribute-name.sass' }, + { startIndex: 114, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 122, type: '' }, - { startIndex: 123, type: 'entity.other.attribute-name.sass' }, + { startIndex: 123, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 132, type: '' }, { startIndex: 133, type: 'punctuation.curly.sass' }, { startIndex: 134, type: '' }, - { startIndex: 137, type: 'support.type.property-name.sass' }, + { startIndex: 137, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 143, type: '' }, - { startIndex: 144, type: 'meta.property-value.sass' }, + { startIndex: 144, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 148, type: 'punctuation.sass' }, { startIndex: 149, type: '' }, - { startIndex: 152, type: 'support.type.property-name.sass' }, + { startIndex: 152, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 164, type: '' }, - { startIndex: 165, type: 'meta.property-value.sass' }, + { startIndex: 165, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 169, type: 'punctuation.sass' }, { startIndex: 170, type: '' }, - { startIndex: 173, type: 'support.type.property-name.sass' }, + { startIndex: 173, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 183, type: '' }, { startIndex: 184, type: 'constant.numeric.sass' }, { startIndex: 187, type: 'punctuation.sass' }, { startIndex: 188, type: '' }, { startIndex: 189, type: 'punctuation.curly.sass' }, { startIndex: 190, type: '' }, - { startIndex: 191, type: 'entity.other.attribute-name.sass' }, + { startIndex: 191, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 198, type: '' }, { startIndex: 199, type: 'punctuation.curly.sass' }, { startIndex: 200, type: '' }, - { startIndex: 203, type: 'keyword.control.at-rule.sass' }, + { startIndex: 203, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 210, type: '' }, - { startIndex: 211, type: 'entity.other.attribute-name.sass' }, + { startIndex: 211, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 219, type: '' }, { startIndex: 220, type: 'literal.sass' }, { startIndex: 229, type: 'punctuation.sass' }, @@ -773,7 +774,7 @@ suite('Sass Colorizer', () => { [{ line: '@debug 10em + 12em;\n@mixin adjust-location($x, $y) {\n @if unitless($x) {\n @warn "Assuming #{$x} to be in pixels";\n $x: 1px * $x;\n }\n @if unitless($y) {\n @warn "Assuming #{$y} to be in pixels";\n $y: 1px * $y;\n }\n position: relative; left: $x; top: $y;\n}', tokens: [ - { startIndex: 0, type: 'keyword.control.at-rule.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 6, type: '' }, { startIndex: 7, type: 'constant.numeric.sass' }, { startIndex: 11, type: '' }, @@ -782,7 +783,7 @@ suite('Sass Colorizer', () => { { startIndex: 14, type: 'constant.numeric.sass' }, { startIndex: 18, type: 'punctuation.sass' }, { startIndex: 19, type: '' }, - { startIndex: 20, type: 'keyword.control.at-rule.sass' }, + { startIndex: 20, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 26, type: '' }, { startIndex: 27, type: 'support.function.name.sass' }, { startIndex: 43, type: 'variable.ref.sass' }, @@ -801,7 +802,7 @@ suite('Sass Colorizer', () => { { startIndex: 71, type: '' }, { startIndex: 72, type: 'punctuation.curly.sass' }, { startIndex: 73, type: '' }, - { startIndex: 78, type: 'keyword.control.at-rule.sass' }, + { startIndex: 78, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 83, type: '' }, { startIndex: 84, type: 'string.punctuation.sass' }, { startIndex: 85, type: 'string.sass' }, @@ -827,7 +828,7 @@ suite('Sass Colorizer', () => { { startIndex: 158, type: '' }, { startIndex: 159, type: 'punctuation.curly.sass' }, { startIndex: 160, type: '' }, - { startIndex: 165, type: 'keyword.control.at-rule.sass' }, + { startIndex: 165, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 170, type: '' }, { startIndex: 171, type: 'string.punctuation.sass' }, { startIndex: 172, type: 'string.sass' }, @@ -845,17 +846,17 @@ suite('Sass Colorizer', () => { { startIndex: 222, type: '' }, { startIndex: 225, type: 'punctuation.curly.sass' }, { startIndex: 226, type: '' }, - { startIndex: 229, type: 'support.type.property-name.sass' }, + { startIndex: 229, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 238, type: '' }, - { startIndex: 239, type: 'meta.property-value.sass' }, + { startIndex: 239, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 247, type: 'punctuation.sass' }, { startIndex: 248, type: '' }, - { startIndex: 249, type: 'support.type.property-name.sass' }, + { startIndex: 249, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 254, type: '' }, { startIndex: 255, type: 'variable.ref.sass' }, { startIndex: 257, type: 'punctuation.sass' }, { startIndex: 258, type: '' }, - { startIndex: 259, type: 'support.type.property-name.sass' }, + { startIndex: 259, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 263, type: '' }, { startIndex: 264, type: 'variable.ref.sass' }, { startIndex: 266, type: 'punctuation.sass' }, @@ -867,7 +868,7 @@ suite('Sass Colorizer', () => { [{ line: 'p {\n @if 1 + 1 == 2 { border: 1px solid; }\n @if 5 < 3 { border: 2px dotted; }\n @if null { border: 3px double; }\n}', tokens: [ - { startIndex: 0, type: 'entity.other.attribute-name.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 1, type: '' }, { startIndex: 2, type: 'punctuation.curly.sass' }, { startIndex: 3, type: '' }, @@ -885,11 +886,11 @@ suite('Sass Colorizer', () => { { startIndex: 20, type: '' }, { startIndex: 21, type: 'punctuation.curly.sass' }, { startIndex: 22, type: '' }, - { startIndex: 23, type: 'support.type.property-name.sass' }, + { startIndex: 23, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 30, type: '' }, { startIndex: 31, type: 'constant.numeric.sass' }, { startIndex: 34, type: '' }, - { startIndex: 35, type: 'meta.property-value.sass' }, + { startIndex: 35, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 40, type: 'punctuation.sass' }, { startIndex: 41, type: '' }, { startIndex: 43, type: 'punctuation.curly.sass' }, @@ -904,26 +905,26 @@ suite('Sass Colorizer', () => { { startIndex: 56, type: '' }, { startIndex: 62, type: 'punctuation.curly.sass' }, { startIndex: 63, type: '' }, - { startIndex: 64, type: 'support.type.property-name.sass' }, + { startIndex: 64, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 71, type: '' }, { startIndex: 72, type: 'constant.numeric.sass' }, { startIndex: 75, type: '' }, - { startIndex: 76, type: 'meta.property-value.sass' }, + { startIndex: 76, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 82, type: 'punctuation.sass' }, { startIndex: 83, type: '' }, { startIndex: 84, type: 'punctuation.curly.sass' }, { startIndex: 85, type: '' }, { startIndex: 88, type: 'keyword.flow.control.at-rule.sass' }, { startIndex: 91, type: '' }, - { startIndex: 92, type: 'meta.property-value.sass' }, + { startIndex: 92, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 96, type: '' }, { startIndex: 103, type: 'punctuation.curly.sass' }, { startIndex: 104, type: '' }, - { startIndex: 105, type: 'support.type.property-name.sass' }, + { startIndex: 105, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 112, type: '' }, { startIndex: 113, type: 'constant.numeric.sass' }, { startIndex: 116, type: '' }, - { startIndex: 117, type: 'meta.property-value.sass' }, + { startIndex: 117, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 123, type: 'punctuation.sass' }, { startIndex: 124, type: '' }, { startIndex: 125, type: 'punctuation.curly.sass' }, @@ -937,10 +938,10 @@ suite('Sass Colorizer', () => { tokens: [ { startIndex: 0, type: 'variable.decl.sass' }, { startIndex: 6, type: '' }, - { startIndex: 7, type: 'meta.property-value.sass' }, + { startIndex: 7, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 14, type: 'punctuation.sass' }, { startIndex: 15, type: '' }, - { startIndex: 16, type: 'entity.other.attribute-name.sass' }, + { startIndex: 16, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 17, type: '' }, { startIndex: 18, type: 'punctuation.curly.sass' }, { startIndex: 19, type: '' }, @@ -950,13 +951,13 @@ suite('Sass Colorizer', () => { { startIndex: 31, type: '' }, { startIndex: 32, type: 'keyword.operator.sass' }, { startIndex: 34, type: '' }, - { startIndex: 35, type: 'meta.property-value.sass' }, + { startIndex: 35, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 40, type: '' }, { startIndex: 41, type: 'punctuation.curly.sass' }, { startIndex: 42, type: '' }, - { startIndex: 47, type: 'support.type.property-name.sass' }, + { startIndex: 47, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 53, type: '' }, - { startIndex: 54, type: 'meta.property-value.sass' }, + { startIndex: 54, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 58, type: 'punctuation.sass' }, { startIndex: 59, type: '' }, { startIndex: 62, type: 'punctuation.curly.sass' }, @@ -969,13 +970,13 @@ suite('Sass Colorizer', () => { { startIndex: 78, type: '' }, { startIndex: 79, type: 'keyword.operator.sass' }, { startIndex: 81, type: '' }, - { startIndex: 82, type: 'meta.property-value.sass' }, + { startIndex: 82, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 89, type: '' }, { startIndex: 90, type: 'punctuation.curly.sass' }, { startIndex: 91, type: '' }, - { startIndex: 96, type: 'support.type.property-name.sass' }, + { startIndex: 96, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 102, type: '' }, - { startIndex: 103, type: 'meta.property-value.sass' }, + { startIndex: 103, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 106, type: 'punctuation.sass' }, { startIndex: 107, type: '' }, { startIndex: 110, type: 'punctuation.curly.sass' }, @@ -984,9 +985,9 @@ suite('Sass Colorizer', () => { { startIndex: 117, type: '' }, { startIndex: 118, type: 'punctuation.curly.sass' }, { startIndex: 119, type: '' }, - { startIndex: 124, type: 'support.type.property-name.sass' }, + { startIndex: 124, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 130, type: '' }, - { startIndex: 131, type: 'meta.property-value.sass' }, + { startIndex: 131, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 136, type: 'punctuation.sass' }, { startIndex: 137, type: '' }, { startIndex: 140, type: 'punctuation.curly.sass' }, @@ -1012,14 +1013,14 @@ suite('Sass Colorizer', () => { { startIndex: 24, type: '' }, { startIndex: 25, type: 'punctuation.curly.sass' }, { startIndex: 26, type: '' }, - { startIndex: 29, type: 'entity.other.attribute-name.sass' }, + { startIndex: 29, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 35, type: 'support.function.interpolation.sass' }, { startIndex: 37, type: 'variable.ref.sass' }, { startIndex: 39, type: 'support.function.interpolation.sass' }, { startIndex: 40, type: '' }, { startIndex: 41, type: 'punctuation.curly.sass' }, { startIndex: 42, type: '' }, - { startIndex: 43, type: 'support.type.property-name.sass' }, + { startIndex: 43, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 49, type: '' }, { startIndex: 50, type: 'constant.numeric.sass' }, { startIndex: 53, type: '' }, @@ -1043,28 +1044,28 @@ suite('Sass Colorizer', () => { { startIndex: 13, type: '' }, { startIndex: 14, type: 'keyword.flow.control.at-rule.sass' }, { startIndex: 16, type: '' }, - { startIndex: 17, type: 'meta.property-value.sass' }, + { startIndex: 17, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 21, type: 'keyword.operator.sass' }, { startIndex: 22, type: '' }, - { startIndex: 23, type: 'meta.property-value.sass' }, + { startIndex: 23, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 31, type: 'keyword.operator.sass' }, { startIndex: 32, type: '' }, - { startIndex: 33, type: 'meta.property-value.sass' }, + { startIndex: 33, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 38, type: 'keyword.operator.sass' }, { startIndex: 39, type: '' }, - { startIndex: 40, type: 'meta.property-value.sass' }, + { startIndex: 40, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 50, type: '' }, { startIndex: 51, type: 'punctuation.curly.sass' }, { startIndex: 52, type: '' }, - { startIndex: 55, type: 'entity.other.attribute-name.sass' }, + { startIndex: 55, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 56, type: 'support.function.interpolation.sass' }, { startIndex: 58, type: 'variable.ref.sass' }, { startIndex: 65, type: 'support.function.interpolation.sass' }, - { startIndex: 66, type: 'entity.other.attribute-name.sass' }, + { startIndex: 66, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 71, type: '' }, { startIndex: 72, type: 'punctuation.curly.sass' }, { startIndex: 73, type: '' }, - { startIndex: 78, type: 'support.type.property-name.sass' }, + { startIndex: 78, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 95, type: '' }, { startIndex: 96, type: 'support.function.name.sass' }, { startIndex: 100, type: 'string.punctuation.sass' }, @@ -1097,14 +1098,14 @@ suite('Sass Colorizer', () => { { startIndex: 20, type: '' }, { startIndex: 21, type: 'punctuation.curly.sass' }, { startIndex: 22, type: '' }, - { startIndex: 25, type: 'entity.other.attribute-name.sass' }, + { startIndex: 25, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 31, type: 'support.function.interpolation.sass' }, { startIndex: 33, type: 'variable.ref.sass' }, { startIndex: 35, type: 'support.function.interpolation.sass' }, { startIndex: 36, type: '' }, { startIndex: 37, type: 'punctuation.curly.sass' }, { startIndex: 38, type: '' }, - { startIndex: 39, type: 'support.type.property-name.sass' }, + { startIndex: 39, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 45, type: '' }, { startIndex: 46, type: 'constant.numeric.sass' }, { startIndex: 49, type: '' }, @@ -1131,7 +1132,7 @@ suite('Sass Colorizer', () => { [{ line: '@function foo($total, $a) {\n @for $i from 0 to $total {\n @if (unit($a) == "%") and ($i == ($total - 1)) {\n $z: 100%;\n @return \'1\';\n }\n }\n @return $grid;\n}', tokens: [ - { startIndex: 0, type: 'keyword.control.at-rule.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 9, type: '' }, { startIndex: 10, type: 'support.function.name.sass' }, { startIndex: 14, type: 'variable.ref.sass' }, @@ -1193,7 +1194,7 @@ suite('Sass Colorizer', () => { { startIndex: 120, type: 'constant.numeric.sass' }, { startIndex: 124, type: 'punctuation.sass' }, { startIndex: 125, type: '' }, - { startIndex: 132, type: 'keyword.control.at-rule.sass' }, + { startIndex: 132, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 139, type: '' }, { startIndex: 140, type: 'string.punctuation.sass' }, { startIndex: 141, type: 'string.sass' }, @@ -1204,7 +1205,7 @@ suite('Sass Colorizer', () => { { startIndex: 150, type: '' }, { startIndex: 153, type: 'punctuation.curly.sass' }, { startIndex: 154, type: '' }, - { startIndex: 157, type: 'keyword.control.at-rule.sass' }, + { startIndex: 157, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 164, type: '' }, { startIndex: 165, type: 'variable.ref.sass' }, { startIndex: 170, type: 'punctuation.sass' }, @@ -1216,50 +1217,50 @@ suite('Sass Colorizer', () => { [{ line: '@mixin large-text {\n font: {\n family: Arial;\n size: 20px;\n weight: bold;\n }\n color: #ff0000;\n}\n.page-title {\n @include large-text;\n padding: 4px;\n}', tokens: [ - { startIndex: 0, type: 'keyword.control.at-rule.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 6, type: '' }, { startIndex: 7, type: 'support.function.name.sass' }, { startIndex: 17, type: '' }, { startIndex: 18, type: 'punctuation.curly.sass' }, { startIndex: 19, type: '' }, - { startIndex: 22, type: 'support.type.property-name.sass' }, + { startIndex: 22, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 27, type: '' }, { startIndex: 28, type: 'punctuation.curly.sass' }, { startIndex: 29, type: '' }, - { startIndex: 34, type: 'support.type.property-name.sass' }, + { startIndex: 34, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 41, type: '' }, - { startIndex: 42, type: 'meta.property-value.sass' }, + { startIndex: 42, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 47, type: 'punctuation.sass' }, { startIndex: 48, type: '' }, - { startIndex: 53, type: 'support.type.property-name.sass' }, + { startIndex: 53, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 58, type: '' }, { startIndex: 59, type: 'constant.numeric.sass' }, { startIndex: 63, type: 'punctuation.sass' }, { startIndex: 64, type: '' }, - { startIndex: 69, type: 'support.type.property-name.sass' }, + { startIndex: 69, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 76, type: '' }, - { startIndex: 77, type: 'meta.property-value.sass' }, + { startIndex: 77, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 81, type: 'punctuation.sass' }, { startIndex: 82, type: '' }, { startIndex: 85, type: 'punctuation.curly.sass' }, { startIndex: 86, type: '' }, - { startIndex: 89, type: 'support.type.property-name.sass' }, + { startIndex: 89, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 95, type: '' }, { startIndex: 96, type: 'constant.rgb-value.sass' }, { startIndex: 103, type: 'punctuation.sass' }, { startIndex: 104, type: '' }, { startIndex: 105, type: 'punctuation.curly.sass' }, { startIndex: 106, type: '' }, - { startIndex: 107, type: 'entity.other.attribute-name.sass' }, + { startIndex: 107, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 118, type: '' }, { startIndex: 119, type: 'punctuation.curly.sass' }, { startIndex: 120, type: '' }, - { startIndex: 123, type: 'keyword.control.at-rule.sass' }, + { startIndex: 123, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 131, type: '' }, { startIndex: 132, type: 'support.function.name.sass' }, { startIndex: 142, type: 'punctuation.sass' }, { startIndex: 143, type: '' }, - { startIndex: 146, type: 'support.type.property-name.sass' }, + { startIndex: 146, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 154, type: '' }, { startIndex: 155, type: 'constant.numeric.sass' }, { startIndex: 158, type: 'punctuation.sass' }, @@ -1271,50 +1272,50 @@ suite('Sass Colorizer', () => { [{ line: '@mixin sexy-border($color, $width: 1in) {\n border: {\n color: $color;\n width: $width;\n style: dashed;\n }\n}\np { @include sexy-border(blue); }', tokens: [ - { startIndex: 0, type: 'keyword.control.at-rule.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 6, type: '' }, { startIndex: 7, type: 'support.function.name.sass' }, { startIndex: 19, type: 'variable.ref.sass' }, { startIndex: 25, type: 'punctuation.sass' }, { startIndex: 26, type: '' }, - { startIndex: 27, type: 'support.type.property-name.sass' }, + { startIndex: 27, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 34, type: '' }, { startIndex: 35, type: 'constant.numeric.sass' }, { startIndex: 38, type: 'support.function.name.sass' }, { startIndex: 39, type: '' }, { startIndex: 40, type: 'punctuation.curly.sass' }, { startIndex: 41, type: '' }, - { startIndex: 44, type: 'support.type.property-name.sass' }, + { startIndex: 44, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 51, type: '' }, { startIndex: 52, type: 'punctuation.curly.sass' }, { startIndex: 53, type: '' }, - { startIndex: 58, type: 'support.type.property-name.sass' }, + { startIndex: 58, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 64, type: '' }, { startIndex: 65, type: 'variable.ref.sass' }, { startIndex: 71, type: 'punctuation.sass' }, { startIndex: 72, type: '' }, - { startIndex: 77, type: 'support.type.property-name.sass' }, + { startIndex: 77, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 83, type: '' }, { startIndex: 84, type: 'variable.ref.sass' }, { startIndex: 90, type: 'punctuation.sass' }, { startIndex: 91, type: '' }, - { startIndex: 96, type: 'support.type.property-name.sass' }, + { startIndex: 96, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 102, type: '' }, - { startIndex: 103, type: 'meta.property-value.sass' }, + { startIndex: 103, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 109, type: 'punctuation.sass' }, { startIndex: 110, type: '' }, { startIndex: 113, type: 'punctuation.curly.sass' }, { startIndex: 114, type: '' }, { startIndex: 115, type: 'punctuation.curly.sass' }, { startIndex: 116, type: '' }, - { startIndex: 117, type: 'entity.other.attribute-name.sass' }, + { startIndex: 117, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 118, type: '' }, { startIndex: 119, type: 'punctuation.curly.sass' }, { startIndex: 120, type: '' }, - { startIndex: 121, type: 'keyword.control.at-rule.sass' }, + { startIndex: 121, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 129, type: '' }, { startIndex: 130, type: 'support.function.name.sass' }, - { startIndex: 142, type: 'meta.property-value.sass' }, + { startIndex: 142, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 146, type: 'support.function.name.sass' }, { startIndex: 147, type: 'punctuation.sass' }, { startIndex: 148, type: '' }, @@ -1325,7 +1326,7 @@ suite('Sass Colorizer', () => { [{ line: '@mixin box-shadow($shadows...) {\n -moz-box-shadow: $shadows;\n -webkit-box-shadow: $shadows;\n box-shadow: $shadows;\n}\n.shadows {\n @include box-shadow(0px 4px 5px #666, 2px 6px 10px #999);\n}', tokens: [ - { startIndex: 0, type: 'keyword.control.at-rule.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 6, type: '' }, { startIndex: 7, type: 'support.function.name.sass' }, { startIndex: 18, type: 'variable.ref.sass' }, @@ -1334,28 +1335,28 @@ suite('Sass Colorizer', () => { { startIndex: 30, type: '' }, { startIndex: 31, type: 'punctuation.curly.sass' }, { startIndex: 32, type: '' }, - { startIndex: 35, type: 'support.type.property-name.sass' }, + { startIndex: 35, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 51, type: '' }, { startIndex: 52, type: 'variable.ref.sass' }, { startIndex: 60, type: 'punctuation.sass' }, { startIndex: 61, type: '' }, - { startIndex: 64, type: 'support.type.property-name.sass' }, + { startIndex: 64, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 83, type: '' }, { startIndex: 84, type: 'variable.ref.sass' }, { startIndex: 92, type: 'punctuation.sass' }, { startIndex: 93, type: '' }, - { startIndex: 96, type: 'support.type.property-name.sass' }, + { startIndex: 96, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 107, type: '' }, { startIndex: 108, type: 'variable.ref.sass' }, { startIndex: 116, type: 'punctuation.sass' }, { startIndex: 117, type: '' }, { startIndex: 118, type: 'punctuation.curly.sass' }, { startIndex: 119, type: '' }, - { startIndex: 120, type: 'entity.other.attribute-name.sass' }, + { startIndex: 120, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 128, type: '' }, { startIndex: 129, type: 'punctuation.curly.sass' }, { startIndex: 130, type: '' }, - { startIndex: 133, type: 'keyword.control.at-rule.sass' }, + { startIndex: 133, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 141, type: '' }, { startIndex: 142, type: 'support.function.name.sass' }, { startIndex: 153, type: 'constant.numeric.sass' }, @@ -1384,7 +1385,7 @@ suite('Sass Colorizer', () => { [{ line: '@mixin colors($text, $background, $border) {\n color: $text;\n background-color: $background;\n border-color: $border;\n}\n$values: #ff0000, #00ff00, #0000ff;\n.primary {\n @include colors($values...);\n}', tokens: [ - { startIndex: 0, type: 'keyword.control.at-rule.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 6, type: '' }, { startIndex: 7, type: 'support.function.name.sass' }, { startIndex: 14, type: 'variable.ref.sass' }, @@ -1398,17 +1399,17 @@ suite('Sass Colorizer', () => { { startIndex: 42, type: '' }, { startIndex: 43, type: 'punctuation.curly.sass' }, { startIndex: 44, type: '' }, - { startIndex: 47, type: 'support.type.property-name.sass' }, + { startIndex: 47, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 53, type: '' }, { startIndex: 54, type: 'variable.ref.sass' }, { startIndex: 59, type: 'punctuation.sass' }, { startIndex: 60, type: '' }, - { startIndex: 63, type: 'support.type.property-name.sass' }, + { startIndex: 63, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 80, type: '' }, { startIndex: 81, type: 'variable.ref.sass' }, { startIndex: 92, type: 'punctuation.sass' }, { startIndex: 93, type: '' }, - { startIndex: 96, type: 'support.type.property-name.sass' }, + { startIndex: 96, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 109, type: '' }, { startIndex: 110, type: 'variable.ref.sass' }, { startIndex: 117, type: 'punctuation.sass' }, @@ -1426,11 +1427,11 @@ suite('Sass Colorizer', () => { { startIndex: 148, type: 'constant.rgb-value.sass' }, { startIndex: 155, type: 'punctuation.sass' }, { startIndex: 156, type: '' }, - { startIndex: 157, type: 'entity.other.attribute-name.sass' }, + { startIndex: 157, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 165, type: '' }, { startIndex: 166, type: 'punctuation.curly.sass' }, { startIndex: 167, type: '' }, - { startIndex: 170, type: 'keyword.control.at-rule.sass' }, + { startIndex: 170, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 178, type: '' }, { startIndex: 179, type: 'support.function.name.sass' }, { startIndex: 186, type: 'variable.ref.sass' }, @@ -1445,35 +1446,35 @@ suite('Sass Colorizer', () => { [{ line: '@mixin apply-to-ie6-only {\n * html {\n @content;\n }\n}\n@include apply-to-ie6-only {\n #logo {\n background-image: url(/logo.gif);\n }\n}', tokens: [ - { startIndex: 0, type: 'keyword.control.at-rule.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 6, type: '' }, { startIndex: 7, type: 'support.function.name.sass' }, { startIndex: 24, type: '' }, { startIndex: 25, type: 'punctuation.curly.sass' }, { startIndex: 26, type: '' }, - { startIndex: 29, type: 'entity.name.tag.sass' }, + { startIndex: 29, type: cssTokenTypes.TOKEN_SELECTOR_TAG + '.sass' }, { startIndex: 30, type: '' }, - { startIndex: 31, type: 'entity.other.attribute-name.sass' }, + { startIndex: 31, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 35, type: '' }, { startIndex: 36, type: 'punctuation.curly.sass' }, { startIndex: 37, type: '' }, - { startIndex: 42, type: 'keyword.control.at-rule.sass' }, + { startIndex: 42, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 50, type: '' }, { startIndex: 54, type: 'punctuation.curly.sass' }, { startIndex: 55, type: '' }, { startIndex: 56, type: 'punctuation.curly.sass' }, { startIndex: 57, type: '' }, - { startIndex: 58, type: 'keyword.control.at-rule.sass' }, + { startIndex: 58, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 66, type: '' }, { startIndex: 67, type: 'support.function.name.sass' }, { startIndex: 84, type: '' }, { startIndex: 85, type: 'punctuation.curly.sass' }, { startIndex: 86, type: '' }, - { startIndex: 89, type: 'entity.other.attribute-name.sass' }, + { startIndex: 89, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 94, type: '' }, { startIndex: 95, type: 'punctuation.curly.sass' }, { startIndex: 96, type: '' }, - { startIndex: 101, type: 'support.type.property-name.sass' }, + { startIndex: 101, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 118, type: '' }, { startIndex: 119, type: 'support.function.name.sass' }, { startIndex: 123, type: 'string.sass' }, @@ -1489,7 +1490,7 @@ suite('Sass Colorizer', () => { [{ line: '@charset "UTF-8";', tokens: [ - { startIndex: 0, type: 'keyword.control.at-rule.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 8, type: '' }, { startIndex: 9, type: 'string.punctuation.sass' }, { startIndex: 10, type: 'string.sass' }, @@ -1502,17 +1503,17 @@ suite('Sass Colorizer', () => { line: '[rel="external"]::after {\n content: \'s\';\n}', tokens: [ { startIndex: 0, type: 'punctuation.bracket.sass' }, - { startIndex: 1, type: 'meta.property-value.sass' }, + { startIndex: 1, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 4, type: 'keyword.operator.sass' }, { startIndex: 5, type: 'string.punctuation.sass' }, { startIndex: 6, type: 'string.sass' }, { startIndex: 14, type: 'string.punctuation.sass' }, { startIndex: 15, type: 'punctuation.bracket.sass' }, - { startIndex: 16, type: 'entity.other.attribute-name.sass' }, + { startIndex: 16, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 23, type: '' }, { startIndex: 24, type: 'punctuation.curly.sass' }, { startIndex: 25, type: '' }, - { startIndex: 30, type: 'support.type.property-name.sass' }, + { startIndex: 30, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 38, type: '' }, { startIndex: 39, type: 'string.punctuation.sass' }, { startIndex: 40, type: 'string.sass' }, @@ -1526,18 +1527,18 @@ suite('Sass Colorizer', () => { [{ line: '@page :left {\n margin-left: 4cm;\n margin-right: 3cm;\n}', tokens: [ - { startIndex: 0, type: 'keyword.control.at-rule.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 5, type: '' }, - { startIndex: 6, type: 'entity.other.attribute-name.sass' }, + { startIndex: 6, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 11, type: '' }, { startIndex: 12, type: 'punctuation.curly.sass' }, { startIndex: 13, type: '' }, - { startIndex: 16, type: 'support.type.property-name.sass' }, + { startIndex: 16, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 28, type: '' }, { startIndex: 29, type: 'constant.numeric.sass' }, { startIndex: 32, type: 'punctuation.sass' }, { startIndex: 33, type: '' }, - { startIndex: 36, type: 'support.type.property-name.sass' }, + { startIndex: 36, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 49, type: '' }, { startIndex: 50, type: 'constant.numeric.sass' }, { startIndex: 53, type: 'punctuation.sass' }, @@ -1549,27 +1550,27 @@ suite('Sass Colorizer', () => { [{ line: '@mixin error($a: false) {\n @extend .#{$a};\n @extend ##{$a};\n}\n#bar {a: 1px;}\n.bar {b: 1px;}\nfoo {\n @include error(\'bar\'); \n}', tokens: [ - { startIndex: 0, type: 'keyword.control.at-rule.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 6, type: '' }, { startIndex: 7, type: 'support.function.name.sass' }, - { startIndex: 13, type: 'support.type.property-name.sass' }, + { startIndex: 13, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 16, type: '' }, - { startIndex: 17, type: 'meta.property-value.sass' }, + { startIndex: 17, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 22, type: 'support.function.name.sass' }, { startIndex: 23, type: '' }, { startIndex: 24, type: 'punctuation.curly.sass' }, { startIndex: 25, type: '' }, - { startIndex: 28, type: 'keyword.control.at-rule.sass' }, + { startIndex: 28, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 35, type: '' }, - { startIndex: 36, type: 'entity.other.attribute-name.sass' }, + { startIndex: 36, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 37, type: 'support.function.interpolation.sass' }, { startIndex: 39, type: 'variable.ref.sass' }, { startIndex: 41, type: 'support.function.interpolation.sass' }, { startIndex: 42, type: 'punctuation.sass' }, { startIndex: 43, type: '' }, - { startIndex: 46, type: 'keyword.control.at-rule.sass' }, + { startIndex: 46, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 53, type: '' }, - { startIndex: 54, type: 'entity.other.attribute-name.sass' }, + { startIndex: 54, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 55, type: 'support.function.interpolation.sass' }, { startIndex: 57, type: 'variable.ref.sass' }, { startIndex: 59, type: 'support.function.interpolation.sass' }, @@ -1577,29 +1578,29 @@ suite('Sass Colorizer', () => { { startIndex: 61, type: '' }, { startIndex: 62, type: 'punctuation.curly.sass' }, { startIndex: 63, type: '' }, - { startIndex: 64, type: 'entity.other.attribute-name.sass' }, + { startIndex: 64, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 68, type: '' }, { startIndex: 69, type: 'punctuation.curly.sass' }, - { startIndex: 70, type: 'support.type.property-name.sass' }, + { startIndex: 70, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 72, type: '' }, { startIndex: 73, type: 'constant.numeric.sass' }, { startIndex: 76, type: 'punctuation.sass' }, { startIndex: 77, type: 'punctuation.curly.sass' }, { startIndex: 78, type: '' }, - { startIndex: 79, type: 'entity.other.attribute-name.sass' }, + { startIndex: 79, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 83, type: '' }, { startIndex: 84, type: 'punctuation.curly.sass' }, - { startIndex: 85, type: 'support.type.property-name.sass' }, + { startIndex: 85, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 87, type: '' }, { startIndex: 88, type: 'constant.numeric.sass' }, { startIndex: 91, type: 'punctuation.sass' }, { startIndex: 92, type: 'punctuation.curly.sass' }, { startIndex: 93, type: '' }, - { startIndex: 94, type: 'entity.other.attribute-name.sass' }, + { startIndex: 94, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 97, type: '' }, { startIndex: 98, type: 'punctuation.curly.sass' }, { startIndex: 99, type: '' }, - { startIndex: 102, type: 'keyword.control.at-rule.sass' }, + { startIndex: 102, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 110, type: '' }, { startIndex: 111, type: 'support.function.name.sass' }, { startIndex: 117, type: 'string.punctuation.sass' }, @@ -1615,16 +1616,16 @@ suite('Sass Colorizer', () => { [{ line: '@font-face { font-family: Delicious; src: url(\'Delicious-Roman.otf\'); } ', tokens: [ - { startIndex: 0, type: 'keyword.control.at-rule.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 10, type: '' }, { startIndex: 11, type: 'punctuation.curly.sass' }, { startIndex: 12, type: '' }, - { startIndex: 13, type: 'support.type.property-name.sass' }, + { startIndex: 13, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 25, type: '' }, - { startIndex: 26, type: 'meta.property-value.sass' }, + { startIndex: 26, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 35, type: 'punctuation.sass' }, { startIndex: 36, type: '' }, - { startIndex: 37, type: 'support.type.property-name.sass' }, + { startIndex: 37, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 41, type: '' }, { startIndex: 42, type: 'support.function.name.sass' }, { startIndex: 46, type: 'string.punctuation.sass' }, @@ -1641,7 +1642,7 @@ suite('Sass Colorizer', () => { [{ line: '@-webkit-keyframes NAME-YOUR-ANIMATION {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n}\n@-moz-keyframes NAME-YOUR-ANIMATION {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n}\n@-o-keyframes NAME-YOUR-ANIMATION {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n}\n@keyframes NAME-YOUR-ANIMATION {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n}', tokens: [ - { startIndex: 0, type: 'keyword.control.at-rule.sass' }, + { startIndex: 0, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 18, type: '' }, { startIndex: 19, type: 'support.function.name.sass' }, { startIndex: 38, type: '' }, @@ -1651,7 +1652,7 @@ suite('Sass Colorizer', () => { { startIndex: 45, type: '' }, { startIndex: 48, type: 'punctuation.curly.sass' }, { startIndex: 49, type: '' }, - { startIndex: 50, type: 'support.type.property-name.sass' }, + { startIndex: 50, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 58, type: '' }, { startIndex: 59, type: 'constant.numeric.sass' }, { startIndex: 60, type: 'punctuation.sass' }, @@ -1662,7 +1663,7 @@ suite('Sass Colorizer', () => { { startIndex: 70, type: '' }, { startIndex: 71, type: 'punctuation.curly.sass' }, { startIndex: 72, type: '' }, - { startIndex: 73, type: 'support.type.property-name.sass' }, + { startIndex: 73, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 81, type: '' }, { startIndex: 82, type: 'constant.numeric.sass' }, { startIndex: 83, type: 'punctuation.sass' }, @@ -1671,7 +1672,7 @@ suite('Sass Colorizer', () => { { startIndex: 86, type: '' }, { startIndex: 87, type: 'punctuation.curly.sass' }, { startIndex: 88, type: '' }, - { startIndex: 89, type: 'keyword.control.at-rule.sass' }, + { startIndex: 89, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 104, type: '' }, { startIndex: 105, type: 'support.function.name.sass' }, { startIndex: 124, type: '' }, @@ -1681,7 +1682,7 @@ suite('Sass Colorizer', () => { { startIndex: 131, type: '' }, { startIndex: 134, type: 'punctuation.curly.sass' }, { startIndex: 135, type: '' }, - { startIndex: 136, type: 'support.type.property-name.sass' }, + { startIndex: 136, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 144, type: '' }, { startIndex: 145, type: 'constant.numeric.sass' }, { startIndex: 146, type: 'punctuation.sass' }, @@ -1692,7 +1693,7 @@ suite('Sass Colorizer', () => { { startIndex: 156, type: '' }, { startIndex: 157, type: 'punctuation.curly.sass' }, { startIndex: 158, type: '' }, - { startIndex: 159, type: 'support.type.property-name.sass' }, + { startIndex: 159, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 167, type: '' }, { startIndex: 168, type: 'constant.numeric.sass' }, { startIndex: 169, type: 'punctuation.sass' }, @@ -1701,7 +1702,7 @@ suite('Sass Colorizer', () => { { startIndex: 172, type: '' }, { startIndex: 173, type: 'punctuation.curly.sass' }, { startIndex: 174, type: '' }, - { startIndex: 175, type: 'keyword.control.at-rule.sass' }, + { startIndex: 175, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 188, type: '' }, { startIndex: 189, type: 'support.function.name.sass' }, { startIndex: 208, type: '' }, @@ -1711,7 +1712,7 @@ suite('Sass Colorizer', () => { { startIndex: 215, type: '' }, { startIndex: 218, type: 'punctuation.curly.sass' }, { startIndex: 219, type: '' }, - { startIndex: 220, type: 'support.type.property-name.sass' }, + { startIndex: 220, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 228, type: '' }, { startIndex: 229, type: 'constant.numeric.sass' }, { startIndex: 230, type: 'punctuation.sass' }, @@ -1722,7 +1723,7 @@ suite('Sass Colorizer', () => { { startIndex: 240, type: '' }, { startIndex: 241, type: 'punctuation.curly.sass' }, { startIndex: 242, type: '' }, - { startIndex: 243, type: 'support.type.property-name.sass' }, + { startIndex: 243, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 251, type: '' }, { startIndex: 252, type: 'constant.numeric.sass' }, { startIndex: 253, type: 'punctuation.sass' }, @@ -1731,7 +1732,7 @@ suite('Sass Colorizer', () => { { startIndex: 256, type: '' }, { startIndex: 257, type: 'punctuation.curly.sass' }, { startIndex: 258, type: '' }, - { startIndex: 259, type: 'keyword.control.at-rule.sass' }, + { startIndex: 259, type: cssTokenTypes.TOKEN_AT_KEYWORD + '.sass' }, { startIndex: 269, type: '' }, { startIndex: 270, type: 'support.function.name.sass' }, { startIndex: 289, type: '' }, @@ -1741,7 +1742,7 @@ suite('Sass Colorizer', () => { { startIndex: 296, type: '' }, { startIndex: 299, type: 'punctuation.curly.sass' }, { startIndex: 300, type: '' }, - { startIndex: 301, type: 'support.type.property-name.sass' }, + { startIndex: 301, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 309, type: '' }, { startIndex: 310, type: 'constant.numeric.sass' }, { startIndex: 311, type: 'punctuation.sass' }, @@ -1752,7 +1753,7 @@ suite('Sass Colorizer', () => { { startIndex: 321, type: '' }, { startIndex: 322, type: 'punctuation.curly.sass' }, { startIndex: 323, type: '' }, - { startIndex: 324, type: 'support.type.property-name.sass' }, + { startIndex: 324, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 332, type: '' }, { startIndex: 333, type: 'constant.numeric.sass' }, { startIndex: 334, type: 'punctuation.sass' }, @@ -1767,17 +1768,17 @@ suite('Sass Colorizer', () => { line: '[data-icon=\'test-1\']:before {\n content:\'\\\\\';\n}\n/* a comment */\n$var1: \'\\\'\';\n$var2: "\\"";\n/* another comment */', tokens: [ { startIndex: 0, type: 'punctuation.bracket.sass' }, - { startIndex: 1, type: 'meta.property-value.sass' }, + { startIndex: 1, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex: 10, type: 'keyword.operator.sass' }, { startIndex: 11, type: 'string.punctuation.sass' }, { startIndex: 12, type: 'string.sass' }, { startIndex: 18, type: 'string.punctuation.sass' }, { startIndex: 19, type: 'punctuation.bracket.sass' }, - { startIndex: 20, type: 'entity.other.attribute-name.sass' }, + { startIndex: 20, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex: 27, type: '' }, { startIndex: 28, type: 'punctuation.curly.sass' }, { startIndex: 29, type: '' }, - { startIndex: 32, type: 'support.type.property-name.sass' }, + { startIndex: 32, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 40, type: 'string.punctuation.sass' }, { startIndex: 41, type: 'string.sass' }, { startIndex: 43, type: 'string.punctuation.sass' }, @@ -1813,7 +1814,7 @@ suite('Sass Colorizer', () => { line: ' _content: "";', tokens: [ { startIndex: 0, type: '' }, - { startIndex: 2, type: 'support.type.property-name.sass' }, + { startIndex: 2, type: cssTokenTypes.TOKEN_PROPERTY + '.sass' }, { startIndex: 11, type: '' }, { startIndex: 12, type: 'string.punctuation.sass' }, { startIndex: 13, type: 'string.punctuation.sass' }, @@ -1826,12 +1827,12 @@ suite('Sass Colorizer', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: 'input[type= \\"submit\\"', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.sass' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex:5, type: 'punctuation.bracket.sass'}, - { startIndex:6, type: 'meta.property-value.sass' }, + { startIndex:6, type: cssTokenTypes.TOKEN_VALUE + '.sass' }, { startIndex:10, type: 'keyword.operator.sass'}, { startIndex:11, type: ''}, - { startIndex:12, type: 'meta.property-value.sass'} + { startIndex:12, type: cssTokenTypes.TOKEN_VALUE + '.sass'} ]} ]); }); @@ -1840,13 +1841,13 @@ suite('Sass Colorizer', () => { modesUtil.assertTokenization(tokenizationSupport, [{ line: '.\\34 hello { -moz-foo: --myvar }', tokens: [ - { startIndex:0, type: 'entity.other.attribute-name.sass' }, + { startIndex:0, type: cssTokenTypes.TOKEN_SELECTOR + '.sass' }, { startIndex:10, type: ''}, { startIndex:11, type: 'punctuation.curly.sass'}, { startIndex:12, type: ''}, - { startIndex:13, type: 'support.type.property-name.sass'}, + { startIndex:13, type: cssTokenTypes.TOKEN_PROPERTY + '.sass'}, { startIndex:22, type: ''}, - { startIndex:23, type: 'meta.property-value.sass'}, + { startIndex:23, type: cssTokenTypes.TOKEN_VALUE + '.sass'}, { startIndex:30, type: ''}, { startIndex:31, type: 'punctuation.curly.sass'}, ]} diff --git a/src/vs/languages/typescript.workbench/common/projectResolver.ts b/src/vs/languages/typescript.workbench/common/projectResolver.ts index 5d66f5ec8e5..fa5ec56aa92 100644 --- a/src/vs/languages/typescript.workbench/common/projectResolver.ts +++ b/src/vs/languages/typescript.workbench/common/projectResolver.ts @@ -137,7 +137,7 @@ class ProjectResolver implements typescript.IProjectResolver2 { this._consumer = consumer; this._configuration = configuration; - this._fileChangesHandler = new async.RunOnceScheduler(this._processFileChangesEvents.bind(this), 1500); + this._fileChangesHandler = new async.RunOnceScheduler(this._processFileChangesEvents.bind(this), 1000); this._unbindListener = this._eventService.addListener(Files.EventType.FILE_CHANGES, this._onFileChangesEvent.bind(this)); } @@ -291,7 +291,7 @@ class ProjectResolver implements typescript.IProjectResolver2 { includePattern[globPattern] = true; let excludePattern: glob.IExpression = Object.create(null); - excludePattern['{**/node_modules/**,**/.git/**,**/bower_components/**,**/tmp/**,**/temp**}'] = true; + excludePattern['{**/node_modules/**,**/.git/**,**/bower_components/**,**/tmp/**,**/temp/**}'] = true; // add custom exclude patterns if(Array.isArray(excludes)) { @@ -554,7 +554,6 @@ class ProjectResolver implements typescript.IProjectResolver2 { namespace glob2 { const prefix1 = '**/*.'; - const prefix2 = '**/'; export function match(pattern: string, path: string): boolean { if (pattern[0] === '{' && pattern[pattern.length - 1] === '}') { @@ -570,19 +569,17 @@ namespace glob2 { let offset = -1; if (pattern.indexOf(prefix1) === 0) { offset = prefix1.length; - } else if (pattern.indexOf(prefix2) === 0) { - offset = prefix2.length; } if (offset === -1) { return glob.match(pattern, path); } let suffix = pattern.substring(offset); - if (suffix.indexOf('*') !== -1) { + if (suffix.match(/[.\\\/*]/)) { return glob.match(pattern, path); } // endWith check - offset = path.indexOf(suffix); + offset = path.lastIndexOf(suffix); if (offset === -1) { return false; } else { diff --git a/src/vs/languages/typescript.workbench/test/common/projectResolver.test.ts b/src/vs/languages/typescript.workbench/test/common/projectResolver.test.ts index fc695e0f373..1d357b685a5 100644 --- a/src/vs/languages/typescript.workbench/test/common/projectResolver.test.ts +++ b/src/vs/languages/typescript.workbench/test/common/projectResolver.test.ts @@ -62,7 +62,6 @@ function createModelService(): IModelService { onModelAdded: undefined, onModelRemoved: undefined, onModelModeChanged: undefined, - removeModel: undefined, destroyModel: undefined } } diff --git a/src/vs/languages/typescript/common/features/definitions.ts b/src/vs/languages/typescript/common/features/definitions.ts index f04f5ca8371..403dab8823d 100644 --- a/src/vs/languages/typescript/common/features/definitions.ts +++ b/src/vs/languages/typescript/common/features/definitions.ts @@ -30,7 +30,7 @@ export function findDeclaration(project: projectService.IProject, resource: URI, } return { - resource: network.URL.fromValue(info.fileName), + resource: URI.parse(info.fileName), range: project.host.getScriptLineMap(info.fileName).getRangeFromSpan(info.textSpan) }; } diff --git a/src/vs/languages/typescript/common/features/moduleLinks.ts b/src/vs/languages/typescript/common/features/moduleLinks.ts index 9ca91e06387..bbf3c5d44bd 100644 --- a/src/vs/languages/typescript/common/features/moduleLinks.ts +++ b/src/vs/languages/typescript/common/features/moduleLinks.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); import ts = require('vs/languages/typescript/common/lib/typescriptServices'); @@ -104,7 +104,7 @@ export function findLink(sourceFile:ts.SourceFile, filename:string, position:Edi } return { - resource: new network.URL(candidate), + resource: URI.parse(candidate), range: { startLineNumber: 1, startColumn: 1, endLineNumber: Number.MAX_VALUE, endColumn: Number.MAX_VALUE } }; } diff --git a/src/vs/languages/typescript/common/features/quickFix.ts b/src/vs/languages/typescript/common/features/quickFix.ts index b27c13f8b17..b7ebdcd22fd 100644 --- a/src/vs/languages/typescript/common/features/quickFix.ts +++ b/src/vs/languages/typescript/common/features/quickFix.ts @@ -15,7 +15,7 @@ import nls = require('vs/nls'); import arrays = require('vs/base/common/arrays'); import {IMarker} from 'vs/platform/markers/common/markers'; -export function evaluate(languageService: ts.LanguageService, resource: URI, range: EditorCommon.IRange, id: any): Modes.IQuickFixResult { +export function evaluate(languageService: ts.LanguageService, resource: URI, range: EditorCommon.IRange, quickFix: Modes.IQuickFix): Modes.IQuickFixResult { var filename = resource.toString(), sourceFile = languageService.getSourceFile(filename), @@ -26,7 +26,7 @@ export function evaluate(languageService: ts.LanguageService, resource: URI, ran return null; } - var command = JSON.parse(id); + var [command] = quickFix.command.arguments; switch (command.type) { case 'rename': { var start = sourceFile.getLineAndCharacterOfPosition(token.getStart()); @@ -129,9 +129,12 @@ function computeRenameProposals(languageService:ts.LanguageService, resource:URI } fixes.push({ - label: nls.localize('typescript.quickfix.rename', "Rename to '{0}'", entry.name), - id: JSON.stringify({ type: 'rename', name: entry.name }), - score: score + command: { + id: 'ts.renameTo', + title: nls.localize('typescript.quickfix.rename', "Rename to '{0}'", entry.name), + arguments: [{ type: 'rename', name: entry.name }] + }, + score }); } }); @@ -168,7 +171,8 @@ var sinonDD = 'sinon/sinon.d.ts'; var jasmineDD = 'jasmine/jasmine.d.ts'; var handlebarsDD = 'handlebars/handlebars.d.ts'; -var typingsMap: { [key: string]: string | string[] } = { +// exported for tests +export var typingsMap: { [key: string]: string | string[] } = { 'angular': angularDD, '$': jqueryDD, 'jquery': jqueryDD, 'jQuery': jqueryDD, 'process': nodejsDD, '__dirname': nodejsDD, @@ -195,27 +199,33 @@ function computeAddTypeDefinitionProposals(languageService: ts.LanguageService, offset = converter.getOffset(sourceFile, { lineNumber: range.endLineNumber, column: range.endColumn }), token = ts.findTokenOnLeftOfPosition(sourceFile, offset); - if (!token || token.getWidth() === 0) { + if (!token || token.getWidth() === 0 || (network.schemas.inMemory === resource.scheme)) { return; } var currentWord = ts.getTextOfNode(token); - var mapping = typingsMap[currentWord]; - if (mapping && (network.schemas.inMemory !== resource.scheme)) { + if (typingsMap.hasOwnProperty(currentWord)) { + var mapping = typingsMap[currentWord]; var dtsRefs: string[] = Array.isArray(mapping) ? mapping : [ mapping ]; - dtsRefs.forEach((dtsRef) => { + dtsRefs.forEach((dtsRef, idx) => { result.push({ - label: nls.localize('typescript.quickfix.typeDefinitions', "Download type definition {0}", dtsRef.split('/')[1]), - id: JSON.stringify({ type: 'typedefinitions', name: dtsRef }), - score: 1 + command: { + id: 'ts.downloadDts', + title: nls.localize('typescript.quickfix.typeDefinitions', "Download type definition {0}", dtsRef.split('/')[1]), + arguments: [{ type: 'typedefinitions', name: dtsRef }] + }, + score: idx }); }); } - if (strings.endsWith(resource.fsPath, '.js')) { + if (strings.endsWith(resource.path, '.js')) { result.push({ - label: nls.localize('typescript.quickfix.addAsGlobal', "Mark '{0}' as global", currentWord), - id: JSON.stringify({ type: 'addglobal', name: currentWord }), + command: { + id: 'ts.addAsGlobal', + title: nls.localize('typescript.quickfix.addAsGlobal', "Mark '{0}' as global", currentWord), + arguments: [{ type: 'addglobal', name: currentWord }] + }, score: 1 }); } diff --git a/src/vs/languages/typescript/common/features/quickFixMainActions.ts b/src/vs/languages/typescript/common/features/quickFixMainActions.ts index fbc6ac18fb6..603be62fe2d 100644 --- a/src/vs/languages/typescript/common/features/quickFixMainActions.ts +++ b/src/vs/languages/typescript/common/features/quickFixMainActions.ts @@ -5,6 +5,7 @@ 'use strict'; import nls = require('vs/nls'); +import URI from 'vs/base/common/uri'; import network = require('vs/base/common/network'); import strings = require('vs/base/common/strings'); import errors = require('vs/base/common/errors'); @@ -33,8 +34,8 @@ export class QuickFixMainActions { this._contextService = contextService; } - public evaluate(resource: network.URL, range: EditorCommon.IRange, id: any) : winjs.TPromise { - var command = JSON.parse(id); + public evaluate(resource: URI, range: EditorCommon.IRange, quickFix: Modes.IQuickFix) : winjs.TPromise { + var [command] = quickFix.command.arguments; switch (command.type) { case 'typedefinitions': { return this.evaluateAddTypeDefinitionProposal(command.name, resource); @@ -43,12 +44,12 @@ export class QuickFixMainActions { return winjs.Promise.as(null); } - public evaluateAddTypeDefinitionProposal(typingsReference: string, resource: network.URL): winjs.TPromise { + public evaluateAddTypeDefinitionProposal(typingsReference: string, resource: URI): winjs.TPromise { var dtsFile = 'typings/' + typingsReference; var dtsFileResource = this._contextService.toResource(dtsFile); var jsConfigResource = this._contextService.toResource('jsconfig.json'); if (!dtsFileResource || !jsConfigResource) { - return; + return winjs.Promise.as(null); } var resourcePath = this._contextService.toWorkspaceRelativePath(resource); diff --git a/src/vs/languages/typescript/common/features/references.ts b/src/vs/languages/typescript/common/features/references.ts index 114416c6f93..9be3a15f311 100644 --- a/src/vs/languages/typescript/common/features/references.ts +++ b/src/vs/languages/typescript/common/features/references.ts @@ -4,7 +4,6 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import network = require('vs/base/common/network'); import URI from 'vs/base/common/uri'; import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); @@ -31,7 +30,7 @@ export function find(project: projectService.IProject, resource: URI, position: return (includeDecl || !isDeclaration(targetFile, info.textSpan.start)); }).map(info => { var r:Modes.IReference = { - resource: network.URL.fromValue(info.fileName), + resource: URI.parse(info.fileName), range: project.host.getScriptLineMap(info.fileName).getRangeFromSpan(info.textSpan) }; return r; diff --git a/src/vs/languages/typescript/common/features/suggestions.ts b/src/vs/languages/typescript/common/features/suggestions.ts index f145ab78c8b..0552a1d2d97 100644 --- a/src/vs/languages/typescript/common/features/suggestions.ts +++ b/src/vs/languages/typescript/common/features/suggestions.ts @@ -26,7 +26,7 @@ function suggestionHashFn(suggestion:Modes.ISuggestion):string { } export function computeSuggestions(languageService: ts.LanguageService, resource: URI, - position: EditorCommon.IPosition, options: Options): Modes.ISuggestions { + position: EditorCommon.IPosition, options: Options): Modes.ISuggestResult { var filename = resource.toString(), sourceFile = languageService.getSourceFile(filename), diff --git a/src/vs/languages/typescript/common/participants/filenameSuggestions.ts b/src/vs/languages/typescript/common/participants/filenameSuggestions.ts index d653d9f6cc9..8b5200c0a3d 100644 --- a/src/vs/languages/typescript/common/participants/filenameSuggestions.ts +++ b/src/vs/languages/typescript/common/participants/filenameSuggestions.ts @@ -9,7 +9,6 @@ import strings = require('vs/base/common/strings'); import paths = require('vs/base/common/paths'); import collections = require('vs/base/common/collections'); import winjs = require('vs/base/common/winjs.base'); -import network = require('vs/base/common/network'); import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); import ts = require('vs/languages/typescript/common/lib/typescriptServices'); @@ -59,7 +58,7 @@ export class FilenameSuggestions implements Modes.ISuggestParticipant { this._resourceServices = resourceService; } - public suggest(resource: network.URL, position: EditorCommon.IPosition, context?: projectService.ProjectService): winjs.TPromise { + public suggest(resource: URI, position: EditorCommon.IPosition, context?: projectService.ProjectService): winjs.TPromise { if(!(context instanceof projectService.ProjectService)) { return winjs.TPromise.as(null); @@ -76,7 +75,7 @@ export class FilenameSuggestions implements Modes.ISuggestParticipant { var pathMaker = new PathMaker(), quoteCharacter = /^['"]/.test(wordInfo.wordUntilPosition) ? wordInfo.wordUntilPosition[0] : '"'; - var result:Modes.ISuggestions = { + var result:Modes.ISuggestResult = { currentWord: wordInfo.wordUntilPosition, suggestions: [], }; @@ -114,7 +113,7 @@ export class FilenameSuggestions implements Modes.ISuggestParticipant { return winjs.TPromise.as(result); } - private _findCurrentWord(resource:network.URL, position:EditorCommon.IPosition, sourceFile:ts.SourceFile):IPathInfo { + private _findCurrentWord(resource:URI, position:EditorCommon.IPosition, sourceFile:ts.SourceFile):IPathInfo { var mirrorModel = this._resourceServices.get(resource), offset = mirrorModel.getOffsetFromPosition(position), diff --git a/src/vs/languages/typescript/common/project/projectService.ts b/src/vs/languages/typescript/common/project/projectService.ts index c2acea7a7ca..d98593d8b66 100644 --- a/src/vs/languages/typescript/common/project/projectService.ts +++ b/src/vs/languages/typescript/common/project/projectService.ts @@ -369,6 +369,9 @@ export class ProjectService { } _syncProject(kind: typescript.ChangeKind, resource: URI, files: URI[], options: ts.CompilerOptions): void { + + // console.log('SYNC project ', typescript.ChangeKind[kind], resource.fsPath, files.map(f => f.fsPath), options); + var projectFolderName = paths.dirname(resource.fsPath); if (kind === typescript.ChangeKind.Added || kind === typescript.ChangeKind.Changed) { // replace/update the project when it was added/changed diff --git a/src/vs/languages/typescript/common/typescript.ts b/src/vs/languages/typescript/common/typescript.ts index ee48668f239..a7cef06f12c 100644 --- a/src/vs/languages/typescript/common/typescript.ts +++ b/src/vs/languages/typescript/common/typescript.ts @@ -64,7 +64,7 @@ export class DefaultProjectResolver implements IProjectResolver2 { files: [], options: undefined }; - + setConsumer(consumer: IProjectConsumer) { this._consumer = consumer; } @@ -91,7 +91,7 @@ export class DefaultProjectResolver implements IProjectResolver2 { let resource = filePath ? URI.file(filePath) : URI.create('extralib', undefined, Date.now().toString()); - + this._needsProjectUpdate = true; this._projectChange.files.push(resource); this._fileChanges.push({ kind: ChangeKind.Added, resource, content }); diff --git a/src/vs/languages/typescript/common/typescriptMode.ts b/src/vs/languages/typescript/common/typescriptMode.ts index 85fcf70b604..12b2d760135 100644 --- a/src/vs/languages/typescript/common/typescriptMode.ts +++ b/src/vs/languages/typescript/common/typescriptMode.ts @@ -7,7 +7,6 @@ import * as nls from 'vs/nls'; import WinJS = require('vs/base/common/winjs.base'); import URI from 'vs/base/common/uri'; -import Network = require('vs/base/common/network'); import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); import lifecycle = require('vs/base/common/lifecycle'); @@ -406,32 +405,32 @@ export class TypeScriptMode extend } static $getOutline = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.getOutline, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group1); - public getOutline(resource:Network.URL):WinJS.TPromise { + public getOutline(resource:URI):WinJS.TPromise { return this._worker((w) => w.getOutline(resource)); } static $findOccurrences = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.findOccurrences, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group2); - public findOccurrences(resource:Network.URL, position:EditorCommon.IPosition, strict:boolean = false): WinJS.TPromise { + public findOccurrences(resource:URI, position:EditorCommon.IPosition, strict:boolean = false): WinJS.TPromise { return this._worker((w) => w.findOccurrences(resource, position, strict)); } static $suggest = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.suggest, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group2); - public suggest(resource:Network.URL, position:EditorCommon.IPosition):WinJS.TPromise { + public suggest(resource:URI, position:EditorCommon.IPosition):WinJS.TPromise { return this._worker((w) => w.suggest(resource, position)); } static $getSuggestionDetails = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.getSuggestionDetails, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group2); - public getSuggestionDetails(resource:Network.URL, position:EditorCommon.IPosition, suggestion:Modes.ISuggestion):WinJS.TPromise { + public getSuggestionDetails(resource:URI, position:EditorCommon.IPosition, suggestion:Modes.ISuggestion):WinJS.TPromise { return this._worker((w) => w.getSuggestionDetails(resource, position, suggestion)); } static $getParameterHints = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.getParameterHints, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group2); - public getParameterHints(resource:Network.URL, position:EditorCommon.IPosition):WinJS.TPromise { + public getParameterHints(resource:URI, position:EditorCommon.IPosition):WinJS.TPromise { return this._worker((w) => w.getParameterHints(resource, position)); } static $getEmitOutput = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.getEmitOutput, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group3); - public getEmitOutput(resource:Network.URL, type:string = undefined):WinJS.Promise { + public getEmitOutput(resource:URI, type:string = undefined):WinJS.Promise { return this._worker((w) => w.getEmitOutput(resource, type)); } @@ -441,7 +440,7 @@ export class TypeScriptMode extend } static $findReferences = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.findReferences, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group3); - public findReferences(resource:Network.URL, position:EditorCommon.IPosition, includeDeclaration:boolean):WinJS.TPromise { + public findReferences(resource:URI, position:EditorCommon.IPosition, includeDeclaration:boolean):WinJS.TPromise { return this._worker((w) => w.findReferences(resource, position, includeDeclaration)); } @@ -454,7 +453,7 @@ export class TypeScriptMode extend return this._worker(w => w.rename(resource, position, newName)); } - public runQuickFixAction(resource: Network.URL, range: EditorCommon.IRange, id: any): WinJS.TPromise { + public runQuickFixAction(resource: URI, range: EditorCommon.IRange, id: any): WinJS.TPromise { var quickFixMainSupport = this._instantiationService.createInstance(quickFixMainActions.QuickFixMainActions); return quickFixMainSupport.evaluate(resource, range, id).then((action) => { if (action) { @@ -465,27 +464,27 @@ export class TypeScriptMode extend } static $runQuickFixActionInWorker = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.runQuickFixActionInWorker, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group2); - public runQuickFixActionInWorker(resource: Network.URL, range: EditorCommon.IRange, id: any): WinJS.TPromise { + public runQuickFixActionInWorker(resource: URI, range: EditorCommon.IRange, id: any): WinJS.TPromise { return this._worker((w) => w.runQuickFixAction(resource, range, id)); } static $getQuickFixes = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.getQuickFixes, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group2); - public getQuickFixes(resource:Network.URL, range: IMarker | EditorCommon.IRange):WinJS.TPromise { + public getQuickFixes(resource: URI, range: IMarker | EditorCommon.IRange):WinJS.TPromise { return this._worker((w) => w.getQuickFixes(resource, range)); } static $getRangesToPosition = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.getRangesToPosition, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group1); - public getRangesToPosition(resource:Network.URL, position:EditorCommon.IPosition):WinJS.TPromise { + public getRangesToPosition(resource: URI, position:EditorCommon.IPosition):WinJS.TPromise { return this._worker((w) => w.getRangesToPosition(resource, position)); } static $findDeclaration = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.findDeclaration, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group2); - public findDeclaration(resource:Network.URL, position:any):WinJS.TPromise { + public findDeclaration(resource: URI, position:any):WinJS.TPromise { return this._worker((w) => w.findDeclaration(resource, position)); } static $computeInfo = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.computeInfo, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group2); - public computeInfo(resource:Network.URL, position:EditorCommon.IPosition): WinJS.TPromise { + public computeInfo(resource: URI, position:EditorCommon.IPosition): WinJS.TPromise { return this._worker((w) => w.computeInfo(resource, position)); } @@ -494,17 +493,17 @@ export class TypeScriptMode extend } static $formatDocument = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.formatDocument, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group1); - public formatDocument(resource:Network.URL, options:Modes.IFormattingOptions):WinJS.TPromise { + public formatDocument(resource: URI, options:Modes.IFormattingOptions):WinJS.TPromise { return this._worker((w) => w.formatDocument(resource, options)); } static $formatRange = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.formatRange, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group1); - public formatRange(resource:Network.URL, range:EditorCommon.IRange, options:Modes.IFormattingOptions):WinJS.TPromise { + public formatRange(resource: URI, range:EditorCommon.IRange, options:Modes.IFormattingOptions):WinJS.TPromise { return this._worker((w) => w.formatRange(resource, range, options)); } static $formatAfterKeystroke = OneWorkerAttr(TypeScriptMode, TypeScriptMode.prototype.formatAfterKeystroke, TypeScriptMode.prototype._syncProjects, ThreadAffinity.Group1); - public formatAfterKeystroke(resource:Network.URL, position:EditorCommon.IPosition, ch: string, options:Modes.IFormattingOptions):WinJS.TPromise { + public formatAfterKeystroke(resource: URI, position:EditorCommon.IPosition, ch: string, options:Modes.IFormattingOptions):WinJS.TPromise { return this._worker((w) => w.formatAfterKeystroke(resource, position, ch, options)); } } diff --git a/src/vs/languages/typescript/common/typescriptWorker2.ts b/src/vs/languages/typescript/common/typescriptWorker2.ts index 17edcdf8eb8..f6169dd1a81 100644 --- a/src/vs/languages/typescript/common/typescriptWorker2.ts +++ b/src/vs/languages/typescript/common/typescriptWorker2.ts @@ -7,7 +7,6 @@ import winjs = require('vs/base/common/winjs.base'); import paths = require('vs/base/common/paths'); import URI from 'vs/base/common/uri'; -import network = require('vs/base/common/network'); import lifecycle = require('vs/base/common/lifecycle'); import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); @@ -154,7 +153,7 @@ export class TypeScriptWorker2 extends AbstractModeWorker { return new supports.WorkerInplaceReplaceSupport(this.resourceService, this); } - public doValidate(resource: network.URL): void { + public doValidate(resource: URI): void { var project = this._projectService.getProject(resource); var markers: IMarker[] = []; markers.push.apply(markers, diagnostics.getSyntacticDiagnostics(project.languageService, resource, project.host.getCompilationSettings(), @@ -183,7 +182,7 @@ export class TypeScriptWorker2 extends AbstractModeWorker { return null; } - public doSuggest(resource: URI, position: EditorCommon.IPosition): winjs.TPromise { + public doSuggest(resource: URI, position: EditorCommon.IPosition): winjs.TPromise { var project = this._projectService.getProject(resource); var result = suggestions.computeSuggestions(project.languageService, resource, position, this._options); @@ -227,7 +226,7 @@ export class TypeScriptWorker2 extends AbstractModeWorker { return winjs.TPromise.as(result); } - public findDeclaration(resource:network.URL, position:EditorCommon.IPosition):winjs.TPromise { + public findDeclaration(resource: URI, position:EditorCommon.IPosition):winjs.TPromise { // return winjs.TPromise.join([ // this._findLinkTarget(resource, position), // this._findTypeScriptDeclaration(resource, position) diff --git a/src/vs/languages/typescript/test/common/features/logicalSelection.test.ts b/src/vs/languages/typescript/test/common/features/logicalSelection.test.ts index 8561172b2e4..f84540f5fce 100644 --- a/src/vs/languages/typescript/test/common/features/logicalSelection.test.ts +++ b/src/vs/languages/typescript/test/common/features/logicalSelection.test.ts @@ -5,9 +5,9 @@ 'use strict'; import assert = require('assert'); +import URI from 'vs/base/common/uri'; import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); -import network = require('vs/base/common/network'); import logicalSelection = require('vs/languages/typescript/common/features/logicalSelection'); import ts = require('vs/languages/typescript/common/lib/typescriptServices'); import utils = require('vs/languages/typescript/test/common/features/utils'); @@ -19,7 +19,7 @@ suite('TS - logical selection', () => { var host = new utils.LanguageServiceHost().add('a', code), languageService = ts.createLanguageService(host, ts.createDocumentRegistry()); - var elements = logicalSelection.compute(languageService, network.URL.fromValue('a'), { lineNumber: line, column: position }); + var elements = logicalSelection.compute(languageService, URI.parse('a'), { lineNumber: line, column: position }); try { callback(elements); diff --git a/src/vs/languages/typescript/test/common/features/outline.test.ts b/src/vs/languages/typescript/test/common/features/outline.test.ts index c6fa048c591..94f73c25cfa 100644 --- a/src/vs/languages/typescript/test/common/features/outline.test.ts +++ b/src/vs/languages/typescript/test/common/features/outline.test.ts @@ -7,7 +7,7 @@ import assert = require('assert'); import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); -import network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import outline = require('vs/languages/typescript/common/features/outline'); import ts = require('vs/languages/typescript/common/lib/typescriptServices'); import utils = require('vs/languages/typescript/test/common/features/utils'); @@ -17,7 +17,7 @@ suite('TS - outline', () => { function assertOutline(code:string, callback:(outline:Modes.IOutlineEntry[])=>any):void { var host = new utils.LanguageServiceHost().add('a', code); - var elements = outline.compute(ts.createLanguageService(host, ts.createDocumentRegistry()), network.URL.fromValue('a')); + var elements = outline.compute(ts.createLanguageService(host, ts.createDocumentRegistry()), URI.parse('a')); try { callback(elements); diff --git a/src/vs/languages/typescript/test/common/features/quickfix.test.ts b/src/vs/languages/typescript/test/common/features/quickfix.test.ts index bc4d1598147..45f7c151b29 100644 --- a/src/vs/languages/typescript/test/common/features/quickfix.test.ts +++ b/src/vs/languages/typescript/test/common/features/quickfix.test.ts @@ -7,7 +7,7 @@ import assert = require('assert'); import EditorCommon = require('vs/editor/common/editorCommon'); import Modes = require('vs/editor/common/modes'); -import network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import quickfix = require('vs/languages/typescript/common/features/quickFix'); import diagnostics = require('vs/languages/typescript/common/features/diagnostics'); import ts = require('vs/languages/typescript/common/lib/typescriptServices'); @@ -16,29 +16,72 @@ import Options = require('vs/languages/typescript/common/options'); suite('TS - quick fix', () => { - function assertQuickFix(code: string, callback: (outline: Modes.IQuickFix[]) => any): void { - var fileName = 'a.ts'; - var host = new utils.LanguageServiceHost().add(fileName, code); + function assertQuickFix(code: string, fileName: string, callback: (outline: Modes.IQuickFix[]) => any): void { + var filePath = 'file://test/' + fileName; + var fileURL = URI.parse(filePath); + var host = new utils.LanguageServiceHost().add(filePath, code); var service = ts.createLanguageService(host, ts.createDocumentRegistry()); - var markers = diagnostics.getSemanticDiagnostics(service, network.URL.fromValue(fileName), Options.typeScriptOptions).markers; + var markers = diagnostics.getSemanticDiagnostics(service, fileURL, Options.typeScriptOptions).markers; assert.equal(markers.length, 1); var marker = markers[0]; - var elements = quickfix.compute(service, network.URL.fromValue(fileName), marker); + var elements = quickfix.compute(service, fileURL, marker); - try { - callback(elements); - } catch(e) { - assert.ok(false, e); - } + callback(elements); } test('quickfix', function() { - assertQuickFix('class C { private hello = 0; private world = this.hell0; }', (elements) => { + assertQuickFix('class C { private hello = 0; private world = this.hell0; }', 'a.ts', (elements) => { assert.equal(elements.length, 1); - assert.equal(elements[0].label, "Rename to 'hello'"); + assert.equal(elements[0].command.title, "Rename to 'hello'"); + }); + + assertQuickFix('_.foo();', 'a.ts', (elements) => { + assert.equal(elements.length, 2); + assert.equal(elements[0].command.title, "Download type definition underscore.d.ts"); + assert.equal(elements[1].command.title, "Download type definition lodash.d.ts"); + }); + + assertQuickFix('describe("x");', 'a.js', (elements) => { + assert.equal(elements.length, 3); + assert.equal(elements[0].command.title, "Download type definition mocha.d.ts"); + assert.equal(elements[1].command.title, "Download type definition jasmine.d.ts"); + assert.equal(elements[2].command.title, "Mark 'describe' as global"); + }); + + assertQuickFix('angular.foo = 1;', 'a.ts', (elements) => { + assert.equal(elements.length, 1); + assert.equal(elements[0].command.title, "Download type definition angular.d.ts"); + }); + + assertQuickFix('var x = __dirname;', 'a.ts', (elements) => { + assert.equal(elements.length, 1); + assert.equal(elements[0].command.title, "Download type definition node.d.ts"); + }); + + assertQuickFix('ko.observable(null);', 'a.ts', (elements) => { + assert.equal(elements.length, 1); + assert.equal(elements[0].command.title, "Download type definition knockout.d.ts"); + }); + + for (var id in quickfix.typingsMap) { + assertQuickFix(id + '.foo();', 'a.ts', (elements) => { + var value = quickfix.typingsMap[id]; + var length = Array.isArray(value) ? value.length : 1; + assert.equal(elements.length, length); + }); + } + + assertQuickFix('foo.observable(null);', 'a.js', (elements) => { + assert.equal(elements.length, 1); + assert.equal(elements[0].command.title, "Mark 'foo' as global"); + }); + + assertQuickFix('toString();', 'a.js', (elements) => { + assert.equal(elements.length, 1); + assert.equal(elements[0].command.title, "Mark 'toString' as global"); }); }); diff --git a/src/vs/languages/typescript/test/common/participants/filenameSuggestions.test.ts b/src/vs/languages/typescript/test/common/participants/filenameSuggestions.test.ts index cc0273ac934..f9efbcb2010 100644 --- a/src/vs/languages/typescript/test/common/participants/filenameSuggestions.test.ts +++ b/src/vs/languages/typescript/test/common/participants/filenameSuggestions.test.ts @@ -5,7 +5,7 @@ 'use strict'; import assert = require('assert'); -import network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import uri from 'vs/base/common/uri'; import filenameSuggestions = require('vs/languages/typescript/common/participants/filenameSuggestions'); import modelMirror = require('vs/editor/common/model/mirrorModel'); @@ -14,8 +14,8 @@ import modesUtil = require('vs/editor/test/common/modesTestUtils'); suite('TS/JS* - Filename Suggest', () => { - var jsModel = modelMirror.createMirrorModelFromString(null, 1, 'var a = require("module/path");', modesUtil.createMockMode('mock.mode.id'), network.URL.fromValue('http://test/async.js')); - var tsModel = modelMirror.createMirrorModelFromString(null, 1, 'import a = require("module/path");', modesUtil.createMockMode('mock.mode.id'), network.URL.fromValue('http://test/async.ts')); + var jsModel = modelMirror.createMirrorModelFromString(null, 1, 'var a = require("module/path");', modesUtil.createMockMode('mock.mode.id'), URI.parse('http://test/async.js')); + var tsModel = modelMirror.createMirrorModelFromString(null, 1, 'import a = require("module/path");', modesUtil.createMockMode('mock.mode.id'), URI.parse('http://test/async.ts')); var _resourceService = new resourceService.ResourceService(); _resourceService.insert(jsModel.getAssociatedResource(), jsModel); diff --git a/src/vs/languages/vsxml/common/vsxmlTokenTypes.ts b/src/vs/languages/vsxml/common/vsxmlTokenTypes.ts index f0ddbcb916c..ee4602cdb9c 100644 --- a/src/vs/languages/vsxml/common/vsxmlTokenTypes.ts +++ b/src/vs/languages/vsxml/common/vsxmlTokenTypes.ts @@ -4,5 +4,5 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -export const TOKEN_VALUE = 'meta.property-value.constant.other.json'; +export const TOKEN_VALUE = 'support.property-value.constant.other.json'; export const TOKEN_KEY = 'support.type.property-name.json'; \ No newline at end of file diff --git a/src/vs/loader.js b/src/vs/loader.js index 75b0afb92fb..0145cb85e37 100644 --- a/src/vs/loader.js +++ b/src/vs/loader.js @@ -2,6 +2,17 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + * Please make sure to make edits in the .ts file at https://github.com/Microsoft/vscode-loader/ + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------*/ /// 'use strict'; // Limitation: To load jquery through the loader, always require 'jquery' and add a path for it in the loader configuration @@ -1081,7 +1092,9 @@ var AMDLoader; } else { if (this._queuedDefineCalls.length === 0) { - console.warn('No define call received from module ' + id + '. This might be a problem.'); + // Loaded a file and it didn't call `define` + this._loadingScriptsCount++; + this._onLoadError(id, new Error('No define call received from module ' + id + '.')); } else { // Consume queue until first anonymous define call @@ -1717,7 +1730,7 @@ var AMDLoader; recorder.record(LoaderEventType.NodeBeginEvaluatingScript, scriptSrc); var vmScriptSrc = _this._path.normalize(scriptSrc); // Make the script src friendly towards electron - if (isAtomRenderer) { + if (isElectronRenderer) { var driveLetterMatch = vmScriptSrc.match(/^([a-z])\:(.*)/); if (driveLetterMatch) { vmScriptSrc = driveLetterMatch[1].toUpperCase() + ':' + driveLetterMatch[2]; @@ -1825,11 +1838,11 @@ var AMDLoader; }; return RequireFunc; })(); - var global = _amdLoaderGlobal, hasPerformanceNow = (global.performance && typeof global.performance.now === 'function'), isWebWorker, isAtomRenderer, isAtomMain, isNode, scriptLoader, moduleManager, loaderAvailableTimestamp; + var global = _amdLoaderGlobal, hasPerformanceNow = (global.performance && typeof global.performance.now === 'function'), isWebWorker, isElectronRenderer, isElectronMain, isNode, scriptLoader, moduleManager, loaderAvailableTimestamp; function initVars() { isWebWorker = (typeof global.importScripts === 'function'); - isAtomRenderer = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions['electron'] !== 'undefined' && process.type === 'renderer'); - isAtomMain = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions['electron'] !== 'undefined' && process.type === 'browser'); + isElectronRenderer = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions['electron'] !== 'undefined' && process.type === 'renderer'); + isElectronMain = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions['electron'] !== 'undefined' && process.type === 'browser'); isNode = (typeof module !== 'undefined' && !!module.exports); if (isWebWorker) { scriptLoader = new OnlyOnceScriptLoader(new WorkerScriptLoader()); @@ -1893,7 +1906,7 @@ var AMDLoader; global.nodeRequire = nodeRequire; RequireFunc.nodeRequire = nodeRequire; } - if (isNode && !isAtomRenderer) { + if (isNode && !isElectronRenderer) { module.exports = RequireFunc; // These two defs are fore the local closure defined in node in the case that the loader is concatenated define = function () { @@ -1906,7 +1919,7 @@ var AMDLoader; if (typeof global.require !== 'undefined' && typeof global.require !== 'function') { RequireFunc.config(global.require); } - if (!isAtomRenderer) { + if (!isElectronRenderer) { global.define = DefineFunc; } else { diff --git a/src/vs/nls.js b/src/vs/nls.js index d42263bc425..3687ff29b8a 100644 --- a/src/vs/nls.js +++ b/src/vs/nls.js @@ -2,6 +2,17 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + * Please make sure to make edits in the .ts file at https://github.com/Microsoft/vscode-loader/ + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------*/ /// /// 'use strict'; @@ -11,7 +22,7 @@ var NLSLoaderPlugin; var global = _nlsPluginGlobal; var Resources = global.Plugin && global.Plugin.Resources ? global.Plugin.Resources : undefined; var DEFAULT_TAG = 'i-default'; - var IS_PSEUDO = (global && global.document && global.document.URL.match(/[^\?]*\?[^\#]*pseudo=true/)); + var IS_PSEUDO = (global && global.document && global.document.location && global.document.location.hash.indexOf('pseudo=true') >= 0); var slice = Array.prototype.slice; function _format(message, args) { var result; diff --git a/src/vs/platform/actions/common/actionsService.ts b/src/vs/platform/actions/common/actionsService.ts index f36f506668c..06d63b3b8bb 100644 --- a/src/vs/platform/actions/common/actionsService.ts +++ b/src/vs/platform/actions/common/actionsService.ts @@ -116,7 +116,7 @@ export default class ActionsService implements IActionsService { let label = command.category ? localize('category.label', "{0}: {1}", command.category, command.title) : command.title; let action = new Action(command.command, label, undefined, true, () => { return this._pluginService.activateByEvent(activationEvent).then(() => { - this._keybindingsService.executeCommand(command.command); + return this._keybindingsService.executeCommand(command.command); }); }); this._extensionsActions.push(action); diff --git a/src/vs/platform/configuration/common/configurationRegistry.ts b/src/vs/platform/configuration/common/configurationRegistry.ts index e19f3f27c5d..04344f928b3 100644 --- a/src/vs/platform/configuration/common/configurationRegistry.ts +++ b/src/vs/platform/configuration/common/configurationRegistry.ts @@ -38,7 +38,7 @@ export interface IConfigurationRegistry { getConfigurations(): IConfigurationNode[]; } -export interface IConfigurationNode extends IJSONSchema { +export interface IConfigurationNode { id?: string; order?: number; type?: string; @@ -47,8 +47,6 @@ export interface IConfigurationNode extends IJSONSchema { default?: any; properties?: { [path: string]: IJSONSchema; }; allOf?: IJSONSchema[]; - workspace?: boolean; - container?: boolean; definitions?: { [path: string]: IJSONSchema; }; } @@ -99,26 +97,41 @@ platform.Registry.add(Extensions.Configuration, configurationRegistry); let configurationExtPoint = PluginsRegistry.registerExtensionPoint('configuration', { description: nls.localize('vscode.extension.contributes.configuration', 'Contributes configuration settings.'), type: 'object', - default: { title: '', type: 'object', properties: {}}, + default: { title: '', properties: {}}, properties: { title: { description: nls.localize('vscode.extension.contributes.configuration.title', 'A summary of the settings. This label will be used in the settings file as separating comment.'), type: 'string' }, - type: { - description: nls.localize('vscode.extension.contributes.configuration.type', 'Type of the configuration, needs to be \'object\''), - enum: ['object'], - }, properties: { description: nls.localize('vscode.extension.contributes.configuration.properties', 'Description of the configuration properties.'), - type: 'object' + type: 'object', + additionalProperties: { + $ref: 'http://json-schema.org/draft-04/schema#' + } } } }); configurationExtPoint.setHandler((extensions) => { for (var i = 0; i < extensions.length; i++) { - var configuration = extensions[i].value; + var configuration = extensions[i].value; + var collector = extensions[i].collector; + + if (configuration.type && configuration.type !== 'object') { + collector.warn(nls.localize('invalid.type', "if set, 'configuration.type' must be set to 'object")); + } else { + configuration.type = 'object'; + } + + if (configuration.title && (typeof configuration.title !== 'string')) { + collector.error(nls.localize('invalid.title', "'configuration.title' must be a string")); + } + + if (configuration.properties && (typeof configuration.properties !== 'object') ) { + collector.error(nls.localize('invalid.properties', "'configuration.properties' must be an object")); + return; + } var clonedConfiguration = objects.clone(configuration); clonedConfiguration.id = extensions[i].description.id; configurationRegistry.registerConfiguration(clonedConfiguration); diff --git a/src/vs/platform/configuration/common/model.ts b/src/vs/platform/configuration/common/model.ts index 79bbc3c94e6..d1e4105a00f 100644 --- a/src/vs/platform/configuration/common/model.ts +++ b/src/vs/platform/configuration/common/model.ts @@ -122,9 +122,6 @@ function processDefaultValues(withConfig: (config: configurationRegistry.IConfig var configurations = (platform.Registry.as(configurationRegistry.Extensions.Configuration)).getConfigurations(); - // filter out workspace only settings (e.g. debug, tasks) - configurations = configurations.filter((config) => !config.workspace && !config.container); - var visit = (config: configurationRegistry.IConfigurationNode, isFirst: boolean) => { withConfig(config, isFirst); diff --git a/src/vs/platform/contextview/browser/contextView.ts b/src/vs/platform/contextview/browser/contextView.ts index 894ee4eff0f..0d98de4eb32 100644 --- a/src/vs/platform/contextview/browser/contextView.ts +++ b/src/vs/platform/contextview/browser/contextView.ts @@ -5,9 +5,9 @@ 'use strict'; import Lifecycle = require('vs/base/common/lifecycle'); -import Actions = require('vs/base/common/actions'); +import { IAction } from 'vs/base/common/actions'; import ActionBar = require('vs/base/browser/ui/actionbar/actionbar'); -import winjs = require('vs/base/common/winjs.base'); +import { TPromise } from 'vs/base/common/winjs.base'; import {Keybinding} from 'vs/base/common/keyCodes'; import {createDecorator, ServiceIdentifier} from 'vs/platform/instantiation/common/instantiation'; @@ -37,10 +37,10 @@ export interface IContextMenuService { export interface IContextMenuDelegate { getAnchor():HTMLElement|{x: number; y: number; } - getActions(): winjs.Promise; - getActionItem?(action: Actions.IAction): ActionBar.IActionItem; + getActions(): TPromise; + getActionItem?(action: IAction): ActionBar.IActionItem; getActionsContext?():any; - getKeyBinding?(action: Actions.IAction): Keybinding; + getKeyBinding?(action: IAction): Keybinding; getMenuClassName?():string; onHide?(didCancel: boolean): void; } diff --git a/src/vs/platform/keybinding/browser/keybindingServiceImpl.ts b/src/vs/platform/keybinding/browser/keybindingServiceImpl.ts index af0ccb3dd24..f126afc309b 100644 --- a/src/vs/platform/keybinding/browser/keybindingServiceImpl.ts +++ b/src/vs/platform/keybinding/browser/keybindingServiceImpl.ts @@ -118,6 +118,10 @@ export class AbstractKeybindingService { this.getContext(this._myContextId).removeValue(key); } + public getLabelFor(keybinding:Keybinding): string { + throw new Error('Not implemented'); + } + public customKeybindingsCount(): number { throw new Error('Not implemented'); } @@ -142,7 +146,7 @@ export class AbstractKeybindingService { throw new Error('Not implemented'); } - public executeCommand(commandId: string, args:any): void { + public executeCommand(commandId: string, args:any): TPromise { throw new Error('Not implemented'); } } @@ -181,6 +185,10 @@ export class KeybindingService extends AbstractKeybindingService implements IKey this._toDispose = null; } + public getLabelFor(keybinding:Keybinding): string { + return keybinding._toUSLabel(); + } + protected updateResolver(): void { this._createOrUpdateResolver(false); } @@ -234,7 +242,7 @@ export class KeybindingService extends AbstractKeybindingService implements IKey e.preventDefault(); this._currentChord = resolveResult.enterChord; if (this._messageService) { - let firstPartLabel = Keybinding.toLabel(this._currentChord); + let firstPartLabel = this.getLabelFor(new Keybinding(this._currentChord)); this._currentChordStatusMessage = this._messageService.setStatusMessage(nls.localize('first.chord', "({0}) was pressed. Waiting for second key of chord...", firstPartLabel)); } return; @@ -242,8 +250,8 @@ export class KeybindingService extends AbstractKeybindingService implements IKey if (this._messageService && this._currentChord) { if (!resolveResult || !resolveResult.commandId) { - let firstPartLabel = Keybinding.toLabel(this._currentChord); - let chordPartLabel = Keybinding.toLabel(e.asKeybinding()); + let firstPartLabel = this.getLabelFor(new Keybinding(this._currentChord)); + let chordPartLabel = this.getLabelFor(new Keybinding(e.asKeybinding())); this._messageService.setStatusMessage(nls.localize('missing.chord', "The key combination ({0}, {1}) is not a command.", firstPartLabel, chordPartLabel), 10 * 1000 /* 10s */); e.preventDefault(); } @@ -300,7 +308,7 @@ export class KeybindingService extends AbstractKeybindingService implements IKey delete this._contexts[String(contextId)]; } - public executeCommand(commandId: string, args:any = {}): any { + public executeCommand(commandId: string, args:any = {}): TPromise { if (!args.context) { var contextId = this._findContextAttr(document.activeElement); var context = this.getContext(contextId); @@ -309,9 +317,7 @@ export class KeybindingService extends AbstractKeybindingService implements IKey args.context = contextValue; } - return this._invokeHandler(commandId, args).done(undefined, err => { - this._messageService.show(Severity.Warning, err); - }); + return this._invokeHandler(commandId, args); } } @@ -332,6 +338,10 @@ class ScopedKeybindingService extends AbstractKeybindingService { this._domNode.removeAttribute(KEYBINDING_CONTEXT_ATTR); } + public getLabelFor(keybinding:Keybinding): string { + return this._parent.getLabelFor(keybinding); + } + public getDefaultKeybindings(): string { return this._parent.getDefaultKeybindings(); } @@ -356,8 +366,8 @@ class ScopedKeybindingService extends AbstractKeybindingService { this._parent.disposeContext(contextId); } - public executeCommand(commandId: string, args:any): void { - this._parent.executeCommand(commandId, args); + public executeCommand(commandId: string, args:any): TPromise { + return this._parent.executeCommand(commandId, args); } } diff --git a/src/vs/platform/keybinding/common/commonKeybindingResolver.ts b/src/vs/platform/keybinding/common/commonKeybindingResolver.ts index c61aa57a480..e0ffc6af39d 100644 --- a/src/vs/platform/keybinding/common/commonKeybindingResolver.ts +++ b/src/vs/platform/keybinding/common/commonKeybindingResolver.ts @@ -404,15 +404,7 @@ export class IOSupport { } private static writeKeybinding(input: number): string { - var r = Keybinding.toUserSettingsLabel(input).toLowerCase().replace(/arrow/g, ''); - - if (Platform.isMacintosh) { - r = r.replace(/meta/g, 'cmd'); - } else if (Platform.isWindows) { - r = r.replace(/meta/g, 'win'); - } - - return r; + return Keybinding.toUserSettingsLabel(input); } public static readKeybinding(input: string): number { diff --git a/src/vs/platform/keybinding/common/keybindingService.ts b/src/vs/platform/keybinding/common/keybindingService.ts index 634383082b1..d22b4f47801 100644 --- a/src/vs/platform/keybinding/common/keybindingService.ts +++ b/src/vs/platform/keybinding/common/keybindingService.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; +import {TPromise} from 'vs/base/common/winjs.base'; import {createDecorator, IInstantiationService, ServiceIdentifier, ServicesAccessor} from 'vs/platform/instantiation/common/instantiation'; import {Keybinding} from 'vs/base/common/keyCodes'; @@ -82,5 +83,8 @@ export interface IKeybindingService { lookupKeybindings(commandId: string): Keybinding[]; customKeybindingsCount(): number; - executeCommand(commandId: string, args?: any): any; + getLabelFor(keybinding:Keybinding): string; + + executeCommand(commandId: string, args?: any): TPromise; + executeCommand(commandId: string, args?: any): TPromise; } diff --git a/src/vs/platform/keybinding/common/keybindingsRegistry.ts b/src/vs/platform/keybinding/common/keybindingsRegistry.ts index b391a7daea9..65ac634a595 100644 --- a/src/vs/platform/keybinding/common/keybindingsRegistry.ts +++ b/src/vs/platform/keybinding/common/keybindingsRegistry.ts @@ -103,11 +103,6 @@ class KeybindingsRegistryImpl implements IKeybindingsRegistry { } } } - if (Platform.isLinux) { - if (!BinaryKeybindings.hasCtrlCmd(keybinding) && !BinaryKeybindings.hasShift(keybinding) && BinaryKeybindings.hasAlt(keybinding) && !BinaryKeybindings.hasWinCtrl(keybinding)) { - console.warn('Alt+ keybindings should not be used by default under Linux. Offender: ', keybinding, ' for ', commandId); - } - } this._keybindings.push({ keybinding: keybinding, command: commandId, diff --git a/src/vs/platform/markers/common/markerService.ts b/src/vs/platform/markers/common/markerService.ts index 8fb19433317..c9d9a2d6b26 100644 --- a/src/vs/platform/markers/common/markerService.ts +++ b/src/vs/platform/markers/common/markerService.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import network = require('vs/base/common/network'); import arrays = require('vs/base/common/arrays'); +import network = require('vs/base/common/network'); import strings = require('vs/base/common/strings'); import collections = require('vs/base/common/collections'); import URI from 'vs/base/common/uri'; @@ -18,7 +18,7 @@ import {IMarkerService, IMarkerData, MarkerType, IResourceMarker, IMarker, Marke interface Key { owner: string; - resource: network.URL; + resource: URI; } module Key { @@ -27,7 +27,7 @@ module Key { var regexp = /^(.*)→(.*)$/.exec(value); return { owner: regexp[1], - resource: network.URL.fromValue(regexp[2]) + resource: URI.parse(regexp[2]) }; } @@ -92,7 +92,7 @@ export class MarkerService implements IMarkerService, IThreadSynchronizableObjec return this._onMarkerChanged ? this._onMarkerChanged.event : null; } - public changeOne(owner: string, resource: network.URL, markers: IMarkerData[]): void { + public changeOne(owner: string, resource: URI, markers: IMarkerData[]): void { if (this._doChangeOne(owner, resource, markers)) { this._onMarkerChanged.fire([resource]); } diff --git a/src/vs/platform/markers/common/problemMatcher.ts b/src/vs/platform/markers/common/problemMatcher.ts index 5abe2c7a58f..f156b98bbd3 100644 --- a/src/vs/platform/markers/common/problemMatcher.ts +++ b/src/vs/platform/markers/common/problemMatcher.ts @@ -10,7 +10,6 @@ import * as Objects from 'vs/base/common/objects'; import * as Strings from 'vs/base/common/strings'; import * as Assert from 'vs/base/common/assert'; import * as Paths from 'vs/base/common/paths'; -import * as NetWork from 'vs/base/common/network'; import * as Types from 'vs/base/common/types'; import Severity from 'vs/base/common/severity'; import URI from 'vs/base/common/uri'; @@ -171,7 +170,7 @@ export function getResource(filename: string, matcher: ProblemMatcher): URI { if (fullPath[0] !== '/') { fullPath = '/' + fullPath; } - return NetWork.URL.fromValue('file://' + fullPath); + return URI.parse('file://' + fullPath); } export interface ILineMatcher { @@ -1089,8 +1088,8 @@ let matcher = { pattern: defaultPattern('tsc'), watching: { activeOnStart: true, - beginsPattern: { regexp: /^\s*message TS6032: File change detected. Starting incremental compilation.../ }, - endsPattern: { regexp: /^\s*message TS6042: Compilation complete. Watching for file changes./ } + beginsPattern: { regexp: /^\s*(?:message TS6032:|\d{1,2}:\d{1,2}:\d{1,2} (?:AM|PM) -) File change detected\. Starting incremental compilation\.\.\./ }, + endsPattern: { regexp: /^\s*(?:message TS6042:|\d{1,2}:\d{1,2}:\d{1,2} (?:AM|PM) -) Compilation complete\. Watching for file changes\./ } } }; (matcher).tscWatch = true; diff --git a/src/vs/platform/markers/test/common/markerService.test.ts b/src/vs/platform/markers/test/common/markerService.test.ts index ab87323eeed..96598eeb24b 100644 --- a/src/vs/platform/markers/test/common/markerService.test.ts +++ b/src/vs/platform/markers/test/common/markerService.test.ts @@ -6,7 +6,7 @@ import assert = require('assert'); -import network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import markerService = require('vs/platform/markers/common/markerService'); import {NULL_THREAD_SERVICE} from 'vs/platform/test/common/nullThreadService'; import {IMarkerData} from 'vs/platform/markers/common/markers'; @@ -29,18 +29,18 @@ suite('Marker Service', () => { var service = new markerService.MarkerService(NULL_THREAD_SERVICE); service.changeAll('far', [{ - resource: network.URL.fromValue('file:///c/test/file.cs'), + resource: URI.parse('file:///c/test/file.cs'), marker: randomMarkerData() }]); assert.equal(service.read().length, 1); assert.equal(service.read({ owner: 'far' }).length, 1); - assert.equal(service.read({ resource: network.URL.fromValue('file:///c/test/file.cs') }).length, 1); - assert.equal(service.read({ owner: 'far', resource: network.URL.fromValue('file:///c/test/file.cs') }).length, 1); + assert.equal(service.read({ resource: URI.parse('file:///c/test/file.cs') }).length, 1); + assert.equal(service.read({ owner: 'far', resource: URI.parse('file:///c/test/file.cs') }).length, 1); service.changeAll('boo', [{ - resource: network.URL.fromValue('file:///c/test/file.cs'), + resource: URI.parse('file:///c/test/file.cs'), marker: randomMarkerData() }]); @@ -53,16 +53,16 @@ suite('Marker Service', () => { test('changeOne override', () => { var service = new markerService.MarkerService(NULL_THREAD_SERVICE); - service.changeOne('far', network.URL.fromValue('/path/only.cs'), [randomMarkerData()]); + service.changeOne('far', URI.parse('/path/only.cs'), [randomMarkerData()]); assert.equal(service.read().length, 1); assert.equal(service.read({ owner: 'far' }).length, 1); - service.changeOne('boo', network.URL.fromValue('/path/only.cs'), [randomMarkerData()]); + service.changeOne('boo', URI.parse('/path/only.cs'), [randomMarkerData()]); assert.equal(service.read().length, 2); assert.equal(service.read({ owner: 'far' }).length, 1); assert.equal(service.read({ owner: 'boo' }).length, 1); - service.changeOne('far', network.URL.fromValue('/path/only.cs'), [randomMarkerData(), randomMarkerData()]); + service.changeOne('far', URI.parse('/path/only.cs'), [randomMarkerData(), randomMarkerData()]); assert.equal(service.read({ owner: 'far' }).length, 2); assert.equal(service.read({ owner: 'boo' }).length, 1); @@ -71,13 +71,13 @@ suite('Marker Service', () => { test('changeOne/All clears', () => { var service = new markerService.MarkerService(NULL_THREAD_SERVICE); - service.changeOne('far', network.URL.fromValue('/path/only.cs'), [randomMarkerData()]); - service.changeOne('boo', network.URL.fromValue('/path/only.cs'), [randomMarkerData()]); + service.changeOne('far', URI.parse('/path/only.cs'), [randomMarkerData()]); + service.changeOne('boo', URI.parse('/path/only.cs'), [randomMarkerData()]); assert.equal(service.read({ owner: 'far' }).length, 1); assert.equal(service.read({ owner: 'boo' }).length, 1); assert.equal(service.read().length, 2); - service.changeOne('far', network.URL.fromValue('/path/only.cs'), []); + service.changeOne('far', URI.parse('/path/only.cs'), []); assert.equal(service.read({ owner: 'far' }).length, 0); assert.equal(service.read({ owner: 'boo' }).length, 1); assert.equal(service.read().length, 1); @@ -92,10 +92,10 @@ suite('Marker Service', () => { var service = new markerService.MarkerService(NULL_THREAD_SERVICE); service.changeAll('far', [{ - resource: network.URL.fromValue('file:///d/path'), + resource: URI.parse('file:///d/path'), marker: randomMarkerData() }, { - resource: network.URL.fromValue('file:///d/path'), + resource: URI.parse('file:///d/path'), marker: randomMarkerData() }]); @@ -114,10 +114,10 @@ suite('Marker Service', () => { var service = new markerService.MarkerService(NULL_THREAD_SERVICE); service.changeAll('far', [{ - resource: network.URL.fromValue('file:///c/test/file.cs'), + resource: URI.parse('file:///c/test/file.cs'), marker: randomMarkerData() }, { - resource: network.URL.fromValue('file:///c/test/file.cs'), + resource: URI.parse('file:///c/test/file.cs'), marker: randomMarkerData() }]); diff --git a/src/vs/platform/plugins/common/ipcRemoteCom.ts b/src/vs/platform/plugins/common/ipcRemoteCom.ts index 37e8069bd1a..4f4cb636265 100644 --- a/src/vs/platform/plugins/common/ipcRemoteCom.ts +++ b/src/vs/platform/plugins/common/ipcRemoteCom.ts @@ -23,7 +23,7 @@ var pendingRPCReplies: { [msgId: string]: IRPCReply; } = {}; function createRPC(serializeAndSend:(obj:any)=>void): IRPCFunc { var lastMessageId = 0; - + return function rpc(rpcId: string, method: string, args: any[]): winjs.TPromise { var req = String(++lastMessageId); var reply: IRPCReply = { @@ -61,7 +61,7 @@ export function create(send:(obj:string)=>void): IPluginsIPC { var rpc = createRPC(serializeAndSend); var bigHandler: remote.IManyHandler = null; var invokedHandlers: { [req: string]: winjs.TPromise; } = Object.create(null); - + var r: IPluginsIPC = { callOnRemote: rpc, registerBigHandler: (_bigHandler: remote.IManyHandler): void => { @@ -69,7 +69,7 @@ export function create(send:(obj:string)=>void): IPluginsIPC { }, handle: (rawmsg) => { var msg = marshalling.demarshallObject(rawmsg, proxiesMarshalling); - + if (msg.seq) { if (!pendingRPCReplies.hasOwnProperty(msg.seq)) { console.warn('Got reply to unknown seq'); @@ -93,22 +93,22 @@ export function create(send:(obj:string)=>void): IPluginsIPC { } return; } - + if (msg.err) { console.error(msg.err); return; } var rpcId = msg.rpcId; - + if (!bigHandler) { throw new Error('got message before big handler attached!'); } - + var req = msg.req; - + invokedHandlers[req] = invokeHandler(rpcId, msg.method, msg.args); - + invokedHandlers[req].then((r) => { delete invokedHandlers[req]; serializeAndSend({ @@ -124,13 +124,13 @@ export function create(send:(obj:string)=>void): IPluginsIPC { }); } }; - + var proxiesMarshalling = new remote.ProxiesMarshallingContribution(r); - + function serializeAndSend(msg:any): void { send(marshalling.marshallObject(msg, proxiesMarshalling)); } - + function invokeHandler(rpcId:string, method:string, args:any[]): winjs.TPromise { try { return winjs.TPromise.as(bigHandler.handle(rpcId, method, args)); @@ -138,7 +138,7 @@ export function create(send:(obj:string)=>void): IPluginsIPC { return winjs.TPromise.wrapError(err); } } - + return r; }; diff --git a/src/vs/platform/request/common/baseRequestService.ts b/src/vs/platform/request/common/baseRequestService.ts index 539c4e2addb..5dc21abb016 100644 --- a/src/vs/platform/request/common/baseRequestService.ts +++ b/src/vs/platform/request/common/baseRequestService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import strings = require('vs/base/common/strings'); import Timer = require('vs/base/common/timer'); import Async = require('vs/base/common/async'); @@ -46,7 +46,7 @@ export class BaseRequestService implements IRequestService { // Find root server URL from configuration this._origin = workspaceUri; - var urlPath = new network.URL(this._origin).getPath(); + var urlPath = URI.parse(this._origin).path; if (urlPath && urlPath.length > 0) { this._origin = this._origin.substring(0, this._origin.length - urlPath.length + 1); } @@ -59,44 +59,6 @@ export class BaseRequestService implements IRequestService { } } - public getRequestUrl(service:string, path?:string, absolute?:boolean):string { - if (this._serviceMap[service]) { - var serviceUrl = this._serviceMap[service] + strings.normalizePath(path); - - var fullUrl = new network.URL(serviceUrl); - if (fullUrl.getScheme()) { - return serviceUrl; - } - - // request URL relative to server - if (!absolute) { - return serviceUrl; - } - - // absolute request URL - return this._origin + strings.ltrim(serviceUrl, '/'); - } - - return null; - } - - public getPath(service:string, requestUrl:network.URL):string { - - // Find service root - var serviceRoot = this.getRequestUrl(service, '/', true); - if (!serviceRoot) { - return null; - } - - // Substr path - var index = requestUrl.toString().indexOf(serviceRoot); - if (index === 0) { - return requestUrl.toString().substr(serviceRoot.length - 1); // Keep leading slash - } - - return null; - } - protected makeCrossOriginRequest(options:http.IXHROptions): winjs.TPromise { return null; } diff --git a/src/vs/platform/request/common/request.ts b/src/vs/platform/request/common/request.ts index 5ee1b1f1cec..cdd7cf6cad1 100644 --- a/src/vs/platform/request/common/request.ts +++ b/src/vs/platform/request/common/request.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import Network = require('vs/base/common/network'); +import URI from 'vs/base/common/uri'; import http = require('vs/base/common/http'); import winjs = require('vs/base/common/winjs.base'); import {createDecorator, ServiceIdentifier} from 'vs/platform/instantiation/common/instantiation'; @@ -14,20 +14,6 @@ export var IRequestService = createDecorator('requestService'); export interface IRequestService { serviceId : ServiceIdentifier; - /** - * Returns the URL that can be used to access the provided service. The optional second argument can - * be provided to narrow down the request URL to a specific file system resource. The third argument - * allows to specify to return a fully absolute server URL. - */ - getRequestUrl(service:string, path?:string, absolute?:boolean):string; - - /** - * Returns the path from the given requestUrl using the provided service identifier. The path will match - * the path that was passed in to IRequestService#getRequestUrl() or null if it can not be identified. Path - * always begins with a leading slash. - */ - getPath(service:string, requestUrl:Network.URL):string; - /** * Wraps the call into WinJS.XHR to allow for mocking and telemetry. Use this instead * of calling WinJS.XHR directly. diff --git a/src/vs/platform/search/common/search.ts b/src/vs/platform/search/common/search.ts index 55438ee410a..3dd44ffc0df 100644 --- a/src/vs/platform/search/common/search.ts +++ b/src/vs/platform/search/common/search.ts @@ -23,7 +23,7 @@ export interface ISearchService { export interface IQueryOptions { rootResources?: uri[]; - filePatterns?: IPatternInfo[]; + filePattern?: string; excludePattern?: glob.IExpression; includePattern?: glob.IExpression; maxResults?: number; diff --git a/src/vs/platform/telemetry/common/abstractTelemetryService.ts b/src/vs/platform/telemetry/common/abstractTelemetryService.ts index ef30a90e0cd..1b7a99feabe 100644 --- a/src/vs/platform/telemetry/common/abstractTelemetryService.ts +++ b/src/vs/platform/telemetry/common/abstractTelemetryService.ts @@ -67,29 +67,26 @@ export abstract class AbstractTelemetryService implements ITelemetryService { private onErrorEvent(e:any):void { - // work around behavior in workerServer.ts that breaks up Error.stack - if(Array.isArray(e.stack)) { - e.stack = e.stack.join('\n'); - } + let error = Object.create(null); // unwrap nested errors from loader if(e.detail && e.detail.stack) { e = e.detail; } + // work around behavior in workerServer.ts that breaks up Error.stack + let stack = Array.isArray(e.stack) ? e.stack.join('\n') : e.stack; + let message = e.message ? e.message : this._safeStringify(e); + // errors without a stack are not useful telemetry - if(!e.stack) { + if(!stack) { return; } - if (!e.message) { - e.message = this._safeStringify(e); - } + error['message'] = this.cleanupInfo(message); + error['stack'] = this.cleanupInfo(stack); - e.message = this.cleanupInfo(e.message); - e.stack = this.cleanupInfo(e.stack); - - this.addErrortoBuffer(e); + this.addErrortoBuffer(error); } private addErrortoBuffer(e:any): void { diff --git a/src/vs/platform/thread/common/abstractThreadService.ts b/src/vs/platform/thread/common/abstractThreadService.ts index 8cbd86d9965..251646149c5 100644 --- a/src/vs/platform/thread/common/abstractThreadService.ts +++ b/src/vs/platform/thread/common/abstractThreadService.ts @@ -45,7 +45,8 @@ export abstract class AbstractThreadService implements remote.IManyHandler { public isInMainThread:boolean; - private _instantiationService:instantiation.IInstantiationService; + protected _instantiationService: instantiation.IInstantiationService; + _boundObjects:{[id:string]:IThreadSynchronizableObject;}; _pendingObjects:winjs.Promise[]; private _localObjMap: { [id:string]: any; }; diff --git a/src/vs/platform/workspace/common/workspace.ts b/src/vs/platform/workspace/common/workspace.ts index 540ef30e9eb..4f85ffa0355 100644 --- a/src/vs/platform/workspace/common/workspace.ts +++ b/src/vs/platform/workspace/common/workspace.ts @@ -120,6 +120,7 @@ export interface IEnvironment { debugPluginHostPort: number; debugBrkPluginHost: boolean; + disablePlugins: boolean; logPluginHostCommunication: boolean; verboseLogging: boolean; @@ -137,11 +138,5 @@ export interface IEnvironment { aiConfig: { key: string; asimovKey: string; - }, - - sendASmile: { - submitUrl: string, - reportIssueUrl: string, - requestFeatureUrl: string } } \ No newline at end of file diff --git a/src/vs/text.js b/src/vs/text.js index b363b799e4c..041a4615736 100644 --- a/src/vs/text.js +++ b/src/vs/text.js @@ -2,6 +2,17 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + * Please make sure to make edits in the .ts file at https://github.com/Microsoft/vscode-loader/ + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------*/ /// /// 'use strict'; @@ -164,8 +175,8 @@ var TextLoaderPlugin; TextLoaderPlugin.Utilities = Utilities; (function () { var textLoader = null; - var isAtomShell = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions['electron'] !== 'undefined'); - if (typeof process !== 'undefined' && process.versions && !!process.versions.node && !isAtomShell) { + var isElectron = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions['electron'] !== 'undefined'); + if (typeof process !== 'undefined' && process.versions && !!process.versions.node && !isElectron) { textLoader = new NodeTextLoader(); } else { diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 859537b6eae..2b9a4eab7aa 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -10,7 +10,7 @@ declare namespace vscode { /** - * Visual Studio Code's version. + * The version of the editor. */ export var version: string; @@ -1094,7 +1094,7 @@ declare namespace vscode { * its resource, or a glob-pattern that is applied to the [path](#TextDocument.fileName). * * @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }` - * @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**\project.json' }` + * @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**∕project.json' }` */ export interface DocumentFilter { @@ -1119,7 +1119,7 @@ declare namespace vscode { * and [language filters](#LanguageFilter). * * @sample `let sel:DocumentSelector = 'typescript'`; - * @sample `let sel:DocumentSelector = ['typescript', { language: 'json', pattern: '**\tsconfig.json' }]`; + * @sample `let sel:DocumentSelector = ['typescript', { language: 'json', pattern: '**∕tsconfig.json' }]`; */ export type DocumentSelector = string | DocumentFilter | (string | DocumentFilter)[]; @@ -2935,7 +2935,7 @@ declare namespace vscode { /** * Find files in the workspace. * - * @sample `findFiles('**\*.js', '**\node_modules\**', 10)` + * @sample `findFiles('**∕*.js', '**∕node_modules∕**', 10)` * @param include A glob pattern that defines the files to search for. * @param exclude A glob pattern that defines files and folders to exclude. * @param maxResults An upper-bound for the result. @@ -3111,7 +3111,8 @@ declare namespace vscode { * Multiple providers can be registered for a language. In that case providers are sorted * by their [score](#languages.match) and groups of equal score are sequentially asked for * completion items. The process stops when one or many providers of a group return a - * result. + * result. A failing provider (rejected promise or exception) will not fail the whole + * operation. * * @param selector A selector that defines the documents this provider is applicable to. * @param provider A completion provider. @@ -3124,7 +3125,8 @@ declare namespace vscode { * Register a code action provider. * * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. + * parallel and the results are merged. A failing provider (rejected promise or exception) will + * not cause a failure of the whole operation. * * @param selector A selector that defines the documents this provider is applicable to. * @param provider A code action provider. @@ -3136,7 +3138,8 @@ declare namespace vscode { * Register a code lens provider. * * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. + * parallel and the results are merged. A failing provider (rejected promise or exception) will + * not cause a failure of the whole operation. * * @param selector A selector that defines the documents this provider is applicable to. * @param provider A code lens provider. @@ -3148,7 +3151,8 @@ declare namespace vscode { * Register a definition provider. * * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. + * parallel and the results are merged. A failing provider (rejected promise or exception) will + * not cause a failure of the whole operation. * * @param selector A selector that defines the documents this provider is applicable to. * @param provider A definition provider. @@ -3160,7 +3164,8 @@ declare namespace vscode { * Register a hover provider. * * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. + * parallel and the results are merged. A failing provider (rejected promise or exception) will + * not cause a failure of the whole operation. * * @param selector A selector that defines the documents this provider is applicable to. * @param provider A hover provider. @@ -3173,7 +3178,7 @@ declare namespace vscode { * * Multiple providers can be registered for a language. In that case providers are sorted * by their [score](#languages.match) and groups sequentially asked for document highlights. - * The process stops when a provider returns a `non-falsy`-result. + * The process stops when a provider returns a `non-falsy` or `non-failure` result. * * @param selector A selector that defines the documents this provider is applicable to. * @param provider A document highlight provider. @@ -3185,7 +3190,8 @@ declare namespace vscode { * Register a document symbol provider. * * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. + * parallel and the results are merged. A failing provider (rejected promise or exception) will + * not cause a failure of the whole operation. * * @param selector A selector that defines the documents this provider is applicable to. * @param provider A document symbol provider. @@ -3197,7 +3203,8 @@ declare namespace vscode { * Register a workspace symbol provider. * * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. + * parallel and the results are merged. A failing provider (rejected promise or exception) will + * not cause a failure of the whole operation. * * @param provider A workspace symbol provider. * @return A [disposable](#Disposable) that unregisters this provider when being disposed. @@ -3208,7 +3215,8 @@ declare namespace vscode { * Register a reference provider. * * Multiple providers can be registered for a language. In that case providers are asked in - * parallel and the results are merged. + * parallel and the results are merged. A failing provider (rejected promise or exception) will + * not cause a failure of the whole operation. * * @param selector A selector that defines the documents this provider is applicable to. * @param provider A reference provider. @@ -3220,7 +3228,8 @@ declare namespace vscode { * Register a reference provider. * * Multiple providers can be registered for a language. In that case providers are sorted - * by their [score](#languages.match) and the result of best-matching provider is used. + * by their [score](#languages.match) and the result of best-matching provider is used. Failure + * of the selected provider will cause a failure of the whole operation. * * @param selector A selector that defines the documents this provider is applicable to. * @param provider A rename provider. @@ -3232,7 +3241,8 @@ declare namespace vscode { * Register a formatting provider for a document. * * Multiple providers can be registered for a language. In that case providers are sorted - * by their [score](#languages.match) and the result of best-matching provider is used. + * by their [score](#languages.match) and the result of best-matching provider is used. Failure + * of the selected provider will cause a failure of the whole operation. * * @param selector A selector that defines the documents this provider is applicable to. * @param provider A document formatting edit provider. @@ -3244,7 +3254,8 @@ declare namespace vscode { * Register a formatting provider for a document range. * * Multiple providers can be registered for a language. In that case providers are sorted - * by their [score](#languages.match) and the result of best-matching provider is used. + * by their [score](#languages.match) and the result of best-matching provider is used. Failure + * of the selected provider will cause a failure of the whole operation. * * @param selector A selector that defines the documents this provider is applicable to. * @param provider A document range formatting edit provider. @@ -3256,7 +3267,8 @@ declare namespace vscode { * Register a formatting provider that works on type. * * Multiple providers can be registered for a language. In that case providers are sorted - * by their [score](#languages.match) and the result of best-matching provider is used. + * by their [score](#languages.match) and the result of best-matching provider is used. Failure + * of the selected provider will cause a failure of the whole operation. * * @param selector A selector that defines the documents this provider is applicable to. * @param provider An on type formatting edit provider. @@ -3270,7 +3282,8 @@ declare namespace vscode { * Register a signature help provider. * * Multiple providers can be registered for a language. In that case providers are sorted - * by their [score](#languages.match) and the result of best-matching provider is used. + * by their [score](#languages.match) and the result of best-matching provider is used. Failure + * of the selected provider will cause a failure of the whole operation. * * @param selector A selector that defines the documents this provider is applicable to. * @param provider A signature help provider. diff --git a/src/vs/workbench/api/browser/extHostOutputService.ts b/src/vs/workbench/api/browser/extHostOutputService.ts index 2fed91fe4a1..3e7f2cfcb18 100644 --- a/src/vs/workbench/api/browser/extHostOutputService.ts +++ b/src/vs/workbench/api/browser/extHostOutputService.ts @@ -77,32 +77,34 @@ export class ExtHostOutputService { @Remotable.MainContext('MainThreadOutputService') export class MainThreadOutputService { - constructor( - @IOutputService private outputService: IOutputService, - @IWorkbenchEditorService private editorService: IWorkbenchEditorService - ) { + private _outputService: IOutputService; + private _editorService: IWorkbenchEditorService; + + constructor( @IOutputService outputService: IOutputService, @IWorkbenchEditorService editorService: IWorkbenchEditorService) { + this._outputService = outputService; + this._editorService = editorService; } public append(channel: string, value: string): TPromise { - this.outputService.append(channel, value); + this._outputService.append(channel, value); return undefined; } public clear(channel: string): TPromise { - this.outputService.clearOutput(channel); + this._outputService.clearOutput(channel); return undefined; } public reveal(channel: string, position: Position): TPromise { - this.outputService.showOutput(channel, position); + this._outputService.showOutput(channel, position); return undefined; } public close(channel: string): TPromise { - let editors = this.editorService.getVisibleEditors(); + let editors = this._editorService.getVisibleEditors(); for (let editor of editors) { if (editor.input.getId() === OUTPUT_EDITOR_INPUT_ID) { - this.editorService.closeEditor(editor).done(null, onUnexpectedError); + this._editorService.closeEditor(editor).done(null, onUnexpectedError); return undefined; } } diff --git a/src/vs/workbench/api/browser/pluginHost.api.impl.ts b/src/vs/workbench/api/browser/pluginHost.api.impl.ts index 3364186808d..e037779afea 100644 --- a/src/vs/workbench/api/browser/pluginHost.api.impl.ts +++ b/src/vs/workbench/api/browser/pluginHost.api.impl.ts @@ -17,11 +17,12 @@ import {PluginHostQuickOpen} from 'vs/workbench/api/browser/pluginHostQuickOpen' import {PluginHostStatusBar} from 'vs/workbench/api/browser/pluginHostStatusBar'; import {PluginHostCommands} from 'vs/workbench/api/common/pluginHostCommands'; import {ExtHostOutputService} from 'vs/workbench/api/browser/extHostOutputService'; -import {LanguageFeatures} from 'vs/workbench/api/common/languageFeatures'; import {PluginHostMessageService} from 'vs/workbench/api/common/pluginHostMessageService'; import {PluginHostTelemetryService} from 'vs/workbench/api/common/pluginHostTelemetry'; import {PluginHostEditors} from 'vs/workbench/api/common/pluginHostEditors'; import {ExtHostLanguages} from 'vs/workbench/api/common/extHostLanguages'; +import {ExtHostLanguageFeatures} from 'vs/workbench/api/common/extHostLanguageFeatures'; +import {ExtHostLanguageFeatureCommands} from 'vs/workbench/api/common/extHostLanguageFeatureCommands'; import * as extHostTypes from 'vs/workbench/api/common/pluginHostTypes'; import 'vs/workbench/api/common/pluginHostTypes.marshalling'; import {wrapAsWinJSPromise} from 'vs/base/common/async'; @@ -189,7 +190,7 @@ export class PluginHostAPIImplementation { }; // - const workspacePath = contextService.getWorkspace() && contextService.getWorkspace().resource.fsPath; + const workspacePath = contextService.getWorkspace() ? contextService.getWorkspace().resource.fsPath : undefined; const pluginHostFileSystemEvent = threadService.getRemotable(PluginHostFileSystemEventService); const pluginHostWorkspace = new PluginHostWorkspace(this._threadService, workspacePath); const pluginHostDocuments = this._threadService.getRemotable(PluginHostModelService); @@ -250,7 +251,8 @@ export class PluginHostAPIImplementation { // const languages = new ExtHostLanguages(this._threadService); const pluginHostDiagnostics = new PluginHostDiagnostics(this._threadService); - const features = LanguageFeatures.createExtensionHostInstances(this._threadService); + const languageFeatures = threadService.getRemotable(ExtHostLanguageFeatures); + const languageFeatureCommand = new ExtHostLanguageFeatureCommands(threadService.getRemotable(PluginHostCommands)); this.languages = { createDiagnosticCollection(name?: string): vscode.DiagnosticCollection { @@ -260,49 +262,49 @@ export class PluginHostAPIImplementation { return languages.getLanguages(); }, match(selector: vscode.DocumentSelector, document: vscode.TextDocument): number { - return score(selector, { uri: document.uri, language: document.languageId }); + return score(selector, document.uri, document.languageId); }, registerCodeActionsProvider(selector: vscode.DocumentSelector, provider: vscode.CodeActionProvider): vscode.Disposable { - return features.codeActions.register(selector, provider); + return languageFeatures.registerCodeActionProvider(selector, provider); }, registerCodeLensProvider(selector: vscode.DocumentSelector, provider: vscode.CodeLensProvider): vscode.Disposable { - return features.codeLens.register(selector, provider); + return languageFeatures.registerCodeLensProvider(selector, provider); }, registerDefinitionProvider(selector: vscode.DocumentSelector, provider: vscode.DefinitionProvider): vscode.Disposable { - return features.definition.register(selector, provider); + return languageFeatures.registerDefinitionProvider(selector, provider); }, registerHoverProvider(selector: vscode.DocumentSelector, provider: vscode.HoverProvider): vscode.Disposable { - return features.hover.register(selector, provider); + return languageFeatures.registerHoverProvider(selector, provider); }, registerDocumentHighlightProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentHighlightProvider): vscode.Disposable { - return features.documentHighlight.register(selector, provider); + return languageFeatures.registerDocumentHighlightProvider(selector, provider); }, registerReferenceProvider(selector: vscode.DocumentSelector, provider: vscode.ReferenceProvider): vscode.Disposable { - return features.referenceSearch.register(selector, provider); + return languageFeatures.registerReferenceProvider(selector, provider); }, registerRenameProvider(selector: vscode.DocumentSelector, provider: vscode.RenameProvider): vscode.Disposable { - return features.rename.register(selector, provider); + return languageFeatures.registerRenameProvider(selector, provider); }, registerDocumentSymbolProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentSymbolProvider): vscode.Disposable { - return features.documentSymbols.register(selector, provider); + return languageFeatures.registerDocumentSymbolProvider(selector, provider); }, registerWorkspaceSymbolProvider(provider: vscode.WorkspaceSymbolProvider): vscode.Disposable { - return features.workspaceSymbols.register(provider); + return languageFeatures.registerWorkspaceSymbolProvider(provider); }, registerDocumentFormattingEditProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentFormattingEditProvider): vscode.Disposable { - return features.formatDocument.register(selector, provider); + return languageFeatures.registerDocumentFormattingEditProvider(selector, provider); }, registerDocumentRangeFormattingEditProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentRangeFormattingEditProvider): vscode.Disposable { - return features.formatRange.register(selector, provider); + return languageFeatures.registerDocumentRangeFormattingEditProvider(selector, provider); }, registerOnTypeFormattingEditProvider(selector: vscode.DocumentSelector, provider: vscode.OnTypeFormattingEditProvider, firstTriggerCharacter: string, ...moreTriggerCharacters: string[]): vscode.Disposable { - return features.formatOnType.register(selector, { triggerCharacters: [firstTriggerCharacter].concat(moreTriggerCharacters), provider }); + return languageFeatures.registerOnTypeFormattingEditProvider(selector, provider, [firstTriggerCharacter].concat(moreTriggerCharacters)); }, registerSignatureHelpProvider(selector: vscode.DocumentSelector, provider: vscode.SignatureHelpProvider, ...triggerCharacters: string[]): vscode.Disposable { - return features.signatureHelp.register(selector, { triggerCharacters, provider }); + return languageFeatures.registerSignatureHelpProvider(selector, provider, triggerCharacters); }, registerCompletionItemProvider(selector: vscode.DocumentSelector, provider: vscode.CompletionItemProvider, ...triggerCharacters: string[]): vscode.Disposable { - return features.completions.register(selector, { triggerCharacters, provider }); + return languageFeatures.registerCompletionItemProvider(selector, provider, triggerCharacters); }, setLanguageConfiguration: (language: string, configuration: vscode.LanguageConfiguration):vscode.Disposable => { return this._setLanguageConfiguration(language, configuration); diff --git a/src/vs/workbench/api/browser/pluginHostQuickOpen.ts b/src/vs/workbench/api/browser/pluginHostQuickOpen.ts index 173753869fe..1e7c19a0385 100644 --- a/src/vs/workbench/api/browser/pluginHostQuickOpen.ts +++ b/src/vs/workbench/api/browser/pluginHostQuickOpen.ts @@ -67,6 +67,10 @@ export class PluginHostQuickOpen { return items[handle]; } }); + }, (err) => { + this._proxy._setError(err); + + return TPromise.wrapError(err); }); } @@ -80,6 +84,7 @@ export class MainThreadQuickOpen { private _quickOpenService: IQuickOpenService; private _doSetItems: (items: MyQuickPickItems[]) => any; + private _doSetError: (error: Error) => any; private _contents: TPromise; private _token = 0; @@ -97,6 +102,12 @@ export class MainThreadQuickOpen { c(items); } }; + + this._doSetError = (error) => { + if (myToken === this._token) { + e(error); + } + }; }); return this._quickOpenService.pick(this._contents, options).then(item => { @@ -113,6 +124,13 @@ export class MainThreadQuickOpen { } } + _setError(error: Error): Thenable { + if (this._doSetError) { + this._doSetError(error); + return; + } + } + _input(options?: InputBoxOptions): Thenable { return this._quickOpenService.input(options); } diff --git a/src/vs/workbench/api/browser/pluginHostWorkspace.ts b/src/vs/workbench/api/browser/pluginHostWorkspace.ts index f68254d2e3d..55b94c717f0 100644 --- a/src/vs/workbench/api/browser/pluginHostWorkspace.ts +++ b/src/vs/workbench/api/browser/pluginHostWorkspace.ts @@ -101,7 +101,7 @@ export class MainThreadWorkspace { this._eventService = eventService; } - findFiles(include: string, exclude: string, maxResults?: number): Thenable { + findFiles(include: string, exclude: string, maxResults: number): Thenable { if (!this._workspace) { return; @@ -110,7 +110,7 @@ export class MainThreadWorkspace { return this._searchService.search({ rootResources: [this._workspace.resource], type: QueryType.File, - maxResults: 100, + maxResults, includePattern: { [include]: true }, excludePattern: { [exclude]: true }, }).then(result => { diff --git a/src/vs/workbench/api/common/extHostLanguageFeatureCommands.ts b/src/vs/workbench/api/common/extHostLanguageFeatureCommands.ts new file mode 100644 index 00000000000..9c8b5e54693 --- /dev/null +++ b/src/vs/workbench/api/common/extHostLanguageFeatureCommands.ts @@ -0,0 +1,255 @@ +/*--------------------------------------------------------------------------------------------- + * 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 URI from 'vs/base/common/uri'; +import Event, {Emitter} from 'vs/base/common/event'; +import Severity from 'vs/base/common/severity'; +import {DefaultFilter} from 'vs/editor/common/modes/modesFilters'; +import {TPromise} from 'vs/base/common/winjs.base'; +import {onUnexpectedError} from 'vs/base/common/errors'; +import {sequence} from 'vs/base/common/async'; +import {Range as EditorRange} from 'vs/editor/common/core/range'; +import {IDisposable} from 'vs/base/common/lifecycle'; +import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService'; +import {Remotable, IThreadService} from 'vs/platform/thread/common/thread'; +import * as vscode from 'vscode'; +import * as typeConverters from 'vs/workbench/api/common/pluginHostTypeConverters'; +import * as types from 'vs/workbench/api/common/pluginHostTypes'; +import {IPosition, IRange, ISingleEditOperation} from 'vs/editor/common/editorCommon'; +import * as modes from 'vs/editor/common/modes'; +import {CancellationTokenSource} from 'vs/base/common/cancellation'; +import {PluginHostModelService} from 'vs/workbench/api/common/pluginHostDocuments'; +import {IMarkerService, IMarker} from 'vs/platform/markers/common/markers'; +import {PluginHostCommands, MainThreadCommands} from 'vs/workbench/api/common/pluginHostCommands'; +import {DeclarationRegistry} from 'vs/editor/contrib/goToDeclaration/common/goToDeclaration'; +import {ExtraInfoRegistry} from 'vs/editor/contrib/hover/common/hover'; +import {OccurrencesRegistry} from 'vs/editor/contrib/wordHighlighter/common/wordHighlighter'; +import {ReferenceRegistry} from 'vs/editor/contrib/referenceSearch/common/referenceSearch'; +import {IQuickFix2, QuickFixRegistry, getQuickFixes} from 'vs/editor/contrib/quickFix/common/quickFix'; +import {IOutline} from 'vs/editor/contrib/quickOpen/common/quickOpen'; +import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; +import {NavigateTypesSupportRegistry, INavigateTypesSupport, ITypeBearing} from 'vs/workbench/parts/search/common/search' +import {RenameRegistry} from 'vs/editor/contrib/rename/common/rename'; +import {FormatRegistry, FormatOnTypeRegistry} from 'vs/editor/contrib/format/common/format'; +import {ICodeLensData} from 'vs/editor/contrib/codelens/common/codelens'; + +export class ExtHostLanguageFeatureCommands { + + private _commands: PluginHostCommands; + private _disposables: IDisposable[] = []; + + constructor(commands: PluginHostCommands) { + this._commands = commands; + + this._register('vscode.executeWorkspaceSymbolProvider', this._executeWorkspaceSymbolProvider); + this._register('vscode.executeDefinitionProvider', this._executeDefinitionProvider); + this._register('vscode.executeHoverProvider', this._executeHoverProvider); + this._register('vscode.executeDocumentHighlights', this._executeDocumentHighlights); + this._register('vscode.executeReferenceProvider', this._executeReferenceProvider); + this._register('vscode.executeDocumentRenameProvider', this._executeDocumentRenameProvider); + this._register('vscode.executeSignatureHelpProvider', this._executeSignatureHelpProvider); + this._register('vscode.executeDocumentSymbolProvider', this._executeDocumentSymbolProvider); + this._register('vscode.executeCompletionItemProvider', this._executeCompletionItemProvider); + this._register('vscode.executeCodeActionProvider', this._executeCodeActionProvider); + this._register('vscode.executeCodeLensProvider', this._executeCodeLensProvider); + this._register('vscode.executeFormatDocumentProvider', this._executeFormatDocumentProvider); + this._register('vscode.executeFormatRangeProvider', this._executeFormatRangeProvider); + this._register('vscode.executeFormatOnTypeProvider', this._executeFormatOnTypeProvider); + } + + private _register(id: string, callback: (...args: any[]) => any): void { + this._disposables.push(this._commands.registerCommand(id, callback, this)); + } + + // --- command impl + + private _executeWorkspaceSymbolProvider(query: string): Thenable { + return this._commands.executeCommand('_executeWorkspaceSymbolProvider', { query }).then(value => { + if (Array.isArray(value)) { + return value.map(typeConverters.toSymbolInformation); + } + }); + } + + private _executeDefinitionProvider(resource: URI, position: types.Position): Thenable { + const args = { + resource, + position: position && typeConverters.fromPosition(position) + }; + return this._commands.executeCommand('_executeDefinitionProvider', args).then(value => { + if (Array.isArray(value)) { + return value.map(typeConverters.toLocation) + } + }); + } + + private _executeHoverProvider(resource: URI, position: types.Position): Thenable { + const args = { + resource, + position: position && typeConverters.fromPosition(position) + }; + return this._commands.executeCommand('_executeHoverProvider', args).then(value => { + if (Array.isArray(value)) { + return value.map(typeConverters.toHover) + } + }); + } + + private _executeDocumentHighlights(resource: URI, position: types.Position): Thenable { + const args = { + resource, + position: position && typeConverters.fromPosition(position) + }; + return this._commands.executeCommand('_executeDocumentHighlights', args).then(value => { + if (Array.isArray(value)) { + return value.map(typeConverters.toDocumentHighlight) + } + }); + } + + private _executeReferenceProvider(resource: URI, position: types.Position): Thenable { + const args = { + resource, + position: position && typeConverters.fromPosition(position) + }; + return this._commands.executeCommand('_executeDocumentHighlights', args).then(value => { + if (Array.isArray(value)) { + return value.map(typeConverters.toLocation) + } + }); + } + + private _executeDocumentRenameProvider(resource: URI, position: types.Position, newName: string): Thenable { + const args = { + resource, + position: position && typeConverters.fromPosition(position), + newName + }; + return this._commands.executeCommand('_executeDocumentRenameProvider', args).then(value => { + if (!value) { + return; + } + if (value.rejectReason) { + return TPromise.wrapError(value.rejectReason); + } + let workspaceEdit = new types.WorkspaceEdit(); + for (let edit of value.edits) { + workspaceEdit.replace(edit.resource, typeConverters.toRange(edit.range), edit.newText); + } + return workspaceEdit; + }); + } + + private _executeSignatureHelpProvider(resource: URI, position: types.Position, triggerCharacter: string): Thenable { + const args = { + resource, + position: position && typeConverters.fromPosition(position), + triggerCharacter + }; + return this._commands.executeCommand('_executeSignatureHelpProvider', args).then(value => { + if (value) { + return typeConverters.SignatureHelp.to(value); + } + }); + } + + private _executeCompletionItemProvider(resource: URI, position: types.Position, triggerCharacter: string): Thenable { + const args = { + resource, + position: position && typeConverters.fromPosition(position), + triggerCharacter + }; + return this._commands.executeCommand('_executeCompletionItemProvider', args).then(value => { + if (value) { + let items: types.CompletionItem[] = []; + for (let group of value) { + for (let suggestions of group) { + for (let suggestion of suggestions.suggestions) { + const item = typeConverters.Suggest.to(suggestion); + items.push(item); + } + } + } + return items; + } + }); + } + + private _executeDocumentSymbolProvider(resource: URI): Thenable { + const args = { + resource + }; + return this._commands.executeCommand('_executeDocumentSymbolProvider', args).then(value => { + if (value && Array.isArray(value.entries)) { + return value.entries.map(typeConverters.SymbolInformation.fromOutlineEntry); + } + }); + } + + private _executeCodeActionProvider(resource: URI, range: types.Range): Thenable { + const args = { + resource, + range: typeConverters.fromRange(range) + }; + return this._commands.executeCommand('_executeCodeActionProvider', args).then(value => { + if (!Array.isArray(value)) { + return; + } + return value.map(quickFix => typeConverters.Command.to(quickFix.command)); + }); + } + + private _executeCodeLensProvider(resource: URI): Thenable{ + const args = { resource }; + return this._commands.executeCommand('_executeCodeLensProvider', args).then(value => { + if (Array.isArray(value)) { + return value.map(item => { + return new types.CodeLens(typeConverters.toRange(item.symbol.range), + typeConverters.Command.to(item.symbol.command)); + }); + } + }); + } + + private _executeFormatDocumentProvider(resource: URI, options: vscode.FormattingOptions): Thenable { + const args = { + resource, + options + }; + return this._commands.executeCommand('_executeFormatDocumentProvider', args).then(value => { + if (Array.isArray(value)) { + return value.map(edit => new types.TextEdit(typeConverters.toRange(edit.range), edit.text)); + } + }); + } + + private _executeFormatRangeProvider(resource: URI, range: types.Range, options: vscode.FormattingOptions): Thenable { + const args = { + resource, + range: typeConverters.fromRange(range), + options + }; + return this._commands.executeCommand('_executeFormatRangeProvider', args).then(value => { + if (Array.isArray(value)) { + return value.map(edit => new types.TextEdit(typeConverters.toRange(edit.range), edit.text)); + } + }); + } + + private _executeFormatOnTypeProvider(resource: URI, position: types.Position, ch:string, options: vscode.FormattingOptions): Thenable { + const args = { + resource, + position: typeConverters.fromPosition(position), + ch, + options + }; + return this._commands.executeCommand('_executeFormatOnTypeProvider', args).then(value => { + if (Array.isArray(value)) { + return value.map(edit => new types.TextEdit(typeConverters.toRange(edit.range), edit.text)); + } + }); + } +} \ No newline at end of file diff --git a/src/vs/workbench/api/common/extHostLanguageFeatures.ts b/src/vs/workbench/api/common/extHostLanguageFeatures.ts new file mode 100644 index 00000000000..696b257c71b --- /dev/null +++ b/src/vs/workbench/api/common/extHostLanguageFeatures.ts @@ -0,0 +1,1039 @@ +/*--------------------------------------------------------------------------------------------- + * 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 URI from 'vs/base/common/uri'; +import Event, {Emitter} from 'vs/base/common/event'; +import Severity from 'vs/base/common/severity'; +import {DefaultFilter} from 'vs/editor/common/modes/modesFilters'; +import {TPromise} from 'vs/base/common/winjs.base'; +import {onUnexpectedError} from 'vs/base/common/errors'; +import {sequence} from 'vs/base/common/async'; +import {Range as EditorRange} from 'vs/editor/common/core/range'; +import {IDisposable} from 'vs/base/common/lifecycle'; +import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService'; +import {Remotable, IThreadService} from 'vs/platform/thread/common/thread'; +import * as vscode from 'vscode'; +import * as TypeConverters from 'vs/workbench/api/common/pluginHostTypeConverters'; +import {Position, Range, SymbolKind, DocumentHighlightKind, Disposable, Diagnostic, DiagnosticSeverity, Location, SignatureHelp, CompletionItemKind} from 'vs/workbench/api/common/pluginHostTypes'; +import {IPosition, IRange, ISingleEditOperation} from 'vs/editor/common/editorCommon'; +import * as modes from 'vs/editor/common/modes'; +import {CancellationTokenSource} from 'vs/base/common/cancellation'; +import {PluginHostModelService} from 'vs/workbench/api/common/pluginHostDocuments'; +import {IMarkerService, IMarker} from 'vs/platform/markers/common/markers'; +import {PluginHostCommands, MainThreadCommands} from 'vs/workbench/api/common/pluginHostCommands'; +import {DeclarationRegistry} from 'vs/editor/contrib/goToDeclaration/common/goToDeclaration'; +import {ExtraInfoRegistry} from 'vs/editor/contrib/hover/common/hover'; +import {OccurrencesRegistry} from 'vs/editor/contrib/wordHighlighter/common/wordHighlighter'; +import {ReferenceRegistry} from 'vs/editor/contrib/referenceSearch/common/referenceSearch'; +import {QuickFixRegistry} from 'vs/editor/contrib/quickFix/common/quickFix'; +import {OutlineRegistry, IOutlineEntry, IOutlineSupport} from 'vs/editor/contrib/quickOpen/common/quickOpen'; +import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; +import {NavigateTypesSupportRegistry, INavigateTypesSupport, ITypeBearing} from 'vs/workbench/parts/search/common/search' +import {RenameRegistry} from 'vs/editor/contrib/rename/common/rename'; +import {FormatRegistry, FormatOnTypeRegistry} from 'vs/editor/contrib/format/common/format'; +import {CodeLensRegistry} from 'vs/editor/contrib/codelens/common/codelens'; +import {ParameterHintsRegistry} from 'vs/editor/contrib/parameterHints/common/parameterHints'; +import {SuggestRegistry} from 'vs/editor/contrib/suggest/common/suggest'; + +function isThenable(obj: any): obj is Thenable { + return obj && typeof obj['then'] === 'function'; +} + +function asWinJsPromise(callback: (token: vscode.CancellationToken) => T | Thenable): TPromise { + let source = new CancellationTokenSource(); + return new TPromise((resolve, reject) => { + let item = callback(source.token); + if (isThenable(item)) { + item.then(resolve, reject); + } else { + resolve(item); + } + }, () => { + source.cancel(); + }); +} + +// --- adapter + +class OutlineAdapter implements IOutlineSupport { + + private _documents: PluginHostModelService; + private _provider: vscode.DocumentSymbolProvider; + + constructor(documents: PluginHostModelService, provider: vscode.DocumentSymbolProvider) { + this._documents = documents; + this._provider = provider; + } + + getOutline(resource: URI): TPromise { + let doc = this._documents.getDocument(resource); + return asWinJsPromise(token => this._provider.provideDocumentSymbols(doc, token)).then(value => { + if (Array.isArray(value)) { + return value.map(TypeConverters.SymbolInformation.toOutlineEntry); + } + }); + } +} + +class CodeLensAdapter implements modes.ICodeLensSupport { + + private _documents: PluginHostModelService; + private _provider: vscode.CodeLensProvider; + + private _cache: { [uri: string]: vscode.CodeLens[] } = Object.create(null); + + constructor(documents: PluginHostModelService, provider: vscode.CodeLensProvider) { + this._documents = documents; + this._provider = provider; + } + + findCodeLensSymbols(resource: URI): TPromise { + let doc = this._documents.getDocument(resource); + let key = resource.toString(); + + delete this._cache[key]; + + return asWinJsPromise(token => this._provider.provideCodeLenses(doc, token)).then(value => { + if (!Array.isArray(value)) { + return; + } + + this._cache[key] = value; + + return value.map((lens, i) => { + return { + id: String(i), + range: TypeConverters.fromRange(lens.range), + command: TypeConverters.Command.from(lens.command) + } + }); + }); + } + + resolveCodeLensSymbol(resource: URI, symbol: modes.ICodeLensSymbol): TPromise { + + let lenses = this._cache[resource.toString()]; + if (!lenses) { + return; + } + + let lens = lenses[Number(symbol.id)]; + if (!lens) { + return; + } + + let resolve: TPromise; + if (typeof this._provider.resolveCodeLens !== 'function' || lens.isResolved) { + resolve = TPromise.as(lens); + } else { + resolve = asWinJsPromise(token => this._provider.resolveCodeLens(lens, token)); + } + + return resolve.then(newLens => { + lens = newLens || lens; + let command = lens.command; + if (!command) { + command = { + title: '<>', + command: 'missing', + } + } + + symbol.command = TypeConverters.Command.from(command); + return symbol; + }); + } +} + +class DeclarationAdapter implements modes.IDeclarationSupport { + + private _documents: PluginHostModelService; + private _provider: vscode.DefinitionProvider; + + constructor(documents: PluginHostModelService, provider: vscode.DefinitionProvider) { + this._documents = documents; + this._provider = provider; + } + + canFindDeclaration() { + return true; + } + + findDeclaration(resource: URI, position: IPosition): TPromise { + let doc = this._documents.getDocument(resource); + let pos = TypeConverters.toPosition(position); + return asWinJsPromise(token => this._provider.provideDefinition(doc, pos, token)).then(value => { + if (Array.isArray(value)) { + return value.map(DeclarationAdapter._convertLocation); + } else if (value) { + return DeclarationAdapter._convertLocation(value); + } + }); + } + + private static _convertLocation(location: vscode.Location): modes.IReference { + if (!location) { + return; + } + return { + resource: location.uri, + range: TypeConverters.fromRange(location.range) + }; + } +} + +class ExtraInfoAdapter implements modes.IExtraInfoSupport { + + private _documents: PluginHostModelService; + private _provider: vscode.HoverProvider; + + constructor(documents: PluginHostModelService, provider: vscode.HoverProvider) { + this._documents = documents; + this._provider = provider; + } + + computeInfo(resource: URI, position: IPosition): TPromise { + + let doc = this._documents.getDocument(resource); + let pos = TypeConverters.toPosition(position); + + return asWinJsPromise(token => this._provider.provideHover(doc, pos, token)).then(value => { + if (!value) { + return; + } + if (!value.range) { + value.range = doc.getWordRangeAtPosition(pos); + } + if (!value.range) { + value.range = new Range(pos, pos); + } + + return TypeConverters.fromHover(value); + }); + } +} + +class OccurrencesAdapter implements modes.IOccurrencesSupport { + + private _documents: PluginHostModelService; + private _provider: vscode.DocumentHighlightProvider; + + constructor(documents: PluginHostModelService, provider: vscode.DocumentHighlightProvider) { + this._documents = documents; + this._provider = provider; + } + + findOccurrences(resource: URI, position: IPosition): TPromise { + + let doc = this._documents.getDocument(resource); + let pos = TypeConverters.toPosition(position); + + return asWinJsPromise(token => this._provider.provideDocumentHighlights(doc, pos, token)).then(value => { + if (Array.isArray(value)) { + return value.map(OccurrencesAdapter._convertDocumentHighlight); + } + }); + } + + private static _convertDocumentHighlight(documentHighlight: vscode.DocumentHighlight): modes.IOccurence { + return { + range: TypeConverters.fromRange(documentHighlight.range), + kind: DocumentHighlightKind[documentHighlight.kind].toString().toLowerCase() + } + } +} + +class ReferenceAdapter implements modes.IReferenceSupport { + + private _documents: PluginHostModelService; + private _provider: vscode.ReferenceProvider; + + constructor(documents: PluginHostModelService, provider: vscode.ReferenceProvider) { + this._documents = documents; + this._provider = provider; + } + + canFindReferences():boolean { + return true + } + + findReferences(resource: URI, position: IPosition, includeDeclaration: boolean): TPromise { + let doc = this._documents.getDocument(resource); + let pos = TypeConverters.toPosition(position); + + return asWinJsPromise(token => this._provider.provideReferences(doc, pos, { includeDeclaration }, token)).then(value => { + if (Array.isArray(value)) { + return value.map(ReferenceAdapter._convertLocation); + } + }); + } + + private static _convertLocation(location: vscode.Location): modes.IReference { + return { + resource: location.uri, + range: TypeConverters.fromRange(location.range) + }; + } +} + +class QuickFixAdapter implements modes.IQuickFixSupport { + + private _documents: PluginHostModelService; + private _commands: PluginHostCommands; + private _provider: vscode.CodeActionProvider; + + constructor(documents: PluginHostModelService, commands: PluginHostCommands, provider: vscode.CodeActionProvider) { + this._documents = documents; + this._commands = commands; + this._provider = provider; + } + + getQuickFixes(resource: URI, range: IRange, marker?: IMarker[]): TPromise { + + const doc = this._documents.getDocument(resource); + const ran = TypeConverters.toRange(range); + const diagnostics = marker.map(marker => { + const diag = new Diagnostic(TypeConverters.toRange(marker), marker.message); + diag.code = marker.code; + diag.severity = TypeConverters.toDiagnosticSeverty(marker.severity); + return diag; + }); + + return asWinJsPromise(token => this._provider.provideCodeActions(doc, ran, { diagnostics: diagnostics }, token)).then(commands => { + if (!Array.isArray(commands)) { + return; + } + return commands.map((command, i) => { + return { + command: TypeConverters.Command.from(command), + score: i + }; + }); + }); + } + + runQuickFixAction(resource: URI, range: IRange, quickFix: modes.IQuickFix): any { + let {command} = quickFix; + return this._commands.executeCommand(command.id, ...command.arguments); + } +} + +class DocumentFormattingAdapter implements modes.IFormattingSupport { + + private _documents: PluginHostModelService; + private _provider: vscode.DocumentFormattingEditProvider; + + constructor(documents: PluginHostModelService, provider: vscode.DocumentFormattingEditProvider) { + this._documents = documents; + this._provider = provider; + } + + formatDocument(resource: URI, options: modes.IFormattingOptions): TPromise { + + let doc = this._documents.getDocument(resource); + + return asWinJsPromise(token => this._provider.provideDocumentFormattingEdits(doc, options, token)).then(value => { + if (Array.isArray(value)) { + return value.map(TypeConverters.TextEdit.from); + } + }); + } +} + +class RangeFormattingAdapter implements modes.IFormattingSupport { + + private _documents: PluginHostModelService; + private _provider: vscode.DocumentRangeFormattingEditProvider; + + constructor(documents: PluginHostModelService, provider: vscode.DocumentRangeFormattingEditProvider) { + this._documents = documents; + this._provider = provider; + } + + formatRange(resource: URI, range: IRange, options: modes.IFormattingOptions): TPromise { + + let doc = this._documents.getDocument(resource); + let ran = TypeConverters.toRange(range); + + return asWinJsPromise(token => this._provider.provideDocumentRangeFormattingEdits(doc, ran, options, token)).then(value => { + if (Array.isArray(value)) { + return value.map(TypeConverters.TextEdit.from); + } + }); + } +} + +class OnTypeFormattingAdapter implements modes.IFormattingSupport { + + private _documents: PluginHostModelService; + private _provider: vscode.OnTypeFormattingEditProvider; + + constructor(documents: PluginHostModelService, provider: vscode.OnTypeFormattingEditProvider) { + this._documents = documents; + this._provider = provider; + } + + autoFormatTriggerCharacters = []; // not here + + formatAfterKeystroke(resource: URI, position: IPosition, ch: string, options: modes.IFormattingOptions): TPromise { + + let doc = this._documents.getDocument(resource); + let pos = TypeConverters.toPosition(position); + + return asWinJsPromise(token => this._provider.provideOnTypeFormattingEdits(doc, pos, ch, options, token)).then(value => { + if (Array.isArray(value)) { + return value.map(TypeConverters.TextEdit.from); + } + }); + } +} + +class NavigateTypeAdapter implements INavigateTypesSupport { + + private _provider: vscode.WorkspaceSymbolProvider; + + constructor(provider: vscode.WorkspaceSymbolProvider) { + this._provider = provider; + } + + getNavigateToItems(search: string): TPromise { + return asWinJsPromise(token => this._provider.provideWorkspaceSymbols(search, token)).then(value => { + if (Array.isArray(value)) { + return value.map(TypeConverters.fromSymbolInformation); + } + }); + } +} + +class RenameAdapter implements modes.IRenameSupport { + + private _documents: PluginHostModelService; + private _provider: vscode.RenameProvider; + + constructor(documents: PluginHostModelService, provider: vscode.RenameProvider) { + this._documents = documents; + this._provider = provider; + } + + rename(resource: URI, position: IPosition, newName: string): TPromise { + + let doc = this._documents.getDocument(resource); + let pos = TypeConverters.toPosition(position); + + return asWinJsPromise(token => this._provider.provideRenameEdits(doc, pos, newName, token)).then(value => { + + if (!value) { + return; + } + + let result = { + currentName: undefined, + edits: [] + }; + + for (let entry of value.entries()) { + let [uri, textEdits] = entry; + for (let textEdit of textEdits) { + result.edits.push({ + resource: uri, + newText: textEdit.newText, + range: TypeConverters.fromRange(textEdit.range) + }); + } + } + return result; + }, err => { + if (typeof err === 'string') { + return { + currentName: undefined, + edits: undefined, + rejectReason: err + }; + } + return TPromise.wrapError(err); + }); + } +} + +interface ISuggestion2 extends modes.ISuggestion { + id: string; +} + +class SuggestAdapter implements modes.ISuggestSupport { + + private _documents: PluginHostModelService; + private _provider: vscode.CompletionItemProvider; + private _cache: { [key: string]: vscode.CompletionItem[] } = Object.create(null); + + constructor(documents: PluginHostModelService, provider: vscode.CompletionItemProvider) { + this._documents = documents; + this._provider = provider; + } + + suggest(resource: URI, position: IPosition): TPromise { + + const doc = this._documents.getDocument(resource); + const pos = TypeConverters.toPosition(position); + const ran = doc.getWordRangeAtPosition(pos); + + const key = resource.toString(); + delete this._cache[key]; + + return asWinJsPromise(token => this._provider.provideCompletionItems(doc, pos, token)).then(value => { + + let defaultSuggestions: modes.ISuggestResult = { + suggestions: [], + currentWord: ran ? doc.getText(new Range(ran.start, pos)) : '', + }; + let allSuggestions: modes.ISuggestResult[] = [defaultSuggestions]; + + + for (let i = 0; i < value.length; i++) { + const item = value[i]; + const suggestion = TypeConverters.Suggest.from(item); + + if (item.textEdit) { + + let editRange = item.textEdit.range; + + // invalid text edit + if (!editRange.isSingleLine || editRange.start.line !== pos.line) { + console.warn('INVALID text edit, must be single line and on the same line'); + continue; + } + + // insert the text of the edit and create a dedicated + // suggestion-container with overwrite[Before|After] + suggestion.codeSnippet = item.textEdit.newText; + + allSuggestions.push({ + currentWord: doc.getText(editRange), + suggestions: [suggestion], + overwriteBefore: pos.character - editRange.start.character, + overwriteAfter: editRange.end.character - pos.character + }); + + } else { + defaultSuggestions.suggestions.push(suggestion); + } + + // assign identifier to suggestion + suggestion.id = String(i); + } + + // cache for details call + this._cache[key] = value; + + return allSuggestions; + }); + } + + getSuggestionDetails(resource: URI, position: IPosition, suggestion: modes.ISuggestion): TPromise { + if (typeof this._provider.resolveCompletionItem !== 'function') { + return TPromise.as(suggestion); + } + let items = this._cache[resource.toString()]; + if (!items) { + return TPromise.as(suggestion); + } + let item = items[Number(( suggestion).id)]; + if (!item) { + return TPromise.as(suggestion); + } + return asWinJsPromise(token => this._provider.resolveCompletionItem(item, token)).then(resolvedItem => { + return TypeConverters.Suggest.from(resolvedItem || item); + }); + } + + getFilter(): any{ + throw new Error('illegal state'); + } + getTriggerCharacters(): string[] { + throw new Error('illegal state'); + } + shouldShowEmptySuggestionList(): boolean { + throw new Error('illegal state'); + } + shouldAutotriggerSuggest(context: modes.ILineContext, offset: number, triggeredByCharacter: string): boolean { + throw new Error('illegal state'); + } +} + +class ParameterHintsAdapter implements modes.IParameterHintsSupport { + + private _documents: PluginHostModelService; + private _provider: vscode.SignatureHelpProvider; + + constructor(documents: PluginHostModelService, provider: vscode.SignatureHelpProvider) { + this._documents = documents; + this._provider = provider; + } + + getParameterHints(resource: URI, position: IPosition, triggerCharacter?: string): TPromise { + + const doc = this._documents.getDocument(resource); + const pos = TypeConverters.toPosition(position); + + return asWinJsPromise(token => this._provider.provideSignatureHelp(doc, pos, token)).then(value => { + if (value instanceof SignatureHelp) { + return TypeConverters.SignatureHelp.from(value); + } + }); + } + + getParameterHintsTriggerCharacters(): string[] { + throw new Error('illegal state'); + } + + shouldTriggerParameterHints(context: modes.ILineContext, offset: number): boolean { + throw new Error('illegal state'); + } +} + +type Adapter = OutlineAdapter | CodeLensAdapter | DeclarationAdapter | ExtraInfoAdapter + | OccurrencesAdapter | ReferenceAdapter | QuickFixAdapter | DocumentFormattingAdapter + | RangeFormattingAdapter | OnTypeFormattingAdapter | NavigateTypeAdapter | RenameAdapter + | SuggestAdapter | ParameterHintsAdapter; + +@Remotable.PluginHostContext('ExtHostLanguageFeatures') +export class ExtHostLanguageFeatures { + + private static _handlePool = 0; + + private _proxy: MainThreadLanguageFeatures; + private _documents: PluginHostModelService; + private _commands: PluginHostCommands; + private _adapter: { [handle: number]: Adapter } = Object.create(null); + + constructor( @IThreadService threadService: IThreadService) { + this._proxy = threadService.getRemotable(MainThreadLanguageFeatures); + this._documents = threadService.getRemotable(PluginHostModelService); + this._commands = threadService.getRemotable(PluginHostCommands); + } + + private _createDisposable(handle: number): Disposable { + return new Disposable(() => { + delete this._adapter[handle]; + this._proxy.$unregister(handle); + }); + } + + private _nextHandle(): number { + return ExtHostLanguageFeatures._handlePool++; + } + + private _withAdapter(handle: number, ctor: { new (...args: any[]): A }, callback: (adapter: A) => TPromise): TPromise { + let adapter = this._adapter[handle]; + if (!(adapter instanceof ctor)) { + return TPromise.wrapError(new Error('no adapter found')); + } + return callback( adapter); + } + + // --- outline + + registerDocumentSymbolProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentSymbolProvider): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new OutlineAdapter(this._documents, provider); + this._proxy.$registerOutlineSupport(handle, selector); + return this._createDisposable(handle); + } + + $getOutline(handle: number, resource: URI): TPromise{ + return this._withAdapter(handle, OutlineAdapter, adapter => adapter.getOutline(resource)); + } + + // --- code lens + + registerCodeLensProvider(selector: vscode.DocumentSelector, provider: vscode.CodeLensProvider): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new CodeLensAdapter(this._documents, provider); + this._proxy.$registerCodeLensSupport(handle, selector); + return this._createDisposable(handle); + } + + $findCodeLensSymbols(handle: number, resource: URI): TPromise { + return this._withAdapter(handle, CodeLensAdapter, adapter => adapter.findCodeLensSymbols(resource)); + } + + $resolveCodeLensSymbol(handle:number, resource: URI, symbol: modes.ICodeLensSymbol): TPromise { + return this._withAdapter(handle, CodeLensAdapter, adapter => adapter.resolveCodeLensSymbol(resource, symbol)); + } + + // --- declaration + + registerDefinitionProvider(selector: vscode.DocumentSelector, provider: vscode.DefinitionProvider): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new DeclarationAdapter(this._documents, provider); + this._proxy.$registerDeclaractionSupport(handle, selector); + return this._createDisposable(handle); + } + + $findDeclaration(handle: number, resource: URI, position: IPosition): TPromise { + return this._withAdapter(handle, DeclarationAdapter, adapter => adapter.findDeclaration(resource, position)); + } + + // --- extra info + + registerHoverProvider(selector: vscode.DocumentSelector, provider: vscode.HoverProvider): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new ExtraInfoAdapter(this._documents, provider); + this._proxy.$registerExtraInfoSupport(handle, selector); + return this._createDisposable(handle); + } + + $computeInfo(handle:number, resource: URI, position: IPosition): TPromise { + return this._withAdapter(handle, ExtraInfoAdapter, adpater => adpater.computeInfo(resource, position)); + } + + // --- occurrences + + registerDocumentHighlightProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentHighlightProvider): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new OccurrencesAdapter(this._documents, provider); + this._proxy.$registerOccurrencesSupport(handle, selector); + return this._createDisposable(handle); + } + + $findOccurrences(handle:number, resource: URI, position: IPosition): TPromise { + return this._withAdapter(handle, OccurrencesAdapter, adapter => adapter.findOccurrences(resource, position)); + } + + // --- references + + registerReferenceProvider(selector: vscode.DocumentSelector, provider: vscode.ReferenceProvider): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new ReferenceAdapter(this._documents, provider); + this._proxy.$registerReferenceSupport(handle, selector); + return this._createDisposable(handle); + } + + $findReferences(handle: number, resource: URI, position: IPosition, includeDeclaration: boolean): TPromise { + return this._withAdapter(handle, ReferenceAdapter, adapter => adapter.findReferences(resource, position, includeDeclaration)); + } + + // --- quick fix + + registerCodeActionProvider(selector: vscode.DocumentSelector, provider: vscode.CodeActionProvider): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new QuickFixAdapter(this._documents, this._commands, provider); + this._proxy.$registerQuickFixSupport(handle, selector); + return this._createDisposable(handle); + } + + $getQuickFixes(handle:number, resource: URI, range: IRange, marker: IMarker[]): TPromise { + return this._withAdapter(handle, QuickFixAdapter, adapter => adapter.getQuickFixes(resource, range, marker)); + } + + $runQuickFixAction(handle: number, resource: URI, range: IRange, quickFix: modes.IQuickFix): any { + return this._withAdapter(handle, QuickFixAdapter, adapter => adapter.runQuickFixAction(resource, range, quickFix)); + } + + // --- formatting + + registerDocumentFormattingEditProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentFormattingEditProvider): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new DocumentFormattingAdapter(this._documents, provider); + this._proxy.$registerDocumentFormattingSupport(handle, selector); + return this._createDisposable(handle); + } + + $formatDocument(handle: number, resource: URI, options: modes.IFormattingOptions): TPromise{ + return this._withAdapter(handle, DocumentFormattingAdapter, adapter => adapter.formatDocument(resource, options)); + } + + registerDocumentRangeFormattingEditProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentRangeFormattingEditProvider): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new RangeFormattingAdapter(this._documents, provider); + this._proxy.$registerRangeFormattingSupport(handle, selector); + return this._createDisposable(handle); + } + + $formatRange(handle: number, resource: URI, range: IRange, options: modes.IFormattingOptions): TPromise{ + return this._withAdapter(handle, RangeFormattingAdapter, adapter => adapter.formatRange(resource, range, options)); + } + + registerOnTypeFormattingEditProvider(selector: vscode.DocumentSelector, provider: vscode.OnTypeFormattingEditProvider, triggerCharacters: string[]): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new OnTypeFormattingAdapter(this._documents, provider); + this._proxy.$registerOnTypeFormattingSupport(handle, selector, triggerCharacters); + return this._createDisposable(handle); + } + + $formatAfterKeystroke(handle: number, resource: URI, position: IPosition, ch: string, options: modes.IFormattingOptions): TPromise{ + return this._withAdapter(handle, OnTypeFormattingAdapter, adapter => adapter.formatAfterKeystroke(resource, position, ch, options)); + } + + // --- navigate types + + registerWorkspaceSymbolProvider(provider: vscode.WorkspaceSymbolProvider): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new NavigateTypeAdapter(provider); + this._proxy.$registerNavigateTypeSupport(handle); + return this._createDisposable(handle); + } + + $getNavigateToItems(handle: number, search: string): TPromise { + return this._withAdapter(handle, NavigateTypeAdapter, adapter => adapter.getNavigateToItems(search)); + } + + // --- rename + + registerRenameProvider(selector: vscode.DocumentSelector, provider: vscode.RenameProvider): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new RenameAdapter(this._documents, provider); + this._proxy.$registerRenameSupport(handle, selector); + return this._createDisposable(handle); + } + + $rename(handle: number, resource: URI, position: IPosition, newName: string): TPromise { + return this._withAdapter(handle, RenameAdapter, adapter => adapter.rename(resource, position, newName)); + } + + // --- suggestion + + registerCompletionItemProvider(selector: vscode.DocumentSelector, provider: vscode.CompletionItemProvider, triggerCharacters: string[]): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new SuggestAdapter(this._documents, provider); + this._proxy.$registerSuggestSupport(handle, selector, triggerCharacters); + return this._createDisposable(handle); + } + + $suggest(handle: number, resource: URI, position: IPosition): TPromise { + return this._withAdapter(handle, SuggestAdapter, adapter => adapter.suggest(resource, position)); + } + + $getSuggestionDetails(handle: number, resource: URI, position: IPosition, suggestion: modes.ISuggestion): TPromise { + return this._withAdapter(handle, SuggestAdapter, adapter => adapter.getSuggestionDetails(resource, position, suggestion)); + } + + // --- parameter hints + + registerSignatureHelpProvider(selector: vscode.DocumentSelector, provider: vscode.SignatureHelpProvider, triggerCharacters: string[]): vscode.Disposable { + const handle = this._nextHandle(); + this._adapter[handle] = new ParameterHintsAdapter(this._documents, provider); + this._proxy.$registerParameterHintsSupport(handle, selector, triggerCharacters); + return this._createDisposable(handle); + } + + $getParameterHints(handle: number, resource: URI, position: IPosition, triggerCharacter?: string): TPromise { + return this._withAdapter(handle, ParameterHintsAdapter, adapter => adapter.getParameterHints(resource, position, triggerCharacter)); + } +} + +@Remotable.MainContext('MainThreadLanguageFeatures') +export class MainThreadLanguageFeatures { + + private _proxy: ExtHostLanguageFeatures; + private _markerService: IMarkerService; + private _registrations: { [handle: number]: IDisposable; } = Object.create(null); + + constructor( @IThreadService threadService: IThreadService, @IMarkerService markerService: IMarkerService) { + this._proxy = threadService.getRemotable(ExtHostLanguageFeatures); + this._markerService = markerService; + } + + $unregister(handle: number): TPromise { + let registration = this._registrations[handle]; + if (registration) { + registration.dispose(); + delete this._registrations[handle]; + } + return undefined; + } + + // --- outline + + $registerOutlineSupport(handle: number, selector: vscode.DocumentSelector): TPromise { + this._registrations[handle] = OutlineRegistry.register(selector, { + getOutline: (resource: URI): TPromise => { + return this._proxy.$getOutline(handle, resource); + } + }); + return undefined; + } + + // --- code lens + + $registerCodeLensSupport(handle: number, selector: vscode.DocumentSelector): TPromise { + this._registrations[handle] = CodeLensRegistry.register(selector, { + findCodeLensSymbols: (resource: URI): TPromise => { + return this._proxy.$findCodeLensSymbols(handle, resource); + }, + resolveCodeLensSymbol: (resource: URI, symbol: modes.ICodeLensSymbol): TPromise => { + return this._proxy.$resolveCodeLensSymbol(handle, resource, symbol); + } + }); + return undefined; + } + + // --- declaration + + $registerDeclaractionSupport(handle: number, selector: vscode.DocumentSelector): TPromise { + this._registrations[handle] = DeclarationRegistry.register(selector, { + canFindDeclaration() { + return true; + }, + findDeclaration: (resource: URI, position: IPosition): TPromise => { + return this._proxy.$findDeclaration(handle, resource, position); + } + }); + return undefined; + } + + // --- extra info + + $registerExtraInfoSupport(handle: number, selector: vscode.DocumentSelector): TPromise { + this._registrations[handle] = ExtraInfoRegistry.register(selector, { + computeInfo: (resource: URI, position: IPosition): TPromise => { + return this._proxy.$computeInfo(handle, resource, position); + } + }); + return undefined; + } + + // --- occurrences + + $registerOccurrencesSupport(handle: number, selector: vscode.DocumentSelector): TPromise { + this._registrations[handle] = OccurrencesRegistry.register(selector, { + findOccurrences: (resource: URI, position: IPosition): TPromise => { + return this._proxy.$findOccurrences(handle, resource, position); + } + }); + return undefined; + } + + // --- references + + $registerReferenceSupport(handle: number, selector: vscode.DocumentSelector): TPromise { + this._registrations[handle] = ReferenceRegistry.register(selector, { + canFindReferences() { + return true; + }, + findReferences: (resource: URI, position: IPosition, includeDeclaration: boolean): TPromise => { + return this._proxy.$findReferences(handle, resource, position, includeDeclaration); + } + }); + return undefined; + } + + // --- quick fix + + $registerQuickFixSupport(handle: number, selector: vscode.DocumentSelector): TPromise { + this._registrations[handle] = QuickFixRegistry.register(selector, { + getQuickFixes: (resource: URI, range: IRange): TPromise => { + let markers: IMarker[] = []; + this._markerService.read({ resource }).forEach(marker => { + if (EditorRange.lift(marker).intersectRanges(range)) { + markers.push(marker); + } + }); + return this._proxy.$getQuickFixes(handle, resource, range, markers); + }, + runQuickFixAction: (resource: URI, range: IRange, quickFix: modes.IQuickFix) => { + return this._proxy.$runQuickFixAction(handle, resource, range, quickFix); + } + }); + return undefined; + } + + // --- formatting + + $registerDocumentFormattingSupport(handle: number, selector: vscode.DocumentSelector): TPromise { + this._registrations[handle] = FormatRegistry.register(selector, { + formatDocument: (resource: URI, options: modes.IFormattingOptions): TPromise => { + return this._proxy.$formatDocument(handle, resource, options); + } + }); + return undefined; + } + + $registerRangeFormattingSupport(handle: number, selector: vscode.DocumentSelector): TPromise { + this._registrations[handle] = FormatRegistry.register(selector, { + formatRange: (resource: URI, range: IRange, options: modes.IFormattingOptions): TPromise => { + return this._proxy.$formatRange(handle, resource, range, options); + } + }); + return undefined; + } + + $registerOnTypeFormattingSupport(handle: number, selector: vscode.DocumentSelector, autoFormatTriggerCharacters: string[]): TPromise { + this._registrations[handle] = FormatOnTypeRegistry.register(selector, { + + autoFormatTriggerCharacters, + + formatAfterKeystroke: (resource: URI, position: IPosition, ch: string, options: modes.IFormattingOptions): TPromise => { + return this._proxy.$formatAfterKeystroke(handle, resource, position, ch, options); + } + }); + return undefined; + } + + // --- navigate type + + $registerNavigateTypeSupport(handle: number): TPromise { + this._registrations[handle] = NavigateTypesSupportRegistry.register({ + getNavigateToItems: (search: string): TPromise => { + return this._proxy.$getNavigateToItems(handle, search); + } + }); + return undefined; + } + + // --- rename + + $registerRenameSupport(handle: number, selector: vscode.DocumentSelector): TPromise { + this._registrations[handle] = RenameRegistry.register(selector, { + rename: (resource: URI, position: IPosition, newName: string): TPromise => { + return this._proxy.$rename(handle, resource, position, newName); + } + }); + return undefined; + } + + // --- suggest + + $registerSuggestSupport(handle: number, selector: vscode.DocumentSelector, triggerCharacters: string[]): TPromise { + this._registrations[handle] = SuggestRegistry.register(selector, { + suggest: (resource: URI, position: IPosition, triggerCharacter?: string): TPromise => { + return this._proxy.$suggest(handle, resource, position); + }, + getSuggestionDetails: (resource: URI, position: IPosition, suggestion: modes.ISuggestion): TPromise => { + return this._proxy.$getSuggestionDetails(handle, resource, position, suggestion); + }, + getFilter() { + return DefaultFilter; + }, + getTriggerCharacters(): string[] { + return triggerCharacters; + }, + shouldShowEmptySuggestionList(): boolean { + return true; + }, + shouldAutotriggerSuggest(): boolean { + return true; + } + }); + return undefined; + } + + // --- parameter hints + + $registerParameterHintsSupport(handle: number, selector: vscode.DocumentSelector, triggerCharacter: string[]): TPromise { + this._registrations[handle] = ParameterHintsRegistry.register(selector, { + getParameterHints: (resource: URI, position: IPosition, triggerCharacter?: string): TPromise => { + return this._proxy.$getParameterHints(handle, resource, position, triggerCharacter); + }, + getParameterHintsTriggerCharacters(): string[] { + return triggerCharacter; + }, + shouldTriggerParameterHints(context: modes.ILineContext, offset: number): boolean { + return true; + } + }); + return undefined; + } +} \ No newline at end of file diff --git a/src/vs/workbench/api/common/languageFeatures.ts b/src/vs/workbench/api/common/languageFeatures.ts deleted file mode 100644 index b5caf5ddbd2..00000000000 --- a/src/vs/workbench/api/common/languageFeatures.ts +++ /dev/null @@ -1,1293 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 URI from 'vs/base/common/uri'; -import Event, {Emitter} from 'vs/base/common/event'; -import Severity from 'vs/base/common/severity'; -import {TPromise} from 'vs/base/common/winjs.base'; -import {sequence} from 'vs/base/common/async'; -import {Range as EditorRange} from 'vs/editor/common/core/range'; -import {IDisposable} from 'vs/base/common/lifecycle'; -import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService'; -import {Remotable, IThreadService} from 'vs/platform/thread/common/thread'; -import * as vscode from 'vscode'; -import * as TypeConverters from 'vs/workbench/api/common/pluginHostTypeConverters'; -import {Position, Range, SymbolKind, DocumentHighlightKind, Disposable, Diagnostic, DiagnosticSeverity, Location, SignatureHelp, CompletionItemKind} from 'vs/workbench/api/common/pluginHostTypes'; -import {IPosition, IRange, ISingleEditOperation} from 'vs/editor/common/editorCommon'; -import * as modes from 'vs/editor/common/modes'; -import {CancellationTokenSource} from 'vs/base/common/cancellation'; -import {PluginHostModelService} from 'vs/workbench/api/common/pluginHostDocuments'; -import {IMarkerService, IMarker} from 'vs/platform/markers/common/markers'; -import {PluginHostCommands, MainThreadCommands} from 'vs/workbench/api/common/pluginHostCommands'; -import DeclarationRegistry from 'vs/editor/contrib/goToDeclaration/common/goToDeclaration'; -import ExtraInfoRegistry from 'vs/editor/contrib/hover/common/hover'; -import DocumentHighlighterRegistry from 'vs/editor/contrib/wordHighlighter/common/wordHighlighter'; -import ReferenceSearchRegistry from 'vs/editor/contrib/referenceSearch/common/referenceSearch'; -import QuickFixRegistry from 'vs/editor/contrib/quickFix/common/quickFix'; -import QuickOutlineRegistry, {IOutlineEntry, IOutlineSupport} from 'vs/editor/contrib/quickOpen/common/quickOpen'; -import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry'; -import {NavigateTypesSupportRegistry, INavigateTypesSupport, ITypeBearing} from 'vs/workbench/parts/search/common/search' -import {RenameRegistry} from 'vs/editor/contrib/rename/common/rename'; -import {FormatRegistry, FormatOnTypeRegistry} from 'vs/editor/contrib/format/common/format'; -import {CodeLensRegistry} from 'vs/editor/contrib/codelens/common/codelens'; -import {ParameterHintsRegistry} from 'vs/editor/contrib/parameterHints/common/parameterHints'; -import {SuggestRegistry} from 'vs/editor/contrib/suggest/common/suggest'; - -function isThenable(obj: any): obj is Thenable { - return obj && typeof obj['then'] === 'function'; -} - -function asWinJsPromise(callback: (token: vscode.CancellationToken) => T | Thenable): TPromise { - let source = new CancellationTokenSource(); - return new TPromise((resolve, reject) => { - let item = callback(source.token); - if (isThenable(item)) { - item.then(resolve, reject); - } else { - resolve(item); - } - }, () => { - source.cancel(); - }); -} - -export abstract class AbstractMainThreadFeature { - - private _id: string; - protected _commands: PluginHostCommands; - protected _refCount = 0; - protected _disposable: IDisposable; - protected _registry: LanguageFeatureRegistry; - - constructor(id: string, registry: LanguageFeatureRegistry, @IThreadService threadService: IThreadService) { - this._id = id; - this._registry = registry; - this._commands = threadService.getRemotable(PluginHostCommands); - } - - _getId(): TPromise { - return TPromise.as(this._id); - } - - _register(selector: vscode.DocumentSelector): TPromise { - if (this._refCount++ === 0) { - this._disposable = this._registry.register(selector, this); - } - return undefined; - } - - _unregister(): TPromise { - if (--this._refCount === 0) { - this._disposable.dispose(); - } - return undefined; - } - - _executeCommand(...args:any[]):TPromise { - let result = this._commands.executeCommand(this._id, ...args); - return new TPromise((c, e) => { - result.then(c, e); - }); - } -} - -export abstract class AbstractExtensionHostFeature> { - - protected _commands: PluginHostCommands; - protected _proxy: P; - protected _registry = new LanguageFeatureRegistry(); - protected _models: PluginHostModelService; - - constructor(proxy: P, @IThreadService threadService: IThreadService) { - this._proxy = proxy; - this._models = threadService.getRemotable(PluginHostModelService); - this._commands = threadService.getRemotable(PluginHostCommands); - - proxy._getId().then(value => this._commands.registerCommand(value, this._runAsCommand, this)); - } - - register(selector: vscode.DocumentSelector, provider: T): vscode.Disposable { - - let disposable = this._registry.register(selector, provider); - let registered = this._proxy._register(selector); - - return new Disposable(() => { - disposable.dispose(); // remove locally - registered.then(() => this._proxy._unregister()); - }); - } - - protected abstract _runAsCommand(...args: any[]): any; - - protected _getAllFor(document: vscode.TextDocument): T[] { - return this._registry.all({ - language: document.languageId, - uri: document.uri - }); - } - - protected _getOrderedFor(document: vscode.TextDocument): T[] { - return this._registry.ordered({ - language: document.languageId, - uri: document.uri - }); - } -} - -// ---- definition feature - -export class ExtensionHostDefinitionFeature extends AbstractExtensionHostFeature { - - constructor(@IThreadService threadService: IThreadService) { - super(threadService.getRemotable(MainThreadDefinitionFeature), threadService); - } - - _runAsCommand(resource: URI, position: IPosition): TPromise { - - let document = this._models.getDocument(resource); - let pos = TypeConverters.toPosition(position); - let locations: vscode.Location[] = []; - - let promises = this._registry.all({ language: document.languageId, uri: document.uri }).map(provider => { - return asWinJsPromise(token => provider.provideDefinition(document, pos, token)).then(result => { - if (Array.isArray(result)) { - locations.push(...result); - } else { - locations.push( result); - } - }, err => { - console.error(err); - }); - }); - - return TPromise.join(promises).then(() => { - return locations.map(ExtensionHostDefinitionFeature._convertLocation); - }) - } - - private static _convertLocation(location: vscode.Location): modes.IReference { - if (!location) { - return; - } - return { - resource: location.uri, - range: TypeConverters.fromRange(location.range) - }; - } -} - -@Remotable.MainContext('MainThreadDefinitionProvider') -export class MainThreadDefinitionFeature extends AbstractMainThreadFeature implements modes.IDeclarationSupport { - - constructor(@IThreadService threadService: IThreadService) { - super('vscode.executeDefinitionProvider', DeclarationRegistry, threadService); - } - - canFindDeclaration() { - return true - } - - findDeclaration(resource: URI, position: IPosition): TPromise{ - return this._executeCommand(resource, position); - } -} - -// ---- hover - - -export class ExtensionHostHoverFeature extends AbstractExtensionHostFeature { - - constructor( @IThreadService threadService: IThreadService) { - super(threadService.getRemotable(MainThreadHoverFeature), threadService); - } - - _runAsCommand(resource: URI, position: IPosition): TPromise { - - let document = this._models.getDocument(resource); - let pos = TypeConverters.toPosition(position); - - // incrementally building up the result - let contents: vscode.MarkedString[] = []; - let word = document.getWordRangeAtPosition(pos); - let start = word && word.start || pos; - let end = word && word.end || pos; - - let promises = this._registry.all({ language: document.languageId, uri: document.uri }).map(provider => { - - return asWinJsPromise(token => provider.provideHover(document, pos, token)).then(result => { - - if (!result) { - return; - } - - if (result.range) { - if (result.range.start.isBefore(start)) { - start = result.range.start; - } - if (end.isBefore(result.range.end)) { - end = result.range.end; - } - } - - for (let markedString of result.contents) { - if (markedString) { - contents.push(markedString); - } - } - contents.push('\n'); - - }, err => { - console.error(err); - }); - }); - - return TPromise.join(promises).then(() => { - - contents.pop(); // remove the last '\n' element we added - - return { - range: TypeConverters.fromRange(new Range(start, end)), - htmlContent: contents.map(TypeConverters.fromFormattedString) - }; - }); - } -} - -@Remotable.MainContext('MainThreadHoverFeature') -export class MainThreadHoverFeature extends AbstractMainThreadFeature implements modes.IExtraInfoSupport { - - constructor(@IThreadService threadService: IThreadService) { - super('vscode.executeHoverProvider', ExtraInfoRegistry, threadService); - } - - computeInfo(resource: URI, position: IPosition): TPromise { - return this._executeCommand(resource, position); - } -} - -// --- occurrences - - -export class ExtensionHostOccurrencesFeature extends AbstractExtensionHostFeature { - - constructor(@IThreadService threadService: IThreadService) { - super(threadService.getRemotable(MainThreadOccurrencesFeature), threadService); - } - - _runAsCommand(resource: URI, position: IPosition): TPromise { - - let document = this._models.getDocument(resource); - let pos = TypeConverters.toPosition(position); - let highlights: vscode.DocumentHighlight[]; - - let factory = this._getOrderedFor(document).map(provider => { - return () => { - if (!highlights) { - return asWinJsPromise(token => provider.provideDocumentHighlights(document, pos, token)).then(result => { - if (Array.isArray(result) && result.length > 0) { - highlights = result; - } - }, err => { - console.error(err); - }); - } - } - }); - - return sequence(factory).then(() => { - if (highlights) { - return highlights.map(ExtensionHostOccurrencesFeature._convertDocumentHighlight); - } - }); - } - - private static _convertDocumentHighlight(documentHighlight: vscode.DocumentHighlight): modes.IOccurence { - return { - range: TypeConverters.fromRange(documentHighlight.range), - kind: DocumentHighlightKind[documentHighlight.kind].toString().toLowerCase() - } - } -} - -@Remotable.MainContext('MainThreadOccurrencesFeature') -export class MainThreadOccurrencesFeature extends AbstractMainThreadFeature { - - constructor(@IThreadService threadService: IThreadService) { - super('vscode.executeDocumentHighlights', DocumentHighlighterRegistry, threadService); - } - - findOccurrences(resource: URI, position: IPosition): TPromise { - return this._executeCommand(resource, position); - } -} - -// --- reference search - -export class ExtensionHostReferenceSearch extends AbstractExtensionHostFeature { - - constructor(@IThreadService threadService: IThreadService) { - super(threadService.getRemotable(MainThreadReferenceSearch), threadService); - } - - protected _runAsCommand(resource: URI, position: IPosition, includeDeclaration: boolean): TPromise { - - if (!(resource instanceof URI)) { - return TPromise.wrapError('resource expected'); - } - - let document = this._models.getDocument(resource); - let pos = TypeConverters.toPosition(position); - let locations: vscode.Location[] = []; - - let promises = this._registry.all({ language: document.languageId, uri: document.uri }).map(provider => { - return asWinJsPromise(token => provider.provideReferences(document, pos, { includeDeclaration }, token)).then(result => { - if (Array.isArray(result)) { - locations.push(...result); - } - }, err => { - console.error(err); - }); - }); - - return TPromise.join(promises).then(() => { - return locations.map(ExtensionHostReferenceSearch._convertLocation); - }); - } - - private static _convertLocation(location: vscode.Location): modes.IReference { - return { - resource: location.uri, - range: TypeConverters.fromRange(location.range) - }; - } -} - -@Remotable.MainContext('MainThreadReferenceSearch') -export class MainThreadReferenceSearch extends AbstractMainThreadFeature implements modes.IReferenceSupport { - - constructor(@IThreadService threadService: IThreadService) { - super('vscode.executeReferenceProvider', ReferenceSearchRegistry, threadService); - } - - canFindReferences():boolean { - return true - } - - findReferences(resource: URI, position: IPosition, includeDeclaration: boolean): TPromise { - return this._executeCommand(resource, position, includeDeclaration); - } -} - -// --- quick fix aka code actions - -export class ExtensionHostCodeActions extends AbstractExtensionHostFeature { - - private _disposable: Disposable; - - constructor(@IThreadService threadService: IThreadService) { - super(threadService.getRemotable(MainThreadCodeActions), threadService); - } - - _runAsCommand(resource: URI, range: IRange, marker:IMarker[]): TPromise { - - let document = this._models.getDocument(resource); - let _range = TypeConverters.toRange(range); - let commands: vscode.Command[] = []; - - let diagnostics = marker.map(marker => { - let diag = new Diagnostic(TypeConverters.toRange(marker), marker.message); - diag.code = marker.code; - diag.severity = TypeConverters.toDiagnosticSeverty(marker.severity); - return diag; - }); - - let promises = this._getAllFor(document).map(provider => { - return asWinJsPromise(token => provider.provideCodeActions(document, _range, { diagnostics }, token)).then(result => { - if (Array.isArray(result)) { - commands.push(...result); - } - }, err => { - console.error(err); - }); - }); - - return TPromise.join(promises).then(() => { - if (this._disposable) { - this._disposable.dispose(); - } - - let disposables: IDisposable[] = []; - let quickFixes: modes.IQuickFix[] = []; - - commands.forEach((command, i) => { - - let id = '_code_action_action_wrapper_#' + i; - - // create fake action such that the aruments don't - // have to be send between ext-host - disposables.push(this._commands.registerCommand(id, () => { - return this._commands.executeCommand(command.command, ...command.arguments); - })); - - // create quick fix - quickFixes.push({ - id, - label: command.title, - score: 1 - }); - }); - - // not very nice... we need - // some sort of event to tell us when - // quick fix is bored of our commands - this._disposable = Disposable.from(...disposables); - return quickFixes; - }); - } -} - -@Remotable.MainContext('MainThreadCodeAction') -export class MainThreadCodeActions extends AbstractMainThreadFeature implements modes.IQuickFixSupport { - - private _keybindingService: IKeybindingService; - private _markerService: IMarkerService; - - constructor( @IThreadService threadService: IThreadService, @IKeybindingService keybindingService: IKeybindingService, - @IMarkerService markerService: IMarkerService) { - - super('vscode.executeCodeActionProvider', QuickFixRegistry, threadService); - this._keybindingService = keybindingService; - this._markerService = markerService; - } - - getQuickFixes(resource: URI, range: IRange): TPromise { - - let markers: IMarker[] = []; - this._markerService.read({ resource }).forEach(marker => { - if (EditorRange.lift(marker).intersectRanges(range)) { - markers.push(marker); - } - }); - - return this._executeCommand(resource, range, markers); - } - - runQuickFixAction (resource:URI, range:IRange, id:string) { - return TPromise.as(this._keybindingService.executeCommand(id)); - } -} - -// ---- OutlineSupport aka DocumentSymbols - -export class ExtensionHostDocumentSymbols extends AbstractExtensionHostFeature { - - constructor( @IThreadService threadService: IThreadService) { - super(threadService.getRemotable(MainThreadDocumentSymbols), threadService); - } - - protected _runAsCommand(resource: URI): TPromise { - - if (!(resource instanceof URI)) { - return TPromise.wrapError('uri missing'); - } - - let symbols: vscode.SymbolInformation[] = []; - let document = this._models.getDocument(resource); - let candidate = { - language: document.languageId, - uri: document.uri - }; - let promises = this._registry.all(candidate).map(provider => { - return asWinJsPromise(token => { - return provider.provideDocumentSymbols(document, token); - }).then(result => { - if (Array.isArray(result)) { - symbols.push(...result); - } - }, err => { - console.log(err); - }); - }); - - return TPromise.join(promises).then(() => { - return symbols - .sort(ExtensionHostDocumentSymbols._compareByStart) - .map(ExtensionHostDocumentSymbols._convertSymbolInfo); - }); - } - - private static _compareByStart(a: vscode.SymbolInformation, b: vscode.SymbolInformation): number { - if (a.location.range.start.isBefore(b.location.range.start)) { - return -1; - } else if (b.location.range.start.isBefore(a.location.range.start)) { - return 1; - } else { - return 0; - } - } - - private static _convertSymbolInfo(symbol: vscode.SymbolInformation): IOutlineEntry { - return { - type: TypeConverters.fromSymbolKind(symbol.kind), - range: TypeConverters.fromRange(symbol.location.range), - containerLabel: symbol.containerName, - label: symbol.name, - icon: undefined, - }; - } -} - -@Remotable.MainContext('MainThreadDocumentSymbols2') -export class MainThreadDocumentSymbols extends AbstractMainThreadFeature implements IOutlineSupport { - - constructor( @IThreadService threadService: IThreadService) { - super('vscode.executeDocumentSymbolProvider', QuickOutlineRegistry, threadService); - } - - getOutline(resource: URI): TPromise{ - return this._executeCommand(resource); - } -} - -// -- Rename provider - -export class ExtensionHostRename extends AbstractExtensionHostFeature { - - constructor( @IThreadService threadService: IThreadService) { - super(threadService.getRemotable(MainThreadRename), threadService); - } - - _runAsCommand(resource: URI, position: IPosition, newName: string): TPromise { - - let document = this._models.getDocument(resource); - let pos = TypeConverters.toPosition(position); - - let hasResult = false; - let rejects: string[] = []; - let factory = this._getOrderedFor(document).map(provider => { - return () => { - if (!hasResult) { - return asWinJsPromise(token => provider.provideRenameEdits(document, pos, newName, token)).then(result => { - if (result && result.size > 0) { - hasResult = true; - return result; - } - }, err => { - if (typeof err === 'string') { - rejects.push(err); - } - }); - } - }; - }); - - return sequence(factory).then(results => { - let rename = results[0]; - if (!rename) { - return { - rejectReason: rejects.join('\n'), - edits: undefined, - currentName: undefined - }; - } - - let result = { - currentName: undefined, - edits: [] - }; - for (let entry of rename.entries()) { - let [uri, textEdits] = entry; - for (let textEdit of textEdits) { - result.edits.push({ - resource: uri, - newText: textEdit.newText, - range: TypeConverters.fromRange(textEdit.range) - }); - } - } - return result; - }); - } -} - -@Remotable.MainContext('MainThreadRename') -export class MainThreadRename extends AbstractMainThreadFeature implements modes.IRenameSupport { - - constructor( @IThreadService threadService: IThreadService) { - super('vscode.executeDocumentRenameProvider', RenameRegistry, threadService); - } - - rename(resource: URI, position: IPosition, newName: string): TPromise { - return this._executeCommand(resource, position, newName); - } -} - -// --- format - -export class ExtHostFormatDocument extends AbstractExtensionHostFeature { - - constructor( @IThreadService threadService: IThreadService) { - super(threadService.getRemotable(MainThreadFormatDocument), threadService); - } - - _runAsCommand(resource: URI, options: modes.IFormattingOptions): TPromise { - - let document = this._models.getDocument(resource); - let provider = this._getOrderedFor(document)[0]; - - return asWinJsPromise(token => provider.provideDocumentFormattingEdits(document, options, token)).then(result => { - if (Array.isArray(result)) { - return result.map(ExtHostFormatDocument.convertTextEdit); - } - }); - } - - static convertTextEdit(edit: vscode.TextEdit): ISingleEditOperation { - return { - text: edit.newText, - range: TypeConverters.fromRange(edit.range) - } - } -} - -@Remotable.MainContext('MainThreadFormatDocument') -export class MainThreadFormatDocument extends AbstractMainThreadFeature implements modes.IFormattingSupport { - - constructor( @IThreadService threadService: IThreadService) { - super('vscode.executeFormatDocumentProvider', FormatRegistry, threadService); - } - - formatDocument(resource: URI, options: modes.IFormattingOptions):TPromise { - return this._executeCommand(resource, options); - } -} - -export class ExtHostFormatRange extends AbstractExtensionHostFeature { - - constructor( @IThreadService threadService: IThreadService) { - super(threadService.getRemotable(MainThreadFormatRange), threadService); - } - - _runAsCommand(resource: URI, range: IRange, options: modes.IFormattingOptions): TPromise { - - let document = this._models.getDocument(resource); - let provider = this._getOrderedFor(document)[0]; - let ran: Range; - - if (range) { - ran = TypeConverters.toRange(range); - } else { - let lastLine = document.lineAt(document.lineCount - 1); - let {line, character} = lastLine.range.end; - ran = new Range(0, 0, line, character); - } - - return asWinJsPromise(token => provider.provideDocumentRangeFormattingEdits(document, ran, options, token)).then(result => { - if (Array.isArray(result)) { - return result.map(ExtHostFormatDocument.convertTextEdit); - } - }); - } -} - -@Remotable.MainContext('MainThreadFormatRange') -export class MainThreadFormatRange extends AbstractMainThreadFeature implements modes.IFormattingSupport { - - constructor( @IThreadService threadService: IThreadService) { - super('vscode.executeFormatRangeProvider', FormatRegistry, threadService); - } - - formatRange(resource: URI, range:IRange, options: modes.IFormattingOptions):TPromise { - return this._executeCommand(resource, range, options); - } -} - -// --- format on type - -export interface FormatOnTypeEntry { - triggerCharacters: string[]; - provider: vscode.OnTypeFormattingEditProvider; -} - -export class ExtHostFormatOnType extends AbstractExtensionHostFeature { - - constructor( @IThreadService threadService: IThreadService) { - super(threadService.getRemotable(MainThreadFormatOnType), threadService); - } - - register(selector: vscode.DocumentSelector, provider: FormatOnTypeEntry): vscode.Disposable { - - let disposable = this._registry.register(selector, provider); - let registered = this._proxy._register(selector, provider.triggerCharacters); - - return new Disposable(() => { - disposable.dispose(); - registered.then(() => this._proxy._unregister()); - }); - } - - _runAsCommand(resource: URI, position: IPosition, ch: string, options: modes.IFormattingOptions): TPromise { - - let document = this._models.getDocument(resource); - let pos = TypeConverters.toPosition(position); - - let ordered = this._getOrderedFor(document); - let provider: vscode.OnTypeFormattingEditProvider; - for (let entry of ordered) { - if (entry.triggerCharacters.indexOf(ch) >= 0) { - provider = entry.provider; - break; - } - } - - if (provider) { - return asWinJsPromise(token => provider.provideOnTypeFormattingEdits(document, pos, ch, options, token)).then(result => { - if (Array.isArray(result)) { - return result.map(ExtHostFormatDocument.convertTextEdit); - } - }); - } - } -} - -@Remotable.MainContext('MainThreadFormatOnType') -export class MainThreadFormatOnType extends AbstractMainThreadFeature implements modes.IFormattingSupport { - - autoFormatTriggerCharacters: string[] = []; - - constructor( @IThreadService threadService: IThreadService) { - super('vscode.executeFormatOnTypeProvider', FormatOnTypeRegistry, threadService); - } - - _register(selector: vscode.DocumentSelector, triggerCharacters: string[] = []): TPromise { - this.autoFormatTriggerCharacters.push(...triggerCharacters); - return super._register(selector); - } - - formatDocument(resource: URI, options: modes.IFormattingOptions):TPromise { - throw new Error('format on type only'); - } - - formatAfterKeystroke(resource: URI, position: IPosition, ch: string, options: modes.IFormattingOptions): TPromise { - return this._executeCommand(resource, position, ch, options); - } -} - -// ---- signature help - -export interface SignatureHelpEntry { - provider: vscode.SignatureHelpProvider; - triggerCharacters: string[]; -} - -export class ExtHostSignatureHelp extends AbstractExtensionHostFeature { - - constructor( @IThreadService threadService: IThreadService) { - super(threadService.getRemotable(MainThreadSignatureHelp), threadService); - } - - register(selector: vscode.DocumentSelector, entry: SignatureHelpEntry): vscode.Disposable { - - let disposable = this._registry.register(selector, entry); - let registered = this._proxy._register(selector, entry.triggerCharacters); - - return new Disposable(() => { - disposable.dispose(); - registered.then(() => this._proxy._unregister()); - }); - } - - _runAsCommand(resource: URI, position: IPosition, triggerCharacter?: string): TPromise { - - let document = this._models.getDocument(resource); - let pos = TypeConverters.toPosition(position); - - let entry = this._getOrderedFor(document)[0]; - if (entry) { - - if (triggerCharacter) { - if (entry.triggerCharacters.indexOf(triggerCharacter) < 0) { - return; - } - } - - return asWinJsPromise(token => entry.provider.provideSignatureHelp(document, pos, token)).then(result => { - if (result instanceof SignatureHelp) { - return ExtHostSignatureHelp._convertSignatureHelp(result); - } - }); - } - } - - private static _convertSignatureHelp(signatureHelp: SignatureHelp): modes.IParameterHints { - - let result: modes.IParameterHints = { - currentSignature: signatureHelp.activeSignature, - currentParameter: signatureHelp.activeParameter, - signatures: [] - } - - for (let signature of signatureHelp.signatures) { - - let signatureItem: modes.ISignature = { - label: signature.label, - documentation: signature.documentation, - parameters: [] - }; - - let idx = 0; - for (let parameter of signature.parameters) { - - let parameterItem: modes.IParameter = { - label: parameter.label, - documentation: parameter.documentation, - }; - - signatureItem.parameters.push(parameterItem); - idx = signature.label.indexOf(parameter.label, idx); - - if (idx >= 0) { - parameterItem.signatureLabelOffset = idx; - idx += parameter.label.length; - parameterItem.signatureLabelEnd = idx; - } - } - - result.signatures.push(signatureItem); - } - - return result; - } -} - -@Remotable.MainContext('MainThreadSignatureHelp') -export class MainThreadSignatureHelp extends AbstractMainThreadFeature implements modes.IParameterHintsSupport { - - private _triggerCharacters: string[] = []; - - constructor( @IThreadService threadService: IThreadService) { - super('vscode.executeSignatureHelpProvider', ParameterHintsRegistry, threadService); - } - - _register(selector: vscode.DocumentSelector, triggerCharacters: string[] = []): TPromise { - this._triggerCharacters.push(...triggerCharacters); - return super._register(selector); - } - - getParameterHintsTriggerCharacters(): string[] { - return this._triggerCharacters; - } - - shouldTriggerParameterHints(context: modes.ILineContext, offset: number): boolean { - return true; - } - - getParameterHints(resource: URI, position: IPosition, triggerCharacter?: string): TPromise { - return this._executeCommand(resource, position, triggerCharacter); - } -} - -// ---- Completions - -export interface CompletionItemEnty { - provider: vscode.CompletionItemProvider; - triggerCharacters: string[]; -} - -@Remotable.PluginHostContext('ExtHostCompletions') -export class ExtHostCompletions extends AbstractExtensionHostFeature { - - private _detailsStorage: {[n:number]:[vscode.CompletionItemProvider, vscode.CompletionItem]} = Object.create(null); - - constructor( @IThreadService threadService: IThreadService) { - super(threadService.getRemotable(MainThreadCompletions), threadService); - } - - register(selector: vscode.DocumentSelector, entry: CompletionItemEnty): vscode.Disposable { - let disposable = this._registry.register(selector, entry); - let registered = this._proxy._register(selector, entry.triggerCharacters); - return new Disposable(() => { - disposable.dispose(); - registered.then(() => this._proxy._unregister()); - }); - } - - _runAsCommand(resource: URI, position: IPosition, character?: string): TPromise { - - this._detailsStorage = Object.create(null); - - let document = this._models.getDocument(resource); - let pos = TypeConverters.toPosition(position); - let ran = document.getWordRangeAtPosition(pos); - let entries = this._getOrderedFor(document); - - // filter - if (character) { - entries = entries.filter(provider => provider.triggerCharacters.indexOf(character) >= 0); - } - - let defaultSuggestions: modes.ISuggestions = { - suggestions: [], - currentWord: ran ? document.getText(new Range(ran.start, pos)) : '', - }; - let allSuggestions: modes.ISuggestions[] = [defaultSuggestions]; - - let promises = entries.map(entry => { - return asWinJsPromise(token => entry.provider.provideCompletionItems(document, pos, token)).then(result => { - if (!Array.isArray(result)) { - return; - } - - let canResolveDetails = typeof entry.provider.resolveCompletionItem === 'function'; - let detailsIdPool = 1; - - for (let item of result) { - - let suggestion = ExtHostCompletions._convertCompletionItem(item); - if (item.textEdit) { - - let editRange = item.textEdit.range; - - // invalid text edit - if (!editRange.isSingleLine || editRange.start.line !== pos.line) { - console.warn('INVALID text edit, must be single line and on the same line'); - continue; - } - - // insert the text of the edit and create a dedicated - // suggestion-container with overwrite[Before|After] - suggestion.codeSnippet = item.textEdit.newText; - - allSuggestions.push({ - currentWord: document.getText(editRange), - suggestions: [suggestion], - overwriteBefore: pos.character - editRange.start.character, - overwriteAfter: editRange.end.character - pos.character - }); - - } else { - defaultSuggestions.suggestions.push(suggestion); - } - - if (canResolveDetails) { - let id = detailsIdPool++; - (suggestion)._detailsId = id; - this._detailsStorage[id] = [entry.provider, item]; - } - } - }); - }); - - return TPromise.join(promises).then(() => allSuggestions); - } - - _resolveDetails(suggestion: modes.ISuggestion): TPromise { - let id = (suggestion)._detailsId; - if (this._detailsStorage[id]) { - let [provider, item] = this._detailsStorage[id]; - return asWinJsPromise(token => provider.resolveCompletionItem(item, token)).then(resolvedItem => { - return ExtHostCompletions._convertCompletionItem(resolvedItem || item); - }); - } - } - - private static _convertCompletionItem(item: vscode.CompletionItem): modes.ISuggestion { - return { - label: item.label, - codeSnippet: item.insertText || item.label, - type: CompletionItemKind[item.kind || CompletionItemKind.Text].toString().toLowerCase(), - typeLabel: item.detail, - documentationLabel: item.documentation, - sortText: item.sortText, - filterText: item.filterText - }; - } -} - -@Remotable.MainContext('MainThreadCompletions') -export class MainThreadCompletions extends AbstractMainThreadFeature { - - private _triggerCharacters: string[] = []; - private _proxy: ExtHostCompletions; - - constructor( @IThreadService threadService: IThreadService) { - super('vscode.executeCompletionItemProvider', SuggestRegistry, threadService); - this._proxy = threadService.getRemotable(ExtHostCompletions); - } - - _register(selector: vscode.DocumentSelector, triggerCharacters: string[] = []): TPromise { - this._triggerCharacters.push(...triggerCharacters); - return super._register(selector); - } - - suggest(resource: URI, position: IPosition, triggerCharacter?: string): TPromise { - return this._executeCommand(resource, position, triggerCharacter); - } - - getSuggestionDetails(resource: URI, position: IPosition, suggestion: modes.ISuggestion): TPromise { - return this._proxy._resolveDetails(suggestion).then(value => { - return value || suggestion - }); - } - - getTriggerCharacters(): string[] { - return this._triggerCharacters; - } - - shouldShowEmptySuggestionList(): boolean { - return false; - } - - shouldAutotriggerSuggest(context: modes.ILineContext, offset: number, triggeredByCharacter: string): boolean { - return true; - } -} - -// ---- Code Lens - -@Remotable.PluginHostContext('ExtensionHostCodeLens') -export class ExtensionHostCodeLens extends AbstractExtensionHostFeature { - - private static _idPool = 0; - private _lenses: { [id: string]: [string, vscode.CodeLensProvider, vscode.CodeLens] } = Object.create(null); - - constructor(@IThreadService threadService: IThreadService) { - super(threadService.getRemotable(MainThreadCodeLens), threadService); - this._models.onDidRemoveDocument(event => this._clearCache(event.uri)); - } - - _clearCache(resource: URI): void { - for (let key in this._lenses) { - if (this._lenses[key][0] === resource.toString()) { - delete this._lenses[key]; - } - } - } - - _runAsCommand(resource: URI): TPromise { - - let document = this._models.getDocument(resource); - let result: modes.ICodeLensSymbol[] = []; - let promises = this._getAllFor(document).map(provider => { - - let providerCanResolveLens = typeof provider.resolveCodeLens === 'function'; - - return asWinJsPromise(token => provider.provideCodeLenses(document, token)).then(lenses => { - - // new commands - this._clearCache(resource); - - if (!Array.isArray(lenses)) { - return; - } - for (let lens of lenses) { - - if (!providerCanResolveLens && !lens.isResolved) { - throw new Error('illegal state - code lens must be resolved or provider must implement resolveCodeLens-function'); - } - - let id = 'code_lense_#' + ExtensionHostCodeLens._idPool++; - this._lenses[id] = [resource.toString(), provider, lens]; - - result.push({ - id, - range: TypeConverters.fromRange(lens.range) - }); - } - }, err => { - console.error(err); - }); - }); - - return TPromise.join(promises).then(() => { - return result; - }); - } - - _resolveCodeLensSymbol(symbol: modes.ICodeLensSymbol): TPromise { - - if (!this._lenses[symbol.id]) { - return; - } - - let [, provider, lens] = this._lenses[symbol.id]; - let resolve: TPromise; - - if (typeof provider.resolveCodeLens !== 'function') { - resolve = TPromise.as(lens); - } else { - resolve = asWinJsPromise(token => provider.resolveCodeLens(lens, token)); - } - - return resolve.then(newLens => { - lens = newLens || lens; - if (lens.command) { - return { - id: lens.command.command, - title: lens.command.title, - arguments: lens.command.arguments - } - } - }); - } -} - -@Remotable.MainContext('MainThreadCodeLens') -export class MainThreadCodeLens extends AbstractMainThreadFeature implements modes.ICodeLensSupport { - - private _proxy: ExtensionHostCodeLens; - - constructor( @IThreadService threadService: IThreadService) { - super('vscode.executeCodeLensProvider', CodeLensRegistry, threadService); - this._proxy = threadService.getRemotable(ExtensionHostCodeLens); - } - - findCodeLensSymbols(resource: URI): TPromise { - return this._executeCommand(resource); - } - - resolveCodeLensSymbol(resource: URI, symbol: modes.ICodeLensSymbol): TPromise { - return this._proxy._resolveCodeLensSymbol(symbol); - } -} - -// --- workspace symbols - -export class ExtensionHostWorkspaceSymbols { - - private _provider: vscode.WorkspaceSymbolProvider[] = []; - private _proxy: MainThreadWorkspaceSymbols; - private _threadService: IThreadService; - private _commands: PluginHostCommands; - - constructor(@IThreadService threadService: IThreadService) { - this._threadService = threadService; - this._commands = threadService.getRemotable(PluginHostCommands); - this._proxy = threadService.getRemotable(MainThreadWorkspaceSymbols); - this._commands.registerCommand(MainThreadWorkspaceSymbols.CommandId, this._runAsCommand, this); - } - - register(provider: vscode.WorkspaceSymbolProvider): vscode.Disposable { - - this._provider.push(provider); - - // is first, register commands, do stuff - if (this._provider.length === 1) { - this._proxy._enable(true); - } - - return new Disposable(() => { - let idx = this._provider.indexOf(provider); - if (idx >= 0) { - this._provider.splice(idx, 1); - if (this._provider.length === 0) { - this._proxy._enable(false); - } - } - }); - } - - private _runAsCommand(query: string): TPromise { - - if (typeof query !== 'string') { - return TPromise.wrapError('query is not string'); - } - - let symbols: vscode.SymbolInformation[] = []; - let promises = this._provider.map(provider => { - return asWinJsPromise(token => { - return provider.provideWorkspaceSymbols(query, token) - }).then(value => { - if (Array.isArray(value)) { - symbols.push(...value); - } - }, err => { - console.error(err); - }); - }); - - return TPromise.join(promises).then(() => { - return symbols.map(ExtensionHostWorkspaceSymbols._fromSymbolInformation); - }); - } - - private static _fromSymbolInformation(info: vscode.SymbolInformation): ITypeBearing { - return { - name: info.name, - type: SymbolKind[info.kind || SymbolKind.Property].toLowerCase(), - range: TypeConverters.fromRange(info.location.range), - resourceUri: info.location.uri, - containerName: info.containerName, - parameters: '', - }; - } -} - -@Remotable.MainContext('MainThreadWorkspaceSymbols') -export class MainThreadWorkspaceSymbols implements INavigateTypesSupport { - - static CommandId = 'vscode.executeWorkspaceSymbolProvider'; - - private _commands: PluginHostCommands; - private _disposable: IDisposable; - - constructor(@IThreadService threadService: IThreadService) { - this._commands = threadService.getRemotable(PluginHostCommands); - } - - _enable(value: boolean): void { - if (value) { - this._disposable = NavigateTypesSupportRegistry.register(this); - } else if (this._disposable) { - this._disposable.dispose(); - this._disposable = undefined; - } - } - - getNavigateToItems(search: string): TPromise { - let value = this._commands.executeCommand(MainThreadWorkspaceSymbols.CommandId, search); - return TPromise.as(value); - } -} - -export namespace LanguageFeatures { - - export function createMainThreadInstances(threadService: IThreadService): void { - threadService.getRemotable(MainThreadDefinitionFeature); - threadService.getRemotable(MainThreadHoverFeature); - threadService.getRemotable(MainThreadOccurrencesFeature); - threadService.getRemotable(MainThreadReferenceSearch); - threadService.getRemotable(MainThreadCodeActions); - threadService.getRemotable(MainThreadCodeLens); - threadService.getRemotable(MainThreadDocumentSymbols); - threadService.getRemotable(MainThreadWorkspaceSymbols); - threadService.getRemotable(MainThreadRename); - threadService.getRemotable(MainThreadFormatDocument); - threadService.getRemotable(MainThreadFormatRange); - threadService.getRemotable(MainThreadFormatOnType); - threadService.getRemotable(MainThreadSignatureHelp); - threadService.getRemotable(MainThreadCompletions); - } - - export function createExtensionHostInstances(threadService: IThreadService) { - return { - definition: new ExtensionHostDefinitionFeature(threadService), - hover: new ExtensionHostHoverFeature(threadService), - documentHighlight: new ExtensionHostOccurrencesFeature(threadService), - referenceSearch: new ExtensionHostReferenceSearch(threadService), - codeActions: new ExtensionHostCodeActions(threadService), - codeLens: threadService.getRemotable(ExtensionHostCodeLens), - documentSymbols: new ExtensionHostDocumentSymbols(threadService), - workspaceSymbols: new ExtensionHostWorkspaceSymbols(threadService), - rename: new ExtensionHostRename(threadService), - formatDocument: new ExtHostFormatDocument(threadService), - formatRange: new ExtHostFormatRange(threadService), - formatOnType: new ExtHostFormatOnType(threadService), - signatureHelp: new ExtHostSignatureHelp(threadService), - completions: threadService.getRemotable(ExtHostCompletions) - }; - } -} \ No newline at end of file diff --git a/src/vs/workbench/api/common/mainThreadEditors.ts b/src/vs/workbench/api/common/mainThreadEditors.ts index 42c1af89f5d..26cb2666dc2 100644 --- a/src/vs/workbench/api/common/mainThreadEditors.ts +++ b/src/vs/workbench/api/common/mainThreadEditors.ts @@ -335,6 +335,8 @@ export class MainThreadEditorsTracker { private _doUpdateMapping(): void { let allModels = this._modelService.getModels(); + // Same filter as in pluginHostDocuments + allModels.filter((model) => !model.isTooLargeForHavingARichMode()); let allModelsMap: { [modelUri:string]: EditorCommon.IModel; } = Object.create(null); allModels.forEach((model) => { allModelsMap[model.getAssociatedResource().toString()] = model; diff --git a/src/vs/workbench/api/common/pluginHostCommands.ts b/src/vs/workbench/api/common/pluginHostCommands.ts index 20d9ca171a5..bc57ffe3992 100644 --- a/src/vs/workbench/api/common/pluginHostCommands.ts +++ b/src/vs/workbench/api/common/pluginHostCommands.ts @@ -78,13 +78,13 @@ export class PluginHostCommands { return this._executeContributedCommand(id, ...args); } else { - // check that we can get all parameters over to - // the other side - for (let i = 0; i < args.length; i++) { - if (typeof args[i] === 'object' && !canSerialize(args[i])) { - throw new Error('illegal argument - can not serialize argument number: ' + i) - } - } + // // check that we can get all parameters over to + // // the other side + // for (let i = 0; i < args.length; i++) { + // if (args[i] !== null && typeof args[i] === 'object' && !canSerialize(args[i])) { + // throw new Error('illegal argument - can not serialize argument number: ' + i) + // } + // } return this._proxy._executeCommand(id, args); } @@ -148,7 +148,7 @@ export class MainThreadCommands { } _executeCommand(id: string, args: any[]): Thenable { - return TPromise.as(this._keybindingService.executeCommand(id, args)); + return this._keybindingService.executeCommand(id, args); } _getCommands(): Thenable { diff --git a/src/vs/workbench/api/common/pluginHostDocuments.ts b/src/vs/workbench/api/common/pluginHostDocuments.ts index be475ce66ff..32f51520215 100644 --- a/src/vs/workbench/api/common/pluginHostDocuments.ts +++ b/src/vs/workbench/api/common/pluginHostDocuments.ts @@ -532,6 +532,7 @@ export class MainThreadDocuments { private _toDispose: IDisposable[]; private _modelToDisposeMap: {[modelUrl:string]:IDisposable;}; private _proxy: PluginHostModelService; + private _modelIsSynced: {[modelId:string]:boolean;}; constructor( @IThreadService threadService: IThreadService, @@ -547,6 +548,7 @@ export class MainThreadDocuments { this._fileService = fileService; this._untitledEditorService = untitledEditorService; this._proxy = threadService.getRemotable(PluginHostModelService); + this._modelIsSynced = {}; this._toDispose = []; modelService.onModelAdded.add(this._onModelAdded, this, this._toDispose); @@ -575,7 +577,13 @@ export class MainThreadDocuments { } private _onModelAdded(model: EditorCommon.IModel): void { + // Same filter as in mainThreadEditors + if (model.isTooLargeForHavingARichMode()) { + // don't synchronize too large models + return null; + } let modelUrl = model.getAssociatedResource(); + this._modelIsSynced[modelUrl.toString()] = true; this._modelToDisposeMap[modelUrl.toString()] = model.addBulkListener2((events) => this._onModelEvents(modelUrl, events)); this._proxy._acceptModelAdd({ url: model.getAssociatedResource(), @@ -587,11 +595,19 @@ export class MainThreadDocuments { } private _onModelModeChanged(model: EditorCommon.IModel, oldModeId:string): void { + let modelUrl = model.getAssociatedResource(); + if (!this._modelIsSynced[modelUrl.toString()]) { + return; + } this._proxy._acceptModelModeChanged(model.getAssociatedResource(), oldModeId, model.getMode().getId()); } private _onModelRemoved(model: EditorCommon.IModel): void { let modelUrl = model.getAssociatedResource(); + if (!this._modelIsSynced[modelUrl.toString()]) { + return; + } + delete this._modelIsSynced[modelUrl.toString()]; this._modelToDisposeMap[modelUrl.toString()].dispose(); delete this._modelToDisposeMap[modelUrl.toString()]; this._proxy._acceptModelRemoved(modelUrl); @@ -614,7 +630,7 @@ export class MainThreadDocuments { // --- from plugin host process - _trySaveDocument(uri:URI): TPromise { + _trySaveDocument(uri: URI): TPromise { return this._textFileService.save(uri); } @@ -663,6 +679,8 @@ export class MainThreadDocuments { if (input.getResource().toString() !== uri.toString()) { throw new Error(`expected URI ${uri.toString() } BUT GOT ${input.getResource().toString() }`); } + return this._proxy._acceptModelDirty(uri); // mark as dirty + }).then(() => { return true; }); }); diff --git a/src/vs/workbench/api/common/pluginHostTypeConverters.ts b/src/vs/workbench/api/common/pluginHostTypeConverters.ts index 74f3d9c5d9c..9410fc10a9c 100644 --- a/src/vs/workbench/api/common/pluginHostTypeConverters.ts +++ b/src/vs/workbench/api/common/pluginHostTypeConverters.ts @@ -6,10 +6,13 @@ import Severity from 'vs/base/common/severity'; import * as objects from 'vs/base/common/objects'; +import * as modes from 'vs/editor/common/modes'; +import * as types from './pluginHostTypes'; import {Position as EditorPosition} from 'vs/platform/editor/common/editor'; -import {Selection, Range, Position, SymbolKind, DiagnosticSeverity, ViewColumn} from './pluginHostTypes'; -import {IPosition, ISelection, IRange, IRangeWithMessage} from 'vs/editor/common/editorCommon'; +import {IPosition, ISelection, IRange, IRangeWithMessage, ISingleEditOperation} from 'vs/editor/common/editorCommon'; import {IHTMLContentElement} from 'vs/base/common/htmlContent'; +import {ITypeBearing} from 'vs/workbench/parts/search/common/search'; +import * as vscode from 'vscode'; export interface PositionLike { line: number; @@ -26,11 +29,11 @@ export interface SelectionLike extends RangeLike { active: PositionLike; } -export function toSelection(selection: ISelection): Selection { +export function toSelection(selection: ISelection): types.Selection { let {selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn} = selection; - let start = new Position(selectionStartLineNumber - 1, selectionStartColumn - 1); - let end = new Position(positionLineNumber - 1, positionColumn - 1); - return new Selection(start, end); + let start = new types.Position(selectionStartLineNumber - 1, selectionStartColumn - 1); + let end = new types.Position(positionLineNumber - 1, positionColumn - 1); + return new types.Selection(start, end); } export function fromSelection(selection: SelectionLike): ISelection { @@ -53,87 +56,54 @@ export function fromRange(range: RangeLike): IRange { }; } -export function toRange(range: IRange): Range { +export function toRange(range: IRange): types.Range { let {startLineNumber, startColumn, endLineNumber, endColumn} = range; - return new Range(startLineNumber - 1, startColumn - 1, endLineNumber - 1, endColumn - 1); + return new types.Range(startLineNumber - 1, startColumn - 1, endLineNumber - 1, endColumn - 1); } -export function toPosition(position: IPosition): Position { - return new Position(position.lineNumber - 1, position.column - 1); +export function toPosition(position: IPosition): types.Position { + return new types.Position(position.lineNumber - 1, position.column - 1); } -export function fromSymbolKind(kind: number | SymbolKind): string { - switch (kind) { - case SymbolKind.Method: - return 'method'; - case SymbolKind.Function: - return 'function'; - case SymbolKind.Constructor: - return 'constructor'; - case SymbolKind.Variable: - return 'variable'; - case SymbolKind.Class: - return 'class'; - case SymbolKind.Interface: - return 'interface'; - case SymbolKind.Module: - case SymbolKind.Namespace: - case SymbolKind.Package: - return 'module'; - case SymbolKind.Property: - return 'property'; - case SymbolKind.Enum: - return 'enum'; - case SymbolKind.String: - return 'string'; - case SymbolKind.File: - return 'file'; - case SymbolKind.Array: - return 'array'; - case SymbolKind.Number: - return 'number'; - case SymbolKind.Boolean: - return 'boolean'; - } - - return 'property'; +export function fromPosition(position: types.Position):IPosition { + return { lineNumber: position.line + 1, column: position.character + 1}; } export function fromDiagnosticSeverity(value: number): Severity { switch (value) { - case DiagnosticSeverity.Error: + case types.DiagnosticSeverity.Error: return Severity.Error; - case DiagnosticSeverity.Warning: + case types.DiagnosticSeverity.Warning: return Severity.Warning; - case DiagnosticSeverity.Information: + case types.DiagnosticSeverity.Information: return Severity.Info; - case DiagnosticSeverity.Hint: + case types.DiagnosticSeverity.Hint: return Severity.Ignore; } return Severity.Error; } -export function toDiagnosticSeverty(value: Severity): DiagnosticSeverity { +export function toDiagnosticSeverty(value: Severity): types.DiagnosticSeverity { switch (value) { case Severity.Info: - return DiagnosticSeverity.Information; + return types.DiagnosticSeverity.Information; case Severity.Warning: - return DiagnosticSeverity.Warning; + return types.DiagnosticSeverity.Warning; case Severity.Error: - return DiagnosticSeverity.Error; + return types.DiagnosticSeverity.Error; case Severity.Ignore: - return DiagnosticSeverity.Hint; + return types.DiagnosticSeverity.Hint; } - return DiagnosticSeverity.Error; + return types.DiagnosticSeverity.Error; } export function fromViewColumn(column?: vscode.ViewColumn): EditorPosition { let editorColumn = EditorPosition.LEFT; if (typeof column !== 'number') { // stick with LEFT - } else if (column === ViewColumn.Two) { + } else if (column === types.ViewColumn.Two) { editorColumn = EditorPosition.CENTER; - } else if (column === ViewColumn.Three) { + } else if (column === types.ViewColumn.Three) { editorColumn = EditorPosition.RIGHT; } return editorColumn; @@ -148,6 +118,14 @@ export function fromFormattedString(value: vscode.MarkedString): IHTMLContentEle } } +export function toFormattedString(value: IHTMLContentElement): vscode.MarkedString { + if (typeof value.code === 'string') { + return value.code; + } + let {formattedText, text} = value; + return formattedText || text || ''; +} + function isMarkedStringArr(something: vscode.MarkedString | vscode.MarkedString[]): something is vscode.MarkedString[] { return Array.isArray(something); } @@ -189,3 +167,268 @@ export function fromRangeOrRangeWithMessage(ranges:vscode.Range[]|vscode.Decorat }); } } + +export const TextEdit = { + from(edit: vscode.TextEdit): ISingleEditOperation{ + return { + text: edit.newText, + range: fromRange(edit.range) + } + }, + to(edit: ISingleEditOperation): vscode.TextEdit { + return new types.TextEdit(toRange(edit.range), edit.text); + } +} + +export namespace SymbolKind { + + export function from(kind: number | types.SymbolKind): string { + switch (kind) { + case types.SymbolKind.Method: + return 'method'; + case types.SymbolKind.Function: + return 'function'; + case types.SymbolKind.Constructor: + return 'constructor'; + case types.SymbolKind.Variable: + return 'variable'; + case types.SymbolKind.Class: + return 'class'; + case types.SymbolKind.Interface: + return 'interface'; + case types.SymbolKind.Module: + case types.SymbolKind.Namespace: + case types.SymbolKind.Package: + return 'module'; + case types.SymbolKind.Property: + return 'property'; + case types.SymbolKind.Enum: + return 'enum'; + case types.SymbolKind.String: + return 'string'; + case types.SymbolKind.File: + return 'file'; + case types.SymbolKind.Array: + return 'array'; + case types.SymbolKind.Number: + return 'number'; + case types.SymbolKind.Boolean: + return 'boolean'; + } + return 'property'; + } + + export function to(type: string): types.SymbolKind { + switch (type) { + case 'method': + return types.SymbolKind.Method; + case 'function': + return types.SymbolKind.Function; + case 'constructor': + return types.SymbolKind.Constructor; + case 'variable': + return types.SymbolKind.Variable; + case 'class': + return types.SymbolKind.Class; + case 'interface': + return types.SymbolKind.Interface; + case 'module': + // case types.SymbolKind.Namespace: + // case types.SymbolKind.Package: + return types.SymbolKind.Module; + case 'property': + return types.SymbolKind.Property; + case 'enum': + return types.SymbolKind.Enum; + case 'string': + return types.SymbolKind.String; + case 'file': + return types.SymbolKind.File; + case 'array': + return types.SymbolKind.Array; + case 'number': + return types.SymbolKind.Number; + case 'boolean': + return types.SymbolKind.Boolean; + } + return types.SymbolKind.Property + } +} + +export namespace SymbolInformation { + + export function fromOutlineEntry(entry: modes.IOutlineEntry): types.SymbolInformation { + return new types.SymbolInformation(entry.label, + SymbolKind.to(entry.type), + toRange(entry.range), + undefined, + entry.containerLabel) + } + + export function toOutlineEntry(symbol: vscode.SymbolInformation): modes.IOutlineEntry { + return { + type: SymbolKind.from(symbol.kind), + range: fromRange(symbol.location.range), + containerLabel: symbol.containerName, + label: symbol.name, + icon: undefined, + }; + } + +} + +export function fromSymbolInformation(info: vscode.SymbolInformation): ITypeBearing { + return { + name: info.name, + type: types.SymbolKind[info.kind || types.SymbolKind.Property].toLowerCase(), + range: fromRange(info.location.range), + resourceUri: info.location.uri, + containerName: info.containerName, + parameters: '', + }; +} + +export function toSymbolInformation(bearing: ITypeBearing): types.SymbolInformation { + return new types.SymbolInformation(bearing.name, + types.SymbolKind[bearing.type.charAt(0).toUpperCase() + bearing.type.substr(1)], + toRange(bearing.range), + bearing.resourceUri, + bearing.containerName); +} + + +export function toLocation(reference: modes.IReference): types.Location { + return new types.Location(reference.resource, toRange(reference.range)); +} + + +export function fromHover(hover: vscode.Hover): modes.IComputeExtraInfoResult { + return { + range: fromRange(hover.range), + htmlContent: hover.contents.map(fromFormattedString) + } +} + +export function toHover(info: modes.IComputeExtraInfoResult): types.Hover { + return new types.Hover(info.htmlContent.map(toFormattedString), toRange(info.range)); +} + +export function toDocumentHighlight(occurrence: modes.IOccurence): types.DocumentHighlight { + return new types.DocumentHighlight(toRange(occurrence.range), + types.DocumentHighlightKind[occurrence.kind.charAt(0).toUpperCase() + occurrence.kind.substr(1)]); +} + +export const Suggest = { + + from(item: vscode.CompletionItem): modes.ISuggestion { + const suggestion: modes.ISuggestion = { + label: item.label, + codeSnippet: item.insertText || item.label, + type: types.CompletionItemKind[item.kind || types.CompletionItemKind.Text].toString().toLowerCase(), + typeLabel: item.detail, + textEdit: item.textEdit && TextEdit.from(item.textEdit), + documentationLabel: item.documentation, + sortText: item.sortText, + filterText: item.filterText + }; + return suggestion; + }, + + to(suggestion: modes.ISuggestion): types.CompletionItem { + const result = new types.CompletionItem(suggestion.label); + result.insertText = suggestion.codeSnippet; + result.kind = types.CompletionItemKind[suggestion.type.charAt(0).toUpperCase() + suggestion.type.substr(1)]; + result.detail = suggestion.typeLabel; + result.documentation = suggestion.documentationLabel; + result.sortText = suggestion.sortText; + result.filterText = suggestion.filterText; + result.textEdit = suggestion.textEdit && TextEdit.to(suggestion.textEdit); + return result; + } +} + +export namespace SignatureHelp { + + export function from(signatureHelp: types.SignatureHelp): modes.IParameterHints { + + let result: modes.IParameterHints = { + currentSignature: signatureHelp.activeSignature, + currentParameter: signatureHelp.activeParameter, + signatures: [] + } + + for (let signature of signatureHelp.signatures) { + + let signatureItem: modes.ISignature = { + label: signature.label, + documentation: signature.documentation, + parameters: [] + }; + + let idx = 0; + for (let parameter of signature.parameters) { + + let parameterItem: modes.IParameter = { + label: parameter.label, + documentation: parameter.documentation, + }; + + signatureItem.parameters.push(parameterItem); + idx = signature.label.indexOf(parameter.label, idx); + + if (idx >= 0) { + parameterItem.signatureLabelOffset = idx; + idx += parameter.label.length; + parameterItem.signatureLabelEnd = idx; + } + } + + result.signatures.push(signatureItem); + } + + return result; + } + + export function to(hints: modes.IParameterHints): types.SignatureHelp { + + const result = new types.SignatureHelp(); + result.activeSignature = hints.currentSignature; + result.activeParameter = hints.currentParameter; + + for (let signature of hints.signatures) { + + const signatureItem = new types.SignatureInformation(signature.label, signature.documentation); + result.signatures.push(signatureItem); + + for (let parameter of signature.parameters) { + + const parameterItem = new types.ParameterInformation(parameter.label, parameter.documentation); + signatureItem.parameters.push(parameterItem); + } + } + + return result; + } +} + +export const Command = { + from(command: vscode.Command): modes.ICommand { + if (command) { + return { + id: command.command, + title: command.title, + arguments: command.arguments + }; + } + }, + + to(command: modes.ICommand): vscode.Command { + if (command) { + return { + command: command.id, + title: command.title, + arguments: command.arguments + }; + } + } +} \ No newline at end of file diff --git a/src/vs/workbench/api/common/pluginHostTypes.ts b/src/vs/workbench/api/common/pluginHostTypes.ts index f8e6803369d..ab1850230f7 100644 --- a/src/vs/workbench/api/common/pluginHostTypes.ts +++ b/src/vs/workbench/api/common/pluginHostTypes.ts @@ -509,7 +509,7 @@ export class CodeLens { constructor(range: Range, command?: vscode.Command) { this.range = range; - this.command; + this.command = command; } get isResolved(): boolean { diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts index 5d4a976fed4..2d37cb0f45c 100644 --- a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts +++ b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts @@ -132,7 +132,7 @@ export class ActivitybarPart extends Part implements IActivityService { let action = this.instantiationService.createInstance(ViewletActivityAction, viewlet.id + '.activity-bar-action', viewlet); let keybinding: string = null; - let keys = this.keybindingService.lookupKeybindings(viewlet.id).map(k => k.toLabel()); + let keys = this.keybindingService.lookupKeybindings(viewlet.id).map(k => this.keybindingService.getLabelFor(k)); if (keys && keys.length) { keybinding = keys[0]; } @@ -202,7 +202,7 @@ export class ActivitybarPart extends Part implements IActivityService { return actions.map((action: Action) => { if (primary) { let keybinding: string = null; - let keys = this.keybindingService.lookupKeybindings(action.id).map(k => k.toLabel()); + let keys = this.keybindingService.lookupKeybindings(action.id).map(k => this.keybindingService.getLabelFor(k)); if (keys && keys.length) { keybinding = keys[0]; } diff --git a/src/vs/workbench/browser/parts/editor/binaryDiffEditor.ts b/src/vs/workbench/browser/parts/editor/binaryDiffEditor.ts index abb8ef57f42..f9b17d312c8 100644 --- a/src/vs/workbench/browser/parts/editor/binaryDiffEditor.ts +++ b/src/vs/workbench/browser/parts/editor/binaryDiffEditor.ts @@ -8,6 +8,7 @@ import 'vs/css!./media/binarydiffeditor'; import {TPromise} from 'vs/base/common/winjs.base'; import nls = require('vs/nls'); +import URI from 'vs/base/common/uri'; import {Sash, ISashEvent, IVerticalSashLayoutProvider} from 'vs/base/browser/ui/sash/sash'; import {Dimension, Builder, $} from 'vs/base/browser/builder'; import {ResourceViewer} from 'vs/base/browser/ui/resourceviewer/resourceViewer'; @@ -15,7 +16,7 @@ import {IScrollableElement} from 'vs/base/browser/ui/scrollbar/scrollableElement import {ScrollableElement} from 'vs/base/browser/ui/scrollbar/impl/scrollableElement'; import {BaseEditor} from 'vs/workbench/browser/parts/editor/baseEditor'; import {EditorInput, EditorOptions} from 'vs/workbench/common/editor'; -import {BinaryResourceEditorModel} from 'vs/workbench/browser/parts/editor/resourceEditorModel'; +import {BinaryEditorModel} from 'vs/workbench/browser/parts/editor/binaryEditorModel'; import {DiffEditorModel} from 'vs/workbench/browser/parts/editor/diffEditorModel'; import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService'; import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry'; @@ -96,7 +97,7 @@ export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSas return this.editorService.resolveEditorModel(input, true /* Reload */).then((resolvedModel: DiffEditorModel) => { // Assert model instance - if (!(resolvedModel.originalModel instanceof BinaryResourceEditorModel) || !(resolvedModel.modifiedModel instanceof BinaryResourceEditorModel)) { + if (!(resolvedModel.originalModel instanceof BinaryEditorModel) || !(resolvedModel.modifiedModel instanceof BinaryEditorModel)) { return TPromise.wrapError(nls.localize('cannotDiffTextToBinary', "Comparing binary files to non binary files is currently not supported")); } @@ -106,16 +107,16 @@ export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSas } // Render original - let original = resolvedModel.originalModel; - this.renderInput(original.getName(), original.getUrl(), true); + let original = resolvedModel.originalModel; + this.renderInput(original.getName(), original.getResource(), true); // Render modified - let modified = resolvedModel.modifiedModel; - this.renderInput(modified.getName(), modified.getUrl(), false); + let modified = resolvedModel.modifiedModel; + this.renderInput(modified.getName(), modified.getResource(), false); }); } - private renderInput(name: string, url: string, isOriginal: boolean): void { + private renderInput(name: string, resource: URI, isOriginal: boolean): void { // Reset Sash to default 50/50 ratio if needed if (this.leftContainerWidth && this.dimension && this.leftContainerWidth !== this.dimension.width / 2) { @@ -128,7 +129,7 @@ export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSas let container = isOriginal ? this.leftBinaryContainer : this.rightBinaryContainer; let scrollbar = isOriginal ? this.leftScrollbar : this.rightScrollbar; - ResourceViewer.show(name, url, container, scrollbar); + ResourceViewer.show(name, resource, container, scrollbar); } public clearInput(): void { diff --git a/src/vs/workbench/browser/parts/editor/binaryEditor.ts b/src/vs/workbench/browser/parts/editor/binaryEditor.ts index 641f995e208..63a61cbf43f 100644 --- a/src/vs/workbench/browser/parts/editor/binaryEditor.ts +++ b/src/vs/workbench/browser/parts/editor/binaryEditor.ts @@ -13,7 +13,7 @@ import {Dimension, Builder, $} from 'vs/base/browser/builder'; import {ResourceViewer} from 'vs/base/browser/ui/resourceviewer/resourceViewer'; import {EditorModel, EditorInput, EditorOptions} from 'vs/workbench/common/editor'; import {BaseEditor} from 'vs/workbench/browser/parts/editor/baseEditor'; -import {BinaryResourceEditorModel} from 'vs/workbench/browser/parts/editor/resourceEditorModel'; +import {BinaryEditorModel} from 'vs/workbench/browser/parts/editor/binaryEditorModel'; import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService'; import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry'; @@ -61,8 +61,8 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor { return this._editorService.resolveEditorModel(input, true /* Reload */).then((resolvedModel: EditorModel) => { // Assert Model instance - if (!(resolvedModel instanceof BinaryResourceEditorModel)) { - return TPromise.wrapError('Invalid editor input. Binary resource editor requires a model instance of BinaryResourceEditorModel.'); + if (!(resolvedModel instanceof BinaryEditorModel)) { + return TPromise.wrapError('Invalid editor input. Binary resource editor requires a model instance of BinaryEditorModel.'); } // Assert that the current input is still the one we expect. This prevents a race condition when loading takes long and another input was set meanwhile @@ -71,8 +71,8 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor { } // Render Input - let binaryResourceModel = resolvedModel; - ResourceViewer.show(binaryResourceModel.getName(), binaryResourceModel.getUrl(), this.binaryContainer); + let binaryResourceModel = resolvedModel; + ResourceViewer.show(binaryResourceModel.getName(), binaryResourceModel.getResource(), this.binaryContainer); return TPromise.as(null); }); @@ -106,7 +106,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor { } /** - * An implementation of editor for binary files like images or videos leveraging the ResourceEditorInput. + * An implementation of editor for binary files like images or videos. */ export class BinaryResourceEditor extends BaseBinaryResourceEditor { diff --git a/src/vs/workbench/browser/parts/editor/binaryEditorModel.ts b/src/vs/workbench/browser/parts/editor/binaryEditorModel.ts new file mode 100644 index 00000000000..92dd238c337 --- /dev/null +++ b/src/vs/workbench/browser/parts/editor/binaryEditorModel.ts @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * 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 {EditorModel} from 'vs/workbench/common/editor'; +import URI from 'vs/base/common/uri'; + +/** + * An editor model that just represents a resource and mime for a resource that can be loaded. + */ +export class BinaryEditorModel extends EditorModel { + private name: string; + private resource: URI; + + constructor(resource: URI, name: string) { + super(); + + this.name = name; + this.resource = resource; + } + + /** + * The name of the binary resource. + */ + public getName(): string { + return this.name; + } + + /** + * The resource of the binary resource. + */ + public getResource(): URI { + return this.resource; + } +} \ No newline at end of file diff --git a/src/vs/workbench/browser/parts/editor/diffEditorInput.ts b/src/vs/workbench/browser/parts/editor/diffEditorInput.ts index ef0e42c6d07..77c1841c5f6 100644 --- a/src/vs/workbench/browser/parts/editor/diffEditorInput.ts +++ b/src/vs/workbench/browser/parts/editor/diffEditorInput.ts @@ -11,10 +11,7 @@ import {EventType} from 'vs/base/common/events'; import {EditorModel, IFileEditorInput, EditorInput, IInputStatus, BaseDiffEditorInput} from 'vs/workbench/common/editor'; import {BaseTextEditorModel} from 'vs/workbench/browser/parts/editor/textEditorModel'; import {DiffEditorModel} from 'vs/workbench/browser/parts/editor/diffEditorModel'; -import {TextDiffEditor} from 'vs/workbench/browser/parts/editor/textDiffEditor'; import {TextDiffEditorModel} from 'vs/workbench/browser/parts/editor/textDiffEditorModel'; -import {ResourceEditorInput} from 'vs/workbench/browser/parts/editor/resourceEditorInput'; -import {BinaryResourceDiffEditor} from 'vs/workbench/browser/parts/editor/binaryDiffEditor'; /** * The base editor input for the diff editor. It is made up of two editor inputs, the original version @@ -28,12 +25,14 @@ export class DiffEditorInput extends BaseDiffEditorInput { private name: string; private description: string; private cachedModel: DiffEditorModel; + private forceOpenAsBinary: boolean; - constructor(name: string, description: string, originalInput: EditorInput, modifiedInput: EditorInput) { + constructor(name: string, description: string, originalInput: EditorInput, modifiedInput: EditorInput, forceOpenAsBinary?: boolean) { super(originalInput, modifiedInput); this.name = name; this.description = description; + this.forceOpenAsBinary = forceOpenAsBinary; this._toUnbind = []; @@ -130,25 +129,18 @@ export class DiffEditorInput extends BaseDiffEditorInput { public getPreferredEditorId(candidates: string[]): string { // Find the right diff editor for the given isBinary/isText state - let useBinaryEditor = this.isBinary(this.originalInput) || this.isBinary(this.modifiedInput); + let useBinaryEditor = this.forceOpenAsBinary || this.isBinary(this.originalInput) || this.isBinary(this.modifiedInput); - return !useBinaryEditor ? TextDiffEditor.ID : BinaryResourceDiffEditor.ID; + return !useBinaryEditor ? 'workbench.editors.textDiffEditor' : 'workbench.editors.binaryResourceDiffEditor'; } private isBinary(input: EditorInput): boolean { let mime: string; - // Find mime from instancesof ResourceEditorInput - if (input instanceof ResourceEditorInput) { - mime = (input).getMime(); - } - // Find mime by checking for IFileEditorInput implementors - else { - let fileInput = (input); - if (types.isFunction(fileInput.getMime)) { - mime = fileInput.getMime(); - } + let fileInput = (input); + if (types.isFunction(fileInput.getMime)) { + mime = fileInput.getMime(); } return mime && isBinaryMime(mime); diff --git a/src/vs/workbench/browser/parts/editor/editor.contribution.ts b/src/vs/workbench/browser/parts/editor/editor.contribution.ts index 4aba215fdc7..742991c1433 100644 --- a/src/vs/workbench/browser/parts/editor/editor.contribution.ts +++ b/src/vs/workbench/browser/parts/editor/editor.contribution.ts @@ -12,10 +12,9 @@ import {StringEditorInput} from 'vs/workbench/browser/parts/editor/stringEditorI import {StringEditor} from 'vs/workbench/browser/parts/editor/stringEditor'; import {DiffEditorInput} from 'vs/workbench/browser/parts/editor/diffEditorInput'; import {UntitledEditorInput} from 'vs/workbench/browser/parts/editor/untitledEditorInput'; -import {ReadOnlyEditorInput} from 'vs/workbench/browser/parts/editor/readOnlyEditorInput'; +import {ResourceEditorInput} from 'vs/workbench/browser/parts/editor/resourceEditorInput'; import {TextDiffEditor} from 'vs/workbench/browser/parts/editor/textDiffEditor'; import {BinaryResourceDiffEditor} from 'vs/workbench/browser/parts/editor/binaryDiffEditor'; -import {ResourceEditorInput} from 'vs/workbench/browser/parts/editor/resourceEditorInput'; import {BinaryResourceEditor} from 'vs/workbench/browser/parts/editor/binaryEditor'; import {IFrameEditor} from 'vs/workbench/browser/parts/editor/iframeEditor'; import {IFrameEditorInput} from 'vs/workbench/browser/parts/editor/iframeEditorInput'; @@ -32,12 +31,11 @@ import {KeyMod, KeyCode} from 'vs/base/common/keyCodes'; nls.localize('textEditor', "Text Editor"), 'vs/workbench/browser/parts/editor/stringEditor', 'StringEditor' - ), + ), [ new SyncDescriptor(StringEditorInput), - new SyncDescriptor(ResourceEditorInput), new SyncDescriptor(UntitledEditorInput), - new SyncDescriptor(ReadOnlyEditorInput) + new SyncDescriptor(ResourceEditorInput) ] ); @@ -48,7 +46,7 @@ import {KeyMod, KeyCode} from 'vs/base/common/keyCodes'; nls.localize('textDiffEditor', "Text Diff Editor"), 'vs/workbench/browser/parts/editor/textDiffEditor', 'TextDiffEditor' - ), + ), [ new SyncDescriptor(DiffEditorInput) ] @@ -61,25 +59,12 @@ import {KeyMod, KeyCode} from 'vs/base/common/keyCodes'; nls.localize('binaryDiffEditor', "Binary Diff Editor"), 'vs/workbench/browser/parts/editor/binaryDiffEditor', 'BinaryResourceDiffEditor' - ), + ), [ new SyncDescriptor(DiffEditorInput) ] ); -// Register Binary Resource Editor -(Registry.as(EditorExtensions.Editors)).registerEditor( - new EditorDescriptor( - BinaryResourceEditor.ID, - nls.localize('binaryEditor', "Binary Resource Editor"), - 'vs/workbench/browser/parts/editor/binaryEditor', - 'BinaryResourceEditor' - ), - [ - new SyncDescriptor(ResourceEditorInput) - ] -); - // Register IFrame Editor (Registry.as(EditorExtensions.Editors)).registerEditor( new EditorDescriptor( @@ -87,18 +72,18 @@ import {KeyMod, KeyCode} from 'vs/base/common/keyCodes'; nls.localize('iframeEditor', "IFrame Editor"), 'vs/workbench/browser/parts/editor/iframeEditor', 'IFrameEditor' - ), + ), [ new SyncDescriptor(IFrameEditorInput) ] ); // Register Editor Status -let statusBar = ( Registry.as(StatusExtensions.Statusbar)); +let statusBar = (Registry.as(StatusExtensions.Statusbar)); statusBar.registerStatusbarItem(new StatusbarItemDescriptor(EditorStatus, StatusbarAlignment.RIGHT, 100 /* High Priority */)); // Register Actions -let registry = Registry.as(ActionExtensions.WorkbenchActions); +let registry = Registry.as(ActionExtensions.WorkbenchActions); registry.registerWorkbenchAction(new SyncActionDescriptor(ChangeModeAction, ChangeModeAction.ID, ChangeModeAction.LABEL, { primary: KeyMod.chord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_M) })); registry.registerWorkbenchAction(new SyncActionDescriptor(ChangeEOLAction, ChangeEOLAction.ID, ChangeEOLAction.LABEL)); registry.registerWorkbenchAction(new SyncActionDescriptor(ChangeEncodingAction, ChangeEncodingAction.ID, ChangeEncodingAction.LABEL)); \ No newline at end of file diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index eb6c62098d0..73d0fd2004a 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -209,7 +209,15 @@ export class EditorPart extends Part implements IEditorPart { // Close editor when input provided and input gets disposed if (input) { this.visibleInputListeners[position] = input.addListener(EventType.DISPOSE, () => { - this.closeEditors(false, input).done(null, errors.onUnexpectedError); + + // To prevent race conditions, we call the close in a timeout because it can well be + // that an input is being disposed with the intent to replace it with some other input + // right after. + setTimeout(() => { + if (input === this.visibleInputs[position]) { + this.closeEditors(false, input).done(null, errors.onUnexpectedError); + } + }, 0); }); } @@ -254,8 +262,8 @@ export class EditorPart extends Part implements IEditorPart { assert.ok(editorDescriptor, strings.format('Can not find a registered editor for the input {0}', input)); // Progress Indication - let loadingPromise: TPromise = TPromise.timeout(800).then(() => { - if (editorOpenToken === this.editorOpenToken[position] && this.partService.isCreated()) { + let loadingPromise: TPromise = TPromise.timeout(this.partService.isCreated() ? 800 : 3200 /* less ugly initial startup */).then(() => { + if (editorOpenToken === this.editorOpenToken[position]) { this.sideBySideControl.getProgressBar(position).infinite().getContainer().show(); this.sideBySideControl.setLoading(position, input); } diff --git a/src/vs/workbench/browser/parts/editor/readOnlyEditorInput.ts b/src/vs/workbench/browser/parts/editor/readOnlyEditorInput.ts deleted file mode 100644 index a3a3e71bf8b..00000000000 --- a/src/vs/workbench/browser/parts/editor/readOnlyEditorInput.ts +++ /dev/null @@ -1,99 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 {TPromise} from 'vs/base/common/winjs.base'; -import {MIME_TEXT} from 'vs/base/common/mime'; -import {EditorModel, EditorInput} from 'vs/workbench/common/editor'; -import {ReadOnlyEditorModel} from 'vs/workbench/browser/parts/editor/readOnlyEditorModel'; -import URI from 'vs/base/common/uri'; -import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation'; -import {IModelService} from 'vs/editor/common/services/modelService'; - -/** - * A read-only text editor input whos contents are made of the provided resource that points to an existing - * code editor model. - */ -export class ReadOnlyEditorInput extends EditorInput { - - public static ID = 'workbench.editors.readOnlyEditorInput'; - - protected cachedModel: ReadOnlyEditorModel; - - private name: string; - private description: string; - private resource: URI; - - constructor( - name: string, - description: string, - resource: URI, - @IModelService private modelService: IModelService, - @IInstantiationService private instantiationService: IInstantiationService - ) { - super(); - - this.name = name; - this.description = description; - this.resource = resource; - } - - public getId(): string { - return ReadOnlyEditorInput.ID; - } - - public getName(): string { - return this.name; - } - - public getDescription(): string { - return this.description; - } - - public resolve(refresh?: boolean): TPromise { - - // We need the resource to point to an existing model - if (!this.modelService.getModel(this.resource)) { - return TPromise.wrapError(new Error(`Document with resource ${this.resource.toString()} does not exist`)); - } - - // Use Cached Model - if (this.cachedModel) { - return TPromise.as(this.cachedModel); - } - - //Otherwise Create Model and Load - let model = this.instantiationService.createInstance(ReadOnlyEditorModel, this.resource); - return model.load().then((resolvedModel: ReadOnlyEditorModel) => { - this.cachedModel = resolvedModel; - - return this.cachedModel; - }); - } - - public matches(otherInput: any): boolean { - if (super.matches(otherInput) === true) { - return true; - } - - if (otherInput instanceof ReadOnlyEditorInput) { - let otherReadOnlyEditorInput = otherInput; - - // Compare by properties - return otherReadOnlyEditorInput.resource.toString() === this.resource.toString(); - } - - return false; - } - - public dispose(): void { - if (this.cachedModel) { - this.cachedModel.dispose(); - this.cachedModel = null; - } - - super.dispose(); - } -} \ No newline at end of file diff --git a/src/vs/workbench/browser/parts/editor/readOnlyEditorModel.ts b/src/vs/workbench/browser/parts/editor/readOnlyEditorModel.ts deleted file mode 100644 index a7fbd41cdc1..00000000000 --- a/src/vs/workbench/browser/parts/editor/readOnlyEditorModel.ts +++ /dev/null @@ -1,32 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * 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 {TPromise} from 'vs/base/common/winjs.base'; -import {BaseTextEditorModel} from 'vs/workbench/browser/parts/editor/textEditorModel'; -import {IIdentifiedSingleEditOperation} from 'vs/editor/common/editorCommon'; -import {EditorModel} from 'vs/workbench/common/editor'; -import URI from 'vs/base/common/uri'; -import {URL} from 'vs/base/common/network'; -import {Position} from 'vs/editor/common/core/position'; -import {Range} from 'vs/editor/common/core/range'; -import {IModeService} from 'vs/editor/common/services/modeService'; -import {IModelService} from 'vs/editor/common/services/modelService'; -import {EditOperation} from 'vs/editor/common/core/editOperation'; - -/** - * An editor model whith an in-memory, readonly content that is backed by an existing editor model. - */ -export class ReadOnlyEditorModel extends BaseTextEditorModel { - private resource: URI; - - constructor( - resource: URI, - @IModeService modeService: IModeService, - @IModelService modelService: IModelService - ) { - super(modelService, modeService, URL.fromUri(resource)); - } -} \ No newline at end of file diff --git a/src/vs/workbench/browser/parts/editor/resourceEditorInput.ts b/src/vs/workbench/browser/parts/editor/resourceEditorInput.ts index 8bd974a392d..3f49c3598f7 100644 --- a/src/vs/workbench/browser/parts/editor/resourceEditorInput.ts +++ b/src/vs/workbench/browser/parts/editor/resourceEditorInput.ts @@ -5,56 +5,39 @@ 'use strict'; import {TPromise} from 'vs/base/common/winjs.base'; -import {Registry} from 'vs/platform/platform'; -import {isBinaryMime} from 'vs/base/common/mime'; -import objects = require('vs/base/common/objects'); -import {IEditorRegistry, Extensions} from 'vs/workbench/browser/parts/editor/baseEditor'; +import {MIME_TEXT} from 'vs/base/common/mime'; import {EditorModel, EditorInput} from 'vs/workbench/common/editor'; -import {TextResourceEditorModel, BinaryResourceEditorModel} from 'vs/workbench/browser/parts/editor/resourceEditorModel'; +import {ResourceEditorModel} from 'vs/workbench/browser/parts/editor/resourceEditorModel'; import URI from 'vs/base/common/uri'; import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation'; - -const TEXT_EDITOR_ID = 'workbench.editors.stringEditor'; -const BINARY_EDITOR_ID = 'workbench.editors.binaryResourceEditor'; +import {IModelService} from 'vs/editor/common/services/modelService'; /** - * A read-only editor input whos contents are just a mime and url to display either in a text editor or in a binary viewer. The - * decision of using a binary or text editor is made by checking the provided mime type for common textual and binary mime types - * (image, audio, video, application/octet-stream). + * A read-only text editor input whos contents are made of the provided resource that points to an existing + * code editor model. */ export class ResourceEditorInput extends EditorInput { - public static ID: string = 'workbench.editors.resourceEditorInput'; + public static ID = 'workbench.editors.resourceEditorInput'; + + protected cachedModel: ResourceEditorModel; + protected resource: URI; private name: string; private description: string; - private url: string; - private mime: string; - private method: string; - private headers: any; - private isMimeEnforced: boolean; - private singleton: boolean; - private cachedModel: EditorModel; constructor( name: string, description: string, - url: string, - mime: string, - method: string, - headers: any, - singleton: boolean, - @IInstantiationService private instantiationService: IInstantiationService + resource: URI, + @IModelService protected modelService: IModelService, + @IInstantiationService protected instantiationService: IInstantiationService ) { super(); this.name = name; this.description = description; - this.url = url; - this.mime = mime; - this.method = method; - this.headers = headers; - this.singleton = singleton; + this.resource = resource; } public getId(): string { @@ -69,92 +52,27 @@ export class ResourceEditorInput extends EditorInput { return this.description; } - public getUrl(): string { - return this.url; - } - - public getMethod(): string { - return this.method; - } - - public getHeaders(): any { - return this.headers; - } - - public getMime(): string { - return this.mime; - } - - /** - * Will cause this editor input and the associated model to use the mime that was given in to the constructor and will - * ignore any mime that is returned from downloading the resource from the net. This is useful to enforce a certain mime - * to be used for this resource even though it might be served differently. - */ - public setMimeEnforced(): void { - this.isMimeEnforced = true; - } - - protected getResource(): URI { - // Subclasses can implement to associate a resource URL with the input - return null; - } - - public getPreferredEditorId(candidates: string[]): string { - - // Find the right editor for the given isBinary/isText state - let isBinary = isBinaryMime(this.mime); - - return !isBinary ? TEXT_EDITOR_ID : BINARY_EDITOR_ID; - } - public resolve(refresh?: boolean): TPromise { - let modelPromise: TPromise; + + // We need the resource to point to an existing model + if (!this.modelService.getModel(this.resource)) { + return TPromise.wrapError(new Error(`Document with resource ${this.resource.toString()} does not exist`)); + } // Use Cached Model - if (this.cachedModel && !refresh) { - modelPromise = TPromise.as(this.cachedModel); + if (this.cachedModel) { + return TPromise.as(this.cachedModel); } - // Refresh Cached Model - else if (this.cachedModel && refresh) { - modelPromise = this.cachedModel.load(); - } - - // Create Model and Load - else { - modelPromise = this.createModel().load(); - } - - return modelPromise.then((resolvedModel: EditorModel) => { + //Otherwise Create Model and Load + let model = this.instantiationService.createInstance(ResourceEditorModel, this.resource); + return model.load().then((resolvedModel: ResourceEditorModel) => { this.cachedModel = resolvedModel; return this.cachedModel; }); } - private createModel(): EditorModel { - let descriptor = (Registry.as(Extensions.Editors)).getEditor(this); - if (!descriptor) { - throw new Error('Unable to find an editor in the registry for this input.'); - } - - // Binary model if editor is binary editor - let model: EditorModel; - if (descriptor.getId() === BINARY_EDITOR_ID) { - model = new BinaryResourceEditorModel(this.name, this.url); - } - - // Otherwise use text model - else { - model = this.instantiationService.createInstance(TextResourceEditorModel, this.url, this.mime, this.method, this.headers, this.getResource()); - if (this.isMimeEnforced) { - (model).setMimeEnforced(); - } - } - - return model; - } - public matches(otherInput: any): boolean { if (super.matches(otherInput) === true) { return true; @@ -163,18 +81,8 @@ export class ResourceEditorInput extends EditorInput { if (otherInput instanceof ResourceEditorInput) { let otherResourceEditorInput = otherInput; - // If both inputs are singletons, check on the mime for equalness - if (otherResourceEditorInput.singleton && this.singleton && otherResourceEditorInput.mime === this.mime) { - return true; - } - - // Otherwise compare by properties - return otherResourceEditorInput.url === this.url && - otherResourceEditorInput.mime === this.mime && - otherResourceEditorInput.name === this.name && - otherResourceEditorInput.description === this.description && - otherResourceEditorInput.method === this.method && - objects.equals(otherResourceEditorInput.headers, this.headers); + // Compare by properties + return otherResourceEditorInput.resource.toString() === this.resource.toString(); } return false; diff --git a/src/vs/workbench/browser/parts/editor/resourceEditorModel.ts b/src/vs/workbench/browser/parts/editor/resourceEditorModel.ts index 0a7de903808..4ae00bcecfd 100644 --- a/src/vs/workbench/browser/parts/editor/resourceEditorModel.ts +++ b/src/vs/workbench/browser/parts/editor/resourceEditorModel.ts @@ -4,164 +4,22 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import {TPromise} from 'vs/base/common/winjs.base'; -import errors = require('vs/base/common/errors'); -import {MIME_UNKNOWN} from 'vs/base/common/mime'; -import types = require('vs/base/common/types'); -import {Header, IXHRResponse} from 'vs/base/common/http'; -import {EditorModel} from 'vs/workbench/common/editor'; import {BaseTextEditorModel} from 'vs/workbench/browser/parts/editor/textEditorModel'; import URI from 'vs/base/common/uri'; -import {IFileService, IContent} from 'vs/platform/files/common/files'; -import {IRequestService} from 'vs/platform/request/common/request'; import {IModeService} from 'vs/editor/common/services/modeService'; import {IModelService} from 'vs/editor/common/services/modelService'; /** - * An editor model whith a readonly content that can be resolved through the provided URL. + * An editor model whith an in-memory, readonly content that is backed by an existing editor model. */ -export class TextResourceEditorModel extends BaseTextEditorModel { - private url: string; - private method: string; - private headers: any; - private mime: string; - private lastModified: number; - private isMimeEnforced: boolean; +export class ResourceEditorModel extends BaseTextEditorModel { private resource: URI; constructor( - url: string, - mime: string, - method: string, - headers: any, resource: URI, @IModeService modeService: IModeService, - @IModelService modelService: IModelService, - @IRequestService private requestService: IRequestService, - @IFileService private fileService: IFileService + @IModelService modelService: IModelService ) { - super(modelService, modeService); - - this.url = url; - this.mime = mime; - this.method = method; - this.headers = headers; - this.resource = resource; - } - - /** - * Will cause this editor model to use the mime that was given in to the constructor and will - * ignore any mime that is returned from downloading the resource from the net. This is useful to enforce a certain mime - * to be used for this resource even though it might be served differently. - */ - public setMimeEnforced(): void { - this.isMimeEnforced = !!this.mime; // Only enforce if a mime is set - } - - /** - * When the model is loaded, will return the last modified header value as millies since 1970 for the resource if it is provided. - */ - public getLastModified(): number { - return this.lastModified; - } - - public load(): TPromise { - - // We can load file:// URIs through the file service - let isFileResource: boolean; - try { - isFileResource = URI.parse(this.url).scheme === 'file'; - } catch (error) { - isFileResource = false; - } - - let loadPromise: TPromise; - if (isFileResource) { - loadPromise = this.fileService.resolveContent(URI.parse(this.url)); - } else { - loadPromise = this.requestService.makeRequest({ url: this.url, type: this.method, headers: this.headers }); - } - - return loadPromise.then((result) => { - let mtime: number; - let mime = this.mime; - let value: string; - - // Handle XHR - if (types.isFunction((result).getResponseHeader)) { - let xhr = result; - let lastModifiedValue = xhr.getResponseHeader(Header.LAST_MODIFIED); - if (lastModifiedValue) { - mtime = new Date(lastModifiedValue).getTime(); - } - - let contentType = xhr.getResponseHeader(Header.X_CONTENT_TYPES) || xhr.getResponseHeader(Header.CONTENT_TYPE); - if (contentType && contentType.indexOf('; charset') >= 0) { - contentType = contentType.substring(0, contentType.indexOf(';')); - } - - if (contentType && contentType !== MIME_UNKNOWN) { - mime = contentType; - } - - value = xhr.responseText; - } - - // Handle IContent - else { - let content = result; - mtime = content.mtime; - mime = content.mime; - value = content.value; - } - - // Keep this meta data - this.lastModified = mtime; - - // Create text editor model if not yet done - if (!this.textEditorModel) { - return this.createTextEditorModel(value, !this.isMimeEnforced ? mime : this.mime, this.resource); - } - - // Otherwise update - this.updateTextEditorModel(value, !this.isMimeEnforced ? mime : undefined /* do not update mime from previous load */); - - return TPromise.as(this); - }, (error) => { - if (error instanceof Error) { - return TPromise.wrapError(error); - } - - return TPromise.wrapError(new errors.ConnectionError(error)); - }); - } -} - -/** - * An editor model that just represents a URL and mime for a resource that can be loaded. - */ -export class BinaryResourceEditorModel extends EditorModel { - private name: string; - private url: string; - - constructor(name: string, url: string) { - super(); - - this.name = name; - this.url = url; - } - - /** - * The name of the binary resource. - */ - public getName(): string { - return this.name; - } - - /** - * The url of the binary resource. - */ - public getUrl(): string { - return this.url; + super(modelService, modeService, resource); } } \ No newline at end of file diff --git a/src/vs/workbench/browser/parts/editor/stringEditorInput.ts b/src/vs/workbench/browser/parts/editor/stringEditorInput.ts index 3723e1c1b14..8eab1c9a13f 100644 --- a/src/vs/workbench/browser/parts/editor/stringEditorInput.ts +++ b/src/vs/workbench/browser/parts/editor/stringEditorInput.ts @@ -44,7 +44,7 @@ export class StringEditorInput extends EditorInput { } protected getResource(): URI { - // Subclasses can implement to associate a resource URL with the input + // Subclasses can implement to associate a resource with the input return null; } diff --git a/src/vs/workbench/browser/parts/editor/stringEditorModel.ts b/src/vs/workbench/browser/parts/editor/stringEditorModel.ts index 56feb1e5970..9ae7491dd0e 100644 --- a/src/vs/workbench/browser/parts/editor/stringEditorModel.ts +++ b/src/vs/workbench/browser/parts/editor/stringEditorModel.ts @@ -100,10 +100,6 @@ export class StringEditorModel extends BaseTextEditorModel { return null; } - public setMime(mime: string): void { - this.mime = mime; - } - public getMime(): string { return this.mime; } @@ -112,12 +108,12 @@ export class StringEditorModel extends BaseTextEditorModel { // Create text editor model if not yet done if (!this.textEditorModel) { - return this.createTextEditorModel(this.value, this.mime, this.resource); + return this.createTextEditorModel(this.value, this.resource, this.mime); } // Otherwise update else { - this.updateTextEditorModel(this.value, this.mime); + this.updateTextEditorModel(this.value); } return TPromise.as(this); diff --git a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts index d4e05c29fa0..449888aa908 100644 --- a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts +++ b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts @@ -10,6 +10,7 @@ import {Promise, TPromise} from 'vs/base/common/winjs.base'; import nls = require('vs/nls'); import {Builder} from 'vs/base/browser/builder'; import {Action, IAction} from 'vs/base/common/actions'; +import {onUnexpectedError} from 'vs/base/common/errors'; import types = require('vs/base/common/types'); import {IDiffEditor} from 'vs/editor/browser/editorBrowser'; import {IDiffEditorOptions, IEditorOptions} from 'vs/editor/common/editorCommon'; @@ -136,8 +137,8 @@ export class TextDiffEditor extends BaseTextEditor { return this.editorService.resolveEditorModel(input, true /* Reload */).then((resolvedModel: EditorModel) => { // Assert Model Instance - if (!(resolvedModel instanceof TextDiffEditorModel)) { - return TPromise.wrapError(nls.localize('cannotDiffBinary', "At least one of the resources to compare seems to be binary and this is currently not supported")); + if (!(resolvedModel instanceof TextDiffEditorModel) && this.openAsBinary(input, options)) { + return null; } // Assert that the current input is still the one we expect. This prevents a race condition when loading a diff takes long and another input was set meanwhile @@ -174,9 +175,9 @@ export class TextDiffEditor extends BaseTextEditor { diffEditor.updateOptions(this.getCodeEditorOptions()); }, (error) => { - // In case we tried to open a file and the response indicates that this is not a text file, bail out to the user. - if (this.isFileBinaryError(error)) { - return Promise.wrapError(nls.localize('cannotDiffBinary', "At least one of the resources to compare seems to be binary and this is currently not supported")); + // In case we tried to open a file and the response indicates that this is not a text file, fallback to binary diff. + if (this.isFileBinaryError(error) && this.openAsBinary(input, options)) { + return null; } // Otherwise make sure the error bubbles up @@ -184,6 +185,21 @@ export class TextDiffEditor extends BaseTextEditor { }); } + private openAsBinary(input: EditorInput, options: EditorOptions): boolean { + if (input instanceof DiffEditorInput) { + let originalInput = input.originalInput; + let modifiedInput = input.modifiedInput; + + let binaryDiffInput = new DiffEditorInput(input.getName(), input.getDescription(), originalInput, modifiedInput, true); + + this.editorService.openEditor(binaryDiffInput, options, this.position).done(null, onUnexpectedError); + + return true; + } + + return false; + } + protected getCodeEditorOptions(): IEditorOptions { let options: IDiffEditorOptions = super.getCodeEditorOptions(); diff --git a/src/vs/workbench/browser/parts/editor/textEditorModel.ts b/src/vs/workbench/browser/parts/editor/textEditorModel.ts index 23ecb533070..954203fda12 100644 --- a/src/vs/workbench/browser/parts/editor/textEditorModel.ts +++ b/src/vs/workbench/browser/parts/editor/textEditorModel.ts @@ -12,7 +12,6 @@ import {EditorModel} from 'vs/workbench/common/editor'; import {Registry} from 'vs/platform/platform'; import {IEditorModesRegistry, Extensions} from 'vs/editor/common/modes/modesRegistry'; import URI from 'vs/base/common/uri'; -import {URL} from 'vs/base/common/network'; import {NullMode} from 'vs/editor/common/modes/nullMode'; import {ITextEditorModel} from 'vs/platform/editor/common/editor'; import {IModeService} from 'vs/editor/common/services/modeService'; @@ -22,12 +21,12 @@ import {IModelService} from 'vs/editor/common/services/modelService'; * The base text editor model leverages the monaco code editor model. This class is only intended to be subclassed and not instantiated. */ export abstract class BaseTextEditorModel extends EditorModel implements ITextEditorModel { - private textEditorModelHandle: URL; + private textEditorModelHandle: URI; constructor( @IModelService private modelService: IModelService, @IModeService private modeService: IModeService, - textEditorModelHandle?: URL + textEditorModelHandle?: URI ) { super(); @@ -41,12 +40,12 @@ export abstract class BaseTextEditorModel extends EditorModel implements ITextEd /** * Creates the text editor model with the provided value, mime (can be comma separated for multiple values) and optional resource URL. */ - protected createTextEditorModel(value: string, mime?: string, resource?: URI): TPromise { + protected createTextEditorModel(value: string, resource?: URI, mime?: string): TPromise { let firstLineText = this.getFirstLineText(value); // To avoid flickering, give the mode at most 50ms to load. If the mode doesn't load in 50ms, proceed creating the model with a mode promise return Promise.any([Promise.timeout(50), this.getOrCreateMode(this.modeService, mime, firstLineText)]).then(() => { - let model = this.modelService.createModel(value, this.getOrCreateMode(this.modeService, mime, firstLineText), resource ? URL.fromUri(resource) : null); + let model = this.modelService.createModel(value, this.getOrCreateMode(this.modeService, mime, firstLineText), resource); this.textEditorModelHandle = model.getAssociatedResource(); diff --git a/src/vs/workbench/browser/parts/editor/untitledEditorInput.ts b/src/vs/workbench/browser/parts/editor/untitledEditorInput.ts index 5b48fcb56b1..f261afcadcb 100644 --- a/src/vs/workbench/browser/parts/editor/untitledEditorInput.ts +++ b/src/vs/workbench/browser/parts/editor/untitledEditorInput.ts @@ -77,7 +77,7 @@ export class UntitledEditorInput extends EditorInput implements IResourceEditorI public suggestFileName(): string { if (!this.hasAssociatedFilePath) { let mime = this.getMime(); - if (mime) { + if (mime && mime !== MIME_TEXT /* do not suggest when the mime type is simple plain text */) { return suggestFilename(mime, this.getName()); } } diff --git a/src/vs/workbench/browser/parts/quickopen/editorHistoryModel.ts b/src/vs/workbench/browser/parts/quickopen/editorHistoryModel.ts index 28a70129475..47858fa7741 100644 --- a/src/vs/workbench/browser/parts/quickopen/editorHistoryModel.ts +++ b/src/vs/workbench/browser/parts/quickopen/editorHistoryModel.ts @@ -222,7 +222,17 @@ export class EditorHistoryModel extends QuickOpenModel { if (searchValue) { let normalizedSearchValue = strings.stripWildcards(searchValue.toLowerCase()); - return results.sort((elementA, elementB) => comparers.compareAnything((elementA).getInput().getName(), (elementB).getInput().getName(), normalizedSearchValue)); + return results.sort((elementA:EditorHistoryEntry, elementB:EditorHistoryEntry) => { + let nameA = elementA.getInput().getName(); + let nameB = elementB.getInput().getName(); + + if (nameA === nameB) { + nameA = elementA.getResource().fsPath; + nameB = elementB.getResource().fsPath; + } + + return comparers.compareAnything(nameA, nameB, normalizedSearchValue); + }); } // Leave default "most recently used" order if user is not actually searching diff --git a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts index 0b040799230..026883bd582 100644 --- a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts +++ b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts @@ -209,7 +209,11 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe onOk: () => { /* ignore, handle later */ }, onCancel: () => { /* ignore, handle later */ }, onType: (value: string) => { /* ignore, handle later */ }, - onShow: () => this.emitQuickOpenVisibilityChange(true) + onShow: () => this.emitQuickOpenVisibilityChange(true), + onHide: () => { + this.restoreFocus(); // focus back to editor or viewlet + this.emitQuickOpenVisibilityChange(false); // event + } }, { inputPlaceHolder: options.placeHolder || '' }, @@ -363,7 +367,11 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe } else { this.pickOpenWidget.setInput(model, autoFocus); } - }, error); + }, (err) => { + this.pickOpenWidget.hide(); + + error(err); + }); // Progress if task takes a long time Promise.timeout(800).then(() => { @@ -504,7 +512,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe // Apply label to first entry if (entries.length > 0) { - entries[0] = new QuickOpenEntryGroup(entries[0], nls.localize('historyMatches', "recently opened ({0})", entries.length), false); + entries[0] = new QuickOpenEntryGroup(entries[0], nls.localize('historyMatches', "recently opened"), false); } return new QuickOpenModel(entries, this.actionProvider); @@ -611,10 +619,11 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe } private handleDefaultHandlers(defaultHandlers: QuickOpenHandlerDescriptor[], value: string, currentResultToken: string): TPromise { + // Fill in history results if matching let matchingHistoryEntries = this.editorHistoryModel.getResults(value); if (matchingHistoryEntries.length > 0) { - matchingHistoryEntries[0] = new QuickOpenEntryGroup(matchingHistoryEntries[0], nls.localize('historyMatches', "recently opened ({0})", matchingHistoryEntries.length), false); + matchingHistoryEntries[0] = new QuickOpenEntryGroup(matchingHistoryEntries[0], nls.localize('historyMatches', "recently opened"), false); } let quickOpenModel = new QuickOpenModel(matchingHistoryEntries, this.actionProvider); @@ -678,7 +687,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe // Show additional handler results below any existing results if (additionalHandlerResults.length > 0) { let useTopBorder = quickOpenModel.getEntries().length > 0; - additionalHandlerResults[0] = new QuickOpenEntryGroup(additionalHandlerResults[0], nls.localize('additionalResultsGroupLabel', "{0} ({1})", groupLabel, additionalHandlerResults.length), useTopBorder); + additionalHandlerResults[0] = new QuickOpenEntryGroup(additionalHandlerResults[0], groupLabel, useTopBorder); quickOpenModel.addEntries(additionalHandlerResults); this.quickOpenWidget.refresh(quickOpenModel, { autoFocusFirstEntry: true }); } diff --git a/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts b/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts index e9e0c43feff..37e5d498a9d 100644 --- a/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts +++ b/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts @@ -216,10 +216,8 @@ export class SidebarPart extends Part implements IViewletService { return viewlet; }); - // Report progress for slow loading promises if workbench is already created and thus this is user initiated - if (this.partService.isCreated()) { - progressService.showWhile(loaderPromise, 800); - } + // Report progress for slow loading viewlets + progressService.showWhile(loaderPromise, this.partService.isCreated() ? 800 : 3200 /* less ugly initial startup */); // Add to Promise Cache until Loaded this.viewletLoaderPromises[id] = loaderPromise; @@ -265,10 +263,10 @@ export class SidebarPart extends Part implements IViewletService { createViewletPromise = TPromise.as(null); } - // Report progress for slow loading promises (but only if we did not create the viewlet before already and only if this is user initiated) + // Report progress for slow loading viewlets (but only if we did not create the viewlet before already) let progressService = this.mapProgressServiceToViewlet[viewlet.getId()]; - if (progressService && !viewletContainer && this.partService.isCreated()) { - this.mapProgressServiceToViewlet[viewlet.getId()].showWhile(createViewletPromise, 800); + if (progressService && !viewletContainer) { + this.mapProgressServiceToViewlet[viewlet.getId()].showWhile(createViewletPromise, this.partService.isCreated() ? 800 : 3200 /* less ugly initial startup */); } // Fill Content and Actions @@ -369,7 +367,7 @@ export class SidebarPart extends Part implements IViewletService { } let keybinding: string = null; - let keys = this.keybindingService.lookupKeybindings(viewletId).map(k => k.toLabel()); + let keys = this.keybindingService.lookupKeybindings(viewletId).map(k => this.keybindingService.getLabelFor(k)); if (keys && keys.length) { keybinding = keys[0]; } diff --git a/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts b/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts index 7a6bb6a791b..aae2b2dd78f 100644 --- a/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts +++ b/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts @@ -285,7 +285,7 @@ class StatusBarEntryItem implements IStatusbarItem { // Fallback to the keybinding service for any other case else { - this.keybindingService.executeCommand(id); + this.keybindingService.executeCommand(id).done(undefined, err => this.messageService.show(Severity.Error, toErrorMessage(err))); } } } \ No newline at end of file diff --git a/src/vs/workbench/browser/viewlet.ts b/src/vs/workbench/browser/viewlet.ts index 0f57f43ecad..51df182e679 100644 --- a/src/vs/workbench/browser/viewlet.ts +++ b/src/vs/workbench/browser/viewlet.ts @@ -7,6 +7,7 @@ import nls = require('vs/nls'); import {Promise, TPromise} from 'vs/base/common/winjs.base'; import DOM = require('vs/base/browser/dom'); +import errors = require('vs/base/common/errors'); import {IEventEmitter} from 'vs/base/common/eventEmitter'; import {Registry} from 'vs/platform/platform'; import {Dimension, Builder, $} from 'vs/base/browser/builder'; @@ -283,7 +284,7 @@ export abstract class ViewerViewlet extends Viewlet { // Make sure the current selected element is revealed let selection = this.viewer.getSelection(); if (selection.length > 0) { - this.reveal(selection[0], 0.5); + this.reveal(selection[0], 0.5).done(null, errors.onUnexpectedError); } // Pass Focus to Viewer diff --git a/src/vs/workbench/browser/workbench.ts b/src/vs/workbench/browser/workbench.ts index 9cd4bd4071e..c809ce7d63f 100644 --- a/src/vs/workbench/browser/workbench.ts +++ b/src/vs/workbench/browser/workbench.ts @@ -34,7 +34,6 @@ import {WorkbenchLayout, LayoutOptions} from 'vs/workbench/browser/layout'; import {IActionBarRegistry, Extensions as ActionBarExtensions} from 'vs/workbench/browser/actionBarRegistry'; import {IViewletRegistry, Extensions as ViewletExtensions} from 'vs/workbench/browser/viewlet'; import {QuickOpenController} from 'vs/workbench/browser/parts/quickopen/quickOpenController'; -import {WorkspaceStats} from 'vs/platform/telemetry/common/workspaceStats'; import {getServices} from 'vs/platform/instantiation/common/extensions'; import {AbstractKeybindingService} from 'vs/platform/keybinding/browser/keybindingServiceImpl'; import {UntitledEditorService, IUntitledEditorService} from 'vs/workbench/services/untitled/browser/untitledEditorService'; @@ -71,6 +70,7 @@ interface WorkbenchParams { export interface IWorkbenchCallbacks { onServicesCreated?: () => void; + onWorkbenchStarted?: () => void; } /** @@ -247,26 +247,9 @@ export class Workbench implements IPartService { this.eventService.emit(EventType.WORKBENCH_CREATED); this.creationPromiseComplete(true); - // Log to telemetry service - let windowSize = { - innerHeight: window.innerHeight, - innerWidth: window.innerWidth, - outerHeight: window.outerHeight, - outerWidth: window.outerWidth - }; - - this.telemetryService.publicLog('workspaceLoad', - { - userAgent: navigator.userAgent, - windowSize: windowSize, - autoSaveEnabled: this.contextService.isAutoSaveEnabled && this.contextService.isAutoSaveEnabled(), - emptyWorkbench: !this.contextService.getWorkspace(), - customKeybindingsCount: this.keybindingService.customKeybindingsCount(), - theme: this.currentTheme - }); - - let workspaceStats: WorkspaceStats = this.instantiationService.createInstance(WorkspaceStats); - workspaceStats.reportWorkspaceTags(); + if (this.callbacks && this.callbacks.onWorkbenchStarted) { + this.callbacks.onWorkbenchStarted(); + } }, errors.onUnexpectedError); } catch (error) { diff --git a/src/vs/workbench/common/textEditorWorker.ts b/src/vs/workbench/common/textEditorWorker.ts index 3d121ff1f00..d10d0cf465f 100644 --- a/src/vs/workbench/common/textEditorWorker.ts +++ b/src/vs/workbench/common/textEditorWorker.ts @@ -8,7 +8,6 @@ import {TPromise} from 'vs/base/common/winjs.base'; import {IMarkerService} from 'vs/platform/markers/common/markers'; import {IResourceService} from 'vs/editor/common/services/resourceService'; import {AbstractModeWorker} from 'vs/editor/common/modes/abstractModeWorker'; -import {URL} from 'vs/base/common/network'; import URI from 'vs/base/common/uri'; import strings = require('vs/base/common/strings'); import arrays = require('vs/base/common/arrays'); @@ -38,7 +37,7 @@ export class TextEditorWorker extends AbstractModeWorker { return this._contextService; } - public computeLinks(resource: URL): TPromise { + public computeLinks(resource: URI): TPromise { return super.computeLinks(resource).then((links) => { if (!this.patterns.length) { return links; diff --git a/src/vs/workbench/electron-browser/actions.ts b/src/vs/workbench/electron-browser/actions.ts index 055e5665cc0..abaddd0ab1e 100644 --- a/src/vs/workbench/electron-browser/actions.ts +++ b/src/vs/workbench/electron-browser/actions.ts @@ -5,7 +5,7 @@ 'use strict'; -import {Promise} from 'vs/base/common/winjs.base'; +import {Promise, TPromise} from 'vs/base/common/winjs.base'; import timer = require('vs/base/common/timer'); import paths = require('vs/base/common/paths'); import {Action} from 'vs/base/common/actions'; @@ -15,10 +15,12 @@ import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/edito import nls = require('vs/nls'); import {IMessageService, Severity} from 'vs/platform/message/common/message'; import {IThreadService} from 'vs/platform/thread/common/thread'; +import {IWindowConfiguration} from 'vs/workbench/electron-browser/window'; import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; import {IQuickOpenService} from 'vs/workbench/services/quickopen/browser/quickOpenService'; import {INullService} from 'vs/platform/instantiation/common/instantiation'; import {KeyMod, KeyCode} from 'vs/base/common/keyCodes'; +import {IConfigurationService} from 'vs/platform/configuration/common/configuration'; import ipc = require('ipc'); import remote = require('remote'); @@ -155,37 +157,73 @@ export class ZoomInAction extends Action { } } -export class ZoomOutAction extends Action { +export abstract class BaseZoomAction extends Action { + + constructor( + id: string, + label: string, + @IConfigurationService private configurationService: IConfigurationService + ) { + super(id, label); + } + + public run(): Promise { + return Promise.as(false); // Subclass to implement + } + + protected loadConfiguredZoomLevel(): TPromise { + return this.configurationService.loadConfiguration().then((windowConfig: IWindowConfiguration) => { + if (windowConfig.window && typeof windowConfig.window.zoomLevel === 'number') { + return windowConfig.window.zoomLevel; + } + + return 0; // default + }); + } +} + +export class ZoomOutAction extends BaseZoomAction { public static ID = 'workbench.action.zoomOut'; public static LABEL = nls.localize('zoomOut', "Zoom out"); - constructor(id: string, label: string, @INullService ns) { - super(id, label); + constructor( + id: string, + label: string, + @IConfigurationService configurationService: IConfigurationService + ) { + super(id, label, configurationService); } public run(): Promise { - if (webFrame.getZoomLevel() > 0) { - webFrame.setZoomLevel(webFrame.getZoomLevel() - 1); // prevent zoom out below 0 for now because it results in blurryness - } + return this.loadConfiguredZoomLevel().then(level => { + let newZoomLevelCandiate = webFrame.getZoomLevel() - 1; + if (newZoomLevelCandiate < level) { + newZoomLevelCandiate = level; // do not allow to zoom below the configured level + } - return Promise.as(true); + webFrame.setZoomLevel(newZoomLevelCandiate); + }); } } -export class ZoomResetAction extends Action { +export class ZoomResetAction extends BaseZoomAction { public static ID = 'workbench.action.zoomReset'; public static LABEL = nls.localize('zoomReset', "Reset Zoom"); - constructor(id: string, label: string, @INullService ns) { - super(id, label); + constructor( + id: string, + label: string, + @IConfigurationService configurationService: IConfigurationService + ) { + super(id, label, configurationService); } public run(): Promise { - webFrame.setZoomLevel(0); - - return Promise.as(true); + return this.loadConfiguredZoomLevel().then(level => { + webFrame.setZoomLevel(level); + }); } } diff --git a/src/vs/workbench/electron-browser/index.html b/src/vs/workbench/electron-browser/index.html index f96953dd4e6..ad533db5e8e 100644 --- a/src/vs/workbench/electron-browser/index.html +++ b/src/vs/workbench/electron-browser/index.html @@ -99,6 +99,8 @@