From 0656d21d11910e1b241d7d6c52761d89c0ba23a4 Mon Sep 17 00:00:00 2001 From: Johannes Date: Wed, 8 Jun 2022 17:49:21 +0200 Subject: [PATCH] auto-fixed prefer-const violation --- .../common/computeNodeModulesCacheKey.ts | 2 +- build/darwin/create-universal-app.ts | 2 +- build/gulpfile.editor.js | 38 +- build/gulpfile.extensions.js | 2 +- build/gulpfile.hygiene.js | 2 +- build/gulpfile.reh.js | 2 +- build/gulpfile.vscode.js | 14 +- build/gulpfile.vscode.web.js | 4 +- build/hygiene.js | 4 +- build/lib/asar.ts | 2 +- build/lib/builtInExtensions.ts | 2 +- build/lib/compilation.ts | 10 +- .../eslint/code-no-unexternalized-strings.ts | 4 +- build/lib/eslint/vscode-dts-cancellation.ts | 2 +- build/lib/extensions.ts | 4 +- build/lib/git.ts | 2 +- build/lib/i18n.ts | 188 +++++----- build/lib/monaco-api.ts | 84 ++--- build/lib/standalone.ts | 20 +- build/lib/treeshaking.ts | 18 +- build/lib/tsb/builder.ts | 60 +-- build/lib/tsb/index.ts | 2 +- build/lib/tsb/utils.ts | 2 +- build/lib/util.ts | 4 +- .../client/src/cssClient.ts | 20 +- .../server/src/languageModelCache.ts | 22 +- .../server/src/requests.ts | 2 +- .../server/src/test/completion.test.ts | 32 +- .../server/src/test/links.test.ts | 22 +- .../server/src/utils/documentContext.ts | 4 +- .../server/src/utils/runner.ts | 2 +- .../server/src/utils/strings.ts | 2 +- extensions/debug-auto-launch/src/extension.ts | 4 +- .../debug-server-ready/src/extension.ts | 8 +- .../emmet/src/defaultCompletionProvider.ts | 16 +- extensions/emmet/src/editPoint.ts | 14 +- extensions/emmet/src/emmetCommon.ts | 4 +- extensions/emmet/src/incrementDecrement.ts | 4 +- extensions/emmet/src/matchTag.ts | 2 +- extensions/emmet/src/removeTag.ts | 4 +- extensions/emmet/src/selectItem.ts | 2 +- extensions/emmet/src/selectItemStylesheet.ts | 8 +- .../test/editPointSelectItemBalance.test.ts | 20 +- .../src/test/partialParsingStylesheet.test.ts | 26 +- extensions/emmet/src/test/tagActions.test.ts | 4 +- extensions/emmet/src/toggleComment.ts | 10 +- extensions/emmet/src/updateImageSize.ts | 4 +- extensions/emmet/src/updateTag.ts | 2 +- extensions/emmet/src/util.ts | 8 +- .../extension-editing/src/extensionLinter.ts | 4 +- extensions/git/src/askpass.ts | 2 +- extensions/git/src/commands.ts | 8 +- extensions/git/src/decorationProvider.ts | 2 +- extensions/git/src/encoding.ts | 2 +- extensions/git/src/git.ts | 10 +- extensions/git/src/staging.ts | 2 +- extensions/git/src/util.ts | 6 +- .../github-authentication/src/common/utils.ts | 2 +- extensions/github/src/remoteSourceProvider.ts | 2 +- extensions/grunt/src/main.ts | 72 ++-- extensions/gulp/src/main.ts | 66 ++-- .../client/src/htmlClient.ts | 20 +- .../client/src/node/htmlClientMain.ts | 2 +- .../server/src/modes/cssMode.ts | 26 +- .../server/src/modes/embeddedSupport.ts | 42 +-- .../server/src/modes/formatting.ts | 44 +-- .../server/src/modes/htmlFolding.ts | 30 +- .../server/src/modes/javascriptMode.ts | 80 ++-- .../server/src/modes/languageModes.ts | 20 +- .../server/src/modes/selectionRanges.ts | 2 +- .../server/src/modes/semanticTokens.ts | 12 +- .../server/src/requests.ts | 2 +- .../server/src/test/completions.test.ts | 16 +- .../server/src/test/documentContext.test.ts | 2 +- .../server/src/test/formatting.test.ts | 18 +- .../server/src/test/selectionRanges.test.ts | 2 +- .../server/src/test/semanticTokens.test.ts | 2 +- .../server/src/utils/arrays.ts | 6 +- .../server/src/utils/documentContext.ts | 4 +- .../server/src/utils/runner.ts | 2 +- .../server/src/utils/strings.ts | 8 +- extensions/image-preview/media/main.js | 2 +- extensions/ipynb/src/test/serializers.test.ts | 2 +- extensions/jake/src/main.ts | 70 ++-- .../server/src/jsonServer.ts | 4 +- .../server/src/languageModelCache.ts | 22 +- .../server/src/utils/runner.ts | 4 +- .../server/src/utils/strings.ts | 2 +- .../src/languageFeatures/smartSelect.ts | 2 +- .../src/test/util.ts | 2 +- .../src/util/openDocumentLink.ts | 2 +- .../merge-conflict/src/codelensProvider.ts | 12 +- .../merge-conflict/src/commandHandler.ts | 14 +- .../merge-conflict/src/contentProvider.ts | 4 +- extensions/merge-conflict/src/delayer.ts | 4 +- .../src/documentMergeConflict.ts | 4 +- .../merge-conflict/src/documentTracker.ts | 8 +- .../merge-conflict/src/mergeConflictParser.ts | 8 +- .../merge-conflict/src/mergeDecorator.ts | 12 +- extensions/merge-conflict/src/services.ts | 2 +- .../microsoft-authentication/src/AADHelper.ts | 4 +- extensions/notebook-renderers/src/ansi.ts | 2 +- .../notebook-renderers/src/textHelper.ts | 4 +- extensions/npm/src/commands.ts | 16 +- .../src/features/packageJSONContribution.ts | 12 +- extensions/npm/src/npmMain.ts | 12 +- extensions/npm/src/npmView.ts | 20 +- extensions/npm/src/scriptHover.ts | 20 +- extensions/npm/src/tasks.ts | 70 ++-- .../src/features/completionItemProvider.ts | 38 +- .../src/features/hoverProvider.ts | 12 +- .../src/features/signatureHelpProvider.ts | 24 +- .../src/features/utils/async.ts | 6 +- .../src/features/validationProvider.ts | 32 +- .../php-language-features/src/phpMain.ts | 2 +- .../references-view/src/references/model.ts | 22 +- extensions/references-view/src/tree.ts | 2 +- extensions/references-view/src/utils.ts | 14 +- extensions/search-result/src/extension.ts | 4 +- extensions/shared.webpack.config.js | 4 +- extensions/vscode-api-tests/src/memfs.ts | 36 +- .../src/singlefolder-tests/commands.test.ts | 28 +- .../src/singlefolder-tests/languages.test.ts | 44 +-- .../notebook.document.test.ts | 2 +- .../notebook.editor.test.ts | 2 +- .../src/singlefolder-tests/terminal.test.ts | 4 +- .../src/singlefolder-tests/window.test.ts | 42 +-- .../workspace.tasks.test.ts | 2 +- .../src/singlefolder-tests/workspace.test.ts | 140 +++---- .../src/colorizer.test.ts | 12 +- .../vscode-test-resolver/src/extension.ts | 4 +- src/server-main.js | 2 +- src/vs/base/browser/defaultWorkerFactory.ts | 2 +- src/vs/base/browser/dom.ts | 74 ++-- src/vs/base/browser/iframe.ts | 8 +- src/vs/base/browser/keyboardEvent.ts | 8 +- src/vs/base/browser/mouseEvent.ts | 6 +- src/vs/base/browser/touch.ts | 42 +-- .../ui/breadcrumbs/breadcrumbsWidget.ts | 16 +- .../browser/ui/contextview/contextview.ts | 6 +- src/vs/base/browser/ui/dialog/dialog.ts | 2 +- src/vs/base/browser/ui/findinput/findInput.ts | 4 +- .../base/browser/ui/findinput/replaceInput.ts | 6 +- src/vs/base/browser/ui/inputbox/inputBox.ts | 6 +- .../ui/keybindingLabel/keybindingLabel.ts | 2 +- src/vs/base/browser/ui/list/listView.ts | 4 +- src/vs/base/browser/ui/list/rangeMap.ts | 8 +- src/vs/base/browser/ui/menu/menu.ts | 18 +- src/vs/base/browser/ui/menu/menubar.ts | 28 +- src/vs/base/browser/ui/sash/sash.ts | 2 +- .../browser/ui/selectBox/selectBoxCustom.ts | 6 +- src/vs/base/browser/ui/splitview/splitview.ts | 2 +- src/vs/base/browser/ui/toolbar/toolbar.ts | 2 +- src/vs/base/browser/ui/tree/abstractTree.ts | 2 +- src/vs/base/common/amd.ts | 6 +- src/vs/base/common/arrays.ts | 10 +- src/vs/base/common/codicons.ts | 2 +- src/vs/base/common/collections.ts | 12 +- src/vs/base/common/comparers.ts | 2 +- src/vs/base/common/diff/diff.ts | 4 +- src/vs/base/common/errors.ts | 2 +- src/vs/base/common/event.ts | 6 +- src/vs/base/common/json.ts | 4 +- src/vs/base/common/jsonEdit.ts | 4 +- src/vs/base/common/keyCodes.ts | 4 +- src/vs/base/common/labels.ts | 4 +- src/vs/base/common/lifecycle.ts | 2 +- src/vs/base/common/map.ts | 14 +- src/vs/base/common/objects.ts | 2 +- src/vs/base/common/platform.ts | 2 +- src/vs/base/common/skipList.ts | 6 +- src/vs/base/common/strings.ts | 6 +- src/vs/base/common/types.ts | 4 +- src/vs/base/common/uriIpc.ts | 4 +- src/vs/base/common/worker/simpleWorker.ts | 10 +- src/vs/base/node/id.ts | 2 +- src/vs/base/node/macAddress.ts | 2 +- src/vs/base/node/processes.ts | 2 +- src/vs/base/parts/ipc/common/ipc.net.ts | 2 +- src/vs/base/parts/ipc/common/ipc.ts | 4 +- src/vs/base/parts/ipc/node/ipc.net.ts | 6 +- .../test/browser/quickinput.test.ts | 4 +- src/vs/base/parts/request/browser/request.ts | 2 +- .../parts/storage/test/node/storage.test.ts | 8 +- src/vs/base/test/browser/actionbar.test.ts | 22 +- src/vs/base/test/browser/dom.test.ts | 10 +- .../browser/formattedTextRenderer.test.ts | 22 +- .../test/browser/markdownRenderer.test.ts | 14 +- .../ui/scrollbar/scrollbarState.test.ts | 4 +- .../browser/ui/splitview/splitview.test.ts | 2 +- .../browser/ui/tree/asyncDataTree.test.ts | 2 +- .../browser/ui/tree/indexTreeModel.test.ts | 2 +- .../browser/ui/tree/objectTreeModel.test.ts | 2 +- src/vs/base/test/common/arrays.test.ts | 10 +- src/vs/base/test/common/async.test.ts | 148 ++++---- src/vs/base/test/common/buffer.test.ts | 38 +- src/vs/base/test/common/cancellation.test.ts | 12 +- src/vs/base/test/common/collections.test.ts | 8 +- src/vs/base/test/common/color.test.ts | 8 +- src/vs/base/test/common/diff/diff.test.ts | 18 +- src/vs/base/test/common/event.test.ts | 56 +-- src/vs/base/test/common/filters.test.ts | 26 +- src/vs/base/test/common/fuzzyScorer.test.ts | 72 ++-- src/vs/base/test/common/glob.test.ts | 78 ++-- src/vs/base/test/common/history.test.ts | 2 +- src/vs/base/test/common/iconLabels.test.ts | 2 +- src/vs/base/test/common/json.test.ts | 22 +- src/vs/base/test/common/jsonEdit.test.ts | 52 +-- src/vs/base/test/common/jsonFormatter.test.ts | 2 +- src/vs/base/test/common/lifecycle.test.ts | 10 +- src/vs/base/test/common/linkedList.test.ts | 10 +- src/vs/base/test/common/map.test.ts | 84 ++--- src/vs/base/test/common/marshalling.test.ts | 6 +- src/vs/base/test/common/network.test.ts | 10 +- src/vs/base/test/common/objects.test.ts | 26 +- src/vs/base/test/common/processes.test.ts | 2 +- src/vs/base/test/common/resourceTree.test.ts | 4 +- src/vs/base/test/common/resources.test.ts | 34 +- src/vs/base/test/common/scrollable.test.ts | 4 +- src/vs/base/test/common/skipList.test.ts | 26 +- src/vs/base/test/common/stream.test.ts | 4 +- .../base/test/common/timeTravelScheduler.ts | 4 +- src/vs/base/test/common/uri.test.ts | 30 +- src/vs/base/test/node/uri.test.perf.ts | 18 +- src/vs/base/worker/workerMain.ts | 4 +- .../contrib/languagePackCachedDataCleaner.ts | 2 +- src/vs/code/node/cli.ts | 2 +- .../services/abstractCodeEditorService.ts | 2 +- .../browser/services/editorWorkerService.ts | 4 +- .../editor/browser/widget/codeEditorWidget.ts | 12 +- src/vs/editor/common/config/editorOptions.ts | 2 +- src/vs/editor/common/core/range.ts | 8 +- src/vs/editor/common/cursor/cursor.ts | 2 +- .../common/cursor/cursorMoveCommands.ts | 2 +- .../editor/common/languageFeatureRegistry.ts | 6 +- .../supports/inplaceReplaceSupport.ts | 2 +- .../common/languages/supports/tokenization.ts | 2 +- src/vs/editor/common/model/editStack.ts | 2 +- src/vs/editor/common/model/textModelSearch.ts | 2 +- .../common/services/editorSimpleWorker.ts | 4 +- .../services/languageFeatureDebounce.ts | 4 +- .../common/services/languagesRegistry.ts | 6 +- .../services/markerDecorationsService.ts | 2 +- src/vs/editor/common/services/modelService.ts | 2 +- .../services/unicodeTextModelHighlighter.ts | 2 +- .../common/viewModel/modelLineProjection.ts | 2 +- .../browser/bracketMatching.ts | 6 +- .../caretOperations/browser/transpose.ts | 26 +- .../test/browser/codeAction.test.ts | 6 +- .../contrib/codelens/browser/codelens.ts | 2 +- .../codelens/browser/codelensController.ts | 22 +- .../codelens/browser/codelensWidget.ts | 6 +- .../contrib/colorPicker/browser/color.ts | 4 +- .../colorPicker/browser/colorDetector.ts | 6 +- .../comment/browser/blockCommentCommand.ts | 4 +- .../comment/browser/lineCommentCommand.ts | 10 +- .../contextmenu/browser/contextmenu.ts | 2 +- src/vs/editor/contrib/dnd/browser/dnd.ts | 8 +- .../contrib/dnd/browser/dragAndDropCommand.ts | 2 +- .../documentSymbols/browser/outlineModel.ts | 24 +- .../test/browser/outlineModel.test.ts | 28 +- .../test/browser/editorState.test.ts | 18 +- .../contrib/find/browser/findController.ts | 14 +- .../contrib/find/browser/findDecorations.ts | 20 +- .../editor/contrib/find/browser/findModel.ts | 60 +-- .../contrib/find/browser/findOptionsWidget.ts | 4 +- .../editor/contrib/find/browser/findState.ts | 4 +- .../editor/contrib/find/browser/findWidget.ts | 36 +- .../contrib/find/browser/replaceAllCommand.ts | 4 +- .../contrib/find/browser/replacePattern.ts | 20 +- .../contrib/find/test/browser/find.test.ts | 18 +- .../find/test/browser/findController.test.ts | 2 +- .../find/test/browser/findModel.test.ts | 182 ++++----- .../find/test/browser/replacePattern.test.ts | 50 +-- .../editor/contrib/folding/browser/folding.ts | 82 ++--- .../contrib/folding/browser/foldingModel.ts | 118 +++--- .../contrib/folding/browser/foldingRanges.ts | 30 +- .../folding/browser/hiddenRangeModel.ts | 22 +- .../folding/browser/indentRangeProvider.ts | 36 +- .../browser/intializingRangeProvider.ts | 8 +- .../folding/browser/syntaxRangeProvider.ts | 32 +- .../folding/test/browser/foldingModel.test.ts | 286 +++++++-------- .../test/browser/foldingRanges.test.ts | 24 +- .../test/browser/hiddenRangeModel.test.ts | 10 +- .../folding/test/browser/indentFold.test.ts | 26 +- .../test/browser/indentRangeProvider.test.ts | 16 +- .../folding/test/browser/syntaxFold.test.ts | 30 +- .../editor/contrib/format/browser/format.ts | 16 +- .../contrib/format/browser/formatActions.ts | 6 +- .../contrib/format/browser/formattingEdit.ts | 4 +- .../gotoError/browser/gotoErrorWidget.ts | 16 +- .../browser/markerNavigationService.ts | 4 +- .../contrib/gotoSymbol/browser/goToSymbol.ts | 2 +- .../browser/link/goToDefinitionAtPosition.ts | 8 +- .../browser/peek/referencesController.ts | 8 +- .../gotoSymbol/browser/peek/referencesTree.ts | 2 +- .../browser/peek/referencesWidget.ts | 10 +- .../gotoSymbol/browser/referencesModel.ts | 10 +- src/vs/editor/contrib/hover/browser/hover.ts | 2 +- .../inPlaceReplace/browser/inPlaceReplace.ts | 4 +- .../indentation/browser/indentUtils.ts | 2 +- .../indentation/browser/indentation.ts | 94 ++--- .../contrib/inlayHints/browser/inlayHints.ts | 2 +- .../browser/inlayHintsController.ts | 6 +- .../inlayHints/browser/inlayHintsHover.ts | 2 +- .../browser/inlineCompletionsModel.ts | 2 +- .../browser/copyLinesCommand.ts | 2 +- .../browser/linesOperations.ts | 126 +++---- .../browser/moveLinesCommand.ts | 86 ++--- .../browser/sortLinesCommand.ts | 10 +- .../test/browser/linesOperations.test.ts | 102 +++--- .../test/browser/moveLinesCommand.test.ts | 2 +- .../linkedEditing/browser/linkedEditing.ts | 2 +- .../editor/contrib/links/browser/getLinks.ts | 2 +- .../multicursor/browser/multicursor.ts | 10 +- .../test/browser/multicursor.test.ts | 50 +-- .../contrib/peekView/browser/peekView.ts | 6 +- .../editor/contrib/rename/browser/rename.ts | 4 +- .../smartSelect/browser/bracketSelections.ts | 16 +- .../smartSelect/browser/smartSelect.ts | 12 +- .../smartSelect/browser/wordSelections.ts | 8 +- .../test/browser/smartSelect.test.ts | 24 +- .../contrib/snippet/browser/snippetParser.ts | 34 +- .../contrib/snippet/browser/snippetSession.ts | 14 +- .../snippet/browser/snippetVariables.ts | 4 +- .../browser/snippetController2.old.test.ts | 4 +- .../test/browser/snippetParser.test.ts | 42 +-- .../suggest/browser/completionModel.ts | 8 +- .../editor/contrib/suggest/browser/suggest.ts | 4 +- .../suggest/browser/suggestAlternatives.ts | 2 +- .../suggest/browser/suggestController.ts | 16 +- .../contrib/suggest/browser/suggestMemory.ts | 14 +- .../contrib/suggest/browser/suggestModel.ts | 4 +- .../suggest/browser/suggestWidgetRenderer.ts | 2 +- .../suggest/browser/suggestWidgetStatus.ts | 2 +- .../contrib/suggest/browser/wordDistance.ts | 8 +- .../test/browser/completionModel.test.ts | 4 +- .../test/browser/suggestController.test.ts | 34 +- .../test/browser/suggestMemory.test.ts | 24 +- .../suggest/test/browser/suggestModel.test.ts | 2 +- .../suggest/test/browser/wordDistance.test.ts | 6 +- .../browser/unicodeHighlighter.ts | 12 +- .../browser/wordHighlighter.ts | 38 +- .../wordOperations/browser/wordOperations.ts | 4 +- .../test/browser/wordTestUtils.ts | 4 +- .../browser/wordPartOperations.ts | 4 +- .../contrib/zoneWidget/browser/zoneWidget.ts | 20 +- .../standalone/browser/standaloneServices.ts | 2 +- .../browser/standaloneThemeService.ts | 4 +- .../common/monarch/monarchCompile.ts | 6 +- .../standalone/common/monarch/monarchLexer.ts | 4 +- .../browser/commands/shiftCommand.test.ts | 20 +- .../test/browser/commands/sideEditing.test.ts | 2 +- .../trimTrailingWhitespaceCommand.test.ts | 6 +- .../config/editorConfiguration.test.ts | 32 +- .../test/browser/controller/cursor.test.ts | 66 ++-- .../test/browser/controller/imeRecorder.ts | 2 +- .../test/browser/controller/imeTester.ts | 34 +- .../browser/controller/textAreaInput.test.ts | 4 +- .../browser/controller/textAreaState.test.ts | 18 +- .../services/decorationRenderOptions.test.ts | 6 +- .../browser/services/openerService.test.ts | 2 +- src/vs/editor/test/browser/testCommand.ts | 4 +- .../browser/view/minimapCharRenderer.test.ts | 22 +- .../test/browser/view/viewLayer.test.ts | 18 +- .../viewModel/modelLineProjection.test.ts | 54 +-- .../viewModel/viewModelDecorations.test.ts | 12 +- .../browser/viewModel/viewModelImpl.test.ts | 6 +- .../common/core/characterClassifier.test.ts | 2 +- .../test/common/core/lineTokens.test.ts | 4 +- src/vs/editor/test/common/core/range.test.ts | 10 +- .../editor/test/common/core/testLineToken.ts | 2 +- .../test/common/diff/diffComputer.test.ts | 270 +++++++------- .../getBracketPairsInRange.test.ts | 4 +- .../common/model/editableTextModel.test.ts | 18 +- .../model/editableTextModelAuto.test.ts | 34 +- .../model/editableTextModelTestUtils.ts | 26 +- .../test/common/model/intervalTree.test.ts | 54 +-- .../linesTextBuffer/linesTextBuffer.test.ts | 2 +- .../textBufferAutoTestUtils.ts | 54 +-- .../test/common/model/model.line.test.ts | 18 +- src/vs/editor/test/common/model/model.test.ts | 4 +- .../common/model/modelDecorations.test.ts | 64 ++-- .../common/model/modelEditOperation.test.ts | 8 +- .../pieceTreeTextBuffer.test.ts | 240 ++++++------ .../test/common/model/textChange.test.ts | 46 +-- .../test/common/model/textModel.test.ts | 64 ++-- .../test/common/model/textModelSearch.test.ts | 88 ++--- .../common/model/textModelWithTokens.test.ts | 58 +-- .../test/common/model/tokensStore.test.ts | 12 +- .../modes/languageConfiguration.test.ts | 20 +- .../common/modes/languageSelector.test.ts | 26 +- .../test/common/modes/linkComputer.test.ts | 6 +- .../modes/supports/characterPair.test.ts | 14 +- .../modes/supports/electricCharacter.test.ts | 8 +- .../common/modes/supports/onEnter.test.ts | 24 +- .../modes/supports/richEditBrackets.test.ts | 20 +- .../modes/supports/tokenization.test.ts | 52 +-- .../common/modes/textToHtmlTokenizer.test.ts | 30 +- src/vs/editor/test/common/modesTestUtils.ts | 8 +- .../services/editorSimpleWorker.test.ts | 20 +- .../viewLayout/viewLineRenderer.test.ts | 2 +- .../browser/menuEntryActionViewItem.ts | 2 +- src/vs/platform/actions/common/actions.ts | 4 +- src/vs/platform/actions/common/menuService.ts | 14 +- .../platform/assignment/common/assignment.ts | 6 +- .../backup/electron-main/backupMainService.ts | 6 +- src/vs/platform/commands/common/commands.ts | 6 +- .../configuration/common/configuration.ts | 4 +- .../common/configurationModels.ts | 24 +- .../common/configurationRegistry.ts | 14 +- .../test/common/configuration.test.ts | 26 +- .../test/common/configurationModels.test.ts | 92 ++--- .../contextkey/browser/contextKeyService.ts | 4 +- .../platform/contextkey/common/contextkey.ts | 34 +- .../contextkey/test/common/contextkey.test.ts | 16 +- .../contextview/browser/contextMenuHandler.ts | 6 +- .../diagnostics/node/diagnosticsService.ts | 2 +- src/vs/platform/environment/node/argv.ts | 30 +- .../abstractExtensionManagementService.ts | 2 +- .../common/extensionEnablementService.ts | 6 +- .../common/extensionManagementCLIService.ts | 2 +- .../common/extensionsScannerService.ts | 26 +- .../node/extensionManagementService.ts | 2 +- .../extensions/common/extensionValidator.ts | 12 +- .../platform/extensions/common/extensions.ts | 4 +- .../test/common/extensionValidator.test.ts | 6 +- .../node/externalTerminalService.ts | 8 +- .../files/browser/htmlFileSystemProvider.ts | 2 +- .../common/inMemoryFilesystemProvider.ts | 34 +- .../node/watcher/nodejs/nodejsWatcherLib.ts | 2 +- .../files/test/common/watcher.test.ts | 2 +- .../files/test/node/diskFileService.test.ts | 8 +- .../node/nodejsWatcher.integrationTest.ts | 4 +- .../node/parcelWatcher.integrationTest.ts | 2 +- src/vs/platform/instantiation/common/graph.ts | 12 +- .../common/instantiationService.ts | 34 +- .../instantiation/common/serviceCollection.ts | 2 +- .../instantiation/test/common/graph.test.ts | 2 +- .../test/common/instantiationService.test.ts | 66 ++-- .../test/common/instantiationServiceMock.ts | 18 +- .../keybinding/common/keybindingResolver.ts | 14 +- .../common/resolvedKeybindingItem.ts | 2 +- .../common/abstractKeybindingService.test.ts | 24 +- .../test/common/mockKeybindingService.ts | 4 +- .../keyboardLayout/common/keyboardLayout.ts | 6 +- .../languagePacks/node/languagePacks.ts | 2 +- src/vs/platform/lifecycle/common/lifecycle.ts | 2 +- .../electron-main/lifecycleMainService.ts | 2 +- .../platform/markers/common/markerService.ts | 16 +- src/vs/platform/markers/common/markers.ts | 2 +- .../markers/test/common/markerService.test.ts | 24 +- .../platform/menubar/electron-main/menubar.ts | 4 +- .../opener/test/common/opener.test.ts | 2 +- .../registry/test/common/platform.test.ts | 2 +- .../state/test/electron-main/state.test.ts | 2 +- src/vs/platform/storage/common/storage.ts | 4 +- .../test/common/storageService.test.ts | 4 +- .../electron-main/storageMainService.test.ts | 14 +- .../telemetry/browser/errorTelemetry.ts | 6 +- .../telemetry/common/errorTelemetry.ts | 6 +- .../telemetry/common/telemetryService.ts | 14 +- .../telemetry/common/telemetryUtils.ts | 2 +- .../test/browser/telemetryService.test.ts | 204 +++++------ .../appInsightsAppender.test.ts | 10 +- .../terminal/common/terminalProfiles.ts | 2 +- .../terminal/node/terminalEnvironment.ts | 2 +- .../platform/terminal/node/terminalProcess.ts | 2 +- .../platform/theme/browser/iconsStyleSheet.ts | 4 +- src/vs/platform/theme/common/colorRegistry.ts | 12 +- src/vs/platform/theme/common/iconRegistry.ts | 8 +- src/vs/platform/theme/common/styler.ts | 2 +- src/vs/platform/theme/common/themeService.ts | 4 +- .../common/tokenClassificationRegistry.ts | 14 +- .../theme/test/common/testThemeService.ts | 2 +- src/vs/platform/tunnel/common/tunnel.ts | 6 +- .../undoRedo/common/undoRedoService.ts | 6 +- .../uriIdentity/common/uriIdentityService.ts | 2 +- .../test/common/uriIdentityService.test.ts | 22 +- .../userDataSync/common/extensionsSync.ts | 2 +- .../userDataSync/common/globalStateSync.ts | 4 +- .../userDataSync/common/keybindingsMerge.ts | 2 +- .../userDataSync/common/snippetsSync.ts | 2 +- .../platform/userDataSync/common/tasksSync.ts | 2 +- .../common/userDataSyncService.ts | 2 +- .../test/common/snippetsSync.test.ts | 2 +- .../test/common/userDataSyncService.test.ts | 8 +- .../electron-main/windowsMainService.ts | 4 +- .../workspace/test/common/workspace.test.ts | 10 +- .../platform/workspaces/common/workspaces.ts | 12 +- .../workspacesHistoryMainService.ts | 18 +- .../workspaces/test/common/workspaces.test.ts | 6 +- .../workspacesHistoryStorage.test.ts | 8 +- .../workspacesManagementMainService.test.ts | 4 +- src/vs/server/node/extensionHostConnection.ts | 2 +- .../server/node/remoteAgentEnvironmentImpl.ts | 4 +- .../node/remoteExtensionHostAgentServer.ts | 4 +- src/vs/server/node/remoteLanguagePacks.ts | 4 +- src/vs/server/node/server.cli.ts | 22 +- src/vs/server/node/webClientServer.ts | 2 +- .../api/browser/mainThreadBulkEdits.ts | 2 +- .../api/browser/mainThreadCommands.ts | 4 +- .../api/browser/mainThreadComments.ts | 42 +-- .../api/browser/mainThreadDebugService.ts | 2 +- .../api/browser/mainThreadDecorations.ts | 2 +- .../api/browser/mainThreadDiagnostics.ts | 4 +- .../api/browser/mainThreadDocuments.ts | 2 +- .../api/browser/mainThreadEditorTabs.ts | 2 +- .../api/browser/mainThreadEditors.ts | 6 +- .../api/browser/mainThreadFileSystem.ts | 2 +- .../api/browser/mainThreadLanguageFeatures.ts | 4 +- .../api/browser/mainThreadNotebook.ts | 2 +- .../api/browser/mainThreadNotebookEditors.ts | 2 +- .../api/browser/mainThreadNotebookKernels.ts | 4 +- .../workbench/api/browser/mainThreadTask.ts | 12 +- .../api/browser/mainThreadWorkspace.ts | 2 +- .../api/browser/viewsExtensionPoint.ts | 6 +- .../api/common/configurationExtensionPoint.ts | 12 +- .../workbench/api/common/extHostCommands.ts | 6 +- .../workbench/api/common/extHostComments.ts | 20 +- .../api/common/extHostDecorations.ts | 10 +- .../api/common/extHostDiagnostics.ts | 8 +- .../common/extHostDocumentSaveParticipant.ts | 2 +- .../api/common/extHostExtensionService.ts | 4 +- .../workbench/api/common/extHostFileSystem.ts | 2 +- .../common/extHostFileSystemEventService.ts | 12 +- .../api/common/extHostLanguageFeatures.ts | 4 +- .../workbench/api/common/extHostLanguages.ts | 2 +- src/vs/workbench/api/common/extHostMemento.ts | 2 +- .../api/common/extHostMessageService.ts | 2 +- .../api/common/extHostNotebookDocument.ts | 2 +- .../api/common/extHostRequireInterceptor.ts | 2 +- src/vs/workbench/api/common/extHostTask.ts | 12 +- .../api/common/extHostTypeConverters.ts | 2 +- src/vs/workbench/api/common/extHostTypes.ts | 12 +- .../common/jsonValidationExtensionPoint.ts | 2 +- .../api/node/extHostExtensionService.ts | 4 +- src/vs/workbench/api/node/extHostTask.ts | 4 +- .../api/node/extHostTunnelService.ts | 4 +- .../api/node/extensionHostProcess.ts | 2 +- src/vs/workbench/api/node/proxyResolver.ts | 2 +- .../test/browser/extHostApiCommands.test.ts | 90 ++--- .../browser/extHostAuthentication.test.ts | 4 +- .../api/test/browser/extHostBulkEdits.test.ts | 6 +- .../test/browser/extHostConfiguration.test.ts | 4 +- .../test/browser/extHostDecorations.test.ts | 2 +- .../test/browser/extHostDiagnostics.test.ts | 72 ++-- .../test/browser/extHostDocumentData.test.ts | 20 +- .../extHostDocumentSaveParticipant.test.ts | 52 +-- .../test/browser/extHostEditorTabs.test.ts | 6 +- .../browser/extHostLanguageFeatures.test.ts | 76 ++-- .../browser/extHostMessagerService.test.ts | 2 +- .../api/test/browser/extHostNotebook.test.ts | 12 +- .../browser/extHostNotebookKernel.test.ts | 6 +- .../test/browser/extHostTextEditor.test.ts | 8 +- .../api/test/browser/extHostTreeViews.test.ts | 6 +- .../test/browser/extHostTypeConverter.test.ts | 4 +- .../api/test/browser/extHostTypes.test.ts | 72 ++-- .../api/test/browser/extHostWorkspace.test.ts | 12 +- .../browser/mainThreadConfiguration.test.ts | 2 +- .../browser/mainThreadDiagnostics.test.ts | 6 +- ...mainThreadDocumentContentProviders.test.ts | 6 +- .../test/browser/mainThreadDocuments.test.ts | 4 +- .../mainThreadDocumentsAndEditors.test.ts | 2 +- .../test/browser/mainThreadEditors.test.ts | 14 +- .../api/test/common/testRPCProtocol.ts | 4 +- .../api/test/node/extHostSearch.test.ts | 4 +- .../api/worker/extHostExtensionService.ts | 4 +- src/vs/workbench/browser/labels.ts | 4 +- src/vs/workbench/browser/layout.ts | 4 +- .../parts/activitybar/activitybarActions.ts | 2 +- .../parts/activitybar/activitybarPart.ts | 2 +- .../parts/auxiliarybar/auxiliaryBarActions.ts | 2 +- .../workbench/browser/parts/compositeBar.ts | 2 +- .../browser/parts/editor/breadcrumbs.ts | 4 +- .../parts/editor/breadcrumbsControl.ts | 30 +- .../browser/parts/editor/breadcrumbsModel.ts | 4 +- .../browser/parts/editor/breadcrumbsPicker.ts | 2 +- .../browser/parts/editor/editorPane.ts | 2 +- .../browser/parts/editor/editorStatus.ts | 4 +- .../notifications/notificationsCenter.ts | 4 +- .../notifications/notificationsToasts.ts | 2 +- .../browser/parts/panel/panelActions.ts | 2 +- .../browser/parts/panel/panelPart.ts | 2 +- .../browser/parts/titlebar/menubarControl.ts | 10 +- .../browser/parts/titlebar/windowTitle.ts | 2 +- .../browser/parts/views/viewPaneContainer.ts | 6 +- .../browser/parts/views/viewsViewlet.ts | 2 +- src/vs/workbench/browser/workbench.ts | 2 +- src/vs/workbench/common/actions.ts | 2 +- src/vs/workbench/common/contributions.ts | 4 +- .../common/editor/editorGroupModel.ts | 4 +- .../audioCues/browser/audioCueService.ts | 2 +- .../contrib/audioCues/browser/observable.ts | 2 +- .../contrib/bulkEdit/browser/bulkCellEdits.ts | 2 +- .../bulkEdit/browser/bulkEditService.ts | 12 +- .../contrib/bulkEdit/browser/bulkFileEdits.ts | 2 +- .../contrib/bulkEdit/browser/bulkTextEdits.ts | 8 +- .../contrib/bulkEdit/browser/conflicts.ts | 4 +- .../browser/preview/bulkEdit.contribution.ts | 8 +- .../bulkEdit/browser/preview/bulkEditPane.ts | 4 +- .../browser/preview/bulkEditPreview.ts | 14 +- .../bulkEdit/browser/preview/bulkEditTree.ts | 30 +- .../browser/callHierarchyPeek.ts | 4 +- .../browser/callHierarchyTree.ts | 2 +- .../browser/accessibility/accessibility.ts | 4 +- .../browser/find/simpleFindWidget.ts | 2 +- .../inspectEditorTokens.ts | 42 +-- .../languageConfigurationExtensionPoint.ts | 2 +- .../browser/outline/documentSymbolsOutline.ts | 10 +- .../suggestEnabledInput.ts | 12 +- .../electron-sandbox/selectionClipboard.ts | 8 +- .../test/browser/saveParticipant.test.ts | 8 +- .../comments/browser/commentFormActions.ts | 2 +- .../comments/browser/commentGlyphWidget.ts | 2 +- .../contrib/comments/browser/commentNode.ts | 28 +- .../contrib/comments/browser/commentReply.ts | 10 +- .../comments/browser/commentService.ts | 12 +- .../comments/browser/commentThreadBody.ts | 26 +- .../comments/browser/commentThreadHeader.ts | 2 +- .../browser/commentThreadRangeDecorator.ts | 2 +- .../comments/browser/commentThreadWidget.ts | 2 +- .../browser/commentThreadZoneWidget.ts | 6 +- .../browser/commentsEditorContribution.ts | 46 +-- .../contrib/comments/browser/commentsView.ts | 4 +- .../comments/browser/reactionsAction.ts | 10 +- .../contrib/comments/common/commentModel.ts | 2 +- .../configurationExportHelper.ts | 4 +- .../customEditor/browser/customEditorInput.ts | 2 +- .../debug/test/browser/baseDebugView.test.ts | 2 +- .../contrib/emmet/browser/emmetActions.ts | 6 +- .../emmet/test/browser/emmetAction.test.ts | 2 +- .../abstractRuntimeExtensionsEditor.ts | 16 +- .../extensions/browser/extensionEditor.ts | 8 +- .../browser/extensions.contribution.ts | 2 +- .../extensions/browser/extensionsActions.ts | 4 +- .../extensions/browser/extensionsList.ts | 2 +- .../extensions/browser/extensionsViews.ts | 12 +- .../browser/extensionsWorkbenchService.ts | 4 +- .../browser/fileBasedRecommendations.ts | 2 +- .../extensionsAutoProfiler.ts | 4 +- .../reportExtensionIssueAction.ts | 6 +- .../runtimeExtensionsEditor.ts | 2 +- .../test/common/extensionQuery.test.ts | 2 +- .../extensionRecommendationsService.test.ts | 2 +- .../extensionsWorkbenchService.test.ts | 2 +- .../externalTerminal.contribution.ts | 2 +- .../files/browser/editors/textFileEditor.ts | 2 +- .../contrib/files/browser/explorerService.ts | 2 +- .../contrib/files/browser/explorerViewlet.ts | 4 +- .../contrib/files/browser/fileActions.ts | 24 +- .../workbench/contrib/files/browser/files.ts | 2 +- .../files/browser/views/explorerView.ts | 6 +- .../files/browser/views/openEditorsView.ts | 6 +- .../test/browser/fileEditorInput.test.ts | 4 +- .../format/browser/formatActionsMultiple.ts | 4 +- .../contrib/format/browser/formatModified.ts | 2 +- .../browser/inlayHintsAccessibilty.ts | 4 +- .../browser/interactive.contribution.ts | 2 +- .../browser/languageStatus.contribution.ts | 4 +- .../browser/localHistoryCommands.ts | 2 +- .../electron-sandbox/localeService.ts | 2 +- .../markers/browser/markersFileDecorations.ts | 4 +- .../contrib/markers/browser/markersModel.ts | 6 +- .../contrib/markers/browser/markersTable.ts | 2 +- .../contrib/markers/browser/markersView.ts | 2 +- .../markers/test/browser/markersModel.test.ts | 6 +- .../browser/mergeEditor.contribution.ts | 6 +- .../contrib/mergeEditor/browser/model.ts | 2 +- .../browser/contrib/find/notebookFind.ts | 4 +- .../contrib/find/notebookFindReplaceWidget.ts | 4 +- .../browser/contrib/format/formatting.ts | 2 +- .../notebook/browser/notebookEditorWidget.ts | 4 +- .../browser/view/cellParts/cellOutput.ts | 4 +- .../browser/view/renderers/webviewPreloads.ts | 12 +- .../notebook/test/browser/cellDnd.test.ts | 2 +- .../contrib/outline/browser/outlinePane.ts | 2 +- .../outline/browser/outlineViewState.ts | 2 +- .../contrib/output/browser/outputServices.ts | 2 +- .../contrib/output/browser/outputView.ts | 2 +- .../test/browser/outputLinkProvider.test.ts | 12 +- .../performance/browser/perfviewEditor.ts | 12 +- .../browser/keyboardLayoutPicker.ts | 18 +- .../preferences/browser/settingsEditor2.ts | 2 +- .../preferences/browser/settingsTreeModels.ts | 2 +- .../test/common/smartSnippetInserter.test.ts | 6 +- .../remote/browser/explorerViewItems.ts | 2 +- .../contrib/remote/browser/remote.ts | 14 +- .../contrib/remote/browser/remoteIndicator.ts | 8 +- .../contrib/remote/browser/tunnelView.ts | 2 +- .../contrib/scm/browser/scmViewPane.ts | 4 +- .../workbench/contrib/search/common/search.ts | 2 +- .../snippets/browser/configureSnippets.ts | 4 +- .../browser/snippetCompletionProvider.ts | 4 +- .../contrib/snippets/browser/snippetsFile.ts | 6 +- .../snippets/browser/snippetsService.ts | 10 +- .../snippets/test/browser/snippetFile.test.ts | 8 +- .../test/browser/snippetsRegistry.test.ts | 4 +- .../test/browser/snippetsService.test.ts | 80 ++-- .../electron-sandbox/workspaceTagsService.ts | 8 +- .../tasks/browser/abstractTaskService.ts | 346 +++++++++--------- .../tasks/browser/runAutomaticTasks.ts | 4 +- .../tasks/browser/task.contribution.ts | 6 +- .../contrib/tasks/browser/taskQuickPick.ts | 6 +- .../tasks/browser/terminalTaskSystem.ts | 172 ++++----- .../contrib/tasks/common/jsonSchema_v1.ts | 8 +- .../contrib/tasks/common/jsonSchema_v2.ts | 28 +- .../contrib/tasks/common/problemCollectors.ts | 72 ++-- .../contrib/tasks/common/problemMatcher.ts | 124 +++---- .../contrib/tasks/common/taskConfiguration.ts | 174 ++++----- .../tasks/common/taskDefinitionRegistry.ts | 26 +- .../contrib/tasks/common/taskSystem.ts | 4 +- .../workbench/contrib/tasks/common/tasks.ts | 46 +-- .../tasks/electron-sandbox/taskService.ts | 8 +- .../tasks/test/common/problemMatcher.test.ts | 60 +-- .../test/common/taskConfiguration.test.ts | 278 +++++++------- .../browser/links/terminalLinkManager.ts | 2 +- .../terminal/browser/terminalGroupService.ts | 2 +- .../terminal/browser/terminalInstance.ts | 8 +- .../browser/terminalMainContribution.ts | 2 +- .../terminal/browser/terminalService.ts | 4 +- .../terminal/browser/terminalTabsList.ts | 2 +- .../contrib/terminal/browser/terminalView.ts | 2 +- .../browser/xterm/commandNavigationAddon.ts | 2 +- .../test/browser/terminalConfigHelper.test.ts | 4 +- .../browser/terminalProfileService.test.ts | 10 +- .../testing/browser/testingDecorations.ts | 4 +- .../testing/browser/testingExplorerView.ts | 2 +- .../common/mainThreadTestCollection.ts | 2 +- .../contrib/testing/common/testId.ts | 2 +- .../testing/test/browser/testObjectTree.ts | 2 +- .../themes/browser/themes.contribution.ts | 4 +- .../browser/themes.test.contribution.ts | 78 ++-- .../colorRegistry.releaseTest.ts | 42 +-- .../browser/typeHierarchyPeek.ts | 4 +- .../browser/typeHierarchyTree.ts | 2 +- .../webviewView/browser/webviewViewPane.ts | 2 +- .../browser/walkThroughPart.ts | 2 +- .../parts/titlebar/menubarControl.ts | 8 +- .../actions/common/menusExtensionPoint.ts | 6 +- .../test/common/commandService.test.ts | 28 +- .../browser/configurationService.ts | 4 +- .../common/configurationEditingService.ts | 4 +- .../common/jsonEditingService.ts | 2 +- .../baseConfigurationResolverService.ts | 2 +- .../common/variableResolver.ts | 2 +- .../configurationResolverService.test.ts | 22 +- .../decorations/browser/decorationsService.ts | 16 +- .../test/browser/decorationsService.test.ts | 44 +-- .../dialogs/browser/simpleFileDialog.ts | 6 +- .../editor/browser/editorResolverService.ts | 10 +- .../services/editor/browser/editorService.ts | 2 +- .../editor/common/editorGroupFinder.ts | 4 +- .../test/browser/editorGroupsService.test.ts | 10 +- .../editor/test/browser/editorService.test.ts | 230 ++++++------ .../browser/extensionEnablementService.ts | 8 +- .../browser/webExtensionsScannerService.ts | 2 +- .../common/abstractExtensionService.ts | 18 +- .../common/extensionDescriptionRegistry.ts | 10 +- .../extensions/common/extensionDevOptions.ts | 12 +- .../extensions/common/extensionHostManager.ts | 10 +- .../services/extensions/common/extensions.ts | 2 +- .../extensions/common/extensionsRegistry.ts | 4 +- .../extensions/common/extensionsUtil.ts | 4 +- .../extensions/common/remoteExtensionHost.ts | 4 +- .../services/extensions/common/rpcProtocol.ts | 22 +- .../electron-sandbox/extensionHostProfiler.ts | 26 +- .../localProcessExtensionHost.ts | 4 +- .../test/common/rpcProtocol.test.ts | 22 +- .../history/browser/historyService.ts | 4 +- .../test/browser/historyService.test.ts | 2 +- .../electron-sandbox/integrityService.ts | 2 +- .../keybinding/browser/keybindingService.ts | 2 +- .../browser/keyboardLayoutService.ts | 22 +- .../keybinding/common/keybindingEditing.ts | 2 +- .../keybinding/common/keybindingIO.ts | 6 +- .../services/keybinding/common/keymapInfo.ts | 34 +- .../common/macLinuxKeyboardMapper.ts | 32 +- .../common/windowsKeyboardMapper.ts | 8 +- .../browser/browserKeyboardMapper.test.ts | 10 +- .../test/browser/keybindingEditing.test.ts | 2 +- .../test/browser/keybindingIO.test.ts | 38 +- .../keyboardMapperTestUtils.ts | 10 +- .../macLinuxFallbackKeyboardMapper.test.ts | 4 +- .../macLinuxKeyboardMapper.test.ts | 6 +- .../services/label/test/browser/label.test.ts | 2 +- .../language/common/languageService.ts | 6 +- .../outline/browser/outlineService.ts | 4 +- .../browser/keybindingsEditorModel.test.ts | 2 +- .../progress/browser/progressService.ts | 6 +- .../test/browser/progressIndicator.test.ts | 14 +- .../common/abstractRemoteAgentService.ts | 2 +- .../remote/common/remoteExplorerService.ts | 6 +- .../services/search/common/searchService.ts | 2 +- .../search/test/common/ignoreFile.test.ts | 12 +- .../search/test/common/replace.test.ts | 8 +- .../services/search/worker/localFileSearch.ts | 2 +- .../browser/abstractTextMateService.ts | 20 +- .../textMate/browser/nativeTextMateService.ts | 2 +- .../textMate/common/TMGrammarFactory.ts | 6 +- .../services/textMate/common/TMHelper.ts | 16 +- .../textMate/common/TMTokenization.ts | 8 +- .../textfile/common/textFileEditorModel.ts | 2 +- .../browser/browserTextFileService.io.test.ts | 2 +- .../test/browser/textEditorService.test.ts | 2 +- .../test/browser/textFileEditorModel.test.ts | 6 +- .../textFileEditorModelManager.test.ts | 10 +- .../test/browser/textFileService.test.ts | 6 +- .../test/common/textFileService.io.test.ts | 4 +- .../browser/textModelResolverService.test.ts | 18 +- .../themes/browser/productIconThemeData.ts | 6 +- .../themes/common/colorExtensionPoint.ts | 4 +- .../services/themes/common/colorThemeData.ts | 90 ++--- .../themes/common/colorThemeSchema.ts | 4 +- .../themes/common/fileIconThemeSchema.ts | 2 +- .../themes/common/iconExtensionPoint.ts | 2 +- .../services/themes/common/plistParser.ts | 28 +- .../themes/common/productIconThemeSchema.ts | 2 +- .../themes/common/textMateScopeMatcher.ts | 4 +- .../themes/common/themeCompatibility.ts | 12 +- .../themes/common/themeConfiguration.ts | 8 +- .../themes/common/themeExtensionPoints.ts | 6 +- .../tokenClassificationExtensionPoint.ts | 4 +- .../tokenStyleResolving.test.ts | 4 +- .../services/timer/browser/timerService.ts | 4 +- .../common/untitledTextEditorModel.ts | 2 +- .../test/browser/untitledTextEditor.test.ts | 2 +- .../browser/userDataSyncWorkbenchService.ts | 2 +- .../views/browser/viewDescriptorService.ts | 4 +- .../views/common/viewContainerModel.ts | 4 +- .../browser/viewDescriptorService.test.ts | 4 +- .../common/storedFileWorkingCopy.ts | 2 +- .../test/browser/resourceWorkingCopy.test.ts | 2 +- .../browser/storedFileWorkingCopy.test.ts | 2 +- .../storedFileWorkingCopyManager.test.ts | 4 +- .../browser/untitledFileWorkingCopy.test.ts | 2 +- .../browser/workingCopyBackupTracker.test.ts | 2 +- .../browser/workingCopyEditorService.test.ts | 2 +- .../browser/workingCopyFileService.test.ts | 20 +- .../workingCopyBackupService.test.ts | 18 +- .../workingCopyHistoryService.test.ts | 12 +- .../workbench/test/browser/codeeditor.test.ts | 10 +- src/vs/workbench/test/browser/part.test.ts | 12 +- .../parts/editor/breadcrumbModel.test.ts | 18 +- .../parts/editor/diffEditorInput.test.ts | 4 +- .../parts/editor/editorDiffModel.test.ts | 12 +- .../parts/editor/editorGroupModel.test.ts | 24 +- .../browser/parts/editor/editorInput.test.ts | 4 +- .../browser/parts/editor/editorModel.test.ts | 2 +- .../editor/sideBySideEditorInput.test.ts | 4 +- src/vs/workbench/test/browser/viewlet.test.ts | 6 +- .../test/browser/workbenchTestServices.ts | 8 +- src/vs/workbench/test/common/memento.test.ts | 10 +- .../test/common/notifications.test.ts | 40 +- test/automation/src/problems.ts | 4 +- test/automation/src/terminal.ts | 4 +- test/integration/browser/src/index.ts | 2 +- test/unit/browser/index.js | 6 +- test/unit/coverage.js | 4 +- test/unit/electron/renderer.js | 4 +- test/unit/node/index.js | 4 +- test/unit/reporter.js | 2 +- 862 files changed, 6490 insertions(+), 6490 deletions(-) diff --git a/build/azure-pipelines/common/computeNodeModulesCacheKey.ts b/build/azure-pipelines/common/computeNodeModulesCacheKey.ts index 2eed5fe7adbce..2886b28b43881 100644 --- a/build/azure-pipelines/common/computeNodeModulesCacheKey.ts +++ b/build/azure-pipelines/common/computeNodeModulesCacheKey.ts @@ -19,7 +19,7 @@ shasum.update(fs.readFileSync(path.join(ROOT, '.yarnrc'))); shasum.update(fs.readFileSync(path.join(ROOT, 'remote/.yarnrc'))); // Add `package.json` and `yarn.lock` files -for (let dir of dirs) { +for (const dir of dirs) { const packageJsonPath = path.join(ROOT, dir, 'package.json'); const packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString()); const relevantPackageJsonSections = { diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index 7d145eaec710f..26542c2774bf0 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -45,7 +45,7 @@ async function main() { force: true }); - let productJson = await fs.readJson(productJsonPath); + const productJson = await fs.readJson(productJsonPath); Object.assign(productJson, { darwinUniversalAssetId: 'darwin-universal' }); diff --git a/build/gulpfile.editor.js b/build/gulpfile.editor.js index 41dbfe647aefc..3d8a85fd7f932 100644 --- a/build/gulpfile.editor.js +++ b/build/gulpfile.editor.js @@ -17,14 +17,14 @@ const compilation = require('./lib/compilation'); const monacoapi = require('./lib/monaco-api'); const fs = require('fs'); -let root = path.dirname(__dirname); -let sha1 = util.getVersion(root); -let semver = require('./monaco/package.json').version; -let headerVersion = semver + '(' + sha1 + ')'; +const root = path.dirname(__dirname); +const sha1 = util.getVersion(root); +const semver = require('./monaco/package.json').version; +const headerVersion = semver + '(' + sha1 + ')'; // Build -let editorEntryPoints = [ +const editorEntryPoints = [ { name: 'vs/editor/editor.main', include: [], @@ -40,11 +40,11 @@ let editorEntryPoints = [ } ]; -let editorResources = [ +const editorResources = [ 'out-editor-build/vs/base/browser/ui/codicons/**/*.ttf' ]; -let BUNDLED_FILE_HEADER = [ +const BUNDLED_FILE_HEADER = [ '/*!-----------------------------------------------------------', ' * Copyright (c) Microsoft Corporation. All rights reserved.', ' * Version: ' + headerVersion, @@ -224,7 +224,7 @@ const appendJSToESMImportsTask = task.define('append-js-to-esm-imports', () => { result.push(line); continue; } - let modifiedLine = ( + const modifiedLine = ( line .replace(/^import(.*)\'([^']+)\'/, `import$1'$2.js'`) .replace(/^export \* from \'([^']+)\'/, `export * from '$1.js'`) @@ -239,10 +239,10 @@ const appendJSToESMImportsTask = task.define('append-js-to-esm-imports', () => { * @param {string} contents */ function toExternalDTS(contents) { - let lines = contents.split(/\r\n|\r|\n/); + const lines = contents.split(/\r\n|\r|\n/); let killNextCloseCurlyBrace = false; for (let i = 0; i < lines.length; i++) { - let line = lines[i]; + const line = lines[i]; if (killNextCloseCurlyBrace) { if ('}' === line) { @@ -316,7 +316,7 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => { // package.json gulp.src('build/monaco/package.json') .pipe(es.through(function (data) { - let json = JSON.parse(data.contents.toString()); + const json = JSON.parse(data.contents.toString()); json.private = false; data.contents = Buffer.from(JSON.stringify(json, null, ' ')); this.emit('data', data); @@ -360,10 +360,10 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => { return; } - let relativePathToMap = path.relative(path.join(data.relative), path.join('min-maps', data.relative + '.map')); + const relativePathToMap = path.relative(path.join(data.relative), path.join('min-maps', data.relative + '.map')); let strContents = data.contents.toString(); - let newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/'); + const newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/'); strContents = strContents.replace(/\/\/# sourceMappingURL=[^ ]+$/, newStr); data.contents = Buffer.from(strContents); @@ -483,13 +483,13 @@ function createTscCompileTask(watch) { cwd: path.join(__dirname, '..'), // stdio: [null, 'pipe', 'inherit'] }); - let errors = []; - let reporter = createReporter('monaco'); + const errors = []; + const reporter = createReporter('monaco'); /** @type {NodeJS.ReadWriteStream | undefined} */ let report; // eslint-disable-next-line no-control-regex - let magic = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; // https://stackoverflow.com/questions/25245716/remove-all-ansi-colors-styles-from-strings + const magic = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; // https://stackoverflow.com/questions/25245716/remove-all-ansi-colors-styles-from-strings child.stdout.on('data', data => { let str = String(data); @@ -502,12 +502,12 @@ function createTscCompileTask(watch) { report.end(); } else if (str) { - let match = /(.*\(\d+,\d+\): )(.*: )(.*)/.exec(str); + const match = /(.*\(\d+,\d+\): )(.*: )(.*)/.exec(str); if (match) { // trying to massage the message so that it matches the gulp-tsb error messages // e.g. src/vs/base/common/strings.ts(663,5): error TS2322: Type '1234' is not assignable to type 'string'. - let fullpath = path.join(root, match[1]); - let message = match[3]; + const fullpath = path.join(root, match[1]); + const message = match[3]; reporter(fullpath + message); } else { reporter(str); diff --git a/build/gulpfile.extensions.js b/build/gulpfile.extensions.js index ba2606861fd36..c03237951bb97 100644 --- a/build/gulpfile.extensions.js +++ b/build/gulpfile.extensions.js @@ -91,7 +91,7 @@ const tasks = compilations.map(function (tsconfigFile) { const baseUrl = getBaseUrl(out); let headerId, headerOut; - let index = relativeDirname.indexOf('/'); + const index = relativeDirname.indexOf('/'); if (index < 0) { headerId = 'vscode.' + relativeDirname; headerOut = 'out'; diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index a9691fcb0d879..c76fab7abc6c5 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -16,7 +16,7 @@ function checkPackageJSON(actualPath) { const actual = require(path.join(__dirname, '..', actualPath)); const rootPackageJSON = require('../package.json'); const checkIncluded = (set1, set2) => { - for (let depName in set1) { + for (const depName in set1) { const depVersion = set1[depName]; const rootDepVersion = set2[depName]; if (!rootDepVersion) { diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js index 54135e9f50dae..2abc3f30c434d 100644 --- a/build/gulpfile.reh.js +++ b/build/gulpfile.reh.js @@ -281,7 +281,7 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa ].map(resource => gulp.src(resource, { base: '.' }).pipe(rename(resource))); } - let all = es.merge( + const all = es.merge( packageJsonStream, productJsonStream, license, diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index 268650959cdc8..3315caf4bff91 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -122,9 +122,9 @@ gulp.task(core); * @return {Object} A map of paths to checksums. */ function computeChecksums(out, filenames) { - let result = {}; + const result = {}; filenames.forEach(function (filename) { - let fullPath = path.join(process.cwd(), out, filename); + const fullPath = path.join(process.cwd(), out, filename); result[filename] = computeChecksum(fullPath); }); return result; @@ -137,9 +137,9 @@ function computeChecksums(out, filenames) { * @return {string} The checksum for `filename`. */ function computeChecksum(filename) { - let contents = fs.readFileSync(filename); + const contents = fs.readFileSync(filename); - let hash = crypto + const hash = crypto .createHash('md5') .update(contents) .digest('base64') @@ -453,20 +453,20 @@ gulp.task(task.define( gulp.task('vscode-translations-pull', function () { return es.merge([...i18n.defaultLanguages, ...i18n.extraLanguages].map(language => { - let includeDefault = !!innoSetupConfig[language.id].defaultInfo; + const includeDefault = !!innoSetupConfig[language.id].defaultInfo; return i18n.pullSetupXlfFiles(apiHostname, apiName, apiToken, language, includeDefault).pipe(vfs.dest(`../vscode-translations-import/${language.id}/setup`)); })); }); gulp.task('vscode-translations-import', function () { - let options = minimist(process.argv.slice(2), { + const options = minimist(process.argv.slice(2), { string: 'location', default: { location: '../vscode-translations-import' } }); return es.merge([...i18n.defaultLanguages, ...i18n.extraLanguages].map(language => { - let id = language.id; + const id = language.id; return gulp.src(`${options.location}/${id}/vscode-setup/messages.xlf`) .pipe(i18n.prepareIslFiles(language, innoSetupConfig[language.id])) .pipe(vfs.dest(`./build/win32/i18n`)); diff --git a/build/gulpfile.vscode.web.js b/build/gulpfile.vscode.web.js index f0ad617f405b7..4c1259c241c3c 100644 --- a/build/gulpfile.vscode.web.js +++ b/build/gulpfile.vscode.web.js @@ -208,7 +208,7 @@ function packageTask(sourceFolderName, destinationFolderName) { gulp.src('resources/server/code-512.png', { base: 'resources/server' }) ); - let all = es.merge( + const all = es.merge( packageJsonStream, license, sources, @@ -218,7 +218,7 @@ function packageTask(sourceFolderName, destinationFolderName) { pwaicons ); - let result = all + const result = all .pipe(util.skipDirectories()) .pipe(util.fixWin32DirectoryPermissions()); diff --git a/build/hygiene.js b/build/hygiene.js index 1668e508ec9ec..e18466c8f77c5 100644 --- a/build/hygiene.js +++ b/build/hygiene.js @@ -116,8 +116,8 @@ function hygiene(some, linting = true) { }) .then( (result) => { - let original = result.src.replace(/\r\n/gm, '\n'); - let formatted = result.dest.replace(/\r\n/gm, '\n'); + const original = result.src.replace(/\r\n/gm, '\n'); + const formatted = result.dest.replace(/\r\n/gm, '\n'); if (original !== formatted) { console.error( diff --git a/build/lib/asar.ts b/build/lib/asar.ts index 18ab7b01946d1..16c95f8ca5d06 100644 --- a/build/lib/asar.ts +++ b/build/lib/asar.ts @@ -98,7 +98,7 @@ export function createAsar(folderPath: string, unpackGlobs: string[], destFilena } }, function () { - let finish = () => { + const finish = () => { { const headerPickle = pickle.createEmpty(); headerPickle.writeString(JSON.stringify(filesystem.header)); diff --git a/build/lib/builtInExtensions.ts b/build/lib/builtInExtensions.ts index 1abc85b3b09c5..971847c875662 100644 --- a/build/lib/builtInExtensions.ts +++ b/build/lib/builtInExtensions.ts @@ -143,7 +143,7 @@ export function getBuiltInExtensions(): Promise { const streams: Stream[] = []; for (const extension of [...builtInExtensions, ...webBuiltInExtensions]) { - let controlState = control[extension.name] || 'marketplace'; + const controlState = control[extension.name] || 'marketplace'; control[extension.name] = controlState; streams.push(syncExtension(extension, controlState)); diff --git a/build/lib/compilation.ts b/build/lib/compilation.ts index d40b6139cc0ff..4ee44f28596ea 100644 --- a/build/lib/compilation.ts +++ b/build/lib/compilation.ts @@ -26,7 +26,7 @@ const reporter = createReporter(); function getTypeScriptCompilerOptions(src: string): ts.CompilerOptions { const rootDir = path.join(__dirname, `../../${src}`); - let options: ts.CompilerOptions = {}; + const options: ts.CompilerOptions = {}; options.verbose = false; options.sourceMap = true; if (process.env['VSCODE_NO_SOURCEMAP']) { // To be used by developers in a hurry @@ -96,7 +96,7 @@ export function compileTask(src: string, out: string, build: boolean): () => Nod const compile = createCompile(src, build, true); const srcPipe = gulp.src(`${src}/**`, { base: `${src}` }); - let generator = new MonacoGenerator(false); + const generator = new MonacoGenerator(false); if (src === 'src') { generator.execute(); } @@ -116,7 +116,7 @@ export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteSt const src = gulp.src('src/**', { base: 'src' }); const watchSrc = watch('src/**', { base: 'src', readDelay: 200 }); - let generator = new MonacoGenerator(true); + const generator = new MonacoGenerator(true); generator.execute(); return watchSrc @@ -140,7 +140,7 @@ class MonacoGenerator { this._isWatch = isWatch; this.stream = es.through(); this._watchedFiles = {}; - let onWillReadFile = (moduleId: string, filePath: string) => { + const onWillReadFile = (moduleId: string, filePath: string) => { if (!this._isWatch) { return; } @@ -182,7 +182,7 @@ class MonacoGenerator { } private _run(): monacodts.IMonacoDeclarationResult | null { - let r = monacodts.run3(this._declarationResolver); + const r = monacodts.run3(this._declarationResolver); if (!r && !this._isWatch) { // The build must always be able to generate the monaco.d.ts throw new Error(`monaco.d.ts generation error - Cannot continue`); diff --git a/build/lib/eslint/code-no-unexternalized-strings.ts b/build/lib/eslint/code-no-unexternalized-strings.ts index 056a99868ea10..d0c30527f7cdf 100644 --- a/build/lib/eslint/code-no-unexternalized-strings.ts +++ b/build/lib/eslint/code-no-unexternalized-strings.ts @@ -51,7 +51,7 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule { key = keyNode.value; } else if (keyNode.type === AST_NODE_TYPES.ObjectExpression) { - for (let property of keyNode.properties) { + for (const property of keyNode.properties) { if (property.type === AST_NODE_TYPES.Property && !property.computed) { if (property.key.type === AST_NODE_TYPES.Identifier && property.key.name === 'key') { if (isStringLiteral(property.value)) { @@ -97,7 +97,7 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule { // (2) // report all invalid NLS keys if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { - for (let value of values) { + for (const value of values) { context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); } } diff --git a/build/lib/eslint/vscode-dts-cancellation.ts b/build/lib/eslint/vscode-dts-cancellation.ts index 66f184214b93d..6e253a898ca28 100644 --- a/build/lib/eslint/vscode-dts-cancellation.ts +++ b/build/lib/eslint/vscode-dts-cancellation.ts @@ -20,7 +20,7 @@ export = new class ApiProviderNaming implements eslint.Rule.RuleModule { ['TSInterfaceDeclaration[id.name=/.+Provider/] TSMethodSignature[key.name=/^(provide|resolve).+/]']: (node: any) => { let found = false; - for (let param of (node).params) { + for (const param of (node).params) { if (param.type === AST_NODE_TYPES.Identifier) { found = found || param.name === 'token'; } diff --git a/build/lib/extensions.ts b/build/lib/extensions.ts index 312b830b9033d..4aaf668a6c409 100644 --- a/build/lib/extensions.ts +++ b/build/lib/extensions.ts @@ -430,7 +430,7 @@ export function scanBuiltinExtensions(extensionsRoot: string, exclude: string[] if (!fs.existsSync(packageJSONPath)) { continue; } - let packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString('utf8')); + const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString('utf8')); if (!isWebExtension(packageJSON)) { continue; } @@ -461,7 +461,7 @@ export function translatePackageJSON(packageJSON: string, packageNLSPath: string const CharCode_PC = '%'.charCodeAt(0); const packageNls: NLSFormat = JSON.parse(fs.readFileSync(packageNLSPath).toString()); const translate = (obj: any) => { - for (let key in obj) { + for (const key in obj) { const val = obj[key]; if (Array.isArray(val)) { val.forEach(translate); diff --git a/build/lib/git.ts b/build/lib/git.ts index dc9c667c21b22..35671291fc8ed 100644 --- a/build/lib/git.ts +++ b/build/lib/git.ts @@ -51,7 +51,7 @@ export function getVersion(repo: string): string | undefined { const refsRegex = /^([0-9a-f]{40})\s+(.+)$/gm; let refsMatch: RegExpExecArray | null; - let refs: { [ref: string]: string } = {}; + const refs: { [ref: string]: string } = {}; while (refsMatch = refsRegex.exec(refsRaw)) { refs[refsMatch[2]] = refsMatch[1]; diff --git a/build/lib/i18n.ts b/build/lib/i18n.ts index 3ea4f7efb4e4e..c16d31e2d8337 100644 --- a/build/lib/i18n.ts +++ b/build/lib/i18n.ts @@ -87,7 +87,7 @@ interface LocalizeInfo { module LocalizeInfo { export function is(value: any): value is LocalizeInfo { - let candidate = value as LocalizeInfo; + const candidate = value as LocalizeInfo; return Is.defined(candidate) && Is.string(candidate.key) && (Is.undef(candidate.comment) || (Is.array(candidate.comment) && candidate.comment.every(element => Is.string(element)))); } } @@ -104,8 +104,8 @@ module BundledFormat { return false; } - let candidate = value as BundledFormat; - let length = Object.keys(value).length; + const candidate = value as BundledFormat; + const length = Object.keys(value).length; return length === 3 && Is.defined(candidate.keys) && Is.defined(candidate.messages) && Is.defined(candidate.bundles); } @@ -126,7 +126,7 @@ module PackageJsonFormat { return false; } return Object.keys(value).every(key => { - let element = value[key]; + const element = value[key]; return Is.string(element) || (Is.object(element) && Is.defined(element.message) && Is.defined(element.comment)); }); } @@ -218,9 +218,9 @@ export class XLF { } this.numberOfMessages += keys.length; this.files[original] = []; - let existingKeys = new Set(); + const existingKeys = new Set(); for (let i = 0; i < keys.length; i++) { - let key = keys[i]; + const key = keys[i]; let realKey: string | undefined; let comment: string | undefined; if (Is.string(key)) { @@ -236,7 +236,7 @@ export class XLF { continue; } existingKeys.add(realKey); - let message: string = encodeEntities(messages[i]); + const message: string = encodeEntities(messages[i]); this.files[original].push({ id: realKey, message: message, comment: comment }); } } @@ -269,15 +269,15 @@ export class XLF { } private appendNewLine(content: string, indent?: number): void { - let line = new Line(indent); + const line = new Line(indent); line.append(content); this.buffer.push(line.toString()); } static parsePseudo = function (xlfString: string): Promise { return new Promise((resolve) => { - let parser = new xml2js.Parser(); - let files: { messages: Map; originalFilePath: string; language: string }[] = []; + const parser = new xml2js.Parser(); + const files: { messages: Map; originalFilePath: string; language: string }[] = []; parser.parseString(xlfString, function (_err: any, result: any) { const fileNodes: any[] = result['xliff']['file']; fileNodes.forEach(file => { @@ -302,9 +302,9 @@ export class XLF { static parse = function (xlfString: string): Promise { return new Promise((resolve, reject) => { - let parser = new xml2js.Parser(); + const parser = new xml2js.Parser(); - let files: { messages: Map; originalFilePath: string; language: string }[] = []; + const files: { messages: Map; originalFilePath: string; language: string }[] = []; parser.parseString(xlfString, function (err: any, result: any) { if (err) { @@ -321,7 +321,7 @@ export class XLF { if (!originalFilePath) { reject(new Error(`XLF parsing error: XLIFF file node does not contain original attribute to determine the original location of the resource file.`)); } - let language = file.$['target-language']; + const language = file.$['target-language']; if (!language) { reject(new Error(`XLF parsing error: XLIFF file node does not contain target-language attribute to determine translated language.`)); } @@ -413,7 +413,7 @@ function stripComments(content: string): string { // Third group matches a multi line comment // Forth group matches a single line comment const regexp = /("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g; - let result = content.replace(regexp, (match, _m1: string, _m2: string, m3: string, m4: string) => { + const result = content.replace(regexp, (match, _m1: string, _m2: string, m3: string, m4: string) => { // Only one of m1, m2, m3, m4 matches if (m3) { // A block comment. Replace with nothing @@ -472,22 +472,22 @@ function escapeCharacters(value: string): string { } function processCoreBundleFormat(fileHeader: string, languages: Language[], json: BundledFormat, emitter: ThroughStream) { - let keysSection = json.keys; - let messageSection = json.messages; - let bundleSection = json.bundles; + const keysSection = json.keys; + const messageSection = json.messages; + const bundleSection = json.bundles; - let statistics: Map = Object.create(null); + const statistics: Map = Object.create(null); - let defaultMessages: Map> = Object.create(null); - let modules = Object.keys(keysSection); + const defaultMessages: Map> = Object.create(null); + const modules = Object.keys(keysSection); modules.forEach((module) => { - let keys = keysSection[module]; - let messages = messageSection[module]; + const keys = keysSection[module]; + const messages = messageSection[module]; if (!messages || keys.length !== messages.length) { emitter.emit('error', `Message for module ${module} corrupted. Mismatch in number of keys and messages.`); return; } - let messageMap: Map = Object.create(null); + const messageMap: Map = Object.create(null); defaultMessages[module] = messageMap; keys.map((key, i) => { if (typeof key === 'string') { @@ -498,28 +498,28 @@ function processCoreBundleFormat(fileHeader: string, languages: Language[], json }); }); - let languageDirectory = path.join(__dirname, '..', '..', '..', 'vscode-loc', 'i18n'); + const languageDirectory = path.join(__dirname, '..', '..', '..', 'vscode-loc', 'i18n'); if (!fs.existsSync(languageDirectory)) { log(`No VS Code localization repository found. Looking at ${languageDirectory}`); log(`To bundle translations please check out the vscode-loc repository as a sibling of the vscode repository.`); } - let sortedLanguages = sortLanguages(languages); + const sortedLanguages = sortLanguages(languages); sortedLanguages.forEach((language) => { if (process.env['VSCODE_BUILD_VERBOSE']) { log(`Generating nls bundles for: ${language.id}`); } statistics[language.id] = 0; - let localizedModules: Map = Object.create(null); - let languageFolderName = language.translationId || language.id; - let i18nFile = path.join(languageDirectory, `vscode-language-pack-${languageFolderName}`, 'translations', 'main.i18n.json'); + const localizedModules: Map = Object.create(null); + const languageFolderName = language.translationId || language.id; + const i18nFile = path.join(languageDirectory, `vscode-language-pack-${languageFolderName}`, 'translations', 'main.i18n.json'); let allMessages: I18nFormat | undefined; if (fs.existsSync(i18nFile)) { - let content = stripComments(fs.readFileSync(i18nFile, 'utf8')); + const content = stripComments(fs.readFileSync(i18nFile, 'utf8')); allMessages = JSON.parse(content); } modules.forEach((module) => { - let order = keysSection[module]; + const order = keysSection[module]; let moduleMessage: { [messageKey: string]: string } | undefined; if (allMessages) { moduleMessage = allMessages.contents[module]; @@ -531,7 +531,7 @@ function processCoreBundleFormat(fileHeader: string, languages: Language[], json moduleMessage = defaultMessages[module]; statistics[language.id] = statistics[language.id] + Object.keys(moduleMessage).length; } - let localizedMessages: string[] = []; + const localizedMessages: string[] = []; order.forEach((keyInfo) => { let key: string | null = null; if (typeof keyInfo === 'string') { @@ -552,14 +552,14 @@ function processCoreBundleFormat(fileHeader: string, languages: Language[], json localizedModules[module] = localizedMessages; }); Object.keys(bundleSection).forEach((bundle) => { - let modules = bundleSection[bundle]; - let contents: string[] = [ + const modules = bundleSection[bundle]; + const contents: string[] = [ fileHeader, `define("${bundle}.nls.${language.id}", {` ]; modules.forEach((module, index) => { contents.push(`\t"${module}": [`); - let messages = localizedModules[module]; + const messages = localizedModules[module]; if (!messages) { emitter.emit('error', `Didn't find messages for module ${module}.`); return; @@ -574,11 +574,11 @@ function processCoreBundleFormat(fileHeader: string, languages: Language[], json }); }); Object.keys(statistics).forEach(key => { - let value = statistics[key]; + const value = statistics[key]; log(`${key} has ${value} untranslated strings.`); }); sortedLanguages.forEach(language => { - let stats = statistics[language.id]; + const stats = statistics[language.id]; if (Is.undef(stats)) { log(`\tNo translations found for language ${language.id}. Using default language instead.`); } @@ -587,7 +587,7 @@ function processCoreBundleFormat(fileHeader: string, languages: Language[], json export function processNlsFiles(opts: { fileHeader: string; languages: Language[] }): ThroughStream { return through(function (this: ThroughStream, file: File) { - let fileName = path.basename(file.path); + const fileName = path.basename(file.path); if (fileName === 'nls.metadata.json') { let json = null; if (file.isBuffer()) { @@ -643,7 +643,7 @@ export function createXlfFilesForCoreBundle(): ThroughStream { if (file.isBuffer()) { const xlfs: Map = Object.create(null); const json: BundledFormat = JSON.parse((file.contents as Buffer).toString('utf8')); - for (let coreModule in json.keys) { + for (const coreModule in json.keys) { const projectResource = getResource(coreModule); const resource = projectResource.name; const project = projectResource.project; @@ -662,7 +662,7 @@ export function createXlfFilesForCoreBundle(): ThroughStream { xlf.addFile(`src/${coreModule}`, keys, messages); } } - for (let resource in xlfs) { + for (const resource in xlfs) { const xlf = xlfs[resource]; const filePath = `${xlf.project}/${resource.replace(/\//g, '_')}.xlf`; const xlfFile = new File({ @@ -692,7 +692,7 @@ export function createXlfFilesForExtensions(): ThroughStream { if (!stat.isDirectory()) { return; } - let extensionName = path.basename(extensionFolder.path); + const extensionName = path.basename(extensionFolder.path); if (extensionName === 'node_modules') { return; } @@ -725,7 +725,7 @@ export function createXlfFilesForExtensions(): ThroughStream { } else if (basename === 'nls.metadata.json') { const json: BundledExtensionFormat = JSON.parse(buffer.toString('utf8')); const relPath = path.relative(`.build/extensions/${extensionName}`, path.dirname(file.path)); - for (let file in json) { + for (const file in json) { const fileContent = json[file]; getXlf().addFile(`extensions/${extensionName}/${relPath}/${file}`, fileContent.keys, fileContent.messages); } @@ -736,7 +736,7 @@ export function createXlfFilesForExtensions(): ThroughStream { } }, function () { if (_xlf) { - let xlfFile = new File({ + const xlfFile = new File({ path: path.join(extensionsProject, extensionName + '.xlf'), contents: Buffer.from(_xlf.toString(), 'utf8') }); @@ -769,17 +769,17 @@ export function createXlfFilesForIsl(): ThroughStream { throw new Error(`Unknown input file ${file.path}`); } - let xlf = new XLF(projectName), + const xlf = new XLF(projectName), keys: string[] = [], messages: string[] = []; - let model = new TextModel(file.contents.toString()); + const model = new TextModel(file.contents.toString()); let inMessageSection = false; model.lines.forEach(line => { if (line.length === 0) { return; } - let firstChar = line.charAt(0); + const firstChar = line.charAt(0); switch (firstChar) { case ';': // Comment line; @@ -791,12 +791,12 @@ export function createXlfFilesForIsl(): ThroughStream { if (!inMessageSection) { return; } - let sections: string[] = line.split('='); + const sections: string[] = line.split('='); if (sections.length !== 2) { throw new Error(`Badly formatted message found: ${line}`); } else { - let key = sections[0]; - let value = sections[1]; + const key = sections[0]; + const value = sections[1]; if (key.length > 0 && value.length > 0) { keys.push(key); messages.push(value); @@ -815,8 +815,8 @@ export function createXlfFilesForIsl(): ThroughStream { } export function pushXlfFiles(apiHostname: string, username: string, password: string): ThroughStream { - let tryGetPromises: Array> = []; - let updateCreatePromises: Array> = []; + const tryGetPromises: Array> = []; + const updateCreatePromises: Array> = []; return through(function (this: ThroughStream, file: File) { const project = path.dirname(file.relative); @@ -857,11 +857,11 @@ function getAllResources(project: string, apiHostname: string, username: string, }; const request = https.request(options, (res) => { - let buffer: Buffer[] = []; + const buffer: Buffer[] = []; res.on('data', (chunk: Buffer) => buffer.push(chunk)); res.on('end', () => { if (res.statusCode === 200) { - let json = JSON.parse(Buffer.concat(buffer).toString()); + const json = JSON.parse(Buffer.concat(buffer).toString()); if (Array.isArray(json)) { resolve(json.map(o => o.slug)); return; @@ -880,7 +880,7 @@ function getAllResources(project: string, apiHostname: string, username: string, } export function findObsoleteResources(apiHostname: string, username: string, password: string): ThroughStream { - let resourcesByProject: Map = Object.create(null); + const resourcesByProject: Map = Object.create(null); resourcesByProject[extensionsProject] = ([] as any[]).concat(externalExtensionsWithTranslations); // clone return through(function (this: ThroughStream, file: File) { @@ -897,10 +897,10 @@ export function findObsoleteResources(apiHostname: string, username: string, pas }, function () { const json = JSON.parse(fs.readFileSync('./build/lib/i18n.resources.json', 'utf8')); - let i18Resources = [...json.editor, ...json.workbench].map((r: Resource) => r.project + '/' + r.name.replace(/\//g, '_')); - let extractedResources: string[] = []; - for (let project of [workbenchProject, editorProject]) { - for (let resource of resourcesByProject[project]) { + const i18Resources = [...json.editor, ...json.workbench].map((r: Resource) => r.project + '/' + r.name.replace(/\//g, '_')); + const extractedResources: string[] = []; + for (const project of [workbenchProject, editorProject]) { + for (const resource of resourcesByProject[project]) { if (resource !== 'setup_messages') { extractedResources.push(project + '/' + resource); } @@ -911,12 +911,12 @@ export function findObsoleteResources(apiHostname: string, username: string, pas console.log(`[i18n] Missing resources in file 'build/lib/i18n.resources.json': JSON.stringify(${extractedResources.filter(p => i18Resources.indexOf(p) === -1)})`); } - let promises: Array> = []; - for (let project in resourcesByProject) { + const promises: Array> = []; + for (const project in resourcesByProject) { promises.push( getAllResources(project, apiHostname, username, password).then(resources => { - let expectedResources = resourcesByProject[project]; - let unusedResources = resources.filter(resource => resource && expectedResources.indexOf(resource) === -1); + const expectedResources = resourcesByProject[project]; + const unusedResources = resources.filter(resource => resource && expectedResources.indexOf(resource) === -1); if (unusedResources.length) { console.log(`[transifex] Obsolete resources in project '${project}': ${unusedResources.join(', ')}`); } @@ -974,7 +974,7 @@ function createResource(project: string, slug: string, xlfFile: File, apiHostnam method: 'POST' }; - let request = https.request(options, (res) => { + const request = https.request(options, (res) => { if (res.statusCode === 201) { log(`Resource ${project}/${slug} successfully created on Transifex.`); } else { @@ -1008,7 +1008,7 @@ function updateResource(project: string, slug: string, xlfFile: File, apiHostnam method: 'PUT' }; - let request = https.request(options, (res) => { + const request = https.request(options, (res) => { if (res.statusCode === 200) { res.setEncoding('utf8'); @@ -1035,7 +1035,7 @@ function updateResource(project: string, slug: string, xlfFile: File, apiHostnam } export function pullSetupXlfFiles(apiHostname: string, username: string, password: string, language: Language, includeDefault: boolean): NodeJS.ReadableStream { - let setupResources = [{ name: 'setup_messages', project: workbenchProject }]; + const setupResources = [{ name: 'setup_messages', project: workbenchProject }]; if (includeDefault) { setupResources.push({ name: 'setup_default', project: setupProject }); } @@ -1044,7 +1044,7 @@ export function pullSetupXlfFiles(apiHostname: string, username: string, passwor function pullXlfFiles(apiHostname: string, username: string, password: string, language: Language, resources: Resource[]): NodeJS.ReadableStream { const credentials = `${username}:${password}`; - let expectedTranslationsCount = resources.length; + const expectedTranslationsCount = resources.length; let translationsRetrieved = 0, called = false; return readable(function (_count: any, callback: any) { @@ -1075,7 +1075,7 @@ function retrieveResource(language: Language, resource: Resource, apiHostname: s return limiter.queue(() => new Promise((resolve, reject) => { const slug = resource.name.replace(/\//g, '_'); const project = resource.project; - let transifexLanguageId = language.id === 'ps' ? 'en' : language.translationId || language.id; + const transifexLanguageId = language.id === 'ps' ? 'en' : language.translationId || language.id; const options = { hostname: apiHostname, path: `/api/2/project/${project}/resource/${slug}/translation/${transifexLanguageId}?file&mode=onlyreviewed`, @@ -1085,8 +1085,8 @@ function retrieveResource(language: Language, resource: Resource, apiHostname: s }; console.log('[transifex] Fetching ' + options.path); - let request = https.request(options, (res) => { - let xlfBuffer: Buffer[] = []; + const request = https.request(options, (res) => { + const xlfBuffer: Buffer[] = []; res.on('data', (chunk: Buffer) => xlfBuffer.push(chunk)); res.on('end', () => { if (res.statusCode === 200) { @@ -1107,16 +1107,16 @@ function retrieveResource(language: Language, resource: Resource, apiHostname: s } export function prepareI18nFiles(): ThroughStream { - let parsePromises: Promise[] = []; + const parsePromises: Promise[] = []; return through(function (this: ThroughStream, xlf: File) { - let stream = this; - let parsePromise = XLF.parse(xlf.contents.toString()); + const stream = this; + const parsePromise = XLF.parse(xlf.contents.toString()); parsePromises.push(parsePromise); parsePromise.then( resolvedFiles => { resolvedFiles.forEach(file => { - let translatedFile = createI18nFile(file.originalFilePath, file.messages); + const translatedFile = createI18nFile(file.originalFilePath, file.messages); stream.queue(translatedFile); }); } @@ -1129,7 +1129,7 @@ export function prepareI18nFiles(): ThroughStream { } function createI18nFile(originalFilePath: string, messages: any): File { - let result = Object.create(null); + const result = Object.create(null); result[''] = [ '--------------------------------------------------------------------------------------------', 'Copyright (c) Microsoft Corporation. All rights reserved.', @@ -1137,7 +1137,7 @@ function createI18nFile(originalFilePath: string, messages: any): File { '--------------------------------------------------------------------------------------------', 'Do not edit this file. It is machine generated.' ]; - for (let key of Object.keys(messages)) { + for (const key of Object.keys(messages)) { result[key] = messages[key]; } @@ -1166,16 +1166,16 @@ export interface TranslationPath { } export function prepareI18nPackFiles(externalExtensions: Map, resultingTranslationPaths: TranslationPath[], pseudo = false): NodeJS.ReadWriteStream { - let parsePromises: Promise[] = []; - let mainPack: I18nPack = { version: i18nPackVersion, contents: {} }; - let extensionsPacks: Map = {}; - let errors: any[] = []; + const parsePromises: Promise[] = []; + const mainPack: I18nPack = { version: i18nPackVersion, contents: {} }; + const extensionsPacks: Map = {}; + const errors: any[] = []; return through(function (this: ThroughStream, xlf: File) { - let project = path.basename(path.dirname(path.dirname(xlf.relative))); - let resource = path.basename(xlf.relative, '.xlf'); - let contents = xlf.contents.toString(); + const project = path.basename(path.dirname(path.dirname(xlf.relative))); + const resource = path.basename(xlf.relative, '.xlf'); + const contents = xlf.contents.toString(); log(`Found ${project}: ${resource}`); - let parsePromise = pseudo ? XLF.parsePseudo(contents) : XLF.parse(contents); + const parsePromise = pseudo ? XLF.parsePseudo(contents) : XLF.parse(contents); parsePromises.push(parsePromise); parsePromise.then( resolvedFiles => { @@ -1213,7 +1213,7 @@ export function prepareI18nPackFiles(externalExtensions: Map, resultingT resultingTranslationPaths.push({ id: 'vscode', resourceName: 'main.i18n.json' }); this.queue(translatedMainFile); - for (let extension in extensionsPacks) { + for (const extension in extensionsPacks) { const translatedExtFile = createI18nFile(`extensions/${extension}`, extensionsPacks[extension]); this.queue(translatedExtFile); @@ -1234,16 +1234,16 @@ export function prepareI18nPackFiles(externalExtensions: Map, resultingT } export function prepareIslFiles(language: Language, innoSetupConfig: InnoSetup): ThroughStream { - let parsePromises: Promise[] = []; + const parsePromises: Promise[] = []; return through(function (this: ThroughStream, xlf: File) { - let stream = this; - let parsePromise = XLF.parse(xlf.contents.toString()); + const stream = this; + const parsePromise = XLF.parse(xlf.contents.toString()); parsePromises.push(parsePromise); parsePromise.then( resolvedFiles => { resolvedFiles.forEach(file => { - let translatedFile = createIslFile(file.originalFilePath, file.messages, language, innoSetupConfig); + const translatedFile = createIslFile(file.originalFilePath, file.messages, language, innoSetupConfig); stream.queue(translatedFile); }); } @@ -1260,7 +1260,7 @@ export function prepareIslFiles(language: Language, innoSetupConfig: InnoSetup): } function createIslFile(originalFilePath: string, messages: Map, language: Language, innoSetup: InnoSetup): File { - let content: string[] = []; + const content: string[] = []; let originalContent: TextModel; if (path.basename(originalFilePath) === 'Default') { originalContent = new TextModel(fs.readFileSync(originalFilePath + '.isl', 'utf8')); @@ -1269,15 +1269,15 @@ function createIslFile(originalFilePath: string, messages: Map, language } originalContent.lines.forEach(line => { if (line.length > 0) { - let firstChar = line.charAt(0); + const firstChar = line.charAt(0); if (firstChar === '[' || firstChar === ';') { content.push(line); } else { - let sections: string[] = line.split('='); - let key = sections[0]; + const sections: string[] = line.split('='); + const key = sections[0]; let translated = line; if (key) { - let translatedMessage = messages[key]; + const translatedMessage = messages[key]; if (translatedMessage) { translated = `${key}=${translatedMessage}`; } @@ -1299,9 +1299,9 @@ function createIslFile(originalFilePath: string, messages: Map, language } function encodeEntities(value: string): string { - let result: string[] = []; + const result: string[] = []; for (let i = 0; i < value.length; i++) { - let ch = value[i]; + const ch = value[i]; switch (ch) { case '<': result.push('<'); diff --git a/build/lib/monaco-api.ts b/build/lib/monaco-api.ts index e6a06d21ea2b4..cadd0a03715bc 100644 --- a/build/lib/monaco-api.ts +++ b/build/lib/monaco-api.ts @@ -40,7 +40,7 @@ function isDeclaration(ts: typeof import('typescript'), a: TSTopLevelDeclare): a function visitTopLevelDeclarations(ts: typeof import('typescript'), sourceFile: ts.SourceFile, visitor: (node: TSTopLevelDeclare) => boolean): void { let stop = false; - let visit = (node: ts.Node): void => { + const visit = (node: ts.Node): void => { if (stop) { return; } @@ -67,19 +67,19 @@ function visitTopLevelDeclarations(ts: typeof import('typescript'), sourceFile: function getAllTopLevelDeclarations(ts: typeof import('typescript'), sourceFile: ts.SourceFile): TSTopLevelDeclare[] { - let all: TSTopLevelDeclare[] = []; + const all: TSTopLevelDeclare[] = []; visitTopLevelDeclarations(ts, sourceFile, (node) => { if (node.kind === ts.SyntaxKind.InterfaceDeclaration || node.kind === ts.SyntaxKind.ClassDeclaration || node.kind === ts.SyntaxKind.ModuleDeclaration) { - let interfaceDeclaration = node; - let triviaStart = interfaceDeclaration.pos; - let triviaEnd = interfaceDeclaration.name.pos; - let triviaText = getNodeText(sourceFile, { pos: triviaStart, end: triviaEnd }); + const interfaceDeclaration = node; + const triviaStart = interfaceDeclaration.pos; + const triviaEnd = interfaceDeclaration.name.pos; + const triviaText = getNodeText(sourceFile, { pos: triviaStart, end: triviaEnd }); if (triviaText.indexOf('@internal') === -1) { all.push(node); } } else { - let nodeText = getNodeText(sourceFile, node); + const nodeText = getNodeText(sourceFile, node); if (nodeText.indexOf('@internal') === -1) { all.push(node); } @@ -118,7 +118,7 @@ function getNodeText(sourceFile: ts.SourceFile, node: { pos: number; end: number function hasModifier(modifiers: ts.NodeArray | undefined, kind: ts.SyntaxKind): boolean { if (modifiers) { for (let i = 0; i < modifiers.length; i++) { - let mod = modifiers[i]; + const mod = modifiers[i]; if (mod.kind === kind) { return true; } @@ -141,7 +141,7 @@ function isDefaultExport(ts: typeof import('typescript'), declaration: ts.Interf function getMassagedTopLevelDeclarationText(ts: typeof import('typescript'), sourceFile: ts.SourceFile, declaration: TSTopLevelDeclare, importName: string, usage: string[], enums: IEnumEntry[]): string { let result = getNodeText(sourceFile, declaration); if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration || declaration.kind === ts.SyntaxKind.ClassDeclaration) { - let interfaceDeclaration = declaration; + const interfaceDeclaration = declaration; const staticTypeName = ( isDefaultExport(ts, interfaceDeclaration) @@ -152,7 +152,7 @@ function getMassagedTopLevelDeclarationText(ts: typeof import('typescript'), sou let instanceTypeName = staticTypeName; const typeParametersCnt = (interfaceDeclaration.typeParameters ? interfaceDeclaration.typeParameters.length : 0); if (typeParametersCnt > 0) { - let arr: string[] = []; + const arr: string[] = []; for (let i = 0; i < typeParametersCnt; i++) { arr.push('any'); } @@ -162,7 +162,7 @@ function getMassagedTopLevelDeclarationText(ts: typeof import('typescript'), sou const members: ts.NodeArray = interfaceDeclaration.members; members.forEach((member) => { try { - let memberText = getNodeText(sourceFile, member); + const memberText = getNodeText(sourceFile, member); if (memberText.indexOf('@internal') >= 0 || memberText.indexOf('private') >= 0) { result = result.replace(memberText, ''); } else { @@ -182,7 +182,7 @@ function getMassagedTopLevelDeclarationText(ts: typeof import('typescript'), sou result = result.replace(/export default /g, 'export '); result = result.replace(/export declare /g, 'export '); result = result.replace(/declare /g, ''); - let lines = result.split(/\r\n|\r|\n/); + const lines = result.split(/\r\n|\r|\n/); for (let i = 0; i < lines.length; i++) { if (/\s*\*/.test(lines[i])) { // very likely a comment @@ -212,10 +212,10 @@ function format(ts: typeof import('typescript'), text: string, endl: string): st } // Parse the source text - let sourceFile = ts.createSourceFile('file.ts', text, ts.ScriptTarget.Latest, /*setParentPointers*/ true); + const sourceFile = ts.createSourceFile('file.ts', text, ts.ScriptTarget.Latest, /*setParentPointers*/ true); // Get the formatting edits on the input sources - let edits = (ts).formatting.formatDocument(sourceFile, getRuleProvider(tsfmt), tsfmt); + const edits = (ts).formatting.formatDocument(sourceFile, getRuleProvider(tsfmt), tsfmt); // Apply the edits on the input code return applyEdits(text, edits); @@ -242,7 +242,7 @@ function format(ts: typeof import('typescript'), text: string, endl: string): st } function preformat(text: string, endl: string): string { - let lines = text.split(endl); + const lines = text.split(endl); let inComment = false; let inCommentDeltaIndent = 0; let indent = 0; @@ -328,9 +328,9 @@ function format(ts: typeof import('typescript'), text: string, endl: string): st // Apply edits in reverse on the existing text let result = text; for (let i = edits.length - 1; i >= 0; i--) { - let change = edits[i]; - let head = result.slice(0, change.span.start); - let tail = result.slice(change.span.start + change.span.length); + const change = edits[i]; + const head = result.slice(0, change.span.start); + const tail = result.slice(change.span.start + change.span.length); result = head + change.newText + tail; } return result; @@ -348,15 +348,15 @@ function createReplacerFromDirectives(directives: [RegExp, string][]): (str: str function createReplacer(data: string): (str: string) => string { data = data || ''; - let rawDirectives = data.split(';'); - let directives: [RegExp, string][] = []; + const rawDirectives = data.split(';'); + const directives: [RegExp, string][] = []; rawDirectives.forEach((rawDirective) => { if (rawDirective.length === 0) { return; } - let pieces = rawDirective.split('=>'); + const pieces = rawDirective.split('=>'); let findStr = pieces[0]; - let replaceStr = pieces[1]; + const replaceStr = pieces[1]; findStr = findStr.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&'); findStr = '\\b' + findStr + '\\b'; @@ -380,12 +380,12 @@ interface IEnumEntry { function generateDeclarationFile(ts: typeof import('typescript'), recipe: string, sourceFileGetter: SourceFileGetter): ITempResult | null { const endl = /\r\n/.test(recipe) ? '\r\n' : '\n'; - let lines = recipe.split(endl); - let result: string[] = []; + const lines = recipe.split(endl); + const result: string[] = []; let usageCounter = 0; - let usageImports: string[] = []; - let usage: string[] = []; + const usageImports: string[] = []; + const usage: string[] = []; let failed = false; @@ -393,12 +393,12 @@ function generateDeclarationFile(ts: typeof import('typescript'), recipe: string usage.push(`var b: any;`); const generateUsageImport = (moduleId: string) => { - let importName = 'm' + (++usageCounter); + const importName = 'm' + (++usageCounter); usageImports.push(`import * as ${importName} from './${moduleId.replace(/\.d\.ts$/, '')}';`); return importName; }; - let enums: IEnumEntry[] = []; + const enums: IEnumEntry[] = []; let version: string | null = null; lines.forEach(line => { @@ -407,14 +407,14 @@ function generateDeclarationFile(ts: typeof import('typescript'), recipe: string return; } - let m0 = line.match(/^\/\/dtsv=(\d+)$/); + const m0 = line.match(/^\/\/dtsv=(\d+)$/); if (m0) { version = m0[1]; } - let m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/); + const m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/); if (m1) { - let moduleId = m1[1]; + const moduleId = m1[1]; const sourceFile = sourceFileGetter(moduleId); if (!sourceFile) { logErr(`While handling ${line}`); @@ -425,15 +425,15 @@ function generateDeclarationFile(ts: typeof import('typescript'), recipe: string const importName = generateUsageImport(moduleId); - let replacer = createReplacer(m1[2]); + const replacer = createReplacer(m1[2]); - let typeNames = m1[3].split(/,/); + const typeNames = m1[3].split(/,/); typeNames.forEach((typeName) => { typeName = typeName.trim(); if (typeName.length === 0) { return; } - let declaration = getTopLevelDeclaration(ts, sourceFile, typeName); + const declaration = getTopLevelDeclaration(ts, sourceFile, typeName); if (!declaration) { logErr(`While handling ${line}`); logErr(`Cannot find ${typeName}`); @@ -445,9 +445,9 @@ function generateDeclarationFile(ts: typeof import('typescript'), recipe: string return; } - let m2 = line.match(/^\s*#includeAll\(([^;)]*)(;[^)]*)?\)\:(.*)$/); + const m2 = line.match(/^\s*#includeAll\(([^;)]*)(;[^)]*)?\)\:(.*)$/); if (m2) { - let moduleId = m2[1]; + const moduleId = m2[1]; const sourceFile = sourceFileGetter(moduleId); if (!sourceFile) { logErr(`While handling ${line}`); @@ -458,11 +458,11 @@ function generateDeclarationFile(ts: typeof import('typescript'), recipe: string const importName = generateUsageImport(moduleId); - let replacer = createReplacer(m2[2]); + const replacer = createReplacer(m2[2]); - let typeNames = m2[3].split(/,/); - let typesToExcludeMap: { [typeName: string]: boolean } = {}; - let typesToExcludeArr: string[] = []; + const typeNames = m2[3].split(/,/); + const typesToExcludeMap: { [typeName: string]: boolean } = {}; + const typesToExcludeArr: string[] = []; typeNames.forEach((typeName) => { typeName = typeName.trim(); if (typeName.length === 0) { @@ -479,7 +479,7 @@ function generateDeclarationFile(ts: typeof import('typescript'), recipe: string } } else { // node is ts.VariableStatement - let nodeText = getNodeText(sourceFile, declaration); + const nodeText = getNodeText(sourceFile, declaration); for (let i = 0; i < typesToExcludeArr.length; i++) { if (nodeText.indexOf(typesToExcludeArr[i]) >= 0) { return; @@ -732,7 +732,7 @@ class TypeScriptLanguageServiceHost implements ts.LanguageServiceHost { } export function execute(): IMonacoDeclarationResult { - let r = run3(new DeclarationResolver(new FSProvider())); + const r = run3(new DeclarationResolver(new FSProvider())); if (!r) { throw new Error(`monaco.d.ts generation error - Cannot continue`); } diff --git a/build/lib/standalone.ts b/build/lib/standalone.ts index 3483de02a3966..992d1ab52889d 100644 --- a/build/lib/standalone.ts +++ b/build/lib/standalone.ts @@ -10,7 +10,7 @@ import * as tss from './treeshaking'; const REPO_ROOT = path.join(__dirname, '../../'); const SRC_DIR = path.join(REPO_ROOT, 'src'); -let dirCache: { [dir: string]: boolean } = {}; +const dirCache: { [dir: string]: boolean } = {}; function writeFile(filePath: string, contents: Buffer | string): void { function ensureDirs(dirPath: string): void { @@ -63,13 +63,13 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str }); } - let result = tss.shake(options); - for (let fileName in result) { + const result = tss.shake(options); + for (const fileName in result) { if (result.hasOwnProperty(fileName)) { writeFile(path.join(options.destRoot, fileName), result[fileName]); } } - let copied: { [fileName: string]: boolean } = {}; + const copied: { [fileName: string]: boolean } = {}; const copyFile = (fileName: string) => { if (copied[fileName]) { return; @@ -82,7 +82,7 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str const writeOutputFile = (fileName: string, contents: string | Buffer) => { writeFile(path.join(options.destRoot, fileName), contents); }; - for (let fileName in result) { + for (const fileName in result) { if (result.hasOwnProperty(fileName)) { const fileContents = result[fileName]; const info = ts.preProcessFile(fileContents); @@ -142,7 +142,7 @@ export function createESMSourcesAndResources2(options: IOptions2): void { const OUT_RESOURCES_FOLDER = path.join(REPO_ROOT, options.outResourcesFolder); const getDestAbsoluteFilePath = (file: string): string => { - let dest = options.renames[file.replace(/\\/g, '/')] || file; + const dest = options.renames[file.replace(/\\/g, '/')] || file; if (dest === 'tsconfig.json') { return path.join(OUT_FOLDER, `tsconfig.json`); } @@ -229,7 +229,7 @@ export function createESMSourcesAndResources2(options: IOptions2): void { if (dir.charAt(dir.length - 1) !== '/' || dir.charAt(dir.length - 1) !== '\\') { dir += '/'; } - let result: string[] = []; + const result: string[] = []; _walkDirRecursive(dir, result, dir.length); return result; } @@ -253,7 +253,7 @@ export function createESMSourcesAndResources2(options: IOptions2): void { writeFile(absoluteFilePath, contents); function toggleComments(fileContents: string): string { - let lines = fileContents.split(/\r\n|\r|\n/); + const lines = fileContents.split(/\r\n|\r|\n/); let mode = 0; for (let i = 0; i < lines.length; i++) { const line = lines[i]; @@ -325,14 +325,14 @@ function transportCSS(module: string, enqueue: (module: string) => void, write: if (!forceBase64 && /\.svg$/.test(url)) { // .svg => url encode as explained at https://codepen.io/tigt/post/optimizing-svgs-in-data-uris - let newText = fileContents.toString() + const newText = fileContents.toString() .replace(/"/g, '\'') .replace(//g, '%3E') .replace(/&/g, '%26') .replace(/#/g, '%23') .replace(/\s+/g, ' '); - let encodedData = ',' + newText; + const encodedData = ',' + newText; if (encodedData.length < DATA.length) { DATA = encodedData; } diff --git a/build/lib/treeshaking.ts b/build/lib/treeshaking.ts index 113340285a82f..c13f4609b8c83 100644 --- a/build/lib/treeshaking.ts +++ b/build/lib/treeshaking.ts @@ -73,7 +73,7 @@ function printDiagnostics(options: ITreeShakingOptions, diagnostics: ReadonlyArr result += `${path.join(options.sourcesRoot, diag.file.fileName)}`; } if (diag.file && diag.start) { - let location = diag.file.getLineAndCharacterOfPosition(diag.start); + const location = diag.file.getLineAndCharacterOfPosition(diag.start); result += `:${location.line + 1}:${location.character}`; } result += ` - ` + JSON.stringify(diag.messageText); @@ -216,7 +216,7 @@ function processLibFiles(ts: typeof import('typescript'), options: ITreeShakingO // precess dependencies and "recurse" const info = ts.preProcessFile(sourceText); - for (let ref of info.libReferenceDirectives) { + for (const ref of info.libReferenceDirectives) { stack.push(ref.fileName); } } @@ -629,7 +629,7 @@ function markNodes(ts: typeof import('typescript'), languageService: ts.Language // queue the heritage clauses if (declaration.heritageClauses) { - for (let heritageClause of declaration.heritageClauses) { + for (const heritageClause of declaration.heritageClauses) { enqueue_black(heritageClause); } } @@ -682,7 +682,7 @@ function generateResult(ts: typeof import('typescript'), languageService: ts.Lan throw new Error('Could not get program from language service'); } - let result: ITreeShakingResult = {}; + const result: ITreeShakingResult = {}; const writeFile = (filePath: string, contents: string): void => { result[filePath] = contents; }; @@ -700,7 +700,7 @@ function generateResult(ts: typeof import('typescript'), languageService: ts.Lan return; } - let text = sourceFile.text; + const text = sourceFile.text; let result = ''; function keep(node: ts.Node): void { @@ -734,7 +734,7 @@ function generateResult(ts: typeof import('typescript'), languageService: ts.Lan return keep(node); } } else { - let survivingImports: string[] = []; + const survivingImports: string[] = []; for (const importNode of node.importClause.namedBindings.elements) { if (getColor(importNode) === NodeColor.Black) { survivingImports.push(importNode.getFullText(sourceFile)); @@ -762,7 +762,7 @@ function generateResult(ts: typeof import('typescript'), languageService: ts.Lan if (ts.isExportDeclaration(node)) { if (node.exportClause && node.moduleSpecifier && ts.isNamedExports(node.exportClause)) { - let survivingExports: string[] = []; + const survivingExports: string[] = []; for (const exportSpecifier of node.exportClause.elements) { if (getColor(exportSpecifier) === NodeColor.Black) { survivingExports.push(exportSpecifier.getFullText(sourceFile)); @@ -785,8 +785,8 @@ function generateResult(ts: typeof import('typescript'), languageService: ts.Lan continue; } - let pos = member.pos - node.pos; - let end = member.end - node.pos; + const pos = member.pos - node.pos; + const end = member.end - node.pos; toWrite = toWrite.substring(0, pos) + toWrite.substring(end); } return write(toWrite); diff --git a/build/lib/tsb/builder.ts b/build/lib/tsb/builder.ts index d5bec6ee97b0d..c2fab0fcc93a1 100644 --- a/build/lib/tsb/builder.ts +++ b/build/lib/tsb/builder.ts @@ -117,8 +117,8 @@ export function createTypeScriptBuilder(config: IConfiguration, projectFile: str if (/\.d\.ts$/.test(fileName)) { // if it's already a d.ts file just emit it signature - let snapshot = host.getScriptSnapshot(fileName); - let signature = crypto.createHash('md5') + const snapshot = host.getScriptSnapshot(fileName); + const signature = crypto.createHash('md5') .update(snapshot.getText(0, snapshot.getLength())) .digest('base64'); @@ -129,11 +129,11 @@ export function createTypeScriptBuilder(config: IConfiguration, projectFile: str }); } - let output = service.getEmitOutput(fileName); - let files: Vinyl[] = []; + const output = service.getEmitOutput(fileName); + const files: Vinyl[] = []; let signature: string | undefined; - for (let file of output.outputFiles) { + for (const file of output.outputFiles) { if (!emitSourceMapsInStream && /\.js\.map$/.test(file.name)) { continue; } @@ -149,22 +149,22 @@ export function createTypeScriptBuilder(config: IConfiguration, projectFile: str } } - let vinyl = new Vinyl({ + const vinyl = new Vinyl({ path: file.name, contents: Buffer.from(file.text), base: !config._emitWithoutBasePath && baseFor(host.getScriptSnapshot(fileName)) || undefined }); if (!emitSourceMapsInStream && /\.js$/.test(file.name)) { - let sourcemapFile = output.outputFiles.filter(f => /\.js\.map$/.test(f.name))[0]; + const sourcemapFile = output.outputFiles.filter(f => /\.js\.map$/.test(f.name))[0]; if (sourcemapFile) { - let extname = path.extname(vinyl.relative); - let basename = path.basename(vinyl.relative, extname); - let dirname = path.dirname(vinyl.relative); - let tsname = (dirname === '.' ? '' : dirname + '/') + basename + '.ts'; + const extname = path.extname(vinyl.relative); + const basename = path.basename(vinyl.relative, extname); + const dirname = path.dirname(vinyl.relative); + const tsname = (dirname === '.' ? '' : dirname + '/') + basename + '.ts'; - let sourceMap = JSON.parse(sourcemapFile.text); + const sourceMap = JSON.parse(sourcemapFile.text); sourceMap.sources[0] = tsname.replace(/\\/g, '/'); (vinyl).sourceMap = sourceMap; } @@ -182,17 +182,17 @@ export function createTypeScriptBuilder(config: IConfiguration, projectFile: str }); } - let newErrors: { [path: string]: ts.Diagnostic[] } = Object.create(null); - let t1 = Date.now(); + const newErrors: { [path: string]: ts.Diagnostic[] } = Object.create(null); + const t1 = Date.now(); - let toBeEmitted: string[] = []; - let toBeCheckedSyntactically: string[] = []; - let toBeCheckedSemantically: string[] = []; - let filesWithChangedSignature: string[] = []; - let dependentFiles: string[] = []; - let newLastBuildVersion = new Map(); + const toBeEmitted: string[] = []; + const toBeCheckedSyntactically: string[] = []; + const toBeCheckedSemantically: string[] = []; + const filesWithChangedSignature: string[] = []; + const dependentFiles: string[] = []; + const newLastBuildVersion = new Map(); - for (let fileName of host.getScriptFileNames()) { + for (const fileName of host.getScriptFileNames()) { if (lastBuildVersion[fileName] !== host.getScriptVersion(fileName)) { toBeEmitted.push(fileName); @@ -203,8 +203,8 @@ export function createTypeScriptBuilder(config: IConfiguration, projectFile: str return new Promise(resolve => { - let semanticCheckInfo = new Map(); - let seenAsDependentFile = new Set(); + const semanticCheckInfo = new Map(); + const seenAsDependentFile = new Set(); function workOnNext() { @@ -221,10 +221,10 @@ export function createTypeScriptBuilder(config: IConfiguration, projectFile: str // (1st) emit code else if (toBeEmitted.length) { - let fileName = toBeEmitted.pop()!; + const fileName = toBeEmitted.pop()!; promise = emitSoon(fileName).then(value => { - for (let file of value.files) { + for (const file of value.files) { _log('[emit code]', file.path); out(file); } @@ -246,7 +246,7 @@ export function createTypeScriptBuilder(config: IConfiguration, projectFile: str // (2nd) check syntax else if (toBeCheckedSyntactically.length) { - let fileName = toBeCheckedSyntactically.pop()!; + const fileName = toBeCheckedSyntactically.pop()!; _log('[check syntax]', fileName); promise = checkSyntaxSoon(fileName).then(diagnostics => { delete oldErrors[fileName]; @@ -286,7 +286,7 @@ export function createTypeScriptBuilder(config: IConfiguration, projectFile: str // (4th) check dependents else if (filesWithChangedSignature.length) { while (filesWithChangedSignature.length) { - let fileName = filesWithChangedSignature.pop()!; + const fileName = filesWithChangedSignature.pop()!; if (!isExternalModule(service.getProgram()!.getSourceFile(fileName)!)) { _log('[check semantics*]', fileName + ' is an internal module and it has changed shape -> check whatever hasn\'t been checked yet'); @@ -308,7 +308,7 @@ export function createTypeScriptBuilder(config: IConfiguration, projectFile: str } if (fileName) { seenAsDependentFile.add(fileName); - let value = semanticCheckInfo.get(fileName); + const value = semanticCheckInfo.get(fileName); if (value === 0) { // already validated successfully -> look at dependents next host.collectDependents(fileName, dependentFiles); @@ -507,7 +507,7 @@ class LanguageServiceHost implements ts.LanguageServiceHost { } if (!old || old.getVersion() !== snapshot.getVersion()) { this._dependenciesRecomputeList.push(filename); - let node = this._dependencies.lookup(filename); + const node = this._dependencies.lookup(filename); if (node) { node.outgoing = Object.create(null); } @@ -605,7 +605,7 @@ class LanguageServiceHost implements ts.LanguageServiceHost { } if (!found) { - for (let key in this._fileNameToDeclaredModule) { + for (const key in this._fileNameToDeclaredModule) { if (this._fileNameToDeclaredModule[key] && ~this._fileNameToDeclaredModule[key].indexOf(ref.fileName)) { this._dependencies.inertEdge(filename, key); } diff --git a/build/lib/tsb/index.ts b/build/lib/tsb/index.ts index 6e8e3d6fb7779..ab0c5bbb42e54 100644 --- a/build/lib/tsb/index.ts +++ b/build/lib/tsb/index.ts @@ -89,7 +89,7 @@ export function create( const result = (token: builder.CancellationToken) => createStream(token); result.src = (opts?: { cwd?: string; base?: string }) => { let _pos = 0; - let _fileNames = cmdLine.fileNames.slice(0); + const _fileNames = cmdLine.fileNames.slice(0); return new class extends Readable { constructor() { super({ objectMode: true }); diff --git a/build/lib/tsb/utils.ts b/build/lib/tsb/utils.ts index 295d873b63ae5..3b003e3a6e1de 100644 --- a/build/lib/tsb/utils.ts +++ b/build/lib/tsb/utils.ts @@ -28,7 +28,7 @@ export module collections { } export function forEach(collection: { [keys: string]: T }, callback: (entry: { key: string; value: T }) => void): void { - for (let key in collection) { + for (const key in collection) { if (hasOwnProperty.call(collection, key)) { callback({ key: key, diff --git a/build/lib/util.ts b/build/lib/util.ts index e1cb4e70be058..abbf9adc92733 100644 --- a/build/lib/util.ts +++ b/build/lib/util.ts @@ -306,7 +306,7 @@ function _rreaddir(dirPath: string, prepend: string, result: string[]): void { } export function rreddir(dirPath: string): string[] { - let result: string[] = []; + const result: string[] = []; _rreaddir(dirPath, '', result); return result; } @@ -423,7 +423,7 @@ export function createExternalLoaderConfig(webEndpoint?: string, commit?: string return undefined; } webEndpoint = webEndpoint + `/${quality}/${commit}`; - let nodePaths = acquireWebNodePaths(); + const nodePaths = acquireWebNodePaths(); Object.keys(nodePaths).map(function (key, _) { nodePaths[key] = `${webEndpoint}/node_modules/${key}/${nodePaths[key]}`; }); diff --git a/extensions/css-language-features/client/src/cssClient.ts b/extensions/css-language-features/client/src/cssClient.ts index 6f6238465d8a9..ba234ecb2d322 100644 --- a/extensions/css-language-features/client/src/cssClient.ts +++ b/extensions/css-language-features/client/src/cssClient.ts @@ -43,14 +43,14 @@ export async function startClient(context: ExtensionContext, newLanguageClient: const customDataSource = getCustomDataSource(context.subscriptions); - let documentSelector = ['css', 'scss', 'less']; + const documentSelector = ['css', 'scss', 'less']; const formatterRegistrations: FormatterRegistration[] = documentSelector.map(languageId => ({ languageId, settingId: `${languageId}.format.enable`, provider: undefined })); // Options to control the language client - let clientOptions: LanguageClientOptions = { + const clientOptions: LanguageClientOptions = { documentSelector, synchronize: { configurationSection: ['css', 'scss', 'less'] @@ -98,7 +98,7 @@ export async function startClient(context: ExtensionContext, newLanguageClient: }; // Create the language client and start the client. - let client = newLanguageClient('css', localize('cssserver.name', 'CSS Language Server'), clientOptions); + const client = newLanguageClient('css', localize('cssserver.name', 'CSS Language Server'), clientOptions); client.registerProposedFeatures(); await client.start(); @@ -125,17 +125,17 @@ export async function startClient(context: ExtensionContext, newLanguageClient: return languages.registerCompletionItemProvider(documentSelector, { provideCompletionItems(doc: TextDocument, pos: Position) { - let lineUntilPos = doc.getText(new Range(new Position(pos.line, 0), pos)); - let match = lineUntilPos.match(regionCompletionRegExpr); + const lineUntilPos = doc.getText(new Range(new Position(pos.line, 0), pos)); + const match = lineUntilPos.match(regionCompletionRegExpr); if (match) { - let range = new Range(new Position(pos.line, match[1].length), pos); - let beginProposal = new CompletionItem('#region', CompletionItemKind.Snippet); + const range = new Range(new Position(pos.line, match[1].length), pos); + const beginProposal = new CompletionItem('#region', CompletionItemKind.Snippet); beginProposal.range = range; TextEdit.replace(range, '/* #region */'); beginProposal.insertText = new SnippetString('/* #region $1*/'); beginProposal.documentation = localize('folding.start', 'Folding Region Start'); beginProposal.filterText = match[2]; beginProposal.sortText = 'za'; - let endProposal = new CompletionItem('#endregion', CompletionItemKind.Snippet); + const endProposal = new CompletionItem('#endregion', CompletionItemKind.Snippet); endProposal.range = range; endProposal.insertText = '/* #endregion */'; endProposal.documentation = localize('folding.end', 'Folding Region End'); @@ -151,13 +151,13 @@ export async function startClient(context: ExtensionContext, newLanguageClient: commands.registerCommand('_css.applyCodeAction', applyCodeAction); function applyCodeAction(uri: string, documentVersion: number, edits: TextEdit[]) { - let textEditor = window.activeTextEditor; + const textEditor = window.activeTextEditor; if (textEditor && textEditor.document.uri.toString() === uri) { if (textEditor.document.version !== documentVersion) { window.showInformationMessage(`CSS fix is outdated and can't be applied to the document.`); } textEditor.edit(mutator => { - for (let edit of edits) { + for (const edit of edits) { mutator.replace(client.protocol2CodeConverter.asRange(edit.range), edit.newText); } }).then(success => { diff --git a/extensions/css-language-features/server/src/languageModelCache.ts b/extensions/css-language-features/server/src/languageModelCache.ts index 343d57a9ad6d2..f39eada6f445b 100644 --- a/extensions/css-language-features/server/src/languageModelCache.ts +++ b/extensions/css-language-features/server/src/languageModelCache.ts @@ -18,10 +18,10 @@ export function getLanguageModelCache(maxEntries: number, cleanupIntervalTime let cleanupInterval: NodeJS.Timer | undefined = undefined; if (cleanupIntervalTimeInSec > 0) { cleanupInterval = setInterval(() => { - let cutoffTime = Date.now() - cleanupIntervalTimeInSec * 1000; - let uris = Object.keys(languageModels); - for (let uri of uris) { - let languageModelInfo = languageModels[uri]; + const cutoffTime = Date.now() - cleanupIntervalTimeInSec * 1000; + const uris = Object.keys(languageModels); + for (const uri of uris) { + const languageModelInfo = languageModels[uri]; if (languageModelInfo.cTime < cutoffTime) { delete languageModels[uri]; nModels--; @@ -32,14 +32,14 @@ export function getLanguageModelCache(maxEntries: number, cleanupIntervalTime return { get(document: TextDocument): T { - let version = document.version; - let languageId = document.languageId; - let languageModelInfo = languageModels[document.uri]; + const version = document.version; + const languageId = document.languageId; + const languageModelInfo = languageModels[document.uri]; if (languageModelInfo && languageModelInfo.version === version && languageModelInfo.languageId === languageId) { languageModelInfo.cTime = Date.now(); return languageModelInfo.languageModel; } - let languageModel = parse(document); + const languageModel = parse(document); languageModels[document.uri] = { languageModel, version, languageId, cTime: Date.now() }; if (!languageModelInfo) { nModels++; @@ -48,8 +48,8 @@ export function getLanguageModelCache(maxEntries: number, cleanupIntervalTime if (nModels === maxEntries) { let oldestTime = Number.MAX_VALUE; let oldestUri = null; - for (let uri in languageModels) { - let languageModelInfo = languageModels[uri]; + for (const uri in languageModels) { + const languageModelInfo = languageModels[uri]; if (languageModelInfo.cTime < oldestTime) { oldestUri = uri; oldestTime = languageModelInfo.cTime; @@ -64,7 +64,7 @@ export function getLanguageModelCache(maxEntries: number, cleanupIntervalTime }, onDocumentRemoved(document: TextDocument) { - let uri = document.uri; + const uri = document.uri; if (languageModels[uri]) { delete languageModels[uri]; nModels--; diff --git a/extensions/css-language-features/server/src/requests.ts b/extensions/css-language-features/server/src/requests.ts index 0726af35c562b..3d21e54236260 100644 --- a/extensions/css-language-features/server/src/requests.ts +++ b/extensions/css-language-features/server/src/requests.ts @@ -65,7 +65,7 @@ export interface RequestService { export function getRequestService(handledSchemas: string[], connection: Connection, runtime: RuntimeEnvironment): RequestService { const builtInHandlers: { [protocol: string]: RequestService | undefined } = {}; - for (let protocol of handledSchemas) { + for (const protocol of handledSchemas) { if (protocol === 'file') { builtInHandlers[protocol] = runtime.file; } else if (protocol === 'http' || protocol === 'https') { diff --git a/extensions/css-language-features/server/src/test/completion.test.ts b/extensions/css-language-features/server/src/test/completion.test.ts index 6881dd0e3e351..23570c7e1e56e 100644 --- a/extensions/css-language-features/server/src/test/completion.test.ts +++ b/extensions/css-language-features/server/src/test/completion.test.ts @@ -19,13 +19,13 @@ export interface ItemDescription { suite('Completions', () => { - let assertCompletion = function (completions: CompletionList, expected: ItemDescription, document: TextDocument, _offset: number) { - let matches = completions.items.filter(completion => { + const assertCompletion = function (completions: CompletionList, expected: ItemDescription, document: TextDocument, _offset: number) { + const matches = completions.items.filter(completion => { return completion.label === expected.label; }); assert.strictEqual(matches.length, 1, `${expected.label} should only existing once: Actual: ${completions.items.map(c => c.label).join(', ')}`); - let match = matches[0]; + const match = matches[0]; if (expected.resultText && TextEdit.is(match.textEdit)) { assert.strictEqual(TextDocument.applyEdits(document, [match.textEdit]), expected.resultText); } @@ -47,21 +47,21 @@ suite('Completions', () => { const context = getDocumentContext(testUri, workspaceFolders); const stylesheet = cssLanguageService.parseStylesheet(document); - let list = await cssLanguageService.doComplete2(document, position, stylesheet, context); + const list = await cssLanguageService.doComplete2(document, position, stylesheet, context); if (expected.count) { assert.strictEqual(list.items.length, expected.count); } if (expected.items) { - for (let item of expected.items) { + for (const item of expected.items) { assertCompletion(list, item, document, offset); } } } test('CSS url() Path completion', async function () { - let testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(); - let folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }]; + const testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(); + const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }]; await assertCompletions('html { background-image: url("./|")', { items: [ @@ -119,8 +119,8 @@ suite('Completions', () => { }); test('CSS url() Path Completion - Unquoted url', async function () { - let testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(); - let folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }]; + const testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(); + const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }]; await assertCompletions('html { background-image: url(./|)', { items: [ @@ -148,8 +148,8 @@ suite('Completions', () => { }); test('CSS @import Path completion', async function () { - let testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(); - let folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }]; + const testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(); + const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }]; await assertCompletions(`@import './|'`, { items: [ @@ -171,8 +171,8 @@ suite('Completions', () => { * For SCSS, `@import 'foo';` can be used for importing partial file `_foo.scss` */ test('SCSS @import Path completion', async function () { - let testCSSUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(); - let folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }]; + const testCSSUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(); + const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }]; /** * We are in a CSS file, so no special treatment for SCSS partial files @@ -184,7 +184,7 @@ suite('Completions', () => { ] }, testCSSUri, folders); - let testSCSSUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/scss/main.scss')).toString(); + const testSCSSUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/scss/main.scss')).toString(); await assertCompletions(`@import './|'`, { items: [ { label: '_foo.scss', resultText: `@import './foo'` } @@ -193,8 +193,8 @@ suite('Completions', () => { }); test('Completion should ignore files/folders starting with dot', async function () { - let testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(); - let folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }]; + const testUri = URI.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString(); + const folders = [{ name: 'x', uri: URI.file(path.resolve(__dirname, '../../test')).toString() }]; await assertCompletions('html { background-image: url("../|")', { count: 4 diff --git a/extensions/css-language-features/server/src/test/links.test.ts b/extensions/css-language-features/server/src/test/links.test.ts index bc4c6db6477a1..c19f67e5e4ba5 100644 --- a/extensions/css-language-features/server/src/test/links.test.ts +++ b/extensions/css-language-features/server/src/test/links.test.ts @@ -21,13 +21,13 @@ export interface ItemDescription { suite('Links', () => { const cssLanguageService = getCSSLanguageService({ fileSystemProvider: getNodeFSRequestService() }); - let assertLink = function (links: DocumentLink[], expected: ItemDescription, document: TextDocument) { - let matches = links.filter(link => { + const assertLink = function (links: DocumentLink[], expected: ItemDescription, document: TextDocument) { + const matches = links.filter(link => { return document.offsetAt(link.range.start) === expected.offset; }); assert.strictEqual(matches.length, 1, `${expected.offset} should only existing once: Actual: ${links.map(l => document.offsetAt(l.range.start)).join(', ')}`); - let match = matches[0]; + const match = matches[0]; assert.strictEqual(document.getText(match.range), expected.value); assert.strictEqual(match.target, expected.target); }; @@ -45,11 +45,11 @@ suite('Links', () => { const context = getDocumentContext(testUri, workspaceFolders); const stylesheet = cssLanguageService.parseStylesheet(document); - let links = await cssLanguageService.findDocumentLinks2(document, stylesheet, context)!; + const links = await cssLanguageService.findDocumentLinks2(document, stylesheet, context)!; assert.strictEqual(links.length, expected.length); - for (let item of expected) { + for (const item of expected) { assertLink(links, item, document); } } @@ -60,8 +60,8 @@ suite('Links', () => { test('url links', async function () { - let testUri = getTestResource('about.css'); - let folders = [{ name: 'x', uri: getTestResource('') }]; + const testUri = getTestResource('about.css'); + const folders = [{ name: 'x', uri: getTestResource('') }]; await assertLinks('html { background-image: url("hello.html|")', [{ offset: 29, value: '"hello.html"', target: getTestResource('hello.html') }], testUri, folders @@ -70,8 +70,8 @@ suite('Links', () => { test('node module resolving', async function () { - let testUri = getTestResource('about.css'); - let folders = [{ name: 'x', uri: getTestResource('') }]; + const testUri = getTestResource('about.css'); + const folders = [{ name: 'x', uri: getTestResource('') }]; await assertLinks('html { background-image: url("~foo/hello.html|")', [{ offset: 29, value: '"~foo/hello.html"', target: getTestResource('node_modules/foo/hello.html') }], testUri, folders @@ -80,8 +80,8 @@ suite('Links', () => { test('node module subfolder resolving', async function () { - let testUri = getTestResource('subdir/about.css'); - let folders = [{ name: 'x', uri: getTestResource('') }]; + const testUri = getTestResource('subdir/about.css'); + const folders = [{ name: 'x', uri: getTestResource('') }]; await assertLinks('html { background-image: url("~foo/hello.html|")', [{ offset: 29, value: '"~foo/hello.html"', target: getTestResource('node_modules/foo/hello.html') }], testUri, folders diff --git a/extensions/css-language-features/server/src/utils/documentContext.ts b/extensions/css-language-features/server/src/utils/documentContext.ts index a7beffd0310cc..0570ac9237577 100644 --- a/extensions/css-language-features/server/src/utils/documentContext.ts +++ b/extensions/css-language-features/server/src/utils/documentContext.ts @@ -10,7 +10,7 @@ import { Utils, URI } from 'vscode-uri'; export function getDocumentContext(documentUri: string, workspaceFolders: WorkspaceFolder[]): DocumentContext { function getRootFolder(): string | undefined { - for (let folder of workspaceFolders) { + for (const folder of workspaceFolders) { let folderURI = folder.uri; if (!endsWith(folderURI, '/')) { folderURI = folderURI + '/'; @@ -25,7 +25,7 @@ export function getDocumentContext(documentUri: string, workspaceFolders: Worksp return { resolveReference: (ref: string, base = documentUri) => { if (ref[0] === '/') { // resolve absolute path against the current workspace folder - let folderUri = getRootFolder(); + const folderUri = getRootFolder(); if (folderUri) { return folderUri + ref.substr(1); } diff --git a/extensions/css-language-features/server/src/utils/runner.ts b/extensions/css-language-features/server/src/utils/runner.ts index 47c587537aa9f..383b88e448754 100644 --- a/extensions/css-language-features/server/src/utils/runner.ts +++ b/extensions/css-language-features/server/src/utils/runner.ts @@ -8,7 +8,7 @@ import { RuntimeEnvironment } from '../cssServer'; export function formatError(message: string, err: any): string { if (err instanceof Error) { - let error = err; + const error = err; return `${message}: ${error.message}\n${error.stack}`; } else if (typeof err === 'string') { return `${message}: ${err}`; diff --git a/extensions/css-language-features/server/src/utils/strings.ts b/extensions/css-language-features/server/src/utils/strings.ts index 0e9ed34f83d24..1e53c4204fd30 100644 --- a/extensions/css-language-features/server/src/utils/strings.ts +++ b/extensions/css-language-features/server/src/utils/strings.ts @@ -21,7 +21,7 @@ export function startsWith(haystack: string, needle: string): boolean { * Determines if haystack ends with needle. */ export function endsWith(haystack: string, needle: string): boolean { - let diff = haystack.length - needle.length; + const diff = haystack.length - needle.length; if (diff > 0) { return haystack.lastIndexOf(needle) === diff; } else if (diff === 0) { diff --git a/extensions/debug-auto-launch/src/extension.ts b/extensions/debug-auto-launch/src/extension.ts index a4a48f5c38043..572c468d8433c 100644 --- a/extensions/debug-auto-launch/src/extension.ts +++ b/extensions/debug-auto-launch/src/extension.ts @@ -243,7 +243,7 @@ const createServerInner = async (ipcAddress: string) => { const createServerInstance = (ipcAddress: string) => new Promise((resolve, reject) => { const s = createServer(socket => { - let data: Buffer[] = []; + const data: Buffer[] = []; socket.on('data', async chunk => { if (chunk[chunk.length - 1] !== 0) { // terminated with NUL byte @@ -392,7 +392,7 @@ async function getIpcAddress(context: vscode.ExtensionContext) { } function getJsDebugSettingKey() { - let o: { [key: string]: unknown } = {}; + const o: { [key: string]: unknown } = {}; const config = vscode.workspace.getConfiguration(SETTING_SECTION); for (const setting of SETTINGS_CAUSE_REFRESH) { o[setting] = config.get(setting); diff --git a/extensions/debug-server-ready/src/extension.ts b/extensions/debug-server-ready/src/extension.ts index d112651fd09be..a3214e1207b76 100644 --- a/extensions/debug-server-ready/src/extension.ts +++ b/extensions/debug-server-ready/src/extension.ts @@ -57,7 +57,7 @@ class ServerReadyDetector extends vscode.Disposable { } static stop(session: vscode.DebugSession): void { - let detector = ServerReadyDetector.detectors.get(session); + const detector = ServerReadyDetector.detectors.get(session); if (detector) { ServerReadyDetector.detectors.delete(session); detector.dispose(); @@ -65,7 +65,7 @@ class ServerReadyDetector extends vscode.Disposable { } static rememberShellPid(session: vscode.DebugSession, pid: number) { - let detector = ServerReadyDetector.detectors.get(session); + const detector = ServerReadyDetector.detectors.get(session); if (detector) { detector.shellPid = pid; } @@ -77,7 +77,7 @@ class ServerReadyDetector extends vscode.Disposable { // first find the detector with a matching pid const pid = await e.terminal.processId; - for (let [, detector] of this.detectors) { + for (const [, detector] of this.detectors) { if (detector.shellPid === pid) { detector.detectPattern(e.data); return; @@ -85,7 +85,7 @@ class ServerReadyDetector extends vscode.Disposable { } // if none found, try all detectors until one matches - for (let [, detector] of this.detectors) { + for (const [, detector] of this.detectors) { if (detector.detectPattern(e.data)) { return; } diff --git a/extensions/emmet/src/defaultCompletionProvider.ts b/extensions/emmet/src/defaultCompletionProvider.ts index 1462a2ec4d78c..c8a6f657d75b6 100644 --- a/extensions/emmet/src/defaultCompletionProvider.ts +++ b/extensions/emmet/src/defaultCompletionProvider.ts @@ -49,7 +49,7 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi const mappedLanguages = getMappingForIncludedLanguages(); const isSyntaxMapped = mappedLanguages[document.languageId] ? true : false; - let emmetMode = getEmmetMode((isSyntaxMapped ? mappedLanguages[document.languageId] : document.languageId), mappedLanguages, excludedLanguages); + const emmetMode = getEmmetMode((isSyntaxMapped ? mappedLanguages[document.languageId] : document.languageId), mappedLanguages, excludedLanguages); if (!emmetMode || emmetConfig['showExpandedAbbreviation'] === 'never' @@ -135,7 +135,7 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi const offset = document.offsetAt(position); if (isStyleSheet(document.languageId) && context.triggerKind !== vscode.CompletionTriggerKind.TriggerForIncompleteCompletions) { validateLocation = true; - let usePartialParsing = vscode.workspace.getConfiguration('emmet')['optimizeStylesheetParsing'] === true; + const usePartialParsing = vscode.workspace.getConfiguration('emmet')['optimizeStylesheetParsing'] === true; rootNode = usePartialParsing && document.lineCount > 1000 ? parsePartialStylesheet(document, position) : getRootNode(document, true); if (!rootNode) { return; @@ -152,8 +152,8 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi if (!rootNode) { return; } - let flatNode = getFlatNode(rootNode, offset, true); - let embeddedCssNode = getEmbeddedCssNodeIfAny(document, flatNode, position); + const flatNode = getFlatNode(rootNode, offset, true); + const embeddedCssNode = getEmbeddedCssNodeIfAny(document, flatNode, position); currentNode = getFlatNode(embeddedCssNode, offset, true); } @@ -167,7 +167,7 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi // Check for document symbols in js/ts/jsx/tsx and avoid triggering emmet for abbreviations of the form symbolName.sometext // Presence of > or * or + in the abbreviation denotes valid abbreviation that should trigger emmet if (!isStyleSheet(syntax) && (document.languageId === 'javascript' || document.languageId === 'javascriptreact' || document.languageId === 'typescript' || document.languageId === 'typescriptreact')) { - let abbreviation: string = extractAbbreviationResults.abbreviation; + const abbreviation: string = extractAbbreviationResults.abbreviation; // For the second condition, we don't want abbreviations that have [] characters but not ='s in them to expand // In turn, users must explicitly expand abbreviations of the form Component[attr1 attr2], but it means we don't try to expand a[i]. if (abbreviation.startsWith('this.') || /\[[^\]=]*\]/.test(abbreviation)) { @@ -194,14 +194,14 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi } } - let newItems: vscode.CompletionItem[] = []; + const newItems: vscode.CompletionItem[] = []; if (result && result.items) { result.items.forEach((item: any) => { - let newItem = new vscode.CompletionItem(item.label); + const newItem = new vscode.CompletionItem(item.label); newItem.documentation = item.documentation; newItem.detail = item.detail; newItem.insertText = new vscode.SnippetString(item.textEdit.newText); - let oldrange = item.textEdit.range; + const oldrange = item.textEdit.range; newItem.range = new vscode.Range(oldrange.start.line, oldrange.start.character, oldrange.end.line, oldrange.end.character); newItem.filterText = item.filterText; diff --git a/extensions/emmet/src/editPoint.ts b/extensions/emmet/src/editPoint.ts index 239df1f4cc2d6..b5137795dc920 100644 --- a/extensions/emmet/src/editPoint.ts +++ b/extensions/emmet/src/editPoint.ts @@ -12,9 +12,9 @@ export function fetchEditPoint(direction: string): void { } const editor = vscode.window.activeTextEditor; - let newSelections: vscode.Selection[] = []; + const newSelections: vscode.Selection[] = []; editor.selections.forEach(selection => { - let updatedSelection = direction === 'next' ? nextEditPoint(selection, editor) : prevEditPoint(selection, editor); + const updatedSelection = direction === 'next' ? nextEditPoint(selection, editor) : prevEditPoint(selection, editor); newSelections.push(updatedSelection); }); editor.selections = newSelections; @@ -23,7 +23,7 @@ export function fetchEditPoint(direction: string): void { function nextEditPoint(selection: vscode.Selection, editor: vscode.TextEditor): vscode.Selection { for (let lineNum = selection.anchor.line; lineNum < editor.document.lineCount; lineNum++) { - let updatedSelection = findEditPoint(lineNum, editor, selection.anchor, 'next'); + const updatedSelection = findEditPoint(lineNum, editor, selection.anchor, 'next'); if (updatedSelection) { return updatedSelection; } @@ -33,7 +33,7 @@ function nextEditPoint(selection: vscode.Selection, editor: vscode.TextEditor): function prevEditPoint(selection: vscode.Selection, editor: vscode.TextEditor): vscode.Selection { for (let lineNum = selection.anchor.line; lineNum >= 0; lineNum--) { - let updatedSelection = findEditPoint(lineNum, editor, selection.anchor, 'prev'); + const updatedSelection = findEditPoint(lineNum, editor, selection.anchor, 'prev'); if (updatedSelection) { return updatedSelection; } @@ -43,7 +43,7 @@ function prevEditPoint(selection: vscode.Selection, editor: vscode.TextEditor): function findEditPoint(lineNum: number, editor: vscode.TextEditor, position: vscode.Position, direction: string): vscode.Selection | undefined { - let line = editor.document.lineAt(lineNum); + const line = editor.document.lineAt(lineNum); let lineContent = line.text; if (lineNum !== position.line && line.isEmptyOrWhitespace && lineContent.length) { @@ -53,8 +53,8 @@ function findEditPoint(lineNum: number, editor: vscode.TextEditor, position: vsc if (lineNum === position.line && direction === 'prev') { lineContent = lineContent.substr(0, position.character); } - let emptyAttrIndex = direction === 'next' ? lineContent.indexOf('""', lineNum === position.line ? position.character : 0) : lineContent.lastIndexOf('""'); - let emptyTagIndex = direction === 'next' ? lineContent.indexOf('><', lineNum === position.line ? position.character : 0) : lineContent.lastIndexOf('><'); + const emptyAttrIndex = direction === 'next' ? lineContent.indexOf('""', lineNum === position.line ? position.character : 0) : lineContent.lastIndexOf('""'); + const emptyTagIndex = direction === 'next' ? lineContent.indexOf('><', lineNum === position.line ? position.character : 0) : lineContent.lastIndexOf('><'); let winner = -1; diff --git a/extensions/emmet/src/emmetCommon.ts b/extensions/emmet/src/emmetCommon.ts index 5a5e0d872c389..53824c4de290e 100644 --- a/extensions/emmet/src/emmetCommon.ts +++ b/extensions/emmet/src/emmetCommon.ts @@ -161,8 +161,8 @@ const languageMappingForCompletionProviders: Map = new Map = new Map(); function registerCompletionProviders(context: vscode.ExtensionContext) { - let completionProvider = new DefaultCompletionItemProvider(); - let includedLanguages = getMappingForIncludedLanguages(); + const completionProvider = new DefaultCompletionItemProvider(); + const includedLanguages = getMappingForIncludedLanguages(); Object.keys(includedLanguages).forEach(language => { if (languageMappingForCompletionProviders.has(language) && languageMappingForCompletionProviders.get(language) === includedLanguages[language]) { diff --git a/extensions/emmet/src/incrementDecrement.ts b/extensions/emmet/src/incrementDecrement.ts index 9e0afa4acf10c..f7adf444978af 100644 --- a/extensions/emmet/src/incrementDecrement.ts +++ b/extensions/emmet/src/incrementDecrement.ts @@ -21,7 +21,7 @@ export function incrementDecrement(delta: number): Thenable | undefined return editor.edit(editBuilder => { editor.selections.forEach(selection => { - let rangeToReplace = locate(editor.document, selection.isReversed ? selection.anchor : selection.active); + const rangeToReplace = locate(editor.document, selection.isReversed ? selection.anchor : selection.active); if (!rangeToReplace) { return; } @@ -40,7 +40,7 @@ export function incrementDecrement(delta: number): Thenable | undefined */ export function update(numString: string, delta: number): string { let m: RegExpMatchArray | null; - let decimals = (m = numString.match(/\.(\d+)$/)) ? m[1].length : 1; + const decimals = (m = numString.match(/\.(\d+)$/)) ? m[1].length : 1; let output = String((parseFloat(numString) + delta).toFixed(decimals)).replace(/\.0+$/, ''); if (m = numString.match(/^\-?(0\d+)/)) { diff --git a/extensions/emmet/src/matchTag.ts b/extensions/emmet/src/matchTag.ts index d7331a465b255..1c928fb73710f 100644 --- a/extensions/emmet/src/matchTag.ts +++ b/extensions/emmet/src/matchTag.ts @@ -20,7 +20,7 @@ export function matchTag() { return; } - let updatedSelections: vscode.Selection[] = []; + const updatedSelections: vscode.Selection[] = []; editor.selections.forEach(selection => { const updatedSelection = getUpdatedSelections(document, rootNode, selection.start); if (updatedSelection) { diff --git a/extensions/emmet/src/removeTag.ts b/extensions/emmet/src/removeTag.ts index c43a9a03e7239..b8b5b9eebdfb8 100644 --- a/extensions/emmet/src/removeTag.ts +++ b/extensions/emmet/src/removeTag.ts @@ -19,7 +19,7 @@ export function removeTag() { return; } - let finalRangesToRemove = Array.from(editor.selections).reverse() + const finalRangesToRemove = Array.from(editor.selections).reverse() .reduce((prev, selection) => prev.concat(getRangesToRemove(editor.document, rootNode, selection)), []); @@ -68,7 +68,7 @@ function getRangesToRemove(document: vscode.TextDocument, rootNode: HtmlFlatNode } } - let rangesToRemove = []; + const rangesToRemove = []; if (openTagRange) { rangesToRemove.push(openTagRange); if (closeTagRange) { diff --git a/extensions/emmet/src/selectItem.ts b/extensions/emmet/src/selectItem.ts index 52e672eddf3f0..437dbed7ec90c 100644 --- a/extensions/emmet/src/selectItem.ts +++ b/extensions/emmet/src/selectItem.ts @@ -21,7 +21,7 @@ export function fetchSelectItem(direction: string): void { return; } - let newSelections: vscode.Selection[] = []; + const newSelections: vscode.Selection[] = []; editor.selections.forEach(selection => { const selectionStart = selection.isReversed ? selection.active : selection.anchor; const selectionEnd = selection.isReversed ? selection.anchor : selection.active; diff --git a/extensions/emmet/src/selectItemStylesheet.ts b/extensions/emmet/src/selectItemStylesheet.ts index 557d971361b59..09f45ee88796d 100644 --- a/extensions/emmet/src/selectItemStylesheet.ts +++ b/extensions/emmet/src/selectItemStylesheet.ts @@ -28,7 +28,7 @@ export function nextItemStylesheet(document: vscode.TextDocument, startPosition: if (currentNode.type === 'property' && startOffset >= (currentNode).valueToken.start && endOffset <= (currentNode).valueToken.end) { - let singlePropertyValue = getSelectionFromProperty(document, currentNode, startOffset, endOffset, false, 'next'); + const singlePropertyValue = getSelectionFromProperty(document, currentNode, startOffset, endOffset, false, 'next'); if (singlePropertyValue) { return singlePropertyValue; } @@ -77,7 +77,7 @@ export function prevItemStylesheet(document: vscode.TextDocument, startPosition: if (currentNode.type === 'property' && startOffset >= (currentNode).valueToken.start && endOffset <= (currentNode).valueToken.end) { - let singlePropertyValue = getSelectionFromProperty(document, currentNode, startOffset, endOffset, false, 'prev'); + const singlePropertyValue = getSelectionFromProperty(document, currentNode, startOffset, endOffset, false, 'prev'); if (singlePropertyValue) { return singlePropertyValue; } @@ -115,7 +115,7 @@ function getSelectionFromProperty(document: vscode.TextDocument, node: Node | un } const propertyNode = node; - let propertyValue = propertyNode.valueToken.stream.substring(propertyNode.valueToken.start, propertyNode.valueToken.end); + const propertyValue = propertyNode.valueToken.stream.substring(propertyNode.valueToken.start, propertyNode.valueToken.end); selectFullValue = selectFullValue || (direction === 'prev' && selectionStart === propertyNode.valueToken.start && selectionEnd < propertyNode.valueToken.end); @@ -144,7 +144,7 @@ function getSelectionFromProperty(document: vscode.TextDocument, node: Node | un } - let [newSelectionStartOffset, newSelectionEndOffset] = direction === 'prev' ? findPrevWord(propertyValue, pos) : findNextWord(propertyValue, pos); + const [newSelectionStartOffset, newSelectionEndOffset] = direction === 'prev' ? findPrevWord(propertyValue, pos) : findNextWord(propertyValue, pos); if (!newSelectionStartOffset && !newSelectionEndOffset) { return; } diff --git a/extensions/emmet/src/test/editPointSelectItemBalance.test.ts b/extensions/emmet/src/test/editPointSelectItemBalance.test.ts index b631b156d2450..c698e85c683d3 100644 --- a/extensions/emmet/src/test/editPointSelectItemBalance.test.ts +++ b/extensions/emmet/src/test/editPointSelectItemBalance.test.ts @@ -62,13 +62,13 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => { return withRandomFileEditor(htmlContents, '.html', (editor, _) => { editor.selections = [new Selection(1, 5, 1, 5)]; - let expectedNextEditPoints: [number, number][] = [[4, 16], [6, 8], [10, 2], [10, 2]]; + const expectedNextEditPoints: [number, number][] = [[4, 16], [6, 8], [10, 2], [10, 2]]; expectedNextEditPoints.forEach(([line, col]) => { fetchEditPoint('next'); testSelection(editor.selection, col, line); }); - let expectedPrevEditPoints = [[6, 8], [4, 16], [4, 16]]; + const expectedPrevEditPoints = [[6, 8], [4, 16], [4, 16]]; expectedPrevEditPoints.forEach(([line, col]) => { fetchEditPoint('prev'); testSelection(editor.selection, col, line); @@ -82,7 +82,7 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => { return withRandomFileEditor(htmlContents, '.html', (editor, _) => { editor.selections = [new Selection(2, 2, 2, 2)]; - let expectedNextItemPoints: [number, number, number][] = [ + const expectedNextItemPoints: [number, number, number][] = [ [2, 1, 5], // html [2, 6, 15], // lang="en" [2, 12, 14], // en @@ -141,7 +141,7 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => { return withRandomFileEditor(templateContents, '.html', (editor, _) => { editor.selections = [new Selection(2, 2, 2, 2)]; - let expectedNextItemPoints: [number, number, number][] = [ + const expectedNextItemPoints: [number, number, number][] = [ [2, 2, 5], // div [2, 6, 20], // class="header" [2, 13, 19], // header @@ -170,7 +170,7 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => { return withRandomFileEditor(cssContents, '.css', (editor, _) => { editor.selections = [new Selection(0, 0, 0, 0)]; - let expectedNextItemPoints: [number, number, number][] = [ + const expectedNextItemPoints: [number, number, number][] = [ [1, 0, 4], // .boo [2, 1, 19], // margin: 20px 10px; [2, 9, 18], // 20px 10px @@ -201,7 +201,7 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => { return withRandomFileEditor(scssContents, '.scss', (editor, _) => { editor.selections = [new Selection(0, 0, 0, 0)]; - let expectedNextItemPoints: [number, number, number][] = [ + const expectedNextItemPoints: [number, number, number][] = [ [1, 0, 4], // .boo [2, 1, 19], // margin: 20px 10px; [2, 9, 18], // 20px 10px @@ -232,7 +232,7 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => { return withRandomFileEditor(htmlContents, 'html', (editor, _) => { editor.selections = [new Selection(14, 6, 14, 10)]; - let expectedBalanceOutRanges: [number, number, number, number][] = [ + const expectedBalanceOutRanges: [number, number, number, number][] = [ [14, 3, 14, 32], //
  • Item 1
  • [13, 23, 16, 2], // inner contents of