ruby-lsp-typeprof 0.5.0 → 0.5.1
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/lib/ruby_lsp/ruby_lsp_typeprof/addon.rb +17 -2
- data/lib/ruby_lsp_typeprof/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8dca9c586f41117ed848a69f9f2745e6e37b62248ddd4624a0af1b8f0de55962
|
|
4
|
+
data.tar.gz: c36003ffa4f755bf22f6942c98b7d09b0e9b0499886e85f0a6bed61742c9f812
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 94b3aec43190e38cf7d175b75be234ad8bba724326b46a03eff867bf337a400ac62647fa09cfa4edcc2a54572106b5a366d9796a015e2f60f417cd18f0ca2c5e
|
|
7
|
+
data.tar.gz: 9aa30927f54947bcad1ae814ac353c448a4dfd9c38878e94b6cb3685e38fa677cd760adff8b8e2a23a7658845a9f0046d511c8d94a16b2abcfd41d4a9f93bba8
|
|
@@ -30,7 +30,7 @@ module RubyLsp
|
|
|
30
30
|
return unless @enabled
|
|
31
31
|
|
|
32
32
|
require "typeprof"
|
|
33
|
-
@service = build_service(global_state.workspace_path)
|
|
33
|
+
@service = with_utf8_default_external { build_service(global_state.workspace_path) }
|
|
34
34
|
rescue StandardError => e
|
|
35
35
|
log_error("Ruby LSP TypeProf failed to activate: #{e.full_message(highlight: false)}")
|
|
36
36
|
end
|
|
@@ -109,10 +109,25 @@ module RubyLsp
|
|
|
109
109
|
path = URI.parse(change[:uri]).path
|
|
110
110
|
return unless path&.end_with?(".rb", ".rbs")
|
|
111
111
|
|
|
112
|
-
@service.update_file(path, nil)
|
|
112
|
+
with_utf8_default_external { @service.update_file(path, nil) }
|
|
113
113
|
rescue StandardError => e
|
|
114
114
|
log_error("Ruby LSP TypeProf failed to update file #{path}: #{e.full_message(highlight: false)}")
|
|
115
115
|
end
|
|
116
|
+
|
|
117
|
+
# TypeProf reads files with File.read, which follows Encoding.default_external.
|
|
118
|
+
# Without LANG that is US-ASCII and non-ASCII .rbs files fail to parse.
|
|
119
|
+
# See ruby/typeprof#479.
|
|
120
|
+
def with_utf8_default_external
|
|
121
|
+
orig = Encoding.default_external
|
|
122
|
+
return yield if orig == Encoding::UTF_8
|
|
123
|
+
|
|
124
|
+
Encoding.default_external = Encoding::UTF_8
|
|
125
|
+
begin
|
|
126
|
+
yield
|
|
127
|
+
ensure
|
|
128
|
+
Encoding.default_external = orig
|
|
129
|
+
end
|
|
130
|
+
end
|
|
116
131
|
end
|
|
117
132
|
end
|
|
118
133
|
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.5.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Takumi Shotoku
|
|
@@ -61,7 +61,7 @@ licenses:
|
|
|
61
61
|
- MIT
|
|
62
62
|
metadata:
|
|
63
63
|
homepage_uri: https://github.com/sinsoku/ruby-lsp-typeprof
|
|
64
|
-
source_code_uri: https://github.com/sinsoku/ruby-lsp-typeprof/tree/v0.5.
|
|
64
|
+
source_code_uri: https://github.com/sinsoku/ruby-lsp-typeprof/tree/v0.5.1
|
|
65
65
|
changelog_uri: https://github.com/sinsoku/ruby-lsp-typeprof/releases
|
|
66
66
|
rubygems_mfa_required: 'true'
|
|
67
67
|
rdoc_options: []
|