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