'Context is important, if task has note and belongs to projects, make em visible'

def add_projects_and_notes(self, task_regions):

    def add_note(region):
        next_line_begins = (region.end() + 1)
        while (self.view.scope_name(next_line_begins) == 'text.todo    notes.todo    '):
            note = self.view.line(next_line_begins)
            if (note not in task_regions):
                task_regions.append(note)
            next_line_begins = (self.view.line(next_line_begins).end() + 1)
    projects = [r for r in get_all_projects_and_separators(self.view) if (r.a < task_regions[(~ 0)].a)]
    for d in reversed(task_regions):
        add_note(d)
        for p in reversed(projects):
            project_block = self.view.indented_region((p.end() + 1))
            due_block = self.view.indented_region(d.begin())
            if all(((p not in task_regions), project_block.contains(due_block))):
                task_regions.append(p)
                add_note(p)
            if self.view.indented_region(p.begin()).empty():
                break
    task_regions.sort()
    return task_regions
