zed-extensions / ruby

Other
7 stars 3 forks source link

Jump to definition not working for ActiveModel::SecurePassword.has_secure_password #10

Open jer-k opened 3 weeks ago

jer-k commented 3 weeks ago

Summary

Jump to definition for ActiveModel::SecurePassword.has_secure_password does not seem to be working. I thought it might have been all gems, but jump to definition is working on has_many for example.

Info

I just made a new project as a reproduction, it can be found here https://github.com/jer-k/zed-ruby-lsp

The steps I used to initialize the project were

$ rails new zed-ruby-lsp
$ cd zed-ruby-lsp
$ rails generate authentication

This uses the new Rails 8 authentication generator to create the User class and add the has_secure_password directive. The exact line is here https://github.com/jer-k/zed-ruby-lsp/blob/main/app/models/user.rb#L2.

The documentation for the directive is here https://edgeapi.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html.

Some other general info

zed-ruby-lsp % asdf current
ruby            3.3.5           /Users/jeremykreutzbender/.tool-versions

zed-ruby-lsp % gem which ruby-lsp
/Users/jeremykreutzbender/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.21.2/lib/ruby-lsp.rb

zed-ruby-lsp % gem which rails
/Users/jeremykreutzbender/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/railties-8.0.0.rc2/lib/rails.rb

When I do a cmd+click on has_secure_password I get this

image

Where as when I do a cmd+click on has_many, I get

image

And on Intellij IDEA, a cmd+click on has_secure_password takes me here

image

Final bit of info is my Zed settings

image
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
  "assistant": {
    "default_model": {
      "provider": "zed.dev",
      "model": "claude-3-5-sonnet-latest"
    },
    "version": "2"
  },
  "base_keymap": "JetBrains",
  "theme": "Solarized Dark",
  "ui_font_size": 16,
  "buffer_font_size": 16,
  "preferred_line_length": 125,
  "autosave": "on_focus_change",
  "indent_guides": {
    "enabled": true,
    "coloring": "indent_aware"
  },
  "lsp": {
    "ruby-lsp": {
      "initialization_options": {
        "diagnostics": false,
        "formatting": false
      }
    }
  },
  "languages": {
    "TypeScript": {
      "language_servers": ["typescript-language-server", "biome", "!vtsls"],
      "formatter": {
        "language_server": {
          "name": "biome"
        }
      },
      "code_actions_on_format": {
        "source.fixAll.biome": true,
        "source.organizeImports.biome": true
      }
    },
    "TSX": {
      "language_servers": ["typescript-language-server", "biome", "!vtsls"],
      "formatter": {
        "language_server": {
          "name": "biome"
        }
      },
      "code_actions_on_format": {
        "source.fixAll.biome": true,
        "source.organizeImports.biome": true
      }
    },
    "Ruby": {
      "language_servers": ["ruby-lsp", "!solargraph", "!rubocop"]
    }
  }
}
vitallium commented 3 weeks ago

This happens because Zed fallbacks to FindAllReferences if GoToDefinition failed to navigate - https://github.com/zed-industries/zed/pull/9243

jer-k commented 2 weeks ago

This happens because Zed fallbacks to FindAllReferences if GoToDefinition failed to navigate - zed-industries/zed#9243

Does this mean it is a ruby-lsp issue? Should I open an issue over there?