Merge pull request #29 from Geloosa/extra-libs-filepath

more safe extra lib filePath generation
This commit is contained in:
Alexandru Dima 2019-03-04 14:18:27 +01:00 committed by GitHub
commit e9381f692d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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]) {