Skip to content

Conversation

vinistock
Copy link
Member

Motivation

Closes #113

Use the fully qualified names for constants and modules when displaying document symbols. In relation to the alternative way of solving this issue (displaying the values nested), I think this provides a better experience as it follows the flow of the file.

Implementation

Created a helper method to find the fully qualified name of a ClassDeclaration or ModuleDeclaration node. This recursively steps through each parent and builds the complete name.

Automated Tests

Added a new fixture based on the example.

Manual Tests

  1. Open the LSP on this branch
  2. Open the fixture test/fixtures/one_line_nesting.rb
  3. Look at the file outline on the bottom left of VS Code
  4. Verify that all classes/modules are using fully qualified names

@vinistock vinistock requested a review from a team June 9, 2022 19:56
@vinistock vinistock self-assigned this Jun 9, 2022
Copy link
Member

@paracycle paracycle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you for fixing this. I have just one test addition suggestion.

@vinistock vinistock force-pushed the vs/use_fully_qualified_names_in_document_symbols branch from e22a532 to 5fee78f Compare June 10, 2022 14:03
@vinistock vinistock merged commit 0abd749 into main Jun 10, 2022
@vinistock vinistock deleted the vs/use_fully_qualified_names_in_document_symbols branch June 10, 2022 14:06
klaaspieter pushed a commit to klaaspieter/ruby-lsp that referenced this pull request Feb 25, 2025
…p-minitest-0.31.1

Bump rubocop-minitest from 0.31.0 to 0.31.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document outline is not correct for documents that declare single line class/modules
3 participants