editor_opener 0.1.2 → 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 +4 -4
- data/README.md +9 -2
- data/app/views/rescues/_trace.html.erb +2 -6
- data/app/views/rescues/layout.erb +6 -1
- data/lib/editor_opener/action_dispatch/trace_to_file_extractor.rb +3 -2
- data/lib/editor_opener/version.rb +1 -1
- data/lib/generators/editor_opener/templates/initializer.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cfef991d8d0bc6a17c4d34462f2c48a2e10053396b88b0f93ca6bee77b89d32
|
4
|
+
data.tar.gz: b99da146b7413702fb16be1f90c30bacf9609879afa75ebc17793eeb2fb4e7ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0339245f76e84ff7720cd0c6cf7662e4f91220a316a686cb8baf0c944c80b0cc2019a9e916a9ea3ac0d51433afcb8cda37ca8c445a70c8be0870abbb1b53ee76'
|
7
|
+
data.tar.gz: 0332a6abb0cae9929840e4c0a4d6030dfe211eead497b5cab90aec288461a9b31dd7b323cb920609030aa00579e5ed7c6195924a79bbf61c22a6387c1702f4b1
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ Open source files in your editor directly from Rails error pages. This gem adds
|
|
11
11
|
- 📝 **Multiple editor support** - Works with 13+ popular editors
|
12
12
|
- 🎯 **Precise line targeting** - Opens files at the exact error line
|
13
13
|
- 🔧 **Easy configuration** - Set via initializer or environment variable
|
14
|
-
- 🚀 **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
|
15
15
|
- 📱 **Custom URL schemes** - Uses editor-specific protocols for seamless integration
|
16
16
|
|
17
17
|
## Installation
|
@@ -49,12 +49,15 @@ end
|
|
49
49
|
|
50
50
|
### Option 2: Environment variable
|
51
51
|
|
52
|
-
Set the `EDITOR` environment variable:
|
52
|
+
Set the `EDITOR` or `RAILS_EDITOR` environment variable:
|
53
53
|
|
54
54
|
```bash
|
55
55
|
export EDITOR=cursor # for Cursor
|
56
56
|
export EDITOR=atom # for Atom
|
57
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
|
58
61
|
```
|
59
62
|
|
60
63
|
## Usage
|
@@ -105,9 +108,13 @@ end
|
|
105
108
|
```bash
|
106
109
|
# In your shell profile (~/.bashrc, ~/.zshrc, etc.)
|
107
110
|
export EDITOR=cursor
|
111
|
+
# or
|
112
|
+
export RAILS_EDITOR=cursor
|
108
113
|
|
109
114
|
# Or in your .env file (if using dotenv)
|
110
115
|
EDITOR=cursor
|
116
|
+
# or
|
117
|
+
RAILS_EDITOR=cursor
|
111
118
|
```
|
112
119
|
|
113
120
|
### Multiple Environments
|
@@ -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
|
20
|
-
|
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
|
-
|
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
|
|
@@ -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 = ENV["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
|
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.
|
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-
|
10
|
+
date: 2025-07-16 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|