Skip to content

Commit 2c18689

Browse files
committed
Replace unicode arrow with right angle bracket
There was a report where the unicode character `"\u276F"` i.e. `❯` would not render on some older fonts. To improve compatibility, we are switching to the standard right angle bracket `>`.
1 parent bd5211b commit 2c18689

File tree

11 files changed

+69
-67
lines changed

11 files changed

+69
-67
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## HEAD (unreleased)
22

3+
- Replace `` with `>` in error output for compatability with more fonts (https://github.com/ruby/syntax_suggest/pull/161)
4+
35
## 1.0.0 (Library renamed to syntax_suggest )
46

57
- [Breaking] Output "Syntax OK" will no longer be output when `syntax_suggest` is fired due to a syntax error. (https://github.com/ruby/syntax_suggest/pull/158)

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ An error in your code forces you to stop. SyntaxSuggest helps you find those err
66
Unmatched `end', missing keyword (`do', `def`, `if`, etc.) ?
77
88
1 class Dog
9-
2 defbark
10-
4 end
9+
> 2 defbark
10+
> 4 end
1111
5 end
1212
```
1313

@@ -72,9 +72,9 @@ end
7272
```
7373
Unmatched keyword, missing `end' ?
7474
75-
1 class Dog
76-
2 def bark
77-
4 end
75+
> 1 class Dog
76+
> 2 def bark
77+
> 4 end
7878
```
7979

8080
- Missing keyword
@@ -95,8 +95,8 @@ Unmatched `end', missing keyword (`do', `def`, `if`, etc.) ?
9595
9696
1 class Dog
9797
2 def speak
98-
3 @sounds.each |sound|
99-
5 end
98+
> 3 @sounds.each |sound|
99+
> 5 end
100100
6 end
101101
7 end
102102
```
@@ -117,8 +117,8 @@ end
117117
Unmatched `(', missing `)' ?
118118
119119
1 class Dog
120-
2 def speak(sound
121-
4 end
120+
> 2 def speak(sound
121+
> 4 end
122122
5 end
123123
```
124124

@@ -137,7 +137,7 @@ syntax error, unexpected end-of-input
137137
138138
1 class Dog
139139
2 def meals_last_month
140-
3 puts 3 *
140+
> 3 puts 3 *
141141
4 end
142142
5 end
143143
```

lib/syntax_suggest/capture_code_context.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def capture_before_after_kws(block)
140140
# However due to https://github.com/ruby/syntax_suggest/issues/32
141141
# the problem line will be identified as:
142142
#
143-
# class Dog # 1
143+
# > class Dog # 1
144144
#
145145
# Because lines 2, 3, and 4 are technically valid code and are expanded
146146
# first, deemed valid, and hidden. We need to un-hide the matching end
@@ -200,7 +200,7 @@ def capture_last_end_same_indent(block)
200200
#
201201
# the problem line will be identified as:
202202
#
203-
# end # 4
203+
# > end # 4
204204
#
205205
# This happens because lines 1, 2, and 3 are technically valid code and are expanded
206206
# first, deemed valid, and hidden. We need to un-hide the matching keyword on

lib/syntax_suggest/cli.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ def parser
9292
9393
# ...
9494
95-
10 defdog
96-
15 end
95+
> 10 defdog
96+
> 15 end
9797
9898
ENV options:
9999

lib/syntax_suggest/display_code_with_line_numbers.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ module SyntaxSuggest
1414
# # =>
1515
# 1
1616
# 2 def cat
17-
# 3 Dir.chdir
18-
# 4 end
17+
# > 3 Dir.chdir
18+
# > 4 end
1919
# 5 end
2020
# 6
2121
class DisplayCodeWithLineNumbers
@@ -50,7 +50,7 @@ def call
5050
private def format(contents:, number:, empty:, highlight: false)
5151
string = +""
5252
string << if highlight
53-
" "
53+
"> "
5454
else
5555
" "
5656
end

spec/integration/ruby_command_line_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ module SyntaxSuggest
7272
out = `ruby -I#{lib_dir} -rsyntax_suggest #{require_rb} 2>&1`
7373

7474
expect($?.success?).to be_falsey
75-
expect(out).to include(' 5 it "flerg"').once
75+
expect(out).to include('> 5 it "flerg"').once
7676
end
7777
end
7878

@@ -101,7 +101,7 @@ module SyntaxSuggest
101101
out = `ruby -I#{lib_dir} -rsyntax_suggest #{script} 2>&1`
102102

103103
expect($?.success?).to be_falsey
104-
expect(out).to include(' 5 it "flerg"').once
104+
expect(out).to include('> 5 it "flerg"').once
105105
end
106106
end
107107

spec/integration/syntax_suggest_spec.rb

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ module SyntaxSuggest
2929
6 class SyntaxTree < Ripper
3030
170 def self.parse(source)
3131
174 end
32-
754 def on_args_add(arguments, argument)
33-
776 class ArgsAddBlock
34-
810 end
32+
> 754 def on_args_add(arguments, argument)
33+
> 776 class ArgsAddBlock
34+
> 810 end
3535
9233 end
3636
EOM
3737
end
@@ -54,10 +54,10 @@ module SyntaxSuggest
5454

5555
expect(io.string).to_not include("def ruby_install_binstub_path")
5656
expect(io.string).to include(<<~'EOM')
57-
1067 def add_yarn_binary
58-
1068 return [] if yarn_preinstalled?
59-
1069 |
60-
1075 end
57+
> 1067 def add_yarn_binary
58+
> 1068 return [] if yarn_preinstalled?
59+
> 1069 |
60+
> 1075 end
6161
EOM
6262
end
6363

@@ -73,9 +73,9 @@ module SyntaxSuggest
7373

7474
expect(io.string).to include(<<~'EOM')
7575
1 Rails.application.routes.draw do
76-
113 namespace :admin do
77-
116 match "/foobar(*path)", via: :all, to: redirect { |_params, req|
78-
120 }
76+
> 113 namespace :admin do
77+
> 116 match "/foobar(*path)", via: :all, to: redirect { |_params, req|
78+
> 120 }
7979
121 end
8080
EOM
8181
end
@@ -94,8 +94,8 @@ module SyntaxSuggest
9494
1 describe "webmock tests" do
9595
22 it "body" do
9696
27 query = Cutlass::FunctionQuery.new(
97-
28 port: port
98-
29 body: body
97+
> 28 port: port
98+
> 29 body: body
9999
30 ).call
100100
34 end
101101
35 end
@@ -118,9 +118,9 @@ module SyntaxSuggest
118118
7 REQUIRED_BY = {}
119119
9 attr_reader :name
120120
10 attr_writer :cost
121-
13 def initialize(name)
122-
18 def self.reset!
123-
25 end
121+
> 13 def initialize(name)
122+
> 18 def self.reset!
123+
> 25 end
124124
73 end
125125
74 end
126126
EOM
@@ -140,9 +140,9 @@ module SyntaxSuggest
140140

141141
expect(out).to include(<<~EOM)
142142
16 class Rexe
143-
77 class Lookups
144-
78 def input_modes
145-
148 end
143+
> 77 class Lookups
144+
> 78 def input_modes
145+
> 148 end
146146
551 end
147147
EOM
148148
end
@@ -161,9 +161,9 @@ module SyntaxSuggest
161161
expect(out).to include(<<~EOM)
162162
16 class Rexe
163163
18 VERSION = '1.5.1'
164-
77 class Lookups
165-
140 def format_requires
166-
148 end
164+
> 77 class Lookups
165+
> 140 def format_requires
166+
> 148 end
167167
551 end
168168
EOM
169169
end
@@ -182,9 +182,9 @@ def call # 0
182182
)
183183
out = io.string
184184
expect(out).to include(<<~EOM)
185-
1 def call # 0
186-
3 end # one # 2
187-
4 end # two # 3
185+
> 1 def call # 0
186+
> 3 end # one # 2
187+
> 4 end # two # 3
188188
EOM
189189
end
190190

@@ -202,9 +202,9 @@ def bark
202202
)
203203
out = io.string
204204
expect(out).to include(<<~EOM)
205-
1 class Dog
206-
2 def bark
207-
4 end
205+
> 1 class Dog
206+
> 2 def bark
207+
> 4 end
208208
EOM
209209
end
210210
end

spec/unit/clean_document_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ module SyntaxSuggest
6666
highlight_lines: lines[0]
6767
).call
6868
).to eq(<<~'EOM')
69-
1 User
70-
2 .where(name: 'schneems')
71-
3 .first
69+
> 1 User
70+
> 2 .where(name: 'schneems')
71+
> 3 .first
7272
EOM
7373
end
7474

@@ -169,8 +169,8 @@ module SyntaxSuggest
169169
).call
170170
).to eq(<<~'EOM')
171171
1 context "timezones workaround" do
172-
2 it "should receive a time in UTC format and return the time with the"\
173-
3 "office's UTC offset substracted from it" do
172+
> 2 it "should receive a time in UTC format and return the time with the"\
173+
> 3 "office's UTC offset substracted from it" do
174174
4 travel_to DateTime.new(2020, 10, 1, 10, 0, 0) do
175175
5 office = build(:office)
176176
6 end
@@ -227,9 +227,9 @@ module SyntaxSuggest
227227
highlight_lines: lines[0]
228228
).call
229229
).to eq(<<~'EOM')
230-
1 it "should " \
231-
2 "keep " \
232-
3 "going " do
230+
> 1 it "should " \
231+
> 2 "keep " \
232+
> 3 "going " do
233233
4 end
234234
EOM
235235
end

spec/unit/cli_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def called?
5858

5959
expect(exit_obj.called?).to be_truthy
6060
expect(exit_obj.value).to eq(1)
61-
expect(out.strip).to include(" 36 def filename")
61+
expect(out.strip).to include("> 36 def filename")
6262
end
6363

6464
it "parses valid code with flags" do

spec/unit/code_search_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ def hai
185185
expect(search.record_dir.join("1-add-1-(3__4).txt").read).to include(<<~EOM)
186186
1 class OH
187187
2 def hello
188-
3 def hai
189-
4 end
188+
> 3 def hai
189+
> 4 end
190190
5 end
191191
EOM
192192
end
@@ -245,7 +245,7 @@ def hello
245245
).call
246246

247247
expect(document).to include(<<~'EOM')
248-
36 def filename
248+
> 36 def filename
249249
EOM
250250
end
251251

@@ -295,9 +295,9 @@ def hello
295295
1 require 'rails_helper'
296296
2
297297
3 RSpec.describe AclassNameHere, type: :worker do
298-
4 describe "thing" do
299-
16 end # line 16 accidental end, but valid block
300-
30 end # mismatched due to 16
298+
> 4 describe "thing" do
299+
> 16 end # line 16 accidental end, but valid block
300+
> 30 end # mismatched due to 16
301301
31 end
302302
EOM
303303
end

0 commit comments

Comments
 (0)