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:

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

>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) {

Leave a ReplyCancel reply