solargraph 0.36.0 → 0.37.0

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: b775ff47aedcc50ee7f1b3c10db47ad78ae5de1c7be7763a3870bd36a5f1b25d
4
- data.tar.gz: c860cd9e682a6065229d2a14142665b195232c3dd6a2e78e21bea0d9b30aabf1
3
+ metadata.gz: a210d97aeb15cde25f91fae2f9574295d075eb32c91cb73154142f21d250e66c
4
+ data.tar.gz: 3192c110188450543803da61d7f7de524f6b9f12ff47a9f1099487176ed0dc17
5
5
  SHA512:
6
- metadata.gz: ea4070ee58a6ab2c00e7a86674e787395d5325c10cc4aa46f3f8c3b3f4f23726b93b639a479be9a3a86835eda0110672fddb63936637737350614bc2fe59df8b
7
- data.tar.gz: 956f38e583f416eeabf0a95508ccaec1be6ea6f1d1a55e1461b3f5cd2612f07c939eabacf69516742d6f3c8dee9a6c14be78f522593441bc7016515f3c8254e0
6
+ metadata.gz: 28913d0d3371eabe95d351f0c7c45b08ba5aef15a1410e60846b1c362597ea4b19250aeb3098f1ad3c4f18215c5b625a3670f3fe87983e858a2c7550c9e4c3d5
7
+ data.tar.gz: 3cba8f1a33b143e6afd8dd9858301d61e86d167b1786eeeb301708cbd8cce13f9d57af7dbc394e0d6da1245094bf26e058c412c57ad30d9b53f9b77b333c065b
@@ -42,11 +42,12 @@ module Solargraph
42
42
  result = []
43
43
  last_link = nil
44
44
  pins.each_with_index do |pin|
45
- if pin.link_documentation && pin.link_documentation != last_link
46
- result.push pin.link_documentation
45
+ this_link = host.options['enablePages'] ? pin.link_documentation : pin.text_documentation
46
+ if this_link && this_link != last_link && this_link != 'undefined'
47
+ result.push this_link
47
48
  end
48
49
  result.push pin.documentation
49
- last_link = pin.link_documentation
50
+ last_link = this_link
50
51
  end
51
52
  result.join("\n\n")
52
53
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'uri'
4
- require 'htmlentities'
5
4
 
6
5
  module Solargraph
7
6
  module LanguageServer
@@ -16,11 +15,11 @@ module Solargraph
16
15
  last_link = nil
17
16
  suggestions.each do |pin|
18
17
  parts = []
19
- this_link = pin.link_documentation
18
+ this_link = host.options['enablePages'] ? pin.link_documentation : pin.text_documentation
20
19
  if !this_link.nil? && this_link != last_link
21
20
  parts.push this_link
22
21
  end
23
- parts.push HTMLEntities.new.encode(pin.detail) unless pin.is_a?(Pin::Namespace) || pin.detail.nil?
22
+ parts.push pin.detail unless pin.is_a?(Pin::Namespace) || pin.detail.nil?
24
23
  parts.push pin.documentation unless pin.documentation.nil? or pin.documentation.empty?
25
24
  contents.push parts.join("\n\n") unless parts.empty?
26
25
  last_link = this_link unless this_link.nil?
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'ostruct'
4
4
  require 'tilt'
5
- require 'maruku'
5
+ require 'yard'
6
6
  require 'htmlentities'
7
7
  require 'cgi'
8
8
 
@@ -24,9 +24,13 @@ module Solargraph
24
24
  # @param text [String]
25
25
  # @return [String]
26
26
  def htmlify text
27
- Maruku.new(text.to_s.lines.map{|l| l.gsub(/^ /, "\t")}.join).to_html
28
- # redcarpet = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
29
- # redcarpet.render(text.to_s.lines.map{|l| l.gsub(/^ /, "\t")}.join)
27
+ YARD::Templates::Helpers::Markup::RDocMarkup.new(text).to_html
28
+ end
29
+
30
+ # @param text [String]
31
+ # @return [String]
32
+ def escape text
33
+ HTMLEntities.new.encode(text)
30
34
  end
31
35
 
32
36
  # @param code [String]
@@ -47,7 +47,7 @@ module Solargraph
47
47
  # change when pins get proxied.
48
48
  detail = String.new
49
49
  detail += "(#{parameters.join(', ')}) " unless !is_a?(Pin::BaseMethod) or parameters.empty?
50
- detail += "=#{probed? ? '~' : (proxied? ? '^' : '>')} #{return_type}" unless return_type.undefined?
50
+ detail += "=#{probed? ? '~' : (proxied? ? '^' : '>')} #{escape_brackets(return_type.to_s)}" unless return_type.undefined?
51
51
  detail.strip!
52
52
  return nil if detail.empty?
53
53
  detail
@@ -60,6 +60,12 @@ module Solargraph
60
60
  @link_documentation ||= generate_link
61
61
  end
62
62
 
63
+ def text_documentation
64
+ this_path = path || return_type.tag
65
+ return nil if this_path == 'undefined'
66
+ escape_brackets this_path
67
+ end
68
+
63
69
  def reset_conversions
64
70
  @completion_item = nil
65
71
  @resolve_completion_item = nil
@@ -70,11 +76,19 @@ module Solargraph
70
76
 
71
77
  private
72
78
 
79
+ # @return [String]
73
80
  def generate_link
74
81
  this_path = path || return_type.tag
82
+ return nil if this_path == 'undefined'
75
83
  return nil if this_path.nil? || this_path == 'undefined'
76
- # return this_path if comments.empty?
77
- "[#{this_path.gsub('_', '\\\\_')}](solargraph:/document?query=#{URI.escape(this_path)})"
84
+ "[#{escape_brackets(this_path).gsub('_', '\\\\_')}](solargraph:/document?query=#{URI.escape(this_path)})"
85
+ end
86
+
87
+ # @param text [String]
88
+ # @return [String]
89
+ def escape_brackets text
90
+ # text.gsub(/(\<|\>)/, "\\#{$1}")
91
+ text.gsub("<", "\\<").gsub(">", "\\>")
78
92
  end
79
93
  end
80
94
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'rdoc'
4
4
  require 'reverse_markdown'
5
- require 'maruku'
5
+ require 'yard'
6
6
 
7
7
  module Solargraph
8
8
  module Pin
@@ -12,8 +12,11 @@ module Solargraph
12
12
  # @return [String]
13
13
  def documentation
14
14
  @documentation ||= begin
15
- html = Maruku.new(normalize_indentation(docstring.to_s)).to_html
16
- ReverseMarkdown.convert(html, github_flavored: true).lines.map(&:rstrip).join("\n")
15
+ text = normalize_indentation(docstring.to_s)
16
+ markup = YARD::Templates::Helpers::Markup::RDocMarkup.new(text)
17
+ html = markup.to_html
18
+ ReverseMarkdown.convert(html, github_flavored: true)
19
+ .lines.map(&:rstrip).join("\n")
17
20
  end
18
21
  end
19
22
 
@@ -22,7 +25,7 @@ module Solargraph
22
25
  # @param text [String]
23
26
  # @return [String]
24
27
  def normalize_indentation text
25
- text.lines.map { |l| remove_odd_spaces(l).gsub(/^ /, "\t") }.join
28
+ text.lines.map { |l| remove_odd_spaces(l) }.join
26
29
  end
27
30
 
28
31
  # @param line [String]
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'htmlentities'
4
-
5
3
  module Solargraph
6
4
  module Pin
7
5
  class Method < BaseMethod
@@ -44,7 +42,7 @@ module Solargraph
44
42
  lines = []
45
43
  param_tags.each do |p|
46
44
  l = "* #{p.name}"
47
- l += " [#{p.types.map { |t| HTMLEntities.new.encode(t) }.join(', ')}]" unless p.types.nil? or p.types.empty?
45
+ l += " [#{escape_brackets(p.types.join(', '))}]" unless p.types.nil? or p.types.empty?
48
46
  l += " #{p.text}"
49
47
  lines.push l
50
48
  end
@@ -78,7 +76,7 @@ module Solargraph
78
76
  name: name,
79
77
  closure: closure,
80
78
  args: tag.parameters.map(&:first),
81
- comments: tag.text
79
+ comments: tag.docstring.all
82
80
  )
83
81
  end
84
82
  end
@@ -109,21 +109,16 @@ module Solargraph
109
109
  # @return [Cursor, nil]
110
110
  def recipient
111
111
  @recipient ||= begin
112
- result = nil
113
112
  node = recipient_node
114
- unless node.nil?
115
- result = if node.children[1].is_a?(AST::Node)
116
- pos = Range.from_node(node.children[1]).start
117
- Cursor.new(source, Position.new(pos.line, pos.column - 1))
118
- else
119
- Cursor.new(source, Range.from_node(node).ending)
120
- end
121
- end
122
- result
113
+ node ? Cursor.new(source, Range.from_node(node).ending) : nil
123
114
  end
124
115
  end
125
116
  alias receiver recipient
126
117
 
118
+ def node
119
+ @node ||= source.node_at(position.line, position.column)
120
+ end
121
+
127
122
  # @return [Position]
128
123
  def node_position
129
124
  @node_position ||= begin
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Solargraph
4
- VERSION = '0.36.0'
4
+ VERSION = '0.37.0'
5
5
  end
@@ -1,6 +1,6 @@
1
1
  <%= tag.name %>
2
2
  <% unless tag.types.nil? or tag.types.empty? %>
3
- [<%= tag.types.join(', ') %>]
3
+ [<%= escape(tag.types.join(', ')) %>]
4
4
  <% end %>
5
5
  <% unless tag.text.empty? %>
6
6
  <% unless (tag.name.nil? or tag.name.empty?) and (tag.types.nil? or tag.types.empty?) %>
@@ -23,8 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_runtime_dependency 'bundler', '>= 1.17.2'
24
24
  s.add_runtime_dependency 'htmlentities', '~> 4.3', '>= 4.3.4'
25
25
  s.add_runtime_dependency 'jaro_winkler', '~> 1.5'
26
- s.add_runtime_dependency 'maruku', '~> 0.7'
27
- s.add_runtime_dependency 'nokogiri', '>= 1.9.1'
26
+ s.add_runtime_dependency 'nokogiri', '~> 1.9', '>= 1.9.1'
28
27
  s.add_runtime_dependency 'parser', '~> 2.3'
29
28
  s.add_runtime_dependency 'reverse_markdown', '~> 1.0', '>= 1.0.5'
30
29
  s.add_runtime_dependency 'rubocop', '~> 0.52'
@@ -35,5 +34,5 @@ Gem::Specification.new do |s|
35
34
  s.add_development_dependency 'pry', '~> 0.11.3'
36
35
  s.add_development_dependency 'rspec', '~> 3.5', '>= 3.5.0'
37
36
  s.add_development_dependency 'simplecov', '~> 0.14'
38
- s.add_development_dependency 'webmock'
37
+ s.add_development_dependency 'webmock', '~> 3.6'
39
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.0
4
+ version: 0.37.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-12 00:00:00.000000000 Z
11
+ date: 2019-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backport
@@ -73,23 +73,12 @@ dependencies:
73
73
  - !ruby/object:Gem::Version
74
74
  version: '1.5'
75
75
  - !ruby/object:Gem::Dependency
76
- name: maruku
76
+ name: nokogiri
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0.7'
82
- type: :runtime
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '0.7'
89
- - !ruby/object:Gem::Dependency
90
- name: nokogiri
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
81
+ version: '1.9'
93
82
  - - ">="
94
83
  - !ruby/object:Gem::Version
95
84
  version: 1.9.1
@@ -97,6 +86,9 @@ dependencies:
97
86
  prerelease: false
98
87
  version_requirements: !ruby/object:Gem::Requirement
99
88
  requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '1.9'
100
92
  - - ">="
101
93
  - !ruby/object:Gem::Version
102
94
  version: 1.9.1
@@ -248,16 +240,16 @@ dependencies:
248
240
  name: webmock
249
241
  requirement: !ruby/object:Gem::Requirement
250
242
  requirements:
251
- - - ">="
243
+ - - "~>"
252
244
  - !ruby/object:Gem::Version
253
- version: '0'
245
+ version: '3.6'
254
246
  type: :development
255
247
  prerelease: false
256
248
  version_requirements: !ruby/object:Gem::Requirement
257
249
  requirements:
258
- - - ">="
250
+ - - "~>"
259
251
  - !ruby/object:Gem::Version
260
- version: '0'
252
+ version: '3.6'
261
253
  description: IDE tools for code completion, inline documentation, and static analysis
262
254
  email: admin@castwide.com
263
255
  executables: