Skip to content

Add hover documentation for reserved keywords #3553

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

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

mikeygough
Copy link
Contributor

@mikeygough mikeygough commented May 28, 2025

Partially closes #2227

This PR adds hover documentation for the following Ruby reserved keywords:

  • break
  • case
  • class
  • def
  • defined?
  • else
  • ensure
  • for
  • module
  • next
  • rescue
  • return
  • undef
  • unless
  • until
  • when
  • while
ruby-keyword-hover-documentation-demo.mov

This documentation was written by AI following Shopify's Ruby style guide. It has been reviewed by myself but would appreciate additional, more experienced eyes!

NOTE - The following keywords still need definitions which may require modifying their associated Prism Node:

  • alias
  • and
  • begin
  • do
  • elsif
  • end
  • false
  • if
  • in
  • nill
  • not
  • or
  • redo
  • retry
  • self
  • super
  • then
  • true

Motivation

We can deliver a better Ruby programming experience if developers can hover over built-in keywords to learn more about how they work!

Implementation

This implementation follows a pattern established by the yield keyword. It adds a key value pair to the KEYWORD_DOCS' hash inside static_docs.rb, writes a keyword specific markdown file that goes into a deeper explanation and extends hover.rb` to handle keyword specific hover events.

Automated Tests

Run dev t

Manual Tests

Start the Ruby LSP. Use some keywords and checkout the tooltips + related documentation!

Copy link

graphite-app bot commented May 28, 2025

How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@mikeygough mikeygough added enhancement New feature or request server This pull request should be included in the server gem's release notes labels May 28, 2025
@mikeygough mikeygough self-assigned this May 28, 2025
@mikeygough mikeygough marked this pull request as ready for review May 29, 2025 01:54
@mikeygough mikeygough requested a review from a team as a code owner May 29, 2025 01:54
@mikeygough mikeygough force-pushed the add-hover-documentation-for-keywords branch 3 times, most recently from adb884e to 0acb5f9 Compare May 29, 2025 02:45
@mikeygough mikeygough force-pushed the add-hover-documentation-for-keywords branch from 3ae4d4c to ab082e3 Compare May 29, 2025 15:22
@mikeygough mikeygough changed the title Add hover documentation for reserved keyword Add hover documentation for reserved keywords May 29, 2025
@mikeygough mikeygough force-pushed the add-hover-documentation-for-keywords branch from ab082e3 to aaa27d3 Compare May 29, 2025 17:32
@mikeygough mikeygough force-pushed the add-hover-documentation-for-keywords branch from aaa27d3 to ae11a22 Compare May 29, 2025 17:35
@mikeygough mikeygough force-pushed the add-hover-documentation-for-keywords branch 2 times, most recently from f0d252e to cd2f5bc Compare May 29, 2025 18:36
@mikeygough mikeygough force-pushed the add-hover-documentation-for-keywords branch from cd2f5bc to 847ba97 Compare May 29, 2025 18:43
@mikeygough mikeygough force-pushed the add-hover-documentation-for-keywords branch from a9f9809 to c7d8d1e Compare May 29, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hover Definitions for Ruby Keywords
2 participants