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

table of contents won't show async function #16352

Closed
j-carson opened this issue May 21, 2024 · 4 comments · Fixed by #16443
Closed

table of contents won't show async function #16352

j-carson opened this issue May 21, 2024 · 4 comments · Fixed by #16443

Comments

@j-carson
Copy link

Description

When opening the table of contents widget for a .py file, only the non-async functions are bookmarked

Reproduce

  1. Create a .py file with an async function
  2. Open the table of contents widget
  3. Function is not there
    screenshot

Expected behavior

Table of contents shows all my functions

Context

  • Operating System and version: Linux Ubuntu 20.04
  • Browser and version: Firefox 126
  • JupyterLab version: 4.2.0

Let me know if you really need all those details and I will try again

  • I tried to save them and github would not accept them because there were too many characters
Browser Output
TypeError: i is undefined
    getHover hover.ts:321
    factory jlab_core.b91074b1e57242ddcd31.js:1
    _execute jlab_core.b91074b1e57242ddcd31.js:1
    o jlab_core.b91074b1e57242ddcd31.js:1
@j-carson j-carson added the bug label May 21, 2024
@jupyterlab-probot jupyterlab-probot bot added the status:Needs Triage Applied to new issues that need triage label May 21, 2024
@krassowski
Copy link
Member

Thank you for reporting! To solve it this regular expression needs to be updated:

KEYWORDS = new RegExp('^\\s*(class |def |from |import )', 'd');
} catch {
KEYWORDS = new RegExp('^\\s*(class |def |from |import )');

and we will also need a new test case (or a few) in:

describe('#getHeadings', () => {
it.each<[string, IEditorHeading[]]>([
['', []],
['a = 2', []],
[
'def f(a, b):',
[
{
text: 'def f(a, b):',
level: 1,
line: 0
}
]
],

@krassowski krassowski added good first issue and removed status:Needs Triage Applied to new issues that need triage labels May 22, 2024
@Kunalpal216
Copy link

Is this issue open ? I would like to work on this.

@krassowski
Copy link
Member

@Kunalpal216 please do!

@fcollonval
Copy link
Member

Fixed by #16443

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

Successfully merging a pull request may close this issue.

4 participants