diff --git a/src/vs/workbench/api/node/extHostWorkspace.ts b/src/vs/workbench/api/node/extHostWorkspace.ts index 11e5fdeec1bfa8c3d08ae524b9f59dbff9ef70e1..c7e98adbe7ebebd0e6081c21c44a3bbbd0cde4ed 100644 --- a/src/vs/workbench/api/node/extHostWorkspace.ts +++ b/src/vs/workbench/api/node/extHostWorkspace.ts @@ -39,7 +39,7 @@ export class ExtHostWorkspace { } if (isEqualOrParent(path, this._workspacePath)) { - return relative(this._workspacePath, path); + return relative(this._workspacePath, path) || path; } return path; diff --git a/src/vs/workbench/test/node/api/extHostWorkspace.test.ts b/src/vs/workbench/test/node/api/extHostWorkspace.test.ts index d9aece2b3a42be9e8f46a6511ffc2eafe71c1e8f..1c146117c18a458090629dd7d6827eb38c9d5432 100644 --- a/src/vs/workbench/test/node/api/extHostWorkspace.test.ts +++ b/src/vs/workbench/test/node/api/extHostWorkspace.test.ts @@ -20,4 +20,16 @@ suite('ExtHostWorkspace', function () { 'm:/Apps/DartPubCache/hosted/pub.dartlang.org/convert-2.0.1/lib/src/hex.dart'); }); + + test('asRelativePath, same paths, #11402', function () { + const root = '/home/aeschli/workspaces/samples/docker'; + const input = '/home/aeschli/workspaces/samples/docker'; + const ws = new ExtHostWorkspace(new TestThreadService(), root); + + assert.equal(ws.getRelativePath(input), input); + + const input2 = '/home/aeschli/workspaces/samples/docker/a.file'; + assert.equal(ws.getRelativePath(input2), 'a.file'); + + }); });