solargraph 0.58.2 → 0.58.3
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/workflows/plugins.yml +3 -2
- data/CHANGELOG.md +3 -0
- data/lib/solargraph/bench.rb +45 -45
- data/lib/solargraph/convention/data_definition/data_assignment_node.rb +61 -61
- data/lib/solargraph/convention/gemfile.rb +15 -15
- data/lib/solargraph/convention/gemspec.rb +23 -23
- data/lib/solargraph/convention/rakefile.rb +17 -17
- data/lib/solargraph/convention.rb +78 -78
- data/lib/solargraph/converters/dd.rb +17 -17
- data/lib/solargraph/converters/dl.rb +15 -15
- data/lib/solargraph/converters/dt.rb +15 -15
- data/lib/solargraph/converters/misc.rb +1 -1
- data/lib/solargraph/diagnostics/update_errors.rb +41 -41
- data/lib/solargraph/language_server/error_codes.rb +20 -20
- data/lib/solargraph/language_server/message/base.rb +97 -97
- data/lib/solargraph/language_server/message/client/register_capability.rb +15 -15
- data/lib/solargraph/language_server/message/completion_item/resolve.rb +60 -60
- data/lib/solargraph/language_server/message/extended/document_gems.rb +32 -32
- data/lib/solargraph/language_server/message/extended/download_core.rb +19 -19
- data/lib/solargraph/language_server/message/extended/search.rb +20 -20
- data/lib/solargraph/language_server/message/initialize.rb +191 -191
- data/lib/solargraph/language_server/message/text_document/document_highlight.rb +16 -16
- data/lib/solargraph/language_server/message/text_document/prepare_rename.rb +11 -11
- data/lib/solargraph/language_server/message/text_document/references.rb +16 -16
- data/lib/solargraph/language_server/message/text_document/rename.rb +19 -19
- data/lib/solargraph/language_server/message/workspace/did_change_configuration.rb +35 -35
- data/lib/solargraph/language_server/message/workspace/did_change_watched_files.rb +40 -40
- data/lib/solargraph/language_server/message/workspace/did_change_workspace_folders.rb +26 -26
- data/lib/solargraph/language_server/message.rb +94 -94
- data/lib/solargraph/language_server/request.rb +27 -27
- data/lib/solargraph/language_server/transport/data_reader.rb +74 -74
- data/lib/solargraph/language_server/uri_helpers.rb +49 -49
- data/lib/solargraph/page.rb +92 -92
- data/lib/solargraph/parser/parser_gem/flawed_builder.rb +19 -19
- data/lib/solargraph/parser/parser_gem/node_processors/defs_node.rb +37 -37
- data/lib/solargraph/parser/parser_gem/node_processors/until_node.rb +29 -29
- data/lib/solargraph/parser/parser_gem.rb +12 -12
- data/lib/solargraph/parser.rb +23 -23
- data/lib/solargraph/pin/constant.rb +45 -45
- data/lib/solargraph/rbs_map/core_fills.rb +84 -84
- data/lib/solargraph/server_methods.rb +16 -16
- data/lib/solargraph/shell.rb +14 -3
- data/lib/solargraph/source/chain/array.rb +37 -37
- data/lib/solargraph/source/chain/class_variable.rb +13 -13
- data/lib/solargraph/source/chain/global_variable.rb +13 -13
- data/lib/solargraph/source/chain/link.rb +109 -109
- data/lib/solargraph/source/chain/q_call.rb +11 -11
- data/lib/solargraph/source/chain/variable.rb +13 -13
- data/lib/solargraph/source/chain/z_super.rb +30 -30
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/yard_tags.rb +20 -20
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e2913913dac1fa336d5f2a7ac51a5cc7d7afb085fc14e0aea405ec4fc6f482c
|
|
4
|
+
data.tar.gz: 180f4779d6e070e919c8d4d1af3d4c72edb79370cbb9592671213db049254d2b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d30d4d79505a7bd37d906bd8eaf5351426e21a87ae23e922677a149dd946536c05a02debf70e1198d2f8b75dbf0a4941f9a2df34aa9ce2938b35da6458477fa5
|
|
7
|
+
data.tar.gz: 18a7d22d68a432c3b4e7c75385852a3f6f875a77269cabdfef4e91d229c93275236f04df50d5ff527cee7ba3a3100f41151e6f50f3d5947df0cbba83a304252e
|
|
@@ -125,7 +125,7 @@ jobs:
|
|
|
125
125
|
- name: Set up Ruby
|
|
126
126
|
uses: ruby/setup-ruby@v1
|
|
127
127
|
with:
|
|
128
|
-
ruby-version: '3.
|
|
128
|
+
ruby-version: '3.2'
|
|
129
129
|
rubygems: latest
|
|
130
130
|
bundler-cache: false
|
|
131
131
|
- name: Install gems
|
|
@@ -178,7 +178,8 @@ jobs:
|
|
|
178
178
|
uses: ruby/setup-ruby@v1
|
|
179
179
|
with:
|
|
180
180
|
# solargraph-rails supports Ruby 3.0+
|
|
181
|
-
|
|
181
|
+
# This job uses 3.2 due to a problem compiling sqlite3 in earlier versions
|
|
182
|
+
ruby-version: '3.2'
|
|
182
183
|
bundler-cache: false
|
|
183
184
|
bundler: latest
|
|
184
185
|
env:
|
data/CHANGELOG.md
CHANGED
data/lib/solargraph/bench.rb
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
module Solargraph
|
|
5
|
-
# A container of source maps and workspace data to be cataloged in an ApiMap.
|
|
6
|
-
#
|
|
7
|
-
class Bench
|
|
8
|
-
# @return [Set<SourceMap>]
|
|
9
|
-
attr_reader :source_maps
|
|
10
|
-
|
|
11
|
-
# @return [Workspace]
|
|
12
|
-
attr_reader :workspace
|
|
13
|
-
|
|
14
|
-
# @return [SourceMap]
|
|
15
|
-
attr_reader :live_map
|
|
16
|
-
|
|
17
|
-
# @return [Set<String>]
|
|
18
|
-
attr_reader :external_requires
|
|
19
|
-
|
|
20
|
-
# @param source_maps [Array<SourceMap>, Set<SourceMap>]
|
|
21
|
-
# @param workspace [Workspace]
|
|
22
|
-
# @param live_map [SourceMap, nil]
|
|
23
|
-
# @param external_requires [Array<String>, Set<String>]
|
|
24
|
-
def initialize source_maps: [], workspace: Workspace.new, live_map: nil, external_requires: []
|
|
25
|
-
@source_maps = source_maps.to_set
|
|
26
|
-
@workspace = workspace
|
|
27
|
-
@live_map = live_map
|
|
28
|
-
@external_requires = external_requires.reject { |path| workspace.would_require?(path) }
|
|
29
|
-
.compact
|
|
30
|
-
.to_set
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# @return [Hash{String => SourceMap}]
|
|
34
|
-
def source_map_hash
|
|
35
|
-
# @todo Work around #to_h bug in current Ruby head (3.5) with #map#to_h
|
|
36
|
-
@source_map_hash ||= source_maps.map { |s| [s.filename, s] }
|
|
37
|
-
.to_h
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# @return [Set<SourceMap>]
|
|
41
|
-
def icebox
|
|
42
|
-
@icebox ||= (source_maps - [live_map])
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
module Solargraph
|
|
5
|
+
# A container of source maps and workspace data to be cataloged in an ApiMap.
|
|
6
|
+
#
|
|
7
|
+
class Bench
|
|
8
|
+
# @return [Set<SourceMap>]
|
|
9
|
+
attr_reader :source_maps
|
|
10
|
+
|
|
11
|
+
# @return [Workspace]
|
|
12
|
+
attr_reader :workspace
|
|
13
|
+
|
|
14
|
+
# @return [SourceMap]
|
|
15
|
+
attr_reader :live_map
|
|
16
|
+
|
|
17
|
+
# @return [Set<String>]
|
|
18
|
+
attr_reader :external_requires
|
|
19
|
+
|
|
20
|
+
# @param source_maps [Array<SourceMap>, Set<SourceMap>]
|
|
21
|
+
# @param workspace [Workspace]
|
|
22
|
+
# @param live_map [SourceMap, nil]
|
|
23
|
+
# @param external_requires [Array<String>, Set<String>]
|
|
24
|
+
def initialize source_maps: [], workspace: Workspace.new, live_map: nil, external_requires: []
|
|
25
|
+
@source_maps = source_maps.to_set
|
|
26
|
+
@workspace = workspace
|
|
27
|
+
@live_map = live_map
|
|
28
|
+
@external_requires = external_requires.reject { |path| workspace.would_require?(path) }
|
|
29
|
+
.compact
|
|
30
|
+
.to_set
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# @return [Hash{String => SourceMap}]
|
|
34
|
+
def source_map_hash
|
|
35
|
+
# @todo Work around #to_h bug in current Ruby head (3.5) with #map#to_h
|
|
36
|
+
@source_map_hash ||= source_maps.map { |s| [s.filename, s] }
|
|
37
|
+
.to_h
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# @return [Set<SourceMap>]
|
|
41
|
+
def icebox
|
|
42
|
+
@icebox ||= (source_maps - [live_map])
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Solargraph
|
|
4
|
-
module Convention
|
|
5
|
-
module DataDefinition
|
|
6
|
-
# A node wrapper for a Data definition via const assignment.
|
|
7
|
-
# @example
|
|
8
|
-
# MyData = Data.new(:bar, :baz) do
|
|
9
|
-
# def foo
|
|
10
|
-
# end
|
|
11
|
-
# end
|
|
12
|
-
class DataAssignmentNode < DataDefintionNode
|
|
13
|
-
class << self
|
|
14
|
-
# @example
|
|
15
|
-
# s(:casgn, nil, :Foo,
|
|
16
|
-
# s(:block,
|
|
17
|
-
# s(:send,
|
|
18
|
-
# s(:const, nil, :Data), :define,
|
|
19
|
-
# s(:sym, :bar),
|
|
20
|
-
# s(:sym, :baz)),
|
|
21
|
-
# s(:args),
|
|
22
|
-
# s(:def, :foo,
|
|
23
|
-
# s(:args),
|
|
24
|
-
# s(:send, nil, :bar))))
|
|
25
|
-
# @param node [::Parser::AST::Node]
|
|
26
|
-
def match?(node)
|
|
27
|
-
return false unless node&.type == :casgn
|
|
28
|
-
return false if node.children[2].nil?
|
|
29
|
-
|
|
30
|
-
data_node = if node.children[2].type == :block
|
|
31
|
-
node.children[2].children[0]
|
|
32
|
-
else
|
|
33
|
-
node.children[2]
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
data_definition_node?(data_node)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def class_name
|
|
41
|
-
if node.children[0]
|
|
42
|
-
Parser::NodeMethods.unpack_name(node.children[0]) + "::#{node.children[1]}"
|
|
43
|
-
else
|
|
44
|
-
node.children[1].to_s
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
private
|
|
49
|
-
|
|
50
|
-
# @return [Parser::AST::Node]
|
|
51
|
-
def data_node
|
|
52
|
-
if node.children[2].type == :block
|
|
53
|
-
node.children[2].children[0]
|
|
54
|
-
else
|
|
55
|
-
node.children[2]
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solargraph
|
|
4
|
+
module Convention
|
|
5
|
+
module DataDefinition
|
|
6
|
+
# A node wrapper for a Data definition via const assignment.
|
|
7
|
+
# @example
|
|
8
|
+
# MyData = Data.new(:bar, :baz) do
|
|
9
|
+
# def foo
|
|
10
|
+
# end
|
|
11
|
+
# end
|
|
12
|
+
class DataAssignmentNode < DataDefintionNode
|
|
13
|
+
class << self
|
|
14
|
+
# @example
|
|
15
|
+
# s(:casgn, nil, :Foo,
|
|
16
|
+
# s(:block,
|
|
17
|
+
# s(:send,
|
|
18
|
+
# s(:const, nil, :Data), :define,
|
|
19
|
+
# s(:sym, :bar),
|
|
20
|
+
# s(:sym, :baz)),
|
|
21
|
+
# s(:args),
|
|
22
|
+
# s(:def, :foo,
|
|
23
|
+
# s(:args),
|
|
24
|
+
# s(:send, nil, :bar))))
|
|
25
|
+
# @param node [::Parser::AST::Node]
|
|
26
|
+
def match?(node)
|
|
27
|
+
return false unless node&.type == :casgn
|
|
28
|
+
return false if node.children[2].nil?
|
|
29
|
+
|
|
30
|
+
data_node = if node.children[2].type == :block
|
|
31
|
+
node.children[2].children[0]
|
|
32
|
+
else
|
|
33
|
+
node.children[2]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
data_definition_node?(data_node)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def class_name
|
|
41
|
+
if node.children[0]
|
|
42
|
+
Parser::NodeMethods.unpack_name(node.children[0]) + "::#{node.children[1]}"
|
|
43
|
+
else
|
|
44
|
+
node.children[1].to_s
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
# @return [Parser::AST::Node]
|
|
51
|
+
def data_node
|
|
52
|
+
if node.children[2].type == :block
|
|
53
|
+
node.children[2].children[0]
|
|
54
|
+
else
|
|
55
|
+
node.children[2]
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Solargraph
|
|
4
|
-
module Convention
|
|
5
|
-
class Gemfile < Base
|
|
6
|
-
def local source_map
|
|
7
|
-
return EMPTY_ENVIRON unless File.basename(source_map.filename) == 'Gemfile'
|
|
8
|
-
@environ ||= Environ.new(
|
|
9
|
-
requires: ['bundler'],
|
|
10
|
-
domains: ['Bundler::Dsl']
|
|
11
|
-
)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solargraph
|
|
4
|
+
module Convention
|
|
5
|
+
class Gemfile < Base
|
|
6
|
+
def local source_map
|
|
7
|
+
return EMPTY_ENVIRON unless File.basename(source_map.filename) == 'Gemfile'
|
|
8
|
+
@environ ||= Environ.new(
|
|
9
|
+
requires: ['bundler'],
|
|
10
|
+
domains: ['Bundler::Dsl']
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Solargraph
|
|
4
|
-
module Convention
|
|
5
|
-
class Gemspec < Base
|
|
6
|
-
def local source_map
|
|
7
|
-
return Convention::Base::EMPTY_ENVIRON unless File.basename(source_map.filename).end_with?('.gemspec')
|
|
8
|
-
@environ ||= Environ.new(
|
|
9
|
-
requires: ['rubygems'],
|
|
10
|
-
pins: [
|
|
11
|
-
Solargraph::Pin::Reference::Override.from_comment(
|
|
12
|
-
'Gem::Specification.new',
|
|
13
|
-
%(
|
|
14
|
-
@yieldparam [self]
|
|
15
|
-
),
|
|
16
|
-
source: :gemspec
|
|
17
|
-
)
|
|
18
|
-
]
|
|
19
|
-
)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solargraph
|
|
4
|
+
module Convention
|
|
5
|
+
class Gemspec < Base
|
|
6
|
+
def local source_map
|
|
7
|
+
return Convention::Base::EMPTY_ENVIRON unless File.basename(source_map.filename).end_with?('.gemspec')
|
|
8
|
+
@environ ||= Environ.new(
|
|
9
|
+
requires: ['rubygems'],
|
|
10
|
+
pins: [
|
|
11
|
+
Solargraph::Pin::Reference::Override.from_comment(
|
|
12
|
+
'Gem::Specification.new',
|
|
13
|
+
%(
|
|
14
|
+
@yieldparam [self]
|
|
15
|
+
),
|
|
16
|
+
source: :gemspec
|
|
17
|
+
)
|
|
18
|
+
]
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Solargraph
|
|
4
|
-
module Convention
|
|
5
|
-
class Rakefile < Base
|
|
6
|
-
def local source_map
|
|
7
|
-
basename = File.basename(source_map.filename)
|
|
8
|
-
return EMPTY_ENVIRON unless basename.end_with?('.rake') || basename == 'Rakefile'
|
|
9
|
-
|
|
10
|
-
@environ ||= Environ.new(
|
|
11
|
-
requires: ['rake'],
|
|
12
|
-
domains: ['Rake::DSL']
|
|
13
|
-
)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solargraph
|
|
4
|
+
module Convention
|
|
5
|
+
class Rakefile < Base
|
|
6
|
+
def local source_map
|
|
7
|
+
basename = File.basename(source_map.filename)
|
|
8
|
+
return EMPTY_ENVIRON unless basename.end_with?('.rake') || basename == 'Rakefile'
|
|
9
|
+
|
|
10
|
+
@environ ||= Environ.new(
|
|
11
|
+
requires: ['rake'],
|
|
12
|
+
domains: ['Rake::DSL']
|
|
13
|
+
)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Solargraph
|
|
4
|
-
# Conventions provide a way to modify an ApiMap based on expectations about
|
|
5
|
-
# one of its sources.
|
|
6
|
-
#
|
|
7
|
-
module Convention
|
|
8
|
-
autoload :Base, 'solargraph/convention/base'
|
|
9
|
-
autoload :Gemfile, 'solargraph/convention/gemfile'
|
|
10
|
-
autoload :Gemspec, 'solargraph/convention/gemspec'
|
|
11
|
-
autoload :Rakefile, 'solargraph/convention/rakefile'
|
|
12
|
-
autoload :StructDefinition, 'solargraph/convention/struct_definition'
|
|
13
|
-
autoload :DataDefinition, 'solargraph/convention/data_definition'
|
|
14
|
-
autoload :ActiveSupportConcern, 'solargraph/convention/active_support_concern'
|
|
15
|
-
|
|
16
|
-
# @type [Set<Convention::Base>]
|
|
17
|
-
@@conventions = Set.new
|
|
18
|
-
|
|
19
|
-
# @param convention [Class<Convention::Base>]
|
|
20
|
-
# @return [void]
|
|
21
|
-
def self.register convention
|
|
22
|
-
@@conventions.add convention.new
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# @param convention [Class<Convention::Base>]
|
|
26
|
-
# @return [void]
|
|
27
|
-
def self.unregister convention
|
|
28
|
-
@@conventions.delete_if { |c| c.is_a?(convention) }
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# @param source_map [SourceMap]
|
|
32
|
-
# @return [Environ]
|
|
33
|
-
def self.for_local(source_map)
|
|
34
|
-
result = Environ.new
|
|
35
|
-
@@conventions.each do |conv|
|
|
36
|
-
result.merge conv.local(source_map)
|
|
37
|
-
end
|
|
38
|
-
result
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
# @param doc_map [DocMap]
|
|
42
|
-
# @return [Environ]
|
|
43
|
-
def self.for_global(doc_map)
|
|
44
|
-
result = Environ.new
|
|
45
|
-
@@conventions.each do |conv|
|
|
46
|
-
result.merge conv.global(doc_map)
|
|
47
|
-
end
|
|
48
|
-
result
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
# Provides any additional method pins based on the described object.
|
|
52
|
-
#
|
|
53
|
-
# @param api_map [ApiMap]
|
|
54
|
-
# @param rooted_tag [String] A fully qualified namespace, with
|
|
55
|
-
# generic parameter values if applicable
|
|
56
|
-
# @param scope [Symbol] :class or :instance
|
|
57
|
-
# @param visibility [Array<Symbol>] :public, :protected, and/or :private
|
|
58
|
-
# @param deep [Boolean]
|
|
59
|
-
# @param skip [Set<String>]
|
|
60
|
-
# @param no_core [Boolean] Skip core classes if true
|
|
61
|
-
#
|
|
62
|
-
# @return [Environ]
|
|
63
|
-
def self.for_object api_map, rooted_tag, scope, visibility,
|
|
64
|
-
deep, skip, no_core
|
|
65
|
-
result = Environ.new
|
|
66
|
-
@@conventions.each do |conv|
|
|
67
|
-
result.merge conv.object(api_map, rooted_tag, scope, visibility,
|
|
68
|
-
deep, skip, no_core)
|
|
69
|
-
end
|
|
70
|
-
result
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
register Gemfile
|
|
74
|
-
register Gemspec
|
|
75
|
-
register Rakefile
|
|
76
|
-
register ActiveSupportConcern
|
|
77
|
-
end
|
|
78
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solargraph
|
|
4
|
+
# Conventions provide a way to modify an ApiMap based on expectations about
|
|
5
|
+
# one of its sources.
|
|
6
|
+
#
|
|
7
|
+
module Convention
|
|
8
|
+
autoload :Base, 'solargraph/convention/base'
|
|
9
|
+
autoload :Gemfile, 'solargraph/convention/gemfile'
|
|
10
|
+
autoload :Gemspec, 'solargraph/convention/gemspec'
|
|
11
|
+
autoload :Rakefile, 'solargraph/convention/rakefile'
|
|
12
|
+
autoload :StructDefinition, 'solargraph/convention/struct_definition'
|
|
13
|
+
autoload :DataDefinition, 'solargraph/convention/data_definition'
|
|
14
|
+
autoload :ActiveSupportConcern, 'solargraph/convention/active_support_concern'
|
|
15
|
+
|
|
16
|
+
# @type [Set<Convention::Base>]
|
|
17
|
+
@@conventions = Set.new
|
|
18
|
+
|
|
19
|
+
# @param convention [Class<Convention::Base>]
|
|
20
|
+
# @return [void]
|
|
21
|
+
def self.register convention
|
|
22
|
+
@@conventions.add convention.new
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# @param convention [Class<Convention::Base>]
|
|
26
|
+
# @return [void]
|
|
27
|
+
def self.unregister convention
|
|
28
|
+
@@conventions.delete_if { |c| c.is_a?(convention) }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# @param source_map [SourceMap]
|
|
32
|
+
# @return [Environ]
|
|
33
|
+
def self.for_local(source_map)
|
|
34
|
+
result = Environ.new
|
|
35
|
+
@@conventions.each do |conv|
|
|
36
|
+
result.merge conv.local(source_map)
|
|
37
|
+
end
|
|
38
|
+
result
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# @param doc_map [DocMap]
|
|
42
|
+
# @return [Environ]
|
|
43
|
+
def self.for_global(doc_map)
|
|
44
|
+
result = Environ.new
|
|
45
|
+
@@conventions.each do |conv|
|
|
46
|
+
result.merge conv.global(doc_map)
|
|
47
|
+
end
|
|
48
|
+
result
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Provides any additional method pins based on the described object.
|
|
52
|
+
#
|
|
53
|
+
# @param api_map [ApiMap]
|
|
54
|
+
# @param rooted_tag [String] A fully qualified namespace, with
|
|
55
|
+
# generic parameter values if applicable
|
|
56
|
+
# @param scope [Symbol] :class or :instance
|
|
57
|
+
# @param visibility [Array<Symbol>] :public, :protected, and/or :private
|
|
58
|
+
# @param deep [Boolean]
|
|
59
|
+
# @param skip [Set<String>]
|
|
60
|
+
# @param no_core [Boolean] Skip core classes if true
|
|
61
|
+
#
|
|
62
|
+
# @return [Environ]
|
|
63
|
+
def self.for_object api_map, rooted_tag, scope, visibility,
|
|
64
|
+
deep, skip, no_core
|
|
65
|
+
result = Environ.new
|
|
66
|
+
@@conventions.each do |conv|
|
|
67
|
+
result.merge conv.object(api_map, rooted_tag, scope, visibility,
|
|
68
|
+
deep, skip, no_core)
|
|
69
|
+
end
|
|
70
|
+
result
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
register Gemfile
|
|
74
|
+
register Gemspec
|
|
75
|
+
register Rakefile
|
|
76
|
+
register ActiveSupportConcern
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
require 'nokogiri'
|
|
2
|
-
|
|
3
|
-
module ReverseMarkdown
|
|
4
|
-
module Converters
|
|
5
|
-
class Dd < Base
|
|
6
|
-
# @return [String]
|
|
7
|
-
# @param node [Nokogiri::XML::Element]
|
|
8
|
-
# @param state [Hash]
|
|
9
|
-
def convert node, state = {}
|
|
10
|
-
content = treat_children(node, state)
|
|
11
|
-
": #{content.strip}\n"
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
ReverseMarkdown::Converters.register :dd, ReverseMarkdown::Converters::Dd.new
|
|
1
|
+
require 'nokogiri'
|
|
2
|
+
|
|
3
|
+
module ReverseMarkdown
|
|
4
|
+
module Converters
|
|
5
|
+
class Dd < Base
|
|
6
|
+
# @return [String]
|
|
7
|
+
# @param node [Nokogiri::XML::Element]
|
|
8
|
+
# @param state [Hash]
|
|
9
|
+
def convert node, state = {}
|
|
10
|
+
content = treat_children(node, state)
|
|
11
|
+
": #{content.strip}\n"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
ReverseMarkdown::Converters.register :dd, ReverseMarkdown::Converters::Dd.new
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
module ReverseMarkdown
|
|
2
|
-
module Converters
|
|
3
|
-
class Dl < Base
|
|
4
|
-
# @return [String]
|
|
5
|
-
# @param node [Nokogiri::XML::Element]
|
|
6
|
-
# @param state [Hash]
|
|
7
|
-
def convert node, state = {}
|
|
8
|
-
content = treat_children(node, state).strip
|
|
9
|
-
"\n\n#{content}\n"
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
ReverseMarkdown::Converters.register :dl, ReverseMarkdown::Converters::Dl.new
|
|
1
|
+
module ReverseMarkdown
|
|
2
|
+
module Converters
|
|
3
|
+
class Dl < Base
|
|
4
|
+
# @return [String]
|
|
5
|
+
# @param node [Nokogiri::XML::Element]
|
|
6
|
+
# @param state [Hash]
|
|
7
|
+
def convert node, state = {}
|
|
8
|
+
content = treat_children(node, state).strip
|
|
9
|
+
"\n\n#{content}\n"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
ReverseMarkdown::Converters.register :dl, ReverseMarkdown::Converters::Dl.new
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
module ReverseMarkdown
|
|
2
|
-
module Converters
|
|
3
|
-
class Dt < Base
|
|
4
|
-
# @return [String]
|
|
5
|
-
# @param node [Nokogiri::XML::Element]
|
|
6
|
-
# @param state [Hash]
|
|
7
|
-
def convert node, state = {}
|
|
8
|
-
content = treat_children(node, state)
|
|
9
|
-
"\n#{content.strip}\n"
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
ReverseMarkdown::Converters.register :dt, ReverseMarkdown::Converters::Dt.new
|
|
1
|
+
module ReverseMarkdown
|
|
2
|
+
module Converters
|
|
3
|
+
class Dt < Base
|
|
4
|
+
# @return [String]
|
|
5
|
+
# @param node [Nokogiri::XML::Element]
|
|
6
|
+
# @param state [Hash]
|
|
7
|
+
def convert node, state = {}
|
|
8
|
+
content = treat_children(node, state)
|
|
9
|
+
"\n#{content.strip}\n"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
ReverseMarkdown::Converters.register :dt, ReverseMarkdown::Converters::Dt.new
|
|
@@ -1 +1 @@
|
|
|
1
|
-
ReverseMarkdown::Converters.register :tt, ReverseMarkdown::Converters::Code.new
|
|
1
|
+
ReverseMarkdown::Converters.register :tt, ReverseMarkdown::Converters::Code.new
|