ruby-lsp-typeprof 0.3.0 → 0.4.0
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/README.md +3 -1
- data/lib/ruby_lsp/ruby_lsp_typeprof/addon.rb +17 -8
- data/lib/ruby_lsp/ruby_lsp_typeprof/code_lens_listener.rb +7 -2
- data/lib/ruby_lsp/ruby_lsp_typeprof/loggable.rb +19 -0
- data/lib/ruby_lsp_typeprof/version.rb +1 -1
- metadata +5 -6
- data/.tagpr +0 -5
- data/CHANGELOG.md +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cd458cb056ff5e4f48058e864528f8db6d03a9d7709fb47cd81b387976346d77
|
|
4
|
+
data.tar.gz: fe8d2d2de7862ea0ce8dccf66a0ed6e01e259815d82e3c484f35e8d73f4f3d8f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '008e208221b72bb8db5908f01a4f74f30854f54d2a70648c62ad2b39185407014f982b00d52be93ba2a9ac8d47c5a84d1831f217210ec5e4ba49867937eb44e2'
|
|
7
|
+
data.tar.gz: 9e38f9e164764cd93f8da7e877a64262764abba9d74dbbf4221ece9403bbd4cade039daa0dd116f1a6789ab488a57c58be9bd2f9e46b5df406a0192568f91747
|
data/README.md
CHANGED
|
@@ -53,7 +53,9 @@ command for it to take effect.
|
|
|
53
53
|
|
|
54
54
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
55
55
|
|
|
56
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
56
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
57
|
+
|
|
58
|
+
To release a new version, run `bin/bump.rb` (pass `--minor` or `--major` to bump those segments) and push the resulting commit to `main`. The release workflow then publishes the gem to [rubygems.org](https://rubygems.org) and creates a GitHub release.
|
|
57
59
|
|
|
58
60
|
## Contributing
|
|
59
61
|
|
|
@@ -5,10 +5,13 @@ require "ruby_lsp/addon"
|
|
|
5
5
|
require "uri"
|
|
6
6
|
|
|
7
7
|
require_relative "code_lens_listener"
|
|
8
|
+
require_relative "loggable"
|
|
8
9
|
|
|
9
10
|
module RubyLsp
|
|
10
11
|
module Typeprof
|
|
11
12
|
class Addon < ::RubyLsp::Addon
|
|
13
|
+
include Loggable
|
|
14
|
+
|
|
12
15
|
def initialize
|
|
13
16
|
super
|
|
14
17
|
@service = nil
|
|
@@ -17,17 +20,17 @@ module RubyLsp
|
|
|
17
20
|
@code_lens_enabled = true
|
|
18
21
|
end
|
|
19
22
|
|
|
20
|
-
def activate(global_state,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
def activate(global_state, outgoing_queue)
|
|
24
|
+
@outgoing_queue = outgoing_queue
|
|
25
|
+
log_message("Activating Ruby LSP TypeProf add-on v#{VERSION}")
|
|
26
|
+
|
|
27
|
+
load_settings(global_state)
|
|
23
28
|
return unless @enabled
|
|
24
29
|
|
|
25
30
|
require "typeprof"
|
|
26
|
-
|
|
27
|
-
@code_lens_enabled = settings&.dig(:enableCodeLens) != false
|
|
28
31
|
@service = build_service(global_state.workspace_path)
|
|
29
32
|
rescue StandardError => e
|
|
30
|
-
|
|
33
|
+
log_error("Ruby LSP TypeProf failed to activate: #{e.full_message(highlight: false)}")
|
|
31
34
|
end
|
|
32
35
|
|
|
33
36
|
def deactivate
|
|
@@ -46,7 +49,7 @@ module RubyLsp
|
|
|
46
49
|
return unless @service
|
|
47
50
|
return unless @code_lens_enabled
|
|
48
51
|
|
|
49
|
-
CodeLensListener.new(response_builder, uri, dispatcher, @service, @mutex)
|
|
52
|
+
CodeLensListener.new(response_builder, uri, dispatcher, @service, @mutex, @outgoing_queue)
|
|
50
53
|
end
|
|
51
54
|
|
|
52
55
|
def workspace_did_change_watched_files(changes)
|
|
@@ -59,6 +62,12 @@ module RubyLsp
|
|
|
59
62
|
|
|
60
63
|
private
|
|
61
64
|
|
|
65
|
+
def load_settings(global_state)
|
|
66
|
+
settings = global_state.settings_for_addon(name)
|
|
67
|
+
@enabled = settings&.dig(:enabled) != false
|
|
68
|
+
@code_lens_enabled = settings&.dig(:enableCodeLens) != false
|
|
69
|
+
end
|
|
70
|
+
|
|
62
71
|
def build_service(workspace_path)
|
|
63
72
|
conf = load_typeprof_conf(workspace_path) || default_conf
|
|
64
73
|
rbs_dir = File.expand_path(conf[:rbs_dir], workspace_path)
|
|
@@ -92,7 +101,7 @@ module RubyLsp
|
|
|
92
101
|
|
|
93
102
|
@service.update_file(path, nil)
|
|
94
103
|
rescue StandardError => e
|
|
95
|
-
|
|
104
|
+
log_error("Ruby LSP TypeProf failed to update file #{path}: #{e.full_message(highlight: false)}")
|
|
96
105
|
end
|
|
97
106
|
end
|
|
98
107
|
end
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "loggable"
|
|
4
|
+
|
|
3
5
|
module RubyLsp
|
|
4
6
|
module Typeprof
|
|
5
7
|
class CodeLensListener
|
|
6
|
-
|
|
8
|
+
include Loggable
|
|
9
|
+
|
|
10
|
+
def initialize(response_builder, uri, dispatcher, service, mutex, outgoing_queue)
|
|
7
11
|
@response_builder = response_builder
|
|
8
12
|
@path = uri.to_standardized_path
|
|
9
13
|
@lens_cache = {}
|
|
14
|
+
@outgoing_queue = outgoing_queue
|
|
10
15
|
|
|
11
16
|
cache_code_lens_results(service, mutex)
|
|
12
17
|
dispatcher.register(self, :on_def_node_enter) unless @lens_cache.empty?
|
|
@@ -38,7 +43,7 @@ module RubyLsp
|
|
|
38
43
|
end
|
|
39
44
|
end
|
|
40
45
|
rescue StandardError => e
|
|
41
|
-
|
|
46
|
+
log_error("Ruby LSP TypeProf failed to compute code lens for #{@path}: #{e.full_message(highlight: false)}")
|
|
42
47
|
end
|
|
43
48
|
end
|
|
44
49
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RubyLsp
|
|
4
|
+
module Typeprof
|
|
5
|
+
module Loggable
|
|
6
|
+
private
|
|
7
|
+
|
|
8
|
+
def log_message(message, type: ::RubyLsp::Constant::MessageType::LOG)
|
|
9
|
+
return if @outgoing_queue.nil? || @outgoing_queue.closed?
|
|
10
|
+
|
|
11
|
+
@outgoing_queue << ::RubyLsp::Notification.window_log_message(message, type: type)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def log_error(message)
|
|
15
|
+
log_message(message, type: ::RubyLsp::Constant::MessageType::ERROR)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-lsp-typeprof
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Takumi Shotoku
|
|
@@ -44,8 +44,6 @@ executables: []
|
|
|
44
44
|
extensions: []
|
|
45
45
|
extra_rdoc_files: []
|
|
46
46
|
files:
|
|
47
|
-
- ".tagpr"
|
|
48
|
-
- CHANGELOG.md
|
|
49
47
|
- CODE_OF_CONDUCT.md
|
|
50
48
|
- LICENSE.txt
|
|
51
49
|
- README.md
|
|
@@ -53,6 +51,7 @@ files:
|
|
|
53
51
|
- lib/ruby-lsp-typeprof.rb
|
|
54
52
|
- lib/ruby_lsp/ruby_lsp_typeprof/addon.rb
|
|
55
53
|
- lib/ruby_lsp/ruby_lsp_typeprof/code_lens_listener.rb
|
|
54
|
+
- lib/ruby_lsp/ruby_lsp_typeprof/loggable.rb
|
|
56
55
|
- lib/ruby_lsp_typeprof/version.rb
|
|
57
56
|
- sig/ruby_lsp_typeprof/version.rbs
|
|
58
57
|
homepage: https://github.com/sinsoku/ruby-lsp-typeprof
|
|
@@ -60,8 +59,8 @@ licenses:
|
|
|
60
59
|
- MIT
|
|
61
60
|
metadata:
|
|
62
61
|
homepage_uri: https://github.com/sinsoku/ruby-lsp-typeprof
|
|
63
|
-
source_code_uri: https://github.com/sinsoku/ruby-lsp-typeprof/tree/v0.
|
|
64
|
-
changelog_uri: https://github.com/sinsoku/ruby-lsp-typeprof/
|
|
62
|
+
source_code_uri: https://github.com/sinsoku/ruby-lsp-typeprof/tree/v0.4.0
|
|
63
|
+
changelog_uri: https://github.com/sinsoku/ruby-lsp-typeprof/releases
|
|
65
64
|
rubygems_mfa_required: 'true'
|
|
66
65
|
rdoc_options: []
|
|
67
66
|
require_paths:
|
|
@@ -77,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
77
76
|
- !ruby/object:Gem::Version
|
|
78
77
|
version: '0'
|
|
79
78
|
requirements: []
|
|
80
|
-
rubygems_version: 4.0.
|
|
79
|
+
rubygems_version: 4.0.10
|
|
81
80
|
specification_version: 4
|
|
82
81
|
summary: A Ruby LSP addon for TypeProf
|
|
83
82
|
test_files: []
|
data/.tagpr
DELETED
data/CHANGELOG.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
## [v0.3.0](https://github.com/sinsoku/ruby-lsp-typeprof/compare/v0.2.0...v0.3.0) - 2026-05-08
|
|
2
|
-
- feat: Add enabled setting to toggle the entire add-on by @sinsoku in https://github.com/sinsoku/ruby-lsp-typeprof/pull/5
|
|
3
|
-
|
|
4
|
-
## [v0.2.0](https://github.com/sinsoku/ruby-lsp-typeprof/compare/v0.1.1...v0.2.0) - 2026-05-03
|
|
5
|
-
- feat: Add enableCodeLens setting via addonSettings by @sinsoku in https://github.com/sinsoku/ruby-lsp-typeprof/pull/4
|
|
6
|
-
|
|
7
|
-
## [v0.1.1](https://github.com/sinsoku/ruby-lsp-typeprof/compare/v0.1.0...v0.1.1) - 2026-04-27
|
|
8
|
-
|
|
9
|
-
## [0.1.0] - 2026-04-27
|
|
10
|
-
|
|
11
|
-
- feat: Display type declarations using Code Lens
|