steep 0.16.1 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42abbd58a114142d676d6f6a5ba60d736c56385814491f2c6b6c3eb7f84fbeed
4
- data.tar.gz: cecbb129ec52814935611a36eb9596e6cdce3857389880fc16c25102ba3d1641
3
+ metadata.gz: 6c7d4a0ac0c0bbae681b48b3a435baf1e30f67ed36ae86a9cf6e4546d6e30485
4
+ data.tar.gz: a22966a8fd94bed71ad1398d2587b7d84cfc8ba157a47da8b7289f2dae51b8d8
5
5
  SHA512:
6
- metadata.gz: 259698c20f17fbf9f19efd0fe46e5e1c9c4b8f50295c50dea3a9e8934be10ce3d017ad0410fdb3cd81822cd59968c3f3b2acf72ff55cbc99a6ab17e62173f91c
7
- data.tar.gz: f799370012998a8f6a418a497c816ed407e708fac59a6adcdbcaf2cb57d0ce241ce0494a0a0cedc557880eb195fe5620ac5d182664df984a158dbe8335a78b5f
6
+ metadata.gz: 31b10b5a6ac174dafee25cf2c9baaf725218e7c8e7969437557982dcc9c4c1704f8fb87bdd2a583eb9e538fee06376fe068ba2f8f64a5f18ec55919d3d49f9f4
7
+ data.tar.gz: 5f3db5481934cba32b3b45a92b2a9e2dc796507b3b99c2bdcc9c1a991b9ee6982dad1f5824c478abc7a483ba8ad17fab13ac48e6e13429daf465f3c025e66a40
@@ -2,11 +2,34 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.18.0 (2020-07-06)
6
+
7
+ * Sort result of `Pathname#glob` ([#154](https://github.com/soutaro/steep/pull/154))
8
+ * Sort methods in LanguageServer to return non-inherited methods first ([#159](https://github.com/soutaro/steep/pull/159))
9
+
10
+ ## 0.17.1 (2020-06-15)
11
+
12
+ * Allow RBS gem to be 0.4 ([#153](https://github.com/soutaro/steep/pull/153))
13
+
14
+ ## 0.17.0 (2020-06-13)
15
+
16
+ * Fix `steep watch` and `steep langserver` to correctly handle error message filterings based on options ([#152](https://github.com/soutaro/steep/pull/152))
17
+ * Fix typing of collections ([#151](https://github.com/soutaro/steep/pull/151))
18
+
19
+ ## 0.16.3
20
+
21
+ * Fix `steep watch` ([#147](https://github.com/soutaro/steep/pull/147))
22
+ * Stop using pry ([#148](https://github.com/soutaro/steep/pull/148))
23
+
24
+ ## 0.16.2 (2020-05-27)
25
+
26
+ * Update gems ([#144](https://github.com/soutaro/steep/pull/144), [#145](https://github.com/soutaro/steep/pull/145))
27
+
5
28
  ## 0.16.1 (2020-05-22)
6
29
 
7
30
  * Fix constant resolution ([#143](https://github.com/soutaro/steep/pull/143))
8
- * Fix RBS diagnostics line number in LSP ([142](https://github.com/soutaro/steep/pull/142))
9
- * Fix crash caused by hover on `def` in LSP ([140](https://github.com/soutaro/steep/pull/140))
31
+ * Fix RBS diagnostics line number in LSP ([#142](https://github.com/soutaro/steep/pull/142))
32
+ * Fix crash caused by hover on `def` in LSP ([#140](https://github.com/soutaro/steep/pull/140))
10
33
 
11
34
  ## 0.16.0 (2020-05-19)
12
35
 
@@ -8,10 +8,11 @@ require "logger"
8
8
  require "active_support/tagged_logging"
9
9
  require "rainbow"
10
10
  require "listen"
11
- require 'pry'
12
11
  require 'language_server-protocol'
13
12
  require "etc"
14
13
  require "open3"
14
+ require "stringio"
15
+ require 'uri'
15
16
 
16
17
  require "rbs"
17
18
 
@@ -53,18 +53,7 @@ module Steep
53
53
  status.type_check_sources.each do |source_file|
54
54
  case source_file.status
55
55
  when Project::SourceFile::TypeCheckStatus
56
- source_file.errors.reject do |error|
57
- case
58
- when error.is_a?(Errors::FallbackAny)
59
- target.options.allow_fallback_any
60
- when error.is_a?(Errors::MethodDefinitionMissing)
61
- target.options.allow_missing_definitions
62
- when error.is_a?(Errors::NoMethod)
63
- target.options.allow_unknown_method_calls
64
- when error.is_a?(Errors::UnknownConstantAssigned)
65
- target.options.allow_unknown_constant_assignment
66
- end
67
- end.each do |error|
56
+ source_file.errors.select {|error| target.options.error_to_report?(error) }.each do |error|
68
57
  error.print_to stdout
69
58
  end
70
59
  when Project::SourceFile::TypeCheckErrorStatus
@@ -24,7 +24,7 @@ module Steep
24
24
  project = load_config()
25
25
 
26
26
  loader = Project::FileLoader.new(project: project)
27
- loader.load_sources([])
27
+ loader.load_sources(dirs)
28
28
  loader.load_signatures()
29
29
 
30
30
  client_read, server_write = IO.pipe
@@ -36,7 +36,7 @@ module Steep
36
36
  server_reader = LanguageServer::Protocol::Transport::Io::Reader.new(server_read)
37
37
  server_writer = LanguageServer::Protocol::Transport::Io::Writer.new(server_write)
38
38
 
39
- interaction_worker = Server::InteractionWorker.spawn_worker(:interaction, name: "interaction", steepfile: project.steepfile_path)
39
+ interaction_worker = Server::WorkerProcess.spawn_worker(:interaction, name: "interaction", steepfile: project.steepfile_path)
40
40
  signature_worker = Server::WorkerProcess.spawn_worker(:signature, name: "signature", steepfile: project.steepfile_path)
41
41
  code_workers = Server::WorkerProcess.spawn_code_workers(steepfile: project.steepfile_path)
42
42
 
@@ -10,7 +10,7 @@ module Steep
10
10
 
11
11
  InstanceVariableItem = Struct.new(:identifier, :range, :type, keyword_init: true)
12
12
  LocalVariableItem = Struct.new(:identifier, :range, :type, keyword_init: true)
13
- MethodNameItem = Struct.new(:identifier, :range, :definition, :method_type, keyword_init: true)
13
+ MethodNameItem = Struct.new(:identifier, :range, :definition, :method_type, :inherited_method, keyword_init: true)
14
14
 
15
15
  attr_reader :source_text
16
16
  attr_reader :path
@@ -244,7 +244,8 @@ module Steep
244
244
  items << MethodNameItem.new(identifier: name,
245
245
  range: range,
246
246
  definition: method,
247
- method_type: method_type)
247
+ method_type: method_type,
248
+ inherited_method: inherited_method?(method, type))
248
249
  end
249
250
  end
250
251
  end
@@ -293,6 +294,10 @@ module Steep
293
294
 
294
295
  index
295
296
  end
297
+
298
+ def inherited_method?(method, type)
299
+ method.implemented_in&.name&.name != type.name&.name
300
+ end
296
301
  end
297
302
  end
298
303
  end
@@ -20,7 +20,7 @@ module Steep
20
20
  Pathname.glob(absolute_path)
21
21
  end
22
22
 
23
- files.each do |source_path|
23
+ files.sort.each do |source_path|
24
24
  yield project.relative_path(source_path)
25
25
  end
26
26
  end
@@ -37,6 +37,21 @@ module Steep
37
37
  self.allow_unknown_constant_assignment = true
38
38
  self.allow_unknown_method_calls = true
39
39
  end
40
+
41
+ def error_to_report?(error)
42
+ case
43
+ when error.is_a?(Errors::FallbackAny)
44
+ !allow_fallback_any
45
+ when error.is_a?(Errors::MethodDefinitionMissing)
46
+ !allow_missing_definitions
47
+ when error.is_a?(Errors::NoMethod)
48
+ !allow_unknown_method_calls
49
+ when error.is_a?(Errors::UnknownConstantAssigned)
50
+ !allow_unknown_constant_assignment
51
+ else
52
+ true
53
+ end
54
+ end
40
55
  end
41
56
  end
42
57
  end
@@ -47,7 +47,7 @@ module Steep
47
47
 
48
48
  Steep.logger.info "Finished type checking: #{path}@#{target.name}"
49
49
 
50
- diagnostics = source_diagnostics(source)
50
+ diagnostics = source_diagnostics(source, target.options)
51
51
 
52
52
  writer.write(
53
53
  method: :"textDocument/publishDiagnostics",
@@ -58,7 +58,7 @@ module Steep
58
58
  )
59
59
  end
60
60
 
61
- def source_diagnostics(source)
61
+ def source_diagnostics(source, options)
62
62
  case status = source.status
63
63
  when Project::SourceFile::ParseErrorStatus
64
64
  []
@@ -80,7 +80,7 @@ module Steep
80
80
  )
81
81
  ]
82
82
  when Project::SourceFile::TypeCheckStatus
83
- status.typing.errors.map do |error|
83
+ status.typing.errors.select {|error| options.error_to_report?(error) }.map do |error|
84
84
  loc = error.location_to_str
85
85
 
86
86
  LSP::Interface::Diagnostic.new(
@@ -191,7 +191,8 @@ HOVER
191
191
  range: range
192
192
  ),
193
193
  documentation: item.definition.comment&.string,
194
- insert_text_format: LanguageServer::Protocol::Constant::InsertTextFormat::SNIPPET
194
+ insert_text_format: LanguageServer::Protocol::Constant::InsertTextFormat::SNIPPET,
195
+ sort_text: item.inherited_method ? 'z' : 'a' # Ensure language server puts non-inherited methods before inherited methods
195
196
  )
196
197
  when Project::CompletionProvider::InstanceVariableItem
197
198
  label = "#{item.identifier}: #{item.type}"
@@ -1037,10 +1037,10 @@ module Steep
1037
1037
  case child.type
1038
1038
  when :pair
1039
1039
  key, value = child.children
1040
- key_types << synthesize(key).type.yield_self do |type|
1040
+ key_types << synthesize(key, hint: key_hint).type.yield_self do |type|
1041
1041
  select_super_type(type, key_hint)
1042
1042
  end
1043
- value_types << synthesize(value).type.yield_self do |type|
1043
+ value_types << synthesize(value, hint: value_hint).type.yield_self do |type|
1044
1044
  select_super_type(type, value_hint)
1045
1045
  end
1046
1046
  when :kwsplat
@@ -1256,7 +1256,7 @@ module Steep
1256
1256
  end
1257
1257
  end
1258
1258
  else
1259
- [select_super_type(synthesize(e).type, element_hint)]
1259
+ [select_super_type(synthesize(e, hint: element_hint).type, element_hint)]
1260
1260
  end
1261
1261
  end
1262
1262
  array_type = AST::Builtin::Array.instance_type(AST::Types::Union.build(types: element_types))
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "0.16.1"
2
+ VERSION = "0.18.0"
3
3
  end
@@ -14,6 +14,10 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://github.com/soutaro/steep"
15
15
  spec.license = 'MIT'
16
16
 
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/soutaro/steep"
19
+ spec.metadata["changelog_uri"] = "https://github.com/soutaro/steep/blob/master/CHANGELOG.md"
20
+
17
21
  spec.files = `git ls-files -z`.split("\x0").reject {|f|
18
22
  f.match(%r{^(test|spec|features)/})
19
23
  }
@@ -28,7 +32,7 @@ Gem::Specification.new do |spec|
28
32
  spec.add_development_dependency "rake", "~> 13.0"
29
33
  spec.add_development_dependency "minitest", "~> 5.0"
30
34
  spec.add_development_dependency "racc", "~> 1.4"
31
- spec.add_development_dependency "minitest-reporters", "~> 1.3.6"
35
+ spec.add_development_dependency "minitest-reporters", "~> 1.4.2"
32
36
  spec.add_development_dependency "minitest-hooks", "~> 1.5.0"
33
37
 
34
38
  spec.add_runtime_dependency "parser", "~> 2.7.0"
@@ -36,7 +40,6 @@ Gem::Specification.new do |spec|
36
40
  spec.add_runtime_dependency "activesupport", ">= 5.1"
37
41
  spec.add_runtime_dependency "rainbow", ">= 2.2.2", "< 4.0"
38
42
  spec.add_runtime_dependency "listen", "~> 3.1"
39
- spec.add_runtime_dependency "pry", "~> 0.12.2"
40
43
  spec.add_runtime_dependency "language_server-protocol", "~> 3.14.0.2"
41
- spec.add_runtime_dependency "rbs", "~> 0.3.1"
44
+ spec.add_runtime_dependency "rbs", ">= 0.3.1", '< 0.5.0'
42
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.1
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-22 00:00:00.000000000 Z
11
+ date: 2020-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.3.6
75
+ version: 1.4.2
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.3.6
82
+ version: 1.4.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest-hooks
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -170,20 +170,6 @@ dependencies:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
172
  version: '3.1'
173
- - !ruby/object:Gem::Dependency
174
- name: pry
175
- requirement: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: 0.12.2
180
- type: :runtime
181
- prerelease: false
182
- version_requirements: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - "~>"
185
- - !ruby/object:Gem::Version
186
- version: 0.12.2
187
173
  - !ruby/object:Gem::Dependency
188
174
  name: language_server-protocol
189
175
  requirement: !ruby/object:Gem::Requirement
@@ -202,16 +188,22 @@ dependencies:
202
188
  name: rbs
203
189
  requirement: !ruby/object:Gem::Requirement
204
190
  requirements:
205
- - - "~>"
191
+ - - ">="
206
192
  - !ruby/object:Gem::Version
207
193
  version: 0.3.1
194
+ - - "<"
195
+ - !ruby/object:Gem::Version
196
+ version: 0.5.0
208
197
  type: :runtime
209
198
  prerelease: false
210
199
  version_requirements: !ruby/object:Gem::Requirement
211
200
  requirements:
212
- - - "~>"
201
+ - - ">="
213
202
  - !ruby/object:Gem::Version
214
203
  version: 0.3.1
204
+ - - "<"
205
+ - !ruby/object:Gem::Version
206
+ version: 0.5.0
215
207
  description: Gradual Typing for Ruby
216
208
  email:
217
209
  - matsumoto@soutaro.com
@@ -452,7 +444,10 @@ files:
452
444
  homepage: https://github.com/soutaro/steep
453
445
  licenses:
454
446
  - MIT
455
- metadata: {}
447
+ metadata:
448
+ homepage_uri: https://github.com/soutaro/steep
449
+ source_code_uri: https://github.com/soutaro/steep
450
+ changelog_uri: https://github.com/soutaro/steep/blob/master/CHANGELOG.md
456
451
  post_install_message:
457
452
  rdoc_options: []
458
453
  require_paths:
@@ -468,7 +463,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
468
463
  - !ruby/object:Gem::Version
469
464
  version: '0'
470
465
  requirements: []
471
- rubygems_version: 3.0.3
466
+ rubygems_version: 3.1.2
472
467
  signing_key:
473
468
  specification_version: 4
474
469
  summary: Gradual Typing for Ruby