I am working on a typescript project using Visual Studio Code. I have a workflow in which a gulp task will copy a code into a target folder. Copied file will be used by the respective files in the destination folder using imports.
eg. Folder structure
common
server/src
client/src/app
All the files in common will be copied into server/src/common and client/src/app/common
In the server/src/test.ts file, I will add reference to the copied files as follows.
import { CommonClass } from './common/commonClass'
Everything works perfectly fine. The problem occurs when I decide to go to the definition of the imported class 'CommonClass' by pressing F12.
This will open up the copied file and not the one in the source "common" folder. I would like to restrict this opened file to be in read-only mode, so that I do not make changes. The changes will be replaced by the gulp task in time.
Is there any way to achieve this using some extensions or workspace settings in Visual Studio Code?
Tried to use gulp-chmod to make the destination files are read-only, but ran into issue when the typescript compiler is trying to access them during build.
VSCode 1.79 introduces a feature to mark specific files and folders as read-only
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With