mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode cfbd1999769f4f08dce29629fb92fdc0fac53829
This commit is contained in:
6
extensions/search-result/.vscodeignore
Normal file
6
extensions/search-result/.vscodeignore
Normal file
@@ -0,0 +1,6 @@
|
||||
src/**
|
||||
out/**
|
||||
tsconfig.json
|
||||
extension.webpack.config.js
|
||||
extension-browser.webpack.config.js
|
||||
yarn.lock
|
||||
22
extensions/search-result/extension-browser.webpack.config.js
Normal file
22
extensions/search-result/extension-browser.webpack.config.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//@ts-check
|
||||
|
||||
'use strict';
|
||||
|
||||
const withBrowserDefaults = require('../shared.webpack.config').browser;
|
||||
const path = require('path');
|
||||
|
||||
module.exports = withBrowserDefaults({
|
||||
context: __dirname,
|
||||
entry: {
|
||||
extension: './src/extension.ts'
|
||||
},
|
||||
output: {
|
||||
filename: 'extension.js',
|
||||
path: path.join(__dirname, 'dist')
|
||||
}
|
||||
});
|
||||
@@ -12,6 +12,7 @@
|
||||
"Programming Languages"
|
||||
],
|
||||
"main": "./out/extension.js",
|
||||
"browser": "./dist/extension.js",
|
||||
"activationEvents": [
|
||||
"*"
|
||||
],
|
||||
|
||||
@@ -126,6 +126,8 @@ function relativePathToUri(path: string, resultsUri: vscode.Uri): vscode.Uri | u
|
||||
return vscode.Uri.file(pathUtils.join(process.env.HOME!, path.slice(2)));
|
||||
}
|
||||
|
||||
const uriFromFolderWithPath = (folder: vscode.WorkspaceFolder, path: string): vscode.Uri =>
|
||||
folder.uri.with({ path: pathUtils.join(folder.uri.fsPath, path) });
|
||||
|
||||
if (vscode.workspace.workspaceFolders) {
|
||||
const multiRootFormattedPath = /^(.*) • (.*)$/.exec(path);
|
||||
@@ -133,17 +135,18 @@ function relativePathToUri(path: string, resultsUri: vscode.Uri): vscode.Uri | u
|
||||
const [, workspaceName, workspacePath] = multiRootFormattedPath;
|
||||
const folder = vscode.workspace.workspaceFolders.filter(wf => wf.name === workspaceName)[0];
|
||||
if (folder) {
|
||||
return vscode.Uri.file(pathUtils.join(folder.uri.fsPath, workspacePath));
|
||||
return uriFromFolderWithPath(folder, workspacePath);
|
||||
}
|
||||
}
|
||||
|
||||
else if (vscode.workspace.workspaceFolders.length === 1) {
|
||||
return vscode.Uri.file(pathUtils.join(vscode.workspace.workspaceFolders[0].uri.fsPath, path));
|
||||
return uriFromFolderWithPath(vscode.workspace.workspaceFolders[0], path);
|
||||
} else if (resultsUri.scheme !== 'untitled') {
|
||||
// We're in a multi-root workspace, but the path is not multi-root formatted
|
||||
// Possibly a saved search from a single root session. Try checking if the search result document's URI is in a current workspace folder.
|
||||
const prefixMatch = vscode.workspace.workspaceFolders.filter(wf => resultsUri.toString().startsWith(wf.uri.toString()))[0];
|
||||
if (prefixMatch) { return vscode.Uri.file(pathUtils.join(prefixMatch.uri.fsPath, path)); }
|
||||
if (prefixMatch) {
|
||||
return uriFromFolderWithPath(prefixMatch, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user