@@ -1917,6 +1917,56 @@ TEST(CompletionTest, DeprecatedResults) {
1917
1917
AllOf (Named (" TestClangc" ), Deprecated ())));
1918
1918
}
1919
1919
1920
+ TEST (SignatureHelpTest, InsideArgument) {
1921
+ {
1922
+ const auto Results = signatures (R"cpp(
1923
+ void foo(int x);
1924
+ void foo(int x, int y);
1925
+ int main() { foo(1+^); }
1926
+ )cpp" );
1927
+ EXPECT_THAT (
1928
+ Results.signatures ,
1929
+ ElementsAre (Sig (" foo(int x) -> void" , {" int x" }),
1930
+ Sig (" foo(int x, int y) -> void" , {" int x" , " int y" })));
1931
+ EXPECT_EQ (0 , Results.activeParameter );
1932
+ }
1933
+ {
1934
+ const auto Results = signatures (R"cpp(
1935
+ void foo(int x);
1936
+ void foo(int x, int y);
1937
+ int main() { foo(1^); }
1938
+ )cpp" );
1939
+ EXPECT_THAT (
1940
+ Results.signatures ,
1941
+ ElementsAre (Sig (" foo(int x) -> void" , {" int x" }),
1942
+ Sig (" foo(int x, int y) -> void" , {" int x" , " int y" })));
1943
+ EXPECT_EQ (0 , Results.activeParameter );
1944
+ }
1945
+ {
1946
+ const auto Results = signatures (R"cpp(
1947
+ void foo(int x);
1948
+ void foo(int x, int y);
1949
+ int main() { foo(1^0); }
1950
+ )cpp" );
1951
+ EXPECT_THAT (
1952
+ Results.signatures ,
1953
+ ElementsAre (Sig (" foo(int x) -> void" , {" int x" }),
1954
+ Sig (" foo(int x, int y) -> void" , {" int x" , " int y" })));
1955
+ EXPECT_EQ (0 , Results.activeParameter );
1956
+ }
1957
+ {
1958
+ const auto Results = signatures (R"cpp(
1959
+ void foo(int x);
1960
+ void foo(int x, int y);
1961
+ int bar(int x, int y);
1962
+ int main() { bar(foo(2, 3^)); }
1963
+ )cpp" );
1964
+ EXPECT_THAT (Results.signatures , ElementsAre (Sig (" foo(int x, int y) -> void" ,
1965
+ {" int x" , " int y" })));
1966
+ EXPECT_EQ (1 , Results.activeParameter );
1967
+ }
1968
+ }
1969
+
1920
1970
} // namespace
1921
1971
} // namespace clangd
1922
1972
} // namespace clang
0 commit comments