GithubHelp home page GithubHelp logo

Comments (4)

nickclaw avatar nickclaw commented on June 23, 2024

Hi @tvooo,

Thanks a lot for the great feedback! I'm currently in the middle of finals week, so I won't be adding anything for the next couple days, but your method of finding all tasks and subtasks is exactly what I was looking for!

Could you explain how your Sublime extension used cacheing? Were you originally running Grunt every time a user wanted to see the list of available tasks? Currently my extension parses the Gruntfile file once on startup in a totally separate process, which helps keep the extension load time in the 10s of milliseconds. The process returns a list of tasks after it has been completed, which is saved and used whenever a user pulls up the task list.

The one downside of that is that currently any tasks added to the Gruntfile aren't found until the Atom window is reloaded. The solution for that is probably to watch the file for changes, and get the tasks after each change.

Thanks, Nick

from atom-grunt-runner.

tvooo avatar tvooo commented on June 23, 2024

Hi Nick,

yeah, the problem with ST is that it runs on Python. Parsing the Gruntfile wasn't an option. So instead, we "inject" a task called expose into grunt. In the beginning, we would spawn the grunt process with injected expose task from Python, which would output the task list as JSON that we could read from stdout.
Ergo: yes, we ran this task everytime the user wanted to see the list of tasks.

By now, the expose task creates a cache file with the JSON-encoded task list. This cache file also includes a hash of the Gruntfile. That way, we only have to read the cache file, compare the hash to the one of the Gruntfile and show the tasks. Much quicker. Of course, if the hashes don't match (i.e. the Gruntfile was changed) we run the expose task before.

You could work with the same technique, an md5 hash should be fine. Just save it internally, and check if the hash changed everytime you display tasks. Should still be really quick, and the list of tasks would be up to date any time.

Good luck with your finals!

from atom-grunt-runner.

nickclaw avatar nickclaw commented on June 23, 2024

That makes sense, I think I'll try to see if I can somehow watch the file for changes. Either through an Atom API like TextBuffers' events, or through a node module. That way I can preemptively parse the Gruntfile when it changes, instead of only realizing that it's changed when I need the tasks.

That should mean a little better UX, at the expense of an extra process running the whole time.

from atom-grunt-runner.

tvooo avatar tvooo commented on June 23, 2024

Maybe you can hook a function into the Atom API that gets called when files change. I can imagine that they have a mechanism for that. This way, you wouldn't have to poll all the time and the footprint would be minimal.

from atom-grunt-runner.

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.