Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual document's skipInspect should be fixed and exposed (or removed) #15034

Open
krassowski opened this issue Aug 28, 2023 · 0 comments
Open

Comments

@krassowski
Copy link
Member

Description

There are some regions of a virtual document representing notebook which are not to be annotated with diagnostics. These include:

  • (a) empty lines added between cells
  • (b) regions of transclusions, as defined by overrides

When the LSP code was merged into this repository, the overrides were not, and skipInspect remained in partial form - implementing (a) but not (b). How it used to be in the extension (link):

let { lines, foreign_document_map, skip_inspect } = this.prepare_code_block(
  block,
  editor_shift
);

for (let i = 0; i < lines.length; i++) {
  this.virtual_lines.set(this.last_virtual_line + i, {
    skip_inspect: skip_inspect[i],   #  this line was modified
    editor: ce_editor,
    // TODO this is incorrect, wont work if something was extracted
    source_line: this.last_source_line + i
  });
}

How it is in core:

for (let i = 0; i < lines.length; i++) {
this.virtualLines.set(this.lastVirtualLine + i, {
skipInspect: [],
editor: ceEditor,
// TODO this is incorrect, wont work if something was extracted
sourceLine: this.lastSourceLine + i
});
}

Further, because virtualLines are protected it is not straightforward to access skipInspect.

Expected behavior

The logic allowing to pass skipInspect from prepareCodeBlock should be restored. virtualLines should stay protected, but skipInspect should be exposed, e.g.:

interface IVirtualDocument {
   isIgnoredPosition(position: VirtualPosition): boolean;
}

Alternatively this logic could be entirely removed, but it would be annoying having to re-implement this downstream.

Context

  • JupyterLab version: 4.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant