|
259 | 259 | (expect (plist-get lsp-params :context) |
260 | 260 | :to-equal '(:includeDeclaration :json-false))))) |
261 | 261 |
|
| 262 | +(defun eca-editor-test--buffer-file-uri () |
| 263 | + "URI of `eca-editor-test--file' from its visiting buffer. |
| 264 | +Location URIs are built from the variable `buffer-file-name', |
| 265 | +which on Windows holds the resolved long path while |
| 266 | +`make-temp-file' may return a DOS 8.3 short name (e.g. RUNNER~1), |
| 267 | +so expected URIs must come from the same source." |
| 268 | + (eca--path-to-uri |
| 269 | + (buffer-file-name (find-buffer-visiting eca-editor-test--file)))) |
| 270 | + |
262 | 271 | ;; A fake xref backend answering fixed locations inside the temp file: |
263 | 272 | ;; the declaration at line 1 column 6 and a usage at line 2 column 2. |
264 | 273 | (cl-defmethod xref-backend-identifier-at-point ((_backend (eql eca-editor-test--xref))) |
|
304 | 313 | session request |
305 | 314 | (list :status "success" |
306 | 315 | :locations (vector |
307 | | - (list :uri (eca--path-to-uri eca-editor-test--file) |
| 316 | + (list :uri (eca-editor-test--buffer-file-uri) |
308 | 317 | :range (list :start (list :line 1 :character 7) |
309 | 318 | :end (list :line 1 :character 7))))))) |
310 | 319 |
|
|
316 | 325 | session request |
317 | 326 | (list :status "success" |
318 | 327 | :locations (vector |
319 | | - (list :uri (eca--path-to-uri eca-editor-test--file) |
| 328 | + (list :uri (eca-editor-test--buffer-file-uri) |
320 | 329 | :range (list :start (list :line 1 :character 7) |
321 | 330 | :end (list :line 1 :character 7))) |
322 | | - (list :uri (eca--path-to-uri eca-editor-test--file) |
| 331 | + (list :uri (eca-editor-test--buffer-file-uri) |
323 | 332 | :range (list :start (list :line 2 :character 3) |
324 | 333 | :end (list :line 2 :character 3))))))) |
325 | 334 |
|
|
333 | 342 | session request |
334 | 343 | (list :status "success" |
335 | 344 | :locations (vector |
336 | | - (list :uri (eca--path-to-uri eca-editor-test--file) |
| 345 | + (list :uri (eca-editor-test--buffer-file-uri) |
337 | 346 | :range (list :start (list :line 2 :character 3) |
338 | 347 | :end (list :line 2 :character 3))))))) |
339 | 348 |
|
|
0 commit comments