@@ -468,6 +468,16 @@ defmodule NextLSTest do
468468
469469 describe "two" do
470470 setup % { cwd: cwd } do
471+ remote = Path . join ( cwd , "lib/remote.ex" )
472+
473+ File . write! ( remote , """
474+ defmodule Remote do
475+ def bang!() do
476+ "‼️"
477+ end
478+ end
479+ """ )
480+
471481 imported = Path . join ( cwd , "lib/imported.ex" )
472482
473483 File . write! ( imported , """
@@ -484,6 +494,7 @@ defmodule NextLSTest do
484494 defmodule Foo do
485495 import Imported
486496 def run() do
497+ Remote.bang!()
487498 process()
488499 end
489500
@@ -494,7 +505,7 @@ defmodule NextLSTest do
494505 end
495506 """ )
496507
497- [ bar: bar , imported: imported ]
508+ [ bar: bar , imported: imported , remote: remote ]
498509 end
499510
500511 setup :with_lsp
@@ -517,19 +528,19 @@ defmodule NextLSTest do
517528 id: 4 ,
518529 jsonrpc: "2.0" ,
519530 params: % {
520- position: % { line: 3 , character: 6 } ,
531+ position: % { line: 4 , character: 6 } ,
521532 textDocument: % { uri: uri }
522533 }
523534 } )
524535
525536 assert_result 4 , % {
526537 "range" => % {
527538 "start" => % {
528- "line" => 6 ,
539+ "line" => 7 ,
529540 "character" => 0
530541 } ,
531542 "end" => % {
532- "line" => 6 ,
543+ "line" => 7 ,
533544 "character" => 0
534545 }
535546 } ,
@@ -555,7 +566,7 @@ defmodule NextLSTest do
555566 id: 4 ,
556567 jsonrpc: "2.0" ,
557568 params: % {
558- position: % { line: 7 , character: 5 } ,
569+ position: % { line: 8 , character: 5 } ,
559570 textDocument: % { uri: uri }
560571 }
561572 } )
@@ -576,6 +587,46 @@ defmodule NextLSTest do
576587 "uri" => ^ uri
577588 }
578589 end
590+
591+ test "go to remote function definition" , % { client: client , bar: bar , remote: remote } do
592+ assert :ok ==
593+ notify ( client , % {
594+ method: "initialized" ,
595+ jsonrpc: "2.0" ,
596+ params: % { }
597+ } )
598+
599+ assert_notification "window/logMessage" , % { "message" => "[NextLS] Runtime ready..." }
600+ assert_notification "window/logMessage" , % { "message" => "[NextLS] Compiled!" }
601+
602+ uri = uri ( bar )
603+
604+ request ( client , % {
605+ method: "textDocument/definition" ,
606+ id: 4 ,
607+ jsonrpc: "2.0" ,
608+ params: % {
609+ position: % { line: 3 , character: 12 } ,
610+ textDocument: % { uri: uri }
611+ }
612+ } )
613+
614+ uri = uri ( remote )
615+
616+ assert_result 4 , % {
617+ "range" => % {
618+ "start" => % {
619+ "line" => 1 ,
620+ "character" => 0
621+ } ,
622+ "end" => % {
623+ "line" => 1 ,
624+ "character" => 0
625+ }
626+ } ,
627+ "uri" => ^ uri
628+ }
629+ end
579630 end
580631
581632 defp with_lsp ( % { tmp_dir: tmp_dir } ) do
0 commit comments