steep 1.4.0.dev.1 → 1.4.0.dev.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/ruby.yml +1 -2
- data/Gemfile +2 -2
- data/Gemfile.lock +13 -15
- data/Gemfile.steep +1 -2
- data/Gemfile.steep.lock +20 -18
- data/README.md +7 -1
- data/Steepfile +16 -3
- data/bin/rbs +0 -1
- data/guides/README.md +5 -0
- data/guides/src/gem-rbs-collection/gem-rbs-collection.md +143 -0
- data/guides/src/getting-started/getting-started.md +164 -0
- data/guides/src/nil-optional/nil-optional.md +195 -0
- 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 +80 -5
- data/lib/steep/diagnostic/signature.rb +40 -0
- data/lib/steep/drivers/check.rb +4 -4
- data/lib/steep/index/rbs_index.rb +12 -3
- data/lib/steep/index/signature_symbol_provider.rb +1 -1
- data/lib/steep/interface/block.rb +10 -0
- data/lib/steep/module_helper.rb +13 -11
- data/lib/steep/path_helper.rb +4 -0
- data/lib/steep/project/target.rb +1 -3
- data/lib/steep/server/interaction_worker.rb +102 -72
- 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/services/type_name_completion.rb +157 -0
- data/lib/steep/signature/validator.rb +28 -6
- data/lib/steep/source.rb +1 -0
- data/lib/steep/subtyping/check.rb +1 -1
- data/lib/steep/type_construction.rb +414 -239
- data/lib/steep/type_inference/block_params.rb +13 -0
- data/lib/steep/type_inference/constant_env.rb +7 -3
- data/lib/steep/type_inference/context.rb +3 -3
- data/lib/steep/type_inference/method_params.rb +42 -16
- data/lib/steep/type_inference/send_args.rb +79 -50
- data/lib/steep/type_inference/type_env.rb +7 -1
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +1 -0
- data/rbs_collection.steep.lock.yaml +9 -41
- data/rbs_collection.steep.yaml +11 -8
- data/sample/lib/conference.rb +22 -0
- data/sample/sig/conference.rbs +28 -0
- data/sig/shims/language-server_protocol.rbs +12 -0
- data/sig/shims/parser/nodes.rbs +37 -0
- data/sig/shims/parser.rbs +1 -0
- data/sig/shims/string.rbs +4 -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 +12 -8
- data/sig/steep/ast/types/name.rbs +4 -0
- data/sig/steep/diagnostic/lsp_formatter.rbs +1 -1
- data/sig/steep/diagnostic/ruby.rbs +38 -2
- data/sig/steep/diagnostic/signature.rbs +18 -14
- data/sig/steep/drivers/check.rbs +1 -1
- data/sig/steep/drivers/checkfile.rbs +1 -1
- data/sig/steep/drivers/diagnostic_printer.rbs +1 -1
- data/sig/steep/drivers/watch.rbs +1 -1
- data/sig/steep/index/rbs_index.rbs +6 -2
- data/sig/steep/index/signature_symbol_provider.rbs +1 -1
- data/sig/steep/interface/block.rbs +2 -0
- data/sig/steep/interface/builder.rbs +5 -3
- data/sig/steep/interface/method_type.rbs +5 -3
- data/sig/steep/module_helper.rbs +9 -0
- data/sig/steep/path_helper.rbs +3 -1
- data/sig/steep/project/target.rbs +7 -7
- data/sig/steep/server/base_worker.rbs +1 -1
- data/sig/steep/server/interaction_worker.rbs +46 -17
- data/sig/steep/server/lsp_formatter.rbs +4 -2
- data/sig/steep/server/master.rbs +1 -1
- data/sig/steep/server/type_check_worker.rbs +7 -5
- data/sig/steep/server/worker_process.rbs +6 -4
- data/sig/steep/services/completion_provider.rbs +8 -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/services/type_name_completion.rbs +122 -0
- data/sig/steep/signature/validator.rbs +9 -5
- data/sig/steep/type_construction.rbs +100 -31
- data/sig/steep/type_inference/block_params.rbs +4 -0
- data/sig/steep/type_inference/constant_env.rbs +2 -0
- data/sig/steep/type_inference/context.rbs +70 -22
- data/sig/steep/type_inference/method_params.rbs +43 -24
- data/sig/steep/type_inference/multiple_assignment.rbs +1 -1
- data/sig/steep/type_inference/send_args.rbs +13 -3
- data/sig/steep/typing.rbs +7 -2
- data/smoke/diagnostics/test_expectations.yml +1 -0
- data/smoke/regexp/a.rb +2 -2
- data/steep.gemspec +0 -1
- metadata +11 -17
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Parser
|
|
2
|
+
module AST
|
|
3
|
+
interface _BlockNode
|
|
4
|
+
def type: () -> :block
|
|
5
|
+
|
|
6
|
+
%a{pure} def loc: () -> (Source::Map & _BlockLocation)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
interface _BlockLocation
|
|
10
|
+
%a{pure} def end: () -> Source::Range
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
interface _DefNode
|
|
14
|
+
def type: () -> :def
|
|
15
|
+
|
|
16
|
+
def children: () -> [Symbol, Node, Node?]
|
|
17
|
+
|
|
18
|
+
%a{pure} def loc: () -> (Source::Map & _DefLocation)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
interface _DefLocation
|
|
22
|
+
%a{pure} def end: () -> Source::Range?
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
interface _CaseNode
|
|
26
|
+
def type: () -> :case
|
|
27
|
+
|
|
28
|
+
%a{pure} def loc: () -> (Source::Map & _CaseLocation)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
interface _CaseLocation
|
|
32
|
+
%a{pure} def else: () -> Source::Range?
|
|
33
|
+
|
|
34
|
+
%a{pure} def end: () -> Source::Range
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/sig/shims/parser.rbs
CHANGED
|
@@ -19,7 +19,8 @@ module Steep
|
|
|
19
19
|
|
|
20
20
|
attr_reader location: RBS::Location[untyped, untyped]
|
|
21
21
|
|
|
22
|
-
def initialize: (source: String, location: RBS::Location[untyped, untyped],
|
|
22
|
+
def initialize: (source: String, location: RBS::Location[untyped, untyped], exn: Exception) -> void
|
|
23
|
+
| (source: String, location: RBS::Location[untyped, untyped], message: String) -> void
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
TYPE: Regexp
|
|
@@ -30,7 +31,7 @@ module Steep
|
|
|
30
31
|
|
|
31
32
|
TYPE_PARAMS: Regexp
|
|
32
33
|
|
|
33
|
-
def parse_type: (
|
|
34
|
+
def parse_type: (MatchData, ?Symbol, location: RBS::Location[untyped, untyped]) -> AST::Types::t
|
|
34
35
|
|
|
35
36
|
# ```
|
|
36
37
|
# @type ${keyword} ${name}: ${type}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
use RBS::TypeName, RBS::Resolver::TypeNameResolver
|
|
2
|
+
|
|
1
3
|
module Steep
|
|
2
4
|
module AST
|
|
3
5
|
module Types
|
|
@@ -10,13 +12,13 @@ module Steep
|
|
|
10
12
|
|
|
11
13
|
attr_reader type_interface_cache: untyped
|
|
12
14
|
|
|
13
|
-
@type_name_resolver:
|
|
15
|
+
@type_name_resolver: TypeNameResolver?
|
|
14
16
|
|
|
15
17
|
def inspect: () -> String
|
|
16
18
|
|
|
17
19
|
def initialize: (builder: RBS::DefinitionBuilder) -> void
|
|
18
20
|
|
|
19
|
-
def type_name_resolver: () ->
|
|
21
|
+
def type_name_resolver: () -> TypeNameResolver
|
|
20
22
|
|
|
21
23
|
def type: (RBS::Types::t `type`) -> t
|
|
22
24
|
|
|
@@ -40,7 +42,7 @@ module Steep
|
|
|
40
42
|
|
|
41
43
|
def method_type_1: (Interface::MethodType method_type) -> RBS::MethodType
|
|
42
44
|
|
|
43
|
-
def unfold: (
|
|
45
|
+
def unfold: (TypeName type_name, Array[t] args) -> t
|
|
44
46
|
|
|
45
47
|
# Unfold type alias one step, or returns itself
|
|
46
48
|
#
|
|
@@ -51,7 +53,7 @@ module Steep
|
|
|
51
53
|
# * Unions and intersections are expanded
|
|
52
54
|
# * Returns `nil` if it is recursive
|
|
53
55
|
#
|
|
54
|
-
def deep_expand_alias: (t `type`, ?recursive: Set[
|
|
56
|
+
def deep_expand_alias: (t `type`, ?recursive: Set[TypeName]) -> t?
|
|
55
57
|
|
|
56
58
|
# Convert union types to array of types
|
|
57
59
|
#
|
|
@@ -59,21 +61,23 @@ module Steep
|
|
|
59
61
|
|
|
60
62
|
def unwrap_optional: (Types::t `type`) -> [Types::t, Types::t]
|
|
61
63
|
|
|
62
|
-
def module_name?: (
|
|
64
|
+
def module_name?: (TypeName type_name) -> bool
|
|
63
65
|
|
|
64
|
-
def class_name?: (
|
|
66
|
+
def class_name?: (TypeName type_name) -> bool
|
|
65
67
|
|
|
66
68
|
def env: () -> RBS::Environment
|
|
67
69
|
|
|
68
70
|
def absolute_type: (t `type`, context: RBS::Resolver::context) -> t
|
|
69
71
|
|
|
70
|
-
def absolute_type_name: (
|
|
72
|
+
def absolute_type_name: (TypeName type_name, context: RBS::Resolver::context) -> TypeName?
|
|
71
73
|
|
|
72
|
-
def instance_type: (
|
|
74
|
+
def instance_type: (TypeName type_name, ?args: Array[t]?, ?location: untyped?) -> t
|
|
73
75
|
|
|
74
76
|
def try_singleton_type: (t) -> t?
|
|
75
77
|
|
|
76
78
|
def try_instance_type: (t) -> t?
|
|
79
|
+
|
|
80
|
+
def normalize_type: (t) -> t
|
|
77
81
|
end
|
|
78
82
|
end
|
|
79
83
|
end
|
|
@@ -16,6 +16,8 @@ module Steep
|
|
|
16
16
|
def subst: (Steep::Interface::Substitution s) -> self
|
|
17
17
|
|
|
18
18
|
def level: () -> Array[Integer]
|
|
19
|
+
|
|
20
|
+
def map_type: () { (t) -> t } -> self
|
|
19
21
|
end
|
|
20
22
|
|
|
21
23
|
class Applying < Base
|
|
@@ -45,6 +47,8 @@ module Steep
|
|
|
45
47
|
include Helper::ChildrenLevel
|
|
46
48
|
|
|
47
49
|
def level: () -> Array[Integer]
|
|
50
|
+
|
|
51
|
+
def map_type: () { (t) -> t } -> self
|
|
48
52
|
end
|
|
49
53
|
|
|
50
54
|
class Singleton < Base
|
|
@@ -24,9 +24,15 @@ module Steep
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
module ResultPrinter : _DiagnosticWithResult
|
|
27
|
-
def relation_message: (untyped relation) ->
|
|
27
|
+
def relation_message: (Subtyping::Relation[untyped] relation) -> String?
|
|
28
28
|
|
|
29
|
-
def detail_lines: () ->
|
|
29
|
+
def detail_lines: () -> String?
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
module ResultPrinter2 : _DiagnosticWithResult
|
|
33
|
+
def result_line: (Subtyping::Result::t result) -> String?
|
|
34
|
+
|
|
35
|
+
def detail_lines: () -> String?
|
|
30
36
|
end
|
|
31
37
|
|
|
32
38
|
class IncompatibleAssignment < Base
|
|
@@ -524,6 +530,36 @@ module Steep
|
|
|
524
530
|
def header_line: () -> String
|
|
525
531
|
end
|
|
526
532
|
|
|
533
|
+
# Argument forwarding `...` cannot be done safely, because of
|
|
534
|
+
#
|
|
535
|
+
# 1. The arguments are incompatible, or
|
|
536
|
+
# 2. The blocks are incompatible
|
|
537
|
+
#
|
|
538
|
+
class IncompatibleArgumentForwarding < Base
|
|
539
|
+
attr_reader method_name: Symbol
|
|
540
|
+
|
|
541
|
+
attr_reader params_pair: [Interface::Function::Params, Interface::Function::Params]?
|
|
542
|
+
|
|
543
|
+
attr_reader block_pair: [Interface::Block?, Interface::Block?]?
|
|
544
|
+
|
|
545
|
+
attr_reader result: Subtyping::Result::Base
|
|
546
|
+
|
|
547
|
+
include ResultPrinter2
|
|
548
|
+
|
|
549
|
+
# One of `params_pair:` or `block_pair:` is specified where the first object is of the source method (`#foo`) and the second value is of the target method (`#bar`)
|
|
550
|
+
#
|
|
551
|
+
# ```ruby
|
|
552
|
+
# def foo(...)
|
|
553
|
+
# bar(...)
|
|
554
|
+
# end
|
|
555
|
+
# ```
|
|
556
|
+
#
|
|
557
|
+
def initialize: (node: Parser::AST::Node, method_name: Symbol, params_pair: [Interface::Function::Params, Interface::Function::Params], result: Subtyping::Result::Base) -> void
|
|
558
|
+
| (node: Parser::AST::Node, method_name: Symbol, block_pair: [Interface::Block?, Interface::Block?], result: Subtyping::Result::Base) -> void
|
|
559
|
+
|
|
560
|
+
def header_line: () -> String
|
|
561
|
+
end
|
|
562
|
+
|
|
527
563
|
ALL: Array[singleton(Base)]
|
|
528
564
|
|
|
529
565
|
type template = Hash[singleton(Base), LSPFormatter::severity]
|
|
@@ -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
|
data/sig/steep/drivers/check.rbs
CHANGED
data/sig/steep/drivers/watch.rbs
CHANGED
|
@@ -7,7 +7,9 @@ module Steep
|
|
|
7
7
|
type decl = RBS::AST::Declarations::Class
|
|
8
8
|
| RBS::AST::Declarations::Module
|
|
9
9
|
| RBS::AST::Declarations::Interface
|
|
10
|
-
| RBS::AST::Declarations::
|
|
10
|
+
| RBS::AST::Declarations::TypeAlias
|
|
11
|
+
| RBS::AST::Declarations::ClassAlias
|
|
12
|
+
| RBS::AST::Declarations::ModuleAlias
|
|
11
13
|
|
|
12
14
|
type ref = RBS::AST::Members::MethodDefinition
|
|
13
15
|
| RBS::AST::Members::AttrWriter
|
|
@@ -22,7 +24,9 @@ module Steep
|
|
|
22
24
|
| RBS::AST::Declarations::Class
|
|
23
25
|
| RBS::AST::Declarations::Constant
|
|
24
26
|
| RBS::AST::Declarations::Global
|
|
25
|
-
| RBS::AST::Declarations::
|
|
27
|
+
| RBS::AST::Declarations::TypeAlias
|
|
28
|
+
| RBS::AST::Declarations::ClassAlias
|
|
29
|
+
| RBS::AST::Declarations::ModuleAlias
|
|
26
30
|
|
|
27
31
|
attr_reader declarations: Set[decl]
|
|
28
32
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
use RBS::TypeName
|
|
2
|
+
|
|
1
3
|
module Steep
|
|
2
4
|
module Interface
|
|
3
5
|
class Builder
|
|
@@ -85,11 +87,11 @@ module Steep
|
|
|
85
87
|
attr_reader cache: Hash[cache_key, Shape?]
|
|
86
88
|
|
|
87
89
|
# No type application (if generic), no self-instance-module resolution
|
|
88
|
-
attr_reader raw_instance_object_shape_cache: Hash[[
|
|
90
|
+
attr_reader raw_instance_object_shape_cache: Hash[[TypeName, bool], Shape]
|
|
89
91
|
|
|
90
|
-
attr_reader raw_singleton_object_shape_cache: Hash[[
|
|
92
|
+
attr_reader raw_singleton_object_shape_cache: Hash[[TypeName, bool], Shape]
|
|
91
93
|
|
|
92
|
-
attr_reader raw_interface_object_shape_cache: Hash[[
|
|
94
|
+
attr_reader raw_interface_object_shape_cache: Hash[[TypeName, bool], Shape]
|
|
93
95
|
|
|
94
96
|
def initialize: (AST::Types::Factory) -> void
|
|
95
97
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
use Steep::TypeInference::MethodCall::MethodDecl
|
|
2
|
+
|
|
1
3
|
module Steep
|
|
2
4
|
module Interface
|
|
3
5
|
class MethodType
|
|
@@ -7,11 +9,11 @@ module Steep
|
|
|
7
9
|
|
|
8
10
|
attr_reader block: Block?
|
|
9
11
|
|
|
10
|
-
attr_reader method_decls: Set[
|
|
12
|
+
attr_reader method_decls: Set[MethodDecl]
|
|
11
13
|
|
|
12
14
|
@fvs: Set[Symbol]
|
|
13
15
|
|
|
14
|
-
def initialize: (type_params: Array[TypeParam], type: Function, block: Block?, method_decls: Set[
|
|
16
|
+
def initialize: (type_params: Array[TypeParam], type: Function, block: Block?, method_decls: Set[MethodDecl]) -> void
|
|
15
17
|
|
|
16
18
|
def ==: (untyped other) -> bool
|
|
17
19
|
|
|
@@ -28,7 +30,7 @@ module Steep
|
|
|
28
30
|
|
|
29
31
|
def instantiate: (Substitution s) -> MethodType
|
|
30
32
|
|
|
31
|
-
def with: (?type_params: Array[TypeParam], ?type: Function, ?block: Block?, ?method_decls: Set[
|
|
33
|
+
def with: (?type_params: Array[TypeParam], ?type: Function, ?block: Block?, ?method_decls: Set[MethodDecl]) -> MethodType
|
|
32
34
|
|
|
33
35
|
def to_s: () -> ::String
|
|
34
36
|
|
data/sig/steep/module_helper.rbs
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
module Steep
|
|
2
2
|
module ModuleHelper
|
|
3
|
+
# Translate a *const* node to a type name if possible
|
|
4
|
+
#
|
|
5
|
+
# ```ruby
|
|
6
|
+
# Foo::Bar # => `Foo::Bar`
|
|
7
|
+
# foo::Bar # => nil
|
|
8
|
+
# ```
|
|
9
|
+
#
|
|
3
10
|
def module_name_from_node: (Parser::AST::Node? parent_node, Symbol constant_name) -> RBS::TypeName?
|
|
4
11
|
|
|
12
|
+
# Translate a *const* node to a namespace if possible
|
|
13
|
+
#
|
|
5
14
|
def namespace_from_node: (Parser::AST::Node? node) -> RBS::Namespace?
|
|
6
15
|
end
|
|
7
16
|
end
|
data/sig/steep/path_helper.rbs
CHANGED
|
@@ -6,8 +6,10 @@ module Steep
|
|
|
6
6
|
#
|
|
7
7
|
def self?.to_pathname: (String uri, ?dosish: bool) -> Pathname?
|
|
8
8
|
|
|
9
|
+
def self?.to_pathname!: (String uri, ?dosish: bool) -> Pathname
|
|
10
|
+
|
|
9
11
|
# Receives a Pathname and returns a *file* URI
|
|
10
|
-
#
|
|
12
|
+
#
|
|
11
13
|
def self?.to_uri: (Pathname path, ?dosish: bool) -> URI::File
|
|
12
14
|
end
|
|
13
15
|
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
|
|
@@ -1,41 +1,70 @@
|
|
|
1
|
+
use LanguageServer::Protocol::Transport::Io::*, Thread::Queue, RBS::AST::Comment
|
|
2
|
+
use Steep::Services::CompletionProvider, Steep::Services::TypeNameCompletion
|
|
3
|
+
use RBS::TypeName, RBS::Namespace
|
|
4
|
+
|
|
1
5
|
module Steep
|
|
2
6
|
module Server
|
|
3
7
|
class InteractionWorker < BaseWorker
|
|
4
8
|
include ChangeBuffer
|
|
5
9
|
|
|
6
|
-
ApplyChangeJob
|
|
10
|
+
class ApplyChangeJob
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class HoverJob
|
|
14
|
+
attr_reader id: String
|
|
15
|
+
|
|
16
|
+
attr_reader path: Pathname
|
|
17
|
+
|
|
18
|
+
attr_reader line: Integer
|
|
19
|
+
|
|
20
|
+
attr_reader column: Integer
|
|
21
|
+
|
|
22
|
+
def initialize: (id: String, path: Pathname, line: Integer, column: Integer) -> void
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class CompletionJob
|
|
26
|
+
attr_reader id: String
|
|
27
|
+
|
|
28
|
+
attr_reader path: Pathname
|
|
29
|
+
|
|
30
|
+
attr_reader line: Integer
|
|
31
|
+
|
|
32
|
+
attr_reader column: Integer
|
|
33
|
+
|
|
34
|
+
attr_reader trigger: String
|
|
7
35
|
|
|
8
|
-
|
|
36
|
+
def initialize: (id: String, path: Pathname, line: Integer, column: Integer, trigger: String) -> void
|
|
37
|
+
end
|
|
9
38
|
|
|
10
|
-
CompletionJob
|
|
39
|
+
type job = ApplyChangeJob | HoverJob | CompletionJob
|
|
11
40
|
|
|
12
|
-
LSP
|
|
41
|
+
module LSP = LanguageServer::Protocol
|
|
13
42
|
|
|
14
|
-
attr_reader service:
|
|
43
|
+
attr_reader service: Services::TypeCheckService
|
|
15
44
|
|
|
16
|
-
def initialize: (project:
|
|
45
|
+
def initialize: (project: Project, reader: Reader, writer: Writer, ?queue: Queue) -> void
|
|
17
46
|
|
|
18
|
-
def handle_job: (
|
|
47
|
+
def handle_job: (job) -> void
|
|
19
48
|
|
|
20
|
-
|
|
49
|
+
type lsp_request = { id: String, method: String, params: untyped }
|
|
21
50
|
|
|
22
|
-
def
|
|
51
|
+
def handle_request: (lsp_request) -> void
|
|
23
52
|
|
|
24
|
-
def
|
|
53
|
+
def process_hover: (HoverJob job) -> untyped
|
|
25
54
|
|
|
26
|
-
def
|
|
55
|
+
def process_completion: (CompletionJob job) -> untyped
|
|
27
56
|
|
|
28
|
-
def
|
|
57
|
+
def format_completion_item_for_rbs: (Services::SignatureService, RBS::TypeName, CompletionJob job, String complete_text, Integer prefix_size) -> untyped
|
|
29
58
|
|
|
30
|
-
def
|
|
59
|
+
def format_comment: (Comment? comment) -> untyped?
|
|
31
60
|
|
|
32
|
-
def
|
|
61
|
+
def format_comments: (Array[RBS::AST::Comment] comments) -> untyped?
|
|
33
62
|
|
|
34
|
-
def
|
|
63
|
+
def format_completion_item: (CompletionProvider::item item) -> untyped
|
|
35
64
|
|
|
36
|
-
def
|
|
65
|
+
def method_type_to_snippet: (RBS::MethodType method_type) -> ::String
|
|
37
66
|
|
|
38
|
-
def
|
|
67
|
+
def params_to_snippet: (RBS::Types::Function fun) -> String
|
|
39
68
|
end
|
|
40
69
|
end
|
|
41
70
|
end
|
|
@@ -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
|
data/sig/steep/server/master.rbs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
use Steep::Services::*, LanguageServer::Protocol as LSP
|
|
2
|
+
|
|
1
3
|
module Steep
|
|
2
4
|
module Server
|
|
3
5
|
# TypeCheckWorker provides two features:
|
|
@@ -15,9 +17,9 @@ module Steep
|
|
|
15
17
|
class TypeCheckWorker < BaseWorker
|
|
16
18
|
attr_reader project: Project
|
|
17
19
|
|
|
18
|
-
attr_reader assignment:
|
|
20
|
+
attr_reader assignment: PathAssignment
|
|
19
21
|
|
|
20
|
-
attr_reader service:
|
|
22
|
+
attr_reader service: TypeCheckService
|
|
21
23
|
|
|
22
24
|
attr_reader commandline_args: Array[String]
|
|
23
25
|
|
|
@@ -95,9 +97,9 @@ module Steep
|
|
|
95
97
|
|
|
96
98
|
def initialize: (
|
|
97
99
|
project: Project,
|
|
98
|
-
reader:
|
|
99
|
-
writer:
|
|
100
|
-
assignment:
|
|
100
|
+
reader: LSP::Transport::Io::Reader,
|
|
101
|
+
writer: LSP::Transport::Io::Writer,
|
|
102
|
+
assignment: PathAssignment,
|
|
101
103
|
commandline_args: Array[String]
|
|
102
104
|
) -> void
|
|
103
105
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
use LanguageServer::Protocol as LSP
|
|
2
|
+
|
|
1
3
|
module Steep
|
|
2
4
|
module Server
|
|
3
5
|
# WorkerProcess class represents a worker process
|
|
@@ -21,9 +23,9 @@ module Steep
|
|
|
21
23
|
def pid: () -> Integer
|
|
22
24
|
end
|
|
23
25
|
|
|
24
|
-
attr_reader reader:
|
|
26
|
+
attr_reader reader: LSP::Transport::Io::Reader
|
|
25
27
|
|
|
26
|
-
attr_reader writer:
|
|
28
|
+
attr_reader writer: LSP::Transport::Io::Writer
|
|
27
29
|
|
|
28
30
|
attr_reader stderr: IO?
|
|
29
31
|
|
|
@@ -34,8 +36,8 @@ module Steep
|
|
|
34
36
|
attr_reader index: Integer?
|
|
35
37
|
|
|
36
38
|
def initialize: (
|
|
37
|
-
reader:
|
|
38
|
-
writer:
|
|
39
|
+
reader: LSP::Transport::Io::Reader,
|
|
40
|
+
writer: LSP::Transport::Io::Writer,
|
|
39
41
|
stderr: IO?,
|
|
40
42
|
wait_thread: Thread & _ProcessWaitThread,
|
|
41
43
|
name: String,
|