Git Product home page Git Product logo

Comments (4)

Drazzzt avatar Drazzzt commented on June 1, 2024

(this is only the case if the calls are not selected (not blue))

from theseus.

alltom avatar alltom commented on June 1, 2024

I thought I'd fixed this really early on! Let me check it out and see what's regressed. Thanks for the report.

from theseus.

alltom avatar alltom commented on June 1, 2024

You're using Brackets 0.41, right?

from theseus.

alltom avatar alltom commented on June 1, 2024

I think I can reproduce the problem.

  1. Put this in foobar.js:

    setTimeout(foobar, 3000);
    
    // ... lots of blank lines ...
    
    function foobar() {}
  2. Open foobar.js in Brackets with Theseus.

  3. Run node-theseus foobar.js.

  4. Right away, scroll to the bottom in Brackets to see "0 calls" next to foobar(). Then immediately scroll up to the top.

  5. Wait 3 seconds.

  6. Scroll down to the definition of foobar().

Expected: it says "1 call" next to foobar().
Actual: it says "0 calls" next to foobar().

If you skip step 4, it says "1 call" as expected.

Diagnosis

CodeMirror removes those call count pills from the DOM for efficiency as you scroll around. When Theseus does a batch update of all the hit counts, it minimizes DOM access by only updating counts for the functions that have been called since the last update. But it also checks for pills that have been added back by CodeMirror to give them their most up-to-date value, even if the corresponding functions weren't called in the current batch.

It has to do that because it used to be that, when CodeMirror re-added a pill, it inserted the HTML that was originally used to create it, so any changes (such as updating the number and changing the style) were reversed. Theseus took advantage of that by adding an "uninitialized" class to that initial HTML, so it could find re-added pills by looking for nodes with the "uninitialized" class.

My theory is that the latest CodeMirror actually adds the original DOM node back (with all subsequent changes) instead of creating a new node with the original HTML. That explains why it works if you don't scroll far enough for the pill to be on the screen and have its "uninitialized" flag cleared, but doesn't work if you do scroll down.

If the theory is correct, then instead of looking up DOM nodes by ID to update them (which I only did because CodeMirror would destroy and recreate the nodes whenever it felt like it), Theseus can retain a pointer to the DOM nodes for the pills and update them directly, always.

Time to experiment!

from theseus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.