Skip to content

Make it possible for worker to query parent #51

Closed

Description

@basarat

Currently we only have

host ---query---> worker ---response---> host

Allow the worker to query to host. This is useful for stuff like notifications and even simple log debugging.

Activity

  1. added a commit that references this issue on Feb 5, 2015
  2. basarat commented on Feb 5, 2015

    @basarat
    MemberAuthor

    Just a word of caution : since we are using node on windows, and not io.js (which has built in Promise) like atom, Once I've promisified the host -> client code, we will need to use some Promise library for worker.

  3. changed the title [-]Make it possible to worker to query parent[/-] [+]Make it possible for worker to query parent[/+] on Feb 5, 2015
  4. added a commit that references this issue on Feb 5, 2015
  5. assigned and unassigned on Feb 23, 2015
  6. basarat commented on Feb 23, 2015

    @basarat
    MemberAuthor

    One use case we badly need it for is #110 So moving this to a higher priority.

    Use case 1

    When a child comes up it should query the parent about all the files it has open and their contents. This will make sure that the child (by default working on the file system) is never out of date from the server.
    Note: This can also be solved by the parent by just sending the data to the child.

    Use case 2

    The child is very aggressive about keeping its tsconfig up to date. This is great for new ts files, removed ts files, tsconfig changed. Currently child can only reload it all from the file system and cannot notify the parent that it would like in memory changes also. This will allow the child to query the parent for this information and we can be less aggressive about pushing the data to the child e.g. on active tab change.

    Use case 3

    Add message type for notifications. Useful for debugging

    Use case 4

    Add messages for files that are built. This will potentially require mid execution call-out from project.

  7. basarat commented on Feb 26, 2015

    @basarat
    MemberAuthor

    As soon as one thing is async. Everything is async. If we want true (query->response) within a function executing in the child we already need to make all our functions promise based.

  8. basarat commented on Feb 26, 2015

    @basarat
    MemberAuthor

    Its not strictly required, as our use cases not really need the child to stop midway before responding to the parent query. But being completely async at some point is a good idea to have at some point. So now that I've done the grunt work, I will commit it. However it does make it a bit hard for a newbie to understand the project. I apologize to that person. Nevertheless promises are something that every decent JS developer will eventually need to learn. I will do a separate iteration of making debugging easier + documentation.

  9. basarat commented on Feb 26, 2015

    @basarat
    MemberAuthor

    Plus I suspect it will help us if the language service ever becomes async microsoft/TypeScript#1857

  10. basarat commented on Feb 26, 2015

    @basarat
    MemberAuthor

    One issue to solve now is of cyclic references. child ---needs as a responder---> projecService ----needs to query ----> child. Doable, just needs more refactoring and thought.

  11. basarat commented on Feb 26, 2015

    @basarat
    MemberAuthor

    Note: 👍 on promisifying: Having the same signature Query -> Promise<Response> for the IPC / local versions of the functions means they can be swapped in and out of process quite easily

  12. locked and limited conversation to collaborators on Jan 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions