steep 0.11.0 → 0.11.1

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: 5e0677b34af6d2b65ac33be3c60d126d689e10d3b9fb7eff598b33dabda2dc98
4
- data.tar.gz: f126e4ed9b28c55bad922282b280b51a350e0cbc77d25192553437fe0f392917
3
+ metadata.gz: 30d4bfab06e5fe0027f3e2cd8d7570fa5b887d7c4ac177c6cfed0003d71f77b7
4
+ data.tar.gz: ab030947cb032f0fcbb3e9ca7febf38ad489ee4ab21a4a798fb620e9db807ead
5
5
  SHA512:
6
- metadata.gz: '0940b5f73af0ae31a8b310825e402caf784e9327982122b5e2b19f29ce69ddd4dd4dadf7f07bf93d150cecae2c4ffcb3faa6b237ece6d3653482a1dce12930fe'
7
- data.tar.gz: b3fa66639c3ae93d475e6d12b965b526f633c31e244043f22e1c32c5d140e51568602c5087cc85247068010547d0dc4353f78f61c9d7093aefd8933b4b5b2186
6
+ metadata.gz: cec192c40e6de3ea830b3aa6c2f2cdb619b00af8a75c2a754f8302f94423c7f9f098b3e48e44568c967c38c4f34da19309b74999c8efe5e7636e4714375b9c59
7
+ data.tar.gz: b39f4f9f986b70426c5f0738840222f9a8241a4bf42df04d2aa17388f2d6a69014e91442a3021fbc8c1f269cf94361b0786a83d5b61e4557af36e773c7ad66d3
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.11.1 (2019-07-15)
6
+
7
+ * Relax activesupport versnion requirement (#90)
8
+
5
9
  ## 0.11.0 (2019-05-18)
6
10
 
7
11
  * Skip `alias` nodes type checking (#85)
@@ -5,6 +5,7 @@ module Steep
5
5
  attr_reader :signature_dirs
6
6
  attr_reader :options
7
7
  attr_reader :subscribers
8
+ attr_reader :open_paths
8
9
 
9
10
  include Utils::EachSignature
10
11
 
@@ -13,6 +14,7 @@ module Steep
13
14
  @signature_dirs = signature_dirs
14
15
  @options = Project::Options.new
15
16
  @subscribers = {}
17
+ @open_paths = Set.new
16
18
 
17
19
  subscribe :initialize do |request:, notifier:|
18
20
  LanguageServer::Protocol::Interface::InitializeResult.new(
@@ -33,10 +35,16 @@ module Steep
33
35
 
34
36
  subscribe :"textDocument/didOpen" do |request:, notifier:|
35
37
  uri = URI.parse(request[:params][:textDocument][:uri])
38
+ open_path uri
36
39
  text = request[:params][:textDocument][:text]
37
40
  synchronize_project(uri: uri, text: text, notifier: notifier)
38
41
  end
39
42
 
43
+ subscribe :"textDocument/didClose" do |request:, notifier:|
44
+ uri = URI.parse(request[:params][:textDocument][:uri])
45
+ close_path uri
46
+ end
47
+
40
48
  subscribe :"textDocument/didChange" do |request:, notifier:|
41
49
  uri = URI.parse(request[:params][:textDocument][:uri])
42
50
  text = request[:params][:contentChanges][0][:text]
@@ -99,6 +107,18 @@ module Steep
99
107
  end
100
108
  end
101
109
 
110
+ def open_path?(path)
111
+ open_paths.member?(path)
112
+ end
113
+
114
+ def open_path(path)
115
+ open_paths << path
116
+ end
117
+
118
+ def close_path(path)
119
+ open_paths.delete path
120
+ end
121
+
102
122
  def run
103
123
  writer = LanguageServer::Protocol::Transport::Stdio::Writer.new
104
124
  reader = LanguageServer::Protocol::Transport::Stdio::Reader.new
@@ -128,37 +148,45 @@ module Steep
128
148
  file = project.source_files[path] || Project::SourceFile.new(path: path, options: options)
129
149
  file.content = text
130
150
  project.source_files[path] = file
131
- project.type_check
132
-
133
- diags = (file.errors || []).map do |error|
134
- LanguageServer::Protocol::Interface::Diagnostic.new(
135
- message: error.to_s,
136
- severity: LanguageServer::Protocol::Constant::DiagnosticSeverity::ERROR,
137
- range: LanguageServer::Protocol::Interface::Range.new(
138
- start: LanguageServer::Protocol::Interface::Position.new(
139
- line: error.node.loc.line - 1,
140
- character: error.node.loc.column,
141
- ),
142
- end: LanguageServer::Protocol::Interface::Position.new(
143
- line: error.node.loc.last_line - 1,
144
- character: error.node.loc.last_column,
145
- ),
146
- )
147
- )
148
- end
149
-
150
- notifier.call(
151
- method: :"textDocument/publishDiagnostics",
152
- params: LanguageServer::Protocol::Interface::PublishDiagnosticsParams.new(
153
- uri: uri,
154
- diagnostics: diags,
155
- ),
156
- )
157
151
  when ".rbi"
158
152
  file = project.signature_files[path] || Project::SignatureFile.new(path: path)
159
153
  file.content = text
160
154
  project.signature_files[path] = file
161
- project.type_check
155
+ end
156
+
157
+ project.type_check
158
+
159
+ open_paths.each do |uri|
160
+ Pathname(uri.path).relative_path_from(Pathname.pwd).yield_self do |path|
161
+ case path.extname
162
+ when ".rb"
163
+ file = project.source_files[path] || Project::SourceFile.new(path: path, options: options)
164
+ diags = (file.errors || []).map do |error|
165
+ LanguageServer::Protocol::Interface::Diagnostic.new(
166
+ message: error.to_s,
167
+ severity: LanguageServer::Protocol::Constant::DiagnosticSeverity::ERROR,
168
+ range: LanguageServer::Protocol::Interface::Range.new(
169
+ start: LanguageServer::Protocol::Interface::Position.new(
170
+ line: error.node.loc.line - 1,
171
+ character: error.node.loc.column,
172
+ ),
173
+ end: LanguageServer::Protocol::Interface::Position.new(
174
+ line: error.node.loc.last_line - 1,
175
+ character: error.node.loc.last_column,
176
+ ),
177
+ )
178
+ )
179
+ end
180
+
181
+ notifier.call(
182
+ method: :"textDocument/publishDiagnostics",
183
+ params: LanguageServer::Protocol::Interface::PublishDiagnosticsParams.new(
184
+ uri: uri,
185
+ diagnostics: diags,
186
+ ),
187
+ )
188
+ end
189
+ end
162
190
  end
163
191
  end
164
192
  end
data/lib/steep/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "0.11.0"
2
+ VERSION = "0.11.1"
3
3
  end
data/steep.gemspec CHANGED
@@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.add_runtime_dependency "parser", "~> 2.4"
33
33
  spec.add_runtime_dependency "ast_utils", "~> 0.3.0"
34
- spec.add_runtime_dependency "activesupport", "~> 5.1"
35
- spec.add_runtime_dependency "rainbow", "~> 2.2.2", "< 4.0"
34
+ spec.add_runtime_dependency "activesupport", ">= 5.1"
35
+ spec.add_runtime_dependency "rainbow", ">= 2.2.2", "< 4.0"
36
36
  spec.add_runtime_dependency "listen", "~> 3.1"
37
37
  spec.add_runtime_dependency "pry", "~> 0.12.2"
38
38
  spec.add_runtime_dependency "language_server-protocol", "~> 3.14.0"
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.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-17 00:00:00.000000000 Z
11
+ date: 2019-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,21 +98,21 @@ dependencies:
98
98
  name: activesupport
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '5.1'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '5.1'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rainbow
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: 2.2.2
118
118
  - - "<"
@@ -122,7 +122,7 @@ dependencies:
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - "~>"
125
+ - - ">="
126
126
  - !ruby/object:Gem::Version
127
127
  version: 2.2.2
128
128
  - - "<"