Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

147
Visualizações
VS Code - How to use "code completion" on some object that used in another file

I currently build a back-end using NodeJs.

To make the route, I should code like this:

// sever.js
server.route({
    path: '/some/path',
    method: 'GET',
    handler: (request, reply) => {
        return reply.response('trick or treat');
    }
})

If I make the route like this, there will be code completion when I type request or reply and show all of these properties, include the info. Because the intelliSense will recognize it as a member of server object(handler's parameters).

Now, I want to separate the main server and routes. Will be look like this:

// server.js
const routes = require('./routes');

server.routes(routes);
// routes.js
module.exports = [
    {
        path: '/some/path',
        method: 'GET',
        handler: (request, reply) => {
            return reply.response('trick or treat');
        }
    },
    ...
];

Now, when I type request or reply, there is no code completion like before. What I wanted is how to make intelliSense recognise the request and reply as a member of server object so that there will be code completion, parameter info, etc.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda