diff --git a/examples/notebook/example.spec.ts-snapshots/example-linux.png b/examples/notebook/example.spec.ts-snapshots/example-linux.png index 3bc852278410..8a09ec72d3b8 100644 Binary files a/examples/notebook/example.spec.ts-snapshots/example-linux.png and b/examples/notebook/example.spec.ts-snapshots/example-linux.png differ diff --git a/galata/test/benchmark/notebook.spec.ts-snapshots/large-code-notebook-ipynb-benchmark-linux.png b/galata/test/benchmark/notebook.spec.ts-snapshots/large-code-notebook-ipynb-benchmark-linux.png index d92cf065c4d2..195ac18b7bed 100644 Binary files a/galata/test/benchmark/notebook.spec.ts-snapshots/large-code-notebook-ipynb-benchmark-linux.png and b/galata/test/benchmark/notebook.spec.ts-snapshots/large-code-notebook-ipynb-benchmark-linux.png differ diff --git a/galata/test/jupyterlab/debugger.test.ts-snapshots/start-debug-session-script-sources-jupyterlab-linux.png b/galata/test/jupyterlab/debugger.test.ts-snapshots/start-debug-session-script-sources-jupyterlab-linux.png index 71f4e3df4dad..8c0615310aa5 100644 Binary files a/galata/test/jupyterlab/debugger.test.ts-snapshots/start-debug-session-script-sources-jupyterlab-linux.png and b/galata/test/jupyterlab/debugger.test.ts-snapshots/start-debug-session-script-sources-jupyterlab-linux.png differ diff --git a/galata/test/jupyterlab/debugger.test.ts-snapshots/start-debug-session-sources-jupyterlab-linux.png b/galata/test/jupyterlab/debugger.test.ts-snapshots/start-debug-session-sources-jupyterlab-linux.png index 19d8db7e1078..a35d44d2c9c0 100644 Binary files a/galata/test/jupyterlab/debugger.test.ts-snapshots/start-debug-session-sources-jupyterlab-linux.png and b/galata/test/jupyterlab/debugger.test.ts-snapshots/start-debug-session-sources-jupyterlab-linux.png differ diff --git a/galata/test/jupyterlab/notebook-mobile.test.ts-snapshots/mobile-layout-jupyterlab-linux.png b/galata/test/jupyterlab/notebook-mobile.test.ts-snapshots/mobile-layout-jupyterlab-linux.png index e7fc0c88e0ec..9b99de6442b3 100644 Binary files a/galata/test/jupyterlab/notebook-mobile.test.ts-snapshots/mobile-layout-jupyterlab-linux.png and b/galata/test/jupyterlab/notebook-mobile.test.ts-snapshots/mobile-layout-jupyterlab-linux.png differ diff --git a/galata/test/jupyterlab/notebook-search.test.ts-snapshots/search-new-outputs-jupyterlab-linux.png b/galata/test/jupyterlab/notebook-search.test.ts-snapshots/search-new-outputs-jupyterlab-linux.png index 57819f74e41c..baba7c87fca7 100644 Binary files a/galata/test/jupyterlab/notebook-search.test.ts-snapshots/search-new-outputs-jupyterlab-linux.png and b/galata/test/jupyterlab/notebook-search.test.ts-snapshots/search-new-outputs-jupyterlab-linux.png differ diff --git a/galata/test/jupyterlab/notebook-search.test.ts-snapshots/search-on-new-cell-jupyterlab-linux.png b/galata/test/jupyterlab/notebook-search.test.ts-snapshots/search-on-new-cell-jupyterlab-linux.png index 33f07d6f7301..4c02210b2abd 100644 Binary files a/galata/test/jupyterlab/notebook-search.test.ts-snapshots/search-on-new-cell-jupyterlab-linux.png and b/galata/test/jupyterlab/notebook-search.test.ts-snapshots/search-on-new-cell-jupyterlab-linux.png differ diff --git a/galata/test/jupyterlab/notebook-search.test.ts-snapshots/search-within-outputs-jupyterlab-linux.png b/galata/test/jupyterlab/notebook-search.test.ts-snapshots/search-within-outputs-jupyterlab-linux.png index 686d8e42575a..41bc934410e0 100644 Binary files a/galata/test/jupyterlab/notebook-search.test.ts-snapshots/search-within-outputs-jupyterlab-linux.png and b/galata/test/jupyterlab/notebook-search.test.ts-snapshots/search-within-outputs-jupyterlab-linux.png differ diff --git a/galata/test/jupyterlab/output-scrolling.test.ts-snapshots/prompt-overlay-hover-normal-jupyterlab-linux.png b/galata/test/jupyterlab/output-scrolling.test.ts-snapshots/prompt-overlay-hover-normal-jupyterlab-linux.png index ad0f85ac2956..52627c4f9cbb 100644 Binary files a/galata/test/jupyterlab/output-scrolling.test.ts-snapshots/prompt-overlay-hover-normal-jupyterlab-linux.png and b/galata/test/jupyterlab/output-scrolling.test.ts-snapshots/prompt-overlay-hover-normal-jupyterlab-linux.png differ diff --git a/galata/test/jupyterlab/output-scrolling.test.ts-snapshots/prompt-overlay-hover-scroll-jupyterlab-linux.png b/galata/test/jupyterlab/output-scrolling.test.ts-snapshots/prompt-overlay-hover-scroll-jupyterlab-linux.png index fb215064a427..a547aa1928c0 100644 Binary files a/galata/test/jupyterlab/output-scrolling.test.ts-snapshots/prompt-overlay-hover-scroll-jupyterlab-linux.png and b/galata/test/jupyterlab/output-scrolling.test.ts-snapshots/prompt-overlay-hover-scroll-jupyterlab-linux.png differ diff --git a/packages/codemirror-extension/src/services.tsx b/packages/codemirror-extension/src/services.tsx index c9d5627b661d..5190f62e929d 100644 --- a/packages/codemirror-extension/src/services.tsx +++ b/packages/codemirror-extension/src/services.tsx @@ -3,7 +3,7 @@ * Distributed under the terms of the Modified BSD License. */ -import { StreamLanguage } from '@codemirror/language'; +import { LanguageSupport, StreamLanguage } from '@codemirror/language'; import { IYText } from '@jupyter/ydoc'; import { JupyterFrontEnd, @@ -20,6 +20,7 @@ import { IEditorLanguageRegistry, IEditorThemeRegistry, parseMathIPython, + pythonBuiltin, ybinding } from '@jupyterlab/codemirror'; import { ISettingRegistry } from '@jupyterlab/settingregistry'; @@ -62,17 +63,22 @@ export const languagePlugin: JupyterFrontEndPlugin = { name: 'ipythongfm', mime: 'text/x-ipythongfm', load: async () => { - const [m, tex] = await Promise.all([ + const [m, py, tex] = await Promise.all([ import('@codemirror/lang-markdown'), + import('@codemirror/lang-python'), import('@codemirror/legacy-modes/mode/stex') ]); - return m.markdown({ + const mdlang = m.markdown({ base: m.markdownLanguage, codeLanguages: (info: string) => languages.findBest(info) as any, extensions: [ parseMathIPython(StreamLanguage.define(tex.stexMath).parser) ] }); + return new LanguageSupport(mdlang.language, [ + mdlang.support, + pythonBuiltin(py.pythonLanguage) + ]); } }); return languages; diff --git a/packages/codemirror/src/index.ts b/packages/codemirror/src/index.ts index 33b1c4d60ed0..2d34ee896a7b 100644 --- a/packages/codemirror/src/index.ts +++ b/packages/codemirror/src/index.ts @@ -15,3 +15,4 @@ export * from './mimetype'; export * from './searchprovider'; export * from './theme'; export * from './token'; +export * from './pythonBuiltin'; diff --git a/packages/codemirror/src/language.ts b/packages/codemirror/src/language.ts index 3bafd287a416..55017e7a50ab 100644 --- a/packages/codemirror/src/language.ts +++ b/packages/codemirror/src/language.ts @@ -16,6 +16,7 @@ import { highlightTree } from '@lezer/highlight'; import { jupyterHighlightStyle } from './theme'; import { IEditorLanguage, IEditorLanguageRegistry } from './token'; +import { pythonBuiltin } from './pythonBuiltin'; /** * CodeMirror language registry @@ -473,7 +474,10 @@ export namespace EditorLanguageRegistry { filename: /^(BUCK|BUILD)$/, async load() { const m = await import('@codemirror/lang-python'); - return m.python(); + return new LanguageSupport( + m.pythonLanguage, + pythonBuiltin(m.pythonLanguage) + ); } }, { @@ -485,7 +489,10 @@ export namespace EditorLanguageRegistry { // to activate feature such as code folding. // return Promise.resolve(legacy(mkPython({ singleOperators: /\?/ }))); const m = await import('@codemirror/lang-python'); - return m.python(); + return new LanguageSupport( + m.pythonLanguage, + pythonBuiltin(m.pythonLanguage) + ); } }, { diff --git a/packages/codemirror/src/pythonBuiltin.ts b/packages/codemirror/src/pythonBuiltin.ts new file mode 100644 index 000000000000..332a35160dec --- /dev/null +++ b/packages/codemirror/src/pythonBuiltin.ts @@ -0,0 +1,159 @@ +/* + * Copyright (c) Jupyter Development Team. + * Distributed under the terms of the Modified BSD License. + */ + +import { Language, syntaxTree } from '@codemirror/language'; +import { RangeSetBuilder } from '@codemirror/state'; +import { + Decoration, + DecorationSet, + EditorView, + ViewPlugin, + ViewUpdate +} from '@codemirror/view'; +import { NodeProp, SyntaxNodeRef, Tree } from '@lezer/common'; + +export class PythonBuiltin { + decorations: DecorationSet; + decoratedTo: number; + langPython: Language; + tree: Tree; + mark: Decoration; + + constructor(view: EditorView, langPython: Language) { + this.langPython = langPython; + this.tree = syntaxTree(view.state); + this.mark = Decoration.mark({ class: 'cm-builtin' }); + this.decorations = this.buildDeco(view); + this.decoratedTo = view.viewport.to; + } + + update(update: ViewUpdate) { + let tree = syntaxTree(update.state); + let { viewport } = update.view, + decoratedToMapped = update.changes.mapPos(this.decoratedTo, 1); + if ( + tree.length < viewport.to && + tree.type == this.tree.type && + decoratedToMapped >= viewport.to + ) { + this.decorations = this.decorations.map(update.changes); + this.decoratedTo = decoratedToMapped; + } else if (tree != this.tree || update.viewportChanged) { + this.tree = tree; + this.decorations = this.buildDeco(update.view); + this.decoratedTo = viewport.to; + } + } + + buildDeco(view: EditorView) { + if (!this.tree.length) return Decoration.none; + + let builder = new RangeSetBuilder(); + const enter = (node: SyntaxNodeRef) => { + const cursor = node.node.cursor(); + // Handle nested language, e.g. Markdown + const mounted = cursor.tree && cursor.tree.prop(NodeProp.mounted); + if (mounted && mounted.overlay) { + node.node + .enter(mounted.overlay[0].from + node.from, 1) + ?.cursor() + .iterate(enter); + } + if ( + this.langPython.isActiveAt(view.state, node.from + 1) && + node.name === 'VariableName' + ) { + const variableName = view.state.sliceDoc(node.from, node.to); + if (builtins.includes(variableName)) { + builder.add(node.from, node.to, this.mark); + } + } + }; + for (let { from, to } of view.visibleRanges) { + this.tree.iterate({ enter, from, to }); + } + return builder.finish(); + } +} + +export function pythonBuiltin(langPython: Language) { + return ViewPlugin.define(view => new PythonBuiltin(view, langPython), { + decorations: v => v.decorations + }); +} + +const builtins = [ + 'abs', + 'aiter', + 'all', + 'any', + 'anext', + 'ascii', + 'bin', + 'bool', + 'breakpoint', + 'bytearray', + 'bytes', + 'callable', + 'chr', + 'classmethod', + 'compile', + 'complex', + 'delattr', + 'dict', + 'dir', + 'divmod', + 'enumerate', + 'eval', + 'exec', + 'filter', + 'float', + 'format', + 'frozenset', + 'getattr', + 'globals', + 'hasattr', + 'hash', + 'help', + 'hex', + 'id', + 'input', + 'int', + 'isinstance', + 'issubclass', + 'iter', + 'len', + 'list', + 'locals', + 'map', + 'max', + 'memoryview', + 'min', + 'next', + 'object', + 'oct', + 'open', + 'ord', + 'pow', + 'print', + 'property', + 'range', + 'repr', + 'reversed', + 'round', + 'set', + 'setattr', + 'slice', + 'sorted', + 'staticmethod', + 'str', + 'sum', + 'super', + 'tuple', + 'type', + 'vars', + 'zip', + '__import__' +]; diff --git a/packages/codemirror/src/theme.ts b/packages/codemirror/src/theme.ts index eec13b0a5c60..54cd7649fe35 100644 --- a/packages/codemirror/src/theme.ts +++ b/packages/codemirror/src/theme.ts @@ -81,6 +81,10 @@ export const jupyterEditorTheme = EditorView.theme({ '.cm-tooltip': { backgroundColor: 'var(--jp-layout-color1)' + }, + + '.cm-builtin': { + color: 'var(--jp-mirror-editor-builtin-color)' } }); diff --git a/packages/fileeditor/src/fileeditorlspadapter.ts b/packages/fileeditor/src/fileeditorlspadapter.ts index c8bccd505e94..7b0245aafc0e 100644 --- a/packages/fileeditor/src/fileeditorlspadapter.ts +++ b/packages/fileeditor/src/fileeditorlspadapter.ts @@ -45,6 +45,9 @@ export class FileEditorAdapter extends WidgetLSPAdapter< .then(async () => { await this.initOnceReady(); this._readyDelegate.resolve(); + this._editorAdded.emit({ + editor: this._virtualEditor + }); }) .catch(console.error); } @@ -151,6 +154,9 @@ export class FileEditorAdapter extends WidgetLSPAdapter< if (this.isDisposed) { return; } + this._editorRemoved.emit({ + editor: this._virtualEditor + }); this.editor.model.mimeTypeChanged.disconnect(this.reloadConnection); super.dispose(); } diff --git a/packages/lsp/src/adapters/editorAdapter.ts b/packages/lsp/src/adapters/editorAdapter.ts index 29e46948c005..327575a422f1 100644 --- a/packages/lsp/src/adapters/editorAdapter.ts +++ b/packages/lsp/src/adapters/editorAdapter.ts @@ -51,8 +51,8 @@ export class EditorAdapter implements IDisposable { * Setup the editor. */ private _injectExtensions(editor: Document.IEditor): void { - const codeEditor = editor.getEditor()!; - if (codeEditor.isDisposed) { + const codeEditor = editor.getEditor(); + if (!codeEditor || codeEditor.isDisposed) { return; } diff --git a/packages/rendermime/src/widgets.ts b/packages/rendermime/src/widgets.ts index 879dcd94af46..78eb93aa55cf 100644 --- a/packages/rendermime/src/widgets.ts +++ b/packages/rendermime/src/widgets.ts @@ -184,7 +184,7 @@ export class RenderedHTML extends RenderedHTMLCommon { * @returns A promise which resolves when rendering is complete. */ render(model: IRenderMime.IMimeModel): Promise { - return renderers.renderHTML({ + return (this._rendered = renderers.renderHTML({ host: this.node, source: String(model.data[this.mimeType]), trusted: model.trusted, @@ -194,17 +194,24 @@ export class RenderedHTML extends RenderedHTMLCommon { shouldTypeset: this.isAttached, latexTypesetter: this.latexTypesetter, translator: this.translator - }); + })); } /** * A message handler invoked on an `'after-attach'` message. */ onAfterAttach(msg: Message): void { - if (this.latexTypesetter) { - this.latexTypesetter.typeset(this.node); - } + this._rendered + .then(() => { + if (this.latexTypesetter) { + this.latexTypesetter.typeset(this.node); + } + }) + .catch(console.warn); } + + // A promise which resolves when most recent rendering is complete. + private _rendered: Promise = Promise.resolve(); } /** @@ -229,22 +236,29 @@ export class RenderedLatex extends RenderedCommon { * @returns A promise which resolves when rendering is complete. */ render(model: IRenderMime.IMimeModel): Promise { - return renderers.renderLatex({ + return (this._rendered = renderers.renderLatex({ host: this.node, source: String(model.data[this.mimeType]), shouldTypeset: this.isAttached, latexTypesetter: this.latexTypesetter - }); + })); } /** * A message handler invoked on an `'after-attach'` message. */ onAfterAttach(msg: Message): void { - if (this.latexTypesetter) { - this.latexTypesetter.typeset(this.node); - } + this._rendered + .then(() => { + if (this.latexTypesetter) { + this.latexTypesetter.typeset(this.node); + } + }) + .catch(console.warn); } + + // A promise which resolves when most recent rendering is complete. + private _rendered: Promise = Promise.resolve(); } /** @@ -306,7 +320,7 @@ export class RenderedMarkdown extends RenderedHTMLCommon { * @returns A promise which resolves when rendering is complete. */ render(model: IRenderMime.IMimeModel): Promise { - return renderers.renderMarkdown({ + return (this._rendered = renderers.renderMarkdown({ host: this.node, source: String(model.data[this.mimeType]), trusted: model.trusted, @@ -317,7 +331,7 @@ export class RenderedMarkdown extends RenderedHTMLCommon { latexTypesetter: this.latexTypesetter, markdownParser: this.markdownParser, translator: this.translator - }); + })); } /** @@ -335,10 +349,17 @@ export class RenderedMarkdown extends RenderedHTMLCommon { * A message handler invoked on an `'after-attach'` message. */ onAfterAttach(msg: Message): void { - if (this.latexTypesetter) { - this.latexTypesetter.typeset(this.node); - } + this._rendered + .then(() => { + if (this.latexTypesetter) { + this.latexTypesetter.typeset(this.node); + } + }) + .catch(console.warn); } + + // A promise which resolves when most recent rendering is complete. + private _rendered: Promise = Promise.resolve(); } /** @@ -366,23 +387,30 @@ export class RenderedSVG extends RenderedCommon { const metadata = model.metadata[this.mimeType] as | ReadonlyJSONObject | undefined; - return renderers.renderSVG({ + return (this._rendered = renderers.renderSVG({ host: this.node, source: String(model.data[this.mimeType]), trusted: model.trusted, unconfined: metadata && (metadata.unconfined as boolean | undefined), translator: this.translator - }); + })); } /** * A message handler invoked on an `'after-attach'` message. */ onAfterAttach(msg: Message): void { - if (this.latexTypesetter) { - this.latexTypesetter.typeset(this.node); - } + this._rendered + .then(() => { + if (this.latexTypesetter) { + this.latexTypesetter.typeset(this.node); + } + }) + .catch(console.warn); } + + // A promise which resolves when most recent rendering is complete. + private _rendered: Promise = Promise.resolve(); } /** diff --git a/packages/services/src/config/index.ts b/packages/services/src/config/index.ts index 176f4d601bfa..a9ea28916683 100644 --- a/packages/services/src/config/index.ts +++ b/packages/services/src/config/index.ts @@ -104,7 +104,7 @@ class DefaultConfigSection implements IConfigSection { * Load the initial data for this section. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/config). + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/config). * * The promise is fulfilled on a valid response and rejected otherwise. */ @@ -125,7 +125,7 @@ class DefaultConfigSection implements IConfigSection { * Modify the stored config values. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/config). + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/config). * * The promise is fulfilled on a valid response and rejected otherwise. * @@ -181,7 +181,7 @@ export class ConfigWithDefaults { * Set a config value. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/config). + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/config). * * The promise is fulfilled on a valid response and rejected otherwise. * diff --git a/packages/services/src/contents/index.ts b/packages/services/src/contents/index.ts index 11d7913da369..98fdab702afc 100644 --- a/packages/services/src/contents/index.ts +++ b/packages/services/src/contents/index.ts @@ -1127,7 +1127,7 @@ export class Drive implements Contents.IDrive { * * @returns A promise which resolves with the file content. * - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. */ async get( localPath: string, @@ -1193,7 +1193,7 @@ export class Drive implements Contents.IDrive { * file is created. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. */ async newUntitled( options: Contents.ICreateOptions = {} @@ -1235,7 +1235,7 @@ export class Drive implements Contents.IDrive { * @returns A promise which resolves when the file is deleted. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents). + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents). */ async delete(localPath: string): Promise { const url = this._getUrl(localPath); @@ -1266,7 +1266,7 @@ export class Drive implements Contents.IDrive { * the file is renamed. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. */ async rename( oldLocalPath: string, @@ -1306,7 +1306,7 @@ export class Drive implements Contents.IDrive { * #### Notes * Ensure that `model.content` is populated for the file. * - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. */ async save( localPath: string, @@ -1347,7 +1347,7 @@ export class Drive implements Contents.IDrive { * #### Notes * The server will select the name of the copied file. * - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. */ async copy(fromFile: string, toDir: string): Promise { const settings = this.serverSettings; @@ -1380,7 +1380,7 @@ export class Drive implements Contents.IDrive { * checkpoint is created. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. */ async createCheckpoint( localPath: string @@ -1410,7 +1410,7 @@ export class Drive implements Contents.IDrive { * the file. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents) and validates the response model. */ async listCheckpoints( localPath: string @@ -1445,7 +1445,7 @@ export class Drive implements Contents.IDrive { * @returns A promise which resolves when the checkpoint is restored. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents). + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents). */ async restoreCheckpoint( localPath: string, @@ -1474,7 +1474,7 @@ export class Drive implements Contents.IDrive { * @returns A promise which resolves when the checkpoint is deleted. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents). + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents). */ async deleteCheckpoint( localPath: string, @@ -1549,7 +1549,7 @@ export namespace Drive { /** * A REST endpoint for drive requests. * If not given, defaults to the Jupyter - * REST API given by [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents). + * REST API given by [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/contents). */ apiEndpoint?: string; } diff --git a/packages/services/src/kernel/default.ts b/packages/services/src/kernel/default.ts index 7ce48b4b138b..925ec543ee5d 100644 --- a/packages/services/src/kernel/default.ts +++ b/packages/services/src/kernel/default.ts @@ -439,7 +439,7 @@ export class KernelConnection implements Kernel.IKernelConnection { * Interrupt a kernel. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels). + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels). * * The promise is fulfilled on a valid response and rejected otherwise. * @@ -460,7 +460,7 @@ export class KernelConnection implements Kernel.IKernelConnection { * Request a kernel restart. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) * and validates the response model. * * Any existing Future or Comm objects are cleared once the kernel has @@ -528,7 +528,7 @@ export class KernelConnection implements Kernel.IKernelConnection { * Shutdown a kernel. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels). + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels). * * The promise is fulfilled on a valid response and rejected otherwise. * diff --git a/packages/services/src/kernel/kernel.ts b/packages/services/src/kernel/kernel.ts index 2e4655f3f8de..abe443fa250a 100644 --- a/packages/services/src/kernel/kernel.ts +++ b/packages/services/src/kernel/kernel.ts @@ -175,7 +175,7 @@ export interface IKernelConnection extends IObservableDisposable { * @returns A promise that resolves when the kernel has interrupted. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels). + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels). * * The promise is fulfilled on a valid response and rejected otherwise. * @@ -192,7 +192,7 @@ export interface IKernelConnection extends IObservableDisposable { * @returns A promise that resolves when the kernel has restarted. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. * * Any existing Future or Comm objects are cleared. * diff --git a/packages/services/src/kernel/restapi.ts b/packages/services/src/kernel/restapi.ts index 01920fe94aa0..f2399cc1f3d8 100644 --- a/packages/services/src/kernel/restapi.ts +++ b/packages/services/src/kernel/restapi.ts @@ -9,7 +9,7 @@ import { validateModel, validateModels } from './validate'; * The kernel model provided by the server. * * #### Notes - * See the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels). + * See the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels). */ export interface IModel { /** @@ -62,7 +62,7 @@ export const KERNEL_SERVICE_URL = 'api/kernels'; * @returns A promise that resolves with the list of running kernels. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. * * The promise is fulfilled on a valid response and rejected otherwise. */ @@ -88,7 +88,7 @@ export async function listRunning( * @returns A promise that resolves with a kernel connection object. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. * * The promise is fulfilled on a valid response and rejected otherwise. */ @@ -120,7 +120,7 @@ export type IKernelOptions = Partial>; * Restart a kernel. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. * * The promise is fulfilled on a valid response (and thus after a restart) and rejected otherwise. */ @@ -149,7 +149,7 @@ export async function restartKernel( * Interrupt a kernel. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. * * The promise is fulfilled on a valid response and rejected otherwise. */ @@ -182,7 +182,7 @@ export async function interruptKernel( * * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. * * The promise is fulfilled on a valid response and rejected otherwise. */ @@ -210,7 +210,7 @@ export async function shutdownKernel( * Get a full kernel model from the server by kernel id string. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernels) and validates the response model. * * The promise is fulfilled on a valid response and rejected otherwise. */ diff --git a/packages/services/src/kernelspec/restapi.ts b/packages/services/src/kernelspec/restapi.ts index 169190f6e5ed..2e06a20f3c00 100644 --- a/packages/services/src/kernelspec/restapi.ts +++ b/packages/services/src/kernelspec/restapi.ts @@ -21,7 +21,7 @@ const KERNELSPEC_SERVICE_URL = 'api/kernelspecs'; * @returns A promise that resolves with the kernel specs. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernelspecs). + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernelspecs). */ export async function getSpecs( settings: ServerConnection.ISettings = ServerConnection.makeSettings() @@ -83,7 +83,7 @@ export interface ISpecModel extends PartialJSONObject { * The available kernelSpec models. * * #### Notes - * See the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernelspecs). + * See the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/kernelspecs). */ export interface ISpecModels extends PartialJSONObject { /** diff --git a/packages/services/src/session/default.ts b/packages/services/src/session/default.ts index 448ed71b42b1..05ffeb314043 100644 --- a/packages/services/src/session/default.ts +++ b/packages/services/src/session/default.ts @@ -290,7 +290,7 @@ export class SessionConnection implements Session.ISessionConnection { * @returns - The promise fulfilled on a valid response from the server. * * #### Notes - * Uses the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/sessions), and validates the response. + * Uses the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/sessions), and validates the response. * Disposes of the session and emits a [sessionDied] signal on success. */ async shutdown(): Promise { diff --git a/packages/services/src/session/session.ts b/packages/services/src/session/session.ts index 517894efbb2c..7a28f4b5498b 100644 --- a/packages/services/src/session/session.ts +++ b/packages/services/src/session/session.ts @@ -367,7 +367,7 @@ export interface IManager extends IDisposable { * The session model returned by the server. * * #### Notes - * See the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/sessions). + * See the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/sessions). */ export interface IModel { /** @@ -388,7 +388,7 @@ export interface IModel { * parameter is not technically required, but is often assumed to be nonempty, * so we require it too. * - * See the [Jupyter Notebook API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/sessions). + * See the [Jupyter Server API](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter-server/jupyter_server/main/jupyter_server/services/api/api.yaml#!/sessions). */ export type ISessionOptions = Pick & { kernel?: Partial>; diff --git a/yarn.lock b/yarn.lock index 0aad898cd3f5..0d6f633a8047 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11267,14 +11267,15 @@ __metadata: languageName: node linkType: hard -"es5-ext@npm:^0.10.35, es5-ext@npm:^0.10.46, es5-ext@npm:^0.10.50, es5-ext@npm:^0.10.53, es5-ext@npm:~0.10.14, es5-ext@npm:~0.10.2, es5-ext@npm:~0.10.46": - version: 0.10.62 - resolution: "es5-ext@npm:0.10.62" +"es5-ext@npm:^0.10.35, es5-ext@npm:^0.10.46, es5-ext@npm:^0.10.50, es5-ext@npm:^0.10.53, es5-ext@npm:^0.10.62, es5-ext@npm:~0.10.14, es5-ext@npm:~0.10.2, es5-ext@npm:~0.10.46": + version: 0.10.63 + resolution: "es5-ext@npm:0.10.63" dependencies: es6-iterator: ^2.0.3 es6-symbol: ^3.1.3 + esniff: ^2.0.1 next-tick: ^1.1.0 - checksum: 25f42f6068cfc6e393cf670bc5bba249132c5f5ec2dd0ed6e200e6274aca2fed8e9aec8a31c76031744c78ca283c57f0b41c7e737804c6328c7b8d3fbcba7983 + checksum: 3bf04d9bac12a14e716a0a00b1706f538a3211da82703babd3e907deaeadaa30eab71202785027058d44d2a7c0e92e34631fb03fa63ef1097191e88de5223fda languageName: node linkType: hard @@ -11528,6 +11529,18 @@ __metadata: languageName: node linkType: hard +"esniff@npm:^2.0.1": + version: 2.0.1 + resolution: "esniff@npm:2.0.1" + dependencies: + d: ^1.0.1 + es5-ext: ^0.10.62 + event-emitter: ^0.3.5 + type: ^2.7.2 + checksum: d814c0e5c39bce9925b2e65b6d8767af72c9b54f35a65f9f3d6e8c606dce9aebe35a9599d30f15b0807743f88689f445163cfb577a425de4fb8c3c5bc16710cc + languageName: node + linkType: hard + "espree@npm:^9.6.0, espree@npm:^9.6.1": version: 9.6.1 resolution: "espree@npm:9.6.1"