Bug 271265 - Web Inspector: Console code completion doesn't suggest variables unless inspector is re-opened
Summary: Web Inspector: Console code completion doesn't suggest variables unless inspe...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Qianlang Chen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-03-19 13:31 PDT by Qianlang Chen
Modified: 2024-04-09 12:32 PDT (History)
2 users (show)

See Also:


Attachments
Demo: suggestion of myVariable does not show up before re-open (2.79 MB, video/mp4)
2024-03-19 13:31 PDT, Qianlang Chen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Qianlang Chen 2024-03-19 13:31:22 PDT
Created attachment 470437 [details]
Demo: suggestion of myVariable does not show up before re-open

1. On fresh launch of Safari, open inspector's console
2. Run myVariable = 3
3. Type my
   => No suggestions show up
4. Close and re-open the inspector. Go to console
5. Type my
   => Suggestion "myVariable" now shows up

Expected behavior: myVariable should show up as a suggestion after step 3.

See attached video demo.
Comment 1 Radar WebKit Bug Importer 2024-03-19 13:31:41 PDT
<rdar://problem/125035133>
Comment 2 Qianlang Chen 2024-03-29 11:52:43 PDT
Similar to new variables created while the console is open not being suggested immediately, if you reload the page while the console is open, the old variables technically get cleared by are still included in the suggestions.

Try this:
   1. Open inspector's console
   2. Run
       myVariable = 3
   3. Close and reopen the inspector. Go to console
   4. Reload the page with the console still open
   5. Type my
      => See that myVariable is still being suggested, but if you follow the suggestion and run `myVariable`, you get a ReferenceError as expected

This is hinting at the console's suggestion list not being in sync with the code's state. (And it only fetches the up-to-date list of suggestion when inspector launches?)
Comment 3 EWS 2024-04-09 12:32:49 PDT
Committed 277261@main (5c6736f3f9ad): <https://commits.webkit.org/277261@main>

Reviewed commits have been landed. Closing PR #26632 and removing active labels.