typeprof 0.21.7 → 0.21.8

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: 6586977939af7be53d8c86c57f992569abffac1f011e7a435ea248835fabb5be
4
- data.tar.gz: fec9babce50e7c23b31d053a137d7b16c9481ab51bc694d5ba1bf9fd720f63e2
3
+ metadata.gz: 71c74382cb8602ed9c902218ec5066d20865cc8040e5af6737e8d8a0d19beca9
4
+ data.tar.gz: 2646a63cd334443a8dc716f99a5828fac960afdf80f8a0f8c8b5f289e6fb957d
5
5
  SHA512:
6
- metadata.gz: b49afd59c81f251f6526f4f297773983cad6e4ead9ffeff659d1257a5c0138f2b3f8016197fc5537b5bf1a53bebb1382bf3385ce377441a9bbff0f5852e0ac07
7
- data.tar.gz: 3603cff083f9db951648cbc8069c017a42057eb6242963879634f7a0e64633632cb21e4bb51988f4a7d99e30de61e670e953409b64b6cc6bac5bbd771049666c
6
+ metadata.gz: 9c0ca22252a4804152efafafb63c9c8d1d1fb2e796a9d17251f1634dc1393c7fcaac7f924d4a341a0699c5113c3fea8bb03714ceb287ded60bc7057cac7a640c
7
+ data.tar.gz: 899c481fc8a4a05787ab0e66064220b33b17f8f1f0f045b9a1d05d4ebdae1ea4cd62cfe552342588b5a2834491638303be5a2e05c4b00d99713fe4693a6c557a
@@ -13,7 +13,7 @@ jobs:
13
13
  uses: ruby/actions/.github/workflows/ruby_versions.yml@master
14
14
  with:
15
15
  engine: cruby-truffleruby
16
- min_version: 2.7
16
+ min_version: 3.0
17
17
 
18
18
  build:
19
19
  needs: ruby-versions
data/.gitignore CHANGED
@@ -2,7 +2,6 @@ coverage.dump
2
2
  coverage.info
3
3
  coverage/
4
4
  stackprof*.dump
5
- testbed/goodcheck
6
5
  testbed/diff-lcs
7
6
  pkg/
8
7
  *.log
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- typeprof (0.21.7)
4
+ typeprof (0.21.8)
5
5
  rbs (>= 1.8.1)
6
6
 
7
7
  GEM
@@ -11,7 +11,7 @@ GEM
11
11
  docile (1.4.0)
12
12
  power_assert (2.0.1)
13
13
  rake (13.0.1)
14
- rbs (3.0.2)
14
+ rbs (3.2.0)
15
15
  simplecov (0.21.2)
16
16
  docile (~> 1.1)
17
17
  simplecov-html (~> 0.11)
@@ -2273,7 +2273,7 @@ module TypeProf
2273
2273
  _flag_args_fcall = flags[ 2] != 0
2274
2274
  _flag_args_vcall = flags[ 3] != 0
2275
2275
  _flag_args_simple = flags[ 4] != 0 # unused in TP
2276
- _flag_blockiseq = flags[ 5] != 0 # unused in VM :-)
2276
+ flags <<= 1 if RUBY_VERSION >= "3.3" # blockiseq flag was removed in 3.3
2277
2277
  flag_args_kwarg = flags[ 6] != 0
2278
2278
  flag_args_kw_splat = flags[ 7] != 0
2279
2279
  _flag_tailcall = flags[ 8] != 0
data/lib/typeprof/cli.rb CHANGED
@@ -23,7 +23,8 @@ module TypeProf
23
23
  gem_rbs_features = []
24
24
  show_version = false
25
25
  max_sec = max_iter = nil
26
- collection_path = RBS::Collection::Config::PATH
26
+ collection_path = nil
27
+ no_collection = false
27
28
 
28
29
  load_path_ext = []
29
30
 
@@ -35,8 +36,8 @@ module TypeProf
35
36
  opt.on("--version", "Display typeprof version") { show_version = true }
36
37
  opt.on("-I DIR", "Add DIR to the load/require path") {|v| load_path_ext << v }
37
38
  opt.on("-r FEATURE", "Require RBS of the FEATURE gem") {|v| gem_rbs_features << v }
38
- opt.on("--collection PATH", "File path of collection configuration") { |v| collection_path = v }
39
- opt.on("--no-collection", "Ignore collection configuration") { collection_path = nil }
39
+ opt.on("--collection PATH", "File path of collection configuration") { |v| collection_path = Pathname(v) }
40
+ opt.on("--no-collection", "Ignore collection configuration") { no_collection = true }
40
41
  opt.on("--lsp", "LSP mode") {|v| options[:lsp] = true }
41
42
 
42
43
  opt.separator ""
@@ -104,6 +105,14 @@ module TypeProf
104
105
  raise OptionParser::InvalidOption.new("lsp options with non-lsp mode")
105
106
  end
106
107
 
108
+ if !no_collection && collection_path && !collection_path.exist?
109
+ exit if show_version
110
+ raise OptionParser::InvalidOption.new("collection path not found (#{collection_path})")
111
+ end
112
+
113
+ collection_path ||= RBS::Collection::Config::PATH
114
+ collection_path = nil if no_collection
115
+
107
116
  ConfigData.new(
108
117
  rb_files: rb_files,
109
118
  rbs_files: rbs_files,
@@ -118,9 +127,9 @@ module TypeProf
118
127
  lsp_options: lsp_options,
119
128
  )
120
129
 
121
- rescue OptionParser::InvalidOption
130
+ rescue OptionParser::InvalidOption, OptionParser::MissingArgument
122
131
  puts $!
123
- exit
132
+ exit 1
124
133
  end
125
134
  end
126
135
  end
@@ -31,7 +31,7 @@ module TypeProf
31
31
  lock_path = RBS::Collection::Config.to_lockfile_path(collection_path)
32
32
  if lock_path.exist?
33
33
  collection_lock = RBS::Collection::Config::Lockfile.from_lockfile(lockfile_path: lock_path, data: YAML.load_file(lock_path.to_s))
34
- collection_lock.gems.each {|gem| @loaded_gems << gem["name"] }
34
+ collection_lock.gems.each_value {|gem| @loaded_gems << gem[:name] }
35
35
  loader.add_collection(collection_lock)
36
36
  else
37
37
  raise "Please execute 'rbs collection install'"
data/lib/typeprof/lsp.rb CHANGED
@@ -352,6 +352,7 @@ module TypeProf
352
352
  }
353
353
  end
354
354
 
355
+ @server.send_notification('typeprof.enableToggleButton')
355
356
  @server.send_request("workspace/codeLens/refresh")
356
357
 
357
358
  @server.send_notification(
@@ -827,6 +828,13 @@ module TypeProf
827
828
  end
828
829
  end
829
830
 
831
+ module MessageType
832
+ Error = 1
833
+ Warning = 2
834
+ Info = 3
835
+ Log = 4
836
+ end
837
+
830
838
  class Server
831
839
  class Exit < StandardError; end
832
840
 
@@ -861,6 +869,20 @@ module TypeProf
861
869
  end
862
870
  end
863
871
  rescue Exit
872
+ rescue => e
873
+ msg = "Tyeprof fatal error: #{e.message}"
874
+ send_notification(
875
+ 'window/showMessage',
876
+ type: MessageType::Error,
877
+ message: msg
878
+ )
879
+ send_notification(
880
+ 'window/logMessage',
881
+ type: MessageType::Error,
882
+ message: "#{msg} Backtrace: #{e.backtrace}"
883
+ )
884
+ send_notification('typeprof.showErrorStatus')
885
+ retry
864
886
  end
865
887
 
866
888
  def send_response(**msg)
@@ -1,3 +1,3 @@
1
1
  module TypeProf
2
- VERSION = "0.21.7"
2
+ VERSION = "0.21.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typeprof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.7
4
+ version: 0.21.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Endoh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-06 00:00:00.000000000 Z
11
+ date: 2023-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs