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

116
Visualizações
Visual Studio Code Class Selection for multiple identical names

So I can across this today and it might already have been answered somewhere but I'm curious why this isn't picking up all classes with the same name. So I have two requires from two different classes of two different areas of testing that have the same name.

Const AreaOneLoginPage = require('../../pages/areaOne/login.page');
Const areaOneLoginIn = new AreaOneLoginPage();
Const AreaTwoLoginPage = require('../../pages/areaTwo/login.page');
Const areaTwoLoginIn = new AreaTwoLoginPage ();

However when I try to construct this in a different way using the smart logic in Visual Studio Code. This always defaults to AreaOne.

Const areaOneLogin = new LoginPage(); //<== This is the class name of the first area.
Const areaTwoLogin = new LoginPage(); //<== This is the class name of the second area.

The only option Visual Studio picks up is AreaOne and not show all the Classes that link into LoginPage??

Is this just a Visual Studio thing that can be fixed or is this a javascript thing?

Or is it best to refactor the class names to two different names completely. I just figured that VS Code would be able to determine that the class is nested below a seperate folder location?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can import the one module in one file many times, if they will be named unique. And then you can create new objects from these classes/modules.

To prevent this we have Singleton Pattern. it saves the instance of itself and if there was the init earlier, you will get the instance of exsisting object instead of creating new one.

Hope this was the answer to your question

about 4 years ago · Juan Pablo Isaza Relatório
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