solargraph-rails 0.2.2.pre.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +12 -1
- data/README.md +5 -3
- data/lib/solargraph/rails/meta_source/association/belongs_to_matcher.rb +9 -1
- data/lib/solargraph/rails/meta_source/association/has_and_belongs_to_many_matcher.rb +9 -1
- data/lib/solargraph/rails/meta_source/association/has_many_matcher.rb +9 -1
- data/lib/solargraph/rails/meta_source/association/has_one_matcher.rb +9 -1
- data/lib/solargraph/rails/pin_creator.rb +2 -1
- data/lib/solargraph/rails/version.rb +1 -1
- data/solargraph-rails.gemspec +2 -2
- metadata +12 -13
- data/Gemfile.lock +0 -109
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdae0802262c6077a713ab7360faba89107df21b076feb137632d38ea119b7ab
|
4
|
+
data.tar.gz: 241082c1dd11fd455da5b9c309d8836021e9509f7ecad08542d71307485cf726
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06c879380e6f6bc9cf0858809e725058d6b2d013db97816de6fc9afc23431bd51baede7431b1ed7e6ae3338707fe2978b90493119917ff0b3cecf51ccadbc925
|
7
|
+
data.tar.gz: fbda10862a2f58edcd111f643d475111fdea59c0b2f5797f024365c7858642be78747a11ffd04511c35b73791e6e63bdbfa329e7a6dbce46e8fc96488bd3234d
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,18 @@
|
|
2
2
|
|
3
3
|
## Changes
|
4
4
|
|
5
|
-
### v0.
|
5
|
+
### v0.3.0
|
6
|
+
* Require String inflection monkeypatches directly to avoid error from ActiveSupport v7
|
7
|
+
* Remove Gemfile.lock from version control
|
8
|
+
|
9
|
+
### v0.2.2.pre.4
|
10
|
+
* Loosen the dependency requirements
|
11
|
+
|
12
|
+
### v0.2.2.pre.3
|
13
|
+
* Update to solargraph 0.42.3
|
14
|
+
* Determine return type of association using class_name argument
|
15
|
+
|
16
|
+
### v0.2.2.pre.2
|
6
17
|
|
7
18
|
* Simplistic support for associations
|
8
19
|
* Added dependency on ActiveSupport 6.1 for helpful String methods like `.camelize` and `.singularize`
|
data/README.md
CHANGED
@@ -52,23 +52,25 @@ Solargraph won't know about attributes that you add during a session. Restart yo
|
|
52
52
|
For my setup with Emacs, that means running `M-x lsp-workspace-restart`, YMMV in other editors.
|
53
53
|
|
54
54
|
## Associations (experimental)
|
55
|
-
There is
|
55
|
+
There is simplistic support for `belongs_to` and `has_many` macros:
|
56
56
|
|
57
57
|
![Experimental autocomplete and go to definition of associations](assets/solar_rails_associations.gif)
|
58
58
|
|
59
59
|
## Known issues
|
60
60
|
This project is being used to write production code by the maintainer, but it is still WIP. Check out the issues tab and contribute if you are interested.
|
61
61
|
|
62
|
+
Association support is slightly less functional in Rails 7.
|
63
|
+
|
62
64
|
## Installation
|
63
65
|
|
64
|
-
### Install `solargraph`
|
66
|
+
### Install `solargraph` and `solargraph-rails` locally
|
65
67
|
|
66
68
|
Typically gems like these are not installed via the Gemfile, because most projects have more than one contributor and other contributors might have different setups for their editors in mind. Instead you need to use `gem install`.
|
67
69
|
|
68
70
|
`gem install solargraph-rails`
|
69
71
|
|
70
72
|
#### Alternative: using bundler
|
71
|
-
If you do want to use bundler, add `gem 'solargraph-rails'
|
73
|
+
If you do want to use bundler, add `gem 'solargraph-rails'`
|
72
74
|
|
73
75
|
### Add `solargraph-rails` to your `.solargraph.yml`
|
74
76
|
|
@@ -6,10 +6,18 @@ module MetaSource
|
|
6
6
|
def match?(line)
|
7
7
|
line =~ /belongs_to\s+:([a-z_]*)/
|
8
8
|
@name = Regexp.last_match(1)
|
9
|
+
|
10
|
+
return unless @name
|
11
|
+
|
12
|
+
return @name unless line =~ /class_name:\s+["']([A-Za-z0-9]+)/
|
13
|
+
|
14
|
+
@type = Regexp.last_match(1)
|
15
|
+
|
16
|
+
@name
|
9
17
|
end
|
10
18
|
|
11
19
|
def type
|
12
|
-
name&.camelize
|
20
|
+
@type || name&.camelize
|
13
21
|
end
|
14
22
|
end
|
15
23
|
end
|
@@ -6,10 +6,18 @@ module MetaSource
|
|
6
6
|
def match?(line)
|
7
7
|
line =~ /has_and_belongs_to_many\s+:([a-z_]*)/
|
8
8
|
@name = Regexp.last_match(1)
|
9
|
+
|
10
|
+
return unless @name
|
11
|
+
|
12
|
+
if line =~ /class_name:\s+["']([A-Za-z0-9]+)/
|
13
|
+
@type = Regexp.last_match(1)
|
14
|
+
end
|
15
|
+
|
16
|
+
@name
|
9
17
|
end
|
10
18
|
|
11
19
|
def type
|
12
|
-
"
|
20
|
+
"ActiveRecord::Associations::CollectionProxy<#{@type || name.singularize.camelize}>"
|
13
21
|
end
|
14
22
|
end
|
15
23
|
end
|
@@ -6,10 +6,18 @@ module MetaSource
|
|
6
6
|
def match?(line)
|
7
7
|
line =~ /has_many\s+:([a-z_]*)/
|
8
8
|
@name = Regexp.last_match(1)
|
9
|
+
|
10
|
+
return unless @name
|
11
|
+
|
12
|
+
if line =~ /class_name:\s+["']([A-Za-z0-9]+)/
|
13
|
+
@type = Regexp.last_match(1)
|
14
|
+
end
|
15
|
+
|
16
|
+
@name
|
9
17
|
end
|
10
18
|
|
11
19
|
def type
|
12
|
-
"
|
20
|
+
"ActiveRecord::Associations::CollectionProxy<#{@type || name.singularize.camelize}>"
|
13
21
|
end
|
14
22
|
end
|
15
23
|
end
|
@@ -6,10 +6,18 @@ module MetaSource
|
|
6
6
|
def match?(line)
|
7
7
|
line =~ /has_one\s+:([a-z_]*)/
|
8
8
|
@name = Regexp.last_match(1)
|
9
|
+
|
10
|
+
return unless @name
|
11
|
+
|
12
|
+
if line =~ /class_name:\s+["']([A-Za-z0-9]+)/
|
13
|
+
@type = Regexp.last_match(1)
|
14
|
+
end
|
15
|
+
|
16
|
+
@name
|
9
17
|
end
|
10
18
|
|
11
19
|
def type
|
12
|
-
name.camelize
|
20
|
+
@type || name.camelize
|
13
21
|
end
|
14
22
|
end
|
15
23
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'active_support/core_ext/string'
|
3
|
+
require 'active_support/core_ext/string/inflections'
|
4
4
|
|
5
5
|
module Solargraph
|
6
6
|
module Rails
|
@@ -109,6 +109,7 @@ module Solargraph
|
|
109
109
|
'datetime' => 'ActiveSupport::TimeWithZone',
|
110
110
|
'string' => 'String',
|
111
111
|
'boolean' => 'Boolean',
|
112
|
+
'float' => 'Float',
|
112
113
|
'text' => 'String'
|
113
114
|
}
|
114
115
|
end
|
data/solargraph-rails.gemspec
CHANGED
@@ -25,6 +25,6 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency "rake", "~> 12.3.3"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
27
|
|
28
|
-
spec.add_runtime_dependency "solargraph", "
|
29
|
-
spec.add_runtime_dependency "activesupport"
|
28
|
+
spec.add_runtime_dependency "solargraph", ">= 0.41.1"
|
29
|
+
spec.add_runtime_dependency "activesupport"
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solargraph-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fritz Meissner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,30 +56,30 @@ dependencies:
|
|
56
56
|
name: solargraph
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.41.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.41.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activesupport
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '0'
|
83
83
|
description: Add reflection on ActiveModel dynamic attributes that will be created
|
84
84
|
at runtime
|
85
85
|
email:
|
@@ -93,7 +93,6 @@ files:
|
|
93
93
|
- ".travis.yml"
|
94
94
|
- CHANGELOG.md
|
95
95
|
- Gemfile
|
96
|
-
- Gemfile.lock
|
97
96
|
- LICENSE.txt
|
98
97
|
- README.md
|
99
98
|
- Rakefile
|
@@ -128,9 +127,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
127
|
version: '0'
|
129
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
129
|
requirements:
|
131
|
-
- - "
|
130
|
+
- - ">="
|
132
131
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
132
|
+
version: '0'
|
134
133
|
requirements: []
|
135
134
|
rubygems_version: 3.2.3
|
136
135
|
signing_key:
|
data/Gemfile.lock
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
solargraph-rails (0.2.2.pre.2)
|
5
|
-
activesupport (~> 6.1.3)
|
6
|
-
solargraph (~> 0.42.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
activesupport (6.1.3.2)
|
12
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
-
i18n (>= 1.6, < 2)
|
14
|
-
minitest (>= 5.1)
|
15
|
-
tzinfo (~> 2.0)
|
16
|
-
zeitwerk (~> 2.3)
|
17
|
-
ast (2.4.2)
|
18
|
-
backport (1.1.2)
|
19
|
-
benchmark (0.1.1)
|
20
|
-
bundler-audit (0.8.0)
|
21
|
-
bundler (>= 1.2.0, < 3)
|
22
|
-
thor (~> 1.0)
|
23
|
-
byebug (11.1.3)
|
24
|
-
concurrent-ruby (1.1.9)
|
25
|
-
diff-lcs (1.4.4)
|
26
|
-
e2mmap (0.1.0)
|
27
|
-
i18n (1.8.10)
|
28
|
-
concurrent-ruby (~> 1.0)
|
29
|
-
jaro_winkler (1.5.4)
|
30
|
-
kramdown (2.3.1)
|
31
|
-
rexml
|
32
|
-
kramdown-parser-gfm (1.1.0)
|
33
|
-
kramdown (~> 2.0)
|
34
|
-
mini_portile2 (2.5.3)
|
35
|
-
minitest (5.14.4)
|
36
|
-
nokogiri (1.11.7)
|
37
|
-
mini_portile2 (~> 2.5.0)
|
38
|
-
racc (~> 1.4)
|
39
|
-
parallel (1.20.1)
|
40
|
-
parser (3.0.1.1)
|
41
|
-
ast (~> 2.4.1)
|
42
|
-
racc (1.5.2)
|
43
|
-
rainbow (3.0.0)
|
44
|
-
rake (12.3.3)
|
45
|
-
regexp_parser (2.1.1)
|
46
|
-
reverse_markdown (2.0.0)
|
47
|
-
nokogiri
|
48
|
-
rexml (3.2.5)
|
49
|
-
rspec (3.10.0)
|
50
|
-
rspec-core (~> 3.10.0)
|
51
|
-
rspec-expectations (~> 3.10.0)
|
52
|
-
rspec-mocks (~> 3.10.0)
|
53
|
-
rspec-core (3.10.0)
|
54
|
-
rspec-support (~> 3.10.0)
|
55
|
-
rspec-expectations (3.10.0)
|
56
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
-
rspec-support (~> 3.10.0)
|
58
|
-
rspec-mocks (3.10.0)
|
59
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
-
rspec-support (~> 3.10.0)
|
61
|
-
rspec-support (3.10.0)
|
62
|
-
rubocop (1.16.1)
|
63
|
-
parallel (~> 1.10)
|
64
|
-
parser (>= 3.0.0.0)
|
65
|
-
rainbow (>= 2.2.2, < 4.0)
|
66
|
-
regexp_parser (>= 1.8, < 3.0)
|
67
|
-
rexml
|
68
|
-
rubocop-ast (>= 1.7.0, < 2.0)
|
69
|
-
ruby-progressbar (~> 1.7)
|
70
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
71
|
-
rubocop-ast (1.7.0)
|
72
|
-
parser (>= 3.0.1.1)
|
73
|
-
ruby-progressbar (1.11.0)
|
74
|
-
solargraph (0.42.1)
|
75
|
-
backport (~> 1.1)
|
76
|
-
benchmark
|
77
|
-
bundler (>= 1.17.2)
|
78
|
-
diff-lcs (~> 1.4)
|
79
|
-
e2mmap
|
80
|
-
jaro_winkler (~> 1.5)
|
81
|
-
kramdown (~> 2.3)
|
82
|
-
kramdown-parser-gfm (~> 1.1)
|
83
|
-
parser (~> 3.0)
|
84
|
-
reverse_markdown (>= 1.0.5, < 3)
|
85
|
-
rubocop (>= 0.52)
|
86
|
-
thor (~> 1.0)
|
87
|
-
tilt (~> 2.0)
|
88
|
-
yard (~> 0.9, >= 0.9.24)
|
89
|
-
thor (1.1.0)
|
90
|
-
tilt (2.0.10)
|
91
|
-
tzinfo (2.0.4)
|
92
|
-
concurrent-ruby (~> 1.0)
|
93
|
-
unicode-display_width (2.0.0)
|
94
|
-
yard (0.9.26)
|
95
|
-
zeitwerk (2.4.2)
|
96
|
-
|
97
|
-
PLATFORMS
|
98
|
-
ruby
|
99
|
-
|
100
|
-
DEPENDENCIES
|
101
|
-
bundler (~> 2.2.10)
|
102
|
-
bundler-audit
|
103
|
-
byebug
|
104
|
-
rake (~> 12.3.3)
|
105
|
-
rspec (~> 3.0)
|
106
|
-
solargraph-rails!
|
107
|
-
|
108
|
-
BUNDLED WITH
|
109
|
-
2.2.16
|