BaseSecrete / rorvswild

Performances & exceptions monitoring for Ruby on Rails applications
https://www.rorvswild.com
MIT License
336 stars 9 forks source link

Add links to source code files #26

Closed ledermann closed 9 months ago

ledermann commented 10 months ago

How about making the source files listed in the breakdown dialog clickable? I would like to open the file in my editor with a singe click.

For VS Code, one can use links like this: vscode://file/{full path to file}:line:column

Docs here: https://code.visualstudio.com/docs/editor/command-line#_opening-vs-code-with-urls

alexisbernard commented 10 months ago

That could be a nice improvement. I just have to figure out how to support few other editors.

alexisbernard commented 10 months ago

Hi @ledermann,

That is more pleasant than expected to open files directly from the browser. Before releasing a new version, I would like to be sure it works on someone else environment.

Install this specific version :

# Gemfile
gem "rorvswild", git: "https://github.com/BaseSecrete/rorvswild.git", ref: "3347974b3ca9b2a43198bb1d70481b2011cc1155"

RorVsWild has to know the URL pattern which is different among text editors :

# config/rorvswild.yml
development:
  editor_url: "vscode://file${path}:${line}"
  # editor_url: "subl://${path}:${line}"

Let me know.

ledermann commented 10 months ago

Thanks for implementing this! With VS Code, it works like a charm.

A small note: Perhaps it would be better to underline the link. Otherwise, you cannot recognize that it is a link at all. I first put the .yml file in the wrong folder and was surprised that it didn't work. Then, in the right folder, it still looked the same - but it was now correctly a link.

And one more thing: If developers using different editors are working on a project, it is problematic if the editor_url setting is in a file that is checked into the repo. A possible solution would be to use not only config/rorvswild.yml, but also something like ~/.rorvswild.yml.

alexisbernard commented 10 months ago

If developers using different editors are working on a project

Good point. A workaround could be to use an environment variable.

config/rorvswild.yml
development:
  editor_url: <%= ENV["EDITOR_URL"] %>

But I am not very happy with it. I still have to think about it.

alexisbernard commented 9 months ago

Finally, I didn't find better a way than an env var and I prefer to avoid having multiple config files.

I like this feature a lot, and I will try to implement it even in production mode.

ledermann commented 9 months ago

Yes, the use of an ENV variable is sufficient. With the following configuration, you can set a default and only the developer who uses a different editor has to set the variable:

# config/rorvswild.yml
development:
  editor_url: <%= ENV.fetch("EDITOR_URL", "vscode://file${path}:${line}") %>
alexisbernard commented 9 months ago

The version 1.6.4 has been released.