eclipse-theia/theia

Issue: Incorrect editor.selection.isEmpty Behavior in Jupyter Notebooks

garyb9 opened this issue · 0 comments

Description:

When working with a Jupyter Notebook in Theia and using the vscode.window.activeTextEditor API to log editor.selection.isEmpty, the result is inconsistent with the behavior in VS Code. The isEmpty property incorrectly returns true in Theia for a non-empty selection, whereas in VS Code, it correctly returns false.

Steps to Reproduce:
1. Open a Jupyter Notebook in Theia.
2. Select two lines of text within a single cell.
3. Log the editor.selection.isEmpty property:

const editor = vscode.window.activeTextEditor;
console.log(`isEmpty: ${editor.selection.isEmpty}`);

Note - this only happens when selecting bottom to top

Expected Behavior (VS Code):

When selecting two lines in a cell, editor.selection.isEmpty should return false because the selection is not empty.

Observed Behavior (Theia):

For the same file and same selection, editor.selection.isEmpty incorrectly evaluates to true, even though there is a visible selection spanning multiple lines.

Reference this issue with the same setup:
#14475

Impact:

This inconsistency affects extensions or code relying on the editor.selection.isEmpty property for determining whether a selection exists in Jupyter notebooks. This can lead to incorrect functionality in scenarios that depend on non-empty selections.

Additional Context:

This issue appears specific to Jupyter notebooks and does not occur with standard text files. It might be related to how Theia handles notebook-specific editors versus standard text editors.

Request:

Please investigate this discrepancy and align the behavior of editor.selection.isEmpty in Jupyter notebooks with the expected behavior in VS Code.