File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -1786,6 +1786,56 @@ def _():
17861786 assert_snapshot ! ( test. completions( ) , @"<No completions found>" ) ;
17871787 }
17881788
1789+ #[ test]
1790+ fn string_dot_attr1 ( ) {
1791+ let test = cursor_test (
1792+ r#"
1793+ foo = 1
1794+ bar = 2
1795+
1796+ class Foo:
1797+ def method(self): ...
1798+
1799+ f = Foo()
1800+
1801+ # String, this is not an attribute access
1802+ "f.<CURSOR>
1803+ "# ,
1804+ ) ;
1805+
1806+ // TODO: This should not have any completions suggested for it.
1807+ // We do correctly avoid giving `object.attr` completions here,
1808+ // but we instead fall back to scope based completions. Since
1809+ // we're inside a string, we should avoid giving completions at
1810+ // all.
1811+ assert_snapshot ! ( test. completions( ) , @r"
1812+ Foo
1813+ bar
1814+ f
1815+ foo
1816+ " ) ;
1817+ }
1818+
1819+ #[ test]
1820+ fn string_dot_attr2 ( ) {
1821+ let test = cursor_test (
1822+ r#"
1823+ foo = 1
1824+ bar = 2
1825+
1826+ class Foo:
1827+ def method(self): ...
1828+
1829+ f = Foo()
1830+
1831+ # F-string, this is an attribute access
1832+ f"{f.<CURSOR>
1833+ "# ,
1834+ ) ;
1835+
1836+ test. assert_completions_include ( "method" ) ;
1837+ }
1838+
17891839 impl CursorTest {
17901840 fn completions ( & self ) -> String {
17911841 self . completions_if ( |_| true )
You can’t perform that action at this time.
0 commit comments