@elice/material-exercise 1.240718.0-trasncript.2 → 1.240718.2
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/assets/empty.png.js +2 -1
- package/cjs/components/material-exercise/MaterialExercise.d.ts +1 -1
- package/cjs/components/material-exercise/MaterialExercise.js +75 -111
- package/cjs/components/material-exercise/MaterialExercise.styled.js +14 -18
- package/cjs/components/material-exercise/MaterialExerciseMobile.d.ts +1 -1
- package/cjs/components/material-exercise/MaterialExerciseMobile.js +7 -17
- package/cjs/components/material-exercise/context/ExerciseProvider.js +58 -68
- package/cjs/components/material-exercise/context/ExerciseProviderNoImage.js +30 -39
- package/cjs/components/material-exercise/context/context.js +1 -5
- package/cjs/components/material-exercise/context/recoil.js +293 -542
- package/cjs/components/material-exercise/context/subjects.js +4 -4
- package/cjs/components/material-exercise/context/types.d.ts +2 -2
- package/cjs/components/material-exercise/exercise-code-history/ExerciseCodeHistory.js +78 -100
- package/cjs/components/material-exercise/exercise-code-history/ExerciseCodeHistory.styled.js +8 -12
- package/cjs/components/material-exercise/exercise-file/ExerciseFile.js +27 -30
- package/cjs/components/material-exercise/exercise-file-editor/ExerciseFileEditor.js +149 -225
- package/cjs/components/material-exercise/exercise-file-editor/ExerciseFileReadOnlyBanner.js +13 -20
- package/cjs/components/material-exercise/exercise-file-tabs/ExerciseFileTabs.js +29 -49
- package/cjs/components/material-exercise/exercise-file-tabs/ExerciseFileTabsLazy.d.ts +2 -1
- package/cjs/components/material-exercise/exercise-file-tabs/ExerciseFileTabsLazy.js +4 -10
- package/cjs/components/material-exercise/exercise-file-tabs/exercise-file-tabs-file-tree-button/ExerciseFileTabsFileTreeButton.js +36 -53
- package/cjs/components/material-exercise/exercise-file-tree/ExerciseFileTree.js +211 -353
- package/cjs/components/material-exercise/exercise-file-tree/ExerciseFileTreeLazy.d.ts +2 -1
- package/cjs/components/material-exercise/exercise-file-tree/ExerciseFileTreeLazy.js +4 -10
- package/cjs/components/material-exercise/exercise-file-viewer/ExerciseFileViewer.js +15 -18
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenu.js +12 -21
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.js +11 -12
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.js +80 -123
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuDropdown.js +67 -100
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuReset.js +22 -40
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.js +119 -144
- package/cjs/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.styled.js +13 -17
- package/cjs/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdown.js +19 -32
- package/cjs/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdownLazy.d.ts +2 -1
- package/cjs/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdownLazy.js +4 -10
- package/cjs/components/material-exercise/exercise-preview/ExercisePreview.js +24 -31
- package/cjs/components/material-exercise/exercise-preview/ExercisePreviewDisplayModeButton.js +6 -13
- package/cjs/components/material-exercise/exercise-rightpane/ExerciseRightpane.js +35 -51
- package/cjs/components/material-exercise/exercise-rightpane/ExerciseRightpaneEditorPerference.js +6 -14
- package/cjs/components/material-exercise/exercise-rightpane/ExerciseRightpaneEnvironment.js +78 -90
- package/cjs/components/material-exercise/exercise-room/ExerciseRoom.js +12 -25
- package/cjs/components/material-exercise/exercise-room/ExerciseRoom.styled.js +12 -18
- package/cjs/components/material-exercise/exercise-room/ExerciseRoomDetail.js +349 -504
- package/cjs/components/material-exercise/exercise-room/ExerciseRoomList.js +132 -197
- package/cjs/components/material-exercise/exercise-room/helpers/exerciseRoomPermissionStringConvertor.js +2 -2
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunner.js +142 -205
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerContext.js +1 -5
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerController.js +16 -25
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.js +86 -118
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.js +19 -33
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +82 -95
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.js +52 -68
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerRunningInfo.js +87 -136
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerStatusIndicator.js +2 -6
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerStatusMessage.js +15 -21
- package/cjs/components/material-exercise/exercise-runner/ExerciseRunnerControllerTimer.js +23 -36
- package/cjs/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.js +248 -402
- package/cjs/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.styled.js +8 -12
- package/cjs/components/material-exercise/exercise-submit-history/ExerciseSubmitHistoryOutput.js +50 -74
- package/cjs/components/shared/exercise-menu-button/ExerciseMenuButton.js +23 -32
- package/cjs/components/shared/exercise-shimmer/ExerciseFileShimmer.js +38 -44
- package/cjs/components/shared/exercise-shimmer/ExerciseFileTabShimmer.js +20 -26
- package/cjs/components/shared/exercise-shimmer/ExerciseFileTabsShimmer.js +8 -14
- package/cjs/components/shared/exercise-shimmer/ExerciseFileTreeListItemShimmer.js +22 -28
- package/cjs/components/shared/exercise-shimmer/ExerciseFileTreeListShimmer.js +9 -24
- package/cjs/components/shared/exercise-version-list/ExerciseVersionList.js +5 -6
- package/cjs/components/shared/exercise-version-list/ExerciseVersionList.styled.js +1 -5
- package/cjs/components/shared/exercise-version-list/ExerciseVersionListItem.js +10 -10
- package/cjs/components/shared/exercise-version-list/ExerciseVersionListItem.styled.js +5 -13
- package/cjs/components/shared/file-icon/FileIcon.js +16 -23
- package/cjs/components/shared/file-tabs/FileTab.js +33 -47
- package/cjs/components/shared/file-tabs/FileTab.styled.js +15 -23
- package/cjs/components/shared/file-tabs/FileTabs.js +39 -66
- package/cjs/components/shared/file-tabs/FileTabs.styled.js +2 -6
- package/cjs/components/shared/file-tabs/util.js +14 -27
- package/cjs/components/shared/file-tree/FileTree.js +10 -20
- package/cjs/components/shared/file-tree/FileTreeConfig.js +40 -46
- package/cjs/components/shared/file-tree/FileTreeList.js +40 -43
- package/cjs/components/shared/file-tree/FileTreeListItemContent.js +99 -128
- package/cjs/components/shared/file-tree/FileTreeListItemContent.styled.js +21 -29
- package/cjs/components/shared/file-tree/FileTreeListItemContentInput.js +96 -106
- package/cjs/components/shared/file-tree/FileTreeListItemContentInput.styled.js +6 -10
- package/cjs/components/shared/file-tree/FileTreeListItemContentMenu.js +91 -133
- package/cjs/components/shared/file-tree/FileTreeListItems.js +137 -149
- package/cjs/components/shared/file-tree/FileTreeListItems.styled.js +2 -6
- package/cjs/components/shared/file-tree/FileTreeToolbar.styled.js +1 -5
- package/cjs/components/shared/file-tree/context/FileTreeContext.d.ts +1 -1
- package/cjs/components/shared/file-tree/context/FileTreeContext.js +79 -101
- package/cjs/components/shared/file-tree/file-tree-toolbar/FileTreeToolbar.js +54 -59
- package/cjs/components/shared/file-tree/utils/fileTreeFiles.js +20 -24
- package/cjs/components/shared/file-tree/utils/fileTreeGenerator.js +146 -193
- package/cjs/components/shared/file-tree/utils/fileTreeInput.js +0 -11
- package/cjs/components/shared/file-tree/utils/fileTreeItem.js +1 -1
- package/cjs/components/shared/file-tree/utils/fileTreePath.js +6 -5
- package/cjs/components/shared/file-viewer/FileViewer.js +46 -76
- package/cjs/components/shared/file-viewer/FileViewerCsv.js +167 -262
- package/cjs/components/shared/file-viewer/FileViewerImage.js +12 -16
- package/cjs/components/shared/file-viewer/FileViewerIpynb.js +11 -27
- package/cjs/components/shared/file-viewer/FileViewerNonViewable.js +47 -65
- package/cjs/components/shared/file-viewer/FileViewerText.js +11 -23
- package/cjs/components/shared/material-modal/MaterialModal.js +11 -20
- package/cjs/components/shared/material-modal/MaterialModal.styled.js +5 -9
- package/cjs/components/shared/monaco-editor/MonacoEditor.js +74 -102
- package/cjs/components/shared/monaco-editor/MonacoEditorLazy.js +7 -15
- package/cjs/components/shared/monaco-editor/MonacoEditorMobile.js +34 -49
- package/cjs/components/shared/monaco-editor/MonacoEditorPerferenceForm.js +194 -249
- package/cjs/components/shared/monaco-editor/constants/grammars/index.js +28 -82
- package/cjs/components/shared/monaco-editor/constants/monaco/preferences.js +5 -5
- package/cjs/components/shared/monaco-editor/constants/themes/index.js +17 -49
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoEventChange.js +10 -11
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoEventCursor.js +14 -15
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoEventScroll.js +8 -9
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoMarkers.js +30 -34
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoOptions.js +7 -9
- package/cjs/components/shared/monaco-editor/editor-hooks/useMonacoTheme.js +6 -6
- package/cjs/components/shared/monaco-editor/editor-languages/css/formatter.js +10 -33
- package/cjs/components/shared/monaco-editor/editor-languages/css/index.js +2 -3
- package/cjs/components/shared/monaco-editor/editor-languages/html/formatter.js +10 -33
- package/cjs/components/shared/monaco-editor/editor-languages/html/index.js +2 -3
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/dts/_helper.js +1 -1
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/formatter.js +10 -37
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/index.js +5 -6
- package/cjs/components/shared/monaco-editor/hooks/useEditorOptions.js +5 -11
- package/cjs/components/shared/monaco-editor/utils/emmet/abbreviationActions.js +12 -10
- package/cjs/components/shared/monaco-editor/utils/emmet/registerProvider.js +6 -12
- package/cjs/components/shared/monaco-editor/utils/grammar/index.js +24 -67
- package/cjs/components/shared/monaco-editor/utils/grammar/onigasm.js +6 -25
- package/cjs/components/shared/monaco-editor/utils/grammar/textmate.js +37 -70
- package/cjs/components/shared/monaco-editor/utils/monacoLanguage.js +7 -8
- package/cjs/components/shared/monaco-editor/utils/monacoPreference.js +4 -6
- package/cjs/components/shared/monaco-editor/utils/prettier/config.js +2 -2
- package/cjs/components/shared/monaco-editor/utils/prettier/index.js +7 -27
- package/cjs/components/shared/monaco-editor/utils/theme/convert.js +14 -24
- package/cjs/components/shared/monaco-editor/utils/theme/index.js +3 -22
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursor.js +56 -77
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursorManager.js +68 -82
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursorWidget.js +93 -120
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteSelection.js +132 -155
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteSelectionManager.js +92 -104
- 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 +6 -1
- package/cjs/components/shared/monaco-editor/vendors/vscode-emmet-helper/data.js +2 -2
- package/cjs/components/shared/monaco-editor/vendors/vscode-emmet-helper/emmetHelper.js +158 -177
- package/cjs/components/shared/monaco-editor/vendors/vscode-emmet-helper/utils.js +3 -3
- package/cjs/components/shared/no-vnc/NoVnc.js +78 -118
- package/cjs/components/shared/no-vnc/NoVncLazy.js +7 -15
- package/cjs/components/shared/preview-container/PreviewContainer.js +13 -18
- package/cjs/components/shared/web-browser/WebBrowser.js +52 -74
- package/cjs/components/shared/xterm/Xterm.js +57 -82
- package/cjs/components/shared/xterm/XtermLazy.js +7 -15
- package/cjs/constants/arduino.js +10 -10
- package/cjs/constants/color.js +1 -1
- package/cjs/constants/shortcutKeyMap.js +1 -3
- package/cjs/constants/stylesheets.js +5 -7
- package/cjs/hooks/useArduino.js +141 -282
- package/cjs/hooks/useExerciseFile.js +22 -24
- package/cjs/hooks/useExericseShortcut.js +4 -6
- package/cjs/hooks/useMaterialExerciseFileUrl.js +33 -55
- package/cjs/hooks/useRunnerRoomWebSocket.js +27 -51
- package/cjs/hooks/useStdioTextConcator.js +11 -15
- package/cjs/hooks/useStdioWebSocket.js +28 -32
- package/cjs/hooks/useUsercodeEditWebSocket.js +158 -238
- package/cjs/hooks/useUsercodeHistory.js +63 -115
- package/cjs/utils/arduino.js +11 -23
- package/cjs/utils/exerciseFile.js +10 -8
- package/cjs/utils/runner.js +17 -33
- package/es/assets/empty.png.js +2 -1
- package/es/components/material-exercise/MaterialExercise.d.ts +1 -1
- package/es/components/material-exercise/MaterialExercise.js +75 -107
- package/es/components/material-exercise/MaterialExercise.styled.js +14 -14
- package/es/components/material-exercise/MaterialExerciseMobile.d.ts +1 -1
- package/es/components/material-exercise/MaterialExerciseMobile.js +7 -13
- package/es/components/material-exercise/context/ExerciseProvider.js +58 -63
- package/es/components/material-exercise/context/ExerciseProviderNoImage.js +30 -35
- package/es/components/material-exercise/context/context.js +1 -1
- package/es/components/material-exercise/context/recoil.js +290 -535
- package/es/components/material-exercise/context/subjects.js +4 -4
- package/es/components/material-exercise/context/types.d.ts +2 -2
- package/es/components/material-exercise/exercise-code-history/ExerciseCodeHistory.js +78 -95
- package/es/components/material-exercise/exercise-code-history/ExerciseCodeHistory.styled.js +8 -8
- package/es/components/material-exercise/exercise-file/ExerciseFile.js +27 -25
- package/es/components/material-exercise/exercise-file-editor/ExerciseFileEditor.js +149 -221
- package/es/components/material-exercise/exercise-file-editor/ExerciseFileReadOnlyBanner.js +13 -15
- package/es/components/material-exercise/exercise-file-tabs/ExerciseFileTabs.js +29 -44
- package/es/components/material-exercise/exercise-file-tabs/ExerciseFileTabsLazy.d.ts +2 -1
- package/es/components/material-exercise/exercise-file-tabs/ExerciseFileTabsLazy.js +4 -6
- package/es/components/material-exercise/exercise-file-tabs/exercise-file-tabs-file-tree-button/ExerciseFileTabsFileTreeButton.js +36 -48
- package/es/components/material-exercise/exercise-file-tree/ExerciseFileTree.js +211 -348
- package/es/components/material-exercise/exercise-file-tree/ExerciseFileTreeLazy.d.ts +2 -1
- package/es/components/material-exercise/exercise-file-tree/ExerciseFileTreeLazy.js +4 -6
- package/es/components/material-exercise/exercise-file-viewer/ExerciseFileViewer.js +15 -14
- package/es/components/material-exercise/exercise-menu/ExerciseMenu.js +12 -16
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoAgentModalButton.js +11 -12
- package/es/components/material-exercise/exercise-menu/ExerciseMenuArduinoSettings.js +80 -119
- package/es/components/material-exercise/exercise-menu/ExerciseMenuDropdown.js +67 -96
- package/es/components/material-exercise/exercise-menu/ExerciseMenuReset.js +23 -41
- package/es/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.js +122 -143
- package/es/components/material-exercise/exercise-menu/ExerciseMenuStdioFileBrowser.styled.js +13 -13
- package/es/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdown.js +19 -28
- package/es/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdownLazy.d.ts +2 -1
- package/es/components/material-exercise/exercise-multilang-dropdown/ExerciseMultilangDropdownLazy.js +4 -6
- package/es/components/material-exercise/exercise-preview/ExercisePreview.js +24 -26
- package/es/components/material-exercise/exercise-preview/ExercisePreviewDisplayModeButton.js +7 -14
- package/es/components/material-exercise/exercise-rightpane/ExerciseRightpane.js +35 -47
- package/es/components/material-exercise/exercise-rightpane/ExerciseRightpaneEditorPerference.js +6 -10
- package/es/components/material-exercise/exercise-rightpane/ExerciseRightpaneEnvironment.js +78 -85
- package/es/components/material-exercise/exercise-room/ExerciseRoom.js +12 -21
- package/es/components/material-exercise/exercise-room/ExerciseRoom.styled.js +12 -14
- package/es/components/material-exercise/exercise-room/ExerciseRoomDetail.js +349 -498
- package/es/components/material-exercise/exercise-room/ExerciseRoomList.js +133 -193
- package/es/components/material-exercise/exercise-room/helpers/exerciseRoomPermissionStringConvertor.js +2 -2
- package/es/components/material-exercise/exercise-runner/ExerciseRunner.js +142 -200
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerContext.js +1 -1
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerController.js +16 -20
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoAgentModal.js +85 -112
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerArduinoStatusMessage.js +20 -30
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerButtonGroup.js +82 -90
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerCodeHelpRequestButton.js +52 -63
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerRunningInfo.js +87 -131
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerStatusIndicator.js +2 -2
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerStatusMessage.js +15 -17
- package/es/components/material-exercise/exercise-runner/ExerciseRunnerControllerTimer.js +23 -31
- package/es/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.js +250 -399
- package/es/components/material-exercise/exercise-submit-history/ExerciseSubmitHistory.styled.js +8 -8
- package/es/components/material-exercise/exercise-submit-history/ExerciseSubmitHistoryOutput.js +49 -68
- package/es/components/shared/exercise-menu-button/ExerciseMenuButton.js +24 -29
- package/es/components/shared/exercise-shimmer/ExerciseFileShimmer.js +38 -40
- package/es/components/shared/exercise-shimmer/ExerciseFileTabShimmer.js +20 -22
- package/es/components/shared/exercise-shimmer/ExerciseFileTabsShimmer.js +8 -10
- package/es/components/shared/exercise-shimmer/ExerciseFileTreeListItemShimmer.js +22 -24
- package/es/components/shared/exercise-shimmer/ExerciseFileTreeListShimmer.js +9 -19
- package/es/components/shared/exercise-version-list/ExerciseVersionList.js +5 -6
- package/es/components/shared/exercise-version-list/ExerciseVersionList.styled.js +1 -1
- package/es/components/shared/exercise-version-list/ExerciseVersionListItem.js +10 -10
- package/es/components/shared/exercise-version-list/ExerciseVersionListItem.styled.js +5 -9
- package/es/components/shared/file-icon/FileIcon.js +16 -19
- package/es/components/shared/file-tabs/FileTab.js +33 -43
- package/es/components/shared/file-tabs/FileTab.styled.js +15 -19
- package/es/components/shared/file-tabs/FileTabs.js +40 -62
- package/es/components/shared/file-tabs/FileTabs.styled.js +2 -2
- package/es/components/shared/file-tabs/util.js +14 -27
- package/es/components/shared/file-tree/FileTree.js +10 -16
- package/es/components/shared/file-tree/FileTreeConfig.js +39 -39
- package/es/components/shared/file-tree/FileTreeList.js +40 -38
- package/es/components/shared/file-tree/FileTreeListItemContent.js +99 -124
- package/es/components/shared/file-tree/FileTreeListItemContent.styled.js +21 -25
- package/es/components/shared/file-tree/FileTreeListItemContentInput.js +96 -102
- package/es/components/shared/file-tree/FileTreeListItemContentInput.styled.js +6 -6
- package/es/components/shared/file-tree/FileTreeListItemContentMenu.js +91 -129
- package/es/components/shared/file-tree/FileTreeListItems.js +137 -149
- package/es/components/shared/file-tree/FileTreeListItems.styled.js +2 -2
- package/es/components/shared/file-tree/FileTreeToolbar.styled.js +1 -1
- package/es/components/shared/file-tree/context/FileTreeContext.d.ts +1 -1
- package/es/components/shared/file-tree/context/FileTreeContext.js +79 -97
- package/es/components/shared/file-tree/file-tree-toolbar/FileTreeToolbar.js +54 -55
- package/es/components/shared/file-tree/utils/fileTreeFiles.js +20 -20
- package/es/components/shared/file-tree/utils/fileTreeGenerator.js +146 -193
- package/es/components/shared/file-tree/utils/fileTreeInput.js +1 -11
- package/es/components/shared/file-tree/utils/fileTreeItem.js +1 -1
- package/es/components/shared/file-tree/utils/fileTreePath.js +6 -5
- package/es/components/shared/file-viewer/FileViewer.js +46 -69
- package/es/components/shared/file-viewer/FileViewerCsv.js +167 -257
- package/es/components/shared/file-viewer/FileViewerImage.js +12 -12
- package/es/components/shared/file-viewer/FileViewerIpynb.js +11 -21
- package/es/components/shared/file-viewer/FileViewerNonViewable.js +47 -60
- package/es/components/shared/file-viewer/FileViewerText.js +11 -19
- package/es/components/shared/material-modal/MaterialModal.js +11 -20
- package/es/components/shared/material-modal/MaterialModal.styled.js +5 -5
- package/es/components/shared/monaco-editor/MonacoEditor.js +72 -95
- package/es/components/shared/monaco-editor/MonacoEditorLazy.js +7 -11
- package/es/components/shared/monaco-editor/MonacoEditorMobile.js +32 -43
- package/es/components/shared/monaco-editor/MonacoEditorPerferenceForm.js +194 -244
- package/es/components/shared/monaco-editor/constants/grammars/index.js +28 -82
- package/es/components/shared/monaco-editor/constants/monaco/preferences.js +5 -5
- package/es/components/shared/monaco-editor/constants/themes/index.js +17 -49
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoEventChange.js +10 -11
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoEventCursor.js +14 -15
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoEventScroll.js +8 -9
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoMarkers.js +30 -34
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoOptions.js +7 -9
- package/es/components/shared/monaco-editor/editor-hooks/useMonacoTheme.js +6 -6
- package/es/components/shared/monaco-editor/editor-languages/css/formatter.js +10 -33
- package/es/components/shared/monaco-editor/editor-languages/html/formatter.js +10 -33
- package/es/components/shared/monaco-editor/editor-languages/typescript/dts/_helper.js +1 -1
- package/es/components/shared/monaco-editor/editor-languages/typescript/formatter.js +10 -37
- package/es/components/shared/monaco-editor/editor-languages/typescript/index.js +3 -3
- package/es/components/shared/monaco-editor/hooks/useEditorOptions.js +5 -11
- package/es/components/shared/monaco-editor/utils/emmet/abbreviationActions.js +12 -10
- package/es/components/shared/monaco-editor/utils/emmet/registerProvider.js +6 -12
- package/es/components/shared/monaco-editor/utils/grammar/index.js +24 -67
- package/es/components/shared/monaco-editor/utils/grammar/onigasm.js +6 -25
- package/es/components/shared/monaco-editor/utils/grammar/textmate.js +35 -67
- package/es/components/shared/monaco-editor/utils/monacoLanguage.js +5 -5
- package/es/components/shared/monaco-editor/utils/monacoPreference.js +4 -6
- package/es/components/shared/monaco-editor/utils/prettier/config.js +2 -2
- package/es/components/shared/monaco-editor/utils/prettier/index.js +7 -27
- package/es/components/shared/monaco-editor/utils/theme/convert.js +13 -19
- package/es/components/shared/monaco-editor/utils/theme/index.js +3 -22
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursor.js +56 -77
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursorManager.js +68 -82
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteCursorWidget.js +93 -120
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteSelection.js +130 -152
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/RemoteSelectionManager.js +92 -104
- 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 +6 -1
- package/es/components/shared/monaco-editor/vendors/vscode-emmet-helper/data.js +2 -2
- package/es/components/shared/monaco-editor/vendors/vscode-emmet-helper/emmetHelper.js +156 -171
- package/es/components/shared/monaco-editor/vendors/vscode-emmet-helper/utils.js +3 -3
- package/es/components/shared/no-vnc/NoVnc.js +71 -99
- package/es/components/shared/no-vnc/NoVncLazy.js +7 -11
- package/es/components/shared/preview-container/PreviewContainer.js +14 -15
- package/es/components/shared/web-browser/WebBrowser.js +52 -69
- package/es/components/shared/xterm/Xterm.js +57 -77
- package/es/components/shared/xterm/XtermLazy.js +7 -11
- package/es/constants/arduino.js +10 -10
- package/es/constants/color.js +1 -1
- package/es/constants/shortcutKeyMap.js +1 -3
- package/es/constants/stylesheets.js +5 -7
- package/es/hooks/useArduino.js +141 -278
- package/es/hooks/useExerciseFile.js +22 -24
- package/es/hooks/useExericseShortcut.js +4 -6
- package/es/hooks/useMaterialExerciseFileUrl.js +34 -52
- package/es/hooks/useRunnerRoomWebSocket.js +27 -51
- package/es/hooks/useStdioTextConcator.js +11 -11
- package/es/hooks/useStdioWebSocket.js +28 -32
- package/es/hooks/useUsercodeEditWebSocket.js +157 -232
- package/es/hooks/useUsercodeHistory.js +63 -115
- package/es/utils/arduino.js +12 -24
- package/es/utils/exerciseFile.js +10 -8
- package/es/utils/runner.js +17 -33
- package/package.json +15 -11
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -519
- package/cjs/components/index.js +0 -25
- package/cjs/components/locales/index.js +0 -13
- package/cjs/components/material-exercise/context/index.js +0 -57
- package/cjs/components/material-exercise/exercise-code-history/index.js +0 -7
- package/cjs/components/material-exercise/exercise-code-history/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-file/index.js +0 -7
- package/cjs/components/material-exercise/exercise-file-editor/index.js +0 -7
- package/cjs/components/material-exercise/exercise-file-editor/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-file-tabs/exercise-file-tabs-file-tree-button/index.js +0 -7
- package/cjs/components/material-exercise/exercise-file-tabs/exercise-file-tabs-file-tree-button/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-file-tabs/index.js +0 -9
- package/cjs/components/material-exercise/exercise-file-tabs/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-file-tree/index.js +0 -9
- package/cjs/components/material-exercise/exercise-file-tree/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-file-viewer/index.js +0 -7
- package/cjs/components/material-exercise/exercise-menu/index.js +0 -7
- package/cjs/components/material-exercise/exercise-menu/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-multilang-dropdown/index.js +0 -9
- package/cjs/components/material-exercise/exercise-preview/index.js +0 -7
- package/cjs/components/material-exercise/exercise-preview/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-rightpane/index.js +0 -7
- package/cjs/components/material-exercise/exercise-rightpane/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-room/helpers/index.js +0 -7
- package/cjs/components/material-exercise/exercise-room/index.js +0 -7
- package/cjs/components/material-exercise/exercise-room/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-runner/index.js +0 -7
- package/cjs/components/material-exercise/exercise-runner/locales/index.js +0 -13
- package/cjs/components/material-exercise/exercise-submit-history/index.js +0 -7
- package/cjs/components/material-exercise/exercise-submit-history/locales/index.js +0 -13
- package/cjs/components/material-exercise/index.js +0 -9
- package/cjs/components/shared/exercise-menu-button/index.js +0 -7
- package/cjs/components/shared/exercise-shimmer/index.js +0 -15
- package/cjs/components/shared/exercise-version-list/index.js +0 -9
- package/cjs/components/shared/file-icon/index.js +0 -7
- package/cjs/components/shared/file-tabs/index.js +0 -7
- package/cjs/components/shared/file-tree/context/index.js +0 -9
- package/cjs/components/shared/file-tree/file-tree-toolbar/index.js +0 -7
- package/cjs/components/shared/file-tree/file-tree-toolbar/locales/index.js +0 -13
- package/cjs/components/shared/file-tree/index.js +0 -7
- package/cjs/components/shared/file-tree/locales/index.js +0 -13
- package/cjs/components/shared/file-tree/utils/index.js +0 -20
- package/cjs/components/shared/file-viewer/index.js +0 -7
- package/cjs/components/shared/file-viewer/locales/index.js +0 -21
- package/cjs/components/shared/material-modal/index.js +0 -7
- package/cjs/components/shared/monaco-editor/constants/index.js +0 -13
- package/cjs/components/shared/monaco-editor/constants/monaco/index.js +0 -11
- package/cjs/components/shared/monaco-editor/editor-hooks/index.js +0 -17
- package/cjs/components/shared/monaco-editor/editor-languages/typescript/dts/index.js +0 -11
- package/cjs/components/shared/monaco-editor/hooks/index.js +0 -7
- package/cjs/components/shared/monaco-editor/index.js +0 -21
- package/cjs/components/shared/monaco-editor/locales/index.js +0 -13
- package/cjs/components/shared/monaco-editor/utils/emmet/index.js +0 -9
- package/cjs/components/shared/monaco-editor/utils/index.js +0 -9
- package/cjs/components/shared/monaco-editor/vendors/monaco-collab-ext/index.js +0 -12
- package/cjs/components/shared/monaco-editor/vendors/vscode-emmet-helper/index.js +0 -11
- package/cjs/components/shared/no-vnc/index.js +0 -7
- package/cjs/components/shared/preview-container/index.js +0 -9
- package/cjs/components/shared/web-browser/index.js +0 -7
- package/cjs/components/shared/xterm/index.js +0 -7
- package/cjs/components/shared/xterm/locales/index.js +0 -13
- package/cjs/constants/index.js +0 -7
- package/cjs/hooks/index.js +0 -20
- package/cjs/utils/index.js +0 -10
- package/es/_virtual/_rollupPluginBabelHelpers.js +0 -499
- package/es/components/index.js +0 -8
- package/es/components/locales/index.js +0 -4
- package/es/components/material-exercise/context/index.js +0 -5
- package/es/components/material-exercise/exercise-code-history/index.js +0 -1
- package/es/components/material-exercise/exercise-code-history/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-file/index.js +0 -1
- package/es/components/material-exercise/exercise-file-editor/index.js +0 -1
- package/es/components/material-exercise/exercise-file-editor/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-file-tabs/exercise-file-tabs-file-tree-button/index.js +0 -1
- package/es/components/material-exercise/exercise-file-tabs/exercise-file-tabs-file-tree-button/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-file-tabs/index.js +0 -2
- package/es/components/material-exercise/exercise-file-tabs/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-file-tree/index.js +0 -2
- package/es/components/material-exercise/exercise-file-tree/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-file-viewer/index.js +0 -1
- package/es/components/material-exercise/exercise-menu/index.js +0 -1
- package/es/components/material-exercise/exercise-menu/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-multilang-dropdown/index.js +0 -2
- package/es/components/material-exercise/exercise-preview/index.js +0 -1
- package/es/components/material-exercise/exercise-preview/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-rightpane/index.js +0 -1
- package/es/components/material-exercise/exercise-rightpane/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-room/helpers/index.js +0 -1
- package/es/components/material-exercise/exercise-room/index.js +0 -1
- package/es/components/material-exercise/exercise-room/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-runner/index.js +0 -1
- package/es/components/material-exercise/exercise-runner/locales/index.js +0 -4
- package/es/components/material-exercise/exercise-submit-history/index.js +0 -1
- package/es/components/material-exercise/exercise-submit-history/locales/index.js +0 -4
- package/es/components/material-exercise/index.js +0 -2
- package/es/components/shared/exercise-menu-button/index.js +0 -1
- package/es/components/shared/exercise-shimmer/index.js +0 -5
- package/es/components/shared/exercise-version-list/index.js +0 -2
- package/es/components/shared/file-icon/index.js +0 -1
- package/es/components/shared/file-tabs/index.js +0 -1
- package/es/components/shared/file-tree/context/index.js +0 -1
- package/es/components/shared/file-tree/file-tree-toolbar/index.js +0 -1
- package/es/components/shared/file-tree/file-tree-toolbar/locales/index.js +0 -4
- package/es/components/shared/file-tree/index.js +0 -1
- package/es/components/shared/file-tree/locales/index.js +0 -4
- package/es/components/shared/file-tree/utils/index.js +0 -5
- package/es/components/shared/file-viewer/index.js +0 -1
- package/es/components/shared/file-viewer/locales/index.js +0 -8
- package/es/components/shared/material-modal/index.js +0 -1
- package/es/components/shared/monaco-editor/constants/index.js +0 -2
- package/es/components/shared/monaco-editor/constants/monaco/index.js +0 -1
- package/es/components/shared/monaco-editor/editor-hooks/index.js +0 -6
- package/es/components/shared/monaco-editor/editor-languages/typescript/dts/index.js +0 -3
- package/es/components/shared/monaco-editor/hooks/index.js +0 -1
- package/es/components/shared/monaco-editor/index.js +0 -6
- package/es/components/shared/monaco-editor/locales/index.js +0 -4
- package/es/components/shared/monaco-editor/utils/emmet/index.js +0 -1
- package/es/components/shared/monaco-editor/utils/index.js +0 -2
- package/es/components/shared/monaco-editor/vendors/monaco-collab-ext/index.js +0 -3
- package/es/components/shared/monaco-editor/vendors/vscode-emmet-helper/index.js +0 -2
- package/es/components/shared/no-vnc/index.js +0 -1
- package/es/components/shared/preview-container/index.js +0 -1
- package/es/components/shared/web-browser/index.js +0 -1
- package/es/components/shared/xterm/index.js +0 -1
- package/es/components/shared/xterm/locales/index.js +0 -4
- package/es/constants/index.js +0 -1
- package/es/hooks/index.js +0 -7
- package/es/utils/index.js +0 -2
|
@@ -1,26 +1,35 @@
|
|
|
1
|
-
import { toConsumableArray as _toConsumableArray, typeof as _typeof } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import expand, { resolveConfig, extract } from 'emmet';
|
|
3
2
|
import { cssData, htmlData } from './data.js';
|
|
4
3
|
import { syntaxes } from './configCompat.js';
|
|
5
4
|
|
|
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
|
+
* ==================================================================================================== */
|
|
12
|
+
/* istanbul ignore file */
|
|
13
|
+
/* tslint:disable */
|
|
14
|
+
/* eslint-disable */
|
|
6
15
|
// /* workaround for webpack issue: https://github.com/webpack/webpack/issues/5756
|
|
7
16
|
// @emmetio/extract-abbreviation has a cjs that uses a default export
|
|
8
17
|
// */
|
|
9
18
|
// const extract = typeof _extractAbbreviation === 'function' ? _extractAbbreviation : _extractAbbreviation.default;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
const snippetKeyCache = new Map();
|
|
20
|
+
let markupSnippetKeys;
|
|
21
|
+
const stylesheetCustomSnippetsKeyCache = new Map();
|
|
22
|
+
const htmlAbbreviationStartRegex = /^[a-z,A-Z,!,(,[,#,\.\{]/;
|
|
14
23
|
// take off { for jsx because it interferes with the language
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
const jsxAbbreviationStartRegex = /^[a-z,A-Z,!,(,[,#,\.]/;
|
|
25
|
+
const cssAbbreviationRegex = /^-?[a-z,A-Z,!,@,#]/;
|
|
26
|
+
const htmlAbbreviationRegex = /[a-z,A-Z\.]/;
|
|
27
|
+
const commonlyUsedTags = [...htmlData.tags, 'lorem'];
|
|
28
|
+
const bemFilterSuffix = 'bem';
|
|
29
|
+
const filterDelimitor = '|';
|
|
30
|
+
const trimFilterSuffix = 't';
|
|
31
|
+
const commentFilterSuffix = 'c';
|
|
32
|
+
const maxFilters = 3;
|
|
24
33
|
/**
|
|
25
34
|
* Returns all applicable emmet expansions for abbreviation at given position in a CompletionList
|
|
26
35
|
*/
|
|
@@ -29,40 +38,42 @@ function doComplete(_monaco, model, position, syntax, emmetConfig) {
|
|
|
29
38
|
if (emmetConfig.showExpandedAbbreviation === 'never' || !getEmmetMode(syntax, emmetConfig.excludeLanguages)) {
|
|
30
39
|
return;
|
|
31
40
|
}
|
|
32
|
-
|
|
41
|
+
const isStyleSheetRes = isStyleSheet(syntax);
|
|
33
42
|
// Fetch markupSnippets so that we can provide possible abbreviation completions
|
|
34
43
|
// For example, when text at position is `a`, completions should return `a:blank`, `a:link`, `acr` etc.
|
|
35
44
|
if (!isStyleSheetRes) {
|
|
36
45
|
if (!snippetKeyCache.has(syntax)) {
|
|
37
|
-
|
|
46
|
+
const registry = (_a = customSnippetsRegistry[syntax]) !== null && _a !== void 0 ? _a : getDefaultSnippets(syntax);
|
|
38
47
|
snippetKeyCache.set(syntax, Object.keys(registry));
|
|
39
48
|
}
|
|
40
49
|
markupSnippetKeys = (_b = snippetKeyCache.get(syntax)) !== null && _b !== void 0 ? _b : [];
|
|
41
50
|
}
|
|
42
|
-
|
|
51
|
+
const extractOptions = {
|
|
43
52
|
lookAhead: !isStyleSheetRes,
|
|
44
53
|
type: isStyleSheetRes ? 'stylesheet' : 'markup'
|
|
45
54
|
};
|
|
46
|
-
|
|
55
|
+
const extractedValue = extractAbbreviation(_monaco, model, position, extractOptions);
|
|
47
56
|
if (!extractedValue) {
|
|
48
57
|
return;
|
|
49
58
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
const {
|
|
60
|
+
abbreviationRange,
|
|
61
|
+
abbreviation,
|
|
62
|
+
filter
|
|
63
|
+
} = extractedValue;
|
|
64
|
+
const currentLineTillPosition = getCurrentLine(model, position).substr(0, position.column - 1);
|
|
65
|
+
const currentWord = getCurrentWord(currentLineTillPosition);
|
|
55
66
|
// Don't attempt to expand open tags
|
|
56
|
-
if (currentWord === abbreviation && currentLineTillPosition.endsWith(
|
|
67
|
+
if (currentWord === abbreviation && currentLineTillPosition.endsWith(`<${abbreviation}`) && syntaxes.markup.includes(syntax)) {
|
|
57
68
|
return;
|
|
58
69
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
const expandOptions = getExpandOptions(syntax, emmetConfig, filter);
|
|
71
|
+
let expandedText = "";
|
|
72
|
+
let expandedAbbr;
|
|
73
|
+
let completionItems = [];
|
|
63
74
|
// Create completion item after expanding given abbreviation
|
|
64
75
|
// if abbreviation is valid and expanded value is not noise
|
|
65
|
-
|
|
76
|
+
const createExpandedAbbr = (syntax, abbr) => {
|
|
66
77
|
if (!isAbbreviationValid(syntax, abbreviation)) {
|
|
67
78
|
return;
|
|
68
79
|
}
|
|
@@ -90,9 +101,7 @@ function doComplete(_monaco, model, position, syntax, emmetConfig) {
|
|
|
90
101
|
if (isStyleSheet(syntax)) {
|
|
91
102
|
createExpandedAbbr(syntax, abbreviation);
|
|
92
103
|
// 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(
|
|
94
|
-
return x.startsWith(abbreviation);
|
|
95
|
-
})) {
|
|
104
|
+
if (abbreviation.length > 4 && cssData.properties.find(x => x.startsWith(abbreviation))) {
|
|
96
105
|
return {
|
|
97
106
|
suggestions: [],
|
|
98
107
|
incomplete: true
|
|
@@ -105,17 +114,13 @@ function doComplete(_monaco, model, position, syntax, emmetConfig) {
|
|
|
105
114
|
expandedAbbr.label = removeTabStops(expandedText);
|
|
106
115
|
expandedAbbr.filterText = abbreviation;
|
|
107
116
|
// Custom snippets should show up in completions if abbreviation is a prefix
|
|
108
|
-
|
|
117
|
+
const stylesheetCustomSnippetsKeys = stylesheetCustomSnippetsKeyCache.has(syntax) ? stylesheetCustomSnippetsKeyCache.get(syntax) : stylesheetCustomSnippetsKeyCache.get('css');
|
|
109
118
|
completionItems = makeSnippetSuggestion(_monaco, stylesheetCustomSnippetsKeys !== null && stylesheetCustomSnippetsKeys !== void 0 ? stylesheetCustomSnippetsKeys : [], abbreviation, abbreviation, abbreviationRange, expandOptions, 'Emmet Custom Snippet', false);
|
|
110
|
-
if (!completionItems.find(
|
|
111
|
-
return x.insertText === (expandedAbbr === null || expandedAbbr === void 0 ? void 0 : expandedAbbr.insertText);
|
|
112
|
-
})) {
|
|
119
|
+
if (!completionItems.find(x => x.insertText === (expandedAbbr === null || expandedAbbr === void 0 ? void 0 : expandedAbbr.insertText))) {
|
|
113
120
|
// Fix for https://github.com/Microsoft/vscode/issues/28933#issuecomment-309236902
|
|
114
121
|
// When user types in propertyname, emmet uses it to match with snippet names, resulting in width -> widows or font-family -> font: family
|
|
115
122
|
// Filter out those cases here.
|
|
116
|
-
|
|
117
|
-
return x === '$' || x === '+' ? '\\' + x : x;
|
|
118
|
-
}).join('.*') + '.*', 'i');
|
|
123
|
+
const abbrRegex = new RegExp('.*' + abbreviation.split('').map(x => x === '$' || x === '+' ? '\\' + x : x).join('.*') + '.*', 'i');
|
|
119
124
|
if (/\d/.test(abbreviation) || abbrRegex.test(expandedAbbr.label)) {
|
|
120
125
|
completionItems.push(expandedAbbr);
|
|
121
126
|
}
|
|
@@ -123,23 +128,21 @@ function doComplete(_monaco, model, position, syntax, emmetConfig) {
|
|
|
123
128
|
}
|
|
124
129
|
} else {
|
|
125
130
|
createExpandedAbbr(syntax, abbreviation);
|
|
126
|
-
|
|
127
|
-
|
|
131
|
+
let tagToFindMoreSuggestionsFor = abbreviation;
|
|
132
|
+
const newTagMatches = /(>|\+)([\w:-]+)$/.exec(abbreviation);
|
|
128
133
|
if (newTagMatches && newTagMatches.length === 3) {
|
|
129
134
|
tagToFindMoreSuggestionsFor = newTagMatches[2];
|
|
130
135
|
}
|
|
131
136
|
if (syntax !== 'xml') {
|
|
132
|
-
|
|
137
|
+
const commonlyUsedTagSuggestions = makeSnippetSuggestion(_monaco, commonlyUsedTags, tagToFindMoreSuggestionsFor, abbreviation, abbreviationRange, expandOptions, 'Emmet Abbreviation');
|
|
133
138
|
completionItems = completionItems.concat(commonlyUsedTagSuggestions);
|
|
134
139
|
}
|
|
135
140
|
if (emmetConfig.showAbbreviationSuggestions === true) {
|
|
136
|
-
|
|
137
|
-
return !commonlyUsedTags.includes(x);
|
|
138
|
-
}), tagToFindMoreSuggestionsFor, abbreviation, abbreviationRange, expandOptions, 'Emmet Abbreviation');
|
|
141
|
+
const abbreviationSuggestions = makeSnippetSuggestion(_monaco, markupSnippetKeys.filter(x => !commonlyUsedTags.includes(x)), tagToFindMoreSuggestionsFor, abbreviation, abbreviationRange, expandOptions, 'Emmet Abbreviation');
|
|
139
142
|
// Workaround for the main expanded abbr not appearing before the snippet suggestions
|
|
140
143
|
if (expandedAbbr && abbreviationSuggestions.length > 0 && tagToFindMoreSuggestionsFor !== abbreviation) {
|
|
141
144
|
expandedAbbr.sortText = '0' + expandedAbbr.label;
|
|
142
|
-
abbreviationSuggestions.forEach(
|
|
145
|
+
abbreviationSuggestions.forEach(item => {
|
|
143
146
|
// Workaround for snippet suggestions items getting filtered out as the complete abbr does not start with snippetKey
|
|
144
147
|
item.filterText = abbreviation;
|
|
145
148
|
// Workaround for the main expanded abbr not appearing before the snippet suggestions
|
|
@@ -149,16 +152,12 @@ function doComplete(_monaco, model, position, syntax, emmetConfig) {
|
|
|
149
152
|
completionItems = completionItems.concat(abbreviationSuggestions);
|
|
150
153
|
}
|
|
151
154
|
// 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) ===
|
|
153
|
-
completionItems = completionItems.filter(
|
|
154
|
-
return item.label !== abbreviation;
|
|
155
|
-
});
|
|
155
|
+
if (syntax === 'html' && completionItems.length >= 2 && abbreviation.includes(":") && (expandedAbbr === null || expandedAbbr === void 0 ? void 0 : expandedAbbr.insertText) === `<${abbreviation}>\${0}</${abbreviation}>`) {
|
|
156
|
+
completionItems = completionItems.filter(item => item.label !== abbreviation);
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
if (emmetConfig.showSuggestionsAsSnippets === true) {
|
|
159
|
-
completionItems.forEach(
|
|
160
|
-
return x.kind = _monaco.languages.CompletionItemKind.Snippet;
|
|
161
|
-
});
|
|
160
|
+
completionItems.forEach(x => x.kind = _monaco.languages.CompletionItemKind.Snippet);
|
|
162
161
|
}
|
|
163
162
|
return completionItems.length ? {
|
|
164
163
|
suggestions: completionItems,
|
|
@@ -168,25 +167,24 @@ function doComplete(_monaco, model, position, syntax, emmetConfig) {
|
|
|
168
167
|
/**
|
|
169
168
|
* Create & return snippets for snippet keys that start with given prefix
|
|
170
169
|
*/
|
|
171
|
-
function makeSnippetSuggestion(_monaco, snippetKeys, prefix, abbreviation, abbreviationRange, expandOptions, snippetDetail) {
|
|
172
|
-
var skipFullMatch = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
|
|
170
|
+
function makeSnippetSuggestion(_monaco, snippetKeys, prefix, abbreviation, abbreviationRange, expandOptions, snippetDetail, skipFullMatch = true) {
|
|
173
171
|
if (!prefix || !snippetKeys) {
|
|
174
172
|
return [];
|
|
175
173
|
}
|
|
176
|
-
|
|
177
|
-
snippetKeys.forEach(
|
|
174
|
+
const snippetCompletions = [];
|
|
175
|
+
snippetKeys.forEach(snippetKey => {
|
|
178
176
|
if (!snippetKey.startsWith(prefix.toLowerCase()) || skipFullMatch && snippetKey === prefix.toLowerCase()) {
|
|
179
177
|
return;
|
|
180
178
|
}
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
const currentAbbr = abbreviation + snippetKey.substr(prefix.length);
|
|
180
|
+
let expandedAbbr;
|
|
183
181
|
try {
|
|
184
182
|
expandedAbbr = expand(currentAbbr, expandOptions);
|
|
185
183
|
} catch (e) {}
|
|
186
184
|
if (!expandedAbbr) {
|
|
187
185
|
return;
|
|
188
186
|
}
|
|
189
|
-
|
|
187
|
+
const item = {
|
|
190
188
|
kind: _monaco.languages.CompletionItemKind.Property,
|
|
191
189
|
label: prefix + snippetKey.substr(prefix.length),
|
|
192
190
|
documentation: replaceTabStopsWithCursors(expandedAbbr),
|
|
@@ -201,7 +199,7 @@ function makeSnippetSuggestion(_monaco, snippetKeys, prefix, abbreviation, abbre
|
|
|
201
199
|
}
|
|
202
200
|
function getCurrentWord(currentLineTillPosition) {
|
|
203
201
|
if (currentLineTillPosition) {
|
|
204
|
-
|
|
202
|
+
const matches = /[\w,:,-,\.]*$/.exec(currentLineTillPosition);
|
|
205
203
|
if (matches) {
|
|
206
204
|
return matches[0];
|
|
207
205
|
}
|
|
@@ -220,12 +218,12 @@ function addFinalTabStop(text) {
|
|
|
220
218
|
if (!text || !text.trim()) {
|
|
221
219
|
return text;
|
|
222
220
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
221
|
+
let maxTabStop = -1;
|
|
222
|
+
let maxTabStopRanges = [];
|
|
223
|
+
let foundLastStop = false;
|
|
224
|
+
let replaceWithLastStop = false;
|
|
225
|
+
let i = 0;
|
|
226
|
+
const n = text.length;
|
|
229
227
|
try {
|
|
230
228
|
while (i < n && !foundLastStop) {
|
|
231
229
|
// Look for ${
|
|
@@ -233,8 +231,8 @@ function addFinalTabStop(text) {
|
|
|
233
231
|
continue;
|
|
234
232
|
}
|
|
235
233
|
// Find tabstop
|
|
236
|
-
|
|
237
|
-
|
|
234
|
+
let numberStart = -1;
|
|
235
|
+
let numberEnd = -1;
|
|
238
236
|
while (i < n && /\d/.test(text[i])) {
|
|
239
237
|
numberStart = numberStart < 0 ? i : numberStart;
|
|
240
238
|
numberEnd = i + 1;
|
|
@@ -245,12 +243,12 @@ function addFinalTabStop(text) {
|
|
|
245
243
|
continue;
|
|
246
244
|
}
|
|
247
245
|
// If ${0} was found, then break
|
|
248
|
-
|
|
246
|
+
const currentTabStop = text.substring(numberStart, numberEnd);
|
|
249
247
|
foundLastStop = currentTabStop === '0';
|
|
250
248
|
if (foundLastStop) {
|
|
251
249
|
break;
|
|
252
250
|
}
|
|
253
|
-
|
|
251
|
+
let foundPlaceholder = false;
|
|
254
252
|
if (text[i++] == ':') {
|
|
255
253
|
// TODO: Nested placeholders may break here
|
|
256
254
|
while (i < n) {
|
|
@@ -265,37 +263,35 @@ function addFinalTabStop(text) {
|
|
|
265
263
|
if (Number(currentTabStop) > Number(maxTabStop)) {
|
|
266
264
|
maxTabStop = Number(currentTabStop);
|
|
267
265
|
maxTabStopRanges = [{
|
|
268
|
-
numberStart
|
|
269
|
-
numberEnd
|
|
266
|
+
numberStart,
|
|
267
|
+
numberEnd
|
|
270
268
|
}];
|
|
271
269
|
replaceWithLastStop = !foundPlaceholder;
|
|
272
270
|
} else if (Number(currentTabStop) === maxTabStop) {
|
|
273
271
|
maxTabStopRanges.push({
|
|
274
|
-
numberStart
|
|
275
|
-
numberEnd
|
|
272
|
+
numberStart,
|
|
273
|
+
numberEnd
|
|
276
274
|
});
|
|
277
275
|
}
|
|
278
276
|
}
|
|
279
277
|
} catch (e) {}
|
|
280
278
|
if (replaceWithLastStop && !foundLastStop) {
|
|
281
|
-
for (
|
|
282
|
-
|
|
283
|
-
|
|
279
|
+
for (let i = 0; i < maxTabStopRanges.length; i++) {
|
|
280
|
+
const rangeStart = maxTabStopRanges[i].numberStart;
|
|
281
|
+
const rangeEnd = maxTabStopRanges[i].numberEnd;
|
|
284
282
|
text = text.substr(0, rangeStart) + '0' + text.substr(rangeEnd);
|
|
285
283
|
}
|
|
286
284
|
}
|
|
287
285
|
return text;
|
|
288
286
|
}
|
|
289
287
|
function getCurrentLine(model, position) {
|
|
290
|
-
|
|
288
|
+
const currentLine = model.getLineContent(position.lineNumber);
|
|
291
289
|
return currentLine;
|
|
292
290
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
return "${".concat(index).concat(placeholder ? ':' + placeholder : '', "}");
|
|
298
|
-
};
|
|
291
|
+
let customSnippetsRegistry = {};
|
|
292
|
+
let variablesFromFile = {};
|
|
293
|
+
let profilesFromFile = {};
|
|
294
|
+
const emmetSnippetField = (index, placeholder) => `\${${index}${placeholder ? ':' + placeholder : ''}}`;
|
|
299
295
|
/** Returns whether or not syntax is a supported stylesheet syntax, like CSS */
|
|
300
296
|
function isStyleSheet(syntax) {
|
|
301
297
|
return syntaxes.stylesheet.includes(syntax);
|
|
@@ -310,26 +306,26 @@ function getDefaultSyntax(syntax) {
|
|
|
310
306
|
}
|
|
311
307
|
/** Returns the default snippets that Emmet suggests */
|
|
312
308
|
function getDefaultSnippets(syntax) {
|
|
313
|
-
|
|
314
|
-
|
|
309
|
+
const syntaxType = getSyntaxType(syntax);
|
|
310
|
+
const emptyUserConfig = {
|
|
315
311
|
type: syntaxType,
|
|
316
|
-
syntax
|
|
312
|
+
syntax
|
|
317
313
|
};
|
|
318
|
-
|
|
314
|
+
const resolvedConfig = resolveConfig(emptyUserConfig);
|
|
319
315
|
// https://github.com/microsoft/vscode/issues/97632
|
|
320
316
|
// don't return markup (HTML) snippets for XML
|
|
321
317
|
return syntax === 'xml' ? {} : resolvedConfig.snippets;
|
|
322
318
|
}
|
|
323
319
|
function getFilters(text, pos) {
|
|
324
|
-
|
|
325
|
-
for (
|
|
326
|
-
if (text.endsWith(
|
|
320
|
+
let filter;
|
|
321
|
+
for (let i = 0; i < maxFilters; i++) {
|
|
322
|
+
if (text.endsWith(`${filterDelimitor}${bemFilterSuffix}`, pos)) {
|
|
327
323
|
pos -= bemFilterSuffix.length + 1;
|
|
328
324
|
filter = filter ? bemFilterSuffix + ',' + filter : bemFilterSuffix;
|
|
329
|
-
} else if (text.endsWith(
|
|
325
|
+
} else if (text.endsWith(`${filterDelimitor}${commentFilterSuffix}`, pos)) {
|
|
330
326
|
pos -= commentFilterSuffix.length + 1;
|
|
331
327
|
filter = filter ? commentFilterSuffix + ',' + filter : commentFilterSuffix;
|
|
332
|
-
} else if (text.endsWith(
|
|
328
|
+
} else if (text.endsWith(`${filterDelimitor}${trimFilterSuffix}`, pos)) {
|
|
333
329
|
pos -= trimFilterSuffix.length + 1;
|
|
334
330
|
filter = filter ? trimFilterSuffix + ',' + filter : trimFilterSuffix;
|
|
335
331
|
} else {
|
|
@@ -345,21 +341,22 @@ function getFilters(text, pos) {
|
|
|
345
341
|
* Extracts abbreviation from the given position in the given document
|
|
346
342
|
*/
|
|
347
343
|
function extractAbbreviation(_monaco, model, position, options) {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
pos
|
|
352
|
-
filter
|
|
353
|
-
|
|
354
|
-
|
|
344
|
+
const currentLine = model.getLineContent(position.lineNumber);
|
|
345
|
+
const currentLineTillPosition = currentLine.substr(0, position.column - 1);
|
|
346
|
+
const {
|
|
347
|
+
pos,
|
|
348
|
+
filter
|
|
349
|
+
} = getFilters(currentLineTillPosition, position.column - 1);
|
|
350
|
+
const lengthOccupiedByFilter = filter ? filter.length + 1 : 0;
|
|
351
|
+
const result = extract(currentLine, pos, options);
|
|
355
352
|
if (!result) {
|
|
356
353
|
return;
|
|
357
354
|
}
|
|
358
|
-
|
|
355
|
+
const rangeToReplace = new _monaco.Range(position.lineNumber, result.location + 1, position.lineNumber, result.location + result.abbreviation.length + lengthOccupiedByFilter + 1);
|
|
359
356
|
return {
|
|
360
357
|
abbreviationRange: rangeToReplace,
|
|
361
358
|
abbreviation: result.abbreviation,
|
|
362
|
-
filter
|
|
359
|
+
filter
|
|
363
360
|
};
|
|
364
361
|
}
|
|
365
362
|
/**
|
|
@@ -375,7 +372,7 @@ function isAbbreviationValid(syntax, abbreviation) {
|
|
|
375
372
|
if (isStyleSheet(syntax)) {
|
|
376
373
|
if (abbreviation.includes('#')) {
|
|
377
374
|
if (abbreviation.startsWith('#')) {
|
|
378
|
-
|
|
375
|
+
const hexColorRegex = /^#[\d,a-f,A-F]{1,6}$/;
|
|
379
376
|
return hexColorRegex.test(abbreviation);
|
|
380
377
|
} else if (commonlyUsedTags.includes(abbreviation.substring(0, abbreviation.indexOf('#')))) {
|
|
381
378
|
return false;
|
|
@@ -401,18 +398,16 @@ function isExpandedTextNoise(syntax, abbreviation, expandedText, options) {
|
|
|
401
398
|
// Unresolved css abbreviations get expanded to a blank property value
|
|
402
399
|
// Eg: abc -> abc: ; or abc:d -> abc: d; which is noise if it gets suggested for every word typed
|
|
403
400
|
if (isStyleSheet(syntax) && options) {
|
|
404
|
-
|
|
405
|
-
|
|
401
|
+
const between = (_a = options['stylesheet.between']) !== null && _a !== void 0 ? _a : ': ';
|
|
402
|
+
const after = (_b = options['stylesheet.after']) !== null && _b !== void 0 ? _b : ';';
|
|
406
403
|
// Remove overlapping between `abbreviation` and `between`, if any
|
|
407
|
-
|
|
404
|
+
let endPrefixIndex = abbreviation.indexOf(between[0], Math.max(abbreviation.length - between.length, 0));
|
|
408
405
|
endPrefixIndex = endPrefixIndex >= 0 ? endPrefixIndex : abbreviation.length;
|
|
409
|
-
|
|
410
|
-
return expandedText ===
|
|
406
|
+
const abbr = abbreviation.substring(0, endPrefixIndex);
|
|
407
|
+
return expandedText === `${abbr}${between}\${0}${after}` || expandedText.replace(/\s/g, '') === abbreviation.replace(/\s/g, '') + after;
|
|
411
408
|
}
|
|
412
409
|
// we don't want common html tags suggested for xml
|
|
413
|
-
if (syntax === 'xml' && commonlyUsedTags.some(
|
|
414
|
-
return tag.startsWith(abbreviation.toLowerCase());
|
|
415
|
-
})) {
|
|
410
|
+
if (syntax === 'xml' && commonlyUsedTags.some(tag => tag.startsWith(abbreviation.toLowerCase()))) {
|
|
416
411
|
return true;
|
|
417
412
|
}
|
|
418
413
|
if (commonlyUsedTags.includes(abbreviation.toLowerCase()) || markupSnippetKeys.includes(abbreviation)) {
|
|
@@ -430,7 +425,7 @@ function isExpandedTextNoise(syntax, abbreviation, expandedText, options) {
|
|
|
430
425
|
if (abbreviation === '.') {
|
|
431
426
|
return false;
|
|
432
427
|
}
|
|
433
|
-
|
|
428
|
+
const dotMatches = /^([a-z,A-Z,\d]*)\.$/.exec(abbreviation);
|
|
434
429
|
if (dotMatches) {
|
|
435
430
|
// Valid html tags such as `div.`
|
|
436
431
|
if (dotMatches[1] && htmlData.tags.includes(dotMatches[1])) {
|
|
@@ -446,7 +441,7 @@ function isExpandedTextNoise(syntax, abbreviation, expandedText, options) {
|
|
|
446
441
|
}
|
|
447
442
|
// Unresolved html abbreviations get expanded as if it were a tag
|
|
448
443
|
// Eg: abc -> <abc></abc> which is noise if it gets suggested for every word typed
|
|
449
|
-
return expandedText.toLowerCase() ===
|
|
444
|
+
return expandedText.toLowerCase() === `<${abbreviation.toLowerCase()}>\${1}</${abbreviation.toLowerCase()}>`;
|
|
450
445
|
}
|
|
451
446
|
/**
|
|
452
447
|
* Returns options to be used by emmet
|
|
@@ -455,26 +450,20 @@ function getExpandOptions(syntax, emmetConfig, filter) {
|
|
|
455
450
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
456
451
|
emmetConfig = emmetConfig !== null && emmetConfig !== void 0 ? emmetConfig : {};
|
|
457
452
|
emmetConfig['preferences'] = (_a = emmetConfig['preferences']) !== null && _a !== void 0 ? _a : {};
|
|
458
|
-
|
|
459
|
-
|
|
453
|
+
const preferences = emmetConfig['preferences'];
|
|
454
|
+
const stylesheetSyntax = isStyleSheet(syntax) ? syntax : 'css';
|
|
460
455
|
// Fetch Profile
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
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');
|
|
456
|
+
const profile = getProfile(syntax, (_b = emmetConfig['syntaxProfiles']) !== null && _b !== void 0 ? _b : {});
|
|
457
|
+
const filtersFromProfile = profile && profile['filters'] ? profile['filters'].split(',') : [];
|
|
458
|
+
const trimmedFilters = filtersFromProfile.map(filterFromProfile => filterFromProfile.trim());
|
|
459
|
+
const bemEnabled = filter && filter.split(',').some(x => x.trim() === 'bem') || trimmedFilters.includes('bem');
|
|
460
|
+
const commentEnabled = filter && filter.split(',').some(x => x.trim() === 'c') || trimmedFilters.includes('c');
|
|
472
461
|
// Fetch formatters
|
|
473
|
-
|
|
474
|
-
|
|
462
|
+
const formatters = getFormatters(syntax, emmetConfig['preferences']);
|
|
463
|
+
const unitAliases = (formatters === null || formatters === void 0 ? void 0 : formatters.stylesheet) && formatters.stylesheet['unitAliases'] || {};
|
|
475
464
|
// These options are the default values provided by vscode for
|
|
476
465
|
// extension preferences
|
|
477
|
-
|
|
466
|
+
const defaultVSCodeOptions = {
|
|
478
467
|
// inlineElements: string[],
|
|
479
468
|
// 'output.indent': string,
|
|
480
469
|
// 'output.baseIndent': string,
|
|
@@ -520,7 +509,7 @@ function getExpandOptions(syntax, emmetConfig, filter) {
|
|
|
520
509
|
'stylesheet.fuzzySearchMinScore': 0.3
|
|
521
510
|
};
|
|
522
511
|
// These options come from user prefs in the vscode repo
|
|
523
|
-
|
|
512
|
+
const userPreferenceOptions = {
|
|
524
513
|
// inlineElements: string[],
|
|
525
514
|
// 'output.indent': string,
|
|
526
515
|
// 'output.baseIndent': string,
|
|
@@ -551,8 +540,8 @@ function getExpandOptions(syntax, emmetConfig, filter) {
|
|
|
551
540
|
// 'stylesheet.keywords': string[],
|
|
552
541
|
// 'stylesheet.unitless': string[],
|
|
553
542
|
'stylesheet.shortHex': preferences['css.color.short'],
|
|
554
|
-
'stylesheet.between': preferences[
|
|
555
|
-
'stylesheet.after': preferences[
|
|
543
|
+
'stylesheet.between': preferences[`${stylesheetSyntax}.valueSeparator`],
|
|
544
|
+
'stylesheet.after': preferences[`${stylesheetSyntax}.propertyEnd`],
|
|
556
545
|
'stylesheet.intUnit': preferences['css.intUnit'],
|
|
557
546
|
'stylesheet.floatUnit': preferences['css.floatUnit'],
|
|
558
547
|
'stylesheet.unitAliases': unitAliases,
|
|
@@ -560,24 +549,24 @@ function getExpandOptions(syntax, emmetConfig, filter) {
|
|
|
560
549
|
// 'stylesheet.jsonDoubleQuotes': boolean,
|
|
561
550
|
'stylesheet.fuzzySearchMinScore': preferences['css.fuzzySearchMinScore']
|
|
562
551
|
};
|
|
563
|
-
|
|
564
|
-
[
|
|
552
|
+
const combinedOptions = {};
|
|
553
|
+
[...Object.keys(defaultVSCodeOptions), ...Object.keys(userPreferenceOptions)].forEach(key => {
|
|
565
554
|
var _a;
|
|
566
|
-
|
|
555
|
+
const castKey = key;
|
|
567
556
|
combinedOptions[castKey] = (_a = userPreferenceOptions[castKey]) !== null && _a !== void 0 ? _a : defaultVSCodeOptions[castKey];
|
|
568
557
|
});
|
|
569
|
-
|
|
558
|
+
const mergedAliases = Object.assign(Object.assign({}, defaultVSCodeOptions['stylesheet.unitAliases']), userPreferenceOptions['stylesheet.unitAliases']);
|
|
570
559
|
combinedOptions['stylesheet.unitAliases'] = mergedAliases;
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
560
|
+
const type = getSyntaxType(syntax);
|
|
561
|
+
const variables = getVariables(emmetConfig['variables']);
|
|
562
|
+
const baseSyntax = getDefaultSyntax(syntax);
|
|
563
|
+
const snippets = type === 'stylesheet' ? (_k = customSnippetsRegistry[syntax]) !== null && _k !== void 0 ? _k : customSnippetsRegistry[baseSyntax] : customSnippetsRegistry[syntax];
|
|
575
564
|
return {
|
|
576
|
-
type
|
|
565
|
+
type,
|
|
577
566
|
options: combinedOptions,
|
|
578
|
-
variables
|
|
579
|
-
snippets
|
|
580
|
-
syntax
|
|
567
|
+
variables,
|
|
568
|
+
snippets,
|
|
569
|
+
syntax,
|
|
581
570
|
// context: null,
|
|
582
571
|
text: undefined,
|
|
583
572
|
maxRepeat: 1000
|
|
@@ -607,8 +596,8 @@ function getProfile(syntax, profilesFromSettings) {
|
|
|
607
596
|
if (!profilesFromSettings) {
|
|
608
597
|
profilesFromSettings = {};
|
|
609
598
|
}
|
|
610
|
-
|
|
611
|
-
|
|
599
|
+
const profilesConfig = Object.assign({}, profilesFromFile, profilesFromSettings);
|
|
600
|
+
const options = profilesConfig[syntax];
|
|
612
601
|
if (!options || typeof options === 'string') {
|
|
613
602
|
if (options === 'xhtml') {
|
|
614
603
|
return {
|
|
@@ -617,8 +606,8 @@ function getProfile(syntax, profilesFromSettings) {
|
|
|
617
606
|
}
|
|
618
607
|
return {};
|
|
619
608
|
}
|
|
620
|
-
|
|
621
|
-
for (
|
|
609
|
+
const newOptions = {};
|
|
610
|
+
for (const key in options) {
|
|
622
611
|
switch (key) {
|
|
623
612
|
case 'tag_case':
|
|
624
613
|
newOptions['tagCase'] = options[key] === 'lower' || options[key] === 'upper' ? options[key] : '';
|
|
@@ -666,12 +655,12 @@ function getVariables(variablesFromSettings) {
|
|
|
666
655
|
return Object.assign({}, variablesFromFile, variablesFromSettings);
|
|
667
656
|
}
|
|
668
657
|
function getFormatters(syntax, preferences) {
|
|
669
|
-
if (!preferences ||
|
|
658
|
+
if (!preferences || typeof preferences !== 'object') {
|
|
670
659
|
return {};
|
|
671
660
|
}
|
|
672
661
|
if (!isStyleSheet(syntax)) {
|
|
673
|
-
|
|
674
|
-
for (
|
|
662
|
+
const commentFormatter = {};
|
|
663
|
+
for (const key in preferences) {
|
|
675
664
|
switch (key) {
|
|
676
665
|
case 'filter.commentAfter':
|
|
677
666
|
commentFormatter['after'] = preferences[key];
|
|
@@ -688,31 +677,31 @@ function getFormatters(syntax, preferences) {
|
|
|
688
677
|
comment: commentFormatter
|
|
689
678
|
};
|
|
690
679
|
}
|
|
691
|
-
|
|
680
|
+
let fuzzySearchMinScore = typeof (preferences === null || preferences === void 0 ? void 0 : preferences['css.fuzzySearchMinScore']) === 'number' ? preferences['css.fuzzySearchMinScore'] : 0.3;
|
|
692
681
|
if (fuzzySearchMinScore > 1) {
|
|
693
682
|
fuzzySearchMinScore = 1;
|
|
694
683
|
} else if (fuzzySearchMinScore < 0) {
|
|
695
684
|
fuzzySearchMinScore = 0;
|
|
696
685
|
}
|
|
697
|
-
|
|
686
|
+
const stylesheetFormatter = {
|
|
698
687
|
'fuzzySearchMinScore': fuzzySearchMinScore
|
|
699
688
|
};
|
|
700
|
-
|
|
701
|
-
switch (
|
|
689
|
+
for (const key in preferences) {
|
|
690
|
+
switch (key) {
|
|
702
691
|
case 'css.floatUnit':
|
|
703
|
-
stylesheetFormatter['floatUnit'] = preferences[
|
|
692
|
+
stylesheetFormatter['floatUnit'] = preferences[key];
|
|
704
693
|
break;
|
|
705
694
|
case 'css.intUnit':
|
|
706
|
-
stylesheetFormatter['intUnit'] = preferences[
|
|
695
|
+
stylesheetFormatter['intUnit'] = preferences[key];
|
|
707
696
|
break;
|
|
708
697
|
case 'css.unitAliases':
|
|
709
|
-
|
|
710
|
-
preferences[
|
|
698
|
+
const unitAliases = {};
|
|
699
|
+
preferences[key].split(',').forEach(alias => {
|
|
711
700
|
if (!alias || !alias.trim() || !alias.includes(':')) {
|
|
712
701
|
return;
|
|
713
702
|
}
|
|
714
|
-
|
|
715
|
-
|
|
703
|
+
const aliasName = alias.substr(0, alias.indexOf(':'));
|
|
704
|
+
const aliasValue = alias.substr(aliasName.length + 1);
|
|
716
705
|
if (!aliasName.trim() || !aliasValue) {
|
|
717
706
|
return;
|
|
718
707
|
}
|
|
@@ -720,16 +709,13 @@ function getFormatters(syntax, preferences) {
|
|
|
720
709
|
});
|
|
721
710
|
stylesheetFormatter['unitAliases'] = unitAliases;
|
|
722
711
|
break;
|
|
723
|
-
case
|
|
724
|
-
stylesheetFormatter['between'] = preferences[
|
|
712
|
+
case `${syntax}.valueSeparator`:
|
|
713
|
+
stylesheetFormatter['between'] = preferences[key];
|
|
725
714
|
break;
|
|
726
|
-
case
|
|
727
|
-
stylesheetFormatter['after'] = preferences[
|
|
715
|
+
case `${syntax}.propertyEnd`:
|
|
716
|
+
stylesheetFormatter['after'] = preferences[key];
|
|
728
717
|
break;
|
|
729
718
|
}
|
|
730
|
-
};
|
|
731
|
-
for (var _key in preferences) {
|
|
732
|
-
_loop();
|
|
733
719
|
}
|
|
734
720
|
return {
|
|
735
721
|
stylesheet: stylesheetFormatter
|
|
@@ -744,8 +730,7 @@ function getFormatters(syntax, preferences) {
|
|
|
744
730
|
* @param language
|
|
745
731
|
* @param exlcudedLanguages Array of language ids that user has chosen to exlcude for emmet
|
|
746
732
|
*/
|
|
747
|
-
function getEmmetMode(language) {
|
|
748
|
-
var excludedLanguages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
733
|
+
function getEmmetMode(language, excludedLanguages = []) {
|
|
749
734
|
if (!language || excludedLanguages.includes(language)) {
|
|
750
735
|
return;
|
|
751
736
|
}
|