ruby-lsp 0.23.13 → 0.23.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e224f23084eccd6f7b441b6cf6ae2793fb9c73a0045bf36f8c1bbdf2b1f00445
4
- data.tar.gz: 581749c8bd2ab362075e49940d364af6a237068e6107d340a2535043d7fdec37
3
+ metadata.gz: 49fceec4749d3523e5271e7e363f6f7e34203aa406d7e6c652f7950a3036a917
4
+ data.tar.gz: 03db90b64dbbd29bd7485eb2bfd9657e845de82d38824d61c6f3f27439968125
5
5
  SHA512:
6
- metadata.gz: a5d7cb45c56ad5e9e92cba7a0012be7a1626044da4fbc936c413b7a8e5cb3cdd4463bf56dd35ef65feed10f0de363edd04702a4496572248e6e74ea9f720a373
7
- data.tar.gz: 53639a355c1641e8b11d4e756a417ea9ee96421cb5a87090ffc94cd8f905d41ca3fa5111e4171a81fa62b452c23088895deca0e7eb52fd2e8fed82e1232d2d06
6
+ metadata.gz: 1124cf716bf2a7c04b72c4dcce0bd830218c57b8e28a3e36267aeb9a9e28da4e63c392fff203b3546e4c10c1b63bb62e950f8413d9c569e11986828ddaf73e13
7
+ data.tar.gz: 92d3fe608ca8b547fe9aba4389b5f14e193dfe11f0ceafa0c1ac5fafca3d63fe875f94d803e5c594179eaf6ccbf99a0dbede08e5efe716744b343201507d404a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.23.13
1
+ 0.23.14
@@ -15,14 +15,19 @@ module URI
15
15
  class << self
16
16
  #: (path: String, ?fragment: String?, ?scheme: String, ?load_path_entry: String?) -> URI::Generic
17
17
  def from_path(path:, fragment: nil, scheme: "file", load_path_entry: nil)
18
+ # This unsafe regex is the same one used in the URI::RFC2396_REGEXP class with the exception of the fact that we
19
+ # do not include colon as a safe character. VS Code URIs always escape colons and we need to ensure we do the
20
+ # same to avoid inconsistencies in our URIs, which are used to identify resources
21
+ unsafe_regex = %r{[^\-_.!~*'()a-zA-Z\d;/?@&=+$,\[\]]}
22
+
18
23
  # On Windows, if the path begins with the disk name, we need to add a leading slash to make it a valid URI
19
24
  escaped_path = if /^[A-Z]:/i.match?(path)
20
- PARSER.escape("/#{path}")
25
+ PARSER.escape("/#{path}", unsafe_regex)
21
26
  elsif path.start_with?("//?/")
22
27
  # Some paths on Windows start with "//?/". This is a special prefix that allows for long file paths
23
- PARSER.escape(path.delete_prefix("//?"))
28
+ PARSER.escape(path.delete_prefix("//?"), unsafe_regex)
24
29
  else
25
- PARSER.escape(path)
30
+ PARSER.escape(path, unsafe_regex)
26
31
  end
27
32
 
28
33
  uri = build(scheme: scheme, path: escaped_path, fragment: fragment)
@@ -12,12 +12,12 @@ module RubyIndexer
12
12
 
13
13
  def test_from_path_on_windows
14
14
  uri = URI::Generic.from_path(path: "C:/some/windows/path/to/file.rb")
15
- assert_equal("/C:/some/windows/path/to/file.rb", uri.path)
15
+ assert_equal("/C%3A/some/windows/path/to/file.rb", uri.path)
16
16
  end
17
17
 
18
18
  def test_from_path_on_windows_with_lowercase_drive
19
19
  uri = URI::Generic.from_path(path: "c:/some/windows/path/to/file.rb")
20
- assert_equal("/c:/some/windows/path/to/file.rb", uri.path)
20
+ assert_equal("/c%3A/some/windows/path/to/file.rb", uri.path)
21
21
  end
22
22
 
23
23
  def test_to_standardized_path_on_unix
@@ -68,5 +68,18 @@ module RubyIndexer
68
68
  uri.add_require_path_from_load_entry("/some/unix/path")
69
69
  assert_equal("to/file", uri.require_path)
70
70
  end
71
+
72
+ def test_from_path_escapes_colon_characters
73
+ uri = URI::Generic.from_path(path: "c:/some/windows/path with/spaces/file.rb")
74
+ assert_equal("c:/some/windows/path with/spaces/file.rb", uri.to_standardized_path)
75
+ assert_equal("file:///c%3A/some/windows/path%20with/spaces/file.rb", uri.to_s)
76
+ end
77
+
78
+ def test_from_path_with_unicode_characters
79
+ path = "/path/with/unicode/文件.rb"
80
+ uri = URI::Generic.from_path(path: path)
81
+ assert_equal(path, uri.to_standardized_path)
82
+ assert_equal("file:///path/with/unicode/%E6%96%87%E4%BB%B6.rb", uri.to_s)
83
+ end
71
84
  end
72
85
  end
@@ -42,7 +42,6 @@ module RubyLsp
42
42
  ensure
43
43
  if load_addons
44
44
  RubyLsp::Addon.addons.each(&:deactivate)
45
- RubyLsp::Addon.addon_classes.clear
46
45
  RubyLsp::Addon.addons.clear
47
46
  end
48
47
  server.run_shutdown
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.13
4
+ version: 0.23.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-03-28 00:00:00.000000000 Z
10
+ date: 2025-04-09 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: language_server-protocol