File tree Expand file tree Collapse file tree 3 files changed +43
-2
lines changed
Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 1616 two constructors of the same name were created.
1717 ([ Surya Rose] ( https://github.com/GearsDatapacks ) )
1818
19+ - Fixed a bug where jumping to the definition of an unqualified function would
20+ produce the correct location, but remain in the same file.
21+ ([ Surya Rose] ( https://github.com/gearsdatapacks ) )
22+
1923## v1.4.1 - 2024-08-04
2024
2125### Bug Fixes
Original file line number Diff line number Diff line change @@ -906,6 +906,41 @@ fn main() {
906906 )
907907}
908908
909+ #[ test]
910+ fn goto_definition_unqualified_function ( ) {
911+ let code = "
912+ import wibble.{wobble}
913+ fn main() {
914+ wobble()
915+ }
916+ " ;
917+
918+ assert_eq ! (
919+ definition(
920+ TestProject :: for_source( code) . add_module( "wibble" , "pub fn wobble() {}" ) ,
921+ Position :: new( 3 , 5 )
922+ ) ,
923+ Some ( Location {
924+ uri: Url :: from_file_path( Utf8PathBuf :: from( if cfg!( target_family = "windows" ) {
925+ r"\\?\C:\src\wibble.gleam"
926+ } else {
927+ "/src/wibble.gleam"
928+ } ) )
929+ . unwrap( ) ,
930+ range: Range {
931+ start: Position {
932+ line: 0 ,
933+ character: 0
934+ } ,
935+ end: Position {
936+ line: 0 ,
937+ character: 15
938+ }
939+ }
940+ } )
941+ )
942+ }
943+
909944#[ test]
910945fn goto_definition_import_unqualified_type ( ) {
911946 let code = "
Original file line number Diff line number Diff line change @@ -963,6 +963,9 @@ impl ValueConstructor {
963963 }
964964 | ValueConstructorVariant :: ModuleConstant {
965965 location, module, ..
966+ }
967+ | ValueConstructorVariant :: ModuleFn {
968+ location, module, ..
966969 } => DefinitionLocation {
967970 module : Some ( module. as_str ( ) ) ,
968971 span : * location,
@@ -973,8 +976,7 @@ impl ValueConstructor {
973976 span : literal. location ( ) ,
974977 } ,
975978
976- ValueConstructorVariant :: ModuleFn { location, .. }
977- | ValueConstructorVariant :: LocalVariable { location } => DefinitionLocation {
979+ ValueConstructorVariant :: LocalVariable { location } => DefinitionLocation {
978980 module : None ,
979981 span : * location,
980982 } ,
You can’t perform that action at this time.
0 commit comments