Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

230
Vistas
cannot save new generated file vscode extension

I'm trying to make a vscode extension. One functionnality it will need is creating a new file that the user can modify and then save. I use the following code to do so :

export async function linkA() {

const newFile = Uri.parse('untitled:' + path.join(workspace.workspaceFolders![0].uri.path + "/templates", 'filename.txt'));

workspace.openTextDocument(newFile).then(async document => {

    const edit = new WorkspaceEdit();

    edit.insert(newFile, new Position(0, 0), "Hello world!");

    return workspace.applyEdit(edit).then(success => {
        if (success) {
            window.showTextDocument(document);
        } else {
            window.showInformationMessage('Error!');
        }
    }); });}

When the function linkA is called, this does open a new file "filename.txt" and I can edit it. But when I try to save it I get the following error message (as a vscode information window ) : Failed to save 'filename.txt': Unable to write file '\c:\Users\RAM\Desktop\vscode-extension-samples\helloworld-sample\templates\filename.txt' (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '\c:\Users\RAM\Desktop\vscode-extension-samples\helloworld-sample\templates\filename.txt').

Anybody knows how to fix this ?

Thanks

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda