Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show incoming edges in scope graph #87

Open
MeAmAnUsername opened this issue Feb 10, 2022 · 1 comment
Open

Show incoming edges in scope graph #87

MeAmAnUsername opened this issue Feb 10, 2022 · 1 comment

Comments

@MeAmAnUsername
Copy link
Contributor

Short description
Add a section 'incoming edges' in the scope graph. Rename the section 'edges' to 'outgoing edges'

Problem description.
Right now, it is easy to see the outgoing edges of a scope in the a .scopegraph file, but the incoming edges have to be derived by searching for that edge and scope, which is made particularly difficult due to the way Statix lays out multiple targets with the same edge.

Describe the solution you'd like
Instead of just edges, show incoming edges and outgoing edges in .scopegraph:

  #.-s_func_instantiated_125-26 {
    relations {
      statics/base!generic_arg : (GenericParameter(#src/main/test.pie-s_func_60-17, "F"), ?.-arg_ty-230)
    }
    outgoing edges {
      statics/base!P : #src/main/test.pie-s_func_inner_16-5
                       #src/main/test.pie-s_func_60-17
    }
    incoming edges {
      statics/base!INHERIT : #src/main/test.pie-s_func_inner_14-23
    }
  }

Describe alternatives you've considered

  1. Some kind of menu action that can be used when on the scope. Sounds awful but would work.
  2. Show references by CTRL+clicking the scope declaration (requires Navigation in Test Results #85). Has two problems: first, it shows every reference, not just incoming edges. More importantly, Eclipse uses menu actions to show references, not just CTRL+click on a declaration like IntelliJ.

Additional context
This feature would work very well in combination with #85. The combination of these two would allow more or less effortless following edges back and forth between scopes.

Additional ideas for sections

  • References: relations in other scopes that refer to this scope.
  • Queries that were started from this scope
  • Queries that resolved to this scope
  • Queries that pathed via this scope

Some of these might become big very quickly, so it is probably a good idea to make sections collapsible, with menu options like collapse all > {scopes, sections, relations > {all, own, references}, edges > {all, outgoing edges, incoming edges}, queries > {all, started, resolved, pathed}}

Example:

  #.-s_data_def_125-26 {
    relations {
      statics/base!generic_param : ("F", GenericParameter(#src/main/test.pie-s_data_def_125-26, "F"))
                                   ("T", GenericParameter(#src/main/test.pie-s_data_def_125-26, "T"))
    }
    references {
      statics/base!generic_arg : #src/main/test.pie-s_data_instance_16-5 : (GenericParameter(#src/main/test.pie-s_data_def_125-26, "F"), IntType())
                                                                           (GenericParameter(#src/main/test.pie-s_data_def_125-26, "T"), StrType())
                                 #src/main/test.pie-s_data_instance_24-9 : (GenericParameter(#src/main/test.pie-s_data_def_125-26, "F"), BoolType())
                                                                           (GenericParameter(#src/main/test.pie-s_data_def_125-26, "T"), DataType(#src/main/test.pie-s_data_instance_16-5))
    }
    outgoing edges {
      statics/base!P : #src/main/test.pie-s_func_inner_16-5
                       #src/main/test.pie-s_func_60-17
    }
    incoming edges {
      statics/base!INHERIT : #src/main/test.pie-s_data_instance_14-23
    }
    queries originating {
      query var { name' :- name' == "foo" } filter P min P in #.-s_data_def_125-26 |-> []
    }
    queries resolving {
      query data { name' :- name' == "Box" } filter P min P in #.-s_func_124-27 |-> [((<...too lazy to write out path...>), #.-s_data_def_125-26)]
    }
    queries traversing {
    }
  }
@AZWN
Copy link
Contributor

AZWN commented Apr 19, 2022

I like the idea's expressed in this issue, but have some questions regarding feasibility.

  • Collapsing is not supported (anymore) by Spoofax.
  • I'm afraid tho that tracing all queries that traverse a scope might be a too big memory overhead.

As I won't have time to implement this issue myself, I'll add an good-first-issue label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants