From 8e2f978e605a2592fc7447a59ad7fad7ff1d028d Mon Sep 17 00:00:00 2001 From: Goulven Champenois Date: Sun, 21 May 2023 16:01:37 +0200 Subject: [PATCH] Allow opening files in Nova editor Closes #518 --- lib/better_errors.rb | 1 + lib/better_errors/editor.rb | 1 + spec/better_errors/editor_spec.rb | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/lib/better_errors.rb b/lib/better_errors.rb index aff646e1..ce396eec 100644 --- a/lib/better_errors.rb +++ b/lib/better_errors.rb @@ -74,6 +74,7 @@ def self.editor # * `:textmate`, `:txmt`, `:tm` # * `:sublime`, `:subl`, `:st` # * `:macvim` + # * `:nova` # * `:atom` # # @param [Symbol] sym diff --git a/lib/better_errors/editor.rb b/lib/better_errors/editor.rb index 96ffc3f0..7bcbe414 100644 --- a/lib/better_errors/editor.rb +++ b/lib/better_errors/editor.rb @@ -7,6 +7,7 @@ class Editor { symbols: [:emacs, :emacsclient], sniff: /emacs/i, url: "emacs://open?url=file://%{file}&line=%{line}" }, { symbols: [:idea], sniff: /idea/i, url: "idea://open?file=%{file}&line=%{line}" }, { symbols: [:macvim, :mvim], sniff: /vim/i, url: "mvim://open?url=file://%{file_unencoded}&line=%{line}" }, + { symbols: [:nova], sniff: /nova/i, url: "nova://open?path=%{file}&line=%{line}" }, { symbols: [:rubymine], sniff: /mine/i, url: "x-mine://open?file=%{file}&line=%{line}" }, { symbols: [:sublime, :subl, :st], sniff: /subl/i, url: "subl://open?url=file://%{file}&line=%{line}" }, { symbols: [:textmate, :txmt, :tm], sniff: /mate/i, url: "txmt://open?url=file://%{file}&line=%{line}" }, diff --git a/spec/better_errors/editor_spec.rb b/spec/better_errors/editor_spec.rb index ca0127a3..7ce60117 100644 --- a/spec/better_errors/editor_spec.rb +++ b/spec/better_errors/editor_spec.rb @@ -210,6 +210,16 @@ end end + [:nova].each do |symbol| + context "when symbol is '#{symbol}'" do + let(:symbol) { symbol } + + it "uses txmt:// scheme" do + expect(subject.url("file", 42)).to start_with("nova://") + end + end + end + [:sublime, :subl, :st].each do |symbol| context "when symbol is '#{symbol}'" do let(:symbol) { symbol }