editor_opener 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d7652583a50398a131c7f55eb47307dc5aec0a521d3663462e37345afc3e206
4
- data.tar.gz: 2428aeee0b984176fddfd3c1307039be50d38296725990384f8465a18a578d6a
3
+ metadata.gz: 1cfef991d8d0bc6a17c4d34462f2c48a2e10053396b88b0f93ca6bee77b89d32
4
+ data.tar.gz: b99da146b7413702fb16be1f90c30bacf9609879afa75ebc17793eeb2fb4e7ba
5
5
  SHA512:
6
- metadata.gz: 59d2f5d010666fe3b600e87fbb044d14850abd6b7a71673ff8672398040e389f90d9c844022f41683fa2fca18303823e346dc478d9a48ad20416589419efe709
7
- data.tar.gz: 29be85c61c83125543cb25c3a2348c6ae94597118e5f3cb97244c0e91ecff11b7d1659df7f125fb4c2d4fb80a42e3a36506b3057b57e994b81c8257266d54f97
6
+ metadata.gz: '0339245f76e84ff7720cd0c6cf7662e4f91220a316a686cb8baf0c944c80b0cc2019a9e916a9ea3ac0d51433afcb8cda37ca8c445a70c8be0870abbb1b53ee76'
7
+ data.tar.gz: 0332a6abb0cae9929840e4c0a4d6030dfe211eead497b5cab90aec288461a9b31dd7b323cb920609030aa00579e5ed7c6195924a79bbf61c22a6387c1702f4b1
data/README.md CHANGED
@@ -6,11 +6,12 @@ Open source files in your editor directly from Rails error pages. This gem adds
6
6
 
7
7
  ## Features
8
8
 
9
+ - 🔥 **Works with Rails 7.1+**
9
10
  - 🔗 **Clickable file links** in Rails error pages
10
11
  - 📝 **Multiple editor support** - Works with 13+ popular editors
11
12
  - 🎯 **Precise line targeting** - Opens files at the exact error line
12
13
  - 🔧 **Easy configuration** - Set via initializer or environment variable
13
- - 🚀 **Zero configuration** - Works out of the box with `EDITOR` environment variable
14
+ - 🚀 **Zero configuration** - Works out of the box with `EDITOR` or `RAILS_EDITOR` environment variable
14
15
  - 📱 **Custom URL schemes** - Uses editor-specific protocols for seamless integration
15
16
 
16
17
  ## Installation
@@ -48,12 +49,15 @@ end
48
49
 
49
50
  ### Option 2: Environment variable
50
51
 
51
- Set the `EDITOR` environment variable:
52
+ Set the `EDITOR` or `RAILS_EDITOR` environment variable:
52
53
 
53
54
  ```bash
54
55
  export EDITOR=cursor # for Cursor
55
56
  export EDITOR=atom # for Atom
56
57
  export EDITOR=subl # for Sublime Text
58
+ export RAILS_EDITOR=cursor # for Cursor
59
+ export RAILS_EDITOR=atom # for Atom
60
+ export RAILS_EDITOR=subl # for Sublime Text
57
61
  ```
58
62
 
59
63
  ## Usage
@@ -104,9 +108,13 @@ end
104
108
  ```bash
105
109
  # In your shell profile (~/.bashrc, ~/.zshrc, etc.)
106
110
  export EDITOR=cursor
111
+ # or
112
+ export RAILS_EDITOR=cursor
107
113
 
108
114
  # Or in your .env file (if using dotenv)
109
115
  EDITOR=cursor
116
+ # or
117
+ RAILS_EDITOR=cursor
110
118
  ```
111
119
 
112
120
  ### Multiple Environments
@@ -172,7 +180,26 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/igorka
172
180
 
173
181
  ## TODO
174
182
 
175
- - verify it works with old Rails versions
183
+ - verify it works with old Rails versions (test with 7.1.0 and it works, for older versions it doesn't work)
184
+ possible fix:
185
+ ```ruby
186
+ # in railtie.rb
187
+ if defined?(ActionDispatch::DebugView::RESCUES_TEMPLATE_PATHS)
188
+ ActionDispatch::DebugView::RESCUES_TEMPLATE_PATHS.unshift(path)
189
+ else
190
+ module X
191
+ def initialize(assigns)
192
+ paths = [RESCUES_TEMPLATE_PATH]
193
+ lookup_context = ActionView::LookupContext.new(paths, path)
194
+ super(lookup_context, assigns, nil)
195
+ end
196
+ end
197
+
198
+ ActionDispatch::DebugView.prepend(X)
199
+ ```
200
+ But something is wrong in the views. Maybe we need to support older views, and create a new copy of them?
201
+ Also, you don't see the full exception, maybe this setting `config.action_dispatch.show_exceptions` can help, or capture exception with begin/rescue and print in the console?
202
+
176
203
  - more tests
177
204
  - support for more error pages?
178
205
  - support for more editors
@@ -16,12 +16,8 @@
16
16
  <% trace.each do |frame| %>
17
17
  <div class="trace">
18
18
  <% file_url = ActionDispatch::TraceToFileExtractor.open_in_editor? && ActionDispatch::TraceToFileExtractor.new(frame[:trace]).call %>
19
- <% if file_url.present? %>
20
- <a href="<%= file_url %>" class="edit-icon">
21
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
22
- <path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
23
- </svg>
24
- </a>
19
+ <% if file_url %>
20
+ <%= link_to("✏️", file_url, class: "edit-icon") %>
25
21
  <% end %>
26
22
  <a class="trace-frames trace-frames-<%= error_index %>" data-exception-object-id="<%= frame[:exception_object_id] %>" data-frame-id="<%= frame[:id] %>" href="#">
27
23
  <%= frame[:trace] %>
@@ -67,10 +67,15 @@
67
67
  .edit-icon {
68
68
  width: 16px;
69
69
  height: 16px;
70
+ font-size: 13px;
70
71
  display: flex;
71
72
  align-items: center;
72
73
  justify-content: center;
73
- color: #A0A0A0;
74
+ text-decoration: none;
75
+ }
76
+
77
+ .edit-icon:hover {
78
+ scale: 1.05;
74
79
  }
75
80
 
76
81
  .edit-line-link {
@@ -18,7 +18,8 @@ module ActionDispatch
18
18
  { symbols: [ :windsurf ], sniff: /windsurf/i, url: "windsurf://file/%{file}:%{line}" },
19
19
  { symbols: [ :zed ], sniff: /zed/i, url: "zed://file/%{file}:%{line}" },
20
20
  { symbols: [ :nova ], sniff: /nova/i, url: "nova://open?path=%{file}&line=%{line}" },
21
- { symbols: [ :cursor ], sniff: /cursor/i, url: "cursor://file/%{file}:%{line}" }
21
+ { symbols: [ :cursor ], sniff: /cursor/i, url: "cursor://file/%{file}:%{line}" },
22
+ { symbols: [ :kiro ], sniff: /kiro/i, url: "kiro://file/%{file}:%{line}" }
22
23
  ]
23
24
 
24
25
  class << self
@@ -33,7 +34,7 @@ module ActionDispatch
33
34
  private
34
35
 
35
36
  def potential_editor
36
- EditorOpener.editor || ENV["EDITOR"]
37
+ EditorOpener.editor || ENV["RAILS_EDITOR"] || ENV["EDITOR"]
37
38
  end
38
39
  end
39
40
 
@@ -1,3 +1,3 @@
1
1
  module EditorOpener
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -5,7 +5,7 @@
5
5
  EditorOpener.setup do |config|
6
6
  # Set your preferred editor
7
7
  # You can use any of the supported editors listed below:
8
- # config.editor = :cursor
8
+ # config.editor = ENV["RAILS_EDITOR"] || ENV["EDITOR"] || :cursor
9
9
 
10
10
  # Alternatively, you can set the EDITOR environment variable
11
11
  # export EDITOR=cursor
@@ -40,4 +40,4 @@ EditorOpener.setup do |config|
40
40
  # config.editor = :rubymine # For RubyMine
41
41
  # config.editor = :cursor # For Cursor
42
42
  # config.editor = :zed # For Zed
43
- end
43
+ end if defined?(EditorOpener)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: editor_opener
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-07-03 00:00:00.000000000 Z
10
+ date: 2025-07-16 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails