Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit 1207e75

Browse files
darkwingjasonLaster
authored andcommitted
Prevent anonymous functions from displaying in symbol search (#5803)
1 parent cd50717 commit 1207e75

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/components/QuickOpenModal.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ export class QuickOpenModal extends Component<Props, State> {
128128
let results = functions;
129129
if (this.isVariableQuery()) {
130130
results = variables;
131+
} else {
132+
results = results.filter(result => result.title !== "anonymous");
131133
}
134+
132135
if (query === "@" || query === "#") {
133136
return this.setState({ results });
134137
}

src/components/tests/QuickOpenModal.spec.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,27 @@ describe("QuickOpenModal", () => {
6666
expect(wrapper).toMatchSnapshot();
6767
});
6868

69+
test("Ensure anonymous functions do not render in QuickOpenModal", () => {
70+
const { wrapper } = generateModal(
71+
{
72+
enabled: true,
73+
query: "@",
74+
searchType: "functions",
75+
symbols: {
76+
functions: [
77+
{ title: "anonymous" },
78+
{ title: "c" },
79+
{ title: "anonymous" }
80+
],
81+
variables: []
82+
}
83+
},
84+
"mount"
85+
);
86+
expect(wrapper.find("ResultList")).toHaveLength(1);
87+
expect(wrapper.find("li")).toHaveLength(1);
88+
});
89+
6990
test("Basic render with mount & searchType = variables", () => {
7091
const { wrapper } = generateModal(
7192
{

0 commit comments

Comments
 (0)