@elice/material-exercise 1.230328.0 → 1.230418.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +526 -0
- package/cjs/components/material-exercise/MaterialExercise.js +44 -63
- package/cjs/components/material-exercise/MaterialExercise.styled.js +20 -23
- package/cjs/components/material-exercise/MaterialExerciseMobile.js +19 -15
- package/cjs/components/material-exercise/context/ExerciseIntlProvider.js +9 -13
- package/cjs/components/material-exercise/context/ExerciseProvider.js +83 -81
- package/cjs/components/material-exercise/context/ExerciseProviderNoImage.js +16 -16
- package/cjs/components/material-exercise/context/context.js +1 -1
- package/cjs/components/material-exercise/context/locales/noImage.en.json.js +3 -1
- package/cjs/components/material-exercise/context/locales/noImage.ko.json.js +3 -1
- package/cjs/components/material-exercise/context/recoil.js +559 -371
- package/cjs/components/material-exercise/context/recoilTypes.js +0 -5
- package/cjs/components/material-exercise/context/subjects.js +3 -6
- package/cjs/components/material-exercise/exercise-code-history/ExerciseCodeHistory.d.ts +2 -2
- package/cjs/components/material-exercise/exercise-code-history/ExerciseCodeHistory.js +78 -65
- package/cjs/components/material-exercise/exercise-code-history/ExerciseCodeHistory.styled.js +8 -8
- package/cjs/components/material-exercise/exercise-code-history/locales/en.json.js +7 -0
- package/cjs/components/material-exercise/exercise-code-history/locales/ko.json.js +7 -0
- package/cjs/components/material-exercise/exercise-file/ExerciseFile.js +20 -21
- package/cjs/components/material-exercise/exercise-file-editor/ExerciseFileEditor.js +225 -198
- package/cjs/components/material-exercise/exercise-file-editor/ExerciseFileReadOnlyBanner.js +8 -10
- package/cjs/components/material-exercise/exercise-file-tabs/ExerciseFileTabs.js +35 -32
- package/cjs/components/material-exercise/exercise-file-tabs/ExerciseFileTabsFileTreeButton.js +57 -48
- package/cjs/components/material-exercise/exercise-file-tabs/ExerciseFileTabsLazy.js +6 -4
- package/cjs/components/material-exercise/exercise-file-tabs/locales/fileTreeButton.en.json.js +3 -1
- package/cjs/components/material-exercise/exercise-file-tabs/locales/fileTreeButton.ko.json.js +3 -1
- package/cjs/components/material-exercise/exercise-file-tree/ExerciseFileTree.js +327 -231
- package/cjs/components/material-exercise/exercise-file-tree/ExerciseFileTreeLazy.js +6 -4
- package/cjs/components/material-exercise/exercise-file-tree/locales/en.json.js +3 -1
- package/cjs/components/material-exercise/exercise-file-tree/locales/ko.json.js +3 -1
- package/cjs/components/material-exercise/exercise-file-viewer/ExerciseFileViewer.js +17 -17
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenu.js +13 -14
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.js +6 -6
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.js +47 -38
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuDropdown.js +60 -42
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuReset.js +29 -22
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.js +45 -56
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.styled.js +12 -12
- package/cjs/components/material-exercise/exercise-menu/locales/en.json.js +3 -1
- package/cjs/components/material-exercise/exercise-menu/locales/ko.json.js +3 -1
- package/cjs/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdown.js +28 -20
- package/cjs/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdownLazy.js +5 -3
- package/cjs/components/material-exercise/exercise-preview/ExercisePreview.js +30 -41
- package/cjs/components/material-exercise/exercise-preview/ExercisePreviewDisplayModeButton.js +17 -12
- package/cjs/components/material-exercise/exercise-preview/locales/en.json.js +3 -1
- package/cjs/components/material-exercise/exercise-preview/locales/ko.json.js +3 -1
- package/cjs/components/material-exercise/exercise-rightpane/ExerciseRightpane.js +24 -33
- package/cjs/components/material-exercise/exercise-rightpane/ExerciseRightpaneEditorPerference.js +13 -8
- package/cjs/components/material-exercise/exercise-rightpane/ExerciseRightpaneEnvironment.js +84 -83
- package/cjs/components/material-exercise/exercise-rightpane/locales/en.json.js +3 -1
- package/cjs/components/material-exercise/exercise-rightpane/locales/ko.json.js +3 -1
- package/cjs/components/material-exercise/exercise-room/ExerciseRoom.js +20 -12
- package/cjs/components/material-exercise/exercise-room/ExerciseRoom.styled.js +14 -12
- package/cjs/components/material-exercise/exercise-room/ExerciseRoomDetail.js +239 -147
- package/cjs/components/material-exercise/exercise-room/ExerciseRoomList.js +92 -63
- package/cjs/components/material-exercise/exercise-room/helpers/exerciseRoomPermissionStringConvertor.js +2 -8
- package/cjs/components/material-exercise/exercise-room/locales/en.json.js +3 -1
- package/cjs/components/material-exercise/exercise-room/locales/ko.json.js +3 -1
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunner.js +219 -220
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerContext.js +1 -1
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerController.js +13 -13
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.js +30 -26
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.js +26 -26
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +70 -95
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.js +27 -27
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerRunningInfo.js +54 -60
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerStatusIndicator.js +5 -5
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerStatusMessage.js +10 -13
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerTimer.js +29 -26
- package/cjs/components/material-exercise/exercise-runner/locales/en.json.js +3 -1
- package/cjs/components/material-exercise/exercise-runner/locales/ko.json.js +3 -1
- package/cjs/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.d.ts +2 -2
- package/cjs/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.js +290 -180
- package/cjs/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.styled.js +8 -8
- package/cjs/components/material-exercise/exercise-submit-history/ExerciseSubmitHistoryOutput.js +41 -45
- package/cjs/components/material-exercise/exercise-submit-history/locales/en.json.js +7 -0
- package/cjs/components/material-exercise/exercise-submit-history/locales/ko.json.js +7 -0
- package/cjs/components/shared/exercise-menu-button/ExerciseMenuButton.js +19 -17
- package/cjs/components/shared/exercise-shimmer/ExerciseFileShimmer.js +5 -4
- package/cjs/components/shared/exercise-shimmer/ExerciseFileTabShimmer.js +15 -14
- package/cjs/components/shared/exercise-shimmer/ExerciseFileTabsShimmer.js +7 -6
- package/cjs/components/shared/exercise-shimmer/ExerciseFileTreeListItemShimmer.js +17 -16
- package/cjs/components/shared/exercise-shimmer/ExerciseFileTreeListShimmer.js +18 -11
- package/cjs/components/shared/exercise-version-list/ExerciseVersionList.js +5 -4
- package/cjs/components/shared/exercise-version-list/ExerciseVersionList.styled.js +1 -1
- package/cjs/components/shared/exercise-version-list/ExerciseVersionListItem.js +8 -7
- package/cjs/components/shared/exercise-version-list/ExerciseVersionListItem.styled.js +9 -5
- package/cjs/components/shared/file-icon/FileIcon.js +23 -23
- package/cjs/components/shared/file-tabs/FileTab.js +32 -43
- package/cjs/components/shared/file-tabs/FileTab.styled.js +26 -22
- package/cjs/components/shared/file-tabs/FileTabs.js +55 -49
- package/cjs/components/shared/file-tabs/FileTabs.styled.js +2 -2
- package/cjs/components/shared/file-tabs/util.js +29 -18
- package/cjs/components/shared/file-tree/FileTree.js +11 -11
- package/cjs/components/shared/file-tree/FileTreeConfig.js +24 -23
- package/cjs/components/shared/file-tree/FileTreeList.js +35 -41
- package/cjs/components/shared/file-tree/FileTreeListItemContent.js +75 -91
- package/cjs/components/shared/file-tree/FileTreeListItemContent.styled.js +29 -40
- package/cjs/components/shared/file-tree/FileTreeListItemContentInput.js +77 -101
- package/cjs/components/shared/file-tree/FileTreeListItemContentInput.styled.js +6 -6
- package/cjs/components/shared/file-tree/FileTreeListItemContentMenu.js +51 -86
- package/cjs/components/shared/file-tree/FileTreeListItems.js +150 -153
- package/cjs/components/shared/file-tree/FileTreeListItems.styled.js +2 -2
- package/cjs/components/shared/file-tree/FileTreeToolbar.js +30 -41
- package/cjs/components/shared/file-tree/FileTreeToolbar.styled.js +1 -1
- package/cjs/components/shared/file-tree/context/FileTreeContext.js +91 -97
- package/cjs/components/shared/file-tree/locales/en.json.js +3 -1
- package/cjs/components/shared/file-tree/locales/ko.json.js +3 -1
- package/cjs/components/shared/file-tree/utils/fileTreeFiles.js +20 -22
- package/cjs/components/shared/file-tree/utils/fileTreeGenerator.js +193 -173
- package/cjs/components/shared/file-tree/utils/fileTreeInput.js +0 -1
- package/cjs/components/shared/file-tree/utils/fileTreeItem.js +1 -1
- package/cjs/components/shared/file-tree/utils/fileTreePath.js +5 -7
- package/cjs/components/shared/file-viewer/FileViewer.js +59 -60
- package/cjs/components/shared/file-viewer/FileViewerCsv.js +145 -101
- package/cjs/components/shared/file-viewer/FileViewerImage.js +7 -8
- package/cjs/components/shared/file-viewer/FileViewerIpynb.js +20 -14
- package/cjs/components/shared/file-viewer/FileViewerNonViewable.js +28 -34
- package/cjs/components/shared/file-viewer/FileViewerText.js +23 -16
- package/cjs/components/shared/file-viewer/locales/en.json.js +3 -1
- package/cjs/components/shared/file-viewer/locales/ko.json.js +3 -1
- package/cjs/components/shared/file-viewer/locales/nonViewable.en.json.js +3 -1
- package/cjs/components/shared/file-viewer/locales/nonViewable.ko.json.js +3 -1
- package/cjs/components/shared/material-modal/MaterialModal.js +10 -12
- package/cjs/components/shared/material-modal/MaterialModal.styled.js +5 -5
- package/cjs/components/shared/monaco-editor/MonacoEditor.js +123 -149
- package/cjs/components/shared/monaco-editor/MonacoEditorLazy.js +10 -8
- package/cjs/components/shared/monaco-editor/MonacoEditorMobile.js +49 -58
- package/cjs/components/shared/monaco-editor/MonacoEditorPerferenceForm.js +78 -85
- package/cjs/components/shared/monaco-editor/constants/grammars/index.js +131 -52
- package/cjs/components/shared/monaco-editor/constants/monaco/preferences.js +5 -9
- package/cjs/components/shared/monaco-editor/constants/themes/index.js +80 -32
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoEventChange.js +10 -13
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoEventCursor.js +14 -18
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoEventScroll.js +8 -9
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoMarkers.js +54 -72
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoOptions.js +14 -15
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoTheme.js +8 -9
- package/cjs/components/shared/monaco-editor/editor-languages/css/formatter.js +36 -12
- package/cjs/components/shared/monaco-editor/editor-languages/css/index.js +5 -8
- package/cjs/components/shared/monaco-editor/editor-languages/html/formatter.js +36 -12
- package/cjs/components/shared/monaco-editor/editor-languages/html/index.js +3 -6
- package/cjs/components/shared/monaco-editor/editor-languages/index.js +3 -1
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/dts/_helper.js +1 -1
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/dts/express.js +3 -2
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/dts/propTypes.js +3 -2
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/dts/react.js +3 -2
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/formatter.js +36 -12
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/index.js +18 -24
- package/cjs/components/shared/monaco-editor/hooks/useEditorOptions.js +12 -9
- package/cjs/components/shared/monaco-editor/locales/en.json.js +3 -1
- package/cjs/components/shared/monaco-editor/locales/ko.json.js +3 -1
- package/cjs/components/shared/monaco-editor/utils/emmet/abbreviationActions.js +18 -28
- package/cjs/components/shared/monaco-editor/utils/emmet/emmet.js +0 -3
- package/cjs/components/shared/monaco-editor/utils/emmet/registerProvider.js +12 -8
- package/cjs/components/shared/monaco-editor/utils/grammar/index.js +70 -32
- package/cjs/components/shared/monaco-editor/utils/grammar/onigasm.js +25 -7
- package/cjs/components/shared/monaco-editor/utils/grammar/textmate.js +67 -43
- package/cjs/components/shared/monaco-editor/utils/monacoLanguage.js +9 -19
- package/cjs/components/shared/monaco-editor/utils/monacoPreference.js +6 -5
- package/cjs/components/shared/monaco-editor/utils/prettier/config.js +2 -3
- package/cjs/components/shared/monaco-editor/utils/prettier/index.js +30 -9
- package/cjs/components/shared/monaco-editor/utils/theme/convert.js +20 -26
- package/cjs/components/shared/monaco-editor/utils/theme/index.js +22 -5
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursor.js +77 -75
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursorManager.js +82 -93
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursorWidget.js +125 -135
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteSelection.js +148 -160
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteSelectionManager.js +104 -118
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/styles.js +2 -2
- package/cjs/components/shared/monaco-editor/vendors/vscode-emmet-helper/configCompat.js +1 -3
- package/cjs/components/shared/monaco-editor/vendors/vscode-emmet-helper/data.js +2 -3
- package/cjs/components/shared/monaco-editor/vendors/vscode-emmet-helper/emmetHelper.js +218 -329
- package/cjs/components/shared/monaco-editor/vendors/vscode-emmet-helper/utils.js +3 -6
- package/cjs/components/shared/no-vnc/NoVnc.js +93 -90
- package/cjs/components/shared/no-vnc/NoVncLazy.js +7 -5
- package/cjs/components/shared/preview-container/PreviewContainer.js +7 -10
- package/cjs/components/shared/web-browser/WebBrowser.js +54 -59
- package/cjs/components/shared/xterm/Xterm.js +112 -105
- package/cjs/components/shared/xterm/XtermLazy.js +7 -5
- package/cjs/components/shared/xterm/locales/en.json.js +3 -1
- package/cjs/components/shared/xterm/locales/ko.json.js +3 -1
- package/cjs/constants/arduino.js +10 -10
- package/cjs/constants/shortcutKeyMap.js +5 -5
- package/cjs/constants/stylesheets.js +7 -10
- package/cjs/hooks/useArduino.js +327 -255
- package/cjs/hooks/useExerciseFile.js +24 -24
- package/cjs/hooks/useExericseShortcut.js +6 -5
- package/cjs/hooks/useMaterialExerciseFileUrl.js +54 -37
- package/cjs/hooks/useRunnerRoomWebSocket.js +58 -56
- package/cjs/hooks/useStdioTextConcator.js +18 -12
- package/cjs/hooks/useStdioWebSocket.js +41 -67
- package/cjs/hooks/useUsercodeEditWebSocket.js +230 -252
- package/cjs/hooks/useUsercodeHistory.js +121 -82
- package/cjs/index.js +4 -4
- package/cjs/utils/arduino.js +23 -25
- package/cjs/utils/exerciseFile.js +8 -16
- package/cjs/utils/runner.js +29 -25
- package/es/_virtual/_rollupPluginBabelHelpers.js +504 -0
- package/es/components/material-exercise/MaterialExercise.js +33 -54
- package/es/components/material-exercise/MaterialExercise.styled.js +20 -23
- package/es/components/material-exercise/MaterialExerciseMobile.js +15 -13
- package/es/components/material-exercise/context/ExerciseIntlProvider.js +9 -13
- package/es/components/material-exercise/context/ExerciseProvider.js +79 -79
- package/es/components/material-exercise/context/ExerciseProviderNoImage.js +11 -13
- package/es/components/material-exercise/context/context.js +1 -1
- package/es/components/material-exercise/context/recoil.js +560 -372
- package/es/components/material-exercise/context/recoilTypes.js +0 -5
- package/es/components/material-exercise/context/subjects.js +3 -6
- package/es/components/material-exercise/exercise-code-history/ExerciseCodeHistory.d.ts +2 -2
- package/es/components/material-exercise/exercise-code-history/ExerciseCodeHistory.js +73 -62
- package/es/components/material-exercise/exercise-code-history/ExerciseCodeHistory.styled.js +8 -8
- package/es/components/material-exercise/exercise-code-history/locales/en.json.js +3 -0
- package/es/components/material-exercise/exercise-code-history/locales/ko.json.js +3 -0
- package/es/components/material-exercise/exercise-file/ExerciseFile.js +15 -18
- package/es/components/material-exercise/exercise-file-editor/ExerciseFileEditor.js +218 -193
- package/es/components/material-exercise/exercise-file-editor/ExerciseFileReadOnlyBanner.js +5 -9
- package/es/components/material-exercise/exercise-file-tabs/ExerciseFileTabs.js +31 -28
- package/es/components/material-exercise/exercise-file-tabs/ExerciseFileTabsFileTreeButton.js +52 -45
- package/es/components/material-exercise/exercise-file-tabs/ExerciseFileTabsLazy.js +1 -1
- package/es/components/material-exercise/exercise-file-tree/ExerciseFileTree.js +321 -225
- package/es/components/material-exercise/exercise-file-tree/ExerciseFileTreeLazy.js +1 -1
- package/es/components/material-exercise/exercise-file-viewer/ExerciseFileViewer.js +12 -14
- package/es/components/material-exercise/exercise-menu/ExerciseMenu.js +7 -10
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.js +3 -5
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.js +43 -36
- package/es/components/material-exercise/exercise-menu/ExerciseMenuDropdown.js +53 -37
- package/es/components/material-exercise/exercise-menu/ExerciseMenuReset.js +25 -20
- package/es/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.js +41 -54
- package/es/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.styled.js +12 -12
- package/es/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdown.js +25 -19
- package/es/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdownLazy.js +1 -1
- package/es/components/material-exercise/exercise-preview/ExercisePreview.js +21 -34
- package/es/components/material-exercise/exercise-preview/ExercisePreviewDisplayModeButton.js +13 -10
- package/es/components/material-exercise/exercise-rightpane/ExerciseRightpane.js +17 -28
- package/es/components/material-exercise/exercise-rightpane/ExerciseRightpaneEditorPerference.js +9 -6
- package/es/components/material-exercise/exercise-rightpane/ExerciseRightpaneEnvironment.js +81 -82
- package/es/components/material-exercise/exercise-room/ExerciseRoom.js +13 -7
- package/es/components/material-exercise/exercise-room/ExerciseRoom.styled.js +14 -12
- package/es/components/material-exercise/exercise-room/ExerciseRoomDetail.js +236 -146
- package/es/components/material-exercise/exercise-room/ExerciseRoomList.js +90 -63
- package/es/components/material-exercise/exercise-room/helpers/exerciseRoomPermissionStringConvertor.js +2 -8
- package/es/components/material-exercise/exercise-runner/ExerciseRunner.js +212 -215
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerContext.js +1 -1
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerController.js +7 -9
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.js +27 -25
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.js +22 -24
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +66 -93
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.js +24 -26
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerRunningInfo.js +51 -59
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerStatusIndicator.js +2 -4
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerStatusMessage.js +6 -11
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerTimer.js +26 -25
- package/es/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.d.ts +2 -2
- package/es/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.js +284 -174
- package/es/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.styled.js +8 -8
- package/es/components/material-exercise/exercise-submit-history/ExerciseSubmitHistoryOutput.js +38 -44
- package/es/components/material-exercise/exercise-submit-history/locales/en.json.js +3 -0
- package/es/components/material-exercise/exercise-submit-history/locales/ko.json.js +3 -0
- package/es/components/shared/exercise-menu-button/ExerciseMenuButton.js +16 -16
- package/es/components/shared/exercise-shimmer/ExerciseFileShimmer.js +2 -3
- package/es/components/shared/exercise-shimmer/ExerciseFileTabShimmer.js +12 -13
- package/es/components/shared/exercise-shimmer/ExerciseFileTabsShimmer.js +2 -3
- package/es/components/shared/exercise-shimmer/ExerciseFileTreeListItemShimmer.js +14 -15
- package/es/components/shared/exercise-shimmer/ExerciseFileTreeListShimmer.js +15 -10
- package/es/components/shared/exercise-version-list/ExerciseVersionList.js +2 -3
- package/es/components/shared/exercise-version-list/ExerciseVersionList.styled.js +1 -1
- package/es/components/shared/exercise-version-list/ExerciseVersionListItem.js +5 -6
- package/es/components/shared/exercise-version-list/ExerciseVersionListItem.styled.js +9 -5
- package/es/components/shared/file-icon/FileIcon.js +20 -22
- package/es/components/shared/file-tabs/FileTab.js +28 -41
- package/es/components/shared/file-tabs/FileTab.styled.js +26 -22
- package/es/components/shared/file-tabs/FileTabs.js +52 -48
- package/es/components/shared/file-tabs/FileTabs.styled.js +2 -2
- package/es/components/shared/file-tabs/util.js +29 -18
- package/es/components/shared/file-tree/FileTree.js +3 -5
- package/es/components/shared/file-tree/FileTreeConfig.js +21 -22
- package/es/components/shared/file-tree/FileTreeList.js +31 -39
- package/es/components/shared/file-tree/FileTreeListItemContent.js +67 -85
- package/es/components/shared/file-tree/FileTreeListItemContent.styled.js +29 -40
- package/es/components/shared/file-tree/FileTreeListItemContentInput.js +74 -100
- package/es/components/shared/file-tree/FileTreeListItemContentInput.styled.js +6 -6
- package/es/components/shared/file-tree/FileTreeListItemContentMenu.js +48 -85
- package/es/components/shared/file-tree/FileTreeListItems.js +147 -152
- package/es/components/shared/file-tree/FileTreeListItems.styled.js +2 -2
- package/es/components/shared/file-tree/FileTreeToolbar.js +24 -37
- package/es/components/shared/file-tree/FileTreeToolbar.styled.js +1 -1
- package/es/components/shared/file-tree/context/FileTreeContext.js +91 -97
- package/es/components/shared/file-tree/utils/fileTreeFiles.js +20 -22
- package/es/components/shared/file-tree/utils/fileTreeGenerator.js +193 -173
- package/es/components/shared/file-tree/utils/fileTreeInput.js +0 -1
- package/es/components/shared/file-tree/utils/fileTreeItem.js +1 -1
- package/es/components/shared/file-tree/utils/fileTreePath.js +5 -7
- package/es/components/shared/file-viewer/FileViewer.js +52 -53
- package/es/components/shared/file-viewer/FileViewerCsv.js +141 -99
- package/es/components/shared/file-viewer/FileViewerImage.js +3 -6
- package/es/components/shared/file-viewer/FileViewerIpynb.js +16 -12
- package/es/components/shared/file-viewer/FileViewerNonViewable.js +22 -30
- package/es/components/shared/file-viewer/FileViewerText.js +18 -13
- package/es/components/shared/material-modal/MaterialModal.js +7 -11
- package/es/components/shared/material-modal/MaterialModal.styled.js +5 -5
- package/es/components/shared/monaco-editor/MonacoEditor.js +119 -147
- package/es/components/shared/monaco-editor/MonacoEditorLazy.js +6 -4
- package/es/components/shared/monaco-editor/MonacoEditorMobile.js +45 -56
- package/es/components/shared/monaco-editor/MonacoEditorPerferenceForm.js +73 -82
- package/es/components/shared/monaco-editor/constants/grammars/index.js +131 -52
- package/es/components/shared/monaco-editor/constants/monaco/preferences.js +5 -9
- package/es/components/shared/monaco-editor/constants/themes/index.js +80 -32
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoEventChange.js +10 -13
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoEventCursor.js +14 -18
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoEventScroll.js +8 -9
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoMarkers.js +54 -72
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoOptions.js +14 -15
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoTheme.js +8 -9
- package/es/components/shared/monaco-editor/editor-languages/css/formatter.js +33 -11
- package/es/components/shared/monaco-editor/editor-languages/css/index.js +2 -5
- package/es/components/shared/monaco-editor/editor-languages/html/formatter.js +33 -11
- package/es/components/shared/monaco-editor/editor-languages/html/index.js +2 -5
- package/es/components/shared/monaco-editor/editor-languages/typescript/dts/_helper.js +1 -1
- package/es/components/shared/monaco-editor/editor-languages/typescript/dts/express.js +0 -1
- package/es/components/shared/monaco-editor/editor-languages/typescript/dts/propTypes.js +0 -1
- package/es/components/shared/monaco-editor/editor-languages/typescript/dts/react.js +0 -1
- package/es/components/shared/monaco-editor/editor-languages/typescript/formatter.js +33 -11
- package/es/components/shared/monaco-editor/editor-languages/typescript/index.js +10 -16
- package/es/components/shared/monaco-editor/hooks/useEditorOptions.js +12 -9
- package/es/components/shared/monaco-editor/utils/emmet/abbreviationActions.js +18 -28
- package/es/components/shared/monaco-editor/utils/emmet/emmet.js +0 -3
- package/es/components/shared/monaco-editor/utils/emmet/registerProvider.js +12 -8
- package/es/components/shared/monaco-editor/utils/grammar/index.js +67 -31
- package/es/components/shared/monaco-editor/utils/grammar/onigasm.js +25 -7
- package/es/components/shared/monaco-editor/utils/grammar/textmate.js +67 -43
- package/es/components/shared/monaco-editor/utils/monacoLanguage.js +9 -19
- package/es/components/shared/monaco-editor/utils/monacoPreference.js +6 -5
- package/es/components/shared/monaco-editor/utils/prettier/config.js +2 -3
- package/es/components/shared/monaco-editor/utils/prettier/index.js +27 -8
- package/es/components/shared/monaco-editor/utils/theme/convert.js +20 -26
- package/es/components/shared/monaco-editor/utils/theme/index.js +22 -5
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursor.js +77 -75
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursorManager.js +82 -93
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursorWidget.js +125 -135
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteSelection.js +148 -160
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteSelectionManager.js +104 -118
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/styles.js +2 -2
- package/es/components/shared/monaco-editor/vendors/vscode-emmet-helper/configCompat.js +1 -3
- package/es/components/shared/monaco-editor/vendors/vscode-emmet-helper/data.js +2 -3
- package/es/components/shared/monaco-editor/vendors/vscode-emmet-helper/emmetHelper.js +219 -330
- package/es/components/shared/monaco-editor/vendors/vscode-emmet-helper/utils.js +3 -6
- package/es/components/shared/no-vnc/NoVnc.js +89 -88
- package/es/components/shared/no-vnc/NoVncLazy.js +4 -2
- package/es/components/shared/preview-container/PreviewContainer.js +7 -10
- package/es/components/shared/web-browser/WebBrowser.js +49 -56
- package/es/components/shared/xterm/Xterm.js +107 -102
- package/es/components/shared/xterm/XtermLazy.js +4 -2
- package/es/constants/arduino.js +10 -10
- package/es/constants/shortcutKeyMap.js +3 -5
- package/es/constants/stylesheets.js +7 -10
- package/es/hooks/useArduino.js +327 -255
- package/es/hooks/useExerciseFile.js +24 -24
- package/es/hooks/useExericseShortcut.js +6 -5
- package/es/hooks/useMaterialExerciseFileUrl.js +55 -38
- package/es/hooks/useRunnerRoomWebSocket.js +58 -56
- package/es/hooks/useStdioTextConcator.js +18 -12
- package/es/hooks/useStdioWebSocket.js +41 -67
- package/es/hooks/useUsercodeEditWebSocket.js +230 -252
- package/es/hooks/useUsercodeHistory.js +122 -83
- package/es/utils/arduino.js +23 -25
- package/es/utils/exerciseFile.js +8 -16
- package/es/utils/runner.js +29 -25
- package/package.json +8 -8
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _rollupPluginBabelHelpers = require('../../../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
5
6
|
var expand = require('emmet');
|
|
6
7
|
var data = require('./data.js');
|
|
7
8
|
var configCompat = require('./configCompat.js');
|
|
@@ -10,99 +11,79 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
11
|
|
|
11
12
|
var expand__default = /*#__PURE__*/_interopDefaultLegacy(expand);
|
|
12
13
|
|
|
13
|
-
/*
|
|
14
|
-
* These codes forked and modified from `microsoft/vscode-emmet-helper`
|
|
15
|
-
* under the terms of the MIT license.
|
|
16
|
-
* Make sure to check the original project if any issue exists.
|
|
17
|
-
* - project: https://github.com/microsoft/vscode-emmet-helper
|
|
18
|
-
* - codes: https://github.com/microsoft/vscode-emmet-helper/blob/e64481648451f0189216794979ce2ace82ee8148/src/emmetHelper.ts
|
|
19
|
-
* ==================================================================================================== */
|
|
14
|
+
// /* workaround for webpack issue: https://github.com/webpack/webpack/issues/5756
|
|
20
15
|
// @emmetio/extract-abbreviation has a cjs that uses a default export
|
|
21
16
|
// */
|
|
22
17
|
// const extract = typeof _extractAbbreviation === 'function' ? _extractAbbreviation : _extractAbbreviation.default;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const maxFilters = 3;
|
|
18
|
+
var snippetKeyCache = new Map();
|
|
19
|
+
var markupSnippetKeys;
|
|
20
|
+
var stylesheetCustomSnippetsKeyCache = new Map();
|
|
21
|
+
var htmlAbbreviationStartRegex = /^[a-z,A-Z,!,(,[,#,\.\{]/;
|
|
22
|
+
// take off { for jsx because it interferes with the language
|
|
23
|
+
var jsxAbbreviationStartRegex = /^[a-z,A-Z,!,(,[,#,\.]/;
|
|
24
|
+
var cssAbbreviationRegex = /^-?[a-z,A-Z,!,@,#]/;
|
|
25
|
+
var htmlAbbreviationRegex = /[a-z,A-Z\.]/;
|
|
26
|
+
var commonlyUsedTags = [].concat(_rollupPluginBabelHelpers.toConsumableArray(data.htmlData.tags), ['lorem']);
|
|
27
|
+
var bemFilterSuffix = 'bem';
|
|
28
|
+
var filterDelimitor = '|';
|
|
29
|
+
var trimFilterSuffix = 't';
|
|
30
|
+
var commentFilterSuffix = 'c';
|
|
31
|
+
var maxFilters = 3;
|
|
38
32
|
/**
|
|
39
33
|
* Returns all applicable emmet expansions for abbreviation at given position in a CompletionList
|
|
40
34
|
*/
|
|
41
|
-
|
|
42
35
|
function doComplete(_monaco, model, position, syntax, emmetConfig) {
|
|
43
36
|
var _a, _b;
|
|
44
|
-
|
|
45
37
|
if (emmetConfig.showExpandedAbbreviation === 'never' || !getEmmetMode(syntax, emmetConfig.excludeLanguages)) {
|
|
46
38
|
return;
|
|
47
39
|
}
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
var isStyleSheetRes = isStyleSheet(syntax);
|
|
41
|
+
// Fetch markupSnippets so that we can provide possible abbreviation completions
|
|
50
42
|
// For example, when text at position is `a`, completions should return `a:blank`, `a:link`, `acr` etc.
|
|
51
|
-
|
|
52
43
|
if (!isStyleSheetRes) {
|
|
53
44
|
if (!snippetKeyCache.has(syntax)) {
|
|
54
|
-
|
|
45
|
+
var registry = (_a = customSnippetsRegistry[syntax]) !== null && _a !== void 0 ? _a : getDefaultSnippets(syntax);
|
|
55
46
|
snippetKeyCache.set(syntax, Object.keys(registry));
|
|
56
47
|
}
|
|
57
|
-
|
|
58
48
|
markupSnippetKeys = (_b = snippetKeyCache.get(syntax)) !== null && _b !== void 0 ? _b : [];
|
|
59
49
|
}
|
|
60
|
-
|
|
61
|
-
const extractOptions = {
|
|
50
|
+
var extractOptions = {
|
|
62
51
|
lookAhead: !isStyleSheetRes,
|
|
63
52
|
type: isStyleSheetRes ? 'stylesheet' : 'markup'
|
|
64
53
|
};
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
var extractedValue = extractAbbreviation(_monaco, model, position, extractOptions);
|
|
67
55
|
if (!extractedValue) {
|
|
68
56
|
return;
|
|
69
57
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const currentWord = getCurrentWord(currentLineTillPosition); // Don't attempt to expand open tags
|
|
78
|
-
|
|
79
|
-
if (currentWord === abbreviation && currentLineTillPosition.endsWith(`<${abbreviation}`) && configCompat.syntaxes.markup.includes(syntax)) {
|
|
58
|
+
var abbreviationRange = extractedValue.abbreviationRange,
|
|
59
|
+
abbreviation = extractedValue.abbreviation,
|
|
60
|
+
filter = extractedValue.filter;
|
|
61
|
+
var currentLineTillPosition = getCurrentLine(model, position).substr(0, position.column - 1);
|
|
62
|
+
var currentWord = getCurrentWord(currentLineTillPosition);
|
|
63
|
+
// Don't attempt to expand open tags
|
|
64
|
+
if (currentWord === abbreviation && currentLineTillPosition.endsWith("<".concat(abbreviation)) && configCompat.syntaxes.markup.includes(syntax)) {
|
|
80
65
|
return;
|
|
81
66
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
67
|
+
var expandOptions = getExpandOptions(syntax, emmetConfig, filter);
|
|
68
|
+
var expandedText = "";
|
|
69
|
+
var expandedAbbr;
|
|
70
|
+
var completionItems = [];
|
|
71
|
+
// Create completion item after expanding given abbreviation
|
|
87
72
|
// if abbreviation is valid and expanded value is not noise
|
|
88
|
-
|
|
89
|
-
const createExpandedAbbr = (syntax, abbr) => {
|
|
73
|
+
var createExpandedAbbr = function createExpandedAbbr(syntax, abbr) {
|
|
90
74
|
if (!isAbbreviationValid(syntax, abbreviation)) {
|
|
91
75
|
return;
|
|
92
76
|
}
|
|
93
|
-
|
|
94
77
|
try {
|
|
95
|
-
expandedText = expand__default["default"](abbr, expandOptions);
|
|
96
|
-
|
|
78
|
+
expandedText = expand__default["default"](abbr, expandOptions);
|
|
79
|
+
// manually patch https://github.com/microsoft/vscode/issues/120245 for now
|
|
97
80
|
if (isStyleSheetRes && '!important'.startsWith(abbr)) {
|
|
98
81
|
expandedText = '!important';
|
|
99
82
|
}
|
|
100
83
|
} catch (e) {}
|
|
101
|
-
|
|
102
84
|
if (!expandedText || isExpandedTextNoise(syntax, abbr, expandedText, expandOptions.options)) {
|
|
103
85
|
return;
|
|
104
86
|
}
|
|
105
|
-
|
|
106
87
|
expandedAbbr = {
|
|
107
88
|
kind: _monaco.languages.CompletionItemKind.Property,
|
|
108
89
|
label: abbreviation + (filter ? '|' + filter.replace(',', '|') : ''),
|
|
@@ -114,33 +95,35 @@ function doComplete(_monaco, model, position, syntax, emmetConfig) {
|
|
|
114
95
|
};
|
|
115
96
|
completionItems = [expandedAbbr];
|
|
116
97
|
};
|
|
117
|
-
|
|
118
98
|
if (isStyleSheet(syntax)) {
|
|
119
|
-
createExpandedAbbr(syntax, abbreviation);
|
|
120
|
-
|
|
121
|
-
if (abbreviation.length > 4 && data.cssData.properties.find(
|
|
99
|
+
createExpandedAbbr(syntax, abbreviation);
|
|
100
|
+
// When abbr is longer than usual emmet snippets and matches better with existing css property, then no emmet
|
|
101
|
+
if (abbreviation.length > 4 && data.cssData.properties.find(function (x) {
|
|
102
|
+
return x.startsWith(abbreviation);
|
|
103
|
+
})) {
|
|
122
104
|
return {
|
|
123
105
|
suggestions: [],
|
|
124
106
|
incomplete: true
|
|
125
107
|
};
|
|
126
108
|
}
|
|
127
|
-
|
|
128
109
|
if (expandedAbbr && expandedText.length) {
|
|
129
110
|
expandedAbbr.range = abbreviationRange;
|
|
130
111
|
expandedAbbr.insertText = escapeNonTabStopDollar(addFinalTabStop(expandedText));
|
|
131
112
|
expandedAbbr.documentation = replaceTabStopsWithCursors(expandedText);
|
|
132
113
|
expandedAbbr.label = removeTabStops(expandedText);
|
|
133
|
-
expandedAbbr.filterText = abbreviation;
|
|
134
|
-
|
|
135
|
-
|
|
114
|
+
expandedAbbr.filterText = abbreviation;
|
|
115
|
+
// Custom snippets should show up in completions if abbreviation is a prefix
|
|
116
|
+
var stylesheetCustomSnippetsKeys = stylesheetCustomSnippetsKeyCache.has(syntax) ? stylesheetCustomSnippetsKeyCache.get(syntax) : stylesheetCustomSnippetsKeyCache.get('css');
|
|
136
117
|
completionItems = makeSnippetSuggestion(_monaco, stylesheetCustomSnippetsKeys !== null && stylesheetCustomSnippetsKeys !== void 0 ? stylesheetCustomSnippetsKeys : [], abbreviation, abbreviation, abbreviationRange, expandOptions, 'Emmet Custom Snippet', false);
|
|
137
|
-
|
|
138
|
-
|
|
118
|
+
if (!completionItems.find(function (x) {
|
|
119
|
+
return x.insertText === (expandedAbbr === null || expandedAbbr === void 0 ? void 0 : expandedAbbr.insertText);
|
|
120
|
+
})) {
|
|
139
121
|
// Fix for https://github.com/Microsoft/vscode/issues/28933#issuecomment-309236902
|
|
140
122
|
// When user types in propertyname, emmet uses it to match with snippet names, resulting in width -> widows or font-family -> font: family
|
|
141
123
|
// Filter out those cases here.
|
|
142
|
-
|
|
143
|
-
|
|
124
|
+
var abbrRegex = new RegExp('.*' + abbreviation.split('').map(function (x) {
|
|
125
|
+
return x === '$' || x === '+' ? '\\' + x : x;
|
|
126
|
+
}).join('.*') + '.*', 'i');
|
|
144
127
|
if (/\d/.test(abbreviation) || abbrRegex.test(expandedAbbr.label)) {
|
|
145
128
|
completionItems.push(expandedAbbr);
|
|
146
129
|
}
|
|
@@ -148,44 +131,43 @@ function doComplete(_monaco, model, position, syntax, emmetConfig) {
|
|
|
148
131
|
}
|
|
149
132
|
} else {
|
|
150
133
|
createExpandedAbbr(syntax, abbreviation);
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
134
|
+
var tagToFindMoreSuggestionsFor = abbreviation;
|
|
135
|
+
var newTagMatches = /(>|\+)([\w:-]+)$/.exec(abbreviation);
|
|
154
136
|
if (newTagMatches && newTagMatches.length === 3) {
|
|
155
137
|
tagToFindMoreSuggestionsFor = newTagMatches[2];
|
|
156
138
|
}
|
|
157
|
-
|
|
158
139
|
if (syntax !== 'xml') {
|
|
159
|
-
|
|
140
|
+
var commonlyUsedTagSuggestions = makeSnippetSuggestion(_monaco, commonlyUsedTags, tagToFindMoreSuggestionsFor, abbreviation, abbreviationRange, expandOptions, 'Emmet Abbreviation');
|
|
160
141
|
completionItems = completionItems.concat(commonlyUsedTagSuggestions);
|
|
161
142
|
}
|
|
162
|
-
|
|
163
143
|
if (emmetConfig.showAbbreviationSuggestions === true) {
|
|
164
|
-
|
|
165
|
-
|
|
144
|
+
var abbreviationSuggestions = makeSnippetSuggestion(_monaco, markupSnippetKeys.filter(function (x) {
|
|
145
|
+
return !commonlyUsedTags.includes(x);
|
|
146
|
+
}), tagToFindMoreSuggestionsFor, abbreviation, abbreviationRange, expandOptions, 'Emmet Abbreviation');
|
|
147
|
+
// Workaround for the main expanded abbr not appearing before the snippet suggestions
|
|
166
148
|
if (expandedAbbr && abbreviationSuggestions.length > 0 && tagToFindMoreSuggestionsFor !== abbreviation) {
|
|
167
149
|
expandedAbbr.sortText = '0' + expandedAbbr.label;
|
|
168
|
-
abbreviationSuggestions.forEach(item
|
|
150
|
+
abbreviationSuggestions.forEach(function (item) {
|
|
169
151
|
// Workaround for snippet suggestions items getting filtered out as the complete abbr does not start with snippetKey
|
|
170
|
-
item.filterText = abbreviation;
|
|
171
|
-
|
|
152
|
+
item.filterText = abbreviation;
|
|
153
|
+
// Workaround for the main expanded abbr not appearing before the snippet suggestions
|
|
172
154
|
item.sortText = '9' + abbreviation;
|
|
173
155
|
});
|
|
174
156
|
}
|
|
175
|
-
|
|
176
157
|
completionItems = completionItems.concat(abbreviationSuggestions);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
158
|
+
}
|
|
159
|
+
// https://github.com/microsoft/vscode/issues/66680
|
|
160
|
+
if (syntax === 'html' && completionItems.length >= 2 && abbreviation.includes(":") && (expandedAbbr === null || expandedAbbr === void 0 ? void 0 : expandedAbbr.insertText) === "<".concat(abbreviation, ">${0}</").concat(abbreviation, ">")) {
|
|
161
|
+
completionItems = completionItems.filter(function (item) {
|
|
162
|
+
return item.label !== abbreviation;
|
|
163
|
+
});
|
|
182
164
|
}
|
|
183
165
|
}
|
|
184
|
-
|
|
185
166
|
if (emmetConfig.showSuggestionsAsSnippets === true) {
|
|
186
|
-
completionItems.forEach(
|
|
167
|
+
completionItems.forEach(function (x) {
|
|
168
|
+
return x.kind = _monaco.languages.CompletionItemKind.Snippet;
|
|
169
|
+
});
|
|
187
170
|
}
|
|
188
|
-
|
|
189
171
|
return completionItems.length ? {
|
|
190
172
|
suggestions: completionItems,
|
|
191
173
|
incomplete: true
|
|
@@ -194,30 +176,25 @@ function doComplete(_monaco, model, position, syntax, emmetConfig) {
|
|
|
194
176
|
/**
|
|
195
177
|
* Create & return snippets for snippet keys that start with given prefix
|
|
196
178
|
*/
|
|
197
|
-
|
|
198
|
-
|
|
179
|
+
function makeSnippetSuggestion(_monaco, snippetKeys, prefix, abbreviation, abbreviationRange, expandOptions, snippetDetail) {
|
|
180
|
+
var skipFullMatch = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
|
|
199
181
|
if (!prefix || !snippetKeys) {
|
|
200
182
|
return [];
|
|
201
183
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
snippetKeys.forEach(snippetKey => {
|
|
184
|
+
var snippetCompletions = [];
|
|
185
|
+
snippetKeys.forEach(function (snippetKey) {
|
|
205
186
|
if (!snippetKey.startsWith(prefix.toLowerCase()) || skipFullMatch && snippetKey === prefix.toLowerCase()) {
|
|
206
187
|
return;
|
|
207
188
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
let expandedAbbr;
|
|
211
|
-
|
|
189
|
+
var currentAbbr = abbreviation + snippetKey.substr(prefix.length);
|
|
190
|
+
var expandedAbbr;
|
|
212
191
|
try {
|
|
213
192
|
expandedAbbr = expand__default["default"](currentAbbr, expandOptions);
|
|
214
193
|
} catch (e) {}
|
|
215
|
-
|
|
216
194
|
if (!expandedAbbr) {
|
|
217
195
|
return;
|
|
218
196
|
}
|
|
219
|
-
|
|
220
|
-
const item = {
|
|
197
|
+
var item = {
|
|
221
198
|
kind: _monaco.languages.CompletionItemKind.Property,
|
|
222
199
|
label: prefix + snippetKey.substr(prefix.length),
|
|
223
200
|
documentation: replaceTabStopsWithCursors(expandedAbbr),
|
|
@@ -230,73 +207,58 @@ function makeSnippetSuggestion(_monaco, snippetKeys, prefix, abbreviation, abbre
|
|
|
230
207
|
});
|
|
231
208
|
return snippetCompletions;
|
|
232
209
|
}
|
|
233
|
-
|
|
234
210
|
function getCurrentWord(currentLineTillPosition) {
|
|
235
211
|
if (currentLineTillPosition) {
|
|
236
|
-
|
|
237
|
-
|
|
212
|
+
var matches = /[\w,:,-,\.]*$/.exec(currentLineTillPosition);
|
|
238
213
|
if (matches) {
|
|
239
214
|
return matches[0];
|
|
240
215
|
}
|
|
241
216
|
}
|
|
242
217
|
}
|
|
243
|
-
|
|
244
218
|
function replaceTabStopsWithCursors(expandedWord) {
|
|
245
219
|
return expandedWord.replace(/([^\\])\$\{\d+\}/g, '$1|').replace(/\$\{\d+:([^\}]+)\}/g, '$1');
|
|
246
220
|
}
|
|
247
|
-
|
|
248
221
|
function removeTabStops(expandedWord) {
|
|
249
222
|
return expandedWord.replace(/([^\\])\$\{\d+\}/g, '$1').replace(/\$\{\d+:([^\}]+)\}/g, '$1');
|
|
250
223
|
}
|
|
251
|
-
|
|
252
224
|
function escapeNonTabStopDollar(text) {
|
|
253
225
|
return text ? text.replace(/([^\\])(\$)([^\{])/g, '$1\\$2$3') : text;
|
|
254
226
|
}
|
|
255
|
-
|
|
256
227
|
function addFinalTabStop(text) {
|
|
257
228
|
if (!text || !text.trim()) {
|
|
258
229
|
return text;
|
|
259
230
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const n = text.length;
|
|
267
|
-
|
|
231
|
+
var maxTabStop = -1;
|
|
232
|
+
var maxTabStopRanges = [];
|
|
233
|
+
var foundLastStop = false;
|
|
234
|
+
var replaceWithLastStop = false;
|
|
235
|
+
var i = 0;
|
|
236
|
+
var n = text.length;
|
|
268
237
|
try {
|
|
269
238
|
while (i < n && !foundLastStop) {
|
|
270
239
|
// Look for ${
|
|
271
240
|
if (text[i++] != '$' || text[i++] != '{') {
|
|
272
241
|
continue;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
let numberEnd = -1;
|
|
278
|
-
|
|
242
|
+
}
|
|
243
|
+
// Find tabstop
|
|
244
|
+
var numberStart = -1;
|
|
245
|
+
var numberEnd = -1;
|
|
279
246
|
while (i < n && /\d/.test(text[i])) {
|
|
280
247
|
numberStart = numberStart < 0 ? i : numberStart;
|
|
281
248
|
numberEnd = i + 1;
|
|
282
249
|
i++;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
250
|
+
}
|
|
251
|
+
// If ${ was not followed by a number and either } or :, then its not a tabstop
|
|
286
252
|
if (numberStart === -1 || numberEnd === -1 || i >= n || text[i] != '}' && text[i] != ':') {
|
|
287
253
|
continue;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
const currentTabStop = text.substring(numberStart, numberEnd);
|
|
254
|
+
}
|
|
255
|
+
// If ${0} was found, then break
|
|
256
|
+
var currentTabStop = text.substring(numberStart, numberEnd);
|
|
292
257
|
foundLastStop = currentTabStop === '0';
|
|
293
|
-
|
|
294
258
|
if (foundLastStop) {
|
|
295
259
|
break;
|
|
296
260
|
}
|
|
297
|
-
|
|
298
|
-
let foundPlaceholder = false;
|
|
299
|
-
|
|
261
|
+
var foundPlaceholder = false;
|
|
300
262
|
if (text[i++] == ':') {
|
|
301
263
|
// TODO: Nested placeholders may break here
|
|
302
264
|
while (i < n) {
|
|
@@ -304,95 +266,84 @@ function addFinalTabStop(text) {
|
|
|
304
266
|
foundPlaceholder = true;
|
|
305
267
|
break;
|
|
306
268
|
}
|
|
307
|
-
|
|
308
269
|
i++;
|
|
309
270
|
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
|
|
271
|
+
}
|
|
272
|
+
// Decide to replace currentTabStop with ${0} only if its the max among all tabstops and is not a placeholder
|
|
313
273
|
if (Number(currentTabStop) > Number(maxTabStop)) {
|
|
314
274
|
maxTabStop = Number(currentTabStop);
|
|
315
275
|
maxTabStopRanges = [{
|
|
316
|
-
numberStart,
|
|
317
|
-
numberEnd
|
|
276
|
+
numberStart: numberStart,
|
|
277
|
+
numberEnd: numberEnd
|
|
318
278
|
}];
|
|
319
279
|
replaceWithLastStop = !foundPlaceholder;
|
|
320
280
|
} else if (Number(currentTabStop) === maxTabStop) {
|
|
321
281
|
maxTabStopRanges.push({
|
|
322
|
-
numberStart,
|
|
323
|
-
numberEnd
|
|
282
|
+
numberStart: numberStart,
|
|
283
|
+
numberEnd: numberEnd
|
|
324
284
|
});
|
|
325
285
|
}
|
|
326
286
|
}
|
|
327
287
|
} catch (e) {}
|
|
328
|
-
|
|
329
288
|
if (replaceWithLastStop && !foundLastStop) {
|
|
330
|
-
for (
|
|
331
|
-
|
|
332
|
-
|
|
289
|
+
for (var _i = 0; _i < maxTabStopRanges.length; _i++) {
|
|
290
|
+
var rangeStart = maxTabStopRanges[_i].numberStart;
|
|
291
|
+
var rangeEnd = maxTabStopRanges[_i].numberEnd;
|
|
333
292
|
text = text.substr(0, rangeStart) + '0' + text.substr(rangeEnd);
|
|
334
293
|
}
|
|
335
294
|
}
|
|
336
|
-
|
|
337
295
|
return text;
|
|
338
296
|
}
|
|
339
|
-
|
|
340
297
|
function getCurrentLine(model, position) {
|
|
341
|
-
|
|
298
|
+
var currentLine = model.getLineContent(position.lineNumber);
|
|
342
299
|
return currentLine;
|
|
343
300
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
301
|
+
var customSnippetsRegistry = {};
|
|
302
|
+
var variablesFromFile = {};
|
|
303
|
+
var profilesFromFile = {};
|
|
304
|
+
var emmetSnippetField = function emmetSnippetField(index, placeholder) {
|
|
305
|
+
return "${".concat(index).concat(placeholder ? ':' + placeholder : '', "}");
|
|
306
|
+
};
|
|
349
307
|
/** Returns whether or not syntax is a supported stylesheet syntax, like CSS */
|
|
350
|
-
|
|
351
308
|
function isStyleSheet(syntax) {
|
|
352
309
|
return configCompat.syntaxes.stylesheet.includes(syntax);
|
|
353
310
|
}
|
|
354
311
|
/** Returns the syntax type, either markup (e.g. for HTML) or stylesheet (e.g. for CSS) */
|
|
355
|
-
|
|
356
312
|
function getSyntaxType(syntax) {
|
|
357
313
|
return isStyleSheet(syntax) ? 'stylesheet' : 'markup';
|
|
358
314
|
}
|
|
359
315
|
/** Returns the default syntax (html or css) to use for the snippets registry */
|
|
360
|
-
|
|
361
316
|
function getDefaultSyntax(syntax) {
|
|
362
317
|
return isStyleSheet(syntax) ? 'css' : 'html';
|
|
363
318
|
}
|
|
364
319
|
/** Returns the default snippets that Emmet suggests */
|
|
365
|
-
|
|
366
320
|
function getDefaultSnippets(syntax) {
|
|
367
|
-
|
|
368
|
-
|
|
321
|
+
var syntaxType = getSyntaxType(syntax);
|
|
322
|
+
var emptyUserConfig = {
|
|
369
323
|
type: syntaxType,
|
|
370
|
-
syntax
|
|
324
|
+
syntax: syntax
|
|
371
325
|
};
|
|
372
|
-
|
|
326
|
+
var resolvedConfig = expand.resolveConfig(emptyUserConfig);
|
|
327
|
+
// https://github.com/microsoft/vscode/issues/97632
|
|
373
328
|
// don't return markup (HTML) snippets for XML
|
|
374
|
-
|
|
375
329
|
return syntax === 'xml' ? {} : resolvedConfig.snippets;
|
|
376
330
|
}
|
|
377
|
-
|
|
378
331
|
function getFilters(text, pos) {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
if (text.endsWith(`${filterDelimitor}${bemFilterSuffix}`, pos)) {
|
|
332
|
+
var filter;
|
|
333
|
+
for (var i = 0; i < maxFilters; i++) {
|
|
334
|
+
if (text.endsWith("".concat(filterDelimitor).concat(bemFilterSuffix), pos)) {
|
|
383
335
|
pos -= bemFilterSuffix.length + 1;
|
|
384
336
|
filter = filter ? bemFilterSuffix + ',' + filter : bemFilterSuffix;
|
|
385
|
-
} else if (text.endsWith(
|
|
337
|
+
} else if (text.endsWith("".concat(filterDelimitor).concat(commentFilterSuffix), pos)) {
|
|
386
338
|
pos -= commentFilterSuffix.length + 1;
|
|
387
339
|
filter = filter ? commentFilterSuffix + ',' + filter : commentFilterSuffix;
|
|
388
|
-
} else if (text.endsWith(
|
|
340
|
+
} else if (text.endsWith("".concat(filterDelimitor).concat(trimFilterSuffix), pos)) {
|
|
389
341
|
pos -= trimFilterSuffix.length + 1;
|
|
390
342
|
filter = filter ? trimFilterSuffix + ',' + filter : trimFilterSuffix;
|
|
391
343
|
} else {
|
|
392
344
|
break;
|
|
393
345
|
}
|
|
394
346
|
}
|
|
395
|
-
|
|
396
347
|
return {
|
|
397
348
|
pos: pos,
|
|
398
349
|
filter: filter
|
|
@@ -401,27 +352,22 @@ function getFilters(text, pos) {
|
|
|
401
352
|
/**
|
|
402
353
|
* Extracts abbreviation from the given position in the given document
|
|
403
354
|
*/
|
|
404
|
-
|
|
405
|
-
|
|
406
355
|
function extractAbbreviation(_monaco, model, position, options) {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
pos,
|
|
411
|
-
filter
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
const result = expand.extract(currentLine, pos, options);
|
|
415
|
-
|
|
356
|
+
var currentLine = model.getLineContent(position.lineNumber);
|
|
357
|
+
var currentLineTillPosition = currentLine.substr(0, position.column - 1);
|
|
358
|
+
var _getFilters = getFilters(currentLineTillPosition, position.column - 1),
|
|
359
|
+
pos = _getFilters.pos,
|
|
360
|
+
filter = _getFilters.filter;
|
|
361
|
+
var lengthOccupiedByFilter = filter ? filter.length + 1 : 0;
|
|
362
|
+
var result = expand.extract(currentLine, pos, options);
|
|
416
363
|
if (!result) {
|
|
417
364
|
return;
|
|
418
365
|
}
|
|
419
|
-
|
|
420
|
-
const rangeToReplace = new _monaco.Range(position.lineNumber, result.location + 1, position.lineNumber, result.location + result.abbreviation.length + lengthOccupiedByFilter + 1);
|
|
366
|
+
var rangeToReplace = new _monaco.Range(position.lineNumber, result.location + 1, position.lineNumber, result.location + result.abbreviation.length + lengthOccupiedByFilter + 1);
|
|
421
367
|
return {
|
|
422
368
|
abbreviationRange: rangeToReplace,
|
|
423
369
|
abbreviation: result.abbreviation,
|
|
424
|
-
filter
|
|
370
|
+
filter: filter
|
|
425
371
|
};
|
|
426
372
|
}
|
|
427
373
|
/**
|
|
@@ -430,126 +376,113 @@ function extractAbbreviation(_monaco, model, position, options) {
|
|
|
430
376
|
* @param syntax string
|
|
431
377
|
* @param abbreviation string
|
|
432
378
|
*/
|
|
433
|
-
|
|
434
379
|
function isAbbreviationValid(syntax, abbreviation) {
|
|
435
380
|
if (!abbreviation) {
|
|
436
381
|
return false;
|
|
437
382
|
}
|
|
438
|
-
|
|
439
383
|
if (isStyleSheet(syntax)) {
|
|
440
384
|
if (abbreviation.includes('#')) {
|
|
441
385
|
if (abbreviation.startsWith('#')) {
|
|
442
|
-
|
|
386
|
+
var hexColorRegex = /^#[\d,a-f,A-F]{1,6}$/;
|
|
443
387
|
return hexColorRegex.test(abbreviation);
|
|
444
388
|
} else if (commonlyUsedTags.includes(abbreviation.substring(0, abbreviation.indexOf('#')))) {
|
|
445
389
|
return false;
|
|
446
390
|
}
|
|
447
391
|
}
|
|
448
|
-
|
|
449
392
|
return cssAbbreviationRegex.test(abbreviation);
|
|
450
393
|
}
|
|
451
|
-
|
|
452
394
|
if (abbreviation.startsWith('!')) {
|
|
453
395
|
return !/[^!]/.test(abbreviation);
|
|
454
|
-
}
|
|
396
|
+
}
|
|
397
|
+
// Its common for users to type (sometextinsidebrackets), this should not be treated as an abbreviation
|
|
455
398
|
// Grouping in abbreviation is valid only if it's inside a text node or preceeded/succeeded with one of the symbols for nesting, sibling, repeater or climb up
|
|
456
|
-
|
|
457
|
-
|
|
458
399
|
if ((/\(/.test(abbreviation) || /\)/.test(abbreviation)) && !/\{[^\}\{]*[\(\)]+[^\}\{]*\}(?:[>\+\*\^]|$)/.test(abbreviation) && !/\(.*\)[>\+\*\^]/.test(abbreviation) && !/[>\+\*\^]\(.*\)/.test(abbreviation)) {
|
|
459
400
|
return false;
|
|
460
401
|
}
|
|
461
|
-
|
|
462
402
|
if (syntax === 'jsx') {
|
|
463
403
|
return jsxAbbreviationStartRegex.test(abbreviation) && htmlAbbreviationRegex.test(abbreviation);
|
|
464
404
|
}
|
|
465
|
-
|
|
466
405
|
return htmlAbbreviationStartRegex.test(abbreviation) && htmlAbbreviationRegex.test(abbreviation);
|
|
467
406
|
}
|
|
468
|
-
|
|
469
407
|
function isExpandedTextNoise(syntax, abbreviation, expandedText, options) {
|
|
470
|
-
var _a, _b;
|
|
408
|
+
var _a, _b;
|
|
409
|
+
// Unresolved css abbreviations get expanded to a blank property value
|
|
471
410
|
// Eg: abc -> abc: ; or abc:d -> abc: d; which is noise if it gets suggested for every word typed
|
|
472
|
-
|
|
473
|
-
|
|
474
411
|
if (isStyleSheet(syntax) && options) {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
412
|
+
var between = (_a = options['stylesheet.between']) !== null && _a !== void 0 ? _a : ': ';
|
|
413
|
+
var after = (_b = options['stylesheet.after']) !== null && _b !== void 0 ? _b : ';';
|
|
414
|
+
// Remove overlapping between `abbreviation` and `between`, if any
|
|
415
|
+
var endPrefixIndex = abbreviation.indexOf(between[0], Math.max(abbreviation.length - between.length, 0));
|
|
479
416
|
endPrefixIndex = endPrefixIndex >= 0 ? endPrefixIndex : abbreviation.length;
|
|
480
|
-
|
|
481
|
-
return expandedText ===
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
417
|
+
var abbr = abbreviation.substring(0, endPrefixIndex);
|
|
418
|
+
return expandedText === "".concat(abbr).concat(between, "${0}").concat(after) || expandedText.replace(/\s/g, '') === abbreviation.replace(/\s/g, '') + after;
|
|
419
|
+
}
|
|
420
|
+
// we don't want common html tags suggested for xml
|
|
421
|
+
if (syntax === 'xml' && commonlyUsedTags.some(function (tag) {
|
|
422
|
+
return tag.startsWith(abbreviation.toLowerCase());
|
|
423
|
+
})) {
|
|
486
424
|
return true;
|
|
487
425
|
}
|
|
488
|
-
|
|
489
426
|
if (commonlyUsedTags.includes(abbreviation.toLowerCase()) || markupSnippetKeys.includes(abbreviation)) {
|
|
490
427
|
return false;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
|
|
428
|
+
}
|
|
429
|
+
// Custom tags can have - or :
|
|
494
430
|
if (/[-,:]/.test(abbreviation) && !/--|::/.test(abbreviation) && !abbreviation.endsWith(':')) {
|
|
495
431
|
return false;
|
|
496
|
-
}
|
|
432
|
+
}
|
|
433
|
+
// Its common for users to type some text and end it with period, this should not be treated as an abbreviation
|
|
497
434
|
// Else it becomes noise.
|
|
498
435
|
// When user just types '.', return the expansion
|
|
499
436
|
// Otherwise emmet loses change to participate later
|
|
500
437
|
// For example in `.foo`. See https://github.com/Microsoft/vscode/issues/66013
|
|
501
|
-
|
|
502
|
-
|
|
503
438
|
if (abbreviation === '.') {
|
|
504
439
|
return false;
|
|
505
440
|
}
|
|
506
|
-
|
|
507
|
-
const dotMatches = /^([a-z,A-Z,\d]*)\.$/.exec(abbreviation);
|
|
508
|
-
|
|
441
|
+
var dotMatches = /^([a-z,A-Z,\d]*)\.$/.exec(abbreviation);
|
|
509
442
|
if (dotMatches) {
|
|
510
443
|
// Valid html tags such as `div.`
|
|
511
444
|
if (dotMatches[1] && data.htmlData.tags.includes(dotMatches[1])) {
|
|
512
445
|
return false;
|
|
513
446
|
}
|
|
514
|
-
|
|
515
447
|
return true;
|
|
516
|
-
}
|
|
448
|
+
}
|
|
449
|
+
// Fix for https://github.com/microsoft/vscode/issues/89746
|
|
517
450
|
// PascalCase tags are common in jsx code, which should not be treated as noise.
|
|
518
451
|
// Eg: MyAwesomComponent -> <MyAwesomComponent></MyAwesomComponent>
|
|
519
|
-
|
|
520
|
-
|
|
521
452
|
if (syntax === 'jsx' && /^([A-Z][A-Za-z0-9]*)+$/.test(abbreviation)) {
|
|
522
453
|
return false;
|
|
523
|
-
}
|
|
454
|
+
}
|
|
455
|
+
// Unresolved html abbreviations get expanded as if it were a tag
|
|
524
456
|
// Eg: abc -> <abc></abc> which is noise if it gets suggested for every word typed
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
return expandedText.toLowerCase() === `<${abbreviation.toLowerCase()}>\${1}</${abbreviation.toLowerCase()}>`;
|
|
457
|
+
return expandedText.toLowerCase() === "<".concat(abbreviation.toLowerCase(), ">${1}</").concat(abbreviation.toLowerCase(), ">");
|
|
528
458
|
}
|
|
529
459
|
/**
|
|
530
460
|
* Returns options to be used by emmet
|
|
531
461
|
*/
|
|
532
|
-
|
|
533
|
-
|
|
534
462
|
function getExpandOptions(syntax, emmetConfig, filter) {
|
|
535
463
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
536
|
-
|
|
537
464
|
emmetConfig = emmetConfig !== null && emmetConfig !== void 0 ? emmetConfig : {};
|
|
538
465
|
emmetConfig['preferences'] = (_a = emmetConfig['preferences']) !== null && _a !== void 0 ? _a : {};
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
466
|
+
var preferences = emmetConfig['preferences'];
|
|
467
|
+
var stylesheetSyntax = isStyleSheet(syntax) ? syntax : 'css';
|
|
468
|
+
// Fetch Profile
|
|
469
|
+
var profile = getProfile(syntax, (_b = emmetConfig['syntaxProfiles']) !== null && _b !== void 0 ? _b : {});
|
|
470
|
+
var filtersFromProfile = profile && profile['filters'] ? profile['filters'].split(',') : [];
|
|
471
|
+
var trimmedFilters = filtersFromProfile.map(function (filterFromProfile) {
|
|
472
|
+
return filterFromProfile.trim();
|
|
473
|
+
});
|
|
474
|
+
var bemEnabled = filter && filter.split(',').some(function (x) {
|
|
475
|
+
return x.trim() === 'bem';
|
|
476
|
+
}) || trimmedFilters.includes('bem');
|
|
477
|
+
var commentEnabled = filter && filter.split(',').some(function (x) {
|
|
478
|
+
return x.trim() === 'c';
|
|
479
|
+
}) || trimmedFilters.includes('c');
|
|
480
|
+
// Fetch formatters
|
|
481
|
+
var formatters = getFormatters(syntax, emmetConfig['preferences']);
|
|
482
|
+
var unitAliases = (formatters === null || formatters === void 0 ? void 0 : formatters.stylesheet) && formatters.stylesheet['unitAliases'] || {};
|
|
483
|
+
// These options are the default values provided by vscode for
|
|
550
484
|
// extension preferences
|
|
551
|
-
|
|
552
|
-
const defaultVSCodeOptions = {
|
|
485
|
+
var defaultVSCodeOptions = {
|
|
553
486
|
// inlineElements: string[],
|
|
554
487
|
// 'output.indent': string,
|
|
555
488
|
// 'output.baseIndent': string,
|
|
@@ -593,9 +526,9 @@ function getExpandOptions(syntax, emmetConfig, filter) {
|
|
|
593
526
|
// 'stylesheet.json': boolean,
|
|
594
527
|
// 'stylesheet.jsonDoubleQuotes': boolean,
|
|
595
528
|
'stylesheet.fuzzySearchMinScore': 0.3
|
|
596
|
-
};
|
|
597
|
-
|
|
598
|
-
|
|
529
|
+
};
|
|
530
|
+
// These options come from user prefs in the vscode repo
|
|
531
|
+
var userPreferenceOptions = {
|
|
599
532
|
// inlineElements: string[],
|
|
600
533
|
// 'output.indent': string,
|
|
601
534
|
// 'output.baseIndent': string,
|
|
@@ -626,8 +559,8 @@ function getExpandOptions(syntax, emmetConfig, filter) {
|
|
|
626
559
|
// 'stylesheet.keywords': string[],
|
|
627
560
|
// 'stylesheet.unitless': string[],
|
|
628
561
|
'stylesheet.shortHex': preferences['css.color.short'],
|
|
629
|
-
'stylesheet.between': preferences[
|
|
630
|
-
'stylesheet.after': preferences[
|
|
562
|
+
'stylesheet.between': preferences["".concat(stylesheetSyntax, ".valueSeparator")],
|
|
563
|
+
'stylesheet.after': preferences["".concat(stylesheetSyntax, ".propertyEnd")],
|
|
631
564
|
'stylesheet.intUnit': preferences['css.intUnit'],
|
|
632
565
|
'stylesheet.floatUnit': preferences['css.floatUnit'],
|
|
633
566
|
'stylesheet.unitAliases': unitAliases,
|
|
@@ -635,29 +568,28 @@ function getExpandOptions(syntax, emmetConfig, filter) {
|
|
|
635
568
|
// 'stylesheet.jsonDoubleQuotes': boolean,
|
|
636
569
|
'stylesheet.fuzzySearchMinScore': preferences['css.fuzzySearchMinScore']
|
|
637
570
|
};
|
|
638
|
-
|
|
639
|
-
[
|
|
571
|
+
var combinedOptions = {};
|
|
572
|
+
[].concat(_rollupPluginBabelHelpers.toConsumableArray(Object.keys(defaultVSCodeOptions)), _rollupPluginBabelHelpers.toConsumableArray(Object.keys(userPreferenceOptions))).forEach(function (key) {
|
|
640
573
|
var _a;
|
|
641
|
-
|
|
642
|
-
const castKey = key;
|
|
574
|
+
var castKey = key;
|
|
643
575
|
combinedOptions[castKey] = (_a = userPreferenceOptions[castKey]) !== null && _a !== void 0 ? _a : defaultVSCodeOptions[castKey];
|
|
644
576
|
});
|
|
645
|
-
|
|
577
|
+
var mergedAliases = Object.assign(Object.assign({}, defaultVSCodeOptions['stylesheet.unitAliases']), userPreferenceOptions['stylesheet.unitAliases']);
|
|
646
578
|
combinedOptions['stylesheet.unitAliases'] = mergedAliases;
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
579
|
+
var type = getSyntaxType(syntax);
|
|
580
|
+
var variables = getVariables(emmetConfig['variables']);
|
|
581
|
+
var baseSyntax = getDefaultSyntax(syntax);
|
|
582
|
+
var snippets = type === 'stylesheet' ? (_k = customSnippetsRegistry[syntax]) !== null && _k !== void 0 ? _k : customSnippetsRegistry[baseSyntax] : customSnippetsRegistry[syntax];
|
|
651
583
|
return {
|
|
652
|
-
type,
|
|
584
|
+
type: type,
|
|
653
585
|
options: combinedOptions,
|
|
654
|
-
variables,
|
|
655
|
-
snippets,
|
|
656
|
-
syntax,
|
|
586
|
+
variables: variables,
|
|
587
|
+
snippets: snippets,
|
|
588
|
+
syntax: syntax,
|
|
657
589
|
// context: null,
|
|
658
590
|
text: undefined,
|
|
659
|
-
maxRepeat: 1000
|
|
660
|
-
|
|
591
|
+
maxRepeat: 1000
|
|
592
|
+
// cache: null
|
|
661
593
|
};
|
|
662
594
|
}
|
|
663
595
|
|
|
@@ -665,16 +597,12 @@ function getClosingStyle(syntax) {
|
|
|
665
597
|
switch (syntax) {
|
|
666
598
|
case 'xhtml':
|
|
667
599
|
return 'xhtml';
|
|
668
|
-
|
|
669
600
|
case 'xml':
|
|
670
601
|
return 'xml';
|
|
671
|
-
|
|
672
602
|
case 'xsl':
|
|
673
603
|
return 'xml';
|
|
674
|
-
|
|
675
604
|
case 'jsx':
|
|
676
605
|
return 'xhtml';
|
|
677
|
-
|
|
678
606
|
default:
|
|
679
607
|
return 'html';
|
|
680
608
|
}
|
|
@@ -683,168 +611,134 @@ function getClosingStyle(syntax) {
|
|
|
683
611
|
* Maps and returns syntaxProfiles of previous format to ones compatible with new emmet modules
|
|
684
612
|
* @param syntax
|
|
685
613
|
*/
|
|
686
|
-
|
|
687
614
|
function getProfile(syntax, profilesFromSettings) {
|
|
688
615
|
if (!profilesFromSettings) {
|
|
689
616
|
profilesFromSettings = {};
|
|
690
617
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
const options = profilesConfig[syntax];
|
|
694
|
-
|
|
618
|
+
var profilesConfig = Object.assign({}, profilesFromFile, profilesFromSettings);
|
|
619
|
+
var options = profilesConfig[syntax];
|
|
695
620
|
if (!options || typeof options === 'string') {
|
|
696
621
|
if (options === 'xhtml') {
|
|
697
622
|
return {
|
|
698
623
|
selfClosingStyle: 'xhtml'
|
|
699
624
|
};
|
|
700
625
|
}
|
|
701
|
-
|
|
702
626
|
return {};
|
|
703
627
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
for (const key in options) {
|
|
628
|
+
var newOptions = {};
|
|
629
|
+
for (var key in options) {
|
|
708
630
|
switch (key) {
|
|
709
631
|
case 'tag_case':
|
|
710
632
|
newOptions['tagCase'] = options[key] === 'lower' || options[key] === 'upper' ? options[key] : '';
|
|
711
633
|
break;
|
|
712
|
-
|
|
713
634
|
case 'attr_case':
|
|
714
635
|
newOptions['attributeCase'] = options[key] === 'lower' || options[key] === 'upper' ? options[key] : '';
|
|
715
636
|
break;
|
|
716
|
-
|
|
717
637
|
case 'attr_quotes':
|
|
718
638
|
newOptions['attributeQuotes'] = options[key];
|
|
719
639
|
break;
|
|
720
|
-
|
|
721
640
|
case 'tag_nl':
|
|
722
641
|
newOptions['format'] = options[key] === true || options[key] === false ? options[key] : true;
|
|
723
642
|
break;
|
|
724
|
-
|
|
725
643
|
case 'inline_break':
|
|
726
644
|
newOptions['inlineBreak'] = options[key];
|
|
727
645
|
break;
|
|
728
|
-
|
|
729
646
|
case 'self_closing_tag':
|
|
730
647
|
if (options[key] === true) {
|
|
731
648
|
newOptions['selfClosingStyle'] = 'xml';
|
|
732
649
|
break;
|
|
733
650
|
}
|
|
734
|
-
|
|
735
651
|
if (options[key] === false) {
|
|
736
652
|
newOptions['selfClosingStyle'] = 'html';
|
|
737
653
|
break;
|
|
738
654
|
}
|
|
739
|
-
|
|
740
655
|
newOptions['selfClosingStyle'] = options[key];
|
|
741
656
|
break;
|
|
742
|
-
|
|
743
657
|
case 'compact_bool':
|
|
744
658
|
newOptions['compactBooleanAttributes'] = options[key];
|
|
745
659
|
break;
|
|
746
|
-
|
|
747
660
|
default:
|
|
748
661
|
newOptions[key] = options[key];
|
|
749
662
|
break;
|
|
750
663
|
}
|
|
751
664
|
}
|
|
752
|
-
|
|
753
665
|
return newOptions;
|
|
754
666
|
}
|
|
755
667
|
/**
|
|
756
668
|
* Returns variables to be used while expanding snippets
|
|
757
669
|
*/
|
|
758
|
-
|
|
759
|
-
|
|
760
670
|
function getVariables(variablesFromSettings) {
|
|
761
671
|
if (!variablesFromSettings) {
|
|
762
672
|
return variablesFromFile;
|
|
763
673
|
}
|
|
764
|
-
|
|
765
674
|
return Object.assign({}, variablesFromFile, variablesFromSettings);
|
|
766
675
|
}
|
|
767
|
-
|
|
768
676
|
function getFormatters(syntax, preferences) {
|
|
769
|
-
if (!preferences || typeof
|
|
677
|
+
if (!preferences || _rollupPluginBabelHelpers["typeof"](preferences) !== 'object') {
|
|
770
678
|
return {};
|
|
771
679
|
}
|
|
772
|
-
|
|
773
680
|
if (!isStyleSheet(syntax)) {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
for (const key in preferences) {
|
|
681
|
+
var commentFormatter = {};
|
|
682
|
+
for (var key in preferences) {
|
|
777
683
|
switch (key) {
|
|
778
684
|
case 'filter.commentAfter':
|
|
779
685
|
commentFormatter['after'] = preferences[key];
|
|
780
686
|
break;
|
|
781
|
-
|
|
782
687
|
case 'filter.commentBefore':
|
|
783
688
|
commentFormatter['before'] = preferences[key];
|
|
784
689
|
break;
|
|
785
|
-
|
|
786
690
|
case 'filter.commentTrigger':
|
|
787
691
|
commentFormatter['trigger'] = preferences[key];
|
|
788
692
|
break;
|
|
789
693
|
}
|
|
790
694
|
}
|
|
791
|
-
|
|
792
695
|
return {
|
|
793
696
|
comment: commentFormatter
|
|
794
697
|
};
|
|
795
698
|
}
|
|
796
|
-
|
|
797
|
-
let fuzzySearchMinScore = typeof (preferences === null || preferences === void 0 ? void 0 : preferences['css.fuzzySearchMinScore']) === 'number' ? preferences['css.fuzzySearchMinScore'] : 0.3;
|
|
798
|
-
|
|
699
|
+
var fuzzySearchMinScore = typeof (preferences === null || preferences === void 0 ? void 0 : preferences['css.fuzzySearchMinScore']) === 'number' ? preferences['css.fuzzySearchMinScore'] : 0.3;
|
|
799
700
|
if (fuzzySearchMinScore > 1) {
|
|
800
701
|
fuzzySearchMinScore = 1;
|
|
801
702
|
} else if (fuzzySearchMinScore < 0) {
|
|
802
703
|
fuzzySearchMinScore = 0;
|
|
803
704
|
}
|
|
804
|
-
|
|
805
|
-
const stylesheetFormatter = {
|
|
705
|
+
var stylesheetFormatter = {
|
|
806
706
|
'fuzzySearchMinScore': fuzzySearchMinScore
|
|
807
707
|
};
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
switch (key) {
|
|
708
|
+
var _loop = function _loop() {
|
|
709
|
+
switch (_key) {
|
|
811
710
|
case 'css.floatUnit':
|
|
812
|
-
stylesheetFormatter['floatUnit'] = preferences[
|
|
711
|
+
stylesheetFormatter['floatUnit'] = preferences[_key];
|
|
813
712
|
break;
|
|
814
|
-
|
|
815
713
|
case 'css.intUnit':
|
|
816
|
-
stylesheetFormatter['intUnit'] = preferences[
|
|
714
|
+
stylesheetFormatter['intUnit'] = preferences[_key];
|
|
817
715
|
break;
|
|
818
|
-
|
|
819
716
|
case 'css.unitAliases':
|
|
820
|
-
|
|
821
|
-
preferences[
|
|
717
|
+
var unitAliases = {};
|
|
718
|
+
preferences[_key].split(',').forEach(function (alias) {
|
|
822
719
|
if (!alias || !alias.trim() || !alias.includes(':')) {
|
|
823
720
|
return;
|
|
824
721
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
const aliasValue = alias.substr(aliasName.length + 1);
|
|
828
|
-
|
|
722
|
+
var aliasName = alias.substr(0, alias.indexOf(':'));
|
|
723
|
+
var aliasValue = alias.substr(aliasName.length + 1);
|
|
829
724
|
if (!aliasName.trim() || !aliasValue) {
|
|
830
725
|
return;
|
|
831
726
|
}
|
|
832
|
-
|
|
833
727
|
unitAliases[aliasName.trim()] = aliasValue;
|
|
834
728
|
});
|
|
835
729
|
stylesheetFormatter['unitAliases'] = unitAliases;
|
|
836
730
|
break;
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
stylesheetFormatter['between'] = preferences[key];
|
|
731
|
+
case "".concat(syntax, ".valueSeparator"):
|
|
732
|
+
stylesheetFormatter['between'] = preferences[_key];
|
|
840
733
|
break;
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
stylesheetFormatter['after'] = preferences[key];
|
|
734
|
+
case "".concat(syntax, ".propertyEnd"):
|
|
735
|
+
stylesheetFormatter['after'] = preferences[_key];
|
|
844
736
|
break;
|
|
845
737
|
}
|
|
738
|
+
};
|
|
739
|
+
for (var _key in preferences) {
|
|
740
|
+
_loop();
|
|
846
741
|
}
|
|
847
|
-
|
|
848
742
|
return {
|
|
849
743
|
stylesheet: stylesheetFormatter
|
|
850
744
|
};
|
|
@@ -858,27 +752,22 @@ function getFormatters(syntax, preferences) {
|
|
|
858
752
|
* @param language
|
|
859
753
|
* @param exlcudedLanguages Array of language ids that user has chosen to exlcude for emmet
|
|
860
754
|
*/
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
function getEmmetMode(language, excludedLanguages = []) {
|
|
755
|
+
function getEmmetMode(language) {
|
|
756
|
+
var excludedLanguages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
864
757
|
if (!language || excludedLanguages.includes(language)) {
|
|
865
758
|
return;
|
|
866
759
|
}
|
|
867
|
-
|
|
868
760
|
if (/\b(typescriptreact|javascriptreact|jsx-tags)\b/.test(language)) {
|
|
869
761
|
// treat tsx like jsx
|
|
870
762
|
return 'jsx';
|
|
871
763
|
}
|
|
872
|
-
|
|
873
764
|
if (language === 'sass-indented') {
|
|
874
765
|
// map sass-indented to sass
|
|
875
766
|
return 'sass';
|
|
876
767
|
}
|
|
877
|
-
|
|
878
768
|
if (language === 'jade') {
|
|
879
769
|
return 'pug';
|
|
880
770
|
}
|
|
881
|
-
|
|
882
771
|
if (configCompat.syntaxes.markup.includes(language) || configCompat.syntaxes.stylesheet.includes(language)) {
|
|
883
772
|
return language;
|
|
884
773
|
}
|