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

182
Visualizações
Alternative of vscode.window.onDidWriteTerminalData

The vscode.window.onDidWriteTerminalData event cannot be used when publishing extensions for Visual Studio Code. Does anyone know of an alternative method to capture the text and changes from the built-in terminal to handle this information in a variable?

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

0

searching in some places, I checked a NodeJs library called child_process and imported it into my project, after that, I declared a Promise to check the result of the exec method of this library. It was possible to get the execution data and treat it using a regexp to match a text or URL in the terminal.

Example:

function runApp(command) {
  setApplicationProperties();
  outputChannel.show();
  let promise = new Promise(resolve => {
    vscode.window.showInformationMessage(`Running App '${application_name}'...`);   
    let result = child.exec(command, {cwd: getWorkspaceDir()});
    result.stdout.on("data", (data) => {
        outputFilter = data;
        infoCatcher = outputFilter.match(/\w.+/gi);
        if(infoCatcher != null) outputChannel.append(`${infoCatcher[0]}\n`);
        urlCatcher = outputFilter.match(/(http|https)?:\/\/.+/gi);
        if(urlCatcher != null) vscode.env.openExternal(vscode.Uri.parse(urlCatcher[0]));
        resolve(); 
    });
});
return promise;

}

Thanks for the help.

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