Delete vscode-typescript upon close of VS Code (#73801)

* Cleans up vs-typescript temp directoy upon VS code close

* Fixed typing errors preventing build from succeeding

* Moved deletion to the deactivate method. Added folders per extension host

* Removed yarn watch script used in testing
This commit is contained in:
Logan Ramos
2019-05-17 18:55:31 +00:00
committed by GitHub
parent a2be028360
commit ca9887459b
5 changed files with 74 additions and 8 deletions

View File

@@ -10,6 +10,8 @@ import { LanguageConfigurationManager } from './features/languageConfiguration';
import TypeScriptTaskProviderManager from './features/task';
import TypeScriptServiceClientHost from './typeScriptServiceClientHost';
import { flatten } from './utils/arrays';
import * as electron from './utils/electron';
import * as rimraf from 'rimraf';
import { CommandManager } from './utils/commandManager';
import * as fileSchemes from './utils/fileSchemes';
import { standardLanguageDescriptions } from './utils/languageDescription';
@@ -128,4 +130,8 @@ function isSupportedDocument(
return false;
}
return fileSchemes.isSupportedScheme(document.uri.scheme);
}
export function deactivate() {
rimraf.sync(electron.getInstanceDir());
}

View File

@@ -5,4 +5,3 @@
/// <reference path='../../../../src/vs/vscode.d.ts'/>
/// <reference path='../../../../src/vs/vscode.proposed.d.ts'/>
/// <reference types='@types/node'/>

View File

@@ -22,8 +22,21 @@ const getRootTempDir = (() => {
};
})();
export const getInstanceDir = (() => {
let dir: string | undefined;
return () => {
if (!dir) {
dir = path.join(getRootTempDir(), temp.makeRandomHexString(20));
}
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
return dir;
};
})();
export function getTempFile(prefix: string): string {
return path.join(getRootTempDir(), `${prefix}-${temp.makeRandomHexString(20)}.tmp`);
return path.join(getInstanceDir(), `${prefix}-${temp.makeRandomHexString(20)}.tmp`);
}
function generatePatchedEnv(env: any, modulePath: string): any {