steep 1.3.0 → 1.4.0.dev.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-windows.yml +1 -0
- data/.github/workflows/ruby.yml +1 -5
- data/Gemfile +3 -1
- data/Gemfile.lock +22 -19
- data/Gemfile.steep +2 -1
- data/Gemfile.steep.lock +18 -14
- data/Steepfile +16 -0
- data/bin/rbs +21 -0
- data/bin/setup +1 -1
- data/lib/steep/annotation_parser.rb +40 -20
- data/lib/steep/ast/types/factory.rb +56 -10
- data/lib/steep/ast/types/name.rb +10 -0
- data/lib/steep/diagnostic/ruby.rb +1 -1
- data/lib/steep/diagnostic/signature.rb +40 -0
- data/lib/steep/index/rbs_index.rb +25 -9
- data/lib/steep/index/signature_symbol_provider.rb +1 -1
- data/lib/steep/project/dsl.rb +12 -4
- data/lib/steep/project/options.rb +3 -1
- data/lib/steep/project/target.rb +1 -3
- data/lib/steep/server/interaction_worker.rb +37 -20
- data/lib/steep/server/lsp_formatter.rb +14 -5
- data/lib/steep/services/completion_provider.rb +10 -12
- data/lib/steep/services/goto_service.rb +15 -14
- data/lib/steep/services/hover_provider/rbs.rb +29 -9
- data/lib/steep/services/hover_provider/ruby.rb +16 -10
- data/lib/steep/services/signature_service.rb +36 -39
- data/lib/steep/signature/validator.rb +28 -6
- data/lib/steep/subtyping/check.rb +1 -1
- data/lib/steep/type_construction.rb +16 -14
- data/lib/steep/type_inference/constant_env.rb +7 -3
- data/lib/steep/version.rb +1 -1
- data/rbs_collection.steep.lock.yaml +48 -51
- data/rbs_collection.steep.yaml +3 -1
- data/sample/lib/conference.rb +10 -0
- data/sample/sig/conference.rbs +23 -0
- data/sig/steep/annotation_parser.rbs +3 -2
- data/sig/steep/ast/annotation/collection.rbs +1 -1
- data/sig/steep/ast/types/factory.rbs +2 -0
- data/sig/steep/ast/types/name.rbs +4 -0
- data/sig/steep/diagnostic/signature.rbs +18 -14
- data/sig/steep/index/rbs_index.rbs +92 -42
- data/sig/steep/project/dsl.rbs +35 -30
- data/sig/steep/project/options.rbs +16 -4
- data/sig/steep/project/target.rbs +7 -7
- data/sig/steep/server/interaction_worker.rbs +2 -2
- data/sig/steep/server/lsp_formatter.rbs +4 -2
- data/sig/steep/services/completion_provider.rbs +6 -0
- data/sig/steep/services/hover_provider/rbs.rbs +6 -4
- data/sig/steep/services/hover_provider/ruby.rbs +8 -4
- data/sig/steep/services/signature_service.rbs +27 -3
- data/sig/steep/signature/validator.rbs +9 -5
- data/sig/steep/type_construction.rbs +1 -1
- data/sig/steep/type_inference/constant_env.rbs +2 -0
- data/smoke/diagnostics-rbs/test_expectations.yml +1 -1
- data/smoke/regexp/a.rb +2 -2
- data/steep.gemspec +2 -1
- metadata +21 -6
@@ -146,23 +146,11 @@ module Steep
|
|
146
146
|
class ModuleSelfTypeError < Base
|
147
147
|
attr_reader name: RBS::TypeName
|
148
148
|
|
149
|
-
attr_reader ancestor: RBS::
|
149
|
+
attr_reader ancestor: RBS::Definition::Ancestor::Instance
|
150
150
|
|
151
151
|
attr_reader relation: Subtyping::Relation[AST::Types::t]
|
152
152
|
|
153
|
-
def initialize: (name: RBS::TypeName, ancestor: RBS::
|
154
|
-
|
155
|
-
def header_line: () -> String
|
156
|
-
end
|
157
|
-
|
158
|
-
class ClassVariableDuplicationError < Base
|
159
|
-
attr_reader class_name: RBS::TypeName
|
160
|
-
|
161
|
-
attr_reader other_class_name: RBS::TypeName
|
162
|
-
|
163
|
-
attr_reader variable_name: Symbol
|
164
|
-
|
165
|
-
def initialize: (class_name: RBS::TypeName, other_class_name: RBS::TypeName, variable_name: Symbol, location: RBS::Location[untyped, untyped]) -> void
|
153
|
+
def initialize: (name: RBS::TypeName, ancestor: RBS::Definition::Ancestor::Instance, relation: Subtyping::Relation[AST::Types::t], location: location?) -> void
|
166
154
|
|
167
155
|
def header_line: () -> String
|
168
156
|
end
|
@@ -242,6 +230,22 @@ module Steep
|
|
242
230
|
def header_line: () -> String
|
243
231
|
end
|
244
232
|
|
233
|
+
class InconsistentClassModuleAliasError < Base
|
234
|
+
attr_reader decl: RBS::AST::Declarations::ModuleAlias | RBS::AST::Declarations::ClassAlias
|
235
|
+
|
236
|
+
def initialize: (decl: RBS::AST::Declarations::ModuleAlias | RBS::AST::Declarations::ClassAlias) -> void
|
237
|
+
|
238
|
+
def header_line: () -> String
|
239
|
+
end
|
240
|
+
|
241
|
+
class CyclicClassAliasDefinitionError < Base
|
242
|
+
attr_reader decl: RBS::AST::Declarations::ModuleAlias | RBS::AST::Declarations::ClassAlias
|
243
|
+
|
244
|
+
def initialize: (decl: RBS::AST::Declarations::ModuleAlias | RBS::AST::Declarations::ClassAlias) -> void
|
245
|
+
|
246
|
+
def header_line: () -> String
|
247
|
+
end
|
248
|
+
|
245
249
|
def self.from_rbs_error: (RBS::BaseError error, factory: AST::Types::Factory) -> Base
|
246
250
|
end
|
247
251
|
end
|
@@ -2,89 +2,139 @@ module Steep
|
|
2
2
|
module Index
|
3
3
|
class RBSIndex
|
4
4
|
class TypeEntry
|
5
|
-
attr_reader type_name:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
5
|
+
attr_reader type_name: RBS::TypeName
|
6
|
+
|
7
|
+
type decl = RBS::AST::Declarations::Class
|
8
|
+
| RBS::AST::Declarations::Module
|
9
|
+
| RBS::AST::Declarations::Interface
|
10
|
+
| RBS::AST::Declarations::TypeAlias
|
11
|
+
| RBS::AST::Declarations::ClassAlias
|
12
|
+
| RBS::AST::Declarations::ModuleAlias
|
13
|
+
|
14
|
+
type ref = RBS::AST::Members::MethodDefinition
|
15
|
+
| RBS::AST::Members::AttrWriter
|
16
|
+
| RBS::AST::Members::AttrReader
|
17
|
+
| RBS::AST::Members::AttrAccessor
|
18
|
+
| RBS::AST::Members::Include
|
19
|
+
| RBS::AST::Members::Extend
|
20
|
+
| RBS::AST::Members::InstanceVariable
|
21
|
+
| RBS::AST::Members::ClassVariable
|
22
|
+
| RBS::AST::Members::ClassInstanceVariable
|
23
|
+
| RBS::AST::Declarations::Module
|
24
|
+
| RBS::AST::Declarations::Class
|
25
|
+
| RBS::AST::Declarations::Constant
|
26
|
+
| RBS::AST::Declarations::Global
|
27
|
+
| RBS::AST::Declarations::TypeAlias
|
28
|
+
| RBS::AST::Declarations::ClassAlias
|
29
|
+
| RBS::AST::Declarations::ModuleAlias
|
30
|
+
|
31
|
+
attr_reader declarations: Set[decl]
|
32
|
+
|
33
|
+
attr_reader references: Set[ref]
|
34
|
+
|
35
|
+
def initialize: (type_name: RBS::TypeName) -> void
|
36
|
+
|
37
|
+
def add_declaration: (decl decl) -> self
|
38
|
+
|
39
|
+
def add_reference: (ref) -> self
|
16
40
|
end
|
17
41
|
|
18
42
|
class MethodEntry
|
19
|
-
attr_reader method_name:
|
43
|
+
attr_reader method_name: method_name
|
20
44
|
|
21
|
-
|
45
|
+
type decl = RBS::AST::Members::MethodDefinition
|
46
|
+
| RBS::AST::Members::Alias
|
47
|
+
| RBS::AST::Members::AttrWriter
|
48
|
+
| RBS::AST::Members::AttrReader
|
49
|
+
| RBS::AST::Members::AttrAccessor
|
22
50
|
|
23
|
-
|
51
|
+
type ref = RBS::AST::Members::Alias
|
24
52
|
|
25
|
-
|
53
|
+
attr_reader declarations: Set[decl]
|
26
54
|
|
27
|
-
|
55
|
+
attr_reader references: Set[ref]
|
56
|
+
|
57
|
+
def initialize: (method_name: method_name) -> void
|
58
|
+
|
59
|
+
def add_declaration: (decl) -> self
|
28
60
|
end
|
29
61
|
|
30
62
|
class ConstantEntry
|
31
|
-
attr_reader const_name:
|
63
|
+
attr_reader const_name: RBS::TypeName
|
32
64
|
|
33
|
-
|
65
|
+
type decl = RBS::AST::Declarations::Constant
|
34
66
|
|
35
|
-
|
67
|
+
attr_reader declarations: Set[decl]
|
36
68
|
|
37
|
-
def
|
69
|
+
def initialize: (const_name: RBS::TypeName) -> void
|
70
|
+
|
71
|
+
def add_declaration: (decl) -> self
|
38
72
|
end
|
39
73
|
|
40
74
|
class GlobalEntry
|
41
|
-
attr_reader global_name:
|
75
|
+
attr_reader global_name: Symbol
|
76
|
+
|
77
|
+
type decl = RBS::AST::Declarations::Global
|
42
78
|
|
43
|
-
attr_reader declarations:
|
79
|
+
attr_reader declarations: Set[decl]
|
44
80
|
|
45
|
-
def initialize: (global_name:
|
81
|
+
def initialize: (global_name: Symbol) -> void
|
46
82
|
|
47
|
-
def add_declaration: (
|
83
|
+
def add_declaration: (decl) -> self
|
48
84
|
end
|
49
85
|
|
50
|
-
attr_reader type_index:
|
86
|
+
attr_reader type_index: Hash[RBS::TypeName, TypeEntry]
|
51
87
|
|
52
|
-
attr_reader method_index:
|
88
|
+
attr_reader method_index: Hash[method_name, MethodEntry]
|
53
89
|
|
54
|
-
attr_reader const_index:
|
90
|
+
attr_reader const_index: Hash[RBS::TypeName, ConstantEntry]
|
55
91
|
|
56
|
-
attr_reader global_index:
|
92
|
+
attr_reader global_index: Hash[Symbol, GlobalEntry]
|
57
93
|
|
58
94
|
def initialize: () -> void
|
59
95
|
|
60
|
-
def entry: (
|
96
|
+
def entry: (type_name: RBS::TypeName) -> TypeEntry
|
97
|
+
| (method_name: method_name) -> MethodEntry
|
98
|
+
| (const_name: RBS::TypeName) -> ConstantEntry
|
99
|
+
| (global_name: Symbol) -> GlobalEntry
|
61
100
|
|
62
|
-
def each_entry: () { () ->
|
101
|
+
def each_entry: () { (TypeEntry | MethodEntry | ConstantEntry | GlobalEntry) -> void } -> void
|
102
|
+
| () -> Enumerator[TypeEntry | MethodEntry | ConstantEntry | GlobalEntry, void]
|
63
103
|
|
64
|
-
def add_type_declaration: (
|
104
|
+
def add_type_declaration: (RBS::TypeName type_name, TypeEntry::decl declaration) -> TypeEntry
|
65
105
|
|
66
|
-
def add_method_declaration: (
|
106
|
+
def add_method_declaration: (method_name, MethodEntry::decl member) -> MethodEntry
|
67
107
|
|
68
|
-
def add_constant_declaration: (
|
108
|
+
def add_constant_declaration: (RBS::TypeName const_name, ConstantEntry::decl decl) -> ConstantEntry
|
69
109
|
|
70
|
-
def add_global_declaration: (
|
110
|
+
def add_global_declaration: (Symbol global_name, GlobalEntry::decl decl) -> GlobalEntry
|
71
111
|
|
72
|
-
def each_declaration: (
|
112
|
+
def each_declaration: (type_name: RBS::TypeName) { (TypeEntry) -> void } -> void
|
113
|
+
| (type_name: RBS::TypeName) -> Enumerator[TypeEntry, void]
|
114
|
+
| (method_name: method_name) { (MethodEntry) -> void } -> void
|
115
|
+
| (method_name: method_name) -> Enumerator[MethodEntry, void]
|
116
|
+
| (const_name: RBS::TypeName) { (ConstantEntry) -> void } -> void
|
117
|
+
| (const_name: RBS::TypeName) -> Enumerator[ConstantEntry, void]
|
118
|
+
| (global_name: Symbol) { (GlobalEntry) -> void } -> void
|
119
|
+
| (global_name: Symbol) -> Enumerator[GlobalEntry, void]
|
73
120
|
|
74
|
-
|
121
|
+
# `type_name` is referred from `ref`
|
122
|
+
#
|
123
|
+
def add_type_reference: (RBS::TypeName type_name, TypeEntry::ref ref) -> TypeEntry
|
75
124
|
|
76
|
-
def each_reference: (
|
125
|
+
def each_reference: (type_name: RBS::TypeName) { (TypeEntry::ref) -> void } -> void
|
126
|
+
| (type_name: RBS::TypeName) -> Enumerator[TypeEntry::ref, void]
|
77
127
|
|
78
128
|
class Builder
|
79
|
-
attr_reader index:
|
129
|
+
attr_reader index: RBSIndex
|
80
130
|
|
81
|
-
def initialize: (index:
|
131
|
+
def initialize: (index: RBSIndex) -> void
|
82
132
|
|
83
|
-
def member: (
|
133
|
+
def member: (RBS::TypeName type_name, RBS::AST::Members::t | RBS::AST::Declarations::t member) -> void
|
84
134
|
|
85
|
-
def type_reference: (
|
135
|
+
def type_reference: (RBS::Types::t, from: TypeEntry::ref) -> void
|
86
136
|
|
87
|
-
def env: (
|
137
|
+
def env: (RBS::Environment env) -> void
|
88
138
|
end
|
89
139
|
end
|
90
140
|
end
|
data/sig/steep/project/dsl.rbs
CHANGED
@@ -2,53 +2,55 @@ module Steep
|
|
2
2
|
class Project
|
3
3
|
class DSL
|
4
4
|
class TargetDSL
|
5
|
-
attr_reader name:
|
5
|
+
attr_reader name: Symbol
|
6
6
|
|
7
|
-
attr_reader sources:
|
7
|
+
attr_reader sources: Array[String]
|
8
8
|
|
9
|
-
attr_reader libraries:
|
9
|
+
attr_reader libraries: Array[String]
|
10
10
|
|
11
|
-
attr_reader signatures:
|
11
|
+
attr_reader signatures: Array[String]
|
12
12
|
|
13
|
-
attr_reader ignored_sources:
|
13
|
+
attr_reader ignored_sources: Array[String]
|
14
14
|
|
15
|
-
attr_reader stdlib_root:
|
15
|
+
attr_reader stdlib_root: Pathname?
|
16
16
|
|
17
|
-
attr_reader core_root:
|
17
|
+
attr_reader core_root: Pathname?
|
18
18
|
|
19
|
-
attr_reader repo_paths:
|
19
|
+
attr_reader repo_paths: Array[Pathname]
|
20
20
|
|
21
21
|
attr_reader code_diagnostics_config: untyped
|
22
22
|
|
23
|
-
attr_reader project:
|
23
|
+
attr_reader project: Project?
|
24
24
|
|
25
|
-
attr_reader collection_config_path:
|
25
|
+
attr_reader collection_config_path: Pathname?
|
26
26
|
|
27
27
|
NONE: untyped
|
28
28
|
|
29
|
-
def
|
29
|
+
def project!: () -> Project
|
30
30
|
|
31
|
-
def
|
31
|
+
def initialize: (Symbol name, ?sources: Array[String], ?libraries: Array[String], ?signatures: Array[String], ?ignored_sources: Array[String], ?repo_paths: Array[Pathname], ?code_diagnostics_config: ::Hash[untyped, untyped], ?project: Project?, ?collection_config_path: Pathname?) -> void
|
32
32
|
|
33
|
-
def
|
33
|
+
def initialize_copy: (instance other) -> void
|
34
34
|
|
35
|
-
def
|
35
|
+
def check: (*String args) -> void
|
36
36
|
|
37
|
-
def
|
37
|
+
def ignore: (*String args) -> void
|
38
38
|
|
39
|
-
def
|
39
|
+
def library: (*String args) -> void
|
40
40
|
|
41
|
-
def
|
41
|
+
def typing_options: (?untyped level, **untyped hash) -> void
|
42
42
|
|
43
|
-
def
|
43
|
+
def signature: (*String args) -> void
|
44
44
|
|
45
|
-
def
|
45
|
+
def update: (?name: Symbol, ?sources: Array[String], ?libraries: Array[String], ?signatures: Array[String], ?ignored_sources: Array[String], ?project: Project?) -> TargetDSL
|
46
46
|
|
47
|
-
def
|
47
|
+
def no_builtin!: (?bool value) -> void
|
48
48
|
|
49
|
-
def
|
49
|
+
def vendor: (?::String dir, ?stdlib: untyped?, ?gems: untyped?) -> void
|
50
50
|
|
51
|
-
def
|
51
|
+
def stdlib_path: (core_root: String, stdlib_root: String) -> void
|
52
|
+
|
53
|
+
def repo_path: (*String paths) -> void
|
52
54
|
|
53
55
|
# Configure the code diagnostics printing setup.
|
54
56
|
#
|
@@ -71,24 +73,27 @@ module Steep
|
|
71
73
|
# configure_code_diagnostics(D::Ruby.lenient)
|
72
74
|
# ```
|
73
75
|
#
|
74
|
-
def configure_code_diagnostics: (
|
76
|
+
def configure_code_diagnostics: (Hash[untyped, untyped] hash) -> void
|
77
|
+
| () { (Hash[untyped, untyped]) -> void } -> void
|
75
78
|
|
76
|
-
def collection_config: (
|
79
|
+
def collection_config: (Pathname path) -> void
|
77
80
|
|
78
|
-
def disable_collection: () ->
|
81
|
+
def disable_collection: () -> void
|
79
82
|
end
|
80
83
|
|
81
84
|
attr_reader project: untyped
|
82
85
|
|
83
|
-
|
86
|
+
@@templates: Hash[Symbol, TargetDSL]
|
87
|
+
|
88
|
+
def self.templates: () -> Hash[Symbol, TargetDSL]
|
84
89
|
|
85
|
-
def initialize: (project:
|
90
|
+
def initialize: (project: Project) -> void
|
86
91
|
|
87
|
-
def self.register_template: (
|
92
|
+
def self.register_template: (Symbol name, TargetDSL target) -> void
|
88
93
|
|
89
|
-
def self.parse: (
|
94
|
+
def self.parse: (Project project, String code, ?filename: String) -> void
|
90
95
|
|
91
|
-
def target: (
|
96
|
+
def target: (Symbol name, ?template: Symbol?) ?{ (TargetDSL) [self: TargetDSL] -> void } -> void
|
92
97
|
end
|
93
98
|
end
|
94
99
|
end
|
@@ -1,13 +1,25 @@
|
|
1
1
|
module Steep
|
2
2
|
class Project
|
3
3
|
class Options
|
4
|
-
PathOptions
|
4
|
+
class PathOptions
|
5
|
+
attr_reader core_root: Pathname?
|
5
6
|
|
6
|
-
|
7
|
+
attr_reader stdlib_root: Pathname?
|
7
8
|
|
8
|
-
|
9
|
+
attr_reader repo_paths: Array[Pathname]
|
9
10
|
|
10
|
-
|
11
|
+
def initialize: (?core_root: Pathname?, ?stdlib_root: Pathname?, ?repo_paths: Array[Pathname]) -> void
|
12
|
+
|
13
|
+
def customized_stdlib?: () -> bool
|
14
|
+
|
15
|
+
def customized_core?: () -> bool
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_reader libraries: Array[String]
|
19
|
+
|
20
|
+
attr_accessor paths: PathOptions
|
21
|
+
|
22
|
+
attr_accessor collection_lock: RBS::Collection::Config::Lockfile
|
11
23
|
|
12
24
|
def initialize: () -> void
|
13
25
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Steep
|
2
2
|
class Project
|
3
3
|
class Target
|
4
|
-
attr_reader name:
|
4
|
+
attr_reader name: Symbol
|
5
5
|
|
6
|
-
attr_reader options:
|
6
|
+
attr_reader options: Options
|
7
7
|
|
8
8
|
attr_reader source_pattern: Pattern
|
9
9
|
|
@@ -11,15 +11,15 @@ module Steep
|
|
11
11
|
|
12
12
|
attr_reader code_diagnostics_config: untyped
|
13
13
|
|
14
|
-
def initialize: (name:
|
14
|
+
def initialize: (name: Symbol, options: Options, source_pattern: Pattern, signature_pattern: Pattern, code_diagnostics_config: untyped) -> void
|
15
15
|
|
16
|
-
def possible_source_file?: (
|
16
|
+
def possible_source_file?: (Pathname path) -> bool
|
17
17
|
|
18
|
-
def possible_signature_file?: (
|
18
|
+
def possible_signature_file?: (Pathname path) -> bool
|
19
19
|
|
20
|
-
def new_env_loader: (project:
|
20
|
+
def new_env_loader: (project: Project) -> RBS::EnvironmentLoader
|
21
21
|
|
22
|
-
def self.construct_env_loader: (options:
|
22
|
+
def self.construct_env_loader: (options: Options, project: Project) -> RBS::EnvironmentLoader
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -23,11 +23,11 @@ module Steep
|
|
23
23
|
|
24
24
|
def process_completion: (untyped job) -> untyped
|
25
25
|
|
26
|
-
def format_completion_item_for_rbs: (
|
26
|
+
def format_completion_item_for_rbs: (Services::SignatureService sig_service, untyped type_name, untyped context, untyped job, untyped prefix) -> (nil | untyped)
|
27
27
|
|
28
28
|
def format_comment: (untyped comment) -> (untyped | nil)
|
29
29
|
|
30
|
-
def format_comments: (
|
30
|
+
def format_comments: (Array[RBS::AST::Comment] comments) -> untyped?
|
31
31
|
|
32
32
|
def format_completion_item: (untyped item) -> untyped
|
33
33
|
|
@@ -28,8 +28,10 @@ module Steep
|
|
28
28
|
type summarizable_decl = ::RBS::AST::Declarations::Class
|
29
29
|
| ::RBS::AST::Declarations::Module
|
30
30
|
| ::RBS::AST::Declarations::Interface
|
31
|
-
| ::RBS::AST::Declarations::
|
32
|
-
|
31
|
+
| ::RBS::AST::Declarations::TypeAlias
|
32
|
+
| ::RBS::AST::Declarations::ClassAlias
|
33
|
+
| ::RBS::AST::Declarations::ModuleAlias
|
34
|
+
|
33
35
|
def self?.declaration_summary: (summarizable_decl) -> String
|
34
36
|
end
|
35
37
|
end
|
@@ -51,6 +51,12 @@ module Steep
|
|
51
51
|
attr_reader full_name: RBS::TypeName
|
52
52
|
|
53
53
|
def initialize: (env: RBS::Environment, identifier: Symbol, range: Range, type: AST::Types::t, full_name: RBS::TypeName) -> void
|
54
|
+
|
55
|
+
def class?: () -> bool
|
56
|
+
|
57
|
+
def module?: () -> bool
|
58
|
+
|
59
|
+
def comments: () -> Array[RBS::AST::Comment]
|
54
60
|
end
|
55
61
|
|
56
62
|
class MethodNameItem
|
@@ -5,17 +5,19 @@ module Steep
|
|
5
5
|
class TypeAliasContent
|
6
6
|
attr_reader location: ::RBS::Location[untyped, untyped]
|
7
7
|
|
8
|
-
attr_reader decl: ::RBS::AST::Declarations::
|
8
|
+
attr_reader decl: ::RBS::AST::Declarations::TypeAlias
|
9
9
|
|
10
|
-
def initialize: (location: ::RBS::Location[untyped, untyped], decl: ::RBS::AST::Declarations::
|
10
|
+
def initialize: (location: ::RBS::Location[untyped, untyped], decl: ::RBS::AST::Declarations::TypeAlias) -> void
|
11
11
|
end
|
12
12
|
|
13
13
|
class ClassContent
|
14
14
|
attr_reader location: ::RBS::Location[untyped, untyped]
|
15
15
|
|
16
|
-
|
16
|
+
type decl = ::RBS::AST::Declarations::Class | ::RBS::AST::Declarations::Module | ::RBS::AST::Declarations::ClassAlias | ::RBS::AST::Declarations::ModuleAlias
|
17
17
|
|
18
|
-
|
18
|
+
attr_reader decl: decl
|
19
|
+
|
20
|
+
def initialize: (location: ::RBS::Location[untyped, untyped], decl: decl) -> void
|
19
21
|
end
|
20
22
|
|
21
23
|
class InterfaceContent
|
@@ -82,23 +82,27 @@ module Steep
|
|
82
82
|
|
83
83
|
type decl = ::RBS::Environment::ClassEntry
|
84
84
|
| ::RBS::Environment::ModuleEntry
|
85
|
-
| ::RBS::Environment::
|
85
|
+
| ::RBS::Environment::ClassAliasEntry
|
86
|
+
| ::RBS::Environment::ModuleAliasEntry
|
87
|
+
| ::RBS::Environment::ConstantEntry
|
86
88
|
|
87
89
|
attr_reader decl: decl
|
88
90
|
|
89
91
|
attr_reader class_decl(): ::RBS::Environment::ClassEntry | ::RBS::Environment::ModuleEntry | nil
|
90
92
|
|
91
|
-
attr_reader
|
93
|
+
attr_reader class_alias(): ::RBS::Environment::ClassAliasEntry | ::RBS::Environment::ModuleAliasEntry | nil
|
94
|
+
|
95
|
+
attr_reader constant_decl(): ::RBS::Environment::ConstantEntry?
|
92
96
|
|
93
97
|
def initialize: (location: Parser::Source::Range, full_name: ::RBS::TypeName, type: AST::Types::t, decl: decl) -> void
|
94
98
|
|
95
99
|
def comments: () -> Array[::RBS::AST::Comment]
|
96
100
|
|
97
101
|
# Returns true if `decl` is a class/module definition
|
98
|
-
def class_or_module?: () ->
|
102
|
+
def class_or_module?: () -> bool
|
99
103
|
|
100
104
|
# Returns true if `decl` is a constant definition
|
101
|
-
def constant?: () ->
|
105
|
+
def constant?: () -> bool
|
102
106
|
end
|
103
107
|
|
104
108
|
type content = TypeContent | VariableContent | MethodCallContent | DefinitionContent | ConstantContent | TypeAssertionContent
|
@@ -1,5 +1,12 @@
|
|
1
1
|
module Steep
|
2
2
|
module Services
|
3
|
+
# SignatureService takes care of two sets of RBS files.
|
4
|
+
#
|
5
|
+
# 1. RBS files loaded from `EnvironmentLoader` -- usually type signatures of libraries
|
6
|
+
# 2. RBS files managed in editors -- usually type signatures of the development target (app or gem)
|
7
|
+
#
|
8
|
+
# The files in #2 are managed throuth `#status` and the changes are tracked.
|
9
|
+
#
|
3
10
|
class SignatureService
|
4
11
|
type status = SyntaxErrorStatus | AncestorErrorStatus | LoadedStatus
|
5
12
|
|
@@ -65,17 +72,25 @@ module Steep
|
|
65
72
|
def constant_resolver: () -> RBS::Resolver::ConstantResolver
|
66
73
|
end
|
67
74
|
|
75
|
+
# A file has one of the three states:
|
76
|
+
#
|
77
|
+
# 1. The parsing succeeded and loaded a list of declarations
|
78
|
+
# 2. The content has a syntax error and parsing failed
|
79
|
+
# 3. Other unexpected error
|
80
|
+
#
|
68
81
|
class FileStatus
|
69
82
|
attr_reader path: Pathname
|
70
83
|
|
71
84
|
attr_reader content: String
|
72
85
|
|
73
|
-
|
86
|
+
type signature = [RBS::Buffer, Array[RBS::AST::Directives::t], Array[RBS::AST::Declarations::t]]
|
87
|
+
|
88
|
+
attr_reader signature: signature | Diagnostic::Signature::UnexpectedError | RBS::ParsingError
|
74
89
|
|
75
90
|
def initialize: (
|
76
91
|
path: Pathname,
|
77
92
|
content: String,
|
78
|
-
|
93
|
+
signature: signature | Diagnostic::Signature::UnexpectedError | RBS::ParsingError
|
79
94
|
) -> void
|
80
95
|
end
|
81
96
|
|
@@ -85,11 +100,17 @@ module Steep
|
|
85
100
|
|
86
101
|
@env_rbs_paths: Set[Pathname]?
|
87
102
|
|
103
|
+
# All RBS paths in environment, both dependency RBS and target RBS
|
104
|
+
#
|
88
105
|
def env_rbs_paths: () -> Set[Pathname]
|
89
106
|
|
107
|
+
# Yield all RBS paths in the environment, both dependency RBS and target RBS
|
108
|
+
#
|
90
109
|
def each_rbs_path: () { (Pathname) -> void } -> void
|
91
110
|
| () -> Enumerator[Pathname, void]
|
92
111
|
|
112
|
+
# The Target files
|
113
|
+
#
|
93
114
|
def files: () -> Hash[Pathname, FileStatus]
|
94
115
|
|
95
116
|
def pending_changed_paths: () -> Set[Pathname]
|
@@ -106,10 +127,13 @@ module Steep
|
|
106
127
|
|
107
128
|
def apply_changes: (Hash[Pathname, FileStatus] files, Server::ChangeBuffer::changes changes) -> Hash[Pathname, FileStatus]
|
108
129
|
|
130
|
+
# The entry point to apply the edit to the signatures
|
131
|
+
#
|
109
132
|
def update: (Server::ChangeBuffer::changes changes) -> void
|
110
133
|
|
111
134
|
def update_env: (
|
112
|
-
Hash[Pathname, FileStatus] updated_files,
|
135
|
+
Hash[Pathname, FileStatus] updated_files,
|
136
|
+
paths: Set[Pathname]
|
113
137
|
) -> (RBS::DefinitionBuilder::AncestorBuilder | Array[Diagnostic::Signature::Base])
|
114
138
|
|
115
139
|
def rescue_rbs_error: (Array[RBS::BaseError] errors) { () -> void } -> void
|
@@ -9,7 +9,7 @@ module Steep
|
|
9
9
|
|
10
10
|
@errors: Array[Diagnostic::Signature::Base]
|
11
11
|
|
12
|
-
@type_name_resolver: RBS::TypeNameResolver?
|
12
|
+
@type_name_resolver: RBS::Resolver::TypeNameResolver?
|
13
13
|
|
14
14
|
@validator: RBS::Validator?
|
15
15
|
|
@@ -26,7 +26,7 @@ module Steep
|
|
26
26
|
|
27
27
|
def builder: () -> RBS::DefinitionBuilder
|
28
28
|
|
29
|
-
def type_name_resolver: () -> RBS::TypeNameResolver
|
29
|
+
def type_name_resolver: () -> RBS::Resolver::TypeNameResolver
|
30
30
|
|
31
31
|
def validator: () -> RBS::Validator
|
32
32
|
|
@@ -60,13 +60,17 @@ module Steep
|
|
60
60
|
|
61
61
|
def validate_const: () -> void
|
62
62
|
|
63
|
-
def validate_one_constant: (RBS::TypeName name, RBS::Environment::
|
63
|
+
def validate_one_constant: (RBS::TypeName name, RBS::Environment::ConstantEntry entry) -> void
|
64
64
|
|
65
65
|
def validate_global: () -> void
|
66
66
|
|
67
|
-
def validate_one_global: (Symbol name, RBS::Environment::
|
67
|
+
def validate_one_global: (Symbol name, RBS::Environment::GlobalEntry) -> void
|
68
68
|
|
69
|
-
def validate_one_alias: (RBS::TypeName name, ?RBS::Environment::
|
69
|
+
def validate_one_alias: (RBS::TypeName name, ?RBS::Environment::TypeAliasEntry entry) -> void
|
70
|
+
|
71
|
+
def validate_one_class_decl: (RBS::TypeName) -> void
|
72
|
+
|
73
|
+
def validate_one_class_alias: (RBS::TypeName, RBS::Environment::ClassAliasEntry | RBS::Environment::ModuleAliasEntry) -> void
|
70
74
|
|
71
75
|
def validate_alias: () -> void
|
72
76
|
|
@@ -80,7 +80,7 @@ module Steep
|
|
80
80
|
|
81
81
|
def with_method_constr: (untyped method_name, untyped node, args: untyped, self_type: untyped, definition: untyped) { (untyped) -> untyped } -> untyped
|
82
82
|
|
83
|
-
def implement_module: (module_name:
|
83
|
+
def implement_module: (module_name: RBS::TypeName, annotations: AST::Annotation::Collection, ?super_name: RBS::TypeName?) -> AST::Annotation::Implements::Module?
|
84
84
|
|
85
85
|
def default_module_context: (untyped implement_module_name, nesting: untyped) -> untyped
|
86
86
|
|