浏览代码

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

more safe extra lib filePath generation
Alexandru Dima 6 年之前
父节点
当前提交
e9381f692d
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/monaco.contribution.ts

+ 1 - 1
src/monaco.contribution.ts

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