dprint / dprint-vscode

Visual Studio Code extension for formatting code with dprint.
MIT License
59 stars 12 forks source link

don't lock the `dprint` executable when the LSP is running #88

Open DetachHead opened 5 months ago

DetachHead commented 5 months ago

when the dprint vscode extension is running, it locks the executable, which means the user can't update dprint while vscode is open:

npm error code EPERM
npm error syscall unlink
npm error path C:\Users\user\project\node_modules\dprint\dprint.exe
npm error errno -4048
npm error [Error: EPERM: operation not permitted, unlink 'C:\Users\user\project\node_modules\dprint\dprint.exe'] {
npm error   errno: -4048,
npm error   code: 'EPERM',
npm error   syscall: 'unlink',
npm error   path: 'C:\\Users\\user\\project\\node_modules\\dprint\\dprint.exe'
npm error }
npm error
npm error The operation was rejected by your operating system.
npm error It's possible that the file was already in use (by a text editor or antivirus),
npm error or that you lack permissions to access it.
npm error
npm error If you believe this might be a permissions issue, please double-check the
npm error permissions of the file and its containing directories, or try running
npm error the command again as root/Administrator.

a possible solution could be for the extension to create a temporary copy of the executable and launch that instead, which is what my extension does to work around the same issue