steep 1.4.0 → 1.5.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.vscode/steep-shared.code-snippets +41 -0
- data/CHANGELOG.md +37 -0
- data/Gemfile +2 -5
- data/Gemfile.lock +20 -17
- data/Gemfile.steep +1 -1
- data/Gemfile.steep.lock +6 -6
- data/Rakefile +198 -0
- data/Steepfile +3 -1
- data/lib/steep/ast/builtin.rb +9 -7
- data/lib/steep/ast/node/type_application.rb +13 -5
- data/lib/steep/ast/node/type_assertion.rb +28 -9
- data/lib/steep/ast/types/factory.rb +39 -7
- data/lib/steep/cli.rb +2 -1
- data/lib/steep/diagnostic/deprecated/else_on_exhaustive_case.rb +20 -0
- data/lib/steep/diagnostic/lsp_formatter.rb +3 -3
- data/lib/steep/diagnostic/ruby.rb +73 -12
- data/lib/steep/drivers/annotations.rb +1 -0
- data/lib/steep/drivers/check.rb +18 -13
- data/lib/steep/drivers/checkfile.rb +1 -1
- data/lib/steep/drivers/diagnostic_printer.rb +6 -4
- data/lib/steep/drivers/init.rb +2 -1
- data/lib/steep/drivers/print_project.rb +3 -1
- data/lib/steep/drivers/stats.rb +1 -1
- data/lib/steep/drivers/utils/driver_helper.rb +10 -8
- data/lib/steep/drivers/utils/jobs_option.rb +6 -1
- data/lib/steep/drivers/validate.rb +9 -5
- data/lib/steep/drivers/watch.rb +8 -3
- data/lib/steep/expectations.rb +144 -75
- data/lib/steep/index/signature_symbol_provider.rb +22 -13
- data/lib/steep/node_helper.rb +172 -0
- data/lib/steep/server/base_worker.rb +2 -1
- data/lib/steep/server/change_buffer.rb +17 -15
- data/lib/steep/server/interaction_worker.rb +20 -0
- data/lib/steep/server/lsp_formatter.rb +20 -1
- data/lib/steep/server/master.rb +51 -36
- data/lib/steep/server/type_check_worker.rb +18 -2
- data/lib/steep/server/worker_process.rb +19 -2
- data/lib/steep/services/completion_provider.rb +189 -3
- data/lib/steep/services/file_loader.rb +1 -1
- data/lib/steep/services/goto_service.rb +123 -27
- data/lib/steep/services/signature_help_provider.rb +1 -6
- data/lib/steep/signature/validator.rb +6 -1
- data/lib/steep/source.rb +165 -108
- data/lib/steep/subtyping/check.rb +5 -3
- data/lib/steep/subtyping/variable_variance.rb +11 -0
- data/lib/steep/thread_waiter.rb +35 -0
- data/lib/steep/type_construction.rb +416 -171
- data/lib/steep/type_inference/block_params.rb +50 -9
- data/lib/steep/type_inference/context.rb +4 -0
- data/lib/steep/type_inference/context_array.rb +6 -6
- data/lib/steep/type_inference/logic_type_interpreter.rb +202 -68
- data/lib/steep/typing.rb +5 -4
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +21 -14
- data/sample/Steepfile +1 -0
- data/sig/shims/bundler.rbs +3 -0
- data/sig/shims/language-server_protocol.rbs +151 -10
- data/sig/shims/parser/nodes.rbs +210 -0
- data/sig/shims/parser.rbs +10 -0
- data/sig/steep/ast/builtin.rbs +2 -2
- data/sig/steep/ast/node/type_application.rbs +2 -2
- data/sig/steep/ast/node/type_assertion.rbs +8 -2
- data/sig/steep/ast/types/factory.rbs +28 -1
- data/sig/steep/diagnostic/deprecated/else_on_exhaustive_case.rbs +13 -0
- data/sig/steep/diagnostic/lsp_formatter.rbs +5 -2
- data/sig/steep/diagnostic/ruby.rbs +76 -6
- data/sig/steep/drivers/annotations.rbs +5 -5
- data/sig/steep/drivers/check.rbs +11 -11
- data/sig/steep/drivers/diagnostic_printer.rbs +9 -9
- data/sig/steep/drivers/init.rbs +6 -6
- data/sig/steep/drivers/print_project.rbs +4 -4
- data/sig/steep/drivers/utils/driver_helper.rbs +8 -6
- data/sig/steep/drivers/validate.rbs +4 -4
- data/sig/steep/drivers/watch.rbs +1 -1
- data/sig/steep/expectations.rbs +72 -0
- data/sig/steep/index/signature_symbol_provider.rbs +22 -10
- data/sig/steep/interface/block.rbs +2 -0
- data/sig/steep/interface/function.rbs +2 -2
- data/sig/steep/node_helper.rbs +56 -0
- data/sig/steep/path_helper.rbs +1 -1
- data/sig/steep/project/options.rbs +1 -1
- data/sig/steep/range_extension.rbs +2 -2
- data/sig/steep/server/master.rbs +16 -2
- data/sig/steep/server/type_check_worker.rbs +5 -1
- data/sig/steep/server/worker_process.rbs +5 -1
- data/sig/steep/services/completion_provider.rbs +31 -1
- data/sig/steep/services/goto_service.rbs +80 -19
- data/sig/steep/source.rbs +27 -4
- data/sig/steep/subtyping/variable_variance.rbs +9 -9
- data/sig/steep/thread_waiter.rbs +13 -0
- data/sig/steep/type_construction.rbs +26 -9
- data/sig/steep/type_inference/block_params.rbs +13 -1
- data/sig/steep/type_inference/context.rbs +5 -1
- data/sig/steep/type_inference/context_array.rbs +16 -15
- data/sig/steep/type_inference/logic_type_interpreter.rbs +36 -6
- data/sig/steep/type_inference/type_env_builder.rbs +4 -0
- data/sig/steep/typing.rbs +22 -20
- data/sig/steep.rbs +14 -13
- data/smoke/and/a.rb +1 -1
- data/smoke/and/test_expectations.yml +5 -7
- data/smoke/diagnostics/incompatible_annotation.rb +1 -1
- data/smoke/diagnostics/test_expectations.yml +2 -2
- data/smoke/enumerator/a.rb +0 -7
- data/smoke/enumerator/b.rb +0 -2
- data/smoke/enumerator/test_expectations.yml +17 -105
- data/smoke/lambda/a.rb +0 -5
- data/smoke/lambda/test_expectations.yml +0 -22
- data/smoke/type_case/test_expectations.yml +10 -0
- data/steep.gemspec +2 -2
- metadata +16 -9
@@ -153,6 +153,36 @@ module Steep
|
|
153
153
|
def header_line: () -> ::String
|
154
154
|
end
|
155
155
|
|
156
|
+
# Setter method, which has a name ending with `=`, returns different type from the method type
|
157
|
+
#
|
158
|
+
# ```ruby
|
159
|
+
# class Foo
|
160
|
+
# # Assume `name=` has method type of `(String) -> String`
|
161
|
+
# def name=(value)
|
162
|
+
# return if value.empty?
|
163
|
+
# @value = value
|
164
|
+
# end
|
165
|
+
# end
|
166
|
+
# ```
|
167
|
+
#
|
168
|
+
# This is a special diagnostic for setter methods because the return value is not used with ordinal call syntax.
|
169
|
+
#
|
170
|
+
class SetterReturnTypeMismatch < Base
|
171
|
+
attr_reader expected: AST::Types::t
|
172
|
+
|
173
|
+
attr_reader actual: AST::Types::t
|
174
|
+
|
175
|
+
attr_reader result: Subtyping::Result::Base
|
176
|
+
|
177
|
+
attr_reader method_name: Symbol
|
178
|
+
|
179
|
+
include ResultPrinter
|
180
|
+
|
181
|
+
def initialize: (node: Parser::AST::Node, method_name: Symbol, expected: AST::Types::t, actual: AST::Types::t, result: Subtyping::Result::Base) -> void
|
182
|
+
|
183
|
+
def header_line: () -> String
|
184
|
+
end
|
185
|
+
|
156
186
|
class UnexpectedBlockGiven < Base
|
157
187
|
attr_reader method_type: untyped
|
158
188
|
|
@@ -299,6 +329,36 @@ module Steep
|
|
299
329
|
def header_line: () -> ::String
|
300
330
|
end
|
301
331
|
|
332
|
+
# Setter method, which has a name ending with `=`, has different type from the method type
|
333
|
+
#
|
334
|
+
# ```ruby
|
335
|
+
# class Foo
|
336
|
+
# # Assume `name=` has method type of `(String) -> String`
|
337
|
+
# def name=(value)
|
338
|
+
# @value = value
|
339
|
+
# value.strip!
|
340
|
+
# end
|
341
|
+
# end
|
342
|
+
# ```
|
343
|
+
#
|
344
|
+
# This is a special diagnostic for setter methods because the return value is not used with ordinal call syntax.
|
345
|
+
#
|
346
|
+
class SetterBodyTypeMismatch < Base
|
347
|
+
attr_reader expected: AST::Types::t
|
348
|
+
|
349
|
+
attr_reader actual: AST::Types::t
|
350
|
+
|
351
|
+
attr_reader result: Subtyping::Result::Base
|
352
|
+
|
353
|
+
attr_reader method_name: Symbol
|
354
|
+
|
355
|
+
include ResultPrinter
|
356
|
+
|
357
|
+
def initialize: (node: Parser::AST::Node & Parser::AST::_DefNode, expected: AST::Types::t, actual: AST::Types::t, result: Subtyping::Result::Base, method_name: Symbol) -> void
|
358
|
+
|
359
|
+
def header_line: () -> String
|
360
|
+
end
|
361
|
+
|
302
362
|
class UnexpectedYield < Base
|
303
363
|
def header_line: () -> "No block given for `yield`"
|
304
364
|
end
|
@@ -415,12 +475,8 @@ module Steep
|
|
415
475
|
def header_line: () -> ::String
|
416
476
|
end
|
417
477
|
|
418
|
-
class
|
419
|
-
|
420
|
-
|
421
|
-
def initialize: (node: untyped, type: untyped) -> void
|
422
|
-
|
423
|
-
def header_line: () -> "The branch is unreachable because the condition is exhaustive"
|
478
|
+
class UnreachableBranch < Base
|
479
|
+
def header_line: () -> String
|
424
480
|
end
|
425
481
|
|
426
482
|
class UnexpectedSplat < Base
|
@@ -530,6 +586,17 @@ module Steep
|
|
530
586
|
def header_line: () -> String
|
531
587
|
end
|
532
588
|
|
589
|
+
# Type hint is given to a proc/lambda but it was ignored
|
590
|
+
#
|
591
|
+
# 1. Because the hint is incompatible to `::Proc` type
|
592
|
+
# 2. More than one *proc type* is included in the hint
|
593
|
+
#
|
594
|
+
class ProcHintIgnored < Base
|
595
|
+
attr_reader hint_type: AST::Types::t
|
596
|
+
|
597
|
+
def initialize: (hint_type: AST::Types::t, node: Parser::AST::Node) -> void
|
598
|
+
end
|
599
|
+
|
533
600
|
# Argument forwarding `...` cannot be done safely, because of
|
534
601
|
#
|
535
602
|
# 1. The arguments are incompatible, or
|
@@ -575,6 +642,9 @@ module Steep
|
|
575
642
|
|
576
643
|
self.@lenient: template?
|
577
644
|
def self.lenient: () -> template
|
645
|
+
|
646
|
+
self.@silent: template?
|
647
|
+
def self.silent: () -> template
|
578
648
|
end
|
579
649
|
end
|
580
650
|
end
|
@@ -1,17 +1,17 @@
|
|
1
1
|
module Steep
|
2
2
|
module Drivers
|
3
3
|
class Annotations
|
4
|
-
attr_reader command_line_patterns:
|
4
|
+
attr_reader command_line_patterns: Array[String]
|
5
5
|
|
6
|
-
attr_reader stdout:
|
6
|
+
attr_reader stdout: IO
|
7
7
|
|
8
|
-
attr_reader stderr:
|
8
|
+
attr_reader stderr: IO
|
9
9
|
|
10
10
|
include Utils::DriverHelper
|
11
11
|
|
12
|
-
def initialize: (stdout:
|
12
|
+
def initialize: (stdout: IO, stderr: IO) -> void
|
13
13
|
|
14
|
-
def run: () ->
|
14
|
+
def run: () -> Integer
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/sig/steep/drivers/check.rbs
CHANGED
@@ -3,31 +3,31 @@ module Steep
|
|
3
3
|
class Check
|
4
4
|
module LSP = LanguageServer::Protocol
|
5
5
|
|
6
|
-
attr_reader stdout:
|
6
|
+
attr_reader stdout: IO
|
7
7
|
|
8
|
-
attr_reader stderr:
|
8
|
+
attr_reader stderr: IO
|
9
9
|
|
10
|
-
attr_reader command_line_patterns:
|
10
|
+
attr_reader command_line_patterns: Array[String]
|
11
11
|
|
12
|
-
attr_accessor with_expectations_path:
|
12
|
+
attr_accessor with_expectations_path: Pathname?
|
13
13
|
|
14
|
-
attr_accessor save_expectations_path:
|
14
|
+
attr_accessor save_expectations_path: Pathname?
|
15
15
|
|
16
|
-
attr_accessor severity_level:
|
16
|
+
attr_accessor severity_level: Diagnostic::LSPFormatter::severity
|
17
17
|
|
18
18
|
attr_reader jobs_option: Utils::JobsOption
|
19
19
|
|
20
20
|
include Utils::DriverHelper
|
21
21
|
|
22
|
-
def initialize: (stdout:
|
22
|
+
def initialize: (stdout: IO, stderr: IO) -> void
|
23
23
|
|
24
|
-
def run: () ->
|
24
|
+
def run: () -> Integer
|
25
25
|
|
26
|
-
def print_expectations: (project:
|
26
|
+
def print_expectations: (project: Project, all_files: Array[Pathname], expectations_path: Pathname, notifications: Array[untyped]) -> Integer
|
27
27
|
|
28
|
-
def save_expectations: (project:
|
28
|
+
def save_expectations: (project: Project, all_files: Array[Pathname], expectations_path: Pathname, notifications: Array[untyped]) -> Integer
|
29
29
|
|
30
|
-
def print_result: (project:
|
30
|
+
def print_result: (project: Project, notifications: Array[untyped]) -> Integer
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -3,23 +3,23 @@ module Steep
|
|
3
3
|
class DiagnosticPrinter
|
4
4
|
module LSP = LanguageServer::Protocol
|
5
5
|
|
6
|
-
attr_reader stdout:
|
6
|
+
attr_reader stdout: IO
|
7
7
|
|
8
|
-
attr_reader buffer:
|
8
|
+
attr_reader buffer: RBS::Buffer
|
9
9
|
|
10
|
-
def initialize: (stdout:
|
10
|
+
def initialize: (stdout: IO, buffer: RBS::Buffer) -> void
|
11
11
|
|
12
|
-
def path: () ->
|
12
|
+
def path: () -> Pathname
|
13
13
|
|
14
|
-
def color_severity: (
|
14
|
+
def color_severity: (String string, severity: String) -> String
|
15
15
|
|
16
|
-
def severity_message: (
|
16
|
+
def severity_message: (String) -> String
|
17
17
|
|
18
|
-
def location: (untyped diagnostic) ->
|
18
|
+
def location: (untyped diagnostic) -> String
|
19
19
|
|
20
|
-
def print: (untyped diagnostic, ?prefix: ::String, ?source: bool) ->
|
20
|
+
def print: (Hash[Symbol, untyped] diagnostic, ?prefix: ::String, ?source: bool) -> void
|
21
21
|
|
22
|
-
def print_source_line: (untyped diagnostic, ?prefix: ::String) ->
|
22
|
+
def print_source_line: (untyped diagnostic, ?prefix: ::String) -> void
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/sig/steep/drivers/init.rbs
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
module Steep
|
2
2
|
module Drivers
|
3
3
|
class Init
|
4
|
-
attr_reader stdout:
|
4
|
+
attr_reader stdout: IO
|
5
5
|
|
6
|
-
attr_reader stderr:
|
6
|
+
attr_reader stderr: IO
|
7
7
|
|
8
|
-
attr_accessor force_write:
|
8
|
+
attr_accessor force_write: bool
|
9
9
|
|
10
10
|
include Utils::DriverHelper
|
11
11
|
|
12
|
-
TEMPLATE:
|
12
|
+
TEMPLATE: String
|
13
13
|
|
14
|
-
def initialize: (stdout:
|
14
|
+
def initialize: (stdout: IO, stderr: IO) -> void
|
15
15
|
|
16
|
-
def run: () ->
|
16
|
+
def run: () -> Integer
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module Steep
|
2
2
|
module Drivers
|
3
3
|
class PrintProject
|
4
|
-
attr_reader stdout:
|
4
|
+
attr_reader stdout: IO
|
5
5
|
|
6
|
-
attr_reader stderr:
|
6
|
+
attr_reader stderr: IO
|
7
7
|
|
8
8
|
include Utils::DriverHelper
|
9
9
|
|
10
|
-
def initialize: (stdout:
|
10
|
+
def initialize: (stdout: IO, stderr: IO) -> void
|
11
11
|
|
12
|
-
def run: () ->
|
12
|
+
def run: () -> Integer
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
use LanguageServer::Protocol::Transport::Io::*
|
2
|
+
|
1
3
|
module Steep
|
2
4
|
module Drivers
|
3
5
|
module Utils
|
@@ -6,17 +8,17 @@ module Steep
|
|
6
8
|
|
7
9
|
def load_config: (?path: Pathname) -> Project
|
8
10
|
|
9
|
-
def type_check: (Project project) -> void
|
10
|
-
|
11
11
|
def request_id: () -> String
|
12
12
|
|
13
|
-
def wait_for_response_id: (reader:
|
13
|
+
def wait_for_response_id: (reader: Reader, id: String, ?unknown_responses: unknown_message_action) -> untyped
|
14
|
+
|
15
|
+
def shutdown_exit: (writer: Writer, reader: Reader) -> void
|
14
16
|
|
15
|
-
|
17
|
+
type unknown_message_action = :ignore | :log | :raise
|
16
18
|
|
17
|
-
def wait_for_message: (reader:
|
19
|
+
def wait_for_message: (reader: Reader, ?unknown_messages: unknown_message_action) { (untyped) -> bool } -> untyped
|
18
20
|
|
19
|
-
def keep_diagnostic?: (untyped diagnostic) -> bool
|
21
|
+
def keep_diagnostic?: (untyped diagnostic, severity_level: Diagnostic::LSPFormatter::severity) -> bool
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module Steep
|
2
2
|
module Drivers
|
3
3
|
class Validate
|
4
|
-
attr_reader stdout:
|
4
|
+
attr_reader stdout: IO
|
5
5
|
|
6
|
-
attr_reader stderr:
|
6
|
+
attr_reader stderr: IO
|
7
7
|
|
8
8
|
include Utils::DriverHelper
|
9
9
|
|
10
|
-
def initialize: (stdout:
|
10
|
+
def initialize: (stdout: IO, stderr: IO) -> void
|
11
11
|
|
12
|
-
def run: () ->
|
12
|
+
def run: () -> Integer
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/sig/steep/drivers/watch.rbs
CHANGED
@@ -0,0 +1,72 @@
|
|
1
|
+
module Steep
|
2
|
+
class Expectations
|
3
|
+
type status = :expected | :missing | :unexpected
|
4
|
+
|
5
|
+
class Diagnostic
|
6
|
+
module DiagnosticSeverity = LanguageServer::Protocol::Constant::DiagnosticSeverity
|
7
|
+
|
8
|
+
type position = { line: Integer, character: Integer }
|
9
|
+
|
10
|
+
attr_reader start_position: position
|
11
|
+
|
12
|
+
attr_reader end_position: position
|
13
|
+
|
14
|
+
attr_reader severity: Steep::Diagnostic::LSPFormatter::severity
|
15
|
+
|
16
|
+
attr_reader message: String
|
17
|
+
|
18
|
+
attr_reader code: String
|
19
|
+
|
20
|
+
def initialize: (start_position: position, end_position: position, severity: Steep::Diagnostic::LSPFormatter::severity, message: String, code: String) -> void
|
21
|
+
|
22
|
+
def self.from_hash: (untyped) -> instance
|
23
|
+
|
24
|
+
def self.from_lsp: (untyped) -> Diagnostic
|
25
|
+
|
26
|
+
def to_hash: () -> Hash[String, untyped]
|
27
|
+
|
28
|
+
def to_lsp: () -> Hash[Symbol, untyped]
|
29
|
+
|
30
|
+
def lsp_severity: () -> Integer
|
31
|
+
|
32
|
+
def sort_key: () -> Array[untyped]
|
33
|
+
end
|
34
|
+
|
35
|
+
class TestResult
|
36
|
+
attr_reader path: Pathname
|
37
|
+
|
38
|
+
attr_reader expectation: Array[Diagnostic]
|
39
|
+
|
40
|
+
attr_reader actual: Array[Diagnostic]
|
41
|
+
|
42
|
+
def initialize: (path: Pathname, expectation: Array[Diagnostic], actual: Array[Diagnostic]) -> void
|
43
|
+
|
44
|
+
def empty?: () -> bool
|
45
|
+
|
46
|
+
def satisfied?: () -> bool
|
47
|
+
|
48
|
+
def each_diagnostics: () { ([status, Diagnostic]) -> void } -> void
|
49
|
+
| () -> Enumerator[[status, Diagnostic], void]
|
50
|
+
|
51
|
+
def expected_diagnostics: () -> Array[Diagnostic]
|
52
|
+
|
53
|
+
def unexpected_diagnostics: () -> Array[Diagnostic]
|
54
|
+
|
55
|
+
def missing_diagnostics: () -> Array[Diagnostic]
|
56
|
+
end
|
57
|
+
|
58
|
+
module LSP = LanguageServer::Protocol
|
59
|
+
|
60
|
+
attr_reader diagnostics: Hash[Pathname, Array[Diagnostic]]
|
61
|
+
|
62
|
+
def initialize: () -> void
|
63
|
+
|
64
|
+
def test: (path: Pathname, diagnostics: Array[Diagnostic]) -> TestResult
|
65
|
+
|
66
|
+
def self.empty: () -> instance
|
67
|
+
|
68
|
+
def to_yaml: () -> String
|
69
|
+
|
70
|
+
def self.load: (path: Pathname, content: String) -> instance
|
71
|
+
end
|
72
|
+
end
|
@@ -1,29 +1,41 @@
|
|
1
|
+
use LanguageServer::Protocol::Constant::SymbolKind
|
2
|
+
|
1
3
|
module Steep
|
2
4
|
module Index
|
3
5
|
class SignatureSymbolProvider
|
4
6
|
module LSP = LanguageServer::Protocol
|
5
7
|
|
6
|
-
SymbolInformation
|
8
|
+
class SymbolInformation
|
9
|
+
attr_reader name: String
|
10
|
+
|
11
|
+
attr_reader location: RBS::Location[untyped, untyped]
|
12
|
+
|
13
|
+
attr_reader container_name: String?
|
14
|
+
|
15
|
+
attr_reader kind: SymbolKind::t
|
16
|
+
|
17
|
+
def initialize: (name: String, location: RBS::Location[untyped, untyped], container_name: String?, kind: SymbolKind::t) -> void
|
18
|
+
end
|
7
19
|
|
8
|
-
attr_reader project:
|
20
|
+
attr_reader project: Project
|
9
21
|
|
10
|
-
attr_reader indexes:
|
22
|
+
attr_reader indexes: Array[RBSIndex]
|
11
23
|
|
12
|
-
attr_reader assignment:
|
24
|
+
attr_reader assignment: Services::PathAssignment
|
13
25
|
|
14
|
-
def initialize: (project:
|
26
|
+
def initialize: (project: Project, assignment: Services::PathAssignment) -> void
|
15
27
|
|
16
|
-
def self.test_type_name: (
|
28
|
+
def self.test_type_name: (String query, RBS::TypeName type_name) -> bool
|
17
29
|
|
18
30
|
alias self.test_const_name self.test_type_name
|
19
31
|
|
20
|
-
|
32
|
+
def self.test_global_name: (String query, Symbol global_name) -> bool
|
21
33
|
|
22
|
-
def self.test_method_name: (
|
34
|
+
def self.test_method_name: (String query, method_name) -> bool
|
23
35
|
|
24
|
-
def assigned?: (
|
36
|
+
def assigned?: (Pathname) -> bool
|
25
37
|
|
26
|
-
def query_symbol: (
|
38
|
+
def query_symbol: (String query) -> Array[SymbolInformation]
|
27
39
|
end
|
28
40
|
end
|
29
41
|
end
|
@@ -140,7 +140,7 @@ module Steep
|
|
140
140
|
|
141
141
|
def optional: () -> Array[AST::Types::t]
|
142
142
|
|
143
|
-
def rest: () -> AST::Types::t?
|
143
|
+
%a{pure} def rest: () -> AST::Types::t?
|
144
144
|
|
145
145
|
attr_reader positional_params: PositionalParams?
|
146
146
|
|
@@ -166,7 +166,7 @@ module Steep
|
|
166
166
|
|
167
167
|
def hash: () -> untyped
|
168
168
|
|
169
|
-
def flat_unnamed_params: () ->
|
169
|
+
def flat_unnamed_params: () -> Array[[:required | :optional, AST::Types::t]]
|
170
170
|
|
171
171
|
def flat_keywords: () -> untyped
|
172
172
|
|
data/sig/steep/node_helper.rbs
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
use Parser::AST::Node
|
2
|
+
use Parser::AST::_Condition, Parser::AST::_Ternary, Parser::AST::_Keyword, Parser::AST::_RescueBody, Parser::AST::_Send
|
3
|
+
use Parser::Source::Map
|
4
|
+
|
1
5
|
module Steep
|
2
6
|
module NodeHelper
|
3
7
|
def each_child_node: (Parser::AST::Node) -> Enumerator[Parser::AST::Node, void]
|
@@ -9,5 +13,57 @@ module Steep
|
|
9
13
|
# Returns true if given node is a syntactic-value node
|
10
14
|
#
|
11
15
|
def value_node?: (Parser::AST::Node) -> bool
|
16
|
+
|
17
|
+
type condition_loc = Map & _Condition
|
18
|
+
|
19
|
+
type ternary_loc = Map & _Ternary
|
20
|
+
|
21
|
+
def deconstruct_if_node: (Node) -> [Node, Node?, Node?, condition_loc | ternary_loc]?
|
22
|
+
|
23
|
+
def deconstruct_if_node!: (Node) -> [Node, Node?, Node?, condition_loc | ternary_loc]
|
24
|
+
|
25
|
+
def test_if_node: (Node) { (Node, Node?, Node?, condition_loc | ternary_loc) -> bool } -> bool
|
26
|
+
|
27
|
+
type keyword_loc = Map & Parser::AST::_Keyword
|
28
|
+
|
29
|
+
def deconstruct_whileish_node: (Node) -> [Node, Node?, keyword_loc]?
|
30
|
+
|
31
|
+
def deconstruct_whileish_node!: (Node) -> [Node, Node?, keyword_loc]
|
32
|
+
|
33
|
+
def test_whileish_node: (Node) { (Node, Node?, keyword_loc) -> bool } -> bool
|
34
|
+
|
35
|
+
def deconstruct_case_node: (Node) -> [Node?, Array[Node], Node?, condition_loc]?
|
36
|
+
|
37
|
+
def deconstruct_case_node!: (Node) -> [Node?, Array[Node], Node?, condition_loc]
|
38
|
+
|
39
|
+
def test_case_node: (Node) { (Node?, Array[Node], Node?, condition_loc) -> bool } -> bool
|
40
|
+
|
41
|
+
def deconstruct_when_node: (Node) -> [Array[Node], Node?, keyword_loc]?
|
42
|
+
|
43
|
+
def deconstruct_when_node!: (Node) -> [Array[Node], Node?, keyword_loc]
|
44
|
+
|
45
|
+
def test_when_node: (Node) { (Array[Node], Node?, keyword_loc) -> bool } -> bool
|
46
|
+
|
47
|
+
def deconstruct_rescue_node: (Node) -> [Node?, Array[Node], Node?, condition_loc]?
|
48
|
+
|
49
|
+
def deconstruct_rescue_node!: (Node) -> [Node?, Array[Node], Node?, condition_loc]
|
50
|
+
|
51
|
+
def test_rescue_node: (Node) { (Node?, Array[Node], Node?, condition_loc) -> bool } -> bool
|
52
|
+
|
53
|
+
type rescue_body_loc = Map & _RescueBody
|
54
|
+
|
55
|
+
def deconstruct_resbody_node: (Node) -> [Node?, Node?, Node?, rescue_body_loc]?
|
56
|
+
|
57
|
+
def deconstruct_resbody_node!: (Node) -> [Node?, Node?, Node?, rescue_body_loc]
|
58
|
+
|
59
|
+
def test_resbody_node: (Node) { (Node?, Node?, Node?, rescue_body_loc) -> bool } -> bool
|
60
|
+
|
61
|
+
type send_loc = Map & _Send
|
62
|
+
|
63
|
+
def deconstruct_send_node: (Node) -> [Node?, Symbol, Array[Node], send_loc]?
|
64
|
+
|
65
|
+
def deconstruct_send_node!: (Node) -> [Node?, Symbol, Array[Node], send_loc]
|
66
|
+
|
67
|
+
def test_send_node: (Node) { (Node?, Symbol, Array[Node], send_loc) -> bool } -> bool
|
12
68
|
end
|
13
69
|
end
|
data/sig/steep/path_helper.rbs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class RBS::Location[in RK, in OK]
|
2
|
-
def as_lsp_range: () ->
|
2
|
+
def as_lsp_range: () -> LanguageServer::Protocol::Interface::Range::json
|
3
3
|
end
|
4
4
|
|
5
5
|
class Parser::Source::Range
|
6
|
-
def as_lsp_range: () ->
|
6
|
+
def as_lsp_range: () -> LanguageServer::Protocol::Interface::Range::json
|
7
7
|
end
|
data/sig/steep/server/master.rbs
CHANGED
@@ -227,8 +227,24 @@ module Steep
|
|
227
227
|
|
228
228
|
def initialize: (project: Project, reader: untyped, writer: untyped, interaction_worker: WorkerProcess?, typecheck_workers: Array[WorkerProcess], ?queue: Thread::Queue) -> void
|
229
229
|
|
230
|
+
# Start the Steep language server
|
231
|
+
#
|
232
|
+
# Returns after the language server shutdown.
|
233
|
+
# The shutdown process starts by `exit` message.
|
234
|
+
#
|
235
|
+
# Raises an exception if the worker processes doesn't shutdown properly, like being `#kill`-ed.
|
236
|
+
# Exiting the process is assumed in the case of error.
|
237
|
+
# The only one cleanup it does is stopping the worker processes, by `SIGKILL`.
|
238
|
+
#
|
230
239
|
def start: () -> void
|
231
240
|
|
241
|
+
# Stops the language server workers by sending SIGTERM
|
242
|
+
#
|
243
|
+
# This skips the normal shutdown process defined in LSP.
|
244
|
+
# The `#start` call will result in an exception.
|
245
|
+
#
|
246
|
+
def kill: () -> void
|
247
|
+
|
232
248
|
def each_worker: () { (WorkerProcess) -> void } -> void
|
233
249
|
| () -> Enumerator[WorkerProcess, void]
|
234
250
|
|
@@ -253,8 +269,6 @@ module Steep
|
|
253
269
|
def send_request: (method: String, worker: WorkerProcess, ?id: String, ?params: untyped?) ?{ (ResultHandler) -> void } -> ResultHandler
|
254
270
|
|
255
271
|
def group_request: () { (GroupHandler) -> void } -> GroupHandler
|
256
|
-
|
257
|
-
def kill: () -> void
|
258
272
|
end
|
259
273
|
end
|
260
274
|
end
|
@@ -72,7 +72,7 @@ module Steep
|
|
72
72
|
end
|
73
73
|
|
74
74
|
class GotoJob
|
75
|
-
type kind = :implementation | :definition
|
75
|
+
type kind = :implementation | :definition | :type_definition
|
76
76
|
|
77
77
|
attr_reader id: String
|
78
78
|
|
@@ -88,9 +88,13 @@ module Steep
|
|
88
88
|
|
89
89
|
def self.definition: (id: String, params: params) -> GotoJob
|
90
90
|
|
91
|
+
def self.type_definition: (id: String, params: params) -> GotoJob
|
92
|
+
|
91
93
|
def implementation?: () -> bool
|
92
94
|
|
93
95
|
def definition?: () -> bool
|
96
|
+
|
97
|
+
def type_definition?: () -> bool
|
94
98
|
end
|
95
99
|
|
96
100
|
include ChangeBuffer
|
@@ -87,7 +87,11 @@ module Steep
|
|
87
87
|
|
88
88
|
def read: () { (untyped) -> void } -> void
|
89
89
|
|
90
|
-
|
90
|
+
# Stop the process by sending SIGTERM and wait for the process exit
|
91
|
+
#
|
92
|
+
# Send `SIGKILL` and returns immediately if `force:` is `true`.
|
93
|
+
#
|
94
|
+
def kill: (?force: bool) -> void
|
91
95
|
end
|
92
96
|
end
|
93
97
|
end
|