Fix ADS Web notebook cross linking (#16926)

* fix cross linking files

* use host location instead
This commit is contained in:
Vasu Bhog
2021-08-30 15:43:16 -07:00
committed by GitHub
parent 82f706cf80
commit 529e4fe0de

View File

@@ -10,6 +10,7 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
import { relative, resolve } from 'vs/base/common/path';
import { IFileService } from 'vs/platform/files/common/files';
import { isWeb } from 'vs/base/common/platform';
const knownSchemes = new Set(['http', 'https', 'file', 'mailto', 'data', 'azuredatastudio', 'azuredatastudio-insiders', 'vscode', 'vscode-insiders', 'vscode-resource', 'onenote']);
@Directive({
@@ -60,6 +61,16 @@ export class LinkHandlerDirective {
} catch {
// ignore
}
// Web mode linking to open files
if (isWeb) {
// only change scheme for file links (file links in web mode scheme are also http)
// therefore we will use the authority to understand if its a local file path
if (window.location.host === uri.authority) {
uri = uri.with({ scheme: 'vscode-remote' });
this.openerService.open(uri);
return;
}
}
if (uri && this.openerService && this.isSupportedLink(uri)) {
if (uri.fragment && uri.fragment.length > 0 && uri.fsPath === this.workbenchFilePath.fsPath) {
this.notebookService.navigateTo(this.notebookUri, uri.fragment);