SmiteshP / nvim-navbuddy

A simple popup display that provides breadcrumbs feature using LSP server
Apache License 2.0
770 stars 30 forks source link

Possible to work within code blocks? #43

Closed zcag closed 1 year ago

zcag commented 1 year ago

In Ruby Rspec it's very common to use code blocks to define chunks when defining specs. Something like this:

RSpec.describe Some::Class do
  describe '.build' do
    # set some vars
    context 'some context' do
      # more vars
      it 'a spec' do
        # spec definition
      end

      it 'another spec' do
        # spec definition
      end
    end

    context 'another context' do
      # ...
    end
  end

  describe '.call' do
    # ...
    # ...
  end
# it goes like this
end

I don't see anything in the navbuddy window since there are no class and method definitions. My main hope when getting this plugin was that i would stop getting lost mainly in these kind of long spec files. Is it possible to include these kind of nested block definitions in the nav window?

SmiteshP commented 1 year ago

Navbuddy itself doesn't parse the code, it just gets the data from lsp for which symbols are present in the file. You could try alternate language servers for ruby to see if they can provide this data, or maybe open an issue in the language server's repo.

zcag commented 1 year ago

You're right, for a moment i was thinking of treesitter nodes instead of lsp symbols. Just double checked and solargraph deosn't list code blocks as symbols. Only other lsp for ruby is `ruby-ls' which is not in a usable state for me. Maybe i need use a plugin which shows context through treesitter..

But thanks for the answer, and for the great plugin!