Open specific files in the workspace as read-only in VS code

I am working on a typescript project using Visual Studio code. I have a workflow in which the gulp task copies the code to the target folder. The copied file will be used by the corresponding files in the destination folder using import.

eg. Folder structure

common

server / csi

client / src / application

All shared files will be copied to the server / src / common and client / src / app / common

In the server / src / test.ts file, I will add a link to the copied files as follows.

import { CommonClass } from './common/commonClass' 

Everything works perfectly. The problem occurs when I decide to go to the definition of the imported CommonClass by pressing F12.

This will open the copied file, not the one in the original β€œshared” folder. I would like to limit this open file to read-only so that I don't make any changes. Changes will be replaced by the gulp task in time.

Is there a way to achieve this using some extensions or workspace settings in Visual Studio Code?

Tried to use gulp -chmod so that the destination files are read-only, but run into a problem when the typescript compiler tries to access them during build.

+5
source share

All Articles