rubydex 0.1.0.beta11 → 0.1.0.beta13
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/LICENSE.txt +23 -23
- data/README.md +125 -125
- data/THIRD_PARTY_LICENSES.html +2018 -945
- data/exe/rdx +47 -47
- data/ext/rubydex/declaration.c +453 -388
- data/ext/rubydex/declaration.h +23 -23
- data/ext/rubydex/definition.c +284 -197
- data/ext/rubydex/definition.h +28 -28
- data/ext/rubydex/diagnostic.c +6 -6
- data/ext/rubydex/diagnostic.h +11 -11
- data/ext/rubydex/document.c +97 -98
- data/ext/rubydex/document.h +10 -10
- data/ext/rubydex/extconf.rb +146 -127
- data/ext/rubydex/graph.c +701 -512
- data/ext/rubydex/graph.h +10 -10
- data/ext/rubydex/handle.h +44 -44
- data/ext/rubydex/location.c +22 -22
- data/ext/rubydex/location.h +15 -15
- data/ext/rubydex/reference.c +123 -104
- data/ext/rubydex/reference.h +15 -16
- data/ext/rubydex/rubydex.c +22 -22
- data/ext/rubydex/utils.c +108 -86
- data/ext/rubydex/utils.h +34 -28
- data/lib/rubydex/comment.rb +17 -17
- data/lib/rubydex/declaration.rb +11 -0
- data/lib/rubydex/diagnostic.rb +21 -21
- data/lib/rubydex/failures.rb +15 -15
- data/lib/rubydex/graph.rb +98 -92
- data/lib/rubydex/keyword.rb +17 -0
- data/lib/rubydex/keyword_parameter.rb +13 -0
- data/lib/rubydex/location.rb +90 -90
- data/lib/rubydex/mixin.rb +22 -0
- data/lib/rubydex/version.rb +5 -5
- data/lib/rubydex.rb +24 -20
- data/rbi/rubydex.rbi +425 -310
- data/rust/Cargo.lock +1851 -1851
- data/rust/Cargo.toml +29 -29
- data/rust/about.toml +10 -10
- data/rust/{about.hbs → about_templates/about.hbs} +81 -78
- data/rust/about_templates/mingw_licenses.hbs +1071 -0
- data/rust/rubydex/Cargo.toml +42 -42
- data/rust/rubydex/src/compile_assertions.rs +13 -13
- data/rust/rubydex/src/diagnostic.rs +110 -109
- data/rust/rubydex/src/errors.rs +28 -28
- data/rust/rubydex/src/indexing/local_graph.rs +224 -224
- data/rust/rubydex/src/indexing/rbs_indexer.rs +1551 -1554
- data/rust/rubydex/src/indexing/ruby_indexer.rs +2329 -6753
- data/rust/rubydex/src/indexing/ruby_indexer_tests.rs +4962 -0
- data/rust/rubydex/src/indexing.rs +210 -210
- data/rust/rubydex/src/integrity.rs +279 -278
- data/rust/rubydex/src/job_queue.rs +199 -205
- data/rust/rubydex/src/lib.rs +17 -17
- data/rust/rubydex/src/listing.rs +371 -272
- data/rust/rubydex/src/main.rs +160 -160
- data/rust/rubydex/src/model/built_in.rs +83 -0
- data/rust/rubydex/src/model/comment.rs +24 -24
- data/rust/rubydex/src/model/declaration.rs +679 -588
- data/rust/rubydex/src/model/definitions.rs +1682 -1602
- data/rust/rubydex/src/model/document.rs +222 -252
- data/rust/rubydex/src/model/encoding.rs +22 -22
- data/rust/rubydex/src/model/graph.rs +3782 -3556
- data/rust/rubydex/src/model/id.rs +110 -110
- data/rust/rubydex/src/model/identity_maps.rs +58 -58
- data/rust/rubydex/src/model/ids.rs +60 -38
- data/rust/rubydex/src/model/keywords.rs +256 -256
- data/rust/rubydex/src/model/name.rs +298 -298
- data/rust/rubydex/src/model/references.rs +111 -111
- data/rust/rubydex/src/model/string_ref.rs +50 -50
- data/rust/rubydex/src/model/visibility.rs +41 -41
- data/rust/rubydex/src/model.rs +15 -14
- data/rust/rubydex/src/offset.rs +147 -147
- data/rust/rubydex/src/position.rs +6 -6
- data/rust/rubydex/src/query.rs +1841 -1700
- data/rust/rubydex/src/resolution.rs +1852 -5895
- data/rust/rubydex/src/resolution_tests.rs +4701 -0
- data/rust/rubydex/src/stats/memory.rs +71 -71
- data/rust/rubydex/src/stats/orphan_report.rs +264 -263
- data/rust/rubydex/src/stats/timer.rs +127 -127
- data/rust/rubydex/src/stats.rs +11 -11
- data/rust/rubydex/src/test_utils/context.rs +226 -226
- data/rust/rubydex/src/test_utils/graph_test.rs +730 -679
- data/rust/rubydex/src/test_utils/local_graph_test.rs +602 -602
- data/rust/rubydex/src/test_utils.rs +52 -52
- data/rust/rubydex/src/visualization/dot.rs +192 -176
- data/rust/rubydex/src/visualization.rs +6 -6
- data/rust/rubydex/tests/cli.rs +185 -167
- data/rust/rubydex-mcp/Cargo.toml +28 -28
- data/rust/rubydex-mcp/src/main.rs +48 -48
- data/rust/rubydex-mcp/src/server.rs +1145 -1145
- data/rust/rubydex-mcp/src/tools.rs +49 -49
- data/rust/rubydex-mcp/tests/mcp.rs +302 -302
- data/rust/rubydex-sys/Cargo.toml +20 -20
- data/rust/rubydex-sys/build.rs +14 -14
- data/rust/rubydex-sys/cbindgen.toml +12 -12
- data/rust/rubydex-sys/src/declaration_api.rs +485 -469
- data/rust/rubydex-sys/src/definition_api.rs +443 -352
- data/rust/rubydex-sys/src/diagnostic_api.rs +99 -99
- data/rust/rubydex-sys/src/document_api.rs +85 -54
- data/rust/rubydex-sys/src/graph_api.rs +1017 -700
- data/rust/rubydex-sys/src/lib.rs +79 -9
- data/rust/rubydex-sys/src/location_api.rs +79 -79
- data/rust/rubydex-sys/src/name_api.rs +187 -135
- data/rust/rubydex-sys/src/reference_api.rs +267 -195
- data/rust/rubydex-sys/src/utils.rs +70 -70
- data/rust/rustfmt.toml +2 -2
- metadata +16 -9
- data/lib/rubydex/librubydex_sys.so +0 -0
data/lib/rubydex/location.rb
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Rubydex
|
|
4
|
-
# A zero based internal location. Intended to be used for tool-to-tool communication, such as a language server
|
|
5
|
-
# communicating with an editor.
|
|
6
|
-
class Location
|
|
7
|
-
class NotFileUriError < StandardError; end
|
|
8
|
-
|
|
9
|
-
include Comparable
|
|
10
|
-
|
|
11
|
-
#: String
|
|
12
|
-
attr_reader :uri
|
|
13
|
-
|
|
14
|
-
#: Integer
|
|
15
|
-
attr_reader :start_line, :end_line, :start_column, :end_column
|
|
16
|
-
|
|
17
|
-
#: (?uri: String, ?start_line: Integer, ?end_line: Integer, ?start_column: Integer, ?end_column: Integer) -> void
|
|
18
|
-
def initialize(uri:, start_line:, end_line:, start_column:, end_column:)
|
|
19
|
-
@uri = uri
|
|
20
|
-
@start_line = start_line
|
|
21
|
-
@end_line = end_line
|
|
22
|
-
@start_column = start_column
|
|
23
|
-
@end_column = end_column
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
#: () -> String
|
|
27
|
-
def to_file_path
|
|
28
|
-
uri = URI(@uri)
|
|
29
|
-
raise NotFileUriError, "URI is not a file:// URI: #{@uri}" unless uri.scheme == "file"
|
|
30
|
-
|
|
31
|
-
path = uri.path
|
|
32
|
-
# TODO: This has to go away once we have a proper URI abstraction
|
|
33
|
-
path.delete_prefix!("/") if Gem.win_platform?
|
|
34
|
-
path
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
#: (other: BasicObject) -> Integer
|
|
38
|
-
def <=>(other)
|
|
39
|
-
return -1 unless other.is_a?(Location)
|
|
40
|
-
|
|
41
|
-
comparable_values <=> other.comparable_values
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
#: () -> [String, Integer, Integer, Integer, Integer]
|
|
45
|
-
def comparable_values
|
|
46
|
-
[@uri, @start_line, @start_column, @end_line, @end_column]
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
# Turns this zero based location into a one based location for display purposes.
|
|
50
|
-
#
|
|
51
|
-
#: () -> DisplayLocation
|
|
52
|
-
def to_display
|
|
53
|
-
DisplayLocation.new(
|
|
54
|
-
uri: @uri,
|
|
55
|
-
start_line: @start_line + 1,
|
|
56
|
-
end_line: @end_line + 1,
|
|
57
|
-
start_column: @start_column + 1,
|
|
58
|
-
end_column: @end_column + 1,
|
|
59
|
-
)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
#: -> String
|
|
63
|
-
def to_s
|
|
64
|
-
"#{to_file_path}:#{@start_line + 1}:#{@start_column + 1}-#{@end_line + 1}:#{@end_column + 1}"
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# A one based location intended for display purposes. This is what should be used when displaying a location to users,
|
|
69
|
-
# like in CLIs
|
|
70
|
-
class DisplayLocation < Location
|
|
71
|
-
# Returns itself
|
|
72
|
-
#
|
|
73
|
-
#: () -> DisplayLocation
|
|
74
|
-
def to_display
|
|
75
|
-
self
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
# Normalize to zero-based for comparison with Location
|
|
79
|
-
#
|
|
80
|
-
#: () -> [String, Integer, Integer, Integer, Integer]
|
|
81
|
-
def comparable_values
|
|
82
|
-
[@uri, @start_line - 1, @start_column - 1, @end_line - 1, @end_column - 1]
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
#: -> String
|
|
86
|
-
def to_s
|
|
87
|
-
"#{to_file_path}:#{@start_line}:#{@start_column}-#{@end_line}:#{@end_column}"
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rubydex
|
|
4
|
+
# A zero based internal location. Intended to be used for tool-to-tool communication, such as a language server
|
|
5
|
+
# communicating with an editor.
|
|
6
|
+
class Location
|
|
7
|
+
class NotFileUriError < StandardError; end
|
|
8
|
+
|
|
9
|
+
include Comparable
|
|
10
|
+
|
|
11
|
+
#: String
|
|
12
|
+
attr_reader :uri
|
|
13
|
+
|
|
14
|
+
#: Integer
|
|
15
|
+
attr_reader :start_line, :end_line, :start_column, :end_column
|
|
16
|
+
|
|
17
|
+
#: (?uri: String, ?start_line: Integer, ?end_line: Integer, ?start_column: Integer, ?end_column: Integer) -> void
|
|
18
|
+
def initialize(uri:, start_line:, end_line:, start_column:, end_column:)
|
|
19
|
+
@uri = uri
|
|
20
|
+
@start_line = start_line
|
|
21
|
+
@end_line = end_line
|
|
22
|
+
@start_column = start_column
|
|
23
|
+
@end_column = end_column
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
#: () -> String
|
|
27
|
+
def to_file_path
|
|
28
|
+
uri = URI(@uri)
|
|
29
|
+
raise NotFileUriError, "URI is not a file:// URI: #{@uri}" unless uri.scheme == "file"
|
|
30
|
+
|
|
31
|
+
path = uri.path
|
|
32
|
+
# TODO: This has to go away once we have a proper URI abstraction
|
|
33
|
+
path.delete_prefix!("/") if Gem.win_platform?
|
|
34
|
+
path
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
#: (other: BasicObject) -> Integer
|
|
38
|
+
def <=>(other)
|
|
39
|
+
return -1 unless other.is_a?(Location)
|
|
40
|
+
|
|
41
|
+
comparable_values <=> other.comparable_values
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
#: () -> [String, Integer, Integer, Integer, Integer]
|
|
45
|
+
def comparable_values
|
|
46
|
+
[@uri, @start_line, @start_column, @end_line, @end_column]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Turns this zero based location into a one based location for display purposes.
|
|
50
|
+
#
|
|
51
|
+
#: () -> DisplayLocation
|
|
52
|
+
def to_display
|
|
53
|
+
DisplayLocation.new(
|
|
54
|
+
uri: @uri,
|
|
55
|
+
start_line: @start_line + 1,
|
|
56
|
+
end_line: @end_line + 1,
|
|
57
|
+
start_column: @start_column + 1,
|
|
58
|
+
end_column: @end_column + 1,
|
|
59
|
+
)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
#: -> String
|
|
63
|
+
def to_s
|
|
64
|
+
"#{to_file_path}:#{@start_line + 1}:#{@start_column + 1}-#{@end_line + 1}:#{@end_column + 1}"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# A one based location intended for display purposes. This is what should be used when displaying a location to users,
|
|
69
|
+
# like in CLIs
|
|
70
|
+
class DisplayLocation < Location
|
|
71
|
+
# Returns itself
|
|
72
|
+
#
|
|
73
|
+
#: () -> DisplayLocation
|
|
74
|
+
def to_display
|
|
75
|
+
self
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Normalize to zero-based for comparison with Location
|
|
79
|
+
#
|
|
80
|
+
#: () -> [String, Integer, Integer, Integer, Integer]
|
|
81
|
+
def comparable_values
|
|
82
|
+
[@uri, @start_line - 1, @start_column - 1, @end_line - 1, @end_column - 1]
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
#: -> String
|
|
86
|
+
def to_s
|
|
87
|
+
"#{to_file_path}:#{@start_line}:#{@start_column}-#{@end_line}:#{@end_column}"
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rubydex
|
|
4
|
+
class Mixin
|
|
5
|
+
#: ConstantReference
|
|
6
|
+
attr_reader :constant_reference
|
|
7
|
+
|
|
8
|
+
#: (ConstantReference) -> void
|
|
9
|
+
def initialize(constant_reference)
|
|
10
|
+
@constant_reference = constant_reference
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Represents `include SomeModule`
|
|
15
|
+
class Include < Mixin; end
|
|
16
|
+
|
|
17
|
+
# Represents `prepend SomeModule`
|
|
18
|
+
class Prepend < Mixin; end
|
|
19
|
+
|
|
20
|
+
# Represents `extend SomeModule`
|
|
21
|
+
class Extend < Mixin; end
|
|
22
|
+
end
|
data/lib/rubydex/version.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Rubydex
|
|
4
|
-
VERSION = "0.1.0.
|
|
5
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rubydex
|
|
4
|
+
VERSION = "0.1.0.beta13"
|
|
5
|
+
end
|
data/lib/rubydex.rb
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "bundler"
|
|
4
|
-
require "uri"
|
|
5
|
-
require "rubydex/version"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
require "rubydex/
|
|
18
|
-
require "rubydex/
|
|
19
|
-
require "rubydex/
|
|
20
|
-
require "rubydex/
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler"
|
|
4
|
+
require "uri"
|
|
5
|
+
require "rubydex/version"
|
|
6
|
+
require "rubydex/mixin"
|
|
7
|
+
|
|
8
|
+
begin
|
|
9
|
+
# Load the precompiled version of the library
|
|
10
|
+
ruby_version = /(\d+\.\d+)/.match(RUBY_VERSION)
|
|
11
|
+
require "rubydex/#{ruby_version}/rubydex"
|
|
12
|
+
rescue LoadError
|
|
13
|
+
# It's important to leave for users that can not or don't want to use the gem with precompiled binaries.
|
|
14
|
+
require "rubydex/rubydex"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
require "rubydex/failures"
|
|
18
|
+
require "rubydex/location"
|
|
19
|
+
require "rubydex/comment"
|
|
20
|
+
require "rubydex/diagnostic"
|
|
21
|
+
require "rubydex/keyword"
|
|
22
|
+
require "rubydex/keyword_parameter"
|
|
23
|
+
require "rubydex/graph"
|
|
24
|
+
require "rubydex/declaration"
|