microsoft/vscode-react-native

Public

mirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0.11.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/common/extensionMessaging.ts

18lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
4import {HostPlatform} from "./hostPlatform";
5import {Crypto} from "./node/crypto";
6
7export class MessagingHelper {
8 public static getPath(projectRootPath: string): string {
9 /* We need to use a different value for each VS Code window so the pipe names won't clash.
10 We create the pipe path hashing the user id + project root path so both client and server
11 will generate the same path, yet it's unique for each vs code instance */
12 const userID = HostPlatform.getUserID();
13 const normalizedRootPath = projectRootPath.toLowerCase();
14 const uniqueSeed = `${userID}:${normalizedRootPath}`;
15 const hash = new Crypto().hash(uniqueSeed);
16 return HostPlatform.getPipePath(`vscode-reactnative-${hash}`);
17 }
18}
19