Skip to content

Commit da486d7

Browse files
committed
Merge branch 'release/095'
2 parents 2dce4e4 + ecfc8e6 commit da486d7

7 files changed

Lines changed: 147 additions & 33 deletions

File tree

CHANGELOG.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
#### 0.9.5 Tue Feb 10 22:04:44 PST 2026
4+
5+
* Fix some scope lookups
6+
* Update the Gemfile
7+
38
#### 0.9.4 Fri Jan 30 21:09:57 PST 2026
49

510
* Enhance constant lookup to support namespaced constants in ProjectManager

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
#
33
# For development:
44
# docker run -it -v $PWD:/project -v $PWD:/tmp/src -w /tmp/src ruby_language_server sh -c 'bundle && guard'
5-
FROM ruby:4.0-alpine
5+
FROM ruby:4.0-slim
66
LABEL maintainer="kurt@CircleW.org"
77

88
# RUN gem update bundler - Skipping as Ruby 4.0 comes with compatible bundler
99

1010
# Needed for byebug and some other gems
11-
RUN apk update
11+
RUN apt-get update && apt-get install -y \
12+
curl make g++ sqlite3 libsqlite3-dev libyaml-dev linux-libc-dev build-essential ncurses-bin unzip pkg-config file \
13+
&& rm -rf /var/lib/apt/lists/*
1214
# changes as of ruby 4:
1315
# ncurses for guard
1416
# linux-headers to build some io code - maybe to do with sockets
15-
RUN apk add curl make g++ sqlite-dev yaml-dev linux-headers ncurses
1617

1718
WORKDIR /usr/local/src
1819
RUN curl -O -L https://github.com/mateusza/SQLite-Levenshtein/archive/master.zip

Gemfile.lock

Lines changed: 71 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
ruby_language_server (0.9.4)
4+
ruby_language_server (0.9.5)
55
activerecord (~> 8.1)
66
amatch
77
bundler
@@ -53,39 +53,49 @@ GEM
5353
drb (2.2.3)
5454
erb (6.0.1)
5555
etc (1.4.6)
56+
ffi (1.17.3-aarch64-linux-gnu)
5657
ffi (1.17.3-aarch64-linux-musl)
58+
ffi (1.17.3-arm-linux-gnu)
59+
ffi (1.17.3-arm-linux-musl)
60+
ffi (1.17.3-arm64-darwin)
61+
ffi (1.17.3-x86-linux-gnu)
62+
ffi (1.17.3-x86-linux-musl)
63+
ffi (1.17.3-x86_64-darwin)
64+
ffi (1.17.3-x86_64-linux-gnu)
65+
ffi (1.17.3-x86_64-linux-musl)
5766
formatador (1.2.3)
5867
reline
5968
fuzzy_match (2.1.0)
60-
guard (2.19.1)
69+
guard (2.20.1)
6170
formatador (>= 0.2.4)
6271
listen (>= 2.7, < 4.0)
6372
logger (~> 1.6)
6473
lumberjack (>= 1.0.12, < 2.0)
6574
nenv (~> 0.1)
6675
notiffany (~> 0.0)
67-
ostruct (~> 0.6)
6876
pry (>= 0.13.0)
6977
shellany (~> 0.0)
7078
thor (>= 0.18.1)
7179
guard-compat (1.2.1)
72-
guard-minitest (2.4.6)
80+
guard-minitest (3.0.0)
7381
guard-compat (~> 1.2)
74-
minitest (>= 3.0)
82+
minitest (>= 5.0.4, < 7.0)
7583
guard-rubocop (1.5.0)
7684
guard (~> 2.0)
7785
rubocop (< 2.0)
7886
i18n (1.14.8)
7987
concurrent-ruby (~> 1.0)
8088
io-console (0.8.2)
81-
irb (1.16.0)
89+
irb (1.17.0)
8290
pp (>= 0.6.0)
91+
prism (>= 1.3.0)
8392
rdoc (>= 4.0.0)
8493
reline (>= 0.4.2)
85-
json (2.18.0)
94+
json (2.18.1)
8695
language_server-protocol (3.17.0.5)
8796
lint_roller (1.1.0)
88-
listen (3.9.0)
97+
listen (3.10.0)
98+
logger
8999
rb-fsevent (~> 0.10, >= 0.10.3)
90100
rb-inotify (~> 0.9, >= 0.9.10)
91101
logger (1.7.0)
@@ -105,13 +115,13 @@ GEM
105115
shellany (~> 0.0)
106116
ostruct (0.6.3)
107117
parallel (1.27.0)
108-
parser (3.3.10.0)
118+
parser (3.3.10.1)
109119
ast (~> 2.4.1)
110120
racc
111121
pp (0.6.3)
112122
prettyprint
113123
prettyprint (0.2.0)
114-
prism (1.8.0)
124+
prism (1.9.0)
115125
pry (0.16.0)
116126
coderay (~> 1.1)
117127
method_source (~> 1.0)
@@ -126,7 +136,7 @@ GEM
126136
rb-inotify (0.11.1)
127137
ffi (~> 1.0)
128138
rb-readline (0.5.5)
129-
rdoc (7.1.0)
139+
rdoc (7.2.0)
130140
erb
131141
psych (>= 4.0.0)
132142
tsort
@@ -135,15 +145,15 @@ GEM
135145
regexp_parser (2.11.3)
136146
reline (0.6.3)
137147
io-console (~> 0.5)
138-
rubocop (1.82.1)
148+
rubocop (1.84.1)
139149
json (~> 2.3)
140150
language_server-protocol (~> 3.17.0.2)
141151
lint_roller (~> 1.1.0)
142152
parallel (~> 1.10)
143153
parser (>= 3.3.0.2)
144154
rainbow (>= 2.2.2, < 4.0)
145155
regexp_parser (>= 2.9.3, < 3.0)
146-
rubocop-ast (>= 1.48.0, < 2.0)
156+
rubocop-ast (>= 1.49.0, < 2.0)
147157
ruby-progressbar (~> 1.7)
148158
unicode-display_width (>= 2.4.0, < 4.0)
149159
rubocop-ast (1.49.0)
@@ -172,12 +182,21 @@ GEM
172182
simplecov_json_formatter (~> 0.1)
173183
simplecov-html (0.13.2)
174184
simplecov_json_formatter (0.1.4)
185+
sqlite3 (2.9.0-aarch64-linux-gnu)
175186
sqlite3 (2.9.0-aarch64-linux-musl)
187+
sqlite3 (2.9.0-arm-linux-gnu)
188+
sqlite3 (2.9.0-arm-linux-musl)
189+
sqlite3 (2.9.0-arm64-darwin)
190+
sqlite3 (2.9.0-x86-linux-gnu)
191+
sqlite3 (2.9.0-x86-linux-musl)
192+
sqlite3 (2.9.0-x86_64-darwin)
193+
sqlite3 (2.9.0-x86_64-linux-gnu)
194+
sqlite3 (2.9.0-x86_64-linux-musl)
176195
stringio (3.2.0)
177196
sync (0.5.0)
178197
thor (1.5.0)
179198
timeout (0.6.0)
180-
tins (1.51.0)
199+
tins (1.51.1)
181200
bigdecimal
182201
mize (~> 0.6)
183202
readline
@@ -191,7 +210,16 @@ GEM
191210
uri (1.1.1)
192211

193212
PLATFORMS
213+
aarch64-linux-gnu
194214
aarch64-linux-musl
215+
arm-linux-gnu
216+
arm-linux-musl
217+
arm64-darwin
218+
x86-linux-gnu
219+
x86-linux-musl
220+
x86_64-darwin
221+
x86_64-linux-gnu
222+
x86_64-linux-musl
195223

196224
DEPENDENCIES
197225
debug
@@ -231,20 +259,29 @@ CHECKSUMS
231259
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
232260
erb (6.0.1) sha256=28ecdd99c5472aebd5674d6061e3c6b0a45c049578b071e5a52c2a7f13c197e5
233261
etc (1.4.6) sha256=0f7e9e7842ea5e3c3bd9bc81746ebb8c65ea29e4c42a93520a0d638129c7de01
262+
ffi (1.17.3-aarch64-linux-gnu) sha256=28ad573df26560f0aedd8a90c3371279a0b2bd0b4e834b16a2baa10bd7a97068
234263
ffi (1.17.3-aarch64-linux-musl) sha256=020b33b76775b1abacc3b7d86b287cef3251f66d747092deec592c7f5df764b2
264+
ffi (1.17.3-arm-linux-gnu) sha256=5bd4cea83b68b5ec0037f99c57d5ce2dd5aa438f35decc5ef68a7d085c785668
265+
ffi (1.17.3-arm-linux-musl) sha256=0d7626bb96265f9af78afa33e267d71cfef9d9a8eb8f5525344f8da6c7d76053
266+
ffi (1.17.3-arm64-darwin) sha256=0c690555d4cee17a7f07c04d59df39b2fba74ec440b19da1f685c6579bb0717f
267+
ffi (1.17.3-x86-linux-gnu) sha256=868a88fcaf5186c3a46b7c7c2b2c34550e1e61a405670ab23f5b6c9971529089
268+
ffi (1.17.3-x86-linux-musl) sha256=f0286aa6ef40605cf586e61406c446de34397b85dbb08cc99fdaddaef8343945
269+
ffi (1.17.3-x86_64-darwin) sha256=1f211811eb5cfaa25998322cdd92ab104bfbd26d1c4c08471599c511f2c00bb5
270+
ffi (1.17.3-x86_64-linux-gnu) sha256=3746b01f677aae7b16dc1acb7cb3cc17b3e35bdae7676a3f568153fb0e2c887f
271+
ffi (1.17.3-x86_64-linux-musl) sha256=086b221c3a68320b7564066f46fed23449a44f7a1935f1fe5a245bd89d9aea56
235272
formatador (1.2.3) sha256=19fa898133c2c26cdbb5d09f6998c1e137ad9427a046663e55adfe18b950d894
236273
fuzzy_match (2.1.0) sha256=e97e25d0eaee48a5f77ed970d007c7b6ff3c6a6858303fead2d1986859204dfc
237-
guard (2.19.1) sha256=b8bc52694be3d8b26730280de7dcec7fe92ea1cff3414246fe96af3f23580f3d
274+
guard (2.20.1) sha256=ab9cd7873854e6b76080c0589f781ff3e390e441bdda20165804df54f977015a
238275
guard-compat (1.2.1) sha256=3ad21ab0070107f92edfd82610b5cdc2fb8e368851e72362ada9703443d646fe
239-
guard-minitest (2.4.6) sha256=d89e83d029447c13b191599085d24b6e2fe61e402d275e46491cd3e82f561572
276+
guard-minitest (3.0.0) sha256=0c418e62a4081a429e4e66ad094a3b66f113423542b43ad7b2df0c87f19d5728
240277
guard-rubocop (1.5.0) sha256=3041d796dcb5ee31e352de74732250826f5f235b4ff48df9dbf424a6dc736251
241278
i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5
242279
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
243-
irb (1.16.0) sha256=2abe56c9ac947cdcb2f150572904ba798c1e93c890c256f8429981a7675b0806
244-
json (2.18.0) sha256=b10506aee4183f5cf49e0efc48073d7b75843ce3782c68dbeb763351c08fd505
280+
irb (1.17.0) sha256=168c4ddb93d8a361a045c41d92b2952c7a118fa73f23fe14e55609eb7a863aae
281+
json (2.18.1) sha256=fe112755501b8d0466b5ada6cf50c8c3f41e897fa128ac5d263ec09eedc9f986
245282
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
246283
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
247-
listen (3.9.0) sha256=db9e4424e0e5834480385197c139cb6b0ae0ef28cc13310cfd1ca78377d59c67
284+
listen (3.10.0) sha256=c6e182db62143aeccc2e1960033bebe7445309c7272061979bb098d03760c9d2
248285
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
249286
lumberjack (1.4.2) sha256=40de5ae46321380c835031bcc1370f13bba304d29f2b5f5bb152061a5a191b95
250287
method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5
@@ -255,10 +292,10 @@ CHECKSUMS
255292
notiffany (0.1.3) sha256=d37669605b7f8dcb04e004e6373e2a780b98c776f8eb503ac9578557d7808738
256293
ostruct (0.6.3) sha256=95a2ed4a4bd1d190784e666b47b2d3f078e4a9efda2fccf18f84ddc6538ed912
257294
parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
258-
parser (3.3.10.0) sha256=ce3587fa5cc55a88c4ba5b2b37621b3329aadf5728f9eafa36bbd121462aabd6
295+
parser (3.3.10.1) sha256=06f6a725d2cd91e5e7f2b7c32ba143631e1f7c8ae2fb918fc4cebec187e6a688
259296
pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6
260297
prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
261-
prism (1.8.0) sha256=84453a16ef5530ea62c5f03ec16b52a459575ad4e7b9c2b360fd8ce2c39c1254
298+
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
262299
pry (0.16.0) sha256=d76c69065698ed1f85e717bd33d7942c38a50868f6b0673c636192b3d1b6054e
263300
psych (5.3.1) sha256=eb7a57cef10c9d70173ff74e739d843ac3b2c019a003de48447b2963d81b1974
264301
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
@@ -267,29 +304,38 @@ CHECKSUMS
267304
rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe
268305
rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e
269306
rb-readline (0.5.5) sha256=9e9bd7e198bdef0822c46902f6c592b882c1f9777894a4c3dcf5b320824a8793
270-
rdoc (7.1.0) sha256=494899df0706c178596ca6e1d50f1b7eb285a9b2aae715be5abd742734f17363
307+
rdoc (7.2.0) sha256=8650f76cd4009c3b54955eb5d7e3a075c60a57276766ebf36f9085e8c9f23192
271308
readline (0.0.4) sha256=6138eef17be2b98298b672c3ea63bf9cb5158d401324f26e1e84f235879c1d6a
272309
regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
273310
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
274-
rubocop (1.82.1) sha256=09f1a6a654a960eda767aebea33e47603080f8e9c9a3f019bf9b94c9cab5e273
311+
rubocop (1.84.1) sha256=14cc626f355141f5a2ef53c10a68d66b13bb30639b26370a76559096cc6bcc1a
275312
rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
276313
rubocop-minitest (0.38.2) sha256=5a9dfb5a538973d0601aa51e59637d3998bb8df81233edf1ff421504c6280068
277314
rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
278315
rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
279316
rubocop-rspec (3.9.0) sha256=8fa70a3619408237d789aeecfb9beef40576acc855173e60939d63332fdb55e2
280317
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
281-
ruby_language_server (0.9.4)
318+
ruby_language_server (0.9.5)
282319
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
283320
shellany (0.0.1) sha256=0e127a9132698766d7e752e82cdac8250b6adbd09e6c0a7fbbb6f61964fedee7
284321
simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
285322
simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
286323
simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
324+
sqlite3 (2.9.0-aarch64-linux-gnu) sha256=cfe1e0216f46d7483839719bf827129151e6c680317b99d7b8fc1597a3e13473
287325
sqlite3 (2.9.0-aarch64-linux-musl) sha256=56a35cb2d70779afc2ac191baf2c2148242285ecfed72f9b021218c5c4917913
326+
sqlite3 (2.9.0-arm-linux-gnu) sha256=a19a21504b0d7c8c825fbbf37b358ae316b6bd0d0134c619874060b2eef05435
327+
sqlite3 (2.9.0-arm-linux-musl) sha256=fca5b26197c70e3363115d3faaea34d7b2ad9c7f5fa8d8312e31b64e7556ee07
328+
sqlite3 (2.9.0-arm64-darwin) sha256=a917bd9b84285766ff3300b7d79cd583f5a067594c8c1263e6441618c04a6ed3
329+
sqlite3 (2.9.0-x86-linux-gnu) sha256=47317ba230f6c2c361981aa5fc1bf9de1b99727317171393ba90abab092c5b5f
330+
sqlite3 (2.9.0-x86-linux-musl) sha256=b627f3a2ca59aaaa5e10b8666cdbd7122469b49afa4bd895133cecb7b5c1368d
331+
sqlite3 (2.9.0-x86_64-darwin) sha256=59fe51baa3cb33c36d27ce78b4ed9360cd33ccca09498c2ae63850c97c0a6026
332+
sqlite3 (2.9.0-x86_64-linux-gnu) sha256=72fff9bd750070ba3af695511ba5f0e0a2d8a9206f84869640b3e99dfaf3d5a5
333+
sqlite3 (2.9.0-x86_64-linux-musl) sha256=ef716ba7a66d7deb1ccc402ac3a6d7343da17fac862793b7f0be3d2917253c90
288334
stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
289335
sync (0.5.0) sha256=668356cc07c59ac7ed9ecf34fec3929831f179c07adb1f3e1c3b7a1609a638fd
290336
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
291337
timeout (0.6.0) sha256=6d722ad619f96ee383a0c557ec6eb8c4ecb08af3af62098a0be5057bf00de1af
292-
tins (1.51.0) sha256=9f83c534bfca23973c5e641308828d71d5ffa79fc32c0ef90996efa699d0696f
338+
tins (1.51.1) sha256=cc17bc37e62bd2dd2e8bc2a706b9cf419dfd4766407b84b341a67db947f8e44a
293339
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
294340
tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
295341
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42

lib/ruby_language_server/project_manager.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,20 @@ def possible_definitions(uri, position)
182182
end
183183

184184
if class_module_indices.any?
185-
# Use the rightmost class/module and build the path from there to just before the name
185+
# Find the continuous chain of class/module names ending at the rightmost one
186+
# For "Foo::Bar.method", we want both Foo and Bar, not just Bar
187+
# For "foo.Bar::Baz.method", we want Bar and Baz, not just Baz
186188
rightmost_class_index = class_module_indices.last
187-
scope_path_parts = context[rightmost_class_index..-2]
189+
190+
# Find the leftmost index of the continuous chain ending at rightmost_class_index
191+
leftmost_continuous_index = rightmost_class_index
192+
class_module_indices.reverse.each_cons(2) do |right, left|
193+
break unless right == left + 1 # Break if not continuous
194+
195+
leftmost_continuous_index = left
196+
end
197+
198+
scope_path_parts = context[leftmost_continuous_index..-2]
188199

189200
if scope_path_parts.empty?
190201
# This shouldn't happen, but handle it gracefully
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module RubyLanguageServer
4-
VERSION = '0.9.4'
4+
VERSION = '0.9.5'
55
end

spec/lib/ruby_language_server/completion_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def scope_completions_in_target_context(*)
5656
completions = RubyLanguageServer::Completion.completion(context, nar_naz_scope, all_scopes)
5757
# Methods with parameters now include insertText, insertTextFormat, label with params, and detail
5858
expected_items = [
59-
{label: "Bar", kind: 7},
60-
{label: "baz(bing, zing)", kind: 2, insertText: "baz(${1:bing}, ${2:zing})", insertTextFormat: 2, detail: "bing (required), zing (required)"}
59+
{label: "baz(bing, zing)", kind: 2, insertText: "baz(${1:bing}, ${2:zing})", insertTextFormat: 2, detail: "bing (required), zing (required)"},
60+
{label: "Bar", kind: 7}
6161
]
6262
assert_equal(expected_items, completions[:items][0..1])
6363
end

spec/lib/ruby_language_server/project_manager_spec.rb

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,57 @@ def import
289289
end
290290
end
291291

292+
describe 'namespaced class method lookup' do
293+
let(:file_with_namespaced_class_method) do
294+
<<~CODE_FILE
295+
module Foo
296+
class Bar
297+
def self.class_method
298+
puts "class method"
299+
end
300+
def some_method
301+
puts "instance method"
302+
end
303+
end
304+
end
305+
306+
Foo::Bar # clicking on Bar should find the class
307+
Foo::Bar.class_method # clicking on class_method should find the method
308+
CODE_FILE
309+
end
310+
311+
before(:each) do
312+
project_manager.update_document_content('namespace_method_uri', file_with_namespaced_class_method)
313+
project_manager.tags_for_uri('namespace_method_uri') # Force load of tags
314+
end
315+
316+
it 'finds namespaced class when clicking on Bar in Foo::Bar' do
317+
# Position on "Bar" in "Foo::Bar" (0-indexed line 11)
318+
# The line is: "Foo::Bar # clicking on Bar should find the class"
319+
# Character 5 is on 'B' of Bar
320+
position = OpenStruct.new(line: 11, character: 5)
321+
results = project_manager.possible_definitions('namespace_method_uri', position)
322+
323+
# Should find the Bar class definition on line 1 (0-indexed)
324+
assert_equal 1, results.length
325+
assert_equal 'namespace_method_uri', results.first[:uri]
326+
assert_equal 1, results.first[:range][:start][:line]
327+
end
328+
329+
it 'finds class method when clicking on class_method in Foo::Bar.class_method' do
330+
# Position on "class_method" in "Foo::Bar.class_method" (0-indexed line 12)
331+
# The line is: "Foo::Bar.class_method # clicking on class_method should find the method"
332+
# Character 9 is on 'c' of class_method
333+
position = OpenStruct.new(line: 12, character: 9)
334+
results = project_manager.possible_definitions('namespace_method_uri', position)
335+
336+
# Should find the class_method definition on line 2 (0-indexed)
337+
assert_equal 1, results.length
338+
assert_equal 'namespace_method_uri', results.first[:uri]
339+
assert_equal 2, results.first[:range][:start][:line]
340+
end
341+
end
342+
292343
describe 'parameter vs method name resolution' do
293344
let(:file_with_param_shadowing) do
294345
<<~CODE_FILE

0 commit comments

Comments
 (0)