[go: nahoru, domu]

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

Support YARD directive comments #2181

Closed
1 task done
erickguan opened this issue Jun 13, 2024 · 2 comments
Closed
1 task done

Support YARD directive comments #2181

erickguan opened this issue Jun 13, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@erickguan
Copy link
erickguan commented Jun 13, 2024

I have checked that this feature is not already implemented

  • This feature does not exist

Use case

This is a feature request to improve Hover.

I would expect that I can see YARD formatted documentation about a function method in a class. This is particularly useful when I create ruby methods through metaprogramming. Currently, hovering on a method that is created dynamically would not show any information.

Code example:

# @!method foo(name, opts = {})
create_a_foo_method

As a side, Solargraph supports parsing YARD directives. And solargraph VS Code plugin shows defined function upon hovering.

Description

RubyLSP should parse YARD directives when parsing code documents.

Implementation

No response

@erickguan erickguan added the enhancement New feature or request label Jun 13, 2024
@vinistock
Copy link
Member

Thank you for the feature suggestion.

However, we will not add support for YARD annotations. There are multiple reasons for that

  1. We try to keep the Ruby LSP's concerns related only to Ruby itself. YARD is a separate gem and not every Ruby developer uses it
  2. When it comes to adding type annotations, a complete gradual type system like Sorbet or Steep yields significantly better results. They provide the ability to narrow types, widen types, use generics, interfaces, etc - things that are not possible to do with YARD annotations
  3. For handling declarations that occur via meta-programming, we are going to explore both options through our addon system and through RBS files. RBS is significantly more expressive and thus we will favour support for that for manually written annotations. And with the addon system we hope to provide APIs for other gems to teach the indexer how to handle their meta-programming DSLs

@vinistock vinistock closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2024
@erickguan
Copy link
Author

Thanks. Good to know the plans for Ruby LSP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants