Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion atest/_libraries/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def page_contains_diagnostic(driver: WebDriver, selector, negate=False):
driver.execute_script(
"""
arguments[0].map(el => {
let diagnostic = el.cmView.mark.spec.diagnostic;
let view = el.cmView | el.cmTile;
let diagnostic = view.mark.spec.diagnostic;
el.title = diagnostic.message + " (" + diagnostic.source + ")";
});
""",
Expand Down
16 changes: 11 additions & 5 deletions atest/_resources/Keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ Enter Cell Editor
Wait Until Page Contains Element css:.jp-Cell:nth-child(${cell_nr}) .cm-focused
# clicking on line does not appear sufficient in CM6 (but still useful because it ensures we have it in view
Execute JavaScript
... var view = document.querySelector('.jp-Cell:nth-child(${cell_nr}) .cm-content').cmView.view;
... var cell = document.querySelector('.jp-Cell:nth-child(${cell_nr}) .cm-content');
... var view = (cell.cmView || cell.cmTile).view;
... var pos = view.state.doc.line(${line}).to;
... return view.dispatch({selection: {anchor: pos, head: pos}});

Expand All @@ -362,7 +363,8 @@ Place Cursor In Cell Editor At
[Arguments] ${cell_nr} ${line} ${character}
Enter Cell Editor ${cell_nr} ${line}
Execute JavaScript
... var view = document.querySelector('.jp-Cell:nth-child(${cell_nr}) .cm-content').cmView.view;
... var cell = document.querySelector('.jp-Cell:nth-child(${cell_nr}) .cm-content');
... var view = (cell.cmView || cell.cmTile).view;
... var pos = view.state.doc.line(${line}).from + ${character};
... return view.dispatch({selection: {anchor: pos, head: pos}});

Expand All @@ -374,7 +376,8 @@ Place Cursor In File Editor At
[Arguments] ${line} ${character}
Enter File Editor
Execute JavaScript
... var view = document.querySelector('.jp-FileEditor .cm-content').cmView.view;
... var editor = document.querySelector('.jp-FileEditor .cm-content');
... var view = (editor.cmView || editor.cmTile).view;
... var pos = view.state.doc.line(${line}).from + ${character};
... return view.dispatch({selection: {anchor: pos, head: pos}});

Expand Down Expand Up @@ -429,7 +432,8 @@ Set Editor Content
[Arguments] ${text} ${css}=${EMPTY}
Wait Until Page Contains Element css:${css} .cm-content
Execute JavaScript
... let view = document.querySelector('${css} .cm-content').cmView.view;
... var editor = document.querySelector('${css} .cm-content');
... var view = (editor.cmView || editor.cmTile).view;
... view.dispatch({
... changes: {from: 0, to: view.state.doc.length, insert: `${text}`}
... });
Expand All @@ -438,7 +442,9 @@ Get Editor Content
[Arguments] ${css}=${EMPTY}
Wait Until Page Contains Element css:${css} .cm-content
${content} = Execute JavaScript
... return document.querySelector('${css} .cm-content').cmView.view.state.doc.toString()
... var editor = document.querySelector('${css} .cm-content');
... var view = (editor.cmView || editor.cmTile).view;
... return view.state.doc.toString()
RETURN ${content}

Configure JupyterLab Plugin
Expand Down
4 changes: 2 additions & 2 deletions packages/jupyterlab-lsp/src/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { EditorView } from '@codemirror/view';
import { EditorView } from '@codemirror/view';
import { JupyterFrontEnd } from '@jupyterlab/application';
import { CodeEditor } from '@jupyterlab/codeeditor';
import type { CodeMirrorEditor } from '@jupyterlab/codemirror';
Expand Down Expand Up @@ -231,7 +231,7 @@ export class ContextAssembler {
if (!cmContent) {
return;
}
const cmView = (cmContent as any)?.cmView?.view as EditorView | undefined;
const cmView = EditorView.findFromDOM(cmContent as HTMLElement);

if (!cmView) {
return;
Expand Down
Loading