solargraph 0.28.3 → 0.28.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5263886b3711a2cc3a6ff8b93c6162002feae2162055999a42d0e571473e47c
4
- data.tar.gz: e936cac7abedde1efab2c97618c15a0290937211016cb7ae0a71d607b6483e23
3
+ metadata.gz: 0fd24fe0b737e17e14772aa13d7b948b5721ba99f3a0855682e78503ca337816
4
+ data.tar.gz: 1e907c9e1f5fa10537c406fdd512574da4dce74354d0d16accb04d91794c29a4
5
5
  SHA512:
6
- metadata.gz: c8dd13d206f759022ab35d9721672b2a0c1c517a18f9e58cfeec7143eacdd6e8d20ad726cb5539bb2e010b9ec82593a4b164dd5bed4ddcb48e4adde17e226689
7
- data.tar.gz: b4e88b5cd5f6c5d4495d4562edfd2510651410fe17e6e6b4db33dcee85afbe0ba7110fba5dabd143c76fd04a94e359ad07adae0588ca67ca2a1e445dd421ce67
6
+ metadata.gz: 77d273f6d65def59c5d4661a3479948fffce730fe9aebdff94cdc24dbefed1be8d60633e469a2d3f8c9941d1463980ed0db71eef7bdffe1182b6d9abc1835af6
7
+ data.tar.gz: e836999b24c652aa457a32db9f29a46264b91401c1fe6f4a86dc62baf9fce78e49f8795b6e957919ddcca21924c7ccc57a54d030f6183095dfa5d1663ab650d6
@@ -1,6 +1,3 @@
1
- require 'reverse_markdown'
2
- require 'uri'
3
-
4
1
  module Solargraph
5
2
  module LanguageServer
6
3
  module Message
@@ -3,6 +3,7 @@ require 'tilt'
3
3
  require 'kramdown'
4
4
  require 'htmlentities'
5
5
  require 'coderay'
6
+ require 'reverse_markdown'
6
7
 
7
8
  module Solargraph
8
9
  class Page
@@ -18,11 +19,8 @@ module Solargraph
18
19
  end
19
20
 
20
21
  def htmlify text
21
- helper = Solargraph::Pin::Helper.new
22
- html = helper.html_markup_rdoc(text)
23
- conv = ReverseMarkdown.convert(html, github_flavored: true)
24
22
  Kramdown::Document.new(
25
- conv,
23
+ text.to_s.lines.map{|l| l.gsub(/^ /, "\t")}.join,
26
24
  input: 'GFM',
27
25
  entity_output: :symbolic,
28
26
  syntax_highlighter_opts: {
@@ -2,7 +2,6 @@ module Solargraph
2
2
  # The namespace for pins used in maps.
3
3
  #
4
4
  module Pin
5
- autoload :Helper, 'solargraph/pin/helper'
6
5
  autoload :Conversions, 'solargraph/pin/conversions'
7
6
  autoload :Base, 'solargraph/pin/base'
8
7
  autoload :Method, 'solargraph/pin/method'
@@ -1,5 +1,3 @@
1
- require 'reverse_markdown'
2
-
3
1
  module Solargraph
4
2
  module Pin
5
3
  # The base class for map pins.
@@ -1,18 +1,41 @@
1
+ require 'rdoc'
2
+ require 'reverse_markdown'
3
+ require 'kramdown'
4
+
1
5
  module Solargraph
2
6
  module Pin
7
+ # A module to add the Pin::Base#documentation method.
8
+ #
3
9
  module Documenting
4
10
  # @return [String]
5
11
  def documentation
6
- if @documentation.nil?
7
- @documentation = ReverseMarkdown.convert(helper.html_markup_rdoc(docstring), github_flavored: true)
8
- @documentation.strip!
12
+ @documentation ||= begin
13
+ html = Kramdown::Document.new(
14
+ normalize_indentation(docstring.to_s),
15
+ input: 'GFM',
16
+ entity_output: :symbolic,
17
+ syntax_highlighter: nil
18
+ ).to_html
19
+ ReverseMarkdown.convert(html, github_flavored: true)
9
20
  end
10
- @documentation
11
21
  end
12
22
 
13
- def helper
14
- @helper ||= Solargraph::Pin::Helper.new
23
+ private
24
+
25
+ # @param text [String]
26
+ # @return [String]
27
+ def normalize_indentation text
28
+ text.lines.map { |l| remove_odd_spaces(l).gsub(/^ /, "\t") }.join
29
+ end
30
+
31
+ # @param line [String]
32
+ # @return [String]
33
+ def remove_odd_spaces line
34
+ return line unless line.start_with?(' ')
35
+ spaces = line.match(/^ +/)[0].length
36
+ return line unless spaces.odd?
37
+ line[1..-1]
15
38
  end
16
39
  end
17
40
  end
18
- end
41
+ end
@@ -1,3 +1,3 @@
1
1
  module Solargraph
2
- VERSION = '0.28.3'
2
+ VERSION = '0.28.4'
3
3
  end
@@ -139,23 +139,38 @@ module Solargraph
139
139
  end
140
140
  end
141
141
 
142
+ # Generate require paths from gemspecs if they exist or assume the default
143
+ # lib directory.
144
+ #
145
+ # @return [Array<String>]
142
146
  def generate_require_paths
143
147
  return configured_require_paths if directory.empty? || !gemspec?
144
148
  result = []
145
149
  gemspecs.each do |file|
150
+ base = File.dirname(file)
146
151
  # @todo Evaluating gemspec files violates the goal of not running
147
152
  # workspace code, but this is how Gem::Specification.load does it
148
153
  # anyway.
149
- spec = eval(File.read(file), binding, file)
150
- next unless Gem::Specification === spec
151
- base = File.dirname(file)
152
- result.concat spec.require_paths.map{ |path| File.join(base, path) } unless spec.nil?
154
+ begin
155
+ spec = eval(File.read(file), binding, file)
156
+ next unless Gem::Specification === spec
157
+ result.concat spec.require_paths.map{ |path| File.join(base, path) } unless spec.nil?
158
+ rescue Exception => e
159
+ # Don't die if we have an error during eval-ing a gem spec.
160
+ # Concat the default lib directory instead.
161
+ # @todo Should the client be informed of the error through
162
+ # diagnostics or some other mechanism?
163
+ result.push File.join(base, 'lib')
164
+ end
153
165
  end
154
166
  result.concat config.require_paths
155
167
  result.push File.join(directory, 'lib') if result.empty?
156
168
  result
157
169
  end
158
170
 
171
+ # Get additional require paths defined in the configuration.
172
+ #
173
+ # @return [Array<String>]
159
174
  def configured_require_paths
160
175
  return ['lib'] if directory.empty?
161
176
  return [File.join(directory, 'lib')] if config.require_paths.empty?
metadata CHANGED
@@ -1,83 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.3
4
+ version: 0.28.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-22 00:00:00.000000000 Z
11
+ date: 2018-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: parser
14
+ name: coderay
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.4'
19
+ version: '1.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.4'
26
+ version: '1.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: thor
28
+ name: eventmachine
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.19'
33
+ version: '1.2'
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 0.19.4
36
+ version: 1.2.5
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
- version: '0.19'
43
+ version: '1.2'
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 0.19.4
46
+ version: 1.2.5
47
47
  - !ruby/object:Gem::Dependency
48
- name: yard
48
+ name: htmlentities
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.9'
53
+ version: '4.3'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 4.3.4
54
57
  type: :runtime
55
58
  prerelease: false
56
59
  version_requirements: !ruby/object:Gem::Requirement
57
60
  requirements:
58
61
  - - "~>"
59
62
  - !ruby/object:Gem::Version
60
- version: '0.9'
63
+ version: '4.3'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 4.3.4
61
67
  - !ruby/object:Gem::Dependency
62
- name: eventmachine
68
+ name: kramdown
63
69
  requirement: !ruby/object:Gem::Requirement
64
70
  requirements:
65
71
  - - "~>"
66
72
  - !ruby/object:Gem::Version
67
- version: '1.2'
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: 1.2.5
73
+ version: '1.16'
71
74
  type: :runtime
72
75
  prerelease: false
73
76
  version_requirements: !ruby/object:Gem::Requirement
74
77
  requirements:
75
78
  - - "~>"
76
79
  - !ruby/object:Gem::Version
77
- version: '1.2'
78
- - - ">="
80
+ version: '1.16'
81
+ - !ruby/object:Gem::Dependency
82
+ name: parser
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
79
86
  - !ruby/object:Gem::Version
80
- version: 1.2.5
87
+ version: '2.4'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '2.4'
81
95
  - !ruby/object:Gem::Dependency
82
96
  name: reverse_markdown
83
97
  requirement: !ruby/object:Gem::Requirement
@@ -99,81 +113,81 @@ dependencies:
99
113
  - !ruby/object:Gem::Version
100
114
  version: 1.0.5
101
115
  - !ruby/object:Gem::Dependency
102
- name: kramdown
116
+ name: rubocop
103
117
  requirement: !ruby/object:Gem::Requirement
104
118
  requirements:
105
119
  - - "~>"
106
120
  - !ruby/object:Gem::Version
107
- version: '1.16'
121
+ version: '0.52'
108
122
  type: :runtime
109
123
  prerelease: false
110
124
  version_requirements: !ruby/object:Gem::Requirement
111
125
  requirements:
112
126
  - - "~>"
113
127
  - !ruby/object:Gem::Version
114
- version: '1.16'
128
+ version: '0.52'
115
129
  - !ruby/object:Gem::Dependency
116
- name: htmlentities
130
+ name: thor
117
131
  requirement: !ruby/object:Gem::Requirement
118
132
  requirements:
119
133
  - - "~>"
120
134
  - !ruby/object:Gem::Version
121
- version: '4.3'
135
+ version: '0.19'
122
136
  - - ">="
123
137
  - !ruby/object:Gem::Version
124
- version: 4.3.4
138
+ version: 0.19.4
125
139
  type: :runtime
126
140
  prerelease: false
127
141
  version_requirements: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: '4.3'
145
+ version: '0.19'
132
146
  - - ">="
133
147
  - !ruby/object:Gem::Version
134
- version: 4.3.4
148
+ version: 0.19.4
135
149
  - !ruby/object:Gem::Dependency
136
- name: coderay
150
+ name: tilt
137
151
  requirement: !ruby/object:Gem::Requirement
138
152
  requirements:
139
153
  - - "~>"
140
154
  - !ruby/object:Gem::Version
141
- version: '1.1'
155
+ version: '2.0'
142
156
  type: :runtime
143
157
  prerelease: false
144
158
  version_requirements: !ruby/object:Gem::Requirement
145
159
  requirements:
146
160
  - - "~>"
147
161
  - !ruby/object:Gem::Version
148
- version: '1.1'
162
+ version: '2.0'
149
163
  - !ruby/object:Gem::Dependency
150
- name: rubocop
164
+ name: yard
151
165
  requirement: !ruby/object:Gem::Requirement
152
166
  requirements:
153
167
  - - "~>"
154
168
  - !ruby/object:Gem::Version
155
- version: '0.52'
169
+ version: '0.9'
156
170
  type: :runtime
157
171
  prerelease: false
158
172
  version_requirements: !ruby/object:Gem::Requirement
159
173
  requirements:
160
174
  - - "~>"
161
175
  - !ruby/object:Gem::Version
162
- version: '0.52'
176
+ version: '0.9'
163
177
  - !ruby/object:Gem::Dependency
164
- name: tilt
178
+ name: pry
165
179
  requirement: !ruby/object:Gem::Requirement
166
180
  requirements:
167
181
  - - "~>"
168
182
  - !ruby/object:Gem::Version
169
- version: '2.0'
170
- type: :runtime
183
+ version: 0.11.3
184
+ type: :development
171
185
  prerelease: false
172
186
  version_requirements: !ruby/object:Gem::Requirement
173
187
  requirements:
174
188
  - - "~>"
175
189
  - !ruby/object:Gem::Version
176
- version: '2.0'
190
+ version: 0.11.3
177
191
  - !ruby/object:Gem::Dependency
178
192
  name: rspec
179
193
  requirement: !ruby/object:Gem::Requirement
@@ -208,20 +222,6 @@ dependencies:
208
222
  - - "~>"
209
223
  - !ruby/object:Gem::Version
210
224
  version: '0.14'
211
- - !ruby/object:Gem::Dependency
212
- name: pry
213
- requirement: !ruby/object:Gem::Requirement
214
- requirements:
215
- - - "~>"
216
- - !ruby/object:Gem::Version
217
- version: 0.11.3
218
- type: :development
219
- prerelease: false
220
- version_requirements: !ruby/object:Gem::Requirement
221
- requirements:
222
- - - "~>"
223
- - !ruby/object:Gem::Version
224
- version: 0.11.3
225
225
  description: IDE tools for code completion and inline documentation
226
226
  email: admin@castwide.com
227
227
  executables:
@@ -319,7 +319,6 @@ files:
319
319
  - lib/solargraph/pin/documenting.rb
320
320
  - lib/solargraph/pin/duck_method.rb
321
321
  - lib/solargraph/pin/global_variable.rb
322
- - lib/solargraph/pin/helper.rb
323
322
  - lib/solargraph/pin/instance_variable.rb
324
323
  - lib/solargraph/pin/keyword.rb
325
324
  - lib/solargraph/pin/local_variable.rb
@@ -1,41 +0,0 @@
1
- require 'yard'
2
-
3
- module Solargraph
4
- module Pin
5
- class Helper
6
- include YARD::Templates::Helpers::HtmlHelper
7
-
8
- attr_accessor :object
9
- attr_accessor :serializer
10
-
11
- def initialize object = nil
12
- @object = object
13
- end
14
-
15
- def url_for(object)
16
- '.'
17
- end
18
-
19
- def html_markup_rdoc(text)
20
- # @todo The :rdoc markup class might not be immediately available.
21
- # If not, return nil for now under the assumption that the problem
22
- # will eventually fix itself.
23
- return nil if markup_class(:rdoc).nil?
24
- super
25
- end
26
-
27
- def options
28
- if @options.nil?
29
- @options = YARD::Templates::TemplateOptions.new
30
- @options[:type] = :rdoc
31
- end
32
- @options
33
- end
34
-
35
- # HACK: The linkify method just returns the arguments as plain text
36
- def linkify *args
37
- args.join(', ')
38
- end
39
- end
40
- end
41
- end