Reputation: 20130
All
is it possible to have file locked when opened by VSCode ?
any extensions?
so if I check file by handle64
from sysinternals, it will tell me something like
> handle64.exe -a c:\XXX.txt
code.exe pid: 123 type: File c:\XXX.txt
Windows solution would be fine, cross-platform would be the best
Upvotes: 1
Views: 1113
Reputation: 6874
The Windows-specific file API (CreateFile) has a number of access and sharing options, so yes, technically it would be possible. But that doesn't mean it would be desirable. There are a number of use-cases where it is quite desirable to allow another process to read, change or delete a file while it is "open" (really visible) in vscode.
I put "open" in quotes because to achieve the behavior it currently has, vscode probably closes the file as soon as it's done reading it, intentionally avoiding the sort of behavior you seem to be asking for. Since your question deals with a specific solution, rather than the problem motivating you, it's hard to provide more detail.
Upvotes: 2