提交 6f4294e5 编写于 作者: M Mark Pearce

Fixed condition for if workspace exists

上级 2efa5b60
......@@ -140,7 +140,7 @@ export class TerminalLinkHandler {
//resolve relative paths
if (!link.match('^' + winDrivePrefix)) {
if (!this._contextService.hasWorkspace) {
if (!this._contextService.hasWorkspace()) {
// Abort if no workspace is open
return null;
}
......@@ -149,7 +149,7 @@ export class TerminalLinkHandler {
}
// Resolve workspace path . | .. | <relative_path> -> <path>/. | <path>/.. | <path>/<relative_path>
else if (link.charAt(0) !== '/' && link.charAt(0) !== '~') {
if (!this._contextService.hasWorkspace) {
if (!this._contextService.hasWorkspace()) {
// Abort if no workspace is open
return null;
}
......
......@@ -113,5 +113,13 @@ suite('Workbench - TerminalLinkHandler', () => {
assert.equal(linkHandler.preprocessPath('/absolute/path/file3'), '/absolute/path/file3');
stub.restore();
});
test('No Workspace', () => {
const linkHandler = new TestTerminalLinkHandler(null, new TestXterm(), Platform.Linux, null, new WorkspaceContextService(null));
assert.equal(linkHandler.preprocessPath('./src/file1'), null);
assert.equal(linkHandler.preprocessPath('src/file2'), null);
assert.equal(linkHandler.preprocessPath('/absolute/path/file3'), '/absolute/path/file3');
});
});
});
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册