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

Test: Improved notebook inline value fallback logic #241791

Open
2 tasks
Yoyokrazy opened this issue Feb 25, 2025 · 0 comments
Open
2 tasks

Test: Improved notebook inline value fallback logic #241791

Yoyokrazy opened this issue Feb 25, 2025 · 0 comments
Assignees
Milestone

Comments

@Yoyokrazy
Copy link
Contributor

Yoyokrazy commented Feb 25, 2025

Refs: #238912

Complexity: 3

author: @Yoyokrazy

Create Issue


Summary

Support for inline values was added for notebooks last iteration, using the setting notebook.inlineValues. When enabled, after a cell is executed, inline values will be displayed after the line, according to either any registered InlineValueProvider or the default fallback.

The fallback has now been improved to only show the last occurrences of a value, in order to reduce visual clutter and incorrect values. Additionally, variables within local functions will not be shown, as their value can't be obtained from the kernel following a cell's execution. This tpi is to test the fallback logic.

note: copilot edits support for notebooks has just been added, and we are looking for as much selfhosting as possible. Throughout this and other TPI's the notebook team would appreciate if you generated edits + notebooks as much as possible, before using pre made notebooks you already have. There are some rough edges, so don't feel the need to get stuck on this part.

Steps to Test:

Part 0:

  • Change the setting notebook.inlineValues explicitly to on. Setting this to auto will only run when a language provider for inline values is registered (ie pylance)
  • Ensure you have disabled the pylance extension, as they have a more intelligent provider that will always take priority with the setting in either enabled state.

Part 1:

  • Execute several cells with varying levels of variable reuse and scopes. Include classes, local functions, etc. Look for the following:
    • Ensure that there should only be inline values shown for the last occurrence of that variable.
    • Inline values should not be shown in local scopes, only variables at the global level will be caught in the kernel and therefore shown to the user.

As an example, see the following cell and the current vs old behavior.

current (improved) inline values:
Image

old ("dumb") regex matching:
Image

cell content

a = {'value': 5}

b = 'world'

c = 10

def local_fn():
    a = 5
    b = 100

    c = a + b

    return c


result = local_fn()

a['pie'] = 3.14

test = 'hello'

print(a)

local_fn()

Known Issues

  • dataframes may render with broken LF characeters (\n) and render with an excessive amount of whitespace (though the hover - another tpi - should show cleaner info now!)

Thanks for testing!

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

3 participants