steep 1.5.3 → 1.6.0.pre.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 -2
- data/.github/workflows/ruby.yml +1 -2
- data/CHANGELOG.md +46 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +37 -10
- data/gemfile_steep/Gemfile.lock +3 -3
- data/lib/steep/ast/types/logic.rb +6 -0
- data/lib/steep/cli.rb +39 -19
- data/lib/steep/diagnostic/ruby.rb +4 -4
- data/lib/steep/interface/builder.rb +9 -0
- data/lib/steep/path_helper.rb +2 -0
- data/lib/steep/project/pattern.rb +1 -1
- data/lib/steep/server/change_buffer.rb +9 -0
- data/lib/steep/server/delay_queue.rb +41 -0
- data/lib/steep/server/interaction_worker.rb +4 -2
- data/lib/steep/server/master.rb +106 -10
- data/lib/steep/server/type_check_worker.rb +10 -3
- data/lib/steep/services/completion_provider.rb +2 -2
- data/lib/steep/services/stats_calculator.rb +2 -2
- data/lib/steep/services/type_name_completion.rb +86 -15
- data/lib/steep/signature/validator.rb +9 -2
- data/lib/steep/subtyping/check.rb +24 -18
- data/lib/steep/type_construction.rb +61 -17
- data/lib/steep/type_inference/logic_type_interpreter.rb +26 -0
- data/lib/steep/type_inference/method_params.rb +1 -1
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +1 -3
- data/sig/shims/language-server_protocol.rbs +12 -0
- data/sig/steep/ast/types/logic.rbs +5 -0
- data/sig/steep/ast/types.rbs +1 -1
- data/sig/steep/cli.rbs +2 -0
- data/sig/steep/diagnostic/ruby.rbs +7 -7
- data/sig/steep/project/pattern.rbs +22 -0
- data/sig/steep/server/change_buffer.rbs +4 -0
- data/sig/steep/server/delay_queue.rbs +37 -0
- data/sig/steep/server/master.rbs +4 -0
- data/sig/steep/services/stats_calculator.rbs +30 -6
- data/sig/steep/services/type_name_completion.rbs +13 -0
- data/sig/steep/signature/validator.rbs +5 -0
- data/sig/steep/subtyping/check.rbs +1 -1
- data/sig/steep/subtyping/relation.rbs +11 -1
- data/sig/steep/subtyping/result.rbs +1 -1
- data/sig/steep/type_construction.rbs +1 -1
- data/smoke/block/test_expectations.yml +10 -14
- data/smoke/enumerator/test_expectations.yml +10 -10
- data/smoke/integer/test_expectations.yml +5 -16
- data/smoke/regression/hello world.rb +1 -0
- data/smoke/regression/test_expectations.yml +12 -0
- data/steep.gemspec +1 -1
- metadata +8 -7
- data/lib/steep/shims/filter_map.rb +0 -30
- data/lib/steep/shims/symbol_start_with.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a94bcc44621f7c597278fe70c9a9f909983408b8f02fae8ba400b8193f88918
|
4
|
+
data.tar.gz: 32381468ac551d739b2ab84c70a5bfb0ea30265ca66ab3020f8eb3a99b53b2ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02bb300d0a9f42ccf368a32f8b6161eb6332433b5a68d6f9e75158d52cfe9ea19b67aba437b31000817b21b009e78f46633c5b7745157f32520deb711dcdbeb8
|
7
|
+
data.tar.gz: 367df39a6e217e6c962d4eee1d38a0d1f8e55833190375ce3e17d2b11f2a049e9e8ce78e6fdfb14db5d69c917f4f6ff4460ffb2d50197325f8dc0433bfd4149f
|
@@ -11,7 +11,6 @@ jobs:
|
|
11
11
|
strategy:
|
12
12
|
matrix:
|
13
13
|
ruby_version:
|
14
|
-
- "2.7"
|
15
14
|
- "3.0"
|
16
15
|
- "3.1"
|
17
16
|
- "3.2"
|
@@ -21,7 +20,7 @@ jobs:
|
|
21
20
|
- build
|
22
21
|
runs-on: windows-latest
|
23
22
|
steps:
|
24
|
-
- uses: actions/checkout@
|
23
|
+
- uses: actions/checkout@v4
|
25
24
|
- uses: ruby/setup-ruby@v1
|
26
25
|
with:
|
27
26
|
ruby-version: ${{ matrix.ruby_version }}
|
data/.github/workflows/ruby.yml
CHANGED
@@ -11,7 +11,6 @@ jobs:
|
|
11
11
|
strategy:
|
12
12
|
matrix:
|
13
13
|
container_tag:
|
14
|
-
- "2.7"
|
15
14
|
- "3.0"
|
16
15
|
- "3.1"
|
17
16
|
- "3.2"
|
@@ -24,7 +23,7 @@ jobs:
|
|
24
23
|
container:
|
25
24
|
image: rubylang/ruby:${{ matrix.container_tag }}
|
26
25
|
steps:
|
27
|
-
- uses: actions/checkout@
|
26
|
+
- uses: actions/checkout@v4
|
28
27
|
- name: Run test
|
29
28
|
run: |
|
30
29
|
git config --global --add safe.directory /__w/steep/steep
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,52 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.6.0.pre.2 (2023-10-31)
|
6
|
+
|
7
|
+
### Type checker core
|
8
|
+
|
9
|
+
* Assign types on method calls in mlhs node ([#951](https://github.com/soutaro/steep/pull/951))
|
10
|
+
* Change severity of block diagnostics ([#950](https://github.com/soutaro/steep/pull/950))
|
11
|
+
|
12
|
+
### Commandline tool
|
13
|
+
|
14
|
+
* Match with `**` in pattern ([#949](https://github.com/soutaro/steep/pull/949))
|
15
|
+
|
16
|
+
## 1.6.0.pre.1 (2023-10-27)
|
17
|
+
|
18
|
+
### Type checker core
|
19
|
+
|
20
|
+
* Test if a parameter is `_` ([#946](https://github.com/soutaro/steep/pull/946))
|
21
|
+
* Let `[]=` call have correct type ([#945](https://github.com/soutaro/steep/pull/945))
|
22
|
+
* Support type narrowing by `Module#<` ([#877](https://github.com/soutaro/steep/pull/877))
|
23
|
+
* Fewer `UnresolvedOverloading` ([#941](https://github.com/soutaro/steep/pull/941))
|
24
|
+
* Fix ArgumentTypeMismatch for PublishDiagnosticsParams ([#895](https://github.com/soutaro/steep/pull/895))
|
25
|
+
* Add types for LSP::Constant::MessageType ([#894](https://github.com/soutaro/steep/pull/894))
|
26
|
+
* `nil` is not a `NilClass` ([#920](https://github.com/soutaro/steep/pull/920))
|
27
|
+
* Fix unexpected error when DifferentMethodParameterKind ([#917](https://github.com/soutaro/steep/pull/917))
|
28
|
+
|
29
|
+
### Commandline tool
|
30
|
+
|
31
|
+
* Fix space in file path crash ([#944](https://github.com/soutaro/steep/pull/944))
|
32
|
+
* refactor: Rename driver objects to command ([#893](https://github.com/soutaro/steep/pull/893))
|
33
|
+
* Run with `--jobs=2` automatically on CI ([#924](https://github.com/soutaro/steep/pull/924))
|
34
|
+
* Fix type alias validation ([#922](https://github.com/soutaro/steep/pull/922))
|
35
|
+
|
36
|
+
### Language server
|
37
|
+
|
38
|
+
* Let goto definition work from `UnresolvedOverloading` error calls ([#943](https://github.com/soutaro/steep/pull/943))
|
39
|
+
* Let label be whole method type in SignatureHelp ([#942](https://github.com/soutaro/steep/pull/942))
|
40
|
+
* Set up file watcher ([#936](https://github.com/soutaro/steep/pull/936))
|
41
|
+
* Reset file content on `didOpen` notification ([#935](https://github.com/soutaro/steep/pull/935))
|
42
|
+
* Start type check on change ([#934](https://github.com/soutaro/steep/pull/934))
|
43
|
+
* Better completion with module alias and `use` directives ([#923](https://github.com/soutaro/steep/pull/923))
|
44
|
+
|
45
|
+
### Miscellaneous
|
46
|
+
|
47
|
+
* Drop 2.7 support ([#928](https://github.com/soutaro/steep/pull/928))
|
48
|
+
* Type check `subtyping/check.rb` ([#921](https://github.com/soutaro/steep/pull/921))
|
49
|
+
* Type check constant under `self` ([#908](https://github.com/soutaro/steep/pull/908))
|
50
|
+
|
5
51
|
## 1.5.3 (2023-08-10)
|
6
52
|
|
7
53
|
### Type checker core
|
data/Gemfile
CHANGED
@@ -4,9 +4,11 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
gem "rake"
|
7
|
-
gem "minitest", "~> 5.
|
7
|
+
gem "minitest", "~> 5.20"
|
8
8
|
gem "minitest-hooks"
|
9
9
|
group :stackprof, optional: true do
|
10
10
|
gem "stackprof"
|
11
11
|
end
|
12
12
|
gem 'minitest-slow_test'
|
13
|
+
|
14
|
+
gem "debug", require: false, platform: :mri
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
steep (1.
|
4
|
+
steep (1.6.0.pre.2)
|
5
5
|
activesupport (>= 5.1)
|
6
6
|
concurrent-ruby (>= 1.1.10)
|
7
7
|
csv (>= 3.0.9)
|
@@ -20,53 +20,80 @@ PATH
|
|
20
20
|
GEM
|
21
21
|
remote: https://rubygems.org/
|
22
22
|
specs:
|
23
|
-
activesupport (7.
|
23
|
+
activesupport (7.1.1)
|
24
|
+
base64
|
25
|
+
bigdecimal
|
24
26
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
27
|
+
connection_pool (>= 2.2.5)
|
28
|
+
drb
|
25
29
|
i18n (>= 1.6, < 2)
|
26
30
|
minitest (>= 5.1)
|
31
|
+
mutex_m
|
27
32
|
tzinfo (~> 2.0)
|
28
33
|
ast (2.4.2)
|
34
|
+
base64 (0.1.1)
|
35
|
+
bigdecimal (3.1.4)
|
29
36
|
concurrent-ruby (1.2.2)
|
37
|
+
connection_pool (2.4.1)
|
30
38
|
csv (3.2.7)
|
31
|
-
|
39
|
+
debug (1.8.0)
|
40
|
+
irb (>= 1.5.0)
|
41
|
+
reline (>= 0.3.1)
|
42
|
+
drb (2.1.1)
|
43
|
+
ruby2_keywords
|
44
|
+
ffi (1.16.3)
|
32
45
|
fileutils (1.7.1)
|
33
46
|
i18n (1.14.1)
|
34
47
|
concurrent-ruby (~> 1.0)
|
48
|
+
io-console (0.6.0)
|
49
|
+
irb (1.8.1)
|
50
|
+
rdoc
|
51
|
+
reline (>= 0.3.8)
|
35
52
|
json (2.6.3)
|
36
53
|
language_server-protocol (3.17.0.3)
|
37
54
|
listen (3.8.0)
|
38
55
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
39
56
|
rb-inotify (~> 0.9, >= 0.9.10)
|
40
57
|
logger (1.5.3)
|
41
|
-
minitest (5.
|
58
|
+
minitest (5.20.0)
|
42
59
|
minitest-hooks (1.5.1)
|
43
60
|
minitest (> 5.3)
|
44
61
|
minitest-slow_test (0.2.0)
|
45
62
|
minitest (>= 5.0)
|
46
|
-
|
63
|
+
mutex_m (0.1.2)
|
64
|
+
parser (3.2.2.4)
|
47
65
|
ast (~> 2.4.1)
|
48
66
|
racc
|
67
|
+
psych (5.1.0)
|
68
|
+
stringio
|
49
69
|
racc (1.7.1)
|
50
70
|
rainbow (3.1.1)
|
51
|
-
rake (13.0
|
71
|
+
rake (13.1.0)
|
52
72
|
rb-fsevent (0.11.2)
|
53
73
|
rb-inotify (0.10.1)
|
54
74
|
ffi (~> 1.0)
|
55
|
-
rbs (3.
|
75
|
+
rbs (3.2.2)
|
76
|
+
rdoc (6.5.0)
|
77
|
+
psych (>= 4.0.0)
|
78
|
+
reline (0.3.8)
|
79
|
+
io-console (~> 0.5)
|
80
|
+
ruby2_keywords (0.0.5)
|
56
81
|
securerandom (0.2.2)
|
57
82
|
stackprof (0.2.25)
|
58
|
-
|
83
|
+
stringio (3.0.8)
|
84
|
+
strscan (3.0.7)
|
59
85
|
terminal-table (3.0.2)
|
60
86
|
unicode-display_width (>= 1.1.1, < 3)
|
61
87
|
tzinfo (2.0.6)
|
62
88
|
concurrent-ruby (~> 1.0)
|
63
|
-
unicode-display_width (2.
|
89
|
+
unicode-display_width (2.5.0)
|
64
90
|
|
65
91
|
PLATFORMS
|
66
92
|
ruby
|
67
93
|
|
68
94
|
DEPENDENCIES
|
69
|
-
|
95
|
+
debug
|
96
|
+
minitest (~> 5.20)
|
70
97
|
minitest-hooks
|
71
98
|
minitest-slow_test
|
72
99
|
rake
|
data/gemfile_steep/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (7.0.
|
4
|
+
activesupport (7.0.7.2)
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
6
|
i18n (>= 1.6, < 2)
|
7
7
|
minitest (>= 5.1)
|
@@ -28,9 +28,9 @@ GEM
|
|
28
28
|
rb-fsevent (0.11.2)
|
29
29
|
rb-inotify (0.10.1)
|
30
30
|
ffi (~> 1.0)
|
31
|
-
rbs (3.1.
|
31
|
+
rbs (3.1.3)
|
32
32
|
securerandom (0.2.2)
|
33
|
-
steep (1.5.
|
33
|
+
steep (1.5.3)
|
34
34
|
activesupport (>= 5.1)
|
35
35
|
concurrent-ruby (>= 1.1.10)
|
36
36
|
csv (>= 3.0.9)
|
data/lib/steep/cli.rb
CHANGED
@@ -84,6 +84,18 @@ module Steep
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
+
def setup_jobs_for_ci(jobs_option)
|
88
|
+
if ENV["CI"]
|
89
|
+
unless jobs_option.jobs_count
|
90
|
+
stderr.puts Rainbow("CI environment is detected but no `--jobs` option is given.").yellow
|
91
|
+
stderr.puts " Using `[2, #{jobs_option.default_jobs_count} (# or processors)].min` to avoid hitting memory limit."
|
92
|
+
stderr.puts " Specify `--jobs` option to increase the number of jobs."
|
93
|
+
|
94
|
+
jobs_option.jobs_count = [2, jobs_option.default_jobs_count].min
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
87
99
|
def process_init
|
88
100
|
Drivers::Init.new(stdout: stdout, stderr: stderr).tap do |command|
|
89
101
|
OptionParser.new do |opts|
|
@@ -98,63 +110,69 @@ module Steep
|
|
98
110
|
end
|
99
111
|
|
100
112
|
def process_check
|
101
|
-
Drivers::Check.new(stdout: stdout, stderr: stderr).tap do |
|
113
|
+
Drivers::Check.new(stdout: stdout, stderr: stderr).tap do |command|
|
102
114
|
OptionParser.new do |opts|
|
103
115
|
opts.banner = "Usage: steep check [options] [sources]"
|
104
116
|
|
105
|
-
opts.on("--steepfile=PATH") {|path|
|
117
|
+
opts.on("--steepfile=PATH") {|path| command.steepfile = Pathname(path) }
|
106
118
|
opts.on("--with-expectations[=PATH]", "Type check with expectations saved in PATH (or steep_expectations.yml)") do |path|
|
107
|
-
|
119
|
+
command.with_expectations_path = Pathname(path || "steep_expectations.yml")
|
108
120
|
end
|
109
121
|
opts.on("--save-expectations[=PATH]", "Save expectations with current type check result to PATH (or steep_expectations.yml)") do |path|
|
110
|
-
|
122
|
+
command.save_expectations_path = Pathname(path || "steep_expectations.yml")
|
111
123
|
end
|
112
124
|
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|
|
113
|
-
|
125
|
+
command.severity_level = level.to_sym
|
114
126
|
end
|
115
|
-
handle_jobs_option
|
127
|
+
handle_jobs_option command.jobs_option, opts
|
116
128
|
handle_logging_options opts
|
117
129
|
end.parse!(argv)
|
118
130
|
|
119
|
-
|
131
|
+
setup_jobs_for_ci(command.jobs_option)
|
132
|
+
|
133
|
+
command.command_line_patterns.push *argv
|
120
134
|
end.run
|
121
135
|
end
|
122
136
|
|
123
137
|
def process_checkfile
|
124
|
-
Drivers::Checkfile.new(stdout: stdout, stderr: stderr).tap do |
|
138
|
+
Drivers::Checkfile.new(stdout: stdout, stderr: stderr).tap do |command|
|
125
139
|
OptionParser.new do |opts|
|
126
140
|
opts.banner = "Usage: steep checkfile [options] [files]"
|
127
141
|
|
128
|
-
opts.on("--steepfile=PATH") {|path|
|
129
|
-
opts.on("--all-rbs", "Type check all RBS files") {
|
130
|
-
opts.on("--all-ruby", "Type check all Ruby files") {
|
142
|
+
opts.on("--steepfile=PATH") {|path| command.steepfile = Pathname(path) }
|
143
|
+
opts.on("--all-rbs", "Type check all RBS files") { command.all_rbs = true }
|
144
|
+
opts.on("--all-ruby", "Type check all Ruby files") { command.all_ruby = true }
|
131
145
|
opts.on("--stdin", "Read files to type check from stdin") do
|
132
146
|
while line = stdin.gets()
|
133
147
|
object = JSON.parse(line, symbolize_names: true)
|
134
148
|
Steep.logger.info { "Loading content of `#{object[:path]}` from stdin: #{object[:content].lines[0].chomp}" }
|
135
|
-
|
149
|
+
command.stdin_input[Pathname(object[:path])] = object[:content]
|
136
150
|
end
|
137
151
|
end
|
138
|
-
handle_jobs_option
|
152
|
+
handle_jobs_option command.jobs_option, opts
|
139
153
|
handle_logging_options opts
|
140
154
|
end.parse!(argv)
|
141
155
|
|
142
|
-
|
156
|
+
setup_jobs_for_ci(command.jobs_option)
|
157
|
+
|
158
|
+
command.command_line_args.push *argv
|
143
159
|
end.run
|
144
160
|
end
|
145
161
|
|
146
162
|
def process_stats
|
147
|
-
Drivers::Stats.new(stdout: stdout, stderr: stderr).tap do |
|
163
|
+
Drivers::Stats.new(stdout: stdout, stderr: stderr).tap do |command|
|
148
164
|
OptionParser.new do |opts|
|
149
165
|
opts.banner = "Usage: steep stats [options] [sources]"
|
150
166
|
|
151
|
-
opts.on("--steepfile=PATH") {|path|
|
152
|
-
opts.on("--format=FORMAT", "Specify output format: csv, table") {|format|
|
153
|
-
handle_jobs_option
|
167
|
+
opts.on("--steepfile=PATH") {|path| command.steepfile = Pathname(path) }
|
168
|
+
opts.on("--format=FORMAT", "Specify output format: csv, table") {|format| command.format = format }
|
169
|
+
handle_jobs_option command.jobs_option, opts
|
154
170
|
handle_logging_options opts
|
155
171
|
end.parse!(argv)
|
156
172
|
|
157
|
-
|
173
|
+
setup_jobs_for_ci(command.jobs_option)
|
174
|
+
|
175
|
+
command.command_line_patterns.push *argv
|
158
176
|
end.run
|
159
177
|
end
|
160
178
|
|
@@ -199,6 +217,8 @@ module Steep
|
|
199
217
|
handle_logging_options opts
|
200
218
|
end.parse!(argv)
|
201
219
|
|
220
|
+
setup_jobs_for_ci(command.jobs_option)
|
221
|
+
|
202
222
|
dirs = argv.map {|dir| Pathname(dir) }
|
203
223
|
command.dirs.push(*dirs)
|
204
224
|
end.run
|
@@ -1013,8 +1013,8 @@ module Steep
|
|
1013
1013
|
@default ||= _ = all_error.merge(
|
1014
1014
|
{
|
1015
1015
|
ArgumentTypeMismatch => :error,
|
1016
|
-
BlockBodyTypeMismatch => :
|
1017
|
-
BlockTypeMismatch => :
|
1016
|
+
BlockBodyTypeMismatch => :warning,
|
1017
|
+
BlockTypeMismatch => :warning,
|
1018
1018
|
BreakTypeMismatch => :hint,
|
1019
1019
|
DifferentMethodParameterKind => :hint,
|
1020
1020
|
FallbackAny => :hint,
|
@@ -1129,8 +1129,8 @@ module Steep
|
|
1129
1129
|
@lenient ||= _ = all_error.merge(
|
1130
1130
|
{
|
1131
1131
|
ArgumentTypeMismatch => :information,
|
1132
|
-
BlockBodyTypeMismatch => :
|
1133
|
-
BlockTypeMismatch => :
|
1132
|
+
BlockBodyTypeMismatch => :information,
|
1133
|
+
BlockTypeMismatch => :information,
|
1134
1134
|
BreakTypeMismatch => :hint,
|
1135
1135
|
DifferentMethodParameterKind => nil,
|
1136
1136
|
FallbackAny => nil,
|
@@ -766,6 +766,15 @@ module Steep
|
|
766
766
|
)
|
767
767
|
)
|
768
768
|
end
|
769
|
+
when :<, :<=
|
770
|
+
case defined_in
|
771
|
+
when RBS::BuiltinNames::Module.name
|
772
|
+
return method_type.with(
|
773
|
+
type: method_type.type.with(
|
774
|
+
return_type: AST::Types::Logic::ArgIsAncestor.new(location: method_type.type.return_type.location)
|
775
|
+
)
|
776
|
+
)
|
777
|
+
end
|
769
778
|
end
|
770
779
|
end
|
771
780
|
|
data/lib/steep/path_helper.rb
CHANGED
@@ -7,6 +7,7 @@ module Steep
|
|
7
7
|
if uri.scheme == "file"
|
8
8
|
path = uri.path or raise
|
9
9
|
path.sub!(%r{^/([a-zA-Z])(:|%3A)//?}i, '\1:/') if dosish
|
10
|
+
path = URI::DEFAULT_PARSER.unescape(path)
|
10
11
|
Pathname(path)
|
11
12
|
end
|
12
13
|
end
|
@@ -20,6 +21,7 @@ module Steep
|
|
20
21
|
if dosish
|
21
22
|
str_path.insert(0, "/") if str_path[0] != "/"
|
22
23
|
end
|
24
|
+
str_path = URI::DEFAULT_PARSER.escape(str_path)
|
23
25
|
URI::File.build(path: str_path)
|
24
26
|
end
|
25
27
|
end
|
@@ -48,7 +48,7 @@ module Steep
|
|
48
48
|
string = path.to_s
|
49
49
|
extension = path.extname
|
50
50
|
|
51
|
-
patterns.any? {|pat| File.fnmatch(pat, string) } ||
|
51
|
+
patterns.any? {|pat| File.fnmatch(pat, string, File::FNM_PATHNAME) } ||
|
52
52
|
prefixes.any? {|prefix| string.start_with?(prefix) && extension == ext }
|
53
53
|
end
|
54
54
|
end
|
@@ -61,6 +61,15 @@ module Steep
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
def reset_change(uri:, text:)
|
66
|
+
push_buffer do |changes|
|
67
|
+
if path = Steep::PathHelper.to_pathname(uri)
|
68
|
+
path = project.relative_path(path)
|
69
|
+
changes[path] = [Services::ContentChange.new(text: text)]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
64
73
|
end
|
65
74
|
end
|
66
75
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Steep
|
2
|
+
module Server
|
3
|
+
class DelayQueue
|
4
|
+
attr_reader :delay, :thread, :queue, :last_task
|
5
|
+
|
6
|
+
def initialize(delay:)
|
7
|
+
@delay = delay
|
8
|
+
|
9
|
+
@queue = Thread::Queue.new
|
10
|
+
|
11
|
+
@thread = Thread.new do
|
12
|
+
while (scheduled_at, proc = queue.pop)
|
13
|
+
# @type var scheduled_at: Time
|
14
|
+
# @type var proc: ^() -> void
|
15
|
+
|
16
|
+
diff = scheduled_at - Time.now
|
17
|
+
case
|
18
|
+
when diff > 0.1
|
19
|
+
sleep diff
|
20
|
+
when diff > 0
|
21
|
+
while Time.now < scheduled_at
|
22
|
+
# nop
|
23
|
+
sleep 0
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
if proc.equal?(last_task)
|
28
|
+
proc[]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def execute(&block)
|
35
|
+
@last_task = block
|
36
|
+
scheduled_at = Time.now + delay
|
37
|
+
queue << [scheduled_at, block]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -227,9 +227,11 @@ module Steep
|
|
227
227
|
)
|
228
228
|
)
|
229
229
|
|
230
|
+
type_name = sig_service.latest_env.normalize_type_name(type_name)
|
231
|
+
|
230
232
|
case type_name.kind
|
231
233
|
when :class
|
232
|
-
env = sig_service.latest_env
|
234
|
+
env = sig_service.latest_env
|
233
235
|
class_entry = env.module_class_entry(type_name) or raise
|
234
236
|
|
235
237
|
case class_entry
|
@@ -407,7 +409,7 @@ module Steep
|
|
407
409
|
if (items, index = provider.run(line: job.line, column: job.column))
|
408
410
|
signatures = items.map do |item|
|
409
411
|
LSP::Interface::SignatureInformation.new(
|
410
|
-
label:
|
412
|
+
label: item.method_type.to_s,
|
411
413
|
parameters: item.parameters.map { |param| LSP::Interface::ParameterInformation.new(label: param)},
|
412
414
|
active_parameter: item.active_parameter,
|
413
415
|
documentation: item.comment&.yield_self do |comment|
|