提交 fb48d397 编写于 作者: J Johannes Rieken

Revert "also use $mid as version id and only accept external and fsPath from...

Revert "also use $mid as version id and only accept external and fsPath from the most recent version, #60163"

This reverts commit 7d80b00c.
上级 d3975052
......@@ -40,7 +40,7 @@ export function revive(obj: any, depth: number): any {
if (typeof obj === 'object') {
switch ((<MarshalledObject>obj).$mid) {
case 100: return URI.revive(obj);
case 1: return URI.revive(obj);
case 2: return new RegExp(obj.source, obj.flags);
}
......
......@@ -361,10 +361,8 @@ export class URI implements UriComponents {
return data;
} else {
let result = new _URI(data);
if ((<UriState>data).$mid === 100) {
result._fsPath = (<UriState>data).fsPath;
result._formatted = (<UriState>data).external;
}
result._fsPath = (<UriState>data).fsPath;
result._formatted = (<UriState>data).external;
return result;
}
}
......@@ -379,7 +377,7 @@ export interface UriComponents {
}
interface UriState extends UriComponents {
$mid: 100;
$mid: number;
fsPath: string;
external: string;
}
......@@ -412,7 +410,7 @@ class _URI extends URI {
toJSON(): object {
const res = <UriState>{
$mid: 100
$mid: 1
};
// cached state
if (this._fsPath) {
......
......@@ -458,37 +458,4 @@ suite('URI', () => {
// }
// console.profileEnd();
});
test('Opening files from quick open not showing file contents #60163', function () {
const data = {
'$mid': 1,
'fsPath': 'c:\\Users\\bpasero\\Desktop\\Golda\'s Kitchen\\CHANGELOG.md',
'external': 'file:///c%3A/Users/bpasero/Desktop/Golda%27s%20Kitchen/CHANGELOG.md',
'path': '/c:/Users/bpasero/Desktop/Golda\'s Kitchen/CHANGELOG.md',
'scheme': 'file'
};
const uri = URI.revive(data);
assert.equal(uri.scheme, data.scheme);
assert.equal(uri.path, data.path);
assert.equal((uri as any)._formatted, null);
assert.equal((uri as any)._fsPath, null);
// when the $mid is the current one then we trust
// the data(no matter what)
const data2 = {
'$mid': 100,
'fsPath': 'c:\\Users\\bpasero\\Desktop\\Golda\'s Kitchen\\CHANGELOG.md',
'external': 'file:///c%3A/Users/bpasero/Desktop/Golda%27s%20Kitchen/CHANGELOG.md',
'path': '/c:/Users/bpasero/Desktop/Golda\'s Kitchen/CHANGELOG.md',
'scheme': 'file'
};
const uri2 = URI.revive(data2);
assert.equal(uri2.scheme, data2.scheme);
assert.equal(uri2.path, data2.path);
assert.ok((uri2 as any)._formatted);
assert.ok((uri2 as any)._fsPath);
});
});
......@@ -59,7 +59,7 @@ function _transformIncomingURIs(obj: any, transformer: IURITransformer, depth: n
if (typeof obj === 'object') {
if ((<MarshalledObject>obj).$mid === 100) {
if ((<MarshalledObject>obj).$mid === 1) {
return transformer.transformIncoming(obj);
}
......
......@@ -20,14 +20,14 @@ suite('ExtHostTypes', function () {
let uri = URI.parse('file:///path/test.file');
assert.deepEqual(uri.toJSON(), {
$mid: 100,
$mid: 1,
scheme: 'file',
path: '/path/test.file'
});
assert.ok(uri.fsPath);
assert.deepEqual(uri.toJSON(), {
$mid: 100,
$mid: 1,
scheme: 'file',
path: '/path/test.file',
fsPath: '/path/test.file'.replace(/\//g, isWindows ? '\\' : '/'),
......@@ -35,7 +35,7 @@ suite('ExtHostTypes', function () {
assert.ok(uri.toString());
assert.deepEqual(uri.toJSON(), {
$mid: 100,
$mid: 1,
scheme: 'file',
path: '/path/test.file',
fsPath: '/path/test.file'.replace(/\//g, isWindows ? '\\' : '/'),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册