@@ -861,6 +861,162 @@ print(f\"{some<CURSOR>
861861 " ) ;
862862 }
863863
864+ // Ref: https://github.com/astral-sh/ty/issues/572
865+ #[ test]
866+ fn scope_id_missing_function_identifier1 ( ) {
867+ let test = cursor_test (
868+ "\
869+ def m<CURSOR>
870+ " ,
871+ ) ;
872+
873+ assert_snapshot ! ( test. completions( ) , @"<No completions found>" ) ;
874+ }
875+
876+ // Ref: https://github.com/astral-sh/ty/issues/572
877+ #[ test]
878+ fn scope_id_missing_function_identifier2 ( ) {
879+ let test = cursor_test (
880+ "\
881+ def m<CURSOR>(): pass
882+ " ,
883+ ) ;
884+
885+ assert_snapshot ! ( test. completions( ) , @"<No completions found>" ) ;
886+ }
887+
888+ // Ref: https://github.com/astral-sh/ty/issues/572
889+ #[ test]
890+ fn fscope_id_missing_function_identifier3 ( ) {
891+ let test = cursor_test (
892+ "\
893+ def m(): pass
894+ <CURSOR>
895+ " ,
896+ ) ;
897+
898+ assert_snapshot ! ( test. completions( ) , @r"
899+ m
900+ " ) ;
901+ }
902+
903+ // Ref: https://github.com/astral-sh/ty/issues/572
904+ #[ test]
905+ fn scope_id_missing_class_identifier1 ( ) {
906+ let test = cursor_test (
907+ "\
908+ class M<CURSOR>
909+ " ,
910+ ) ;
911+
912+ assert_snapshot ! ( test. completions( ) , @"<No completions found>" ) ;
913+ }
914+
915+ // Ref: https://github.com/astral-sh/ty/issues/572
916+ #[ test]
917+ fn scope_id_missing_type_alias1 ( ) {
918+ let test = cursor_test (
919+ "\
920+ Fo<CURSOR> = float
921+ " ,
922+ ) ;
923+
924+ assert_snapshot ! ( test. completions( ) , @r"
925+ Fo
926+ float
927+ " ) ;
928+ }
929+
930+ // Ref: https://github.com/astral-sh/ty/issues/572
931+ #[ test]
932+ fn scope_id_missing_import1 ( ) {
933+ let test = cursor_test (
934+ "\
935+ import fo<CURSOR>
936+ " ,
937+ ) ;
938+
939+ assert_snapshot ! ( test. completions( ) , @"<No completions found>" ) ;
940+ }
941+
942+ // Ref: https://github.com/astral-sh/ty/issues/572
943+ #[ test]
944+ fn scope_id_missing_import2 ( ) {
945+ let test = cursor_test (
946+ "\
947+ import foo as ba<CURSOR>
948+ " ,
949+ ) ;
950+
951+ assert_snapshot ! ( test. completions( ) , @"<No completions found>" ) ;
952+ }
953+
954+ // Ref: https://github.com/astral-sh/ty/issues/572
955+ #[ test]
956+ fn scope_id_missing_from_import1 ( ) {
957+ let test = cursor_test (
958+ "\
959+ from fo<CURSOR> import wat
960+ " ,
961+ ) ;
962+
963+ assert_snapshot ! ( test. completions( ) , @"<No completions found>" ) ;
964+ }
965+
966+ // Ref: https://github.com/astral-sh/ty/issues/572
967+ #[ test]
968+ fn scope_id_missing_from_import2 ( ) {
969+ let test = cursor_test (
970+ "\
971+ from foo import wa<CURSOR>
972+ " ,
973+ ) ;
974+
975+ assert_snapshot ! ( test. completions( ) , @"<No completions found>" ) ;
976+ }
977+
978+ // Ref: https://github.com/astral-sh/ty/issues/572
979+ #[ test]
980+ fn scope_id_missing_from_import3 ( ) {
981+ let test = cursor_test (
982+ "\
983+ from foo import wat as ba<CURSOR>
984+ " ,
985+ ) ;
986+
987+ assert_snapshot ! ( test. completions( ) , @"<No completions found>" ) ;
988+ }
989+
990+ // Ref: https://github.com/astral-sh/ty/issues/572
991+ #[ test]
992+ fn scope_id_missing_try_except1 ( ) {
993+ let test = cursor_test (
994+ "\
995+ try:
996+ pass
997+ except Type<CURSOR>:
998+ pass
999+ " ,
1000+ ) ;
1001+
1002+ assert_snapshot ! ( test. completions( ) , @r"
1003+ Type
1004+ " ) ;
1005+ }
1006+
1007+ // Ref: https://github.com/astral-sh/ty/issues/572
1008+ #[ test]
1009+ fn scope_id_missing_global1 ( ) {
1010+ let test = cursor_test (
1011+ "\
1012+ def _():
1013+ global fo<CURSOR>
1014+ " ,
1015+ ) ;
1016+
1017+ assert_snapshot ! ( test. completions( ) , @"<No completions found>" ) ;
1018+ }
1019+
8641020 impl CursorTest {
8651021 fn completions ( & self ) -> String {
8661022 let completions = completion ( & self . db , self . file , self . cursor_offset ) ;
0 commit comments