@deephaven/console 1.30.0 → 1.30.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/dist/ConsoleInput.d.ts +13 -6
- package/dist/ConsoleInput.d.ts.map +1 -1
- package/dist/ConsoleInput.js +95 -62
- package/dist/ConsoleInput.js.map +1 -1
- package/dist/common/Code.d.ts.map +1 -1
- package/dist/common/Code.js +24 -2
- package/dist/common/Code.js.map +1 -1
- package/dist/log/LogView.d.ts +3 -4
- package/dist/log/LogView.d.ts.map +1 -1
- package/dist/log/LogView.js +34 -35
- package/dist/log/LogView.js.map +1 -1
- package/dist/monaco/MonacoProviders.d.ts +1 -1
- package/dist/monaco/MonacoProviders.d.ts.map +1 -1
- package/dist/monaco/MonacoProviders.js +11 -3
- package/dist/monaco/MonacoProviders.js.map +1 -1
- package/dist/monaco/MonacoUtils.d.ts +28 -6
- package/dist/monaco/MonacoUtils.d.ts.map +1 -1
- package/dist/monaco/MonacoUtils.js +115 -15
- package/dist/monaco/MonacoUtils.js.map +1 -1
- package/dist/monaco/RuffSettingsModal.d.ts.map +1 -1
- package/dist/monaco/RuffSettingsModal.js +45 -30
- package/dist/monaco/RuffSettingsModal.js.map +1 -1
- package/dist/notebook/Editor.d.ts +5 -3
- package/dist/notebook/Editor.d.ts.map +1 -1
- package/dist/notebook/Editor.js +61 -44
- package/dist/notebook/Editor.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonacoUtils.js","names":["nanoid","throttle","resolveCssVariablesInRecord","assertNotNull","find","linkifyFind","monaco","KeyCodeUtils","Log","MonacoThemeRaw","PyLang","GroovyLang","ScalaLang","DbLang","LogLang","MonacoProviders","log","module","CONSOLE_URI_PREFIX","MonacoUtils","init","_ref","arguments","length","undefined","getWorker","debug","registerGetWorker","initTheme","registerLanguages","languages","onLanguage","registerCodeActionProvider","provideCodeActions","handlePythonCodeActionRequest","providedCodeActionKinds","registerDocumentFormattingEditProvider","provideDocumentFormattingEdits","handlePythonFormatRequest","editor","onDidCreateModel","model","getLanguageId","ruffWorkspace","lintPython","throttledLint","m","onDidChangeContent","removeConflictingKeybindings","_MonacoTheme$logErro","_MonacoTheme$logErro2","removeHashtag","MonacoTheme","debug2","dhDarkRules","token","foreground","string","keyword","delimiter","comment","number","storage","identifier","operator","predefined","substring","dhDarkColors","errorForeground","background","focusBorder","defineTheme","base","inherit","rules","colors","setTheme","err","error","window","MonacoEnvironment","_objectSpread","color","_color$substring","languageIds","map","_ref2","id","getLanguages","filter","_ref3","includes","forEach","languageParam","language","registerLanguage","register","setLanguageConfiguration","conf","setMonarchTokensProvider","setEOL","_editor$getModel","eolSequence","EndOfLineSequence","LF","getModel","openDocument","session","didOpenDocumentParams","textDocument","uri","concat","languageId","version","getVersionId","text","getValue","dispose","onDidChangeModelContent","changedEvent","changes","versionId","contentChanges","i","change","range","rangeLength","contentChange","start","line","startLineNumber","character","startColumn","end","endLineNumber","endColumn","push","didChangeDocumentParams","changeDocument","closeDocument","didCloseDocumentParams","registerPasteHandler","onDidPaste","pasteEvent","smartQuotes","invalidChars","invalidSpaces","editorModel","pastedText","getValueInRange","test","applyEdits","replace","isMacPlatform","platform","navigator","startsWith","addKeybindingRule","keybinding","KeyMod","CtrlCmd","KeyCode","KeyD","command","KeyH","disableKeyBindings","keybindings","addAction","label","run","getMonacoKeyCodeFromShortcut","shortcut","keyState","keyValue","isMac","metaKey","shiftKey","Shift","altKey","Alt","ctrlKey","WinCtrl","fromString","provideLinks","newTokens","_loop","lineText","getLineContent","originalTokens","tokens","type","value","url","href","Range","getLineCount","links","generateConsoleUri","Uri","parse","isConsoleModel","toString","canFormat","_editor$getAction","getAction","isSupported","formatDocument","_asyncToGenerator","_editor$getAction2"],"sources":["../../src/monaco/MonacoUtils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport { nanoid } from 'nanoid';\nimport throttle from 'lodash.throttle';\n/**\n * Exports a function for initializing monaco with the deephaven theme/config\n */\nimport {\n resolveCssVariablesInRecord,\n type Shortcut,\n} from '@deephaven/components';\nimport type { dh } from '@deephaven/jsapi-types';\nimport { assertNotNull } from '@deephaven/utils';\nimport { find as linkifyFind } from 'linkifyjs';\nimport * as monaco from 'monaco-editor';\nimport type { Environment } from 'monaco-editor';\n// @ts-ignore\nimport { KeyCodeUtils } from 'monaco-editor/esm/vs/base/common/keyCodes.js';\nimport Log from '@deephaven/log';\nimport MonacoThemeRaw from './MonacoTheme.module.scss';\nimport PyLang from './lang/python';\nimport GroovyLang from './lang/groovy';\nimport ScalaLang from './lang/scala';\nimport DbLang from './lang/db';\nimport LogLang from './lang/log';\nimport { type Language } from './lang/Language';\nimport MonacoProviders from './MonacoProviders';\n\nconst log = Log.module('MonacoUtils');\n\nconst CONSOLE_URI_PREFIX = 'inmemory://dh-console/';\n\ndeclare global {\n interface Window {\n MonacoEnvironment?: Environment;\n }\n}\n\nclass MonacoUtils {\n /**\n * Initializes Monaco for the environment\n * @param getWorker The getWorker function Monaco should use\n * The workers should be provided by the caller and bundled by their build system (e.g. Vite, Webpack)\n */\n static init({\n getWorker,\n }: { getWorker?: Environment['getWorker'] } = {}): void {\n log.debug('Initializing Monaco...');\n\n if (getWorker !== undefined) {\n MonacoUtils.registerGetWorker(getWorker);\n }\n\n const { initTheme, registerLanguages } = MonacoUtils;\n\n initTheme();\n\n registerLanguages([DbLang, PyLang, GroovyLang, LogLang, ScalaLang]);\n\n monaco.languages.onLanguage('python', () => {\n monaco.languages.registerCodeActionProvider(\n 'python',\n {\n provideCodeActions: MonacoProviders.handlePythonCodeActionRequest,\n },\n { providedCodeActionKinds: ['quickfix'] }\n );\n\n monaco.languages.registerDocumentFormattingEditProvider('python', {\n provideDocumentFormattingEdits:\n MonacoProviders.handlePythonFormatRequest,\n });\n });\n\n monaco.editor.onDidCreateModel(model => {\n // Lint Python models on creation and on change\n if (model.getLanguageId() === 'python') {\n if (MonacoProviders.ruffWorkspace != null) {\n MonacoProviders.lintPython(model);\n }\n\n const throttledLint = throttle(\n (m: monaco.editor.ITextModel) => MonacoProviders.lintPython(m),\n 250\n );\n\n model.onDidChangeContent(() => {\n throttledLint(model);\n });\n }\n });\n\n MonacoUtils.removeConflictingKeybindings();\n\n log.debug('Monaco initialized.');\n }\n\n /**\n * Initialize current Monaco theme based on the current DH theme.\n */\n static initTheme(): void {\n const { removeHashtag } = MonacoUtils;\n\n const MonacoTheme = resolveCssVariablesInRecord(MonacoThemeRaw);\n log.debug2('Monaco theme:', MonacoThemeRaw);\n log.debug2('Monaco theme derived:', MonacoTheme);\n\n const dhDarkRules = [\n { token: '', foreground: removeHashtag(MonacoTheme.foreground) },\n { token: 'string', foreground: removeHashtag(MonacoTheme.string) },\n {\n token: 'string.delim',\n foreground: removeHashtag(MonacoTheme['string-delim']),\n },\n { token: 'keyword', foreground: removeHashtag(MonacoTheme.keyword) },\n {\n token: 'identifier.js',\n foreground: removeHashtag(MonacoTheme['identifier-js']),\n },\n {\n token: 'delimiter',\n foreground: removeHashtag(MonacoTheme.delimiter),\n },\n { token: 'comment', foreground: removeHashtag(MonacoTheme.comment) },\n { token: 'number', foreground: removeHashtag(MonacoTheme.number) },\n { token: 'storage', foreground: removeHashtag(MonacoTheme.storage) },\n {\n token: 'identifier',\n foreground: removeHashtag(MonacoTheme.identifier),\n },\n {\n token: 'namespace.identifier',\n foreground: removeHashtag(MonacoTheme['namespace-identifier']),\n },\n { token: 'operator', foreground: removeHashtag(MonacoTheme.operator) },\n {\n token: 'predefined',\n foreground: removeHashtag(MonacoTheme.predefined),\n },\n {\n token: 'error.log',\n foreground: MonacoTheme['log-error']?.substring(1) ?? '',\n },\n {\n token: 'warn.log',\n foreground: removeHashtag(MonacoTheme['log-warn']),\n },\n {\n token: 'info.log',\n foreground: removeHashtag(MonacoTheme['log-info']),\n },\n {\n token: 'stdout.log',\n foreground: removeHashtag(MonacoTheme['log-stdout']),\n },\n {\n token: 'trace.log',\n foreground: removeHashtag(MonacoTheme['log-trace']),\n },\n {\n token: 'debug.log',\n foreground: removeHashtag(MonacoTheme['log-debug']),\n },\n {\n token: 'date.log',\n foreground: removeHashtag(MonacoTheme['log-date']),\n },\n ];\n\n const dhDarkColors = {\n foreground: MonacoTheme.foreground,\n errorForeground: MonacoTheme['error-foreground'],\n 'inputOption.activeBorder': MonacoTheme['input-option-active-border'],\n 'editor.background': MonacoTheme.background,\n 'editor.foreground': MonacoTheme.foreground,\n 'editor.lineHighlightBackground':\n MonacoTheme['editor-line-highlight-background'],\n 'editorLineNumber.foreground':\n MonacoTheme['editor-line-number-foreground'],\n 'editorLineNumber.activeForeground':\n MonacoTheme['editor-line-number-active-foreground'],\n 'editor.selectionBackground': MonacoTheme['editor-selection-background'],\n 'editor.inactiveSelectionBackground':\n MonacoTheme['editor-inactive-selection-background'],\n 'editor.selectionHighlightBackground':\n MonacoTheme['editor-selection-highlight-background'],\n 'editor.wordHighlightBackground':\n MonacoTheme['editor-word-highlight-background'],\n 'editor.findMatchBackground': MonacoTheme['editor-find-match-background'],\n 'editor.findMatchHighlightBackground':\n MonacoTheme['editor-find-match-highlight-background'],\n 'editorSuggestWidget.background':\n MonacoTheme['editor-suggest-widget-background'],\n 'editorSuggestWidget.border': MonacoTheme['editor-suggest-widget-border'],\n 'editorSuggestWidget.foreground':\n MonacoTheme['editor-suggest-widget-foreground'],\n 'editorSuggestWidget.selectedBackground':\n MonacoTheme['editor-suggest-widget-selected-background'],\n 'list.activeSelectionBackground':\n MonacoTheme['editor-suggest-widget-selected-background'],\n 'editorSuggestWidget.selectedForeground':\n MonacoTheme['editor-suggest-widget-selected-foreground'],\n 'list.activeSelectionForeground':\n MonacoTheme['editor-suggest-widget-selected-foreground'],\n 'editorSuggestWidget.highlightForeground':\n MonacoTheme['editor-suggest-widget-highlightForeground'],\n 'editorSuggestWidget.focusHighlightForeground':\n MonacoTheme['editor-suggest-widget-focus-highlight-foreground'],\n 'list.hoverBackground': MonacoTheme['list-hover-background'],\n 'dropdown.background': MonacoTheme['context-menu-background'],\n 'dropdown.foreground': MonacoTheme['context-menu-foreground'],\n 'menu.selectionBackground': MonacoTheme['menu-selection-background'],\n 'menu.selectionForeground': MonacoTheme['menu-selection-foreground'],\n 'keybindingLabel.foreground': MonacoTheme['menu-selection-foreground'],\n 'list.focusBackground': MonacoTheme['menu-selection-background'],\n 'editorWidget.background': MonacoTheme['editor-widget-background'],\n 'inputOption.activeBackground':\n MonacoTheme['input-option-active-background'],\n 'inputOption.activeForeground':\n MonacoTheme['input-option-active-foreground'],\n focusBorder: MonacoTheme['focus-border'],\n 'input.background': MonacoTheme['input-background'],\n 'input.foreground': MonacoTheme['input-foreground'],\n 'input.border': MonacoTheme['input-border'],\n 'textLink.foreground': MonacoTheme['text-link-foreground'],\n 'textLink.activeForeground': MonacoTheme['text-link-active-foreground'],\n 'editorLink.activeForeground':\n MonacoTheme['editor-link-active-foreground'],\n 'editorBracketHighlight.foreground1':\n MonacoTheme['editor-bracket-foreground1'],\n 'editorBracketHighlight.foreground2':\n MonacoTheme['editor-bracket-foreground2'],\n 'editorBracketHighlight.foreground3':\n MonacoTheme['editor-bracket-foreground3'],\n 'editorBracketHighlight.foreground4':\n MonacoTheme['editor-bracket-foreground4'],\n 'editorBracketHighlight.foreground5':\n MonacoTheme['editor-bracket-foreground5'],\n 'editorBracketHighlight.foreground6':\n MonacoTheme['editor-bracket-foreground6'],\n 'editorBracketHighlight.unexpectedBracket.foreground':\n MonacoTheme['editor-unexpected-bracket-foreground'],\n 'diffEditor.insertedTextBackground':\n MonacoTheme['diff-editor-inserted-text-background'],\n 'diffEditor.removedTextBackground':\n MonacoTheme['diff-editor-removed-text-background'],\n 'diffEditor.insertedLineBackground':\n MonacoTheme['diff-editor-inserted-line-background'],\n 'diffEditor.removedLineBackground':\n MonacoTheme['diff-editor-removed-line-background'],\n };\n\n monaco.editor.defineTheme('dh-dark', {\n base: 'vs-dark',\n inherit: true,\n rules: dhDarkRules,\n colors: dhDarkColors,\n });\n\n try {\n monaco.editor.setTheme('dh-dark');\n } catch (err) {\n log.error(\n `Failed to set 'dh-dark' Monaco theme, falling back to vs-dark`,\n err\n );\n monaco.editor.setTheme('vs-dark');\n }\n }\n\n /**\n * Register the getWorker function for Monaco\n * @param getWorker The getWorker function for Monaco\n */\n static registerGetWorker(getWorker: Environment['getWorker']): void {\n window.MonacoEnvironment = {\n ...window.MonacoEnvironment,\n getWorker,\n };\n }\n\n /**\n * Remove the hashtag prefix from a CSS color string.\n * Monaco expects colors to be the value only, no hashtag.\n * @param color The hex color string to remove the hashtag from, eg. '#ffffff'\n */\n static removeHashtag(color?: string): string {\n return color?.substring(1) ?? '';\n }\n\n static registerLanguages(languages: Language[]): void {\n // First override the default loader for any language we have a custom definition for\n // https://github.com/Microsoft/monaco-editor/issues/252#issuecomment-482786867\n const languageIds = languages.map(({ id }) => id);\n monaco.languages\n .getLanguages()\n .filter(({ id }) => languageIds.includes(id))\n .forEach(languageParam => {\n const language = languageParam;\n log.debug2('Overriding default language loader:', language.id);\n });\n\n // Then register our language definitions\n languages.forEach(language => {\n MonacoUtils.registerLanguage(language);\n });\n }\n\n static registerLanguage(language: Language): void {\n log.debug2('Registering language: ', language.id);\n monaco.languages.register(language);\n\n monaco.languages.onLanguage(language.id, () => {\n monaco.languages.setLanguageConfiguration(language.id, language.conf);\n monaco.languages.setMonarchTokensProvider(language.id, language.language);\n });\n }\n\n /**\n * Set EOL preference for the editor\n * @param editor The editor to set the EOL for\n * @param eolSequence EOL sequence\n */\n static setEOL(\n editor: monaco.editor.IStandaloneCodeEditor,\n eolSequence = monaco.editor.EndOfLineSequence.LF\n ): void {\n editor.getModel()?.setEOL(eolSequence);\n }\n\n /**\n * Links an editor with a provided session to provide completion items.\n * @param session The IdeSession to link\n * @param editor The editor to link the session to\n * @returns A cleanup function for disposing of the created listeners\n */\n static openDocument(\n editor: monaco.editor.IStandaloneCodeEditor,\n session: dh.IdeSession\n ): monaco.IDisposable {\n const model = editor.getModel();\n assertNotNull(model);\n const didOpenDocumentParams = {\n textDocument: {\n uri: `${model.uri}`,\n languageId: model.getLanguageId(),\n version: model.getVersionId(),\n text: model.getValue(),\n },\n };\n log.debug2('didOpenDocumentParams: ', didOpenDocumentParams);\n\n session.openDocument(didOpenDocumentParams);\n\n const dispose = editor.onDidChangeModelContent(changedEvent => {\n const { changes, versionId } = changedEvent;\n\n const contentChanges = [];\n for (let i = 0; i < changes.length; i += 1) {\n const change = changes[i];\n const { range, rangeLength, text } = change;\n const contentChange = {\n range: {\n start: {\n line: range.startLineNumber - 1,\n character: range.startColumn - 1,\n },\n end: {\n line: range.endLineNumber - 1,\n character: range.endColumn - 1,\n },\n },\n rangeLength,\n text,\n };\n\n contentChanges.push(contentChange);\n }\n\n if (contentChanges.length > 0) {\n const didChangeDocumentParams = {\n textDocument: {\n version: versionId,\n uri: `${model.uri}`,\n },\n contentChanges,\n };\n log.debug2('didChangeDocumentParams', didChangeDocumentParams);\n session.changeDocument(didChangeDocumentParams);\n }\n });\n\n return dispose;\n }\n\n static closeDocument(\n editor: monaco.editor.IStandaloneCodeEditor,\n session: dh.IdeSession\n ): void {\n const model = editor.getModel();\n assertNotNull(model);\n const didCloseDocumentParams = {\n textDocument: {\n uri: `${model.uri}`,\n },\n };\n session.closeDocument(didCloseDocumentParams);\n }\n\n /**\n * Register a paste handle to clean up any garbage code pasted.\n * Most of this comes from copying from Slack, which has a bad habit of injecting their own characters in your code snippets.\n * I've emailed Slack about the issue and they're working on it. I can't reference a ticket number because their ticket system is entirely internally facing.\n * @param editor The editor the register the paste handler for\n */\n static registerPasteHandler(\n editor: monaco.editor.IStandaloneCodeEditor\n ): void {\n editor.onDidPaste(pasteEvent => {\n const smartQuotes = /“|”/g;\n const invalidChars = /\\u200b/g; // zero width space\n const invalidSpaces = /\\u00A0/g; // non-breaking space\n const editorModel = editor.getModel();\n assertNotNull(editorModel);\n const pastedText = editorModel.getValueInRange(pasteEvent.range);\n if (\n smartQuotes.test(pastedText) ||\n invalidChars.test(pastedText) ||\n invalidSpaces.test(pastedText)\n ) {\n editorModel.applyEdits([\n {\n range: pasteEvent.range,\n text: pastedText\n .replace(smartQuotes, '\"')\n .replace(invalidChars, '')\n .replace(invalidSpaces, ' '),\n },\n ]);\n }\n });\n }\n\n static isMacPlatform(): boolean {\n const { platform } = window.navigator;\n return platform.startsWith('Mac');\n }\n\n /**\n * Remove any keybindings which are used for our own shortcuts.\n * This allows the key events to bubble up so a component higher up can capture\n * them. Note that this is a global configuration, so all editor instances will\n * be impacted.\n */\n static removeConflictingKeybindings(): void {\n // All editor instances share a global keybinding registry which is where\n // default keybindings are set. There doesn't appear to be a way to remove\n // default bindings, but we can add new ones that will override the existing\n // ones and set `command` to null. This will treat the key events as unhandled\n // and allow them to bubble up.\n monaco.editor.addKeybindingRule(\n // Restart console in Enterprise (see Shortcuts.ts)\n {\n /* eslint-disable-next-line no-bitwise */\n keybinding: monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyD,\n command: null,\n }\n );\n\n // Ctrl+H is used to focus Community console history in Windows + Linux.\n // An alternate shortcut is used for Mac, so no need to override it\n // (See ConsoleShortcuts.ts)\n if (!MonacoUtils.isMacPlatform()) {\n monaco.editor.addKeybindingRule({\n /* eslint-disable-next-line no-bitwise */\n keybinding: monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyH,\n command: null,\n });\n }\n }\n\n /**\n * Creates actions with a `noop` run function to disable specified keybindings.\n * Note that this will swallow the events. To disable default keybindings in a\n * way that allows events to propagate upward, see `removeConflictingKeybindings`\n * @param editor Editor to disable keybindings for\n * @param keybindings List of monaco keybindings to disable. Often a bitwise\n * combination like `monaco.KeyMod.Alt | monaco.KeyMod.KeyJ`\n */\n static disableKeyBindings(\n editor: monaco.editor.IStandaloneCodeEditor,\n keybindings: number[]\n ): void {\n editor.addAction({\n // This shouldn't be referenced by anything so using an arbitrary unique id\n id: `disable-keybindings-${nanoid()}`,\n label: '', // This action won't be shown in the UI so no need for a label\n keybindings,\n run: () => undefined,\n });\n }\n\n static getMonacoKeyCodeFromShortcut(shortcut: Shortcut): number {\n const { keyState } = shortcut;\n const { keyValue } = keyState;\n if (keyValue === null) {\n return 0;\n }\n\n const isMac = MonacoUtils.isMacPlatform();\n\n if (isMac) {\n return (\n // eslint-disable-next-line no-bitwise\n (keyState.metaKey ? monaco.KeyMod.CtrlCmd : 0) |\n (keyState.shiftKey ? monaco.KeyMod.Shift : 0) |\n (keyState.altKey ? monaco.KeyMod.Alt : 0) |\n (keyState.ctrlKey ? monaco.KeyMod.WinCtrl : 0) |\n KeyCodeUtils.fromString(keyValue)\n );\n }\n\n return (\n // eslint-disable-next-line no-bitwise\n (keyState.ctrlKey ? monaco.KeyMod.CtrlCmd : 0) |\n (keyState.shiftKey ? monaco.KeyMod.Shift : 0) |\n (keyState.altKey ? monaco.KeyMod.Alt : 0) |\n (keyState.metaKey ? monaco.KeyMod.WinCtrl : 0) |\n KeyCodeUtils.fromString(keyValue)\n );\n }\n\n static provideLinks(model: monaco.editor.ITextModel): {\n links: monaco.languages.ILink[];\n } {\n const newTokens: monaco.languages.ILink[] = [];\n\n for (let i = 1; i <= model.getLineCount(); i += 1) {\n const lineText = model.getLineContent(i);\n const originalTokens = linkifyFind(lineText);\n\n const tokens = originalTokens.filter(token => {\n if (token.type === 'url') {\n return /^https?:\\/\\//.test(token.value);\n }\n return true;\n });\n // map the tokens to the ranges - you know the line number now, use the token start/end as the startColumn/endColumn\n tokens.forEach(token => {\n newTokens.push({\n url: token.href,\n range: new monaco.Range(i, token.start + 1, i, token.end + 1),\n });\n });\n }\n\n return {\n links: newTokens,\n };\n }\n\n /**\n * Generates a console URI for use with monaco.\n * @returns A new console URI\n */\n static generateConsoleUri(): monaco.Uri {\n return monaco.Uri.parse(`${CONSOLE_URI_PREFIX}${nanoid()}`);\n }\n\n /**\n * Checks if a model is a console model based on its URI.\n * @param model The monaco model to check\n * @returns If the model is a console model\n */\n static isConsoleModel(model: monaco.editor.ITextModel): boolean {\n return model.uri.toString().startsWith(CONSOLE_URI_PREFIX);\n }\n\n /**\n * Checks if the editor has the formatDocument action registered.\n * @param editor The monaco editor to check\n * @returns If the editor has a document formatter registered\n */\n static canFormat(editor: monaco.editor.IStandaloneCodeEditor): boolean {\n return (\n editor.getAction('editor.action.formatDocument')?.isSupported() === true\n );\n }\n\n /**\n * Runs the formatDocument action on the editor.\n * @param editor The editor to format\n */\n static async formatDocument(\n editor: monaco.editor.IStandaloneCodeEditor\n ): Promise<void> {\n await editor.getAction('editor.action.formatDocument')?.run();\n }\n}\n\nexport default MonacoUtils;\n"],"mappings":";;;;;;;AAAA;AACA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,OAAOC,QAAQ,MAAM,iBAAiB;AACtC;AACA;AACA;AACA,SACEC,2BAA2B,QAEtB,uBAAuB;AAE9B,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,IAAI,IAAIC,WAAW,QAAQ,WAAW;AAC/C,OAAO,KAAKC,MAAM,MAAM,eAAe;AAEvC;AACA,SAASC,YAAY,QAAQ,8CAA8C;AAC3E,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAC1BC,cAAc;AAAA,OACdC,MAAM;AAAA,OACNC,UAAU;AAAA,OACVC,SAAS;AAAA,OACTC,MAAM;AAAA,OACNC,OAAO;AAAA,OAEPC,eAAe;AAEtB,IAAMC,GAAG,GAAGR,GAAG,CAACS,MAAM,CAAC,aAAa,CAAC;AAErC,IAAMC,kBAAkB,GAAG,wBAAwB;AAQnD,MAAMC,WAAW,CAAC;EAChB;AACF;AACA;AACA;AACA;EACE,OAAOC,IAAIA,CAAA,EAE6C;IAAA,IAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAV,CAAC,CAAC;MAD9CG,SAAS,GAAAJ,IAAA,CAATI,SAAS;IAETT,GAAG,CAACU,KAAK,CAAC,wBAAwB,CAAC;IAEnC,IAAID,SAAS,KAAKD,SAAS,EAAE;MA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AACqE,GAAG,CAAC2F,QAAQ,CAAC,CAAC,CAAC7C,UAAU,CAAC1I,kBAAkB,CAAC;EAC5D;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOwL,SAASA,CAACnK,MAA2C,EAAW;IAAA,IAAAoK,iBAAA;IACrE,OACE,EAAAA,iBAAA,GAAApK,MAAM,CAACqK,SAAS,CAAC,8BAA8B,CAAC,cAAAD,iBAAA,uBAAhDA,iBAAA,CAAkDE,WAAW,CAAC,CAAC,MAAK,IAAI;EAE5E;;EAEA;AACF;AACA;AACA;EACE,OAAaC,cAAcA,CACzBvK,MAA2C,EAC5B;IAAA,OAAAwK,iBAAA;MAAA,IAAAC,kBAAA;MACf,OAAAA,kBAAA,GAAMzK,MAAM,CAACqK,SAAS,CAAC,8BAA8B,CAAC,cAAAI,kBAAA,uBAAhDA,kBAAA,CAAkDvC,GAAG,CAAC,CAAC;IAAC;EAChE;AACF;AAEA,eAAetJ,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"MonacoUtils.js","names":["nanoid","throttle","resolveCssVariablesInRecord","assertNotNull","find","linkifyFind","Log","MonacoThemeRaw","PyLang","GroovyLang","ScalaLang","DbLang","LogLang","MonacoProviders","log","module","CONSOLE_URI_PREFIX","MonacoUtils","load","loadPromise","Promise","all","then","_ref","_ref2","_slicedToArray","loaded","KeyCodeUtils","monaco","keyCodeUtils","callbacks","loadCallbacks","forEach","callback","getMonaco","whenLoaded","push","init","_ref3","arguments","length","undefined","getWorker","registerGetWorker","debug","initTheme","registerLanguages","languages","onLanguage","registerCodeActionProvider","provideCodeActions","handlePythonCodeActionRequest","providedCodeActionKinds","registerDocumentFormattingEditProvider","provideDocumentFormattingEdits","handlePythonFormatRequest","editor","onDidCreateModel","model","getLanguageId","ruffWorkspace","lintPython","throttledLint","m","onDidChangeContent","onWillDispose","cancel","removeConflictingKeybindings","_MonacoTheme$logErro","_MonacoTheme$logErro2","removeHashtag","MonacoTheme","debug2","dhDarkRules","token","foreground","string","keyword","delimiter","comment","number","storage","identifier","operator","predefined","substring","dhDarkColors","errorForeground","background","focusBorder","defineTheme","base","inherit","rules","colors","setTheme","err","error","window","MonacoEnvironment","_objectSpread","color","_color$substring","languageIds","map","_ref4","id","getLanguages","filter","_ref5","includes","languageParam","language","registerLanguage","register","setLanguageConfiguration","conf","setMonarchTokensProvider","setEOL","_editor$getModel","eolSequence","EndOfLineSequence","LF","getModel","openDocument","session","didOpenDocumentParams","textDocument","uri","concat","languageId","version","getVersionId","text","getValue","dispose","onDidChangeModelContent","changedEvent","changes","versionId","contentChanges","i","change","range","rangeLength","contentChange","start","line","startLineNumber","character","startColumn","end","endLineNumber","endColumn","didChangeDocumentParams","changeDocument","closeDocument","didCloseDocumentParams","registerPasteHandler","onDidPaste","pasteEvent","smartQuotes","invalidChars","invalidSpaces","editorModel","pastedText","getValueInRange","test","applyEdits","replace","isMacPlatform","platform","navigator","startsWith","addKeybindingRule","keybinding","KeyMod","CtrlCmd","KeyCode","KeyD","command","KeyH","disableKeyBindings","keybindings","addAction","label","run","getMonacoKeyCodeFromShortcut","shortcut","keyState","keyValue","isMac","metaKey","shiftKey","Shift","altKey","Alt","ctrlKey","WinCtrl","fromString","registerLinkProvider","linkProviderRegistration","provideLinks","newTokens","_loop","lineText","getLineContent","originalTokens","tokens","type","value","url","href","Range","getLineCount","links","generateConsoleUri","Uri","parse","isConsoleModel","toString","canFormat","_editor$getAction","getAction","isSupported","formatDocument","_asyncToGenerator","_editor$getAction2","_defineProperty"],"sources":["../../src/monaco/MonacoUtils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport { nanoid } from 'nanoid';\nimport throttle from 'lodash.throttle';\n/**\n * Exports a function for initializing monaco with the deephaven theme/config\n */\nimport {\n resolveCssVariablesInRecord,\n type Shortcut,\n} from '@deephaven/components';\nimport type { dh } from '@deephaven/jsapi-types';\nimport { assertNotNull } from '@deephaven/utils';\nimport { find as linkifyFind } from 'linkifyjs';\nimport type * as monaco from 'monaco-editor';\nimport Log from '@deephaven/log';\nimport MonacoThemeRaw from './MonacoTheme.module.scss';\nimport PyLang from './lang/python';\nimport GroovyLang from './lang/groovy';\nimport ScalaLang from './lang/scala';\nimport DbLang from './lang/db';\nimport LogLang from './lang/log';\nimport { type Language } from './lang/Language';\nimport MonacoProviders from './MonacoProviders';\n\nconst log = Log.module('MonacoUtils');\n\nconst CONSOLE_URI_PREFIX = 'inmemory://dh-console/';\n\ndeclare global {\n interface Window {\n MonacoEnvironment?: monaco.Environment;\n }\n}\n\nclass MonacoUtils {\n private static loadPromise?: Promise<typeof monaco>;\n\n private static monaco?: typeof monaco;\n\n private static loadCallbacks: (() => void)[] = [];\n\n private static keyCodeUtils?: { fromString: (key: string) => number };\n\n private static linkProviderRegistration?: monaco.IDisposable;\n\n /**\n * Loads Monaco. Subsequent calls return the same promise.\n */\n static load(): Promise<typeof monaco> {\n if (MonacoUtils.loadPromise == null) {\n MonacoUtils.loadPromise = Promise.all([\n import('monaco-editor'),\n // KeyCodeUtils is not part of Monaco's public API\n // @ts-ignore\n import('monaco-editor/esm/vs/base/common/keyCodes.js'),\n ]).then(([loaded, { KeyCodeUtils }]) => {\n MonacoUtils.monaco = loaded;\n MonacoUtils.keyCodeUtils = KeyCodeUtils;\n const callbacks = MonacoUtils.loadCallbacks;\n MonacoUtils.loadCallbacks = [];\n callbacks.forEach(callback => callback());\n return loaded;\n });\n }\n return MonacoUtils.loadPromise;\n }\n\n /**\n * @returns Monaco, once it has loaded. Safe wherever an editor already exists.\n */\n static getMonaco(): typeof monaco {\n assertNotNull(MonacoUtils.monaco, 'Monaco has not loaded');\n return MonacoUtils.monaco;\n }\n\n /**\n * Runs the callback now if Monaco has loaded, or once it has\n * @param callback The callback to run\n */\n static whenLoaded(callback: () => void): void {\n if (MonacoUtils.monaco != null) {\n callback();\n } else {\n MonacoUtils.loadCallbacks.push(callback);\n }\n }\n\n /**\n * Initializes Monaco for the environment, once it has loaded\n * @param getWorker The getWorker function Monaco should use\n * The workers should be provided by the caller and bundled by their build system (e.g. Vite, Webpack)\n */\n static init({\n getWorker,\n }: { getWorker?: monaco.Environment['getWorker'] } = {}): void {\n if (getWorker !== undefined) {\n MonacoUtils.registerGetWorker(getWorker);\n }\n\n if (MonacoUtils.monaco == null) {\n MonacoUtils.whenLoaded(() => MonacoUtils.init());\n return;\n }\n\n log.debug('Initializing Monaco...');\n\n const monaco = MonacoUtils.getMonaco();\n const { initTheme, registerLanguages } = MonacoUtils;\n\n initTheme();\n\n registerLanguages([DbLang, PyLang, GroovyLang, LogLang, ScalaLang]);\n\n monaco.languages.onLanguage('python', () => {\n monaco.languages.registerCodeActionProvider(\n 'python',\n {\n provideCodeActions: MonacoProviders.handlePythonCodeActionRequest,\n },\n { providedCodeActionKinds: ['quickfix'] }\n );\n\n monaco.languages.registerDocumentFormattingEditProvider('python', {\n provideDocumentFormattingEdits:\n MonacoProviders.handlePythonFormatRequest,\n });\n });\n\n monaco.editor.onDidCreateModel(model => {\n // Lint Python models on creation and on change\n if (model.getLanguageId() === 'python') {\n if (MonacoProviders.ruffWorkspace != null) {\n MonacoProviders.lintPython(model);\n }\n\n const throttledLint = throttle(\n (m: monaco.editor.ITextModel) => MonacoProviders.lintPython(m),\n 250\n );\n\n model.onDidChangeContent(() => {\n throttledLint(model);\n });\n model.onWillDispose(() => {\n throttledLint.cancel();\n });\n }\n });\n\n MonacoUtils.removeConflictingKeybindings();\n\n log.debug('Monaco initialized.');\n }\n\n /**\n * Initialize current Monaco theme based on the current DH theme.\n */\n static initTheme(): void {\n if (MonacoUtils.monaco == null) {\n MonacoUtils.whenLoaded(() => MonacoUtils.initTheme());\n return;\n }\n\n const monaco = MonacoUtils.getMonaco();\n const { removeHashtag } = MonacoUtils;\n\n const MonacoTheme = resolveCssVariablesInRecord(MonacoThemeRaw);\n log.debug2('Monaco theme:', MonacoThemeRaw);\n log.debug2('Monaco theme derived:', MonacoTheme);\n\n const dhDarkRules = [\n { token: '', foreground: removeHashtag(MonacoTheme.foreground) },\n { token: 'string', foreground: removeHashtag(MonacoTheme.string) },\n {\n token: 'string.delim',\n foreground: removeHashtag(MonacoTheme['string-delim']),\n },\n { token: 'keyword', foreground: removeHashtag(MonacoTheme.keyword) },\n {\n token: 'identifier.js',\n foreground: removeHashtag(MonacoTheme['identifier-js']),\n },\n {\n token: 'delimiter',\n foreground: removeHashtag(MonacoTheme.delimiter),\n },\n { token: 'comment', foreground: removeHashtag(MonacoTheme.comment) },\n { token: 'number', foreground: removeHashtag(MonacoTheme.number) },\n { token: 'storage', foreground: removeHashtag(MonacoTheme.storage) },\n {\n token: 'identifier',\n foreground: removeHashtag(MonacoTheme.identifier),\n },\n {\n token: 'namespace.identifier',\n foreground: removeHashtag(MonacoTheme['namespace-identifier']),\n },\n { token: 'operator', foreground: removeHashtag(MonacoTheme.operator) },\n {\n token: 'predefined',\n foreground: removeHashtag(MonacoTheme.predefined),\n },\n {\n token: 'error.log',\n foreground: MonacoTheme['log-error']?.substring(1) ?? '',\n },\n {\n token: 'warn.log',\n foreground: removeHashtag(MonacoTheme['log-warn']),\n },\n {\n token: 'info.log',\n foreground: removeHashtag(MonacoTheme['log-info']),\n },\n {\n token: 'stdout.log',\n foreground: removeHashtag(MonacoTheme['log-stdout']),\n },\n {\n token: 'trace.log',\n foreground: removeHashtag(MonacoTheme['log-trace']),\n },\n {\n token: 'debug.log',\n foreground: removeHashtag(MonacoTheme['log-debug']),\n },\n {\n token: 'date.log',\n foreground: removeHashtag(MonacoTheme['log-date']),\n },\n ];\n\n const dhDarkColors = {\n foreground: MonacoTheme.foreground,\n errorForeground: MonacoTheme['error-foreground'],\n 'inputOption.activeBorder': MonacoTheme['input-option-active-border'],\n 'editor.background': MonacoTheme.background,\n 'editor.foreground': MonacoTheme.foreground,\n 'editor.lineHighlightBackground':\n MonacoTheme['editor-line-highlight-background'],\n 'editorLineNumber.foreground':\n MonacoTheme['editor-line-number-foreground'],\n 'editorLineNumber.activeForeground':\n MonacoTheme['editor-line-number-active-foreground'],\n 'editor.selectionBackground': MonacoTheme['editor-selection-background'],\n 'editor.inactiveSelectionBackground':\n MonacoTheme['editor-inactive-selection-background'],\n 'editor.selectionHighlightBackground':\n MonacoTheme['editor-selection-highlight-background'],\n 'editor.wordHighlightBackground':\n MonacoTheme['editor-word-highlight-background'],\n 'editor.findMatchBackground': MonacoTheme['editor-find-match-background'],\n 'editor.findMatchHighlightBackground':\n MonacoTheme['editor-find-match-highlight-background'],\n 'editorSuggestWidget.background':\n MonacoTheme['editor-suggest-widget-background'],\n 'editorSuggestWidget.border': MonacoTheme['editor-suggest-widget-border'],\n 'editorSuggestWidget.foreground':\n MonacoTheme['editor-suggest-widget-foreground'],\n 'editorSuggestWidget.selectedBackground':\n MonacoTheme['editor-suggest-widget-selected-background'],\n 'list.activeSelectionBackground':\n MonacoTheme['editor-suggest-widget-selected-background'],\n 'editorSuggestWidget.selectedForeground':\n MonacoTheme['editor-suggest-widget-selected-foreground'],\n 'list.activeSelectionForeground':\n MonacoTheme['editor-suggest-widget-selected-foreground'],\n 'editorSuggestWidget.highlightForeground':\n MonacoTheme['editor-suggest-widget-highlightForeground'],\n 'editorSuggestWidget.focusHighlightForeground':\n MonacoTheme['editor-suggest-widget-focus-highlight-foreground'],\n 'list.hoverBackground': MonacoTheme['list-hover-background'],\n 'dropdown.background': MonacoTheme['context-menu-background'],\n 'dropdown.foreground': MonacoTheme['context-menu-foreground'],\n 'menu.selectionBackground': MonacoTheme['menu-selection-background'],\n 'menu.selectionForeground': MonacoTheme['menu-selection-foreground'],\n 'keybindingLabel.foreground': MonacoTheme['menu-selection-foreground'],\n 'list.focusBackground': MonacoTheme['menu-selection-background'],\n 'editorWidget.background': MonacoTheme['editor-widget-background'],\n 'inputOption.activeBackground':\n MonacoTheme['input-option-active-background'],\n 'inputOption.activeForeground':\n MonacoTheme['input-option-active-foreground'],\n focusBorder: MonacoTheme['focus-border'],\n 'input.background': MonacoTheme['input-background'],\n 'input.foreground': MonacoTheme['input-foreground'],\n 'input.border': MonacoTheme['input-border'],\n 'textLink.foreground': MonacoTheme['text-link-foreground'],\n 'textLink.activeForeground': MonacoTheme['text-link-active-foreground'],\n 'editorLink.activeForeground':\n MonacoTheme['editor-link-active-foreground'],\n 'editorBracketHighlight.foreground1':\n MonacoTheme['editor-bracket-foreground1'],\n 'editorBracketHighlight.foreground2':\n MonacoTheme['editor-bracket-foreground2'],\n 'editorBracketHighlight.foreground3':\n MonacoTheme['editor-bracket-foreground3'],\n 'editorBracketHighlight.foreground4':\n MonacoTheme['editor-bracket-foreground4'],\n 'editorBracketHighlight.foreground5':\n MonacoTheme['editor-bracket-foreground5'],\n 'editorBracketHighlight.foreground6':\n MonacoTheme['editor-bracket-foreground6'],\n 'editorBracketHighlight.unexpectedBracket.foreground':\n MonacoTheme['editor-unexpected-bracket-foreground'],\n 'diffEditor.insertedTextBackground':\n MonacoTheme['diff-editor-inserted-text-background'],\n 'diffEditor.removedTextBackground':\n MonacoTheme['diff-editor-removed-text-background'],\n 'diffEditor.insertedLineBackground':\n MonacoTheme['diff-editor-inserted-line-background'],\n 'diffEditor.removedLineBackground':\n MonacoTheme['diff-editor-removed-line-background'],\n };\n\n monaco.editor.defineTheme('dh-dark', {\n base: 'vs-dark',\n inherit: true,\n rules: dhDarkRules,\n colors: dhDarkColors,\n });\n\n try {\n monaco.editor.setTheme('dh-dark');\n } catch (err) {\n log.error(\n `Failed to set 'dh-dark' Monaco theme, falling back to vs-dark`,\n err\n );\n monaco.editor.setTheme('vs-dark');\n }\n }\n\n /**\n * Register the getWorker function for Monaco\n * @param getWorker The getWorker function for Monaco\n */\n static registerGetWorker(getWorker: monaco.Environment['getWorker']): void {\n window.MonacoEnvironment = {\n ...window.MonacoEnvironment,\n getWorker,\n };\n }\n\n /**\n * Remove the hashtag prefix from a CSS color string.\n * Monaco expects colors to be the value only, no hashtag.\n * @param color The hex color string to remove the hashtag from, eg. '#ffffff'\n */\n static removeHashtag(color?: string): string {\n return color?.substring(1) ?? '';\n }\n\n static registerLanguages(languages: Language[]): void {\n if (MonacoUtils.monaco == null) {\n MonacoUtils.whenLoaded(() => MonacoUtils.registerLanguages(languages));\n return;\n }\n\n const monaco = MonacoUtils.getMonaco();\n // First override the default loader for any language we have a custom definition for\n // https://github.com/Microsoft/monaco-editor/issues/252#issuecomment-482786867\n const languageIds = languages.map(({ id }) => id);\n monaco.languages\n .getLanguages()\n .filter(({ id }) => languageIds.includes(id))\n .forEach(languageParam => {\n const language = languageParam;\n log.debug2('Overriding default language loader:', language.id);\n });\n\n // Then register our language definitions\n languages.forEach(language => {\n MonacoUtils.registerLanguage(language);\n });\n }\n\n static registerLanguage(language: Language): void {\n if (MonacoUtils.monaco == null) {\n MonacoUtils.whenLoaded(() => MonacoUtils.registerLanguage(language));\n return;\n }\n\n const monaco = MonacoUtils.getMonaco();\n log.debug2('Registering language: ', language.id);\n monaco.languages.register(language);\n\n monaco.languages.onLanguage(language.id, () => {\n monaco.languages.setLanguageConfiguration(language.id, language.conf);\n monaco.languages.setMonarchTokensProvider(language.id, language.language);\n });\n }\n\n /**\n * Set EOL preference for the editor\n * @param editor The editor to set the EOL for\n * @param eolSequence EOL sequence\n */\n static setEOL(\n editor: monaco.editor.IStandaloneCodeEditor,\n eolSequence = MonacoUtils.getMonaco().editor.EndOfLineSequence.LF\n ): void {\n editor.getModel()?.setEOL(eolSequence);\n }\n\n /**\n * Links an editor with a provided session to provide completion items.\n * @param session The IdeSession to link\n * @param editor The editor to link the session to\n * @returns A cleanup function for disposing of the created listeners\n */\n static openDocument(\n editor: monaco.editor.IStandaloneCodeEditor,\n session: dh.IdeSession\n ): monaco.IDisposable {\n const model = editor.getModel();\n assertNotNull(model);\n const didOpenDocumentParams = {\n textDocument: {\n uri: `${model.uri}`,\n languageId: model.getLanguageId(),\n version: model.getVersionId(),\n text: model.getValue(),\n },\n };\n log.debug2('didOpenDocumentParams: ', didOpenDocumentParams);\n\n session.openDocument(didOpenDocumentParams);\n\n const dispose = editor.onDidChangeModelContent(changedEvent => {\n const { changes, versionId } = changedEvent;\n\n const contentChanges = [];\n for (let i = 0; i < changes.length; i += 1) {\n const change = changes[i];\n const { range, rangeLength, text } = change;\n const contentChange = {\n range: {\n start: {\n line: range.startLineNumber - 1,\n character: range.startColumn - 1,\n },\n end: {\n line: range.endLineNumber - 1,\n character: range.endColumn - 1,\n },\n },\n rangeLength,\n text,\n };\n\n contentChanges.push(contentChange);\n }\n\n if (contentChanges.length > 0) {\n const didChangeDocumentParams = {\n textDocument: {\n version: versionId,\n uri: `${model.uri}`,\n },\n contentChanges,\n };\n log.debug2('didChangeDocumentParams', didChangeDocumentParams);\n session.changeDocument(didChangeDocumentParams);\n }\n });\n\n return dispose;\n }\n\n static closeDocument(\n editor: monaco.editor.IStandaloneCodeEditor,\n session: dh.IdeSession\n ): void {\n const model = editor.getModel();\n assertNotNull(model);\n const didCloseDocumentParams = {\n textDocument: {\n uri: `${model.uri}`,\n },\n };\n session.closeDocument(didCloseDocumentParams);\n }\n\n /**\n * Register a paste handle to clean up any garbage code pasted.\n * Most of this comes from copying from Slack, which has a bad habit of injecting their own characters in your code snippets.\n * I've emailed Slack about the issue and they're working on it. I can't reference a ticket number because their ticket system is entirely internally facing.\n * @param editor The editor the register the paste handler for\n */\n static registerPasteHandler(\n editor: monaco.editor.IStandaloneCodeEditor\n ): void {\n editor.onDidPaste(pasteEvent => {\n const smartQuotes = /“|”/g;\n const invalidChars = /\\u200b/g; // zero width space\n const invalidSpaces = /\\u00A0/g; // non-breaking space\n const editorModel = editor.getModel();\n assertNotNull(editorModel);\n const pastedText = editorModel.getValueInRange(pasteEvent.range);\n if (\n smartQuotes.test(pastedText) ||\n invalidChars.test(pastedText) ||\n invalidSpaces.test(pastedText)\n ) {\n editorModel.applyEdits([\n {\n range: pasteEvent.range,\n text: pastedText\n .replace(smartQuotes, '\"')\n .replace(invalidChars, '')\n .replace(invalidSpaces, ' '),\n },\n ]);\n }\n });\n }\n\n static isMacPlatform(): boolean {\n const { platform } = window.navigator;\n return platform.startsWith('Mac');\n }\n\n /**\n * Remove any keybindings which are used for our own shortcuts.\n * This allows the key events to bubble up so a component higher up can capture\n * them. Note that this is a global configuration, so all editor instances will\n * be impacted.\n */\n static removeConflictingKeybindings(): void {\n if (MonacoUtils.monaco == null) {\n MonacoUtils.whenLoaded(() => MonacoUtils.removeConflictingKeybindings());\n return;\n }\n\n const monaco = MonacoUtils.getMonaco();\n // All editor instances share a global keybinding registry which is where\n // default keybindings are set. There doesn't appear to be a way to remove\n // default bindings, but we can add new ones that will override the existing\n // ones and set `command` to null. This will treat the key events as unhandled\n // and allow them to bubble up.\n monaco.editor.addKeybindingRule(\n // Restart console in Enterprise (see Shortcuts.ts)\n {\n /* eslint-disable-next-line no-bitwise */\n keybinding: monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyD,\n command: null,\n }\n );\n\n // Ctrl+H is used to focus Community console history in Windows + Linux.\n // An alternate shortcut is used for Mac, so no need to override it\n // (See ConsoleShortcuts.ts)\n if (!MonacoUtils.isMacPlatform()) {\n monaco.editor.addKeybindingRule({\n /* eslint-disable-next-line no-bitwise */\n keybinding: monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyH,\n command: null,\n });\n }\n }\n\n /**\n * Creates actions with a `noop` run function to disable specified keybindings.\n * Note that this will swallow the events. To disable default keybindings in a\n * way that allows events to propagate upward, see `removeConflictingKeybindings`\n * @param editor Editor to disable keybindings for\n * @param keybindings List of monaco keybindings to disable. Often a bitwise\n * combination like `monaco.KeyMod.Alt | monaco.KeyMod.KeyJ`\n */\n static disableKeyBindings(\n editor: monaco.editor.IStandaloneCodeEditor,\n keybindings: number[]\n ): void {\n editor.addAction({\n // This shouldn't be referenced by anything so using an arbitrary unique id\n id: `disable-keybindings-${nanoid()}`,\n label: '', // This action won't be shown in the UI so no need for a label\n keybindings,\n run: () => undefined,\n });\n }\n\n static getMonacoKeyCodeFromShortcut(shortcut: Shortcut): number {\n const { keyState } = shortcut;\n const { keyValue } = keyState;\n if (keyValue === null) {\n return 0;\n }\n\n const isMac = MonacoUtils.isMacPlatform();\n const monaco = MonacoUtils.getMonaco();\n const { keyCodeUtils } = MonacoUtils;\n assertNotNull(keyCodeUtils, 'Monaco has not loaded');\n\n if (isMac) {\n return (\n // eslint-disable-next-line no-bitwise\n (keyState.metaKey ? monaco.KeyMod.CtrlCmd : 0) |\n (keyState.shiftKey ? monaco.KeyMod.Shift : 0) |\n (keyState.altKey ? monaco.KeyMod.Alt : 0) |\n (keyState.ctrlKey ? monaco.KeyMod.WinCtrl : 0) |\n keyCodeUtils.fromString(keyValue)\n );\n }\n\n return (\n // eslint-disable-next-line no-bitwise\n (keyState.ctrlKey ? monaco.KeyMod.CtrlCmd : 0) |\n (keyState.shiftKey ? monaco.KeyMod.Shift : 0) |\n (keyState.altKey ? monaco.KeyMod.Alt : 0) |\n (keyState.metaKey ? monaco.KeyMod.WinCtrl : 0) |\n keyCodeUtils.fromString(keyValue)\n );\n }\n\n /**\n * Registers the plaintext link provider once Monaco has loaded. Providers\n * are global to Monaco, so only the first call registers it.\n */\n static registerLinkProvider(): void {\n if (MonacoUtils.monaco == null) {\n MonacoUtils.whenLoaded(() => MonacoUtils.registerLinkProvider());\n return;\n }\n\n if (MonacoUtils.linkProviderRegistration != null) {\n return;\n }\n\n MonacoUtils.linkProviderRegistration =\n MonacoUtils.getMonaco().languages.registerLinkProvider('plaintext', {\n provideLinks: MonacoUtils.provideLinks,\n });\n }\n\n static provideLinks(model: monaco.editor.ITextModel): {\n links: monaco.languages.ILink[];\n } {\n const monaco = MonacoUtils.getMonaco();\n const newTokens: monaco.languages.ILink[] = [];\n\n for (let i = 1; i <= model.getLineCount(); i += 1) {\n const lineText = model.getLineContent(i);\n const originalTokens = linkifyFind(lineText);\n\n const tokens = originalTokens.filter(token => {\n if (token.type === 'url') {\n return /^https?:\\/\\//.test(token.value);\n }\n return true;\n });\n // map the tokens to the ranges - you know the line number now, use the token start/end as the startColumn/endColumn\n tokens.forEach(token => {\n newTokens.push({\n url: token.href,\n range: new monaco.Range(i, token.start + 1, i, token.end + 1),\n });\n });\n }\n\n return {\n links: newTokens,\n };\n }\n\n /**\n * Generates a console URI for use with monaco.\n * @returns A new console URI\n */\n static generateConsoleUri(): monaco.Uri {\n return MonacoUtils.getMonaco().Uri.parse(\n `${CONSOLE_URI_PREFIX}${nanoid()}`\n );\n }\n\n /**\n * Checks if a model is a console model based on its URI.\n * @param model The monaco model to check\n * @returns If the model is a console model\n */\n static isConsoleModel(model: monaco.editor.ITextModel): boolean {\n return model.uri.toString().startsWith(CONSOLE_URI_PREFIX);\n }\n\n /**\n * Checks if the editor has the formatDocument action registered.\n * @param editor The monaco editor to check\n * @returns If the editor has a document formatter registered\n */\n static canFormat(editor: monaco.editor.IStandaloneCodeEditor): boolean {\n return (\n editor.getAction('editor.action.formatDocument')?.isSupported() === true\n );\n }\n\n /**\n * Runs the formatDocument action on the editor.\n * @param editor The editor to format\n */\n static async formatDocument(\n editor: monaco.editor.IStandaloneCodeEditor\n ): Promise<void> {\n await editor.getAction('editor.action.formatDocument')?.run();\n }\n}\n\nexport default MonacoUtils;\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,OAAOC,QAAQ,MAAM,iBAAiB;AACtC;AACA;AACA;AACA,SACEC,2BAA2B,QAEtB,uBAAuB;AAE9B,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,IAAI,IAAIC,WAAW,QAAQ,WAAW;AAE/C,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAC1BC,cAAc;AAAA,OACdC,MAAM;AAAA,OACNC,UAAU;AAAA,OACVC,SAAS;AAAA,OACTC,MAAM;AAAA,OACNC,OAAO;AAAA,OAEPC,eAAe;AAEtB,IAAMC,GAAG,GAAGR,GAAG,CAACS,MAAM,CAAC,aAAa,CAAC;AAErC,IAAMC,kBAAkB,GAAG,wBAAwB;AAQnD,MAAMC,WAAW,CAAC;EAWhB;AACF;AACA;EACE,O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AAhDA,kBAAA,CAAkDzC,GAAG,CAAC,CAAC;IAAC;EAChE;AACF;AAAC0C,eAAA,CA/pBKnN,WAAW;AAAAmN,eAAA,CAAXnN,WAAW;AAAAmN,eAAA,CAAXnN,WAAW,mBAKgC,EAAE;AAAAmN,eAAA,CAL7CnN,WAAW;AAAAmN,eAAA,CAAXnN,WAAW;AAiqBjB,eAAeA,WAAW","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuffSettingsModal.d.ts","sourceRoot":"","sources":["../../src/monaco/RuffSettingsModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAwBtE,OAAO,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"RuffSettingsModal.d.ts","sourceRoot":"","sources":["../../src/monaco/RuffSettingsModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAwBtE,OAAO,0BAA0B,CAAC;AAIlC,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAmCD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,IAAI,EACJ,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAgB,EAChB,eAAuC,GACxC,EAAE,sBAAsB,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAkJpD"}
|
|
@@ -7,33 +7,47 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
7
7
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
8
8
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
9
9
|
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
10
|
-
import * as monaco from 'monaco-editor';
|
|
11
10
|
import { Workspace } from '@astral-sh/ruff-wasm-web';
|
|
12
11
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
13
12
|
import { ActionButton, Button, Icon, Link, Modal, ModalBody, ModalFooter, ModalHeader, Text } from '@deephaven/components';
|
|
14
13
|
import { vsLinkExternal, vsDiscard } from '@deephaven/icons';
|
|
15
14
|
import { useDebouncedCallback, usePromiseFactory } from '@deephaven/react-hooks';
|
|
16
|
-
import {
|
|
15
|
+
import { EMPTY_FUNCTION } from '@deephaven/utils';
|
|
16
|
+
import Log from '@deephaven/log';
|
|
17
17
|
import Editor from "../notebook/Editor.js";
|
|
18
18
|
import RUFF_DEFAULT_SETTINGS from "./RuffDefaultSettings.js";
|
|
19
|
-
import ruffSchema from "./ruffSchema.js";
|
|
20
19
|
import "./RuffSettingsModal.css";
|
|
21
20
|
import MonacoProviders from "./MonacoProviders.js";
|
|
21
|
+
import MonacoUtils from "./MonacoUtils.js";
|
|
22
22
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
|
-
var
|
|
23
|
+
var log = Log.module('RuffSettingsModal');
|
|
24
|
+
var RUFF_SETTINGS_URI = 'inmemory://dh-config/ruff-settings.json';
|
|
24
25
|
function registerRuffSchema() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
return _registerRuffSchema.apply(this, arguments);
|
|
27
|
+
}
|
|
28
|
+
function _registerRuffSchema() {
|
|
29
|
+
_registerRuffSchema = _asyncToGenerator(function* () {
|
|
30
|
+
var jsonDefaults = MonacoUtils.getMonaco().languages.json.jsonDefaults;
|
|
31
|
+
var _jsonDefaults$diagnos = jsonDefaults.diagnosticsOptions.schemas,
|
|
32
|
+
schemas = _jsonDefaults$diagnos === void 0 ? [] : _jsonDefaults$diagnos;
|
|
33
|
+
if (!schemas.some(schema => schema.uri === 'json://ruff-schema')) {
|
|
34
|
+
// Register the ruff schema so users get validation and completion
|
|
35
|
+
var _yield$import = yield import('./ruffSchema'),
|
|
36
|
+
ruffSchema = _yield$import.default;
|
|
37
|
+
jsonDefaults.setDiagnosticsOptions({
|
|
38
|
+
schemas: [...schemas, {
|
|
39
|
+
uri: 'json://ruff-schema',
|
|
40
|
+
fileMatch: [RUFF_SETTINGS_URI],
|
|
41
|
+
schema: ruffSchema
|
|
42
|
+
}]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return _registerRuffSchema.apply(this, arguments);
|
|
47
|
+
}
|
|
48
|
+
function disposeModel(editor) {
|
|
49
|
+
var _editor$getModel;
|
|
50
|
+
(_editor$getModel = editor.getModel()) === null || _editor$getModel === void 0 || _editor$getModel.dispose();
|
|
37
51
|
}
|
|
38
52
|
function getRuffVersion() {
|
|
39
53
|
return _getRuffVersion.apply(this, arguments);
|
|
@@ -66,16 +80,12 @@ export default function RuffSettingsModal(_ref) {
|
|
|
66
80
|
var formattedDefaultSettings = useMemo(() => JSON.stringify(defaultSettings, null, 2), [defaultSettings]);
|
|
67
81
|
var _usePromiseFactory = usePromiseFactory(getRuffVersion),
|
|
68
82
|
ruffVersion = _usePromiseFactory.data;
|
|
69
|
-
var _useState5 = useState(() => monaco.editor.createModel(text, 'json', RUFF_SETTINGS_URI)),
|
|
70
|
-
_useState6 = _slicedToArray(_useState5, 1),
|
|
71
|
-
model = _useState6[0];
|
|
72
83
|
var handleClose = useCallback(() => {
|
|
73
84
|
if (isOpen) {
|
|
74
85
|
onClose();
|
|
75
86
|
editorRef.current = undefined;
|
|
76
|
-
model.dispose();
|
|
77
87
|
}
|
|
78
|
-
}, [isOpen, onClose
|
|
88
|
+
}, [isOpen, onClose]);
|
|
79
89
|
var handleSave = useCallback(() => {
|
|
80
90
|
if (isOpen) {
|
|
81
91
|
try {
|
|
@@ -88,30 +98,35 @@ export default function RuffSettingsModal(_ref) {
|
|
|
88
98
|
}
|
|
89
99
|
}, [isOpen, handleClose, onSave]);
|
|
90
100
|
var handleReset = useCallback(() => {
|
|
91
|
-
assertNotNull(model);
|
|
92
|
-
model.setValue(formattedDefaultSettings);
|
|
93
|
-
}, [model, formattedDefaultSettings]);
|
|
94
|
-
var validate = useCallback(val => {
|
|
95
101
|
var _editorRef$current2;
|
|
102
|
+
(_editorRef$current2 = editorRef.current) === null || _editorRef$current2 === void 0 || (_editorRef$current2 = _editorRef$current2.getModel()) === null || _editorRef$current2 === void 0 || _editorRef$current2.setValue(formattedDefaultSettings);
|
|
103
|
+
}, [formattedDefaultSettings]);
|
|
104
|
+
var validate = useCallback(val => {
|
|
105
|
+
var _editorRef$current3;
|
|
96
106
|
try {
|
|
97
107
|
JSON.parse(val);
|
|
98
108
|
setIsValid(true);
|
|
99
109
|
} catch (_unused2) {
|
|
100
110
|
setIsValid(false);
|
|
101
111
|
}
|
|
102
|
-
setIsDefault(((_editorRef$
|
|
112
|
+
setIsDefault(((_editorRef$current3 = editorRef.current) === null || _editorRef$current3 === void 0 || (_editorRef$current3 = _editorRef$current3.getModel()) === null || _editorRef$current3 === void 0 ? void 0 : _editorRef$current3.getValue()) === formattedDefaultSettings);
|
|
103
113
|
}, [formattedDefaultSettings]);
|
|
104
114
|
var debouncedValidate = useDebouncedCallback(validate, 500, {
|
|
105
115
|
leading: true
|
|
106
116
|
});
|
|
107
117
|
var onEditorInitialized = useCallback(editor => {
|
|
118
|
+
var monaco = MonacoUtils.getMonaco();
|
|
108
119
|
editorRef.current = editor;
|
|
120
|
+
|
|
121
|
+
// The schema matches the settings by this URI
|
|
122
|
+
var model = monaco.editor.createModel(text, 'json', monaco.Uri.parse(RUFF_SETTINGS_URI));
|
|
123
|
+
editor.setModel(model);
|
|
109
124
|
model.onDidChangeContent(() => {
|
|
110
125
|
debouncedValidate(model.getValue());
|
|
111
126
|
});
|
|
112
|
-
registerRuffSchema();
|
|
127
|
+
registerRuffSchema().catch(log.error);
|
|
113
128
|
debouncedValidate(model.getValue());
|
|
114
|
-
}, [debouncedValidate,
|
|
129
|
+
}, [debouncedValidate, text]);
|
|
115
130
|
if (!isOpen) {
|
|
116
131
|
return null;
|
|
117
132
|
}
|
|
@@ -154,9 +169,9 @@ export default function RuffSettingsModal(_ref) {
|
|
|
154
169
|
},
|
|
155
170
|
children: /*#__PURE__*/_jsx(Editor, {
|
|
156
171
|
onEditorInitialized: onEditorInitialized,
|
|
172
|
+
onEditorWillDestroy: disposeModel,
|
|
157
173
|
settings: {
|
|
158
174
|
readOnly,
|
|
159
|
-
value: text,
|
|
160
175
|
language: 'json',
|
|
161
176
|
folding: true,
|
|
162
177
|
padding: {
|
|
@@ -164,7 +179,7 @@ export default function RuffSettingsModal(_ref) {
|
|
|
164
179
|
},
|
|
165
180
|
lineNumbers: 'on',
|
|
166
181
|
overviewRulerLanes: 0,
|
|
167
|
-
model
|
|
182
|
+
model: null
|
|
168
183
|
}
|
|
169
184
|
})
|
|
170
185
|
}), /*#__PURE__*/_jsx(ModalFooter, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuffSettingsModal.js","names":["React","useCallback","useMemo","useRef","useState","monaco","Workspace","FontAwesomeIcon","ActionButton","Button","Icon","Link","Modal","ModalBody","ModalFooter","ModalHeader","Text","vsLinkExternal","vsDiscard","useDebouncedCallback","usePromiseFactory","assertNotNull","EMPTY_FUNCTION","Editor","RUFF_DEFAULT_SETTINGS","ruffSchema","MonacoProviders","jsxs","_jsxs","jsx","_jsx","Fragment","_Fragment","RUFF_SETTINGS_URI","Uri","parse","registerRuffSchema","_monaco$languages$jso","languages","json","jsonDefaults","diagnosticsOptions","schemas","some","schema","uri","setDiagnosticsOptions","fileMatch","toString","getRuffVersion","_getRuffVersion","apply","arguments","_asyncToGenerator","initRuff","concat","version","RuffSettingsModal","_ref","text","isOpen","onClose","onSave","_ref$readOnly","readOnly","_ref$defaultSettings","defaultSettings","_useState","_useState2","_slicedToArray","isValid","setIsValid","_useState3","_useState4","isDefault","setIsDefault","editorRef","formattedDefaultSettings","JSON","stringify","_usePromiseFactory","ruffVersion","data","_useState5","editor","createModel","_useState6","model","handleClose","current","undefined","dispose","handleSave","_editorRef$current$ge","_editorRef$current","getModel","getValue","_unused","handleReset","setValue","validate","val","_editorRef$current2","_unused2","debouncedValidate","leading","onEditorInitialized","onDidChangeContent","centered","keyboard","clickOutside","toggle","size","className","children","closeButton","href","target","kind","onClick","icon","isDisabled","onPress","style","height","settings","value","language","folding","padding","bottom","lineNumbers","overviewRulerLanes","tooltip","disabled"],"sources":["../../src/monaco/RuffSettingsModal.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useRef, useState } from 'react';\nimport * as monaco from 'monaco-editor';\nimport { Workspace } from '@astral-sh/ruff-wasm-web';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport {\n ActionButton,\n Button,\n Icon,\n Link,\n Modal,\n ModalBody,\n ModalFooter,\n ModalHeader,\n Text,\n} from '@deephaven/components';\nimport { vsLinkExternal, vsDiscard } from '@deephaven/icons';\nimport {\n useDebouncedCallback,\n usePromiseFactory,\n} from '@deephaven/react-hooks';\nimport { assertNotNull, EMPTY_FUNCTION } from '@deephaven/utils';\nimport Editor from '../notebook/Editor';\nimport RUFF_DEFAULT_SETTINGS from './RuffDefaultSettings';\nimport ruffSchema from './ruffSchema';\nimport './RuffSettingsModal.scss';\nimport MonacoProviders from './MonacoProviders';\n\ninterface RuffSettingsModalProps {\n text: string;\n isOpen: boolean;\n onClose: () => void;\n onSave: (value: Record<string, unknown>) => void;\n readOnly?: boolean;\n defaultSettings?: Record<string, unknown>;\n}\n\nconst RUFF_SETTINGS_URI = monaco.Uri.parse(\n 'inmemory://dh-config/ruff-settings.json'\n);\n\nfunction registerRuffSchema(): void {\n const { schemas = [] } =\n monaco.languages.json.jsonDefaults.diagnosticsOptions;\n\n if (!schemas.some(schema => schema.uri === 'json://ruff-schema')) {\n // Register the ruff schema so users get validation and completion\n monaco.languages.json.jsonDefaults.setDiagnosticsOptions({\n schemas: [\n ...schemas,\n {\n uri: 'json://ruff-schema',\n fileMatch: [RUFF_SETTINGS_URI.toString()],\n schema: ruffSchema,\n },\n ],\n });\n }\n}\n\nasync function getRuffVersion(): Promise<string> {\n await MonacoProviders.initRuff();\n return `v${Workspace.version()}`;\n}\n\nexport default function RuffSettingsModal({\n text,\n isOpen,\n onClose,\n onSave,\n readOnly = false,\n defaultSettings = RUFF_DEFAULT_SETTINGS,\n}: RuffSettingsModalProps): React.ReactElement | null {\n const [isValid, setIsValid] = useState(false);\n const [isDefault, setIsDefault] = useState(false);\n const editorRef = useRef<monaco.editor.IStandaloneCodeEditor>();\n\n const formattedDefaultSettings = useMemo(\n () => JSON.stringify(defaultSettings, null, 2),\n [defaultSettings]\n );\n\n const { data: ruffVersion } = usePromiseFactory(getRuffVersion);\n\n const [model] = useState(() =>\n monaco.editor.createModel(text, 'json', RUFF_SETTINGS_URI)\n );\n\n const handleClose = useCallback((): void => {\n if (isOpen) {\n onClose();\n editorRef.current = undefined;\n model.dispose();\n }\n }, [isOpen, onClose, model]);\n\n const handleSave = useCallback((): void => {\n if (isOpen) {\n try {\n onSave(JSON.parse(editorRef.current?.getModel()?.getValue() ?? ''));\n } catch {\n // no-op\n }\n handleClose();\n }\n }, [isOpen, handleClose, onSave]);\n\n const handleReset = useCallback((): void => {\n assertNotNull(model);\n model.setValue(formattedDefaultSettings);\n }, [model, formattedDefaultSettings]);\n\n const validate = useCallback(\n (val: string) => {\n try {\n JSON.parse(val);\n setIsValid(true);\n } catch {\n setIsValid(false);\n }\n setIsDefault(\n editorRef.current?.getModel()?.getValue() === formattedDefaultSettings\n );\n },\n [formattedDefaultSettings]\n );\n\n const debouncedValidate = useDebouncedCallback(validate, 500, {\n leading: true,\n });\n\n const onEditorInitialized = useCallback(\n (editor: monaco.editor.IStandaloneCodeEditor): void => {\n editorRef.current = editor;\n\n model.onDidChangeContent(() => {\n debouncedValidate(model.getValue());\n });\n\n registerRuffSchema();\n debouncedValidate(model.getValue());\n },\n [debouncedValidate, model]\n );\n\n if (!isOpen) {\n return null;\n }\n\n return (\n <Modal\n isOpen={isOpen}\n centered\n keyboard\n clickOutside={false}\n toggle={handleClose}\n size=\"lg\"\n className=\"ruff-settings-modal\"\n >\n <ModalHeader closeButton={false}>\n <span className=\"settings-modal-title mr-auto\">\n Ruff {ruffVersion} Settings\n </span>\n\n <Link href=\"https://docs.astral.sh/ruff/settings/\" target=\"_blank\">\n <Button kind=\"ghost\" onClick={EMPTY_FUNCTION} icon={vsLinkExternal}>\n Settings Docs\n </Button>\n </Link>\n\n <ActionButton isDisabled={isDefault} onPress={handleReset}>\n <Icon>\n <FontAwesomeIcon icon={vsDiscard} />\n </Icon>\n <Text>Reset to default</Text>\n </ActionButton>\n </ModalHeader>\n <ModalBody style={{ height: '80vh' }}>\n <Editor\n onEditorInitialized={onEditorInitialized}\n settings={{\n readOnly,\n value: text,\n language: 'json',\n folding: true,\n padding: { bottom: 16 },\n lineNumbers: 'on',\n overviewRulerLanes: 0,\n model,\n }}\n />\n </ModalBody>\n <ModalFooter>\n {readOnly ? (\n <Button kind=\"secondary\" data-dismiss=\"modal\" onClick={handleClose}>\n Close\n </Button>\n ) : (\n <>\n <Button kind=\"secondary\" data-dismiss=\"modal\" onClick={handleClose}>\n Cancel\n </Button>\n <Button\n kind=\"primary\"\n data-dismiss=\"modal\"\n tooltip={!isValid ? 'Cannot save invalid JSON' : undefined}\n disabled={!isValid}\n onClick={handleSave}\n >\n Save\n </Button>\n </>\n )}\n </ModalFooter>\n </Modal>\n );\n}\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACrE,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,SAAS,QAAQ,0BAA0B;AACpD,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SACEC,YAAY,EACZC,MAAM,EACNC,IAAI,EACJC,IAAI,EACJC,KAAK,EACLC,SAAS,EACTC,WAAW,EACXC,WAAW,EACXC,IAAI,QACC,uBAAuB;AAC9B,SAASC,cAAc,EAAEC,SAAS,QAAQ,kBAAkB;AAC5D,SACEC,oBAAoB,EACpBC,iBAAiB,QACZ,wBAAwB;AAC/B,SAASC,aAAa,EAAEC,cAAc,QAAQ,kBAAkB;AAAC,OAC1DC,MAAM;AAAA,OACNC,qBAAqB;AAAA,OACrBC,UAAU;AAAA;AAAA,OAEVC,eAAe;AAAA,SAAAC,IAAA,IAAAC,KAAA,EAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA;AAWtB,IAAMC,iBAAiB,GAAG5B,MAAM,CAAC6B,GAAG,CAACC,KAAK,CACxC,yCACF,CAAC;AAED,SAASC,kBAAkBA,CAAA,EAAS;EAClC,IAAAC,qBAAA,GACEhC,MAAM,CAACiC,SAAS,CAACC,IAAI,CAACC,YAAY,CAACC,kBAAkB,CAD/CC,OAAO;IAAPA,OAAO,GAAAL,qBAAA,cAAG,EAAE,GAAAA,qBAAA;EAGpB,IAAI,CAACK,OAAO,CAACC,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,GAAG,KAAK,oBAAoB,CAAC,EAAE;IAChE;IACAxC,MAAM,CAACiC,SAAS,CAACC,IAAI,CAACC,YAAY,CAACM,qBAAqB,CAAC;MACvDJ,OAAO,EAAE,CAC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E,IAAI;UACbC,OAAO,EAAE;YAAEC,MAAM,EAAE;UAAG,CAAC;UACvBC,WAAW,EAAE,IAAI;UACjBC,kBAAkB,EAAE,CAAC;UACrB7C;QACF;MAAE,CACH;IAAC,CACO,CAAC,eACZzD,IAAA,CAAChB,WAAW;MAAAoG,QAAA,EACTlD,QAAQ,gBACPlC,IAAA,CAACrB,MAAM;QAAC6G,IAAI,EAAC,WAAW;QAAC,gBAAa,OAAO;QAACC,OAAO,EAAE/B,WAAY;QAAA0B,QAAA,EAAC;MAEpE,CAAQ,CAAC,gBAETtF,KAAA,CAAAI,SAAA;QAAAkF,QAAA,gBACEpF,IAAA,CAACrB,MAAM;UAAC6G,IAAI,EAAC,WAAW;UAAC,gBAAa,OAAO;UAACC,OAAO,EAAE/B,WAAY;UAAA0B,QAAA,EAAC;QAEpE,CAAQ,CAAC,eACTpF,IAAA,CAACrB,MAAM;UACL6G,IAAI,EAAC,SAAS;UACd,gBAAa,OAAO;UACpBe,OAAO,EAAE,CAAC/D,OAAO,GAAG,0BAA0B,GAAGoB,SAAU;UAC3D4C,QAAQ,EAAE,CAAChE,OAAQ;UACnBiD,OAAO,EAAE3B,UAAW;UAAAsB,QAAA,EACrB;QAED,CAAQ,CAAC;MAAA,CACT;IACH,CACU,CAAC;EAAA,CACT,CAAC;AAEZ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"RuffSettingsModal.js","names":["React","useCallback","useMemo","useRef","useState","Workspace","FontAwesomeIcon","ActionButton","Button","Icon","Link","Modal","ModalBody","ModalFooter","ModalHeader","Text","vsLinkExternal","vsDiscard","useDebouncedCallback","usePromiseFactory","EMPTY_FUNCTION","Log","Editor","RUFF_DEFAULT_SETTINGS","MonacoProviders","MonacoUtils","jsxs","_jsxs","jsx","_jsx","Fragment","_Fragment","log","module","RUFF_SETTINGS_URI","registerRuffSchema","_registerRuffSchema","apply","arguments","_asyncToGenerator","jsonDefaults","getMonaco","languages","json","_jsonDefaults$diagnos","diagnosticsOptions","schemas","some","schema","uri","_yield$import","ruffSchema","default","setDiagnosticsOptions","fileMatch","disposeModel","editor","_editor$getModel","getModel","dispose","getRuffVersion","_getRuffVersion","initRuff","concat","version","RuffSettingsModal","_ref","text","isOpen","onClose","onSave","_ref$readOnly","readOnly","_ref$defaultSettings","defaultSettings","_useState","_useState2","_slicedToArray","isValid","setIsValid","_useState3","_useState4","isDefault","setIsDefault","editorRef","formattedDefaultSettings","JSON","stringify","_usePromiseFactory","ruffVersion","data","handleClose","current","undefined","handleSave","_editorRef$current$ge","_editorRef$current","parse","getValue","_unused","handleReset","_editorRef$current2","setValue","validate","val","_editorRef$current3","_unused2","debouncedValidate","leading","onEditorInitialized","monaco","model","createModel","Uri","setModel","onDidChangeContent","catch","error","centered","keyboard","clickOutside","toggle","size","className","children","closeButton","href","target","kind","onClick","icon","isDisabled","onPress","style","height","onEditorWillDestroy","settings","language","folding","padding","bottom","lineNumbers","overviewRulerLanes","tooltip","disabled"],"sources":["../../src/monaco/RuffSettingsModal.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useRef, useState } from 'react';\nimport type * as monaco from 'monaco-editor';\nimport { Workspace } from '@astral-sh/ruff-wasm-web';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport {\n ActionButton,\n Button,\n Icon,\n Link,\n Modal,\n ModalBody,\n ModalFooter,\n ModalHeader,\n Text,\n} from '@deephaven/components';\nimport { vsLinkExternal, vsDiscard } from '@deephaven/icons';\nimport {\n useDebouncedCallback,\n usePromiseFactory,\n} from '@deephaven/react-hooks';\nimport { EMPTY_FUNCTION } from '@deephaven/utils';\nimport Log from '@deephaven/log';\nimport Editor from '../notebook/Editor';\nimport RUFF_DEFAULT_SETTINGS from './RuffDefaultSettings';\nimport './RuffSettingsModal.scss';\nimport MonacoProviders from './MonacoProviders';\nimport MonacoUtils from './MonacoUtils';\n\ninterface RuffSettingsModalProps {\n text: string;\n isOpen: boolean;\n onClose: () => void;\n onSave: (value: Record<string, unknown>) => void;\n readOnly?: boolean;\n defaultSettings?: Record<string, unknown>;\n}\n\nconst log = Log.module('RuffSettingsModal');\n\nconst RUFF_SETTINGS_URI = 'inmemory://dh-config/ruff-settings.json';\n\nasync function registerRuffSchema(): Promise<void> {\n const { jsonDefaults } = MonacoUtils.getMonaco().languages.json;\n const { schemas = [] } = jsonDefaults.diagnosticsOptions;\n\n if (!schemas.some(schema => schema.uri === 'json://ruff-schema')) {\n // Register the ruff schema so users get validation and completion\n const { default: ruffSchema } = await import('./ruffSchema');\n jsonDefaults.setDiagnosticsOptions({\n schemas: [\n ...schemas,\n {\n uri: 'json://ruff-schema',\n fileMatch: [RUFF_SETTINGS_URI],\n schema: ruffSchema,\n },\n ],\n });\n }\n}\n\nfunction disposeModel(editor: monaco.editor.IStandaloneCodeEditor): void {\n editor.getModel()?.dispose();\n}\n\nasync function getRuffVersion(): Promise<string> {\n await MonacoProviders.initRuff();\n return `v${Workspace.version()}`;\n}\n\nexport default function RuffSettingsModal({\n text,\n isOpen,\n onClose,\n onSave,\n readOnly = false,\n defaultSettings = RUFF_DEFAULT_SETTINGS,\n}: RuffSettingsModalProps): React.ReactElement | null {\n const [isValid, setIsValid] = useState(false);\n const [isDefault, setIsDefault] = useState(false);\n const editorRef = useRef<monaco.editor.IStandaloneCodeEditor>();\n\n const formattedDefaultSettings = useMemo(\n () => JSON.stringify(defaultSettings, null, 2),\n [defaultSettings]\n );\n\n const { data: ruffVersion } = usePromiseFactory(getRuffVersion);\n\n const handleClose = useCallback((): void => {\n if (isOpen) {\n onClose();\n editorRef.current = undefined;\n }\n }, [isOpen, onClose]);\n\n const handleSave = useCallback((): void => {\n if (isOpen) {\n try {\n onSave(JSON.parse(editorRef.current?.getModel()?.getValue() ?? ''));\n } catch {\n // no-op\n }\n handleClose();\n }\n }, [isOpen, handleClose, onSave]);\n\n const handleReset = useCallback((): void => {\n editorRef.current?.getModel()?.setValue(formattedDefaultSettings);\n }, [formattedDefaultSettings]);\n\n const validate = useCallback(\n (val: string) => {\n try {\n JSON.parse(val);\n setIsValid(true);\n } catch {\n setIsValid(false);\n }\n setIsDefault(\n editorRef.current?.getModel()?.getValue() === formattedDefaultSettings\n );\n },\n [formattedDefaultSettings]\n );\n\n const debouncedValidate = useDebouncedCallback(validate, 500, {\n leading: true,\n });\n\n const onEditorInitialized = useCallback(\n (editor: monaco.editor.IStandaloneCodeEditor): void => {\n const monaco = MonacoUtils.getMonaco();\n editorRef.current = editor;\n\n // The schema matches the settings by this URI\n const model = monaco.editor.createModel(\n text,\n 'json',\n monaco.Uri.parse(RUFF_SETTINGS_URI)\n );\n editor.setModel(model);\n model.onDidChangeContent(() => {\n debouncedValidate(model.getValue());\n });\n\n registerRuffSchema().catch(log.error);\n debouncedValidate(model.getValue());\n },\n [debouncedValidate, text]\n );\n\n if (!isOpen) {\n return null;\n }\n\n return (\n <Modal\n isOpen={isOpen}\n centered\n keyboard\n clickOutside={false}\n toggle={handleClose}\n size=\"lg\"\n className=\"ruff-settings-modal\"\n >\n <ModalHeader closeButton={false}>\n <span className=\"settings-modal-title mr-auto\">\n Ruff {ruffVersion} Settings\n </span>\n\n <Link href=\"https://docs.astral.sh/ruff/settings/\" target=\"_blank\">\n <Button kind=\"ghost\" onClick={EMPTY_FUNCTION} icon={vsLinkExternal}>\n Settings Docs\n </Button>\n </Link>\n\n <ActionButton isDisabled={isDefault} onPress={handleReset}>\n <Icon>\n <FontAwesomeIcon icon={vsDiscard} />\n </Icon>\n <Text>Reset to default</Text>\n </ActionButton>\n </ModalHeader>\n <ModalBody style={{ height: '80vh' }}>\n <Editor\n onEditorInitialized={onEditorInitialized}\n onEditorWillDestroy={disposeModel}\n settings={{\n readOnly,\n language: 'json',\n folding: true,\n padding: { bottom: 16 },\n lineNumbers: 'on',\n overviewRulerLanes: 0,\n model: null,\n }}\n />\n </ModalBody>\n <ModalFooter>\n {readOnly ? (\n <Button kind=\"secondary\" data-dismiss=\"modal\" onClick={handleClose}>\n Close\n </Button>\n ) : (\n <>\n <Button kind=\"secondary\" data-dismiss=\"modal\" onClick={handleClose}>\n Cancel\n </Button>\n <Button\n kind=\"primary\"\n data-dismiss=\"modal\"\n tooltip={!isValid ? 'Cannot save invalid JSON' : undefined}\n disabled={!isValid}\n onClick={handleSave}\n >\n Save\n </Button>\n </>\n )}\n </ModalFooter>\n </Modal>\n );\n}\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAErE,SAASC,SAAS,QAAQ,0BAA0B;AACpD,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SACEC,YAAY,EACZC,MAAM,EACNC,IAAI,EACJC,IAAI,EACJC,KAAK,EACLC,SAAS,EACTC,WAAW,EACXC,WAAW,EACXC,IAAI,QACC,uBAAuB;AAC9B,SAASC,cAAc,EAAEC,SAAS,QAAQ,kBAAkB;AAC5D,SACEC,oBAAoB,EACpBC,iBAAiB,QACZ,wBAAwB;AAC/B,SAASC,cAAc,QAAQ,kBAAkB;AACjD,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAC1BC,MAAM;AAAA,OACNC,qBAAqB;AAAA;AAAA,OAErBC,eAAe;AAAA,OACfC,WAAW;AAAA,SAAAC,IAAA,IAAAC,KAAA,EAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA;AAWlB,IAAMC,GAAG,GAAGX,GAAG,CAACY,MAAM,CAAC,mBAAmB,CAAC;AAE3C,IAAMC,iBAAiB,GAAG,yCAAyC;AAAC,SAErDC,kBAAkBA,CAAA;EAAA,OAAAC,mBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,oBAAA;EAAAA,mBAAA,GAAAG,iBAAA,CAAjC,aAAmD;IACjD,IAAQC,YAAY,GAAKf,WAAW,CAACgB,SAAS,CAAC,CAAC,CAACC,SAAS,CAACC,IAAI,CAAvDH,YAAY;IACpB,IAAAI,qBAAA,GAAyBJ,YAAY,CAACK,k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AC;QAEpE,CAAQ,CAAC,eACT/F,IAAA,CAACrB,MAAM;UACLwH,IAAI,EAAC,SAAS;UACd,gBAAa,OAAO;UACpBe,OAAO,EAAE,CAACjE,OAAO,GAAG,0BAA0B,GAAGe,SAAU;UAC3DmD,QAAQ,EAAE,CAAClE,OAAQ;UACnBmD,OAAO,EAAEnC,UAAW;UAAA8B,QAAA,EACrB;QAED,CAAQ,CAAC;MAAA,CACT;IACH,CACU,CAAC;EAAA,CACT,CAAC;AAEZ","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Editor editor for large blocks of code
|
|
3
3
|
*/
|
|
4
4
|
import { Component, type ReactElement } from 'react';
|
|
5
|
-
import * as monaco from 'monaco-editor';
|
|
5
|
+
import type * as monaco from 'monaco-editor';
|
|
6
6
|
import './Editor.scss';
|
|
7
7
|
export interface EditorProps {
|
|
8
8
|
className: string;
|
|
@@ -10,7 +10,9 @@ export interface EditorProps {
|
|
|
10
10
|
onEditorWillDestroy: (editor: monaco.editor.IStandaloneCodeEditor) => void;
|
|
11
11
|
settings: monaco.editor.IStandaloneEditorConstructionOptions;
|
|
12
12
|
}
|
|
13
|
-
declare class Editor extends Component<EditorProps,
|
|
13
|
+
declare class Editor extends Component<EditorProps, {
|
|
14
|
+
error?: unknown;
|
|
15
|
+
}> {
|
|
14
16
|
static defaultProps: {
|
|
15
17
|
className: string;
|
|
16
18
|
onEditorInitialized: () => void;
|
|
@@ -26,7 +28,7 @@ declare class Editor extends Component<EditorProps, Record<string, never>> {
|
|
|
26
28
|
handleResize(): void;
|
|
27
29
|
toggleFind(): void;
|
|
28
30
|
updateDimensions(): void;
|
|
29
|
-
initEditor(): void
|
|
31
|
+
initEditor(): Promise<void>;
|
|
30
32
|
destroyEditor(): void;
|
|
31
33
|
render(): ReactElement;
|
|
32
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../src/notebook/Editor.tsx"],"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