onivim / oni2

Native, lightweight modal code editor
https://v2.onivim.io
MIT License
7.76k stars 274 forks source link

Go to buffer symbol does not work for ruby files #3676

Open paul-louyot opened 3 years ago

paul-louyot commented 3 years ago

Detailed steps to reproduce the problem:

  1. git clone https://github.com/pry/pry.git
  2. oni2 pry/lib/pry/ring.rb
  3. Command Palette -> "Language Support: Go to buffer symbol"

What happened:

nothing happens

What should have happened:

I am prompted to select a symbol in the file (e.g a function definition)

Context:

I have installed the Ruby Language Basics extension

Here is what I have in my configuration.json

  "emmet.includeLanguages": {
    "erb": "html",
    "ruby": "erb",
    "javascript": "javascriptreact"
  },
bryphe commented 3 years ago

Hi @paul-louyot ,

It looks like the ruby-language-basics doesn't have language server features like go-to symbol by default. There are a couple other extensions needed to get a language server:

1) Install additional extensions

1) Install Ruby by rebornix:

Screen Shot 2021-06-19 at 10 47 23 AM

2) Install VSCode Ruby by wingrunr21:

Screen Shot 2021-06-19 at 10 48 31 AM

(These two extensions are needed to get the language server working)

3) Edit configuration (Command Palette -> "Preferences: Open configuration file") - add the following configuration entry:

"ruby.useLanguageServer": true

NOTE: More details here: https://open-vsx.org/extension/rebornix/ruby#using-the-language-server

4) Close Onivim, and run oni2 pry/lib/pry/ring.rb

You should now be able to get the symbols:

2021-06-19 10 52 34

LMK if these steps don't work for you.

paul-louyot commented 3 years ago

Thanks a lot @bryphe , it works well on my end.

Although, it does not work in an other (rails) project i'm working on. I will try to find a public repo where I can reproduce the problem. Should I add the information here or should I close the issue and open an other one?

bryphe commented 3 years ago

Thanks for the update @paul-louyot ! Progress at least :smile:

A public repro to reproduce on would be a huge help; feel free to add it here.

PaulFlatlooker commented 3 years ago

Hi @bryphe , yes that's progress already! I noticed the "go to definition" works as well now, which is really useful 👍🏻

Here is a couple of things I noticed:

I was actually able to have "Language Support: Go to buffer symbol" work as expected on some files. It looks like the file size matter: on a private rails repo, the feature worked as expected on file smaller than 3133 bytes, but not above that.

I think one thing that would be helpful to understand the cause of the problem would be access to debug information. Unfortunately, the debug informations seems not to work with the extensions you mentioned above.

Detailed steps to reproduce the problem:

What happened:

nothing happens

What should have happened:

I can see debug information

Configuration

in configuration.json:

  "ruby.intellisense": "rubyLocate",
  "ruby.useBundler": true,
  "ruby.useLanguageServer": true,

installed extensions:

❯ oni2 --list-extensions
wingrunr21.vscode-ruby
silvenon.mdx
vscode.scss
karunamurti.haml
octref.vetur
rebornix.ruby
wakatime.vscode-wakatime
PaulFlatlooker commented 3 years ago

I was also able to reproduce the "Go to buffer symbol" problem on a public ruby repo:

Detailed steps to reproduce the problem:

What happened:

nothing happens

What should have happened:

Onivim lists file symbols

Config: same as mentioned above