From fa4f870501f161747fa032dec006b89476a42baf Mon Sep 17 00:00:00 2001 From: Lee Houghton Date: Sat, 15 Jun 2019 00:36:23 +0100 Subject: [PATCH] Handle multiple users with /tmp/vscode-typescript This fixes an issue where the typescript language server fails to load if multiple users launch VS Code on the same Linux machine. Steps to reproduce: - Log in as user1 - Launch VS Code - Log out - Log in as user2 - Launch VS Code - It tries to write to files in /tmp/vscode-typescript, but that directory is not writeable because it is owned by user1 - You cannot use TypeScript intellisense This fix namespaces the directory with the current uid so that each user will get their own. On Windows, this shouldn't be an issue anyway since each user gets their own temp directory. --- extensions/typescript-language-features/src/utils/electron.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/typescript-language-features/src/utils/electron.ts b/extensions/typescript-language-features/src/utils/electron.ts index 3a1ece8f726..1f542fe07cc 100644 --- a/extensions/typescript-language-features/src/utils/electron.ts +++ b/extensions/typescript-language-features/src/utils/electron.ts @@ -7,13 +7,14 @@ import * as temp from './temp'; import path = require('path'); import fs = require('fs'); import cp = require('child_process'); +import process = require('process'); const getRootTempDir = (() => { let dir: string | undefined; return () => { if (!dir) { - dir = temp.getTempFile(`vscode-typescript`); + dir = temp.getTempFile(`vscode-typescript${process.getuid ? process.getuid() : ''}`); } if (!fs.existsSync(dir)) { fs.mkdirSync(dir);