syntax_suggest 1.0.1 → 1.0.2
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/.github/dependabot.yml +6 -0
- data/.github/workflows/check_changelog.yml +1 -1
- data/.github/workflows/ci.yml +3 -3
- data/CHANGELOG.md +6 -0
- data/lib/syntax_suggest/core_ext.rb +45 -38
- data/lib/syntax_suggest/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3c694e7b419ea1a715d2cccf55e706be86035c2563e2f4506769da76829a65a
|
4
|
+
data.tar.gz: a42f42ceb34fc29e0534072cc25e27e7b416c7a954ec6ccdc75c5748db491e22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 755b4e3e2a5bb86ae61b4f29417a0a4f6531dbe5866ce32d56e0cb2452496fb858469bbeb3aa369ca953814e475cb52e93c2273eb54ec203cff98520d10bac07
|
7
|
+
data.tar.gz: 178a7ecd8a04d8f53f1778a331400273a2980f42451942012c3e98d5171ab30c590e76eaf69b6c78d7c63274f8040cce2e4e4f85ad35601c34fe46149420aa44
|
@@ -13,7 +13,7 @@ jobs:
|
|
13
13
|
!contains(github.event.pull_request.body, '[skip ci]') &&
|
14
14
|
!contains(github.event.pull_request.labels.*.name, 'skip changelog')
|
15
15
|
steps:
|
16
|
-
- uses: actions/checkout@
|
16
|
+
- uses: actions/checkout@v3.2.0
|
17
17
|
- name: Check that CHANGELOG is touched
|
18
18
|
run: |
|
19
19
|
git fetch origin ${{ github.base_ref }} --depth 1 && \
|
data/.github/workflows/ci.yml
CHANGED
@@ -9,7 +9,7 @@ jobs:
|
|
9
9
|
runs-on: ubuntu-latest
|
10
10
|
steps:
|
11
11
|
- name: Checkout code
|
12
|
-
uses: actions/checkout@v3
|
12
|
+
uses: actions/checkout@v3.2.0
|
13
13
|
- name: Set up Ruby
|
14
14
|
uses: ruby/setup-ruby@v1
|
15
15
|
with:
|
@@ -29,11 +29,11 @@ jobs:
|
|
29
29
|
- 2.7
|
30
30
|
- '3.0'
|
31
31
|
- 3.1
|
32
|
-
- "3.2.0-
|
32
|
+
- "3.2.0-rc1"
|
33
33
|
- head
|
34
34
|
steps:
|
35
35
|
- name: Checkout code
|
36
|
-
uses: actions/checkout@v3
|
36
|
+
uses: actions/checkout@v3.2.0
|
37
37
|
- name: Set up Ruby
|
38
38
|
uses: ruby/setup-ruby@v1
|
39
39
|
with:
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## HEAD (unreleased)
|
2
2
|
|
3
|
+
## 1.0.2
|
4
|
+
|
5
|
+
- Drop support or Ruby 3.2.0 preview, now that 3.2.0-rc1 is available (https://github.com/ruby/syntax_suggest/pull/165)
|
6
|
+
- Native support of `SyntaxError#path`, support 3.2.0-preview3 will be dropped with the release of 3.2.0-preview4 (https://github.com/ruby/syntax_suggest/pull/164)
|
7
|
+
- Added dependabot for GitHub Actions (https://github.com/ruby/syntax_suggest/pull/160)
|
8
|
+
|
3
9
|
## 1.0.1
|
4
10
|
|
5
11
|
- Replace `❯` with `>` in error output for compatability with more fonts (https://github.com/ruby/syntax_suggest/pull/161)
|
@@ -3,6 +3,10 @@
|
|
3
3
|
# Ruby 3.2+ has a cleaner way to hook into Ruby that doesn't use `require`
|
4
4
|
if SyntaxError.method_defined?(:detailed_message)
|
5
5
|
module SyntaxSuggest
|
6
|
+
# Mini String IO [Private]
|
7
|
+
#
|
8
|
+
# Acts like a StringIO with reduced API, but without having to require that
|
9
|
+
# class.
|
6
10
|
class MiniStringIO
|
7
11
|
def initialize(isatty: $stderr.isatty)
|
8
12
|
@string = +""
|
@@ -16,46 +20,49 @@ if SyntaxError.method_defined?(:detailed_message)
|
|
16
20
|
|
17
21
|
attr_reader :string
|
18
22
|
end
|
19
|
-
end
|
20
|
-
|
21
|
-
SyntaxError.prepend Module.new {
|
22
|
-
def detailed_message(highlight: true, syntax_suggest: true, **kwargs)
|
23
|
-
return super unless syntax_suggest
|
24
|
-
|
25
|
-
require "syntax_suggest/api" unless defined?(SyntaxSuggest::DEFAULT_VALUE)
|
26
|
-
|
27
|
-
message = super
|
28
|
-
file = if highlight
|
29
|
-
SyntaxSuggest::PathnameFromMessage.new(super(highlight: false, **kwargs)).call.name
|
30
|
-
else
|
31
|
-
SyntaxSuggest::PathnameFromMessage.new(message).call.name
|
32
|
-
end
|
33
|
-
|
34
|
-
io = SyntaxSuggest::MiniStringIO.new
|
35
23
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
24
|
+
# SyntaxSuggest.record_dir [Private]
|
25
|
+
#
|
26
|
+
# Used to monkeypatch SyntaxError via Module.prepend
|
27
|
+
def self.module_for_detailed_message
|
28
|
+
Module.new {
|
29
|
+
def detailed_message(highlight: true, syntax_suggest: true, **kwargs)
|
30
|
+
return super unless syntax_suggest
|
31
|
+
|
32
|
+
require "syntax_suggest/api" unless defined?(SyntaxSuggest::DEFAULT_VALUE)
|
33
|
+
|
34
|
+
message = super
|
35
|
+
|
36
|
+
if path
|
37
|
+
file = Pathname.new(path)
|
38
|
+
io = SyntaxSuggest::MiniStringIO.new
|
39
|
+
|
40
|
+
SyntaxSuggest.call(
|
41
|
+
io: io,
|
42
|
+
source: file.read,
|
43
|
+
filename: file,
|
44
|
+
terminal: highlight
|
45
|
+
)
|
46
|
+
annotation = io.string
|
47
|
+
|
48
|
+
annotation + message
|
49
|
+
else
|
50
|
+
message
|
51
|
+
end
|
52
|
+
rescue => e
|
53
|
+
if ENV["SYNTAX_SUGGEST_DEBUG"]
|
54
|
+
$stderr.warn(e.message)
|
55
|
+
$stderr.warn(e.backtrace)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Ignore internal errors
|
59
|
+
message
|
60
|
+
end
|
61
|
+
}
|
57
62
|
end
|
58
|
-
|
63
|
+
end
|
64
|
+
|
65
|
+
SyntaxError.prepend(SyntaxSuggest.module_for_detailed_message)
|
59
66
|
else
|
60
67
|
autoload :Pathname, "pathname"
|
61
68
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syntax_suggest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- schneems
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: When you get an "unexpected end" in your syntax this gem helps you find
|
14
14
|
it
|
@@ -19,6 +19,7 @@ executables:
|
|
19
19
|
extensions: []
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
|
+
- ".github/dependabot.yml"
|
22
23
|
- ".github/workflows/check_changelog.yml"
|
23
24
|
- ".github/workflows/ci.yml"
|
24
25
|
- ".gitignore"
|
@@ -81,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
82
|
- !ruby/object:Gem::Version
|
82
83
|
version: '0'
|
83
84
|
requirements: []
|
84
|
-
rubygems_version: 3.
|
85
|
+
rubygems_version: 3.4.0.dev
|
85
86
|
signing_key:
|
86
87
|
specification_version: 4
|
87
88
|
summary: Find syntax errors in your source in a snap
|