Skip to content

Include comments when dispatching listener events #2054

Open
@vinistock

Description

@vinistock

There are scenarios where addons might need to have access to comments that are close to nodes they are interested in.

For example, for RBS inline annotations, an addon could provide completion, go to definition, hover and semantic highlighting. But currently, the listeners cannot receive any comments content, because the comments are separate from the AST in Prism's parse result.

I believe the easiest way to provide this functionality to listeners might be to create a custom dispatcher that stores the comment information and passes that along to listeners in a way that allows them to easily access it.

Scenario: imagine proper highlighting and the ability to navigate through constants in these inline RBS annotations.

class Foo
  attr_reader :name # ::String

  # :: (String, Integer?) -> void
  def bar(a, b)
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    addonsTasks related to Ruby LSP addonsenhancementNew feature or requestpinnedThis issue or pull request is pinned and won't be marked as stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions