Skip to content

Explore simple type flow analysis #2421

@vinistock

Description

@vinistock

By analyzing the flow of types in a program, we may be able to improve the accuracy for definition, hover, completion and signature help.

For example, understanding the type stored in a variable

something = Foo.new
something #=> something is an instance of Foo here

However, the Ruby LSP doesn't require a type system to provide features. We may discover that investing in type flow analysis without a type system actually doesn't provide much benefit (because most things would end up being untyped anyway).

Explore implementing simple type flow analysis:

  • Estimate the percentage of types we could understand better without a type system. This is limited to types discoverable without annotations:
    • Literals
    • Object instantiations (Object.new) only when self.new or self.allocate are not overridden
  • Investigate the phases to flow types in the analysis. Do we need to implement a CFG? Are there other options? Trade offs?

The output of this task is either the implemented flow analysis algorithm or an explanation of why it's not worth it without a type system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpinnedThis issue or pull request is pinned and won't be marked as staleserverThis pull request should be included in the server gem's release notes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions