Skip to content

Don't include comments in the context window #361

@nogweii

Description

@nogweii

Description

At least in Ruby, I like to have larger, multi-line explanatory comments. That's great and all, but when I scroll down, the entire block is stuck with the class/function and fills up a lot of the screen.

sample.rb

class Sample
  # Lorem ipsum suscipit velit reiciendis ex aliquid sed. Et qui amet aspernatur
  # voluptatem iusto atque quo. Cumque itaque aut pariatur adipisci est eius et.
  # Ratione laborum eos mollitia tenetur laboriosam sed. Blanditiis excepturi
  # dolores magni et qui non aut doloremque. Et sequi distinctio ut et alias.
  # i don't know what this code is, I just started typing things
  def do_a_thing(a, b)
    a.join(' ').split(/./).each do |char|
      case char
      when 'a'..'z'
        b.upcase
      when 'A'..'Z'
        b.upcase
      when '0'..'9'
        -1 * b.to_i
      else
        b + b
      end
    end
  end
end

Neovim version

v0.9.4 on Arch Linux

Expected behavior

Only the class and def lines are shown, and the comment hidden from the context popup.

Actual behavior

The comment is included, in full, and obscures a large part of the editor's screen.

Minimal config

local plugins = {
  ts         = 'https://github.com/nvim-treesitter/nvim-treesitter',
  ts_context = 'https://github.com/nvim-treesitter/nvim-treesitter-context',
  -- ADD ADDITIONAL PLUGINS THAT ARE _NECESSARY_ TO REPRODUCE THE ISSUE
}

for name, url in pairs(plugins) do
  local install_path = '/tmp/nvim/site/'..name
  if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system { 'git', 'clone', '--depth=1', url, install_path }
  end
  vim.o.runtimepath = install_path..','..vim.o.runtimepath
end

Steps to reproduce

  1. Have a terminal that's shorter than usual, like only 15 or 20 lines tall.
  2. nvim --clean -u minimal.lua sample.rb
  3. Scroll down some

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions