Change:
a JS file: to definition on Bug I see this scary notification: <img width="671" alt="Screen Shot 2022-07-26 at 2 31 10 PM" src="https://user-"In this case, the user was likely just trying to view the file Would it be possible to either: show this notification when saving? open these file as ?
This came in via from and I think is not good. This also reminds me that when debugging you may end up in a file from the installation dir. I think we should probably revert the change for now and think about a better solution unless there are objections.
I agree. Maybe pursue your earlier suggestion of opening all installation directory files in readonly mode. Perhaps combine with a scary warning if you save a new file in there.

Discussion:
import { registerWindowDriver } from 'vs/platform/driver/electron-sandbox/driver'; import { ILabelService } from 'vs/platform/label/common/label'; import { dirname } from 'vs/base/common/resources'; <del> import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'; </del> export class NativeWindow extends Disposable {

@IInstantiationService private readonly instantiationService: IInstantiationService, @ISharedProcessService private readonly sharedProcessService: ISharedProcessService, @IProgressService private readonly progressService: IProgressService, <del> @ILabelService private readonly labelService: ILabelService, @IUriIdentityService private readonly uriIdentityService: IUriIdentityService </del> <ins> @ILabelService private readonly labelService: ILabelService </ins> ) { super();

this._register(addDisposableListener(window, EventType.RESIZE, e => this.onWindowResize(e, true))); // React to editor input changes <del> const appRootUri = URI.file(this.environmentService.appRoot); this._register(this.editorService.onDidActiveEditorChange(() => { // Touchbar this.updateTouchbarMenu(); // Potential data loss when editing files // from within the installation app root if (this.environmentService.isBuilt) { this.notifyOnAppRootEditors(appRootUri); } })); </del> <ins> this._register(this.editorService.onDidActiveEditorChange(() => this.updateTouchbarMenu())); </ins> // prevent opening a real URL inside the window for (const event of [EventType.DRAG_OVER, EventType.DROP]) {

} } <del> private notifyOnAppRootEditors(appRootUri: URI): void { const resourceUri = EditorResourceAccessor.getOriginalUri(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.BOTH }); const isResourceAppRootedFn = (uri: URI): boolean => this.uriIdentityService.extUri.isEqualOrParent(uri, appRootUri); let isResourceAppRooted = false; if (URI.isUri(resourceUri)) { if (isResourceAppRootedFn(resourceUri)) { isResourceAppRooted = true; } } else if (resourceUri) { if (resourceUri.primary && isResourceAppRootedFn(resourceUri.primary)) { isResourceAppRooted = true; } else if (resourceUri.secondary && isResourceAppRootedFn(resourceUri.secondary)) { isResourceAppRooted = true; } } // It is dangerous to edit files in the installation directory of Code because // an update will remove all files and replace them with the new version. // As such, we notify the user whenever an editor opens that is located somewhere // in the installation directory. // https://github.com/microsoft/vscode/issues/138815 if (isResourceAppRooted) { this.notificationService.prompt( Severity.Warning, localize('notifyOnAppRootEditors', "Files within the installation folder of '{0}' ({1}) will be OVERWRITTEN or DELETED IRREVERSIBLY without warning during a future update.", this.productService.nameShort, this.environmentService.appRoot), [{ label: localize('understood', 'Understood'), run: async () => { // Nothing to do } }], { neverShowAgain: { id: 'window.notifyOnAppRootEditors', isSecondary: true }, sticky: true } ); } } </del> private onAddFoldersRequest(request: IAddFoldersRequest): void { // Buffer all pending requests