more safe extra lib filePath generation

This commit is contained in:
Olga Lesnikova 2019-01-28 17:23:53 +03:00
parent 505232c7c8
commit 6d8ff4c54f

View file

@ -42,7 +42,7 @@ export class LanguageServiceDefaultsImpl implements monaco.languages.typescript.
addExtraLib(content: string, filePath?: string): IDisposable {
if (typeof filePath === 'undefined') {
filePath = `ts:extralib-${Date.now()}`;
filePath = `ts:extralib-${Math.random().toString(36).substring(2, 15)}`;
}
if (this._extraLibs[filePath]) {