Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I make an arrow function show up in the functions section of the Outline search instead of the variables section?

The VS Code code navigation is not working with arrow functions defined:

async function all(req: Request, res: Response) {
.....

const checkLogin = async (req: Request, res: Response) => {

When I display the code navigation, this is what I see:
enter image description here

I would like to have the checkLogin definition in the functions section. Is it possible?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

checkLogin is a variable. It happens to be a const variable that references a Function object, but evidently, VS Code doesn’t interpret that as a special case, so it displays it in the "variables" section of the part of the outline search, and not the "functions" section.

If you really wanted it in the "functions" section, you could rewrite it like so:

async function checkLogin (req: Request, res: Response) {
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading