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

Add support for folding defs #10

Merged
merged 5 commits into from Mar 24, 2022
Merged

Add support for folding defs #10

merged 5 commits into from Mar 24, 2022

Conversation

RyanBrushett
Copy link
Contributor

@RyanBrushett RyanBrushett commented Mar 19, 2022

Add support for handling file contents and folding method definitions.

Implementation

  • Add support for document opened, changed and closed events. We need those for every request. We basically keep a hash as storage where the key is the file URI and the value is the content of that file. Most other requests will only send us the URI and so we just access the hash to get the file contents
  • Add basic support for folding method definitions

Tophat

  1. Switch to this branch, bundle install
  2. In vscode-ruby-lsp, click F5 to start running the extension in debug mode
  3. On the extension debug window, open the ruby-lsp project itself
  4. Verify that you can fold method definitions and collapse them into a single line

Copy link
Contributor Author

@RyanBrushett RyanBrushett left a comment

Choose a reason for hiding this comment

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

Not hella sure on the file structure. Could be a lot different of course.

lib/ruby/lsp/handler.rb Outdated Show resolved Hide resolved
lib/ruby/lsp/handler.rb Outdated Show resolved Hide resolved
lib/ruby/lsp/requests/folding_ranges.rb Show resolved Hide resolved
@vinistock vinistock force-pushed the ryanb-code-folding branch 2 times, most recently from a0c892a to 822b7bf Compare March 23, 2022 14:34
@vinistock
Copy link
Member

In the latest commit, I just refactored to use the language server gem's implementation of the folding ranges interface. We were re-defining it ourselves, which isn't necessary.

@vinistock vinistock merged commit bf41027 into main Mar 24, 2022
@vinistock vinistock deleted the ryanb-code-folding branch March 24, 2022 13:16
bjarosze pushed a commit to bjarosze/ruby-lsp that referenced this pull request Mar 8, 2024
…opify/eslint-plugin-41.2.0

Bump @shopify/eslint-plugin from 41.1.0 to 41.2.0
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.

None yet

3 participants