steep 1.8.3 → 1.9.0.dev.2
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/CHANGELOG.md +0 -22
- data/Steepfile +35 -26
- data/bin/rbs-inline +19 -0
- data/lib/steep/cli.rb +38 -5
- data/lib/steep/diagnostic/ruby.rb +11 -58
- data/lib/steep/drivers/annotations.rb +1 -1
- data/lib/steep/drivers/check.rb +103 -1
- data/lib/steep/drivers/checkfile.rb +10 -8
- data/lib/steep/drivers/print_project.rb +83 -40
- data/lib/steep/drivers/utils/driver_helper.rb +39 -6
- data/lib/steep/drivers/watch.rb +24 -2
- data/lib/steep/index/signature_symbol_provider.rb +8 -8
- data/lib/steep/interface/builder.rb +14 -1
- data/lib/steep/interface/function.rb +2 -2
- data/lib/steep/path_helper.rb +4 -2
- data/lib/steep/project/dsl.rb +176 -151
- data/lib/steep/project/group.rb +31 -0
- data/lib/steep/project/pattern.rb +4 -0
- data/lib/steep/project/target.rb +32 -6
- data/lib/steep/project.rb +38 -10
- data/lib/steep/server/custom_methods.rb +16 -0
- data/lib/steep/server/delay_queue.rb +0 -3
- data/lib/steep/server/interaction_worker.rb +2 -11
- data/lib/steep/server/master.rb +129 -279
- data/lib/steep/server/target_group_files.rb +205 -0
- data/lib/steep/server/type_check_controller.rb +366 -0
- data/lib/steep/server/type_check_worker.rb +60 -86
- data/lib/steep/services/file_loader.rb +23 -0
- data/lib/steep/services/goto_service.rb +40 -31
- data/lib/steep/services/hover_provider/singleton_methods.rb +4 -4
- data/lib/steep/services/path_assignment.rb +23 -4
- data/lib/steep/services/type_check_service.rb +76 -159
- data/lib/steep/signature/validator.rb +4 -4
- data/lib/steep/subtyping/check.rb +2 -2
- data/lib/steep/thread_waiter.rb +24 -16
- data/lib/steep/type_construction.rb +12 -3
- data/lib/steep/type_inference/block_params.rb +1 -2
- data/lib/steep/type_inference/context.rb +1 -1
- data/lib/steep/type_inference/type_env.rb +4 -4
- data/lib/steep/type_inference/type_env_builder.rb +1 -1
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +6 -4
- data/sample/Steepfile +6 -0
- data/sample/lib/conference.rb +1 -5
- data/steep.gemspec +7 -1
- metadata +9 -6
- data/lib/steep/drivers/validate.rb +0 -65
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89c207623c288c2142cdcf7d7de7f404da4d160b5bc40c84210116a721ec4029
|
4
|
+
data.tar.gz: dfd95e726115676f4d293d312bd1f06afa6ea89336911e9887c8e4b5ee1167ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9800ef17d4108ff391642510701e12a0ec4e63035c74765ed1203fa9b62d964be10441d60890ab3c643dc8d0295dd2a68be5285126307f3cb401f517eaa799f
|
7
|
+
data.tar.gz: 3ef2c5d7bac4dd2d492df8e5c60322de6c06d9c33cec21e2a97e4608f235e41729f0383e0817cfd324213853cad4c34308b14f5a582eedda71d36828545d6840
|
data/CHANGELOG.md
CHANGED
@@ -1,27 +1,5 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
## 1.8.3 (2024-10-29)
|
4
|
-
|
5
|
-
### Type checker core
|
6
|
-
|
7
|
-
* Fix untyped hash typing ([#1299](https://github.com/soutaro/steep/pull/1299), Backport in [#1301](https://github.com/soutaro/steep/pull/1301))
|
8
|
-
|
9
|
-
### Language server
|
10
|
-
|
11
|
-
* Handle file deletion notification ([#1300](https://github.com/soutaro/steep/pull/1300), Backport in [#1301](https://github.com/soutaro/steep/pull/1301))
|
12
|
-
|
13
|
-
## 1.8.2 (2024-10-24)
|
14
|
-
|
15
|
-
### Language server
|
16
|
-
|
17
|
-
* Ignore `didChangeWatchedFiles notification` for open files ([#1290](https://github.com/soutaro/steep/pull/1290))
|
18
|
-
|
19
|
-
## 1.8.1 (2024-10-08)
|
20
|
-
|
21
|
-
### Language server
|
22
|
-
|
23
|
-
* Skip sending response to `$/steep/typecheck` request from `steep langserver` ([#1268](https://github.com/soutaro/steep/pull/1268), backport [#1267](https://github.com/soutaro/steep/pull/1267))
|
24
|
-
|
25
3
|
## 1.8.0 (2024-09-30)
|
26
4
|
|
27
5
|
### Type checker core
|
data/Steepfile
CHANGED
@@ -1,42 +1,51 @@
|
|
1
1
|
D = Steep::Diagnostic
|
2
2
|
|
3
|
+
FileUtils.mkpath("tmp")
|
4
|
+
tmp_rbs_dir = Pathname("tmp/rbs-sig")
|
5
|
+
|
6
|
+
definition = Bundler::Definition.build(Pathname("Gemfile"), Pathname("Gemfile.lock"), nil)
|
7
|
+
rbs_dep = definition.dependencies.find {|dep| dep.name == "rbs" }
|
8
|
+
if (source = rbs_dep&.source).is_a?(Bundler::Source::Path)
|
9
|
+
unless tmp_rbs_dir.directory?
|
10
|
+
FileUtils.ln_s(Pathname.pwd + source.path + "sig", tmp_rbs_dir.to_s, force: true)
|
11
|
+
end
|
12
|
+
else
|
13
|
+
FileUtils.rm_f(tmp_rbs_dir)
|
14
|
+
library "rbs"
|
15
|
+
end
|
16
|
+
|
3
17
|
target :app do
|
18
|
+
collection_config "rbs_collection.steep.yaml"
|
19
|
+
|
4
20
|
check "lib"
|
5
21
|
ignore "lib/steep/shims"
|
6
22
|
|
7
23
|
signature "sig"
|
8
|
-
|
9
|
-
collection_config "rbs_collection.steep.yaml"
|
24
|
+
ignore_signature "sig/test"
|
10
25
|
|
11
26
|
configure_code_diagnostics(D::Ruby.strict) do |hash|
|
12
27
|
end
|
13
28
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
definition = Bundler::Definition.build(Pathname("Gemfile"), Pathname("Gemfile.lock"), nil)
|
18
|
-
rbs_dep = definition.dependencies.find {|dep| dep.name == "rbs" }
|
19
|
-
if (source = rbs_dep&.source).is_a?(Bundler::Source::Path)
|
20
|
-
unless Pathname(tmp_rbs_dir).exist?
|
21
|
-
FileUtils.ln_s(Pathname.pwd + source.path + "sig", tmp_rbs_dir, force: true)
|
22
|
-
end
|
23
|
-
signature tmp_rbs_dir
|
29
|
+
if tmp_rbs_dir.directory?
|
30
|
+
signature tmp_rbs_dir.to_s
|
24
31
|
else
|
25
|
-
FileUtils.rm_f(tmp_rbs_dir)
|
26
32
|
library "rbs"
|
27
33
|
end
|
34
|
+
end
|
35
|
+
|
36
|
+
target :test do
|
37
|
+
collection_config "rbs_collection.steep.yaml"
|
38
|
+
|
39
|
+
unreferenced!
|
40
|
+
|
41
|
+
check "test"
|
42
|
+
signature "sig/test"
|
28
43
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
'singleton',
|
37
|
-
'shellwords',
|
38
|
-
'find',
|
39
|
-
'digest',
|
40
|
-
"optparse",
|
41
|
-
)
|
44
|
+
configure_code_diagnostics(D::Ruby.lenient)
|
45
|
+
|
46
|
+
if tmp_rbs_dir.directory?
|
47
|
+
signature tmp_rbs_dir.to_s
|
48
|
+
else
|
49
|
+
library "rbs"
|
50
|
+
end
|
42
51
|
end
|
data/bin/rbs-inline
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
BINSTUB_DIR=$(cd $(dirname $0); pwd)
|
4
|
+
GEMFILE=$(readlink -f ${BINSTUB_DIR}/../gemfile_steep/Gemfile)
|
5
|
+
ROOT_DIR=$(readlink -f ${BINSTUB_DIR}/..)
|
6
|
+
|
7
|
+
RBSINLINE="bundle exec --gemfile=${GEMFILE} rbs-inline"
|
8
|
+
|
9
|
+
if type "rbenv" > /dev/null 2>&1; then
|
10
|
+
RBSINLINE="rbenv exec ${RBSINLINE}"
|
11
|
+
else
|
12
|
+
if type "rvm" > /dev/null 2>&1; then
|
13
|
+
if [ -e ${ROOT_DIR}/.ruby-version ]; then
|
14
|
+
RBS="rvm ${ROOT_DIR} do ${RBSINLINE}"
|
15
|
+
fi
|
16
|
+
fi
|
17
|
+
fi
|
18
|
+
|
19
|
+
exec $RBSINLINE $@
|
data/lib/steep/cli.rb
CHANGED
@@ -126,6 +126,39 @@ module Steep
|
|
126
126
|
opts.on("--severity-level=LEVEL", /^error|warning|information|hint$/, "Specify the minimum diagnostic severity to be recognized as an error (defaults: warning): error, warning, information, or hint") do |level|
|
127
127
|
command.severity_level = level.to_sym
|
128
128
|
end
|
129
|
+
|
130
|
+
opts.on("--group=GROUP", "Specify target/group name to type check") do |arg|
|
131
|
+
# @type var group: String
|
132
|
+
target, group = arg.split(".")
|
133
|
+
target or raise
|
134
|
+
command.active_group_names << [target.to_sym, group&.to_sym]
|
135
|
+
end
|
136
|
+
|
137
|
+
opts.on("--[no-]type-check", "Type check Ruby code") do |v|
|
138
|
+
command.type_check_code = v ? true : false
|
139
|
+
end
|
140
|
+
|
141
|
+
opts.on("--validate=OPTION", ["skip", "group", "project", "library"], "Validation levels of signatures (default: group, options: skip,group,project,library)") do |level|
|
142
|
+
case level
|
143
|
+
when "skip"
|
144
|
+
command.validate_group_signatures = false
|
145
|
+
command.validate_project_signatures = false
|
146
|
+
command.validate_library_signatures = false
|
147
|
+
when "group"
|
148
|
+
command.validate_group_signatures = true
|
149
|
+
command.validate_project_signatures = false
|
150
|
+
command.validate_library_signatures = false
|
151
|
+
when "project"
|
152
|
+
command.validate_group_signatures = true
|
153
|
+
command.validate_project_signatures = true
|
154
|
+
command.validate_library_signatures = false
|
155
|
+
when "library"
|
156
|
+
command.validate_group_signatures = true
|
157
|
+
command.validate_project_signatures = true
|
158
|
+
command.validate_library_signatures = true
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
129
162
|
handle_jobs_option command.jobs_option, opts
|
130
163
|
handle_logging_options opts
|
131
164
|
end.parse!(argv)
|
@@ -179,11 +212,8 @@ module Steep
|
|
179
212
|
end
|
180
213
|
|
181
214
|
def process_validate
|
182
|
-
|
183
|
-
|
184
|
-
handle_logging_options opts
|
185
|
-
end.parse!(argv)
|
186
|
-
end.run
|
215
|
+
stderr.puts "`steep validate` is deprecated. Use `steep check` with `--validate` option instead."
|
216
|
+
1
|
187
217
|
end
|
188
218
|
|
189
219
|
def process_annotations
|
@@ -202,6 +232,9 @@ module Steep
|
|
202
232
|
OptionParser.new do |opts|
|
203
233
|
opts.banner = "Usage: steep project [options]"
|
204
234
|
opts.on("--steepfile=PATH") {|path| command.steepfile = Pathname(path) }
|
235
|
+
opts.on("--[no-]print-files", "Print files") {|v|
|
236
|
+
command.print_files = v ? true : false
|
237
|
+
}
|
205
238
|
handle_logging_options opts
|
206
239
|
end.parse!(argv)
|
207
240
|
end.run
|
@@ -458,22 +458,6 @@ module Steep
|
|
458
458
|
end
|
459
459
|
end
|
460
460
|
|
461
|
-
class IncompatibleMethodTypeAnnotation < Base
|
462
|
-
attr_reader :interface_method
|
463
|
-
attr_reader :annotation_method
|
464
|
-
attr_reader :result
|
465
|
-
|
466
|
-
include ResultPrinter
|
467
|
-
|
468
|
-
def initialize(node:, interface_method:, annotation_method:, result:)
|
469
|
-
raise
|
470
|
-
super(node: node)
|
471
|
-
@interface_method = interface_method
|
472
|
-
@annotation_method = annotation_method
|
473
|
-
@result = result
|
474
|
-
end
|
475
|
-
end
|
476
|
-
|
477
461
|
class MethodReturnTypeAnnotationMismatch < Base
|
478
462
|
attr_reader :method_type
|
479
463
|
attr_reader :annotation_type
|
@@ -697,25 +681,6 @@ module Steep
|
|
697
681
|
end
|
698
682
|
end
|
699
683
|
|
700
|
-
class IncompatibleTypeCase < Base
|
701
|
-
attr_reader :var_name
|
702
|
-
attr_reader :result
|
703
|
-
attr_reader :relation
|
704
|
-
|
705
|
-
def initialize(node:, var_name:, result:, relation:)
|
706
|
-
super(node: node)
|
707
|
-
@var_name = var_name
|
708
|
-
@result = result
|
709
|
-
@relation = relation
|
710
|
-
end
|
711
|
-
|
712
|
-
include ResultPrinter
|
713
|
-
|
714
|
-
def header_line
|
715
|
-
"Type annotation for branch about `#{var_name}` is incompatible since #{relation} doesn't hold"
|
716
|
-
end
|
717
|
-
end
|
718
|
-
|
719
684
|
class UnreachableBranch < Base
|
720
685
|
def header_line
|
721
686
|
"The branch is unreachable"
|
@@ -735,19 +700,6 @@ module Steep
|
|
735
700
|
end
|
736
701
|
end
|
737
702
|
|
738
|
-
class UnexpectedSplat < Base
|
739
|
-
attr_reader :type
|
740
|
-
|
741
|
-
def initialize(node:, type:)
|
742
|
-
super(node: node)
|
743
|
-
@type = type
|
744
|
-
end
|
745
|
-
|
746
|
-
def header_line
|
747
|
-
"Hash splat is given with object other than `Hash[X, Y]`"
|
748
|
-
end
|
749
|
-
end
|
750
|
-
|
751
703
|
class ProcTypeExpected < Base
|
752
704
|
attr_reader :type
|
753
705
|
|
@@ -965,6 +917,13 @@ module Steep
|
|
965
917
|
end
|
966
918
|
end
|
967
919
|
|
920
|
+
class UnannotatedEmptyCollection < Base
|
921
|
+
def header_line
|
922
|
+
node or raise
|
923
|
+
"Empty #{node.type} doesn't have type annotation"
|
924
|
+
end
|
925
|
+
end
|
926
|
+
|
968
927
|
ALL = ObjectSpace.each_object(Class).with_object([]) do |klass, array|
|
969
928
|
if klass < Base
|
970
929
|
array << klass
|
@@ -991,8 +950,6 @@ module Steep
|
|
991
950
|
IncompatibleAnnotation => :hint,
|
992
951
|
IncompatibleArgumentForwarding => :warning,
|
993
952
|
IncompatibleAssignment => :hint,
|
994
|
-
IncompatibleMethodTypeAnnotation => :hint,
|
995
|
-
IncompatibleTypeCase => :hint,
|
996
953
|
InsufficientKeywordArguments => :error,
|
997
954
|
InsufficientPositionalArguments => :error,
|
998
955
|
InsufficientTypeArgument => :hint,
|
@@ -1013,6 +970,7 @@ module Steep
|
|
1013
970
|
SetterReturnTypeMismatch => :information,
|
1014
971
|
SyntaxError => :hint,
|
1015
972
|
TypeArgumentMismatchError => :hint,
|
973
|
+
UnannotatedEmptyCollection => :warning,
|
1016
974
|
UnexpectedBlockGiven => :warning,
|
1017
975
|
UnexpectedDynamicMethod => :hint,
|
1018
976
|
UnexpectedError => :hint,
|
@@ -1020,7 +978,6 @@ module Steep
|
|
1020
978
|
UnexpectedJumpValue => :hint,
|
1021
979
|
UnexpectedKeywordArgument => :error,
|
1022
980
|
UnexpectedPositionalArgument => :error,
|
1023
|
-
UnexpectedSplat => :hint,
|
1024
981
|
UnexpectedSuper => :information,
|
1025
982
|
UnexpectedTypeArgument => :hint,
|
1026
983
|
UnexpectedYield => :warning,
|
@@ -1050,8 +1007,6 @@ module Steep
|
|
1050
1007
|
IncompatibleAnnotation => :error,
|
1051
1008
|
IncompatibleArgumentForwarding => :error,
|
1052
1009
|
IncompatibleAssignment => :error,
|
1053
|
-
IncompatibleMethodTypeAnnotation => :error,
|
1054
|
-
IncompatibleTypeCase => :error,
|
1055
1010
|
InsufficientKeywordArguments => :error,
|
1056
1011
|
InsufficientPositionalArguments => :error,
|
1057
1012
|
InsufficientTypeArgument => :error,
|
@@ -1072,6 +1027,7 @@ module Steep
|
|
1072
1027
|
SetterReturnTypeMismatch => :error,
|
1073
1028
|
SyntaxError => :hint,
|
1074
1029
|
TypeArgumentMismatchError => :error,
|
1030
|
+
UnannotatedEmptyCollection => :error,
|
1075
1031
|
UnexpectedBlockGiven => :error,
|
1076
1032
|
UnexpectedDynamicMethod => :information,
|
1077
1033
|
UnexpectedError => :information,
|
@@ -1079,7 +1035,6 @@ module Steep
|
|
1079
1035
|
UnexpectedJumpValue => :error,
|
1080
1036
|
UnexpectedKeywordArgument => :error,
|
1081
1037
|
UnexpectedPositionalArgument => :error,
|
1082
|
-
UnexpectedSplat => :warning,
|
1083
1038
|
UnexpectedSuper => :error,
|
1084
1039
|
UnexpectedTypeArgument => :error,
|
1085
1040
|
UnexpectedYield => :error,
|
@@ -1109,8 +1064,6 @@ module Steep
|
|
1109
1064
|
IncompatibleAnnotation => nil,
|
1110
1065
|
IncompatibleArgumentForwarding => :information,
|
1111
1066
|
IncompatibleAssignment => :hint,
|
1112
|
-
IncompatibleMethodTypeAnnotation => nil,
|
1113
|
-
IncompatibleTypeCase => nil,
|
1114
1067
|
InsufficientKeywordArguments => :information,
|
1115
1068
|
InsufficientPositionalArguments => :information,
|
1116
1069
|
InsufficientTypeArgument => nil,
|
@@ -1131,6 +1084,7 @@ module Steep
|
|
1131
1084
|
SetterReturnTypeMismatch => nil,
|
1132
1085
|
SyntaxError => :hint,
|
1133
1086
|
TypeArgumentMismatchError => nil,
|
1087
|
+
UnannotatedEmptyCollection => :hint,
|
1134
1088
|
UnexpectedBlockGiven => :hint,
|
1135
1089
|
UnexpectedDynamicMethod => nil,
|
1136
1090
|
UnexpectedError => :hint,
|
@@ -1138,7 +1092,6 @@ module Steep
|
|
1138
1092
|
UnexpectedJumpValue => nil,
|
1139
1093
|
UnexpectedKeywordArgument => :information,
|
1140
1094
|
UnexpectedPositionalArgument => :information,
|
1141
|
-
UnexpectedSplat => nil,
|
1142
1095
|
UnexpectedSuper => nil,
|
1143
1096
|
UnexpectedTypeArgument => nil,
|
1144
1097
|
UnexpectedYield => :information,
|
@@ -1155,7 +1108,7 @@ module Steep
|
|
1155
1108
|
end
|
1156
1109
|
|
1157
1110
|
def self.silent
|
1158
|
-
@silent ||= ALL.each.with_object({}) do |klass, hash|
|
1111
|
+
@silent ||= ALL.each.with_object({}) do |klass, hash| #$ template
|
1159
1112
|
hash[klass] = nil
|
1160
1113
|
end.freeze
|
1161
1114
|
end
|
@@ -21,7 +21,7 @@ module Steep
|
|
21
21
|
|
22
22
|
project.targets.each do |target|
|
23
23
|
Steep.logger.tagged "target=#{target.name}" do
|
24
|
-
service = Services::SignatureService.load_from(target.new_env_loader(
|
24
|
+
service = Services::SignatureService.load_from(target.new_env_loader())
|
25
25
|
|
26
26
|
sigs = loader.load_changes(target.signature_pattern, changes: {})
|
27
27
|
service.update(sigs)
|
data/lib/steep/drivers/check.rb
CHANGED
@@ -10,6 +10,12 @@ module Steep
|
|
10
10
|
attr_accessor :save_expectations_path
|
11
11
|
attr_accessor :severity_level
|
12
12
|
attr_reader :jobs_option
|
13
|
+
attr_reader :targets
|
14
|
+
attr_reader :active_group_names
|
15
|
+
attr_accessor :type_check_code
|
16
|
+
attr_accessor :validate_group_signatures
|
17
|
+
attr_accessor :validate_project_signatures
|
18
|
+
attr_accessor :validate_library_signatures
|
13
19
|
|
14
20
|
include Utils::DriverHelper
|
15
21
|
|
@@ -19,6 +25,27 @@ module Steep
|
|
19
25
|
@command_line_patterns = []
|
20
26
|
@severity_level = :warning
|
21
27
|
@jobs_option = Utils::JobsOption.new()
|
28
|
+
@active_group_names = []
|
29
|
+
@type_check_code = true
|
30
|
+
@validate_group_signatures = true
|
31
|
+
@validate_project_signatures = false
|
32
|
+
@validate_library_signatures = false
|
33
|
+
end
|
34
|
+
|
35
|
+
def active_group?(group)
|
36
|
+
return true if active_group_names.empty?
|
37
|
+
|
38
|
+
case group
|
39
|
+
when Project::Target
|
40
|
+
active_group_names.any? {|target_name, group_name|
|
41
|
+
target_name == group.name && group_name == nil
|
42
|
+
}
|
43
|
+
when Project::Group
|
44
|
+
active_group_names.any? {|target_name, group_name|
|
45
|
+
target_name == group.target.name &&
|
46
|
+
(group_name == group.name || group_name.nil?)
|
47
|
+
}
|
48
|
+
end
|
22
49
|
end
|
23
50
|
|
24
51
|
def run
|
@@ -64,9 +91,54 @@ module Steep
|
|
64
91
|
client_writer.write({ method: :initialize, id: initialize_id, params: DEFAULT_CLI_LSP_INITIALIZE_PARAMS })
|
65
92
|
wait_for_response_id(reader: client_reader, id: initialize_id)
|
66
93
|
|
94
|
+
params = { library_paths: [], signature_paths: [], code_paths: [] } #: Server::CustomMethods::TypeCheck::params
|
95
|
+
|
96
|
+
if command_line_patterns.empty?
|
97
|
+
files = Server::TargetGroupFiles.new(project)
|
98
|
+
loader = Services::FileLoader.new(base_dir: project.base_dir)
|
99
|
+
|
100
|
+
project.targets.each do |target|
|
101
|
+
target.new_env_loader.each_dir do |_, dir|
|
102
|
+
RBS::FileFinder.each_file(dir, skip_hidden: true) do |path|
|
103
|
+
files.add_library_path(target, path)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
loader.each_path_in_target(target) do |path|
|
108
|
+
files.add_path(path)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
project.targets.each do |target|
|
113
|
+
target.groups.each do |group|
|
114
|
+
if active_group?(group)
|
115
|
+
load_files(files, group.target, group, params: params)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
if active_group?(target)
|
119
|
+
load_files(files, target, target, params: params)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
else
|
123
|
+
command_line_patterns.each do |pattern|
|
124
|
+
path = Pathname(pattern)
|
125
|
+
path = project.absolute_path(path)
|
126
|
+
next unless path.file?
|
127
|
+
if target = project.target_for_source_path(path)
|
128
|
+
params[:code_paths] << [target.name.to_s, path.to_s]
|
129
|
+
end
|
130
|
+
if target = project.target_for_signature_path(path)
|
131
|
+
params[:signature_paths] << [target.name.to_s, path.to_s]
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
Steep.logger.info { "Starting type check with #{params[:code_paths].size} Ruby files and #{params[:signature_paths].size} RBS signatures..." }
|
137
|
+
Steep.logger.debug { params.inspect }
|
138
|
+
|
67
139
|
request_guid = SecureRandom.uuid
|
68
140
|
Steep.logger.info { "Starting type checking: #{request_guid}" }
|
69
|
-
client_writer.write(Server::CustomMethods::TypeCheck.request(request_guid,
|
141
|
+
client_writer.write(Server::CustomMethods::TypeCheck.request(request_guid, params))
|
70
142
|
|
71
143
|
diagnostic_notifications = [] #: Array[LanguageServer::Protocol::Interface::PublishDiagnosticsParams]
|
72
144
|
error_messages = [] #: Array[String]
|
@@ -132,6 +204,36 @@ module Steep
|
|
132
204
|
return 1
|
133
205
|
end
|
134
206
|
|
207
|
+
def load_files(files, target, group, params:)
|
208
|
+
if type_check_code
|
209
|
+
files.each_group_source_path(group) do |path|
|
210
|
+
params[:code_paths] << [target.name.to_s, target.project.absolute_path(path).to_s]
|
211
|
+
end
|
212
|
+
end
|
213
|
+
if validate_group_signatures
|
214
|
+
files.each_group_signature_path(group) do |path|
|
215
|
+
params[:signature_paths] << [target.name.to_s, target.project.absolute_path(path).to_s]
|
216
|
+
end
|
217
|
+
end
|
218
|
+
if validate_project_signatures
|
219
|
+
files.each_project_signature_path(target) do |path|
|
220
|
+
if path_target = files.signature_path_target(path)
|
221
|
+
params[:signature_paths] << [path_target.name.to_s, target.project.absolute_path(path).to_s]
|
222
|
+
end
|
223
|
+
end
|
224
|
+
if group.is_a?(Project::Group)
|
225
|
+
files.each_target_signature_path(target, group) do |path|
|
226
|
+
params[:signature_paths] << [target.name.to_s, target.project.absolute_path(path).to_s]
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
if validate_library_signatures
|
231
|
+
files.each_library_path(target) do |path|
|
232
|
+
params[:library_paths] << [target.name.to_s, path.to_s]
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
135
237
|
def print_expectations(project:, all_files:, expectations_path:, notifications:)
|
136
238
|
expectations = Expectations.load(path: expectations_path, content: expectations_path.read)
|
137
239
|
|
@@ -53,7 +53,7 @@ module Steep
|
|
53
53
|
nil
|
54
54
|
else
|
55
55
|
command_line_args
|
56
|
-
end
|
56
|
+
end #: Array[String]?
|
57
57
|
|
58
58
|
if ruby_patterns
|
59
59
|
loader.each_path_in_patterns(target.source_pattern, ruby_patterns) do |path|
|
@@ -69,7 +69,7 @@ module Steep
|
|
69
69
|
nil
|
70
70
|
else
|
71
71
|
command_line_args
|
72
|
-
end
|
72
|
+
end #: Array[String]
|
73
73
|
|
74
74
|
if rbs_patterns
|
75
75
|
loader.each_path_in_patterns(target.signature_pattern, rbs_patterns) do |path|
|
@@ -79,10 +79,10 @@ module Steep
|
|
79
79
|
end
|
80
80
|
|
81
81
|
stdin_input.each_key do |path|
|
82
|
-
case
|
83
|
-
when
|
82
|
+
case
|
83
|
+
when project.target_for_signature_path(path)
|
84
84
|
signature_paths << path
|
85
|
-
when
|
85
|
+
when project.target_for_source_path(path)
|
86
86
|
target_paths << path
|
87
87
|
end
|
88
88
|
end
|
@@ -156,13 +156,15 @@ module Steep
|
|
156
156
|
|
157
157
|
request_guid = master.fresh_request_id()
|
158
158
|
progress = master.work_done_progress(request_guid)
|
159
|
-
request = Server::
|
159
|
+
request = Server::TypeCheckController::Request.new(guid: request_guid, progress: progress)
|
160
160
|
|
161
161
|
target_paths.each do |path|
|
162
|
-
|
162
|
+
target = project.target_for_source_path(path) or next
|
163
|
+
request.code_paths << [target.name, project.absolute_path(path)]
|
163
164
|
end
|
164
165
|
signature_paths.each do |path|
|
165
|
-
|
166
|
+
target = project.target_for_signature_path(path) or next
|
167
|
+
request.signature_paths << [target.name, project.absolute_path(path)]
|
166
168
|
end
|
167
169
|
|
168
170
|
request.needs_response = true
|