mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 18:48:00 +00:00
Merge branch 'main' into merogge/tabs2
This commit is contained in:
commit
b116dceb47
24
.github/workflows/no-yarn-lock-changes.yml
vendored
24
.github/workflows/no-yarn-lock-changes.yml
vendored
|
@ -6,9 +6,25 @@ jobs:
|
|||
name: Prevent yarn.lock changes in PRs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- id: file_changes
|
||||
uses: trilom/file-changes-action@ce38c8ce2459ca3c303415eec8cb0409857b4272
|
||||
- name: Check for yarn.lock changes
|
||||
- uses: octokit/request-action@v2.x
|
||||
id: get_permissions
|
||||
with:
|
||||
route: GET /repos/microsoft/vscode/collaborators/{username}/permission
|
||||
username: ${{ github.event.pull_request.user.login }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Set control output variable
|
||||
id: control
|
||||
run: |
|
||||
cat $HOME/files.json | jq -e '.[] | test("yarn\\.lock$") | not' \
|
||||
echo "user: ${{ github.event.pull_request.user.login }}"
|
||||
echo "role: ${{ fromJson(steps.get_permissions.outputs.data).permission }}"
|
||||
echo "should_run: ${{ !contains(fromJson('["admin", "write"]'), fromJson(steps.get_permissions.outputs.data).permission) }}"
|
||||
echo "::set-output name=should_run::${{ !contains(fromJson('["admin", "write"]'), fromJson(steps.get_permissions.outputs.data).permission) }}"
|
||||
- name: Get file changes
|
||||
uses: trilom/file-changes-action@ce38c8ce2459ca3c303415eec8cb0409857b4272
|
||||
if: ${{ steps.control.outputs.should_run == 'true' }}
|
||||
- name: Check for yarn.lock changes
|
||||
if: ${{ steps.control.outputs.should_run == 'true' }}
|
||||
run: |
|
||||
cat $HOME/files.json | jq -e 'any(test("yarn\\.lock$")) | not' \
|
||||
|| (echo "Changes to yarn.lock files aren't allowed in PRs." && exit 1)
|
||||
|
|
|
@ -115,9 +115,6 @@ steps:
|
|||
export SDKROOT=/Applications/Xcode_12.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk
|
||||
ls /Applications/Xcode_12.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
|
||||
yarn electron-rebuild
|
||||
# remove once https://github.com/prebuild/prebuild-install/pull/140 is merged and found in keytar
|
||||
cd ./node_modules/keytar
|
||||
node-gyp rebuild
|
||||
displayName: Rebuild native modules for ARM64
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
|
|
|
@ -59,13 +59,6 @@ steps:
|
|||
condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))
|
||||
displayName: Extract node_modules cache
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npm install -g node-gyp@latest
|
||||
node-gyp --version
|
||||
displayName: Update node-gyp
|
||||
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), eq(variables['VSCODE_ARCH'], 'x64'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npx https://aka.ms/enablesecurefeed standAlone
|
||||
|
@ -86,7 +79,6 @@ steps:
|
|||
if [ "$VSCODE_ARCH" == "x64" ]; then
|
||||
export VSCODE_REMOTE_CC=$(which gcc-4.8)
|
||||
export VSCODE_REMOTE_CXX=$(which g++-4.8)
|
||||
export VSCODE_REMOTE_NODE_GYP=$(which node-gyp)
|
||||
fi
|
||||
|
||||
for i in {1..3}; do # try 3 times, for Terrapin
|
||||
|
@ -97,10 +89,6 @@ steps:
|
|||
fi
|
||||
echo "Yarn failed $i, trying again..."
|
||||
done
|
||||
|
||||
# remove once https://github.com/prebuild/prebuild-install/pull/140 is merged and found in keytar
|
||||
cd ./node_modules/keytar
|
||||
npx node-gyp rebuild
|
||||
env:
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
|
|
|
@ -21,20 +21,20 @@ suite('XLF Parser Tests', () => {
|
|||
});
|
||||
test('XLF to keys & messages conversion', () => {
|
||||
i18n.XLF.parse(sampleTranslatedXlf).then(function (resolvedFiles) {
|
||||
assert.deepEqual(resolvedFiles[0].messages, translatedMessages);
|
||||
assert.deepStrictEqual(resolvedFiles[0].messages, translatedMessages);
|
||||
assert.strictEqual(resolvedFiles[0].originalFilePath, originalFilePath);
|
||||
});
|
||||
});
|
||||
test('JSON file source path to Transifex resource match', () => {
|
||||
const editorProject = 'vscode-editor', workbenchProject = 'vscode-workbench';
|
||||
const platform = { name: 'vs/platform', project: editorProject }, editorContrib = { name: 'vs/editor/contrib', project: editorProject }, editor = { name: 'vs/editor', project: editorProject }, base = { name: 'vs/base', project: editorProject }, code = { name: 'vs/code', project: workbenchProject }, workbenchParts = { name: 'vs/workbench/contrib/html', project: workbenchProject }, workbenchServices = { name: 'vs/workbench/services/textfile', project: workbenchProject }, workbench = { name: 'vs/workbench', project: workbenchProject };
|
||||
assert.deepEqual(i18n.getResource('vs/platform/actions/browser/menusExtensionPoint'), platform);
|
||||
assert.deepEqual(i18n.getResource('vs/editor/contrib/clipboard/browser/clipboard'), editorContrib);
|
||||
assert.deepEqual(i18n.getResource('vs/editor/common/modes/modesRegistry'), editor);
|
||||
assert.deepEqual(i18n.getResource('vs/base/common/errorMessage'), base);
|
||||
assert.deepEqual(i18n.getResource('vs/code/electron-main/window'), code);
|
||||
assert.deepEqual(i18n.getResource('vs/workbench/contrib/html/browser/webview'), workbenchParts);
|
||||
assert.deepEqual(i18n.getResource('vs/workbench/services/textfile/node/testFileService'), workbenchServices);
|
||||
assert.deepEqual(i18n.getResource('vs/workbench/browser/parts/panel/panelActions'), workbench);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/platform/actions/browser/menusExtensionPoint'), platform);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/editor/contrib/clipboard/browser/clipboard'), editorContrib);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/editor/common/modes/modesRegistry'), editor);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/base/common/errorMessage'), base);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/code/electron-main/window'), code);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/workbench/contrib/html/browser/webview'), workbenchParts);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/workbench/services/textfile/node/testFileService'), workbenchServices);
|
||||
assert.deepStrictEqual(i18n.getResource('vs/workbench/browser/parts/panel/panelActions'), workbench);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -311,7 +311,7 @@ function markNodes(ts, languageService, options) {
|
|||
setColor(node, 0 /* White */);
|
||||
// add to black queue
|
||||
enqueue_black(node);
|
||||
// // move from one queue to the other
|
||||
// move from one queue to the other
|
||||
// black_queue.push(node);
|
||||
// setColor(node, NodeColor.Black);
|
||||
return;
|
||||
|
|
|
@ -226,6 +226,7 @@
|
|||
},
|
||||
"output.selfClosingStyle": {
|
||||
"type": "string",
|
||||
"enum": ["html", "xhtml", "xml"],
|
||||
"default": "html",
|
||||
"markdownDescription": "%emmetPreferencesOutputSelfClosingStyle%"
|
||||
},
|
||||
|
|
|
@ -205,7 +205,7 @@ export async function wrapWithAbbreviation(args: any): Promise<boolean> {
|
|||
let inPreviewMode = false;
|
||||
async function makeChanges(inputAbbreviation: string | undefined, previewChanges: boolean): Promise<boolean> {
|
||||
const isAbbreviationValid = !!inputAbbreviation && !!inputAbbreviation.trim() && helper.isAbbreviationValid(syntax, inputAbbreviation);
|
||||
const extractedResults = isAbbreviationValid ? helper.extractAbbreviationFromText(inputAbbreviation!) : undefined;
|
||||
const extractedResults = isAbbreviationValid ? helper.extractAbbreviationFromText(inputAbbreviation!, syntax) : undefined;
|
||||
if (!extractedResults) {
|
||||
if (inPreviewMode) {
|
||||
inPreviewMode = false;
|
||||
|
@ -311,12 +311,12 @@ export function expandEmmetAbbreviation(args: any): Thenable<boolean | undefined
|
|||
let allAbbreviationsSame: boolean = true;
|
||||
const helper = getEmmetHelper();
|
||||
|
||||
const getAbbreviation = (document: vscode.TextDocument, selection: vscode.Selection, position: vscode.Position, syntax: string): [vscode.Range | null, string, string] => {
|
||||
const getAbbreviation = (document: vscode.TextDocument, selection: vscode.Selection, position: vscode.Position, syntax: string): [vscode.Range | null, string, string | undefined] => {
|
||||
position = document.validatePosition(position);
|
||||
let rangeToReplace: vscode.Range = selection;
|
||||
let abbr = document.getText(rangeToReplace);
|
||||
if (!rangeToReplace.isEmpty) {
|
||||
const extractedResults = helper.extractAbbreviationFromText(abbr);
|
||||
const extractedResults = helper.extractAbbreviationFromText(abbr, syntax);
|
||||
if (extractedResults) {
|
||||
return [rangeToReplace, extractedResults.abbreviation, extractedResults.filter];
|
||||
}
|
||||
|
|
|
@ -77,9 +77,9 @@ jsonc-parser@^2.3.0:
|
|||
integrity sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==
|
||||
|
||||
vscode-emmet-helper@^2.3.0:
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/vscode-emmet-helper/-/vscode-emmet-helper-2.5.0.tgz#17085b63c504102ee3f502eef9df140c1a089c1d"
|
||||
integrity sha512-YFNel768f3YOrxmssjt/LVsnPd/gxUWkla0RiHtB0pTgpEi47RAsAzojaSaqY0Xl2jr2tYTLj+65KiHqhdMa4w==
|
||||
version "2.6.2"
|
||||
resolved "https://registry.yarnpkg.com/vscode-emmet-helper/-/vscode-emmet-helper-2.6.2.tgz#777b471a7851ba0ca8e4151533be7f92511f39b0"
|
||||
integrity sha512-SkL1WjZZsA+bfTo52QH4PgqXCQAJSqzOmJtAY3rOl17MKbY6iJhVv2T26PshjmUnHoXnXMNa7PcLMCS75RsQDQ==
|
||||
dependencies:
|
||||
emmet "^2.3.0"
|
||||
jsonc-parser "^2.3.0"
|
||||
|
|
|
@ -127,7 +127,8 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache<HTMLDocume
|
|||
async doResolve(document: TextDocument, item: CompletionItem): Promise<CompletionItem> {
|
||||
const jsDocument = jsDocuments.get(document);
|
||||
const jsLanguageService = await host.getLanguageService(jsDocument);
|
||||
let details = jsLanguageService.getCompletionEntryDetails(jsDocument.uri, item.data.offset, item.label, undefined, undefined, undefined);
|
||||
// @ts-expect-error until 4.3 protocol update
|
||||
let details = jsLanguageService.getCompletionEntryDetails(jsDocument.uri, item.data.offset, item.label, undefined, undefined, undefined, undefined);
|
||||
if (details) {
|
||||
item.detail = ts.displayPartsToString(details.displayParts);
|
||||
item.documentation = ts.displayPartsToString(details.documentation);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
|
||||
"Once accepted there, we are happy to receive an update request."
|
||||
],
|
||||
"version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/10e222a5ac8f4f45b40bd03a76131d07562e5c3e",
|
||||
"version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/398fb82a29898fc7520ad67972a70a0a0bbb1205",
|
||||
"name": "JavaScript (with React support)",
|
||||
"scopeName": "source.js",
|
||||
"patterns": [
|
||||
|
@ -3362,7 +3362,7 @@
|
|||
"name": "keyword.operator.expression.typeof.js"
|
||||
}
|
||||
},
|
||||
"end": "(?=[,);}\\]=>]|$|;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))",
|
||||
"end": "(?=[,);}\\]=>:&|{]|$|;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#expression"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
|
||||
"Once accepted there, we are happy to receive an update request."
|
||||
],
|
||||
"version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/10e222a5ac8f4f45b40bd03a76131d07562e5c3e",
|
||||
"version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/398fb82a29898fc7520ad67972a70a0a0bbb1205",
|
||||
"name": "JavaScript (with React support)",
|
||||
"scopeName": "source.js.jsx",
|
||||
"patterns": [
|
||||
|
@ -3362,7 +3362,7 @@
|
|||
"name": "keyword.operator.expression.typeof.js.jsx"
|
||||
}
|
||||
},
|
||||
"end": "(?=[,);}\\]=>]|$|;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))",
|
||||
"end": "(?=[,);}\\]=>:&|{]|$|;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#expression"
|
||||
|
|
|
@ -136,7 +136,7 @@ export class JSONCompletionItemProvider implements CompletionItemProvider {
|
|||
}
|
||||
if (collectPromise) {
|
||||
return collectPromise.then(() => {
|
||||
if (items.length > 0) {
|
||||
if (items.length > 0 || isIncomplete) {
|
||||
return new CompletionList(items, isIncomplete);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -14,7 +14,6 @@ import { dirname } from 'path';
|
|||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const LIMIT = 40;
|
||||
const SCOPED_LIMIT = 250;
|
||||
|
||||
const USER_AGENT = 'Visual Studio Code';
|
||||
|
||||
|
@ -94,7 +93,7 @@ export class PackageJSONContribution implements IJSONContribution {
|
|||
collector.setAsIncomplete();
|
||||
}
|
||||
|
||||
queryUrl = `https://api.npms.io/v2/search/suggestions?size=${LIMIT}&q=${encodeURIComponent(currentWord)}`;
|
||||
queryUrl = `https://registry.npmjs.org/-/v1/search?size=${LIMIT}&text=${encodeURIComponent(currentWord)}`;
|
||||
return this.xhr({
|
||||
url: queryUrl,
|
||||
agent: USER_AGENT
|
||||
|
@ -102,18 +101,17 @@ export class PackageJSONContribution implements IJSONContribution {
|
|||
if (success.status === 200) {
|
||||
try {
|
||||
const obj = JSON.parse(success.responseText);
|
||||
if (obj && Array.isArray(obj)) {
|
||||
const results = <{ package: SearchPackageInfo; }[]>obj;
|
||||
if (obj && obj.objects && Array.isArray(obj.objects)) {
|
||||
const results = <{ package: SearchPackageInfo; }[]>obj.objects;
|
||||
for (const result of results) {
|
||||
this.processPackage(result.package, addValue, isLast, collector);
|
||||
}
|
||||
if (results.length === LIMIT) {
|
||||
collector.setAsIncomplete();
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
collector.setAsIncomplete();
|
||||
} else {
|
||||
collector.error(localize('json.npm.error.repoaccess', 'Request to the NPM repository failed: {0}', success.responseText));
|
||||
return 0;
|
||||
|
@ -155,7 +153,7 @@ export class PackageJSONContribution implements IJSONContribution {
|
|||
if (name.length < 4) {
|
||||
name = '';
|
||||
}
|
||||
let queryUrl = `https://api.npms.io/v2/search?q=scope:${scope}%20${name}&size=250`;
|
||||
let queryUrl = `https://registry.npmjs.com/-/v1/search?text=scope:${scope}%20${name}&size=250`;
|
||||
return this.xhr({
|
||||
url: queryUrl,
|
||||
agent: USER_AGENT
|
||||
|
@ -163,18 +161,16 @@ export class PackageJSONContribution implements IJSONContribution {
|
|||
if (success.status === 200) {
|
||||
try {
|
||||
const obj = JSON.parse(success.responseText);
|
||||
if (obj && Array.isArray(obj.results)) {
|
||||
const objects = <{ package: SearchPackageInfo }[]>obj.results;
|
||||
if (obj && Array.isArray(obj.objects)) {
|
||||
const objects = <{ package: SearchPackageInfo; }[]>obj.objects;
|
||||
for (let object of objects) {
|
||||
this.processPackage(object.package, addValue, isLast, collector);
|
||||
}
|
||||
if (objects.length === SCOPED_LIMIT) {
|
||||
collector.setAsIncomplete();
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
collector.setAsIncomplete();
|
||||
} else {
|
||||
collector.error(localize('json.npm.error.repoaccess', 'Request to the NPM repository failed: {0}', success.responseText));
|
||||
}
|
||||
|
@ -305,21 +301,18 @@ export class PackageJSONContribution implements IJSONContribution {
|
|||
}
|
||||
|
||||
private async npmjsView(pack: string): Promise<ViewPackageInfo | undefined> {
|
||||
const queryUrl = 'https://api.npms.io/v2/package/' + encodeURIComponent(pack);
|
||||
const queryUrl = 'https://registry.npmjs.org/' + encodeURIComponent(pack);
|
||||
try {
|
||||
const success = await this.xhr({
|
||||
url: queryUrl,
|
||||
agent: USER_AGENT
|
||||
});
|
||||
const obj = JSON.parse(success.responseText);
|
||||
const metadata = obj?.collected?.metadata;
|
||||
if (metadata) {
|
||||
return {
|
||||
description: metadata.description || '',
|
||||
version: metadata.version,
|
||||
homepage: metadata.links?.homepage || ''
|
||||
};
|
||||
}
|
||||
return {
|
||||
description: obj.description || '',
|
||||
version: Object.keys(obj.versions).pop(),
|
||||
homepage: obj.homepage || ''
|
||||
};
|
||||
}
|
||||
catch (e) {
|
||||
//ignore
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"git": {
|
||||
"name": "textmate/perl.tmbundle",
|
||||
"repositoryUrl": "https://github.com/textmate/perl.tmbundle",
|
||||
"commitHash": "80826abe75250286c2a1a07958e50e8551d3f50c"
|
||||
"commitHash": "a85927a902d6e5d7805f56a653f324d34dfad53a"
|
||||
}
|
||||
},
|
||||
"licenseDetail": [
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -90,7 +90,6 @@ export class SimpleBrowserView extends Disposable {
|
|||
const mainJs = this.extensionResourceUrl('media', 'index.js');
|
||||
const mainCss = this.extensionResourceUrl('media', 'main.css');
|
||||
const codiconsUri = this.extensionResourceUrl('media', 'codicon.css');
|
||||
const codiconsFontUri = this.extensionResourceUrl('media', 'codicon.ttf');
|
||||
|
||||
return /* html */ `<!DOCTYPE html>
|
||||
<html>
|
||||
|
@ -99,7 +98,7 @@ export class SimpleBrowserView extends Disposable {
|
|||
|
||||
<meta http-equiv="Content-Security-Policy" content="
|
||||
default-src 'none';
|
||||
font-src ${codiconsFontUri};
|
||||
font-src ${this._webviewPanel.webview.cspSource};
|
||||
style-src ${this._webviewPanel.webview.cspSource};
|
||||
script-src 'nonce-${nonce}';
|
||||
frame-src *;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"git": {
|
||||
"name": "TypeScript-TmLanguage",
|
||||
"repositoryUrl": "https://github.com/microsoft/TypeScript-TmLanguage",
|
||||
"commitHash": "10e222a5ac8f4f45b40bd03a76131d07562e5c3e"
|
||||
"commitHash": "398fb82a29898fc7520ad67972a70a0a0bbb1205"
|
||||
}
|
||||
},
|
||||
"license": "MIT",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
|
||||
"Once accepted there, we are happy to receive an update request."
|
||||
],
|
||||
"version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/10e222a5ac8f4f45b40bd03a76131d07562e5c3e",
|
||||
"version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/398fb82a29898fc7520ad67972a70a0a0bbb1205",
|
||||
"name": "TypeScript",
|
||||
"scopeName": "source.ts",
|
||||
"patterns": [
|
||||
|
@ -3411,7 +3411,7 @@
|
|||
"name": "keyword.operator.expression.typeof.ts"
|
||||
}
|
||||
},
|
||||
"end": "(?=[,);}\\]=>]|$|;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))",
|
||||
"end": "(?=[,);}\\]=>:&|{]|$|;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#expression"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
|
||||
"Once accepted there, we are happy to receive an update request."
|
||||
],
|
||||
"version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/10e222a5ac8f4f45b40bd03a76131d07562e5c3e",
|
||||
"version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/398fb82a29898fc7520ad67972a70a0a0bbb1205",
|
||||
"name": "TypeScriptReact",
|
||||
"scopeName": "source.tsx",
|
||||
"patterns": [
|
||||
|
@ -3362,7 +3362,7 @@
|
|||
"name": "keyword.operator.expression.typeof.tsx"
|
||||
}
|
||||
},
|
||||
"end": "(?=[,);}\\]=>]|$|;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))",
|
||||
"end": "(?=[,);}\\]=>:&|{]|$|;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#expression"
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
|
||||
"enableProposedApi": true,
|
||||
"workspaceTrust": {
|
||||
"required": "onDemand"
|
||||
"request": "onDemand",
|
||||
"description": "The extension requires workspace trust when the workspace version is used because it executes code specified by the workspace."
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.30.0"
|
||||
|
|
|
@ -83,7 +83,7 @@ suite('Notebook Document', function () {
|
|||
assert.strictEqual(notebook.uri.toString(), uri.toString());
|
||||
assert.strictEqual(notebook.isDirty, false);
|
||||
assert.strictEqual(notebook.isUntitled, false);
|
||||
assert.strictEqual(notebook.cells.length, 1);
|
||||
assert.strictEqual(notebook.cellCount, 1);
|
||||
|
||||
assert.strictEqual(notebook.viewType, 'notebook.nbdtest');
|
||||
});
|
||||
|
@ -96,7 +96,7 @@ suite('Notebook Document', function () {
|
|||
return;
|
||||
}
|
||||
const notebook = vscode.notebook.notebookDocuments.find(notebook => {
|
||||
const cell = notebook.cells.find(cell => cell.document === doc);
|
||||
const cell = notebook.getCells().find(cell => cell.document === doc);
|
||||
return Boolean(cell);
|
||||
});
|
||||
assert.ok(notebook, `notebook for cell ${doc.uri} NOT found`);
|
||||
|
@ -112,7 +112,9 @@ suite('Notebook Document', function () {
|
|||
const uri = await utils.createRandomFile(undefined, undefined, '.nbdtest');
|
||||
|
||||
const p = utils.asPromise(vscode.notebook.onDidOpenNotebookDocument).then(notebook => {
|
||||
for (let cell of notebook.cells) {
|
||||
for (let i = 0; i < notebook.cellCount; i++) {
|
||||
let cell = notebook.cellAt(i);
|
||||
|
||||
const doc = vscode.workspace.textDocuments.find(doc => doc.uri.toString() === cell.document.uri.toString());
|
||||
assert.ok(doc);
|
||||
assert.strictEqual(doc.notebook === notebook, true);
|
||||
|
@ -132,7 +134,7 @@ suite('Notebook Document', function () {
|
|||
const uri = await utils.createRandomFile(undefined, undefined, '.nbdtest');
|
||||
|
||||
const document = await vscode.notebook.openNotebookDocument(uri);
|
||||
assert.strictEqual(document.cells.length, 1);
|
||||
assert.strictEqual(document.cellCount, 1);
|
||||
|
||||
// inserting two new cells
|
||||
{
|
||||
|
@ -155,9 +157,9 @@ suite('Notebook Document', function () {
|
|||
assert.strictEqual(success, true);
|
||||
}
|
||||
|
||||
assert.strictEqual(document.cells.length, 3);
|
||||
assert.strictEqual(document.cells[0].document.getText(), 'new_markdown');
|
||||
assert.strictEqual(document.cells[1].document.getText(), 'new_code');
|
||||
assert.strictEqual(document.cellCount, 3);
|
||||
assert.strictEqual(document.cellAt(0).document.getText(), 'new_markdown');
|
||||
assert.strictEqual(document.cellAt(1).document.getText(), 'new_code');
|
||||
|
||||
// deleting cell 1 and 3
|
||||
{
|
||||
|
@ -168,8 +170,8 @@ suite('Notebook Document', function () {
|
|||
assert.strictEqual(success, true);
|
||||
}
|
||||
|
||||
assert.strictEqual(document.cells.length, 1);
|
||||
assert.strictEqual(document.cells[0].document.getText(), 'new_code');
|
||||
assert.strictEqual(document.cellCount, 1);
|
||||
assert.strictEqual(document.cellAt(0).document.getText(), 'new_code');
|
||||
|
||||
// replacing all cells
|
||||
{
|
||||
|
@ -190,24 +192,24 @@ suite('Notebook Document', function () {
|
|||
const success = await vscode.workspace.applyEdit(edit);
|
||||
assert.strictEqual(success, true);
|
||||
}
|
||||
assert.strictEqual(document.cells.length, 2);
|
||||
assert.strictEqual(document.cells[0].document.getText(), 'new2_markdown');
|
||||
assert.strictEqual(document.cells[1].document.getText(), 'new2_code');
|
||||
assert.strictEqual(document.cellCount, 2);
|
||||
assert.strictEqual(document.cellAt(0).document.getText(), 'new2_markdown');
|
||||
assert.strictEqual(document.cellAt(1).document.getText(), 'new2_code');
|
||||
|
||||
// remove all cells
|
||||
{
|
||||
const edit = new vscode.WorkspaceEdit();
|
||||
edit.replaceNotebookCells(document.uri, 0, document.cells.length, []);
|
||||
edit.replaceNotebookCells(document.uri, 0, document.cellCount, []);
|
||||
const success = await vscode.workspace.applyEdit(edit);
|
||||
assert.strictEqual(success, true);
|
||||
}
|
||||
assert.strictEqual(document.cells.length, 0);
|
||||
assert.strictEqual(document.cellCount, 0);
|
||||
});
|
||||
|
||||
test('workspace edit API (replaceCells, event)', async function () {
|
||||
const uri = await utils.createRandomFile(undefined, undefined, '.nbdtest');
|
||||
const document = await vscode.notebook.openNotebookDocument(uri);
|
||||
assert.strictEqual(document.cells.length, 1);
|
||||
assert.strictEqual(document.cellCount, 1);
|
||||
|
||||
const edit = new vscode.WorkspaceEdit();
|
||||
edit.replaceNotebookCells(document.uri, 0, 0, [{
|
||||
|
@ -232,9 +234,9 @@ suite('Notebook Document', function () {
|
|||
const data = await event;
|
||||
|
||||
// check document
|
||||
assert.strictEqual(document.cells.length, 3);
|
||||
assert.strictEqual(document.cells[0].document.getText(), 'new_markdown');
|
||||
assert.strictEqual(document.cells[1].document.getText(), 'new_code');
|
||||
assert.strictEqual(document.cellCount, 3);
|
||||
assert.strictEqual(document.cellAt(0).document.getText(), 'new_markdown');
|
||||
assert.strictEqual(document.cellAt(1).document.getText(), 'new_code');
|
||||
|
||||
// check event data
|
||||
assert.strictEqual(data.document === document, true);
|
||||
|
@ -242,8 +244,8 @@ suite('Notebook Document', function () {
|
|||
assert.strictEqual(data.changes[0].deletedCount, 0);
|
||||
assert.strictEqual(data.changes[0].deletedItems.length, 0);
|
||||
assert.strictEqual(data.changes[0].items.length, 2);
|
||||
assert.strictEqual(data.changes[0].items[0], document.cells[0]);
|
||||
assert.strictEqual(data.changes[0].items[1], document.cells[1]);
|
||||
assert.strictEqual(data.changes[0].items[0], document.cellAt(0));
|
||||
assert.strictEqual(data.changes[0].items[1], document.cellAt(1));
|
||||
});
|
||||
|
||||
test('workspace edit API (appendNotebookCellOutput, replaceCellOutput, event)', async function () {
|
||||
|
@ -258,9 +260,9 @@ suite('Notebook Document', function () {
|
|||
const data = await outputChangeEvent;
|
||||
|
||||
assert.strictEqual(success, true);
|
||||
assert.strictEqual(document.cells.length, 1);
|
||||
assert.strictEqual(document.cells[0].outputs.length, 1);
|
||||
assert.deepStrictEqual(document.cells[0].outputs, [firstCellOutput]);
|
||||
assert.strictEqual(document.cellCount, 1);
|
||||
assert.strictEqual(document.cellAt(0).outputs.length, 1);
|
||||
assert.deepStrictEqual(document.cellAt(0).outputs, [firstCellOutput]);
|
||||
|
||||
assert.strictEqual(data.document === document, true);
|
||||
assert.strictEqual(data.cells.length, 1);
|
||||
|
@ -277,9 +279,9 @@ suite('Notebook Document', function () {
|
|||
const data = await outputChangeEvent;
|
||||
|
||||
assert.strictEqual(success, true);
|
||||
assert.strictEqual(document.cells.length, 1);
|
||||
assert.strictEqual(document.cells[0].outputs.length, 2);
|
||||
assert.deepStrictEqual(document.cells[0].outputs, [firstCellOutput, secondCellOutput]);
|
||||
assert.strictEqual(document.cellCount, 1);
|
||||
assert.strictEqual(document.cellAt(0).outputs.length, 2);
|
||||
assert.deepStrictEqual(document.cellAt(0).outputs, [firstCellOutput, secondCellOutput]);
|
||||
|
||||
assert.strictEqual(data.document === document, true);
|
||||
assert.strictEqual(data.cells.length, 1);
|
||||
|
@ -296,9 +298,9 @@ suite('Notebook Document', function () {
|
|||
const data = await outputChangeEvent;
|
||||
|
||||
assert.strictEqual(success, true);
|
||||
assert.strictEqual(document.cells.length, 1);
|
||||
assert.strictEqual(document.cells[0].outputs.length, 1);
|
||||
assert.deepStrictEqual(document.cells[0].outputs, [thirdOutput]);
|
||||
assert.strictEqual(document.cellCount, 1);
|
||||
assert.strictEqual(document.cellAt(0).outputs.length, 1);
|
||||
assert.deepStrictEqual(document.cellAt(0).outputs, [thirdOutput]);
|
||||
|
||||
assert.strictEqual(data.document === document, true);
|
||||
assert.strictEqual(data.cells.length, 1);
|
||||
|
@ -314,7 +316,7 @@ suite('Notebook Document', function () {
|
|||
assert.strictEqual(notebook.uri.toString(), uri.toString());
|
||||
assert.strictEqual(notebook.isDirty, false);
|
||||
assert.strictEqual(notebook.isUntitled, false);
|
||||
assert.strictEqual(notebook.cells.length, 1);
|
||||
assert.strictEqual(notebook.cellCount, 1);
|
||||
assert.strictEqual(notebook.viewType, 'notebook.nbdtest');
|
||||
|
||||
const edit = new vscode.WorkspaceEdit();
|
||||
|
@ -345,7 +347,7 @@ suite('Notebook Document', function () {
|
|||
|
||||
const uri = await utils.createRandomFile(undefined, undefined, '.nbdtest');
|
||||
const notebook = await vscode.notebook.openNotebookDocument(uri);
|
||||
const first = notebook.cells[0];
|
||||
const first = notebook.cellAt(0);
|
||||
assert.strictEqual(first.document.languageId, 'javascript');
|
||||
|
||||
const pclose = utils.asPromise(vscode.workspace.onDidCloseTextDocument);
|
||||
|
@ -378,10 +380,10 @@ suite('Notebook Document', function () {
|
|||
let success = await vscode.workspace.applyEdit(edit);
|
||||
|
||||
assert.ok(success);
|
||||
assert.strictEqual(document.cells[0].outputs.length, 1);
|
||||
assert.strictEqual(document.cells[0].outputs[0].outputs.length, 1);
|
||||
assert.deepStrictEqual(document.cells[0].outputs[0].metadata, { outputType: 'stream', streamName: 'stdout' });
|
||||
assert.deepStrictEqual(document.cells[0].outputs[0].outputs[0].metadata, { outputType: 'stream', streamName: 'stdout' });
|
||||
assert.strictEqual(document.cellAt(0).outputs.length, 1);
|
||||
assert.strictEqual(document.cellAt(0).outputs[0].outputs.length, 1);
|
||||
assert.deepStrictEqual(document.cellAt(0).outputs[0].metadata, { outputType: 'stream', streamName: 'stdout' });
|
||||
assert.deepStrictEqual(document.cellAt(0).outputs[0].outputs[0].metadata, { outputType: 'stream', streamName: 'stdout' });
|
||||
|
||||
const edit2 = new vscode.WorkspaceEdit();
|
||||
edit2.appendNotebookCellOutput(document.uri, 0, [
|
||||
|
@ -393,13 +395,13 @@ suite('Notebook Document', function () {
|
|||
success = await vscode.workspace.applyEdit(edit2);
|
||||
assert.ok(success);
|
||||
|
||||
assert.strictEqual(document.cells[0].outputs.length, 2);
|
||||
assert.strictEqual(document.cells[0].outputs[0].outputs.length, 1);
|
||||
assert.strictEqual(document.cells[0].outputs[1].outputs.length, 1);
|
||||
assert.deepStrictEqual(document.cells[0].outputs[0].metadata, { outputType: 'stream', streamName: 'stdout' });
|
||||
assert.deepStrictEqual(document.cells[0].outputs[0].outputs[0].metadata, { outputType: 'stream', streamName: 'stdout' });
|
||||
assert.deepStrictEqual(document.cells[0].outputs[1].metadata, { outputType: 'stream', streamName: 'stderr' });
|
||||
assert.deepStrictEqual(document.cells[0].outputs[1].outputs[0].metadata, { outputType: 'stream', streamName: 'stderr' });
|
||||
assert.strictEqual(document.cellAt(0).outputs.length, 2);
|
||||
assert.strictEqual(document.cellAt(0).outputs[0].outputs.length, 1);
|
||||
assert.strictEqual(document.cellAt(0).outputs[1].outputs.length, 1);
|
||||
assert.deepStrictEqual(document.cellAt(0).outputs[0].metadata, { outputType: 'stream', streamName: 'stdout' });
|
||||
assert.deepStrictEqual(document.cellAt(0).outputs[0].outputs[0].metadata, { outputType: 'stream', streamName: 'stdout' });
|
||||
assert.deepStrictEqual(document.cellAt(0).outputs[1].metadata, { outputType: 'stream', streamName: 'stderr' });
|
||||
assert.deepStrictEqual(document.cellAt(0).outputs[1].outputs[0].metadata, { outputType: 'stream', streamName: 'stderr' });
|
||||
});
|
||||
|
||||
test('dirty state - complex', async function () {
|
||||
|
|
|
@ -341,7 +341,7 @@ suite('Notebook API tests', function () {
|
|||
deletedCount: 0,
|
||||
deletedItems: [],
|
||||
items: [
|
||||
vscode.window.activeNotebookEditor!.document.cells[1]
|
||||
vscode.window.activeNotebookEditor!.document.cellAt(1)
|
||||
]
|
||||
});
|
||||
|
||||
|
@ -354,7 +354,7 @@ suite('Notebook API tests', function () {
|
|||
const cellOutputsAddedRet = await cellOutputChange;
|
||||
assert.deepStrictEqual(cellOutputsAddedRet, {
|
||||
document: vscode.window.activeNotebookEditor!.document,
|
||||
cells: [vscode.window.activeNotebookEditor!.document.cells[0]]
|
||||
cells: [vscode.window.activeNotebookEditor!.document.cellAt(0)]
|
||||
});
|
||||
assert.strictEqual(cellOutputsAddedRet.cells[0].outputs.length, 1);
|
||||
|
||||
|
@ -363,7 +363,7 @@ suite('Notebook API tests', function () {
|
|||
const cellOutputsCleardRet = await cellOutputClear;
|
||||
assert.deepStrictEqual(cellOutputsCleardRet, {
|
||||
document: vscode.window.activeNotebookEditor!.document,
|
||||
cells: [vscode.window.activeNotebookEditor!.document.cells[0]]
|
||||
cells: [vscode.window.activeNotebookEditor!.document.cellAt(0)]
|
||||
});
|
||||
assert.strictEqual(cellOutputsAddedRet.cells[0].outputs.length, 0);
|
||||
|
||||
|
@ -372,7 +372,7 @@ suite('Notebook API tests', function () {
|
|||
// const cellChangeLanguageRet = await cellChangeLanguage;
|
||||
// assert.deepStrictEqual(cellChangeLanguageRet, {
|
||||
// document: vscode.window.activeNotebookEditor!.document,
|
||||
// cells: vscode.window.activeNotebookEditor!.document.cells[0],
|
||||
// cells: vscode.window.activeNotebookEditor!.document.cellAt(0),
|
||||
// language: 'markdown'
|
||||
// });
|
||||
|
||||
|
@ -387,7 +387,7 @@ suite('Notebook API tests', function () {
|
|||
await vscode.commands.executeCommand('notebook.focusTop');
|
||||
|
||||
const activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 0);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 0);
|
||||
const moveChange = asPromise(vscode.notebook.onDidChangeNotebookCells);
|
||||
await vscode.commands.executeCommand('notebook.cell.moveDown');
|
||||
await moveChange;
|
||||
|
@ -396,7 +396,7 @@ suite('Notebook API tests', function () {
|
|||
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
const firstEditor = vscode.window.activeNotebookEditor;
|
||||
assert.strictEqual(firstEditor?.document.cells.length, 2);
|
||||
assert.strictEqual(firstEditor?.document.cellCount, 2);
|
||||
await saveAllFilesAndCloseAll(undefined);
|
||||
});
|
||||
|
||||
|
@ -454,8 +454,8 @@ suite('Notebook API tests', function () {
|
|||
});
|
||||
|
||||
const document = vscode.window.activeNotebookEditor?.document!;
|
||||
assert.strictEqual(document.cells.length, 2);
|
||||
assert.strictEqual(document.cells[0].metadata.inputCollapsed, true);
|
||||
assert.strictEqual(document.cellCount, 2);
|
||||
assert.strictEqual(document.cellAt(0).metadata.inputCollapsed, true);
|
||||
|
||||
assert.strictEqual(document.isDirty, true);
|
||||
await saveFileAndCloseAll(resource);
|
||||
|
@ -511,14 +511,14 @@ suite('Notebook API tests', function () {
|
|||
|
||||
await cellsChangeEvent;
|
||||
await cellMetadataChangeEvent;
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.length, 3);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells[0]?.metadata?.breakpointMargin, false);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 3);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(0)?.metadata?.breakpointMargin, false);
|
||||
assert.strictEqual(version + 1, vscode.window.activeNotebookEditor!.document.version);
|
||||
|
||||
await vscode.commands.executeCommand('undo');
|
||||
assert.strictEqual(version + 2, vscode.window.activeNotebookEditor!.document.version);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells[0]?.metadata?.breakpointMargin, undefined);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.length, 2);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(0)?.metadata?.breakpointMargin, undefined);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 2);
|
||||
|
||||
await saveAllFilesAndCloseAll(resource);
|
||||
});
|
||||
|
@ -549,7 +549,7 @@ suite('Notebook API tests', function () {
|
|||
assert.strictEqual(vscode.window.activeNotebookEditor!.selection?.document.getText(), 'test');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.selection?.document.languageId, 'typescript');
|
||||
|
||||
const secondCell = vscode.window.activeNotebookEditor!.document.cells[1];
|
||||
const secondCell = vscode.window.activeNotebookEditor!.document.cellAt(1);
|
||||
assert.strictEqual(secondCell!.outputs.length, 1);
|
||||
assert.deepStrictEqual(secondCell!.outputs[0].metadata, { testOutputMetadata: true });
|
||||
assert.strictEqual(secondCell!.outputs[0].outputs.length, 1);
|
||||
|
@ -566,8 +566,8 @@ suite('Notebook API tests', function () {
|
|||
const activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
assert.notEqual(vscode.window.activeNotebookEditor!.selection, undefined);
|
||||
assert.strictEqual(activeCell!.document.getText(), '');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.length, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 1);
|
||||
|
||||
await vscode.commands.executeCommand('workbench.action.files.save');
|
||||
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
|
||||
|
@ -589,56 +589,56 @@ suite('Notebook API tests', function () {
|
|||
let activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
assert.notEqual(vscode.window.activeNotebookEditor!.selection, undefined);
|
||||
assert.strictEqual(activeCell!.document.getText(), '');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.length, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 1);
|
||||
|
||||
// ---- focus bottom ---- //
|
||||
await vscode.commands.executeCommand('notebook.focusBottom');
|
||||
activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 3);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 3);
|
||||
|
||||
// ---- focus top and then copy down ---- //
|
||||
await vscode.commands.executeCommand('notebook.focusTop');
|
||||
activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 0);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 0);
|
||||
|
||||
await vscode.commands.executeCommand('notebook.cell.copyDown');
|
||||
activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 1);
|
||||
assert.strictEqual(activeCell?.document.getText(), 'test');
|
||||
|
||||
await vscode.commands.executeCommand('notebook.cell.delete');
|
||||
activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 1);
|
||||
assert.strictEqual(activeCell?.document.getText(), '');
|
||||
|
||||
// ---- focus top and then copy up ---- //
|
||||
await vscode.commands.executeCommand('notebook.focusTop');
|
||||
await vscode.commands.executeCommand('notebook.cell.copyUp');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.length, 5);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells[0].document.getText(), 'test');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells[1].document.getText(), 'test');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells[2].document.getText(), '');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells[3].document.getText(), '');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 5);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(0).document.getText(), 'test');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(1).document.getText(), 'test');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(2).document.getText(), '');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(3).document.getText(), '');
|
||||
activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 0);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 0);
|
||||
|
||||
|
||||
// ---- move up and down ---- //
|
||||
|
||||
await vscode.commands.executeCommand('notebook.cell.moveDown');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(vscode.window.activeNotebookEditor!.selection!), 1,
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(vscode.window.activeNotebookEditor!.selection!), 1,
|
||||
`first move down, active cell ${vscode.window.activeNotebookEditor!.selection!.document.uri.toString()}, ${vscode.window.activeNotebookEditor!.selection!.document.getText()}`);
|
||||
|
||||
// await vscode.commands.executeCommand('notebook.cell.moveDown');
|
||||
// activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 2,
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 2,
|
||||
// `second move down, active cell ${vscode.window.activeNotebookEditor!.selection!.uri.toString()}, ${vscode.window.activeNotebookEditor!.selection!.document.getText()}`);
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells[0].document.getText(), 'test');
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells[1].document.getText(), '');
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells[2].document.getText(), 'test');
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells[3].document.getText(), '');
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(0).document.getText(), 'test');
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(1).document.getText(), '');
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(2).document.getText(), 'test');
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(3).document.getText(), '');
|
||||
|
||||
// ---- ---- //
|
||||
|
||||
|
@ -677,7 +677,7 @@ suite('Notebook API tests', function () {
|
|||
await vscode.commands.executeCommand('notebook.focusTop');
|
||||
|
||||
const activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 0);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 0);
|
||||
await vscode.commands.executeCommand('notebook.cell.moveDown');
|
||||
await vscode.commands.executeCommand('notebook.cell.moveDown');
|
||||
|
||||
|
@ -693,7 +693,7 @@ suite('Notebook API tests', function () {
|
|||
assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true, 'notebook first');
|
||||
const editor = vscode.window.activeNotebookEditor!;
|
||||
|
||||
const cell = editor.document.cells[0];
|
||||
const cell = editor.document.cellAt(0);
|
||||
assert.strictEqual(cell.outputs.length, 0);
|
||||
|
||||
currentKernelProvider.setHasKernels(false);
|
||||
|
@ -718,7 +718,7 @@ suite('Notebook API tests', function () {
|
|||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true, 'notebook first');
|
||||
const editor = vscode.window.activeNotebookEditor!;
|
||||
const cell = editor.document.cells[0];
|
||||
const cell = editor.document.cellAt(0);
|
||||
|
||||
await vscode.commands.executeCommand('notebook.execute');
|
||||
assert.strictEqual(cell.outputs.length, 0, 'should not execute'); // not runnable, didn't work
|
||||
|
@ -731,7 +731,7 @@ suite('Notebook API tests', function () {
|
|||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true, 'notebook first');
|
||||
const editor = vscode.window.activeNotebookEditor!;
|
||||
const cell = editor.document.cells[0];
|
||||
const cell = editor.document.cellAt(0);
|
||||
|
||||
await withEvent(vscode.notebook.onDidChangeCellOutputs, async (event) => {
|
||||
await vscode.commands.executeCommand('notebook.execute');
|
||||
|
@ -763,7 +763,7 @@ suite('Notebook API tests', function () {
|
|||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true, 'notebook first');
|
||||
const editor = vscode.window.activeNotebookEditor!;
|
||||
const cell = editor.document.cells[0];
|
||||
const cell = editor.document.cellAt(0);
|
||||
|
||||
await withEvent<vscode.NotebookCellOutputsChangeEvent>(vscode.notebook.onDidChangeCellOutputs, async (event) => {
|
||||
await vscode.commands.executeCommand('notebook.execute');
|
||||
|
@ -794,7 +794,7 @@ suite('Notebook API tests', function () {
|
|||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true, 'notebook first');
|
||||
const editor = vscode.window.activeNotebookEditor!;
|
||||
const cell = editor.document.cells[0];
|
||||
const cell = editor.document.cellAt(0);
|
||||
|
||||
vscode.commands.executeCommand('notebook.cell.execute');
|
||||
await withEvent<vscode.NotebookCellOutputsChangeEvent>(vscode.notebook.onDidChangeCellOutputs, async (event) => {
|
||||
|
@ -851,7 +851,7 @@ suite('Notebook API tests', function () {
|
|||
const resource = await createRandomFile('', undefined, '.vsctestnb');
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
const editor = vscode.window.activeNotebookEditor!;
|
||||
const cell = editor.document.cells[0];
|
||||
const cell = editor.document.cellAt(0);
|
||||
|
||||
await vscode.commands.executeCommand('notebook.selectKernel', { extension: 'vscode.vscode-api-tests', id: cancelableKernel.id });
|
||||
await withEvent<vscode.NotebookCellOutputsChangeEvent>(vscode.notebook.onDidChangeCellOutputs, async (event) => {
|
||||
|
@ -901,7 +901,7 @@ suite('Notebook API tests', function () {
|
|||
const resource = await createRandomFile('', undefined, '.vsctestnb');
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
const editor = vscode.window.activeNotebookEditor!;
|
||||
const cell = editor.document.cells[0];
|
||||
const cell = editor.document.cellAt(0);
|
||||
|
||||
await vscode.commands.executeCommand('notebook.selectKernel', { extension: 'vscode.vscode-api-tests', id: interruptableKernel.id });
|
||||
await withEvent<vscode.NotebookCellOutputsChangeEvent>(vscode.notebook.onDidChangeCellOutputs, async (event) => {
|
||||
|
@ -923,7 +923,7 @@ suite('Notebook API tests', function () {
|
|||
const resource = await createRandomFile('', undefined, '.vsctestnb');
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
const editor = vscode.window.activeNotebookEditor!;
|
||||
const cell = editor.document.cells[0];
|
||||
const cell = editor.document.cellAt(0);
|
||||
|
||||
vscode.commands.executeCommand('notebook.cell.execute');
|
||||
let eventCount = 0;
|
||||
|
@ -964,8 +964,8 @@ suite('Notebook API tests', function () {
|
|||
const activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
assert.notStrictEqual(vscode.window.activeNotebookEditor!.selection, undefined);
|
||||
assert.strictEqual(activeCell!.document.getText(), '');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.length, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 1);
|
||||
|
||||
await withEvent(vscode.workspace.onDidChangeTextDocument, async event => {
|
||||
const edit = new vscode.WorkspaceEdit();
|
||||
|
@ -974,7 +974,7 @@ suite('Notebook API tests', function () {
|
|||
await event;
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor?.selection !== undefined, true);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cells[1], vscode.window.activeNotebookEditor?.selection);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cellAt(1), vscode.window.activeNotebookEditor?.selection);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor?.selection?.document.getText(), 'var abc = 0;');
|
||||
});
|
||||
|
||||
|
@ -997,8 +997,8 @@ suite('Notebook API tests', function () {
|
|||
const activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
assert.notStrictEqual(vscode.window.activeNotebookEditor!.selection, undefined);
|
||||
assert.strictEqual(activeCell!.document.getText(), '');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.length, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 1);
|
||||
|
||||
|
||||
// modify the second cell, delete it
|
||||
|
@ -1006,20 +1006,20 @@ suite('Notebook API tests', function () {
|
|||
edit.insert(vscode.window.activeNotebookEditor!.selection!.document.uri, new vscode.Position(0, 0), 'var abc = 0;');
|
||||
await vscode.workspace.applyEdit(edit);
|
||||
await vscode.commands.executeCommand('notebook.cell.delete');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.length, 3);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(vscode.window.activeNotebookEditor!.selection!), 1);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 3);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(vscode.window.activeNotebookEditor!.selection!), 1);
|
||||
|
||||
|
||||
// undo should bring back the deleted cell, and revert to previous content and selection
|
||||
await vscode.commands.executeCommand('undo');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.length, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(vscode.window.activeNotebookEditor!.selection!), 1);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(vscode.window.activeNotebookEditor!.selection!), 1);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor?.selection?.document.getText(), 'var abc = 0;');
|
||||
|
||||
// redo
|
||||
// await vscode.commands.executeCommand('notebook.redo');
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.length, 2);
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(vscode.window.activeNotebookEditor!.selection!), 1);
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellCount, 2);
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(vscode.window.activeNotebookEditor!.selection!), 1);
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor?.selection?.document.getText(), 'test');
|
||||
|
||||
await saveFileAndCloseAll(resource);
|
||||
|
@ -1064,8 +1064,8 @@ suite('Notebook API tests', function () {
|
|||
// make sure that the previous dirty editor is still restored in the extension host and no data loss
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor?.selection !== undefined, true);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cells[1], vscode.window.activeNotebookEditor?.selection);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cells.length, 4);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cellAt(1), vscode.window.activeNotebookEditor?.selection);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cellCount, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor?.selection?.document.getText(), 'var abc = 0;');
|
||||
|
||||
await saveFileAndCloseAll(resource);
|
||||
|
@ -1091,16 +1091,16 @@ suite('Notebook API tests', function () {
|
|||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor?.selection !== undefined, true);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cells[1], vscode.window.activeNotebookEditor?.selection);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cells.length, 4);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cellAt(1), vscode.window.activeNotebookEditor?.selection);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cellCount, 4);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor?.selection?.document.getText(), 'var abc = 0;');
|
||||
|
||||
// switch to the second editor
|
||||
await vscode.commands.executeCommand('vscode.openWith', secondResource, 'notebookCoreTest');
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor?.selection !== undefined, true);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cells[1], vscode.window.activeNotebookEditor?.selection);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cells.length, 3);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cellAt(1), vscode.window.activeNotebookEditor?.selection);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor?.document.cellCount, 3);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor?.selection?.document.getText(), '');
|
||||
|
||||
await saveAllFilesAndCloseAll(secondResource);
|
||||
|
@ -1150,7 +1150,7 @@ suite('Notebook API tests', function () {
|
|||
// TODO see #101462
|
||||
// await vscode.commands.executeCommand('notebook.cell.copyDown');
|
||||
// const activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
|
||||
// assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 1);
|
||||
// assert.strictEqual(activeCell?.metadata.custom!['testCellMetadata'] as number, 123);
|
||||
|
||||
await saveFileAndCloseAll(resource);
|
||||
|
@ -1162,7 +1162,7 @@ suite('Notebook API tests', function () {
|
|||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
|
||||
const document = vscode.window.activeNotebookEditor?.document!;
|
||||
const [cell] = document.cells;
|
||||
const [cell] = document.getCells();
|
||||
|
||||
await saveAllFilesAndCloseAll(document.uri);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor, undefined);
|
||||
|
@ -1179,7 +1179,7 @@ suite('Notebook API tests', function () {
|
|||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
|
||||
const document = vscode.window.activeNotebookEditor?.document!;
|
||||
const [cell] = document.cells;
|
||||
const [cell] = document.getCells();
|
||||
|
||||
await saveAllFilesAndCloseAll(document.uri);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor, undefined);
|
||||
|
@ -1245,15 +1245,15 @@ suite('Notebook API tests', function () {
|
|||
await vscode.commands.executeCommand('notebook.cell.copyDown');
|
||||
await vscode.commands.executeCommand('notebook.cell.edit');
|
||||
activeCell = vscode.window.activeNotebookEditor!.selection;
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().indexOf(activeCell!), 1);
|
||||
assert.strictEqual(activeCell?.document.getText(), 'test');
|
||||
|
||||
const edit = new vscode.WorkspaceEdit();
|
||||
edit.insert(vscode.window.activeNotebookEditor!.selection!.document.uri, new vscode.Position(0, 0), 'var abc = 0;');
|
||||
await vscode.workspace.applyEdit(edit);
|
||||
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells.length, 3);
|
||||
assert.notEqual(vscode.window.activeNotebookEditor!.document.cells[0].document.getText(), vscode.window.activeNotebookEditor!.document.cells[1].document.getText());
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.getCells().length, 3);
|
||||
assert.notEqual(vscode.window.activeNotebookEditor!.document.cellAt(0).document.getText(), vscode.window.activeNotebookEditor!.document.cellAt(1).document.getText());
|
||||
|
||||
await closeAllEditors();
|
||||
});
|
||||
|
@ -1269,20 +1269,20 @@ suite('Notebook API tests', function () {
|
|||
new vscode.NotebookCellOutputItem('application/json', { data: true }, { metadata: true }),
|
||||
])]);
|
||||
await vscode.workspace.applyEdit(edit);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells[0].outputs.length, 1);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells[0].outputs[0].outputs.length, 2);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(0).outputs.length, 1);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(0).outputs[0].outputs.length, 2);
|
||||
|
||||
const appendEdit = new vscode.WorkspaceEdit();
|
||||
const newItem = new vscode.NotebookCellOutputItem('text/plain', '1');
|
||||
appendEdit.appendNotebookCellOutputItems(
|
||||
resource,
|
||||
0,
|
||||
vscode.window.activeNotebookEditor!.document.cells[0].outputs[0].id,
|
||||
vscode.window.activeNotebookEditor!.document.cellAt(0).outputs[0].id,
|
||||
[newItem]
|
||||
);
|
||||
await vscode.workspace.applyEdit(appendEdit);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cells[0].outputs[0].outputs.length, 3);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor!.document.cells[0].outputs[0].outputs[2], newItem);
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor!.document.cellAt(0).outputs[0].outputs.length, 3);
|
||||
assert.deepStrictEqual(vscode.window.activeNotebookEditor!.document.cellAt(0).outputs[0].outputs[2], newItem);
|
||||
});
|
||||
|
||||
test('#115855 onDidSaveNotebookDocument', async function () {
|
||||
|
@ -1339,8 +1339,8 @@ suite('Notebook API tests', function () {
|
|||
await task.replaceOutput([new vscode.NotebookCellOutput([
|
||||
new vscode.NotebookCellOutputItem('text/plain', ['Some output'], undefined)
|
||||
])]);
|
||||
assert.strictEqual(document.cells[0].outputs.length, 1);
|
||||
assert.deepStrictEqual(document.cells[0].outputs[0].outputs[0].value, ['Some output']);
|
||||
assert.strictEqual(document.cellAt(0).outputs.length, 1);
|
||||
assert.deepStrictEqual(document.cellAt(0).outputs[0].outputs[0].value, ['Some output']);
|
||||
task.end({});
|
||||
}
|
||||
};
|
||||
|
@ -1359,7 +1359,7 @@ suite('Notebook API tests', function () {
|
|||
const resource = await createRandomFile('', undefined, '.vsctestnb');
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
const editor = vscode.window.activeNotebookEditor!;
|
||||
const cell = editor.document.cells[0];
|
||||
const cell = editor.document.cellAt(0);
|
||||
|
||||
assert.strictEqual(cell.latestExecutionSummary?.success, undefined);
|
||||
assert.strictEqual(cell.latestExecutionSummary?.executionOrder, undefined);
|
||||
|
@ -1376,7 +1376,7 @@ suite('Notebook API tests', function () {
|
|||
const resource = await createRandomFile('', undefined, '.vsctestnb');
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
const editor = vscode.window.activeNotebookEditor!;
|
||||
const cell = editor.document.cells[0];
|
||||
const cell = editor.document.cellAt(0);
|
||||
|
||||
assert.strictEqual(cell.latestExecutionSummary?.success, undefined);
|
||||
assert.strictEqual(cell.latestExecutionSummary?.duration, 25);
|
||||
|
|
|
@ -157,7 +157,7 @@ suite('vscode API - window', () => {
|
|||
return;
|
||||
}
|
||||
|
||||
if (process.env['BUILD_SOURCEVERSION']) {
|
||||
if (process.env['BUILD_SOURCEVERSION'] || process.env['CI']) {
|
||||
this.skip();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ const suite = 'Custom Editor Tests';
|
|||
const options: any = {
|
||||
ui: 'tdd',
|
||||
color: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
|
||||
timeout: 6000000
|
||||
timeout: 60000
|
||||
};
|
||||
|
||||
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "code-oss-dev",
|
||||
"version": "1.56.0",
|
||||
"distro": "90e5e23718a75d6251370687f8188633d57e68ad",
|
||||
"distro": "fca0eb45354a13177b2235c30af9b6b158ed9b15",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
|
@ -84,10 +84,10 @@
|
|||
"vscode-ripgrep": "^1.11.1",
|
||||
"vscode-sqlite3": "4.0.10",
|
||||
"vscode-textmate": "5.2.0",
|
||||
"xterm": "4.12.0-beta.15",
|
||||
"xterm": "4.12.0-beta.20",
|
||||
"xterm-addon-search": "0.9.0-beta.1",
|
||||
"xterm-addon-unicode11": "0.3.0-beta.4",
|
||||
"xterm-addon-webgl": "0.11.0-beta.4",
|
||||
"xterm-addon-webgl": "0.11.0-beta.7",
|
||||
"yauzl": "^2.9.2",
|
||||
"yazl": "^2.4.3"
|
||||
},
|
||||
|
@ -124,7 +124,7 @@
|
|||
"copy-webpack-plugin": "^6.0.3",
|
||||
"cson-parser": "^1.3.3",
|
||||
"css-loader": "^3.2.0",
|
||||
"cssnano": "^4.1.10",
|
||||
"cssnano": "^4.1.11",
|
||||
"debounce": "^1.0.0",
|
||||
"deemon": "^1.4.0",
|
||||
"electron": "11.4.1",
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
"builtInExtensions": [
|
||||
{
|
||||
"name": "ms-vscode.node-debug",
|
||||
"version": "1.44.19",
|
||||
"version": "1.44.22",
|
||||
"repo": "https://github.com/microsoft/vscode-node-debug",
|
||||
"metadata": {
|
||||
"id": "b6ded8fb-a0a0-4c1c-acbd-ab2a3bc995a6",
|
||||
|
@ -93,7 +93,7 @@
|
|||
},
|
||||
{
|
||||
"name": "ms-vscode.js-debug",
|
||||
"version": "1.55.2",
|
||||
"version": "1.56.0",
|
||||
"repo": "https://github.com/microsoft/vscode-js-debug",
|
||||
"metadata": {
|
||||
"id": "25629058-ddac-4e17-abba-74678e126c5d",
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
"vscode-regexpp": "^3.1.0",
|
||||
"vscode-ripgrep": "^1.11.1",
|
||||
"vscode-textmate": "5.2.0",
|
||||
"xterm": "4.12.0-beta.15",
|
||||
"xterm": "4.12.0-beta.20",
|
||||
"xterm-addon-search": "0.9.0-beta.1",
|
||||
"xterm-addon-unicode11": "0.3.0-beta.4",
|
||||
"xterm-addon-webgl": "0.11.0-beta.4",
|
||||
"xterm-addon-webgl": "0.11.0-beta.7",
|
||||
"yauzl": "^2.9.2",
|
||||
"yazl": "^2.4.3"
|
||||
},
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
"tas-client-umd": "0.1.4",
|
||||
"vscode-oniguruma": "1.3.1",
|
||||
"vscode-textmate": "5.2.0",
|
||||
"xterm": "4.12.0-beta.15",
|
||||
"xterm": "4.12.0-beta.20",
|
||||
"xterm-addon-search": "0.9.0-beta.1",
|
||||
"xterm-addon-unicode11": "0.3.0-beta.4",
|
||||
"xterm-addon-webgl": "0.11.0-beta.4"
|
||||
"xterm-addon-webgl": "0.11.0-beta.7"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,12 +37,12 @@ xterm-addon-unicode11@0.3.0-beta.4:
|
|||
resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.3.0-beta.4.tgz#c5ff50b156b297e32fdfec2ff15f6c9dde0bfb36"
|
||||
integrity sha512-g3JnXbGvNW1+EKIRVO6qXp6guORTusGBOLLiAQkCz9UAB5Mi/QwrCWuP0XOZNrAS9O1ge3CZYiBwash1cVcV3g==
|
||||
|
||||
xterm-addon-webgl@0.11.0-beta.4:
|
||||
version "0.11.0-beta.4"
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.11.0-beta.4.tgz#f9007976b06837f3c20b1ff49e60e854b303589f"
|
||||
integrity sha512-1zHD5D+lWqZVms4oanlrY44/ndkF/4SWTVohqTy5pukaXrHywhuAU4IG+bm0BwVNj5XLq2brg/ADt7gv8Ny84w==
|
||||
xterm-addon-webgl@0.11.0-beta.7:
|
||||
version "0.11.0-beta.7"
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.11.0-beta.7.tgz#f50c2f12b168f1465bd5a37993c8ff49f1b3e8ed"
|
||||
integrity sha512-JLo104AD6Vh51SgY/Q+MuBbN4E3V7x+ZszbQvXmblCMHzvgb/mXs5vKnDDyu7bQ4hQYxGL3F2jhENniwSrKc7A==
|
||||
|
||||
xterm@4.12.0-beta.15:
|
||||
version "4.12.0-beta.15"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.12.0-beta.15.tgz#3cfc2caf816ac0a50254dcb7e2dd12976344aab4"
|
||||
integrity sha512-tObO3uj2Tfq5ZyHiasUPcVvtOyr5v3LEIGcp5U6g1z7RiuUcsqBwbdEObz2BYLanFUwM/gGka6OO2wEqb/+DyA==
|
||||
xterm@4.12.0-beta.20:
|
||||
version "4.12.0-beta.20"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.12.0-beta.20.tgz#993f88a49a88ebcd73e6b0d4e364ddeebb4bc853"
|
||||
integrity sha512-JOBp5thYngGnWijmLlAGpACQwh7KzdiHEbcdoNTp2jSCFtzL3ATclmVATnbzUWdf0F8dg39L/TiTY2he8IdzpQ==
|
||||
|
|
|
@ -428,15 +428,15 @@ xterm-addon-unicode11@0.3.0-beta.4:
|
|||
resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.3.0-beta.4.tgz#c5ff50b156b297e32fdfec2ff15f6c9dde0bfb36"
|
||||
integrity sha512-g3JnXbGvNW1+EKIRVO6qXp6guORTusGBOLLiAQkCz9UAB5Mi/QwrCWuP0XOZNrAS9O1ge3CZYiBwash1cVcV3g==
|
||||
|
||||
xterm-addon-webgl@0.11.0-beta.4:
|
||||
version "0.11.0-beta.4"
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.11.0-beta.4.tgz#f9007976b06837f3c20b1ff49e60e854b303589f"
|
||||
integrity sha512-1zHD5D+lWqZVms4oanlrY44/ndkF/4SWTVohqTy5pukaXrHywhuAU4IG+bm0BwVNj5XLq2brg/ADt7gv8Ny84w==
|
||||
xterm-addon-webgl@0.11.0-beta.7:
|
||||
version "0.11.0-beta.7"
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.11.0-beta.7.tgz#f50c2f12b168f1465bd5a37993c8ff49f1b3e8ed"
|
||||
integrity sha512-JLo104AD6Vh51SgY/Q+MuBbN4E3V7x+ZszbQvXmblCMHzvgb/mXs5vKnDDyu7bQ4hQYxGL3F2jhENniwSrKc7A==
|
||||
|
||||
xterm@4.12.0-beta.15:
|
||||
version "4.12.0-beta.15"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.12.0-beta.15.tgz#3cfc2caf816ac0a50254dcb7e2dd12976344aab4"
|
||||
integrity sha512-tObO3uj2Tfq5ZyHiasUPcVvtOyr5v3LEIGcp5U6g1z7RiuUcsqBwbdEObz2BYLanFUwM/gGka6OO2wEqb/+DyA==
|
||||
xterm@4.12.0-beta.20:
|
||||
version "4.12.0-beta.20"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.12.0-beta.20.tgz#993f88a49a88ebcd73e6b0d4e364ddeebb4bc853"
|
||||
integrity sha512-JOBp5thYngGnWijmLlAGpACQwh7KzdiHEbcdoNTp2jSCFtzL3ATclmVATnbzUWdf0F8dg39L/TiTY2he8IdzpQ==
|
||||
|
||||
yauzl@^2.9.2:
|
||||
version "2.10.0"
|
||||
|
|
2
src/bootstrap-node.js
vendored
2
src/bootstrap-node.js
vendored
|
@ -98,7 +98,7 @@ exports.removeGlobalNodeModuleLookupPaths = function () {
|
|||
/**
|
||||
* Helper to enable portable mode.
|
||||
*
|
||||
* @param {Partial<import('./vs/platform/product/common/productService').IProductConfiguration>} product
|
||||
* @param {Partial<import('./vs/base/common/product').IProductConfiguration>} product
|
||||
* @returns {{ portableDataPath: string; isPortable: boolean; }}
|
||||
*/
|
||||
exports.configurePortable = function (product) {
|
||||
|
|
24
src/bootstrap-window.js
vendored
24
src/bootstrap-window.js
vendored
|
@ -22,20 +22,18 @@
|
|||
}
|
||||
}(this, function () {
|
||||
const bootstrapLib = bootstrap();
|
||||
const preloadGlobals = globals();
|
||||
const preloadGlobals = sandboxGlobals();
|
||||
const safeProcess = preloadGlobals.process;
|
||||
const useCustomProtocol = safeProcess.sandboxed || typeof safeProcess.env['ENABLE_VSCODE_BROWSER_CODE_LOADING'] === 'string';
|
||||
|
||||
// Start to resolve process.env before anything gets load
|
||||
// so that we can run loading and resolving in parallel
|
||||
const whenEnvResolved = safeProcess.resolveEnv();
|
||||
const useCustomProtocol = safeProcess.sandboxed || typeof safeProcess.env['VSCODE_BROWSER_CODE_LOADING'] === 'string';
|
||||
|
||||
/**
|
||||
* @typedef {import('./vs/base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration} ISandboxConfiguration
|
||||
*
|
||||
* @param {string[]} modulePaths
|
||||
* @param {(result: unknown, configuration: import('./vs/base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => Promise<unknown> | undefined} resultCallback
|
||||
* @param {(result: unknown, configuration: ISandboxConfiguration) => Promise<unknown> | undefined} resultCallback
|
||||
* @param {{
|
||||
* configureDeveloperKeybindings?: (config: import('./vs/base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => {forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean},
|
||||
* canModifyDOM?: (config: import('./vs/base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => void,
|
||||
* configureDeveloperKeybindings?: (config: ISandboxConfiguration) => {forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean},
|
||||
* canModifyDOM?: (config: ISandboxConfiguration) => void,
|
||||
* beforeLoaderConfig?: (loaderConfig: object) => void,
|
||||
* beforeRequire?: () => void
|
||||
* }} [options]
|
||||
|
@ -49,8 +47,8 @@
|
|||
|
||||
// Await window configuration from preload
|
||||
performance.mark('code/willWaitForWindowConfig');
|
||||
/** @type {import('./vs/base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration} */
|
||||
const configuration = await preloadGlobals.context.configuration;
|
||||
/** @type {ISandboxConfiguration} */
|
||||
const configuration = await preloadGlobals.context.resolveConfiguration();
|
||||
performance.mark('code/didWaitForWindowConfig');
|
||||
|
||||
// Developer keybindings
|
||||
|
@ -167,7 +165,7 @@
|
|||
// Wait for process environment being fully resolved
|
||||
performance.mark('code/willWaitForShellEnv');
|
||||
if (!safeProcess.env['VSCODE_SKIP_PROCESS_ENV_PATCHING'] /* TODO@bpasero for https://github.com/microsoft/vscode/issues/108804 */) {
|
||||
await whenEnvResolved;
|
||||
await safeProcess.shellEnv();
|
||||
}
|
||||
performance.mark('code/didWaitForShellEnv');
|
||||
|
||||
|
@ -260,7 +258,7 @@
|
|||
/**
|
||||
* @return {typeof import('./vs/base/parts/sandbox/electron-sandbox/globals')}
|
||||
*/
|
||||
function globals() {
|
||||
function sandboxGlobals() {
|
||||
// @ts-ignore (defined in globals.js)
|
||||
return window.vscode;
|
||||
}
|
||||
|
|
18
src/bootstrap.js
vendored
18
src/bootstrap.js
vendored
|
@ -173,7 +173,7 @@
|
|||
/**
|
||||
* @returns {typeof import('./vs/base/parts/sandbox/electron-sandbox/globals') | undefined}
|
||||
*/
|
||||
function safeGlobals() {
|
||||
function safeSandboxGlobals() {
|
||||
const globals = (typeof self === 'object' ? self : typeof global === 'object' ? global : {});
|
||||
|
||||
return globals.vscode;
|
||||
|
@ -183,13 +183,13 @@
|
|||
* @returns {import('./vs/base/parts/sandbox/electron-sandbox/globals').ISandboxNodeProcess | NodeJS.Process}
|
||||
*/
|
||||
function safeProcess() {
|
||||
if (typeof process !== 'undefined') {
|
||||
return process; // Native environment (non-sandboxed)
|
||||
const sandboxGlobals = safeSandboxGlobals();
|
||||
if (sandboxGlobals) {
|
||||
return sandboxGlobals.process; // Native environment (sandboxed)
|
||||
}
|
||||
|
||||
const globals = safeGlobals();
|
||||
if (globals) {
|
||||
return globals.process; // Native environment (sandboxed)
|
||||
if (typeof process !== 'undefined') {
|
||||
return process; // Native environment (non-sandboxed)
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
@ -199,9 +199,9 @@
|
|||
* @returns {import('./vs/base/parts/sandbox/electron-sandbox/electronTypes').IpcRenderer | undefined}
|
||||
*/
|
||||
function safeIpcRenderer() {
|
||||
const globals = safeGlobals();
|
||||
if (globals) {
|
||||
return globals.ipcRenderer;
|
||||
const sandboxGlobals = safeSandboxGlobals();
|
||||
if (sandboxGlobals) {
|
||||
return sandboxGlobals.ipcRenderer;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
|
38
src/main.js
38
src/main.js
|
@ -6,6 +6,12 @@
|
|||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @typedef {import('./vs/base/common/product').IProductConfiguration} IProductConfiguration
|
||||
* @typedef {import('./vs/base/node/languagePacks').NLSConfiguration} NLSConfiguration
|
||||
* @typedef {import('./vs/platform/environment/common/argv').NativeParsedArgs} NativeParsedArgs
|
||||
*/
|
||||
|
||||
const perf = require('./vs/base/common/performance');
|
||||
perf.mark('code/didStartMain');
|
||||
|
||||
|
@ -16,7 +22,7 @@ const { getNLSConfiguration } = require('./vs/base/node/languagePacks');
|
|||
const bootstrap = require('./bootstrap');
|
||||
const bootstrapNode = require('./bootstrap-node');
|
||||
const { getUserDataPath } = require('./vs/platform/environment/node/userDataPath');
|
||||
/** @type {Partial<import('./vs/platform/product/common/productService').IProductConfiguration>} */
|
||||
/** @type {Partial<IProductConfiguration>} */
|
||||
const product = require('../product.json');
|
||||
const { app, protocol, crashReporter } = require('electron');
|
||||
|
||||
|
@ -74,7 +80,7 @@ const nodeCachedDataDir = getNodeCachedDir();
|
|||
* Support user defined locale: load it early before app('ready')
|
||||
* to have more things running in parallel.
|
||||
*
|
||||
* @type {Promise<import('./vs/base/node/languagePacks').NLSConfiguration> | undefined}
|
||||
* @type {Promise<NLSConfiguration> | undefined}
|
||||
*/
|
||||
let nlsConfigurationPromise = undefined;
|
||||
|
||||
|
@ -104,7 +110,7 @@ app.once('ready', function () {
|
|||
* Main startup routine
|
||||
*
|
||||
* @param {string | undefined} cachedDataDir
|
||||
* @param {import('./vs/base/node/languagePacks').NLSConfiguration} nlsConfig
|
||||
* @param {NLSConfiguration} nlsConfig
|
||||
*/
|
||||
function startup(cachedDataDir, nlsConfig) {
|
||||
nlsConfig._languagePackSupport = true;
|
||||
|
@ -132,7 +138,7 @@ async function onReady() {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {import('./vs/platform/environment/common/argv').NativeParsedArgs} cliArgs
|
||||
* @param {NativeParsedArgs} cliArgs
|
||||
*/
|
||||
function configureCommandlineSwitchesSync(cliArgs) {
|
||||
const SUPPORTED_ELECTRON_SWITCHES = [
|
||||
|
@ -159,16 +165,18 @@ function configureCommandlineSwitchesSync(cliArgs) {
|
|||
'enable-proposed-api',
|
||||
|
||||
// TODO@sandbox remove me once testing is done on `vscode-file` protocol
|
||||
// (all traces of `enable-browser-code-loading` and `ENABLE_VSCODE_BROWSER_CODE_LOADING`)
|
||||
// (all traces of `enable-browser-code-loading` and `VSCODE_BROWSER_CODE_LOADING`)
|
||||
'enable-browser-code-loading',
|
||||
|
||||
// Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn', 'info', 'debug', 'trace', 'off'.
|
||||
'log-level',
|
||||
'log-level'
|
||||
];
|
||||
|
||||
// Read argv config
|
||||
const argvConfig = readArgvConfigSync();
|
||||
|
||||
let browserCodeLoadingStrategy = undefined;
|
||||
|
||||
Object.keys(argvConfig).forEach(argvKey => {
|
||||
const argvValue = argvConfig[argvKey];
|
||||
|
||||
|
@ -204,8 +212,10 @@ function configureCommandlineSwitchesSync(cliArgs) {
|
|||
break;
|
||||
|
||||
case 'enable-browser-code-loading':
|
||||
if (typeof argvValue === 'string') {
|
||||
process.env['ENABLE_VSCODE_BROWSER_CODE_LOADING'] = argvValue;
|
||||
if (argvValue === false) {
|
||||
browserCodeLoadingStrategy = undefined;
|
||||
} else if (typeof argvValue === 'string') {
|
||||
browserCodeLoadingStrategy = argvValue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -224,9 +234,9 @@ function configureCommandlineSwitchesSync(cliArgs) {
|
|||
app.commandLine.appendSwitch('js-flags', jsFlags);
|
||||
}
|
||||
|
||||
// Support __sandbox flag
|
||||
if (cliArgs.__sandbox) {
|
||||
process.env['ENABLE_VSCODE_BROWSER_CODE_LOADING'] = 'bypassHeatCheck';
|
||||
// Configure vscode-file:// code loading environment
|
||||
if (cliArgs.__sandbox || browserCodeLoadingStrategy) {
|
||||
process.env['VSCODE_BROWSER_CODE_LOADING'] = browserCodeLoadingStrategy || 'bypassHeatCheck';
|
||||
}
|
||||
|
||||
return argvConfig;
|
||||
|
@ -411,7 +421,7 @@ function configureCrashReporter() {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {import('./vs/platform/environment/common/argv').NativeParsedArgs} cliArgs
|
||||
* @param {NativeParsedArgs} cliArgs
|
||||
* @returns {string | null}
|
||||
*/
|
||||
function getJSFlags(cliArgs) {
|
||||
|
@ -431,7 +441,7 @@ function getJSFlags(cliArgs) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @returns {import('./vs/platform/environment/common/argv').NativeParsedArgs}
|
||||
* @returns {NativeParsedArgs}
|
||||
*/
|
||||
function parseCLIArgs() {
|
||||
const minimist = require('minimist');
|
||||
|
@ -549,7 +559,7 @@ function mkdirp(dir) {
|
|||
/**
|
||||
* Resolve the NLS configuration
|
||||
*
|
||||
* @return {Promise<import('./vs/base/node/languagePacks').NLSConfiguration>}
|
||||
* @return {Promise<NLSConfiguration>}
|
||||
*/
|
||||
async function resolveNlsConfiguration() {
|
||||
|
||||
|
|
|
@ -6,12 +6,14 @@
|
|||
.monaco-action-bar {
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.monaco-action-bar .actions-container {
|
||||
display: flex;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
@ -21,20 +23,18 @@
|
|||
}
|
||||
|
||||
.monaco-action-bar .action-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
transition: transform 50ms ease;
|
||||
position: relative; /* DO NOT REMOVE - this is the key to preventing the ghosting icon bug in Chrome 42 */
|
||||
min-width: 24px;
|
||||
}
|
||||
|
||||
.monaco-action-bar .action-item.disabled {
|
||||
.monaco-action-bar .eaction-item.disabled {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.monaco-action-bar.animated .action-item.active {
|
||||
transform: scale(1.272019649, 1.272019649); /* 1.272019649 = √φ */
|
||||
}
|
||||
|
||||
.monaco-action-bar .action-item .icon,
|
||||
.monaco-action-bar .action-item .codicon {
|
||||
display: inline-block;
|
||||
|
@ -47,7 +47,8 @@
|
|||
|
||||
.monaco-action-bar .action-label {
|
||||
font-size: 11px;
|
||||
margin-right: 4px;
|
||||
padding: 3px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.monaco-action-bar .action-item.disabled .action-label,
|
||||
|
@ -74,10 +75,6 @@
|
|||
margin-right: .8em;
|
||||
}
|
||||
|
||||
.monaco-action-bar.animated.vertical .action-item.active {
|
||||
transform: translate(5px, 0);
|
||||
}
|
||||
|
||||
.secondary-actions .monaco-action-bar .action-label {
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -11,6 +11,9 @@
|
|||
.monaco-dropdown > .dropdown-label {
|
||||
cursor: pointer;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.monaco-dropdown > .dropdown-label > .action-label.disabled {
|
||||
|
|
|
@ -52,6 +52,10 @@
|
|||
margin-left: auto;
|
||||
}
|
||||
|
||||
.monaco-pane-view .pane > .pane-header > .actions .action-label {
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
/* TODO: actions should be part of the pane, but they aren't yet */
|
||||
.monaco-pane-view .pane:hover > .pane-header.expanded > .actions,
|
||||
.monaco-pane-view .pane:focus-within > .pane-header.expanded > .actions,
|
||||
|
@ -60,22 +64,6 @@
|
|||
display: initial;
|
||||
}
|
||||
|
||||
/* TODO: actions should be part of the pane, but they aren't yet */
|
||||
.monaco-pane-view .pane > .pane-header > .actions .action-label.icon,
|
||||
.monaco-pane-view .pane > .pane-header > .actions .action-label.codicon {
|
||||
width: 28px;
|
||||
height: 22px;
|
||||
background-size: 16px;
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
margin-right: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: inherit;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
.monaco-pane-view .pane > .pane-header .monaco-action-bar .action-item.select-container {
|
||||
cursor: default;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.monaco-toolbar {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.monaco-toolbar .toolbar-toggle-more {
|
||||
display: inline-block;
|
||||
padding: 0;
|
||||
|
|
|
@ -551,6 +551,11 @@ export namespace Codicon {
|
|||
export const workspaceTrusted = new Codicon('workspace-trusted', { fontCharacter: '\\ebc1' });
|
||||
export const workspaceUntrusted = new Codicon('workspace-untrusted', { fontCharacter: '\\ebc2' });
|
||||
export const workspaceUnspecified = new Codicon('workspace-unspecified', { fontCharacter: '\\ebc3' });
|
||||
export const terminalCmd = new Codicon('terminal-cmd', { fontCharacter: '\\ebc4' });
|
||||
export const terminalDebian = new Codicon('terminal-debian', { fontCharacter: '\\ebc5' });
|
||||
export const terminalLinux = new Codicon('terminal-linux', { fontCharacter: '\\ebc6' });
|
||||
export const terminalPowershell = new Codicon('terminal-powershell', { fontCharacter: '\\ebc7' });
|
||||
export const terminalTmux = new Codicon('terminal-tmux', { fontCharacter: '\\ebc8' });
|
||||
|
||||
export const dropDownButton = new Codicon('drop-down-button', Codicon.chevronDown.definition);
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ class FileAccessImpl {
|
|||
}
|
||||
|
||||
// Only convert the URI if we are in a native context and it has `file:` scheme
|
||||
// and we have explicitly enabled the conversion (sandbox, or ENABLE_VSCODE_BROWSER_CODE_LOADING)
|
||||
// and we have explicitly enabled the conversion (sandbox, or VSCODE_BROWSER_CODE_LOADING)
|
||||
if (platform.isNative && (__forceCodeFileUri || platform.isPreferringBrowserCodeLoad) && uri.scheme === Schemas.file) {
|
||||
return uri.with({
|
||||
scheme: Schemas.vscodeFileResource,
|
||||
|
|
|
@ -53,12 +53,12 @@ declare const self: unknown;
|
|||
export const globals: any = (typeof self === 'object' ? self : typeof global === 'object' ? global : {});
|
||||
|
||||
let nodeProcess: INodeProcess | undefined = undefined;
|
||||
if (typeof process !== 'undefined') {
|
||||
// Native environment (non-sandboxed)
|
||||
nodeProcess = process;
|
||||
} else if (typeof globals.vscode !== 'undefined') {
|
||||
if (typeof globals.vscode !== 'undefined') {
|
||||
// Native environment (sandboxed)
|
||||
nodeProcess = globals.vscode.process;
|
||||
} else if (typeof process !== 'undefined') {
|
||||
// Native environment (non-sandboxed)
|
||||
nodeProcess = process;
|
||||
}
|
||||
|
||||
const isElectronRenderer = typeof nodeProcess?.versions?.electron === 'string' && nodeProcess.type === 'renderer';
|
||||
|
@ -71,7 +71,7 @@ export const browserCodeLoadingCacheStrategy: 'none' | 'code' | 'bypassHeatCheck
|
|||
}
|
||||
|
||||
// Otherwise, only enabled conditionally
|
||||
const env = nodeProcess?.env['ENABLE_VSCODE_BROWSER_CODE_LOADING'];
|
||||
const env = nodeProcess?.env['VSCODE_BROWSER_CODE_LOADING'];
|
||||
if (typeof env === 'string') {
|
||||
if (env === 'none' || env === 'code' || env === 'bypassHeatCheck' || env === 'bypassHeatCheckAndEagerCompile') {
|
||||
return env;
|
||||
|
|
|
@ -6,20 +6,10 @@
|
|||
import { isWindows, isMacintosh, setImmediate, globals, INodeProcess } from 'vs/base/common/platform';
|
||||
|
||||
let safeProcess: INodeProcess & { nextTick: (callback: (...args: any[]) => void) => void; };
|
||||
|
||||
// Native node.js environment
|
||||
declare const process: INodeProcess;
|
||||
if (typeof process !== 'undefined') {
|
||||
safeProcess = {
|
||||
get platform() { return process.platform; },
|
||||
get env() { return process.env; },
|
||||
cwd() { return process.env['VSCODE_CWD'] || process.cwd(); },
|
||||
nextTick(callback: (...args: any[]) => void): void { return process.nextTick!(callback); }
|
||||
};
|
||||
}
|
||||
|
||||
// Native sandbox environment
|
||||
else if (typeof globals.vscode !== 'undefined') {
|
||||
if (typeof globals.vscode !== 'undefined') {
|
||||
const sandboxProcess: INodeProcess = globals.vscode.process;
|
||||
safeProcess = {
|
||||
get platform() { return sandboxProcess.platform; },
|
||||
|
@ -29,6 +19,16 @@ else if (typeof globals.vscode !== 'undefined') {
|
|||
};
|
||||
}
|
||||
|
||||
// Native node.js environment
|
||||
else if (typeof process !== 'undefined') {
|
||||
safeProcess = {
|
||||
get platform() { return process.platform; },
|
||||
get env() { return process.env; },
|
||||
cwd() { return process.env['VSCODE_CWD'] || process.cwd(); },
|
||||
nextTick(callback: (...args: any[]) => void): void { return process.nextTick!(callback); }
|
||||
};
|
||||
}
|
||||
|
||||
// Web environment
|
||||
else {
|
||||
safeProcess = {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IProcessEnvironment } from 'vs/base/common/platform';
|
||||
import { IProductConfiguration } from 'vs/base/common/product';
|
||||
|
||||
|
||||
// #######################################################################
|
||||
|
@ -18,10 +19,34 @@ import { IProcessEnvironment } from 'vs/base/common/platform';
|
|||
* renderer to function.
|
||||
*/
|
||||
export interface ISandboxConfiguration {
|
||||
|
||||
/**
|
||||
* Identifier of the sandboxed renderer.
|
||||
*/
|
||||
windowId: number;
|
||||
|
||||
/**
|
||||
* Absolute installation path.
|
||||
*/
|
||||
appRoot: string;
|
||||
|
||||
/**
|
||||
* Per window process environment.
|
||||
*/
|
||||
userEnv: IProcessEnvironment;
|
||||
|
||||
/**
|
||||
* Product configuration.
|
||||
*/
|
||||
product: IProductConfiguration;
|
||||
|
||||
/**
|
||||
* Configured zoom level.
|
||||
*/
|
||||
zoomLevel?: number;
|
||||
|
||||
/**
|
||||
* @deprecated to be removed soon
|
||||
*/
|
||||
nodeCachedDataDir?: string;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,122 @@
|
|||
|
||||
const { ipcRenderer, webFrame, crashReporter, contextBridge } = require('electron');
|
||||
|
||||
//#region Utilities
|
||||
|
||||
/**
|
||||
* @param {string} channel
|
||||
* @returns {true | never}
|
||||
*/
|
||||
function validateIPC(channel) {
|
||||
if (!channel || !channel.startsWith('vscode:')) {
|
||||
throw new Error(`Unsupported event IPC channel '${channel}'`);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} type
|
||||
* @returns {type is 'uncaughtException'}
|
||||
*/
|
||||
function validateProcessEventType(type) {
|
||||
if (type !== 'uncaughtException') {
|
||||
throw new Error(`Unsupported process event '${type}'`);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} key the name of the process argument to parse
|
||||
* @returns {string | undefined}
|
||||
*/
|
||||
function parseArgv(key) {
|
||||
for (const arg of process.argv) {
|
||||
if (arg.indexOf(`--${key}=`) === 0) {
|
||||
return arg.split('=')[1];
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Resolve Configuration
|
||||
|
||||
/**
|
||||
* @typedef {import('../common/sandboxTypes').ISandboxConfiguration} ISandboxConfiguration
|
||||
*/
|
||||
|
||||
/** @type {ISandboxConfiguration | undefined} */
|
||||
let configuration = undefined;
|
||||
|
||||
/** @type {Promise<ISandboxConfiguration>} */
|
||||
const resolveConfiguration = (async () => {
|
||||
const windowConfigIpcChannel = parseArgv('vscode-window-config');
|
||||
if (!windowConfigIpcChannel) {
|
||||
throw new Error('Preload: did not find expected vscode-window-config in renderer process arguments list.');
|
||||
}
|
||||
|
||||
try {
|
||||
if (validateIPC(windowConfigIpcChannel)) {
|
||||
|
||||
// Resolve configuration from electron-main
|
||||
configuration = await ipcRenderer.invoke(windowConfigIpcChannel);
|
||||
|
||||
// Apply `userEnv` directly
|
||||
Object.assign(process.env, configuration.userEnv);
|
||||
|
||||
// Apply zoom level early before even building the
|
||||
// window DOM elements to avoid UI flicker. We always
|
||||
// have to set the zoom level from within the window
|
||||
// because Chrome has it's own way of remembering zoom
|
||||
// settings per origin (if vscode-file:// is used) and
|
||||
// we want to ensure that the user configuration wins.
|
||||
webFrame.setZoomLevel(configuration.zoomLevel ?? 0);
|
||||
|
||||
return configuration;
|
||||
}
|
||||
} catch (error) {
|
||||
throw new Error(`Preload: unable to fetch vscode-window-config: ${error}`);
|
||||
}
|
||||
})();
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Resolve Shell Environment
|
||||
|
||||
/**
|
||||
* If VSCode is not run from a terminal, we should resolve additional
|
||||
* shell specific environment from the OS shell to ensure we are seeing
|
||||
* all development related environment variables. We do this from the
|
||||
* main process because it may involve spawning a shell.
|
||||
*
|
||||
* @type {Promise<typeof process.env>}
|
||||
*/
|
||||
const resolveShellEnv = (async () => {
|
||||
|
||||
// Resolve `userEnv` from configuration and
|
||||
// `shellEnv` from the main side
|
||||
const [userEnv, shellEnv] = await Promise.all([
|
||||
(async () => (await resolveConfiguration).userEnv)(),
|
||||
ipcRenderer.invoke('vscode:fetchShellEnv')
|
||||
]);
|
||||
|
||||
if (!process.env['VSCODE_SKIP_PROCESS_ENV_PATCHING'] /* TODO@bpasero for https://github.com/microsoft/vscode/issues/108804 */) {
|
||||
// Assign all keys of the shell environment to our process environment
|
||||
// But make sure that the user environment wins in the end over shell environment
|
||||
Object.assign(process.env, shellEnv, userEnv);
|
||||
}
|
||||
|
||||
return { ...process.env, ...shellEnv, ...userEnv };
|
||||
})();
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Globals Definition
|
||||
|
||||
// #######################################################################
|
||||
// ### ###
|
||||
// ### !!! DO NOT USE GET/SET PROPERTIES ANYWHERE HERE !!! ###
|
||||
|
@ -26,8 +142,12 @@
|
|||
* A minimal set of methods exposed from Electron's `ipcRenderer`
|
||||
* to support communication to main process.
|
||||
*
|
||||
* @type {import('../electron-sandbox/electronTypes').IpcRenderer}
|
||||
* @typedef {import('../electron-sandbox/electronTypes').IpcRenderer} IpcRenderer
|
||||
* @typedef {import('electron').IpcRendererEvent} IpcRendererEvent
|
||||
*
|
||||
* @type {IpcRenderer}
|
||||
*/
|
||||
|
||||
ipcRenderer: {
|
||||
|
||||
/**
|
||||
|
@ -53,8 +173,8 @@
|
|||
|
||||
/**
|
||||
* @param {string} channel
|
||||
* @param {(event: import('electron').IpcRendererEvent, ...args: any[]) => void} listener
|
||||
* @returns {import('../electron-sandbox/electronTypes').IpcRenderer}
|
||||
* @param {(event: IpcRendererEvent, ...args: any[]) => void} listener
|
||||
* @returns {IpcRenderer}
|
||||
*/
|
||||
on(channel, listener) {
|
||||
if (validateIPC(channel)) {
|
||||
|
@ -66,8 +186,8 @@
|
|||
|
||||
/**
|
||||
* @param {string} channel
|
||||
* @param {(event: import('electron').IpcRendererEvent, ...args: any[]) => void} listener
|
||||
* @returns {import('../electron-sandbox/electronTypes').IpcRenderer}
|
||||
* @param {(event: IpcRendererEvent, ...args: any[]) => void} listener
|
||||
* @returns {IpcRenderer}
|
||||
*/
|
||||
once(channel, listener) {
|
||||
if (validateIPC(channel)) {
|
||||
|
@ -79,8 +199,8 @@
|
|||
|
||||
/**
|
||||
* @param {string} channel
|
||||
* @param {(event: import('electron').IpcRendererEvent, ...args: any[]) => void} listener
|
||||
* @returns {import('../electron-sandbox/electronTypes').IpcRenderer}
|
||||
* @param {(event: IpcRendererEvent, ...args: any[]) => void} listener
|
||||
* @returns {IpcRenderer}
|
||||
*/
|
||||
removeListener(channel, listener) {
|
||||
if (validateIPC(channel)) {
|
||||
|
@ -103,7 +223,7 @@
|
|||
*/
|
||||
connect(channelRequest, channelResponse, requestNonce) {
|
||||
if (validateIPC(channelRequest) && validateIPC(channelResponse)) {
|
||||
const responseListener = (/** @type {import('electron').IpcRendererEvent} */ e, /** @type {string} */ responseNonce) => {
|
||||
const responseListener = (/** @type {IpcRendererEvent} */ e, /** @type {string} */ responseNonce) => {
|
||||
// validate that the nonce from the response is the same
|
||||
// as when requested. and if so, use `postMessage` to
|
||||
// send the `MessagePort` safely over, even when context
|
||||
|
@ -160,7 +280,9 @@
|
|||
* Note: when `sandbox` is enabled, the only properties available
|
||||
* are https://github.com/electron/electron/blob/master/docs/api/process.md#sandbox
|
||||
*
|
||||
* @type {import('../electron-sandbox/globals').ISandboxNodeProcess}
|
||||
* @typedef {import('../electron-sandbox/globals').ISandboxNodeProcess} ISandboxNodeProcess
|
||||
*
|
||||
* @type {ISandboxNodeProcess}
|
||||
*/
|
||||
process: {
|
||||
get platform() { return process.platform; },
|
||||
|
@ -181,15 +303,8 @@
|
|||
/**
|
||||
* @returns {Promise<typeof process.env>}
|
||||
*/
|
||||
getShellEnv() {
|
||||
return shellEnv;
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
resolveEnv() {
|
||||
return resolveEnv();
|
||||
shellEnv() {
|
||||
return resolveShellEnv;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -202,7 +317,7 @@
|
|||
/**
|
||||
* @param {string} type
|
||||
* @param {Function} callback
|
||||
* @returns {import('../electron-sandbox/globals').ISandboxNodeProcess}
|
||||
* @returns {ISandboxNodeProcess}
|
||||
*/
|
||||
on(type, callback) {
|
||||
if (validateProcessEventType(type)) {
|
||||
|
@ -225,36 +340,24 @@
|
|||
* A configuration object made accessible from the main side
|
||||
* to configure the sandbox browser window.
|
||||
*
|
||||
* The property is intentionally not using a getter to resolve
|
||||
* it as soon as possible to prevent waterfalls.
|
||||
* Note: intentionally not using a getter here because the
|
||||
* actual value will be set after `resolveConfiguration`
|
||||
* has finished.
|
||||
*
|
||||
* @type {Promise<import('../common/sandboxTypes').ISandboxConfiguration>}
|
||||
* @returns {ISandboxConfiguration | undefined}
|
||||
*/
|
||||
configuration: (async () => {
|
||||
const windowConfigIpcChannel = parseArgv('vscode-window-config');
|
||||
if (!windowConfigIpcChannel) {
|
||||
throw new Error('Preload: did not find expected vscode-window-config in renderer process arguments list.');
|
||||
}
|
||||
configuration() {
|
||||
return configuration;
|
||||
},
|
||||
|
||||
try {
|
||||
if (validateIPC(windowConfigIpcChannel)) {
|
||||
/** @type {import('../common/sandboxTypes').ISandboxConfiguration} */
|
||||
const configuration = await ipcRenderer.invoke(windowConfigIpcChannel);
|
||||
|
||||
// Apply zoom level early before even building the
|
||||
// window DOM elements to avoid UI flicker. We always
|
||||
// have to set the zoom level from within the window
|
||||
// because Chrome has it's own way of remembering zoom
|
||||
// settings per origin (if vscode-file:// is used) and
|
||||
// we want to ensure that the user configuration wins.
|
||||
webFrame.setZoomLevel(configuration.zoomLevel ?? 0);
|
||||
|
||||
return configuration;
|
||||
}
|
||||
} catch (error) {
|
||||
throw new Error(`Preload: unable to fetch vscode-window-config: ${error}`);
|
||||
}
|
||||
})()
|
||||
/**
|
||||
* Allows to await the resolution of the configuration object.
|
||||
*
|
||||
* @returns {Promise<ISandboxConfiguration>}
|
||||
*/
|
||||
async resolveConfiguration() {
|
||||
return resolveConfiguration;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -276,88 +379,4 @@
|
|||
// @ts-ignore
|
||||
window.vscode = globals;
|
||||
}
|
||||
|
||||
//#region Utilities
|
||||
|
||||
/**
|
||||
* @param {string} channel
|
||||
* @returns {true | never}
|
||||
*/
|
||||
function validateIPC(channel) {
|
||||
if (!channel || !channel.startsWith('vscode:')) {
|
||||
throw new Error(`Unsupported event IPC channel '${channel}'`);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} type
|
||||
* @returns {type is 'uncaughtException'}
|
||||
*/
|
||||
function validateProcessEventType(type) {
|
||||
if (type !== 'uncaughtException') {
|
||||
throw new Error(`Unsupported process event '${type}'`);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} key the name of the process argument to parse
|
||||
* @returns {string | undefined}
|
||||
*/
|
||||
function parseArgv(key) {
|
||||
for (const arg of process.argv) {
|
||||
if (arg.indexOf(`--${key}=`) === 0) {
|
||||
return arg.split('=')[1];
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Resolve Shell Environment
|
||||
|
||||
/** @type {Promise<typeof process.env> | undefined} */
|
||||
let shellEnv = undefined;
|
||||
|
||||
/**
|
||||
* If VSCode is not run from a terminal, we should resolve additional
|
||||
* shell specific environment from the OS shell to ensure we are seeing
|
||||
* all development related environment variables. We do this from the
|
||||
* main process because it may involve spawning a shell.
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function resolveEnv() {
|
||||
if (!shellEnv) {
|
||||
const configuration = await globals.context.configuration;
|
||||
const userEnv = configuration.userEnv;
|
||||
|
||||
// Apply `userEnv` directly
|
||||
Object.assign(process.env, userEnv);
|
||||
|
||||
// Resolve `shellEnv` from the main side
|
||||
shellEnv = new Promise(function (resolve) {
|
||||
ipcRenderer.once('vscode:acceptShellEnv', function (event, shellEnvResult) {
|
||||
if (!process.env['VSCODE_SKIP_PROCESS_ENV_PATCHING'] /* TODO@bpasero for https://github.com/microsoft/vscode/issues/108804 */) {
|
||||
// Assign all keys of the shell environment to our process environment
|
||||
// But make sure that the user environment wins in the end over shell environment
|
||||
Object.assign(process.env, shellEnvResult, userEnv);
|
||||
}
|
||||
|
||||
resolve({ ...process.env, ...shellEnvResult, ...userEnv });
|
||||
});
|
||||
|
||||
ipcRenderer.send('vscode:fetchShellEnv');
|
||||
});
|
||||
}
|
||||
|
||||
await shellEnv;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}());
|
||||
|
|
|
@ -75,8 +75,8 @@ export interface ISandboxNodeProcess extends INodeProcess {
|
|||
getProcessMemoryInfo: () => Promise<ProcessMemoryInfo>;
|
||||
|
||||
/**
|
||||
* A custom method we add to `process`: Resolve the true process environment to use and
|
||||
* apply it to `process.env`.
|
||||
* Returns a process environment that includes all shell environment variables even if
|
||||
* the application was not started from a shell / terminal / console.
|
||||
*
|
||||
* There are different layers of environment that will apply:
|
||||
* - `process.env`: this is the actual environment of the process before this method
|
||||
|
@ -87,17 +87,8 @@ export interface ISandboxNodeProcess extends INodeProcess {
|
|||
* from a terminal and changed certain variables
|
||||
*
|
||||
* The order of overwrites is `process.env` < `shellEnv` < `userEnv`.
|
||||
*
|
||||
* It is critical that every process awaits this method early on startup to get the right
|
||||
* set of environment in `process.env`.
|
||||
*/
|
||||
resolveEnv(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Returns a process environment that includes any shell environment even if the application
|
||||
* was not started from a shell / terminal / console.
|
||||
*/
|
||||
getShellEnv(): Promise<IProcessEnvironment>;
|
||||
shellEnv(): Promise<IProcessEnvironment>;
|
||||
}
|
||||
|
||||
export interface IpcMessagePort {
|
||||
|
@ -119,9 +110,15 @@ export interface ISandboxContext {
|
|||
|
||||
/**
|
||||
* A configuration object made accessible from the main side
|
||||
* to configure the sandbox browser window.
|
||||
* to configure the sandbox browser window. Will be `undefined`
|
||||
* for as long as `resolveConfiguration` is not awaited.
|
||||
*/
|
||||
configuration: Promise<ISandboxConfiguration>;
|
||||
configuration(): ISandboxConfiguration | undefined;
|
||||
|
||||
/**
|
||||
* Allows to await the resolution of the configuration object.
|
||||
*/
|
||||
resolveConfiguration(): Promise<ISandboxConfiguration>;
|
||||
}
|
||||
|
||||
export const ipcRenderer: IpcRenderer = globals.vscode.ipcRenderer;
|
||||
|
|
|
@ -13,7 +13,8 @@ suite('Sandbox', () => {
|
|||
assert.ok(typeof webFrame.setZoomLevel === 'function');
|
||||
assert.ok(typeof process.platform === 'string');
|
||||
|
||||
const config = await context.configuration;
|
||||
const config = await context.resolveConfiguration();
|
||||
assert.ok(config);
|
||||
assert.ok(context.configuration());
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,6 +8,7 @@ import * as async from 'vs/base/common/async';
|
|||
import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
||||
suite('Async', () => {
|
||||
|
||||
|
@ -484,13 +485,11 @@ suite('Async', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test('Queue - events', function (done) {
|
||||
test('Queue - events', function () {
|
||||
let queue = new async.Queue();
|
||||
|
||||
let finished = false;
|
||||
queue.onFinished(() => {
|
||||
done();
|
||||
});
|
||||
const onFinished = Event.toPromise(queue.onFinished);
|
||||
|
||||
let res: number[] = [];
|
||||
|
||||
|
@ -508,6 +507,8 @@ suite('Async', () => {
|
|||
assert.ok(!finished);
|
||||
});
|
||||
});
|
||||
|
||||
return onFinished;
|
||||
});
|
||||
|
||||
test('ResourceQueue - simple', function () {
|
||||
|
|
|
@ -12,7 +12,7 @@ suite('CancellationToken', function () {
|
|||
assert.strictEqual(typeof CancellationToken.None.onCancellationRequested, 'function');
|
||||
});
|
||||
|
||||
test('cancel before token', function (done) {
|
||||
test('cancel before token', function () {
|
||||
|
||||
const source = new CancellationTokenSource();
|
||||
assert.strictEqual(source.token.isCancellationRequested, false);
|
||||
|
@ -20,9 +20,8 @@ suite('CancellationToken', function () {
|
|||
|
||||
assert.strictEqual(source.token.isCancellationRequested, true);
|
||||
|
||||
source.token.onCancellationRequested(function () {
|
||||
assert.ok(true);
|
||||
done();
|
||||
return new Promise<void>(resolve => {
|
||||
source.token.onCancellationRequested(() => resolve());
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -27,13 +27,15 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @typedef {import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration} ISandboxConfiguration
|
||||
*
|
||||
* @returns {{
|
||||
* load: (
|
||||
* modules: string[],
|
||||
* resultCallback: (result, configuration: import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => unknown,
|
||||
* resultCallback: (result, configuration: ISandboxConfiguration) => unknown,
|
||||
* options?: {
|
||||
* configureDeveloperKeybindings?: (config: import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => {forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean},
|
||||
* canModifyDOM?: (config: import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => void,
|
||||
* configureDeveloperKeybindings?: (config: ISandboxConfiguration) => {forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean},
|
||||
* canModifyDOM?: (config: ISandboxConfiguration) => void,
|
||||
* beforeLoaderConfig?: (loaderConfig: object) => void,
|
||||
* beforeRequire?: () => void
|
||||
* }
|
||||
|
|
|
@ -157,11 +157,11 @@ class SharedProcessMain extends Disposable {
|
|||
services.set(INativeEnvironmentService, environmentService);
|
||||
|
||||
// Logger
|
||||
const loggerService = new LoggerChannelClient(mainProcessService.getChannel('logger'));
|
||||
const logLevelClient = new LogLevelChannelClient(this.server.getChannel('logLevel', mainRouter));
|
||||
const loggerService = new LoggerChannelClient(this.configuration.logLevel, logLevelClient.onDidChangeLogLevel, mainProcessService.getChannel('logger'));
|
||||
services.set(ILoggerService, loggerService);
|
||||
|
||||
// Log
|
||||
const logLevelClient = new LogLevelChannelClient(this.server.getChannel('logLevel', mainRouter)); // we only use this for log levels
|
||||
const multiplexLogger = this._register(new MultiplexLogService([
|
||||
this._register(new ConsoleLogger(this.configuration.logLevel)),
|
||||
this._register(loggerService.createLogger(joinPath(URI.file(environmentService.logsPath), 'sharedprocess.log'), { name: 'sharedprocess' }))
|
||||
|
|
|
@ -70,13 +70,15 @@
|
|||
//#region Helpers
|
||||
|
||||
/**
|
||||
* @typedef {import('../../../platform/windows/common/windows').INativeWindowConfiguration} INativeWindowConfiguration
|
||||
*
|
||||
* @returns {{
|
||||
* load: (
|
||||
* modules: string[],
|
||||
* resultCallback: (result, configuration: import('../../../platform/windows/common/windows').INativeWindowConfiguration) => unknown,
|
||||
* resultCallback: (result, configuration: INativeWindowConfiguration) => unknown,
|
||||
* options?: {
|
||||
* configureDeveloperKeybindings?: (config: import('../../../platform/windows/common/windows').INativeWindowConfiguration & object) => {forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean},
|
||||
* canModifyDOM?: (config: import('../../../platform/windows/common/windows').INativeWindowConfiguration & object) => void,
|
||||
* configureDeveloperKeybindings?: (config: INativeWindowConfiguration & object) => {forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean},
|
||||
* canModifyDOM?: (config: INativeWindowConfiguration & object) => void,
|
||||
* beforeLoaderConfig?: (loaderConfig: object) => void,
|
||||
* beforeRequire?: () => void
|
||||
* }
|
||||
|
|
|
@ -71,7 +71,7 @@ import { withNullAsUndefined } from 'vs/base/common/types';
|
|||
import { mnemonicButtonLabel, getPathLabel } from 'vs/base/common/labels';
|
||||
import { WebviewMainService } from 'vs/platform/webview/electron-main/webviewMainService';
|
||||
import { IWebviewManagerService } from 'vs/platform/webview/common/webviewManagerService';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { FileOperationError, FileOperationResult, IFileService } from 'vs/platform/files/common/files';
|
||||
import { stripComments } from 'vs/base/common/json';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
|
@ -281,71 +281,73 @@ export class CodeApplication extends Disposable {
|
|||
//#region Bootstrap IPC Handlers
|
||||
|
||||
let slowShellResolveWarningShown = false;
|
||||
ipcMain.on('vscode:fetchShellEnv', async event => {
|
||||
ipcMain.handle('vscode:fetchShellEnv', event => {
|
||||
return new Promise(async resolve => {
|
||||
|
||||
// DO NOT remove: not only usual windows are fetching the
|
||||
// shell environment but also shared process, issue reporter
|
||||
// etc, so we need to reply via `webContents` always
|
||||
const webContents = event.sender;
|
||||
// DO NOT remove: not only usual windows are fetching the
|
||||
// shell environment but also shared process, issue reporter
|
||||
// etc, so we need to reply via `webContents` always
|
||||
const webContents = event.sender;
|
||||
|
||||
let replied = false;
|
||||
let replied = false;
|
||||
|
||||
function acceptShellEnv(env: IProcessEnvironment): void {
|
||||
clearTimeout(shellEnvSlowWarningHandle);
|
||||
clearTimeout(shellEnvTimeoutErrorHandle);
|
||||
function acceptShellEnv(env: IProcessEnvironment): void {
|
||||
clearTimeout(shellEnvSlowWarningHandle);
|
||||
clearTimeout(shellEnvTimeoutErrorHandle);
|
||||
|
||||
if (!replied) {
|
||||
replied = true;
|
||||
if (!replied) {
|
||||
replied = true;
|
||||
|
||||
if (!webContents.isDestroyed()) {
|
||||
webContents.send('vscode:acceptShellEnv', env);
|
||||
if (!webContents.isDestroyed()) {
|
||||
resolve(env);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle slow shell environment resolve calls:
|
||||
// - a warning after 3s but continue to resolve (only once in active window)
|
||||
// - an error after 10s and stop trying to resolve (in every window where this happens)
|
||||
const cts = new CancellationTokenSource();
|
||||
// Handle slow shell environment resolve calls:
|
||||
// - a warning after 3s but continue to resolve (only once in active window)
|
||||
// - an error after 10s and stop trying to resolve (in every window where this happens)
|
||||
const cts = new CancellationTokenSource();
|
||||
|
||||
const shellEnvSlowWarningHandle = setTimeout(() => {
|
||||
if (!slowShellResolveWarningShown) {
|
||||
this.windowsMainService?.sendToFocused('vscode:showShellEnvSlowWarning', cts.token);
|
||||
slowShellResolveWarningShown = true;
|
||||
const shellEnvSlowWarningHandle = setTimeout(() => {
|
||||
if (!slowShellResolveWarningShown) {
|
||||
this.windowsMainService?.sendToFocused('vscode:showShellEnvSlowWarning', cts.token);
|
||||
slowShellResolveWarningShown = true;
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
const window = this.windowsMainService?.getWindowByWebContents(event.sender); // Note: this can be `undefined` for the shared process!!
|
||||
const shellEnvTimeoutErrorHandle = setTimeout(() => {
|
||||
cts.dispose(true);
|
||||
window?.sendWhenReady('vscode:showShellEnvTimeoutError', CancellationToken.None);
|
||||
acceptShellEnv({});
|
||||
}, 10000);
|
||||
|
||||
// Prefer to use the args and env from the target window
|
||||
// when resolving the shell env. It is possible that
|
||||
// a first window was opened from the UI but a second
|
||||
// from the CLI and that has implications for whether to
|
||||
// resolve the shell environment or not.
|
||||
//
|
||||
// Window can be undefined for e.g. the shared process
|
||||
// that is not part of our windows registry!
|
||||
let args: NativeParsedArgs;
|
||||
let env: IProcessEnvironment;
|
||||
if (window?.config) {
|
||||
args = window.config;
|
||||
env = { ...process.env, ...window.config.userEnv };
|
||||
} else {
|
||||
args = this.environmentMainService.args;
|
||||
env = process.env;
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
const window = this.windowsMainService?.getWindowByWebContents(event.sender); // Note: this can be `undefined` for the shared process!!
|
||||
const shellEnvTimeoutErrorHandle = setTimeout(() => {
|
||||
cts.dispose(true);
|
||||
window?.sendWhenReady('vscode:showShellEnvTimeoutError', CancellationToken.None);
|
||||
acceptShellEnv({});
|
||||
}, 10000);
|
||||
|
||||
// Prefer to use the args and env from the target window
|
||||
// when resolving the shell env. It is possible that
|
||||
// a first window was opened from the UI but a second
|
||||
// from the CLI and that has implications for whether to
|
||||
// resolve the shell environment or not.
|
||||
//
|
||||
// Window can be undefined for e.g. the shared process
|
||||
// that is not part of our windows registry!
|
||||
let args: NativeParsedArgs;
|
||||
let env: IProcessEnvironment;
|
||||
if (window?.config) {
|
||||
args = window.config;
|
||||
env = { ...process.env, ...window.config.userEnv };
|
||||
} else {
|
||||
args = this.environmentMainService.args;
|
||||
env = process.env;
|
||||
}
|
||||
|
||||
// Resolve shell env
|
||||
const shellEnv = await resolveShellEnv(this.logService, args, env);
|
||||
acceptShellEnv(shellEnv);
|
||||
// Resolve shell env
|
||||
const shellEnv = await resolveShellEnv(this.logService, args, env);
|
||||
acceptShellEnv(shellEnv);
|
||||
});
|
||||
});
|
||||
|
||||
ipcMain.handle('vscode:writeNlsFile', async (event, path: unknown, data: unknown) => {
|
||||
ipcMain.handle('vscode:writeNlsFile', (event, path: unknown, data: unknown) => {
|
||||
const uri = this.validateNlsPath([path]);
|
||||
if (!uri || typeof data !== 'string') {
|
||||
throw new Error('Invalid operation (vscode:writeNlsFile)');
|
||||
|
@ -415,6 +417,18 @@ export class CodeApplication extends Disposable {
|
|||
this.logService.debug(`from: ${this.environmentMainService.appRoot}`);
|
||||
this.logService.debug('args:', this.environmentMainService.args);
|
||||
|
||||
// TODO@bpasero TODO@deepak1556 workaround for #120655
|
||||
try {
|
||||
const cachedDataPath = URI.file(this.environmentMainService.chromeCachedDataDir);
|
||||
this.logService.trace(`Deleting Chrome cached data path: ${cachedDataPath.fsPath}`);
|
||||
|
||||
await this.fileService.del(cachedDataPath, { recursive: true });
|
||||
} catch (error) {
|
||||
if ((<FileOperationError>error).fileOperationResult !== FileOperationResult.FILE_NOT_FOUND) {
|
||||
this.logService.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we associate the program with the app user model id
|
||||
// This will help Windows to associate the running program with
|
||||
// any shortcut that is pinned to the taskbar and prevent showing
|
||||
|
@ -549,7 +563,7 @@ export class CodeApplication extends Disposable {
|
|||
services.set(IDiagnosticsService, ProxyChannel.toService(getDelayedChannel(sharedProcessReady.then(client => client.getChannel('diagnostics')))));
|
||||
|
||||
// Issues
|
||||
services.set(IIssueMainService, new SyncDescriptor(IssueMainService, [machineId, this.userEnv]));
|
||||
services.set(IIssueMainService, new SyncDescriptor(IssueMainService, [this.userEnv]));
|
||||
|
||||
// Encryption
|
||||
services.set(IEncryptionMainService, new SyncDescriptor(EncryptionMainService, [machineId]));
|
||||
|
|
|
@ -24,13 +24,15 @@
|
|||
);
|
||||
|
||||
/**
|
||||
* @typedef {import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration} ISandboxConfiguration
|
||||
*
|
||||
* @returns {{
|
||||
* load: (
|
||||
* modules: string[],
|
||||
* resultCallback: (result, configuration: import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => unknown,
|
||||
* resultCallback: (result, configuration: ISandboxConfiguration) => unknown,
|
||||
* options?: {
|
||||
* configureDeveloperKeybindings?: (config: import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => {forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean},
|
||||
* canModifyDOM?: (config: import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => void,
|
||||
* configureDeveloperKeybindings?: (config: ISandboxConfiguration) => {forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean},
|
||||
* canModifyDOM?: (config: ISandboxConfiguration) => void,
|
||||
* beforeLoaderConfig?: (loaderConfig: object) => void,
|
||||
* beforeRequire?: () => void
|
||||
* }
|
||||
|
|
|
@ -11,10 +11,10 @@ import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
|||
import { applyZoom, zoomIn, zoomOut } from 'vs/platform/windows/electron-sandbox/window';
|
||||
import { $, reset, safeInnerHtml, windowOpenNoOpener } from 'vs/base/browser/dom';
|
||||
import { Button } from 'vs/base/browser/ui/button/button';
|
||||
import * as collections from 'vs/base/common/collections';
|
||||
import { groupBy } from 'vs/base/common/collections';
|
||||
import { debounce } from 'vs/base/common/decorators';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { isWindows, isLinux, isLinuxSnap, isMacintosh } from 'vs/base/common/platform';
|
||||
import { escape } from 'vs/base/common/strings';
|
||||
import { normalizeGitHubUrl } from 'vs/platform/issue/common/issueReporterUtil';
|
||||
import { IssueReporterData as IssueReporterModelData, IssueReporterModel } from 'vs/code/electron-sandbox/issue/issueReporterModel';
|
||||
|
@ -23,8 +23,7 @@ import { localize } from 'vs/nls';
|
|||
import { isRemoteDiagnosticError, SystemInfo } from 'vs/platform/diagnostics/common/diagnostics';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/services';
|
||||
import { IssueReporterData, IssueReporterExtensionData, IssueReporterFeatures, IssueReporterStyles, IssueType } from 'vs/platform/issue/common/issue';
|
||||
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
|
||||
import { IssueReporterWindowConfiguration, IssueReporterData, IssueReporterExtensionData, IssueReporterStyles, IssueType } from 'vs/platform/issue/common/issue';
|
||||
import { Codicon } from 'vs/base/common/codicons';
|
||||
import { renderIcon } from 'vs/base/browser/ui/iconLabel/iconLabels';
|
||||
import { ElectronIPCMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService';
|
||||
|
@ -43,28 +42,8 @@ enum IssueSource {
|
|||
Marketplace = 'marketplace'
|
||||
}
|
||||
|
||||
export interface IssueReporterConfiguration extends IWindowConfiguration {
|
||||
windowId: number;
|
||||
disableExtensions: boolean;
|
||||
data: IssueReporterData;
|
||||
features: IssueReporterFeatures;
|
||||
os: {
|
||||
type: string;
|
||||
arch: string;
|
||||
release: string;
|
||||
},
|
||||
product: {
|
||||
nameShort: string;
|
||||
version: string;
|
||||
commit: string | undefined;
|
||||
date: string | undefined;
|
||||
reportIssueUrl: string | undefined;
|
||||
reportMarketplaceIssueUrl: string | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export function startup(configuration: IssueReporterConfiguration) {
|
||||
const platformClass = platform.isWindows ? 'windows' : platform.isLinux ? 'linux' : 'mac';
|
||||
export function startup(configuration: IssueReporterWindowConfiguration) {
|
||||
const platformClass = isWindows ? 'windows' : isLinux ? 'linux' : 'mac';
|
||||
document.body.classList.add(platformClass); // used by our fonts
|
||||
|
||||
safeInnerHtml(document.body, BaseHtml());
|
||||
|
@ -86,7 +65,7 @@ export class IssueReporter extends Disposable {
|
|||
|
||||
private readonly previewButton!: Button;
|
||||
|
||||
constructor(private readonly configuration: IssueReporterConfiguration) {
|
||||
constructor(private readonly configuration: IssueReporterWindowConfiguration) {
|
||||
super();
|
||||
|
||||
this.initServices(configuration);
|
||||
|
@ -95,8 +74,8 @@ export class IssueReporter extends Disposable {
|
|||
this.issueReporterModel = new IssueReporterModel({
|
||||
issueType: configuration.data.issueType || IssueType.Bug,
|
||||
versionInfo: {
|
||||
vscodeVersion: `${configuration.product.nameShort} ${configuration.product.version} (${configuration.product.commit || 'Commit unknown'}, ${configuration.product.date || 'Date unknown'})`,
|
||||
os: `${this.configuration.os.type} ${this.configuration.os.arch} ${this.configuration.os.release}${platform.isLinuxSnap ? ' snap' : ''}`
|
||||
vscodeVersion: `${configuration.product.nameShort} ${!!configuration.product.darwinUniversalAssetId ? `${configuration.product.version} (Universal)` : configuration.product.version} (${configuration.product.commit || 'Commit unknown'}, ${configuration.product.date || 'Date unknown'})`,
|
||||
os: `${this.configuration.os.type} ${this.configuration.os.arch} ${this.configuration.os.release}${isLinuxSnap ? ' snap' : ''}`
|
||||
},
|
||||
extensionsDisabled: !!configuration.disableExtensions,
|
||||
fileOnExtension: configuration.data.extensionId ? !targetExtension?.isBuiltin : undefined,
|
||||
|
@ -257,7 +236,7 @@ export class IssueReporter extends Disposable {
|
|||
|
||||
private handleExtensionData(extensions: IssueReporterExtensionData[]) {
|
||||
const installedExtensions = extensions.filter(x => !x.isBuiltin);
|
||||
const { nonThemes, themes } = collections.groupBy(installedExtensions, ext => {
|
||||
const { nonThemes, themes } = groupBy(installedExtensions, ext => {
|
||||
return ext.isTheme ? 'themes' : 'nonThemes';
|
||||
});
|
||||
|
||||
|
@ -272,7 +251,7 @@ export class IssueReporter extends Disposable {
|
|||
this.updateExtensionSelector(installedExtensions);
|
||||
}
|
||||
|
||||
private initServices(configuration: IssueReporterConfiguration): void {
|
||||
private initServices(configuration: IssueReporterWindowConfiguration): void {
|
||||
const serviceCollection = new ServiceCollection();
|
||||
const mainProcessService = new ElectronIPCMainProcessService(configuration.windowId);
|
||||
serviceCollection.set(IMainProcessService, mainProcessService);
|
||||
|
@ -400,7 +379,7 @@ export class IssueReporter extends Disposable {
|
|||
});
|
||||
|
||||
document.onkeydown = async (e: KeyboardEvent) => {
|
||||
const cmdOrCtrlKey = platform.isMacintosh ? e.metaKey : e.ctrlKey;
|
||||
const cmdOrCtrlKey = isMacintosh ? e.metaKey : e.ctrlKey;
|
||||
// Cmd/Ctrl+Enter previews issue and closes window
|
||||
if (cmdOrCtrlKey && e.keyCode === 13) {
|
||||
if (await this.createIssue()) {
|
||||
|
@ -434,7 +413,7 @@ export class IssueReporter extends Disposable {
|
|||
|
||||
// With latest electron upgrade, cmd+a is no longer propagating correctly for inputs in this window on mac
|
||||
// Manually perform the selection
|
||||
if (platform.isMacintosh) {
|
||||
if (isMacintosh) {
|
||||
if (cmdOrCtrlKey && e.keyCode === 65 && e.target) {
|
||||
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {
|
||||
(<HTMLInputElement>e.target).select();
|
||||
|
|
|
@ -21,13 +21,15 @@
|
|||
});
|
||||
|
||||
/**
|
||||
* @typedef {import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration} ISandboxConfiguration
|
||||
*
|
||||
* @returns {{
|
||||
* load: (
|
||||
* modules: string[],
|
||||
* resultCallback: (result, configuration: import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => unknown,
|
||||
* resultCallback: (result, configuration: ISandboxConfiguration) => unknown,
|
||||
* options?: {
|
||||
* configureDeveloperKeybindings?: (config: import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => {forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean},
|
||||
* canModifyDOM?: (config: import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration) => void,
|
||||
* configureDeveloperKeybindings?: (config: ISandboxConfiguration) => {forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean},
|
||||
* canModifyDOM?: (config: ISandboxConfiguration) => void,
|
||||
* beforeLoaderConfig?: (loaderConfig: object) => void,
|
||||
* beforeRequire?: () => void
|
||||
* }
|
||||
|
|
|
@ -9,13 +9,12 @@ import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
|
|||
import { NativeHostService } from 'vs/platform/native/electron-sandbox/nativeHostService';
|
||||
import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { localize } from 'vs/nls';
|
||||
import { ProcessExplorerStyles, ProcessExplorerData } from 'vs/platform/issue/common/issue';
|
||||
import { ProcessExplorerStyles, ProcessExplorerData, ProcessExplorerWindowConfiguration } from 'vs/platform/issue/common/issue';
|
||||
import { applyZoom, zoomIn, zoomOut } from 'vs/platform/windows/electron-sandbox/window';
|
||||
import { IContextMenuItem } from 'vs/base/parts/contextmenu/common/contextmenu';
|
||||
import { popup } from 'vs/base/parts/contextmenu/electron-sandbox/contextmenu';
|
||||
import { ProcessItem } from 'vs/base/common/processes';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { append, $ } from 'vs/base/browser/dom';
|
||||
import { isRemoteDiagnosticError, IRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics';
|
||||
import { ElectronIPCMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService';
|
||||
import { ByteSize } from 'vs/platform/files/common/files';
|
||||
|
@ -105,11 +104,11 @@ class ProcessHeaderTreeRenderer implements ITreeRenderer<ProcessInformation, voi
|
|||
templateId: string = 'header';
|
||||
renderTemplate(container: HTMLElement): IProcessItemTemplateData {
|
||||
const data = Object.create(null);
|
||||
const row = dom.append(container, dom.$('.row'));
|
||||
data.name = dom.append(row, dom.$('.nameLabel'));
|
||||
data.CPU = dom.append(row, dom.$('.cpu'));
|
||||
data.memory = dom.append(row, dom.$('.memory'));
|
||||
data.PID = dom.append(row, dom.$('.pid'));
|
||||
const row = append(container, $('.row'));
|
||||
data.name = append(row, $('.nameLabel'));
|
||||
data.CPU = append(row, $('.cpu'));
|
||||
data.memory = append(row, $('.memory'));
|
||||
data.PID = append(row, $('.pid'));
|
||||
return data;
|
||||
}
|
||||
renderElement(node: ITreeNode<ProcessInformation, void>, index: number, templateData: IProcessItemTemplateData, height: number | undefined): void {
|
||||
|
@ -128,8 +127,8 @@ class MachineRenderer implements ITreeRenderer<MachineProcessInformation, void,
|
|||
templateId: string = 'machine';
|
||||
renderTemplate(container: HTMLElement): IProcessRowTemplateData {
|
||||
const data = Object.create(null);
|
||||
const row = dom.append(container, dom.$('.row'));
|
||||
data.name = dom.append(row, dom.$('.nameLabel'));
|
||||
const row = append(container, $('.row'));
|
||||
data.name = append(row, $('.nameLabel'));
|
||||
return data;
|
||||
}
|
||||
renderElement(node: ITreeNode<MachineProcessInformation, void>, index: number, templateData: IProcessRowTemplateData, height: number | undefined): void {
|
||||
|
@ -144,8 +143,8 @@ class ErrorRenderer implements ITreeRenderer<IRemoteDiagnosticError, void, IProc
|
|||
templateId: string = 'error';
|
||||
renderTemplate(container: HTMLElement): IProcessRowTemplateData {
|
||||
const data = Object.create(null);
|
||||
const row = dom.append(container, dom.$('.row'));
|
||||
data.name = dom.append(row, dom.$('.nameLabel'));
|
||||
const row = append(container, $('.row'));
|
||||
data.name = append(row, $('.nameLabel'));
|
||||
return data;
|
||||
}
|
||||
renderElement(node: ITreeNode<IRemoteDiagnosticError, void>, index: number, templateData: IProcessRowTemplateData, height: number | undefined): void {
|
||||
|
@ -163,12 +162,12 @@ class ProcessRenderer implements ITreeRenderer<ProcessItem, void, IProcessItemTe
|
|||
templateId: string = 'process';
|
||||
renderTemplate(container: HTMLElement): IProcessItemTemplateData {
|
||||
const data = <IProcessItemTemplateData>Object.create(null);
|
||||
const row = dom.append(container, dom.$('.row'));
|
||||
const row = append(container, $('.row'));
|
||||
|
||||
data.name = dom.append(row, dom.$('.nameLabel'));
|
||||
data.CPU = dom.append(row, dom.$('.cpu'));
|
||||
data.memory = dom.append(row, dom.$('.memory'));
|
||||
data.PID = dom.append(row, dom.$('.pid'));
|
||||
data.name = append(row, $('.nameLabel'));
|
||||
data.CPU = append(row, $('.cpu'));
|
||||
data.memory = append(row, $('.memory'));
|
||||
data.PID = append(row, $('.pid'));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -226,8 +225,6 @@ class ProcessExplorer {
|
|||
|
||||
private mapPidToWindowTitle = new Map<number, string>();
|
||||
|
||||
private listeners = new DisposableStore();
|
||||
|
||||
private nativeHostService: INativeHostService;
|
||||
|
||||
private tree: DataTree<any, ProcessTree | MachineProcessInformation | ProcessItem | ProcessInformation | IRemoteDiagnosticError, any> | undefined;
|
||||
|
@ -277,7 +274,6 @@ class ProcessExplorer {
|
|||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
this.dispose();
|
||||
ipcRenderer.send('vscode:closeProcessExplorer');
|
||||
}
|
||||
|
||||
|
@ -477,16 +473,12 @@ class ProcessExplorer {
|
|||
}
|
||||
}, 200);
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
this.listeners.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
export function startup({ windowId, data }: { windowId: number, data: ProcessExplorerData }): void {
|
||||
const platformClass = data.platform === 'win32' ? 'windows' : data.platform === 'linux' ? 'linux' : 'mac';
|
||||
export function startup(configuration: ProcessExplorerWindowConfiguration): void {
|
||||
const platformClass = configuration.data.platform === 'win32' ? 'windows' : configuration.data.platform === 'linux' ? 'linux' : 'mac';
|
||||
document.body.classList.add(platformClass); // used by our fonts
|
||||
applyZoom(data.zoomLevel);
|
||||
applyZoom(configuration.data.zoomLevel);
|
||||
|
||||
new ProcessExplorer(windowId, data);
|
||||
new ProcessExplorer(configuration.windowId, configuration.data);
|
||||
}
|
||||
|
|
|
@ -70,13 +70,15 @@
|
|||
//#region Helpers
|
||||
|
||||
/**
|
||||
* @typedef {import('../../../platform/windows/common/windows').INativeWindowConfiguration} INativeWindowConfiguration
|
||||
*
|
||||
* @returns {{
|
||||
* load: (
|
||||
* modules: string[],
|
||||
* resultCallback: (result, configuration: import('../../../platform/windows/common/windows').INativeWindowConfiguration) => unknown,
|
||||
* resultCallback: (result, configuration: INativeWindowConfiguration) => unknown,
|
||||
* options?: {
|
||||
* configureDeveloperKeybindings?: (config: import('../../../platform/windows/common/windows').INativeWindowConfiguration & object) => {forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean},
|
||||
* canModifyDOM?: (config: import('../../../platform/windows/common/windows').INativeWindowConfiguration & object) => void,
|
||||
* configureDeveloperKeybindings?: (config: INativeWindowConfiguration & object) => {forceEnableDeveloperKeybindings?: boolean, disallowReloadKeybinding?: boolean, removeDeveloperKeybindingsAfterLoad?: boolean},
|
||||
* canModifyDOM?: (config: INativeWindowConfiguration & object) => void,
|
||||
* beforeLoaderConfig?: (loaderConfig: object) => void,
|
||||
* beforeRequire?: () => void
|
||||
* }
|
||||
|
|
|
@ -416,8 +416,8 @@ export class TextAreaHandler extends ViewPart {
|
|||
this._accessibilitySupport = options.get(EditorOption.accessibilitySupport);
|
||||
const accessibilityPageSize = options.get(EditorOption.accessibilityPageSize);
|
||||
if (this._accessibilitySupport === AccessibilitySupport.Enabled && accessibilityPageSize === EditorOptions.accessibilityPageSize.defaultValue) {
|
||||
// If a screen reader is attached and the default value is not set we shuold automatically increase the page size to 1000 for a better experience
|
||||
this._accessibilityPageSize = 1000;
|
||||
// If a screen reader is attached and the default value is not set we shuold automatically increase the page size to 500 for a better experience
|
||||
this._accessibilityPageSize = 500;
|
||||
} else {
|
||||
this._accessibilityPageSize = accessibilityPageSize;
|
||||
}
|
||||
|
|
|
@ -3895,8 +3895,8 @@ export const EditorOptions = {
|
|||
accessibilitySupport: register(new EditorAccessibilitySupport()),
|
||||
accessibilityPageSize: register(new EditorIntOption(EditorOption.accessibilityPageSize, 'accessibilityPageSize', 10, 1, Constants.MAX_SAFE_SMALL_INTEGER,
|
||||
{
|
||||
description: nls.localize('accessibilityPageSize', "Controls the number of lines in the editor that can be read out by a screen reader at once. When we detect a screen reader we automatically set the default to be 2000. Warning: this has a performance implication for numbers larger than the default."),
|
||||
deprecationMessage: nls.localize('accessibilityPageSize.deprecated', "This setting is deprecated, editor will automatically choose the accessibility page size when we detect a screen reader. 2000 lines will be the new default.")
|
||||
description: nls.localize('accessibilityPageSize', "Controls the number of lines in the editor that can be read out by a screen reader at once. When we detect a screen reader we automatically set the default to be 500. Warning: this has a performance implication for numbers larger than the default."),
|
||||
deprecationMessage: nls.localize('accessibilityPageSize.deprecated', "This setting is deprecated, editor will automatically choose the accessibility page size when we detect a screen reader. 500 lines will be the new default.")
|
||||
})),
|
||||
ariaLabel: register(new EditorStringOption(
|
||||
EditorOption.ariaLabel, 'ariaLabel', nls.localize('editorViewAccessibleLabel', "Editor content")
|
||||
|
|
|
@ -57,7 +57,7 @@ export class ModeServiceImpl extends Disposable implements IModeService {
|
|||
private readonly _onDidCreateMode = this._register(new Emitter<IMode>());
|
||||
public readonly onDidCreateMode: Event<IMode> = this._onDidCreateMode.event;
|
||||
|
||||
protected readonly _onLanguagesMaybeChanged = this._register(new Emitter<void>());
|
||||
protected readonly _onLanguagesMaybeChanged = this._register(new Emitter<void>({ leakWarningThreshold: 200 /* https://github.com/microsoft/vscode/issues/119968 */ }));
|
||||
public readonly onLanguagesMaybeChanged: Event<void> = this._onLanguagesMaybeChanged.event;
|
||||
|
||||
constructor(warnOnOverwrite = false) {
|
||||
|
|
|
@ -5,14 +5,12 @@
|
|||
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { onUnexpectedExternalError } from 'vs/base/common/errors';
|
||||
import { extUri } from 'vs/base/common/resources';
|
||||
import { registerModelAndPositionCommand } from 'vs/editor/browser/editorExtensions';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Location, LocationLink, DefinitionProviderRegistry, ImplementationProviderRegistry, TypeDefinitionProviderRegistry, DeclarationProviderRegistry, ProviderResult, ReferenceProviderRegistry } from 'vs/editor/common/modes';
|
||||
import { LocationLink, DefinitionProviderRegistry, ImplementationProviderRegistry, TypeDefinitionProviderRegistry, DeclarationProviderRegistry, ProviderResult, ReferenceProviderRegistry } from 'vs/editor/common/modes';
|
||||
import { LanguageFeatureRegistry } from 'vs/editor/common/modes/languageFeatureRegistry';
|
||||
|
||||
import { ReferencesModel } from 'vs/editor/contrib/gotoSymbol/referencesModel';
|
||||
|
||||
function getLocationLinks<T>(
|
||||
model: ITextModel,
|
||||
|
@ -39,12 +37,10 @@ function getLocationLinks<T>(
|
|||
result.push(value);
|
||||
}
|
||||
}
|
||||
|
||||
return sortAndDeduplicate(result);
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function getDefinitionsAtPosition(model: ITextModel, position: Position, token: CancellationToken): Promise<LocationLink[]> {
|
||||
return getLocationLinks(model, position, DefinitionProviderRegistry, (provider, model, position) => {
|
||||
return provider.provideDefinition(model, position, token);
|
||||
|
@ -83,24 +79,18 @@ export function getReferencesAtPosition(model: ITextModel, position: Position, c
|
|||
});
|
||||
}
|
||||
|
||||
export function sortAndDeduplicate(locations: Location[]): Location[] {
|
||||
const result: LocationLink[] = [];
|
||||
let last: LocationLink | undefined;
|
||||
for (const link of locations.sort(compareLocations)) {
|
||||
if (last === undefined || compareLocations(last, link) !== 0) {
|
||||
result.push(link);
|
||||
last = link;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
// -- API commands ----
|
||||
|
||||
async function _sortedAndDeduped(callback: () => Promise<LocationLink[]>): Promise<LocationLink[]> {
|
||||
const rawLinks = await callback();
|
||||
const model = new ReferencesModel(rawLinks, '');
|
||||
const modelLinks = model.references.map(ref => ref.link);
|
||||
model.dispose();
|
||||
return modelLinks;
|
||||
}
|
||||
|
||||
function compareLocations(a: Location, b: Location): number {
|
||||
return extUri.compare(a.uri, b.uri) || Range.compareRangesUsingStarts(a.range, b.range);
|
||||
}
|
||||
|
||||
registerModelAndPositionCommand('_executeDefinitionProvider', (model, position) => getDefinitionsAtPosition(model, position, CancellationToken.None));
|
||||
registerModelAndPositionCommand('_executeDeclarationProvider', (model, position) => getDeclarationsAtPosition(model, position, CancellationToken.None));
|
||||
registerModelAndPositionCommand('_executeImplementationProvider', (model, position) => getImplementationsAtPosition(model, position, CancellationToken.None));
|
||||
registerModelAndPositionCommand('_executeTypeDefinitionProvider', (model, position) => getTypeDefinitionsAtPosition(model, position, CancellationToken.None));
|
||||
registerModelAndPositionCommand('_executeReferenceProvider', (model, position) => getReferencesAtPosition(model, position, false, CancellationToken.None));
|
||||
registerModelAndPositionCommand('_executeDefinitionProvider', (model, position) => _sortedAndDeduped(() => getDefinitionsAtPosition(model, position, CancellationToken.None)));
|
||||
registerModelAndPositionCommand('_executeDeclarationProvider', (model, position) => _sortedAndDeduped(() => getDeclarationsAtPosition(model, position, CancellationToken.None)));
|
||||
registerModelAndPositionCommand('_executeImplementationProvider', (model, position) => _sortedAndDeduped(() => getImplementationsAtPosition(model, position, CancellationToken.None)));
|
||||
registerModelAndPositionCommand('_executeTypeDefinitionProvider', (model, position) => _sortedAndDeduped(() => getTypeDefinitionsAtPosition(model, position, CancellationToken.None)));
|
||||
registerModelAndPositionCommand('_executeReferenceProvider', (model, position) => _sortedAndDeduped(() => getReferencesAtPosition(model, position, false, CancellationToken.None)));
|
||||
|
|
|
@ -11,7 +11,7 @@ import * as strings from 'vs/base/common/strings';
|
|||
import { URI } from 'vs/base/common/uri';
|
||||
import { defaultGenerator } from 'vs/base/common/idGenerator';
|
||||
import { Range, IRange } from 'vs/editor/common/core/range';
|
||||
import { LocationLink } from 'vs/editor/common/modes';
|
||||
import { Location, LocationLink } from 'vs/editor/common/modes';
|
||||
import { ITextModelService, ITextEditorModel } from 'vs/editor/common/services/resolverService';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { IMatch } from 'vs/base/common/filters';
|
||||
|
@ -19,22 +19,25 @@ import { Constants } from 'vs/base/common/uint';
|
|||
import { ResourceMap } from 'vs/base/common/map';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
|
||||
import { sortAndDeduplicate } from './goToSymbol';
|
||||
|
||||
export class OneReference {
|
||||
|
||||
readonly id: string = defaultGenerator.nextId();
|
||||
|
||||
private _range?: IRange;
|
||||
|
||||
constructor(
|
||||
readonly isProviderFirst: boolean,
|
||||
readonly parent: FileReferences,
|
||||
readonly uri: URI,
|
||||
private _range: IRange,
|
||||
readonly link: LocationLink,
|
||||
private _rangeCallback: (ref: OneReference) => void
|
||||
) { }
|
||||
|
||||
get uri() {
|
||||
return this.link.uri;
|
||||
}
|
||||
|
||||
get range(): IRange {
|
||||
return this._range;
|
||||
return this._range ?? this.link.targetSelectionRange ?? this.link.range;
|
||||
}
|
||||
|
||||
set range(value: IRange) {
|
||||
|
@ -156,9 +159,9 @@ export class ReferencesModel implements IDisposable {
|
|||
this._links = links;
|
||||
this._title = title;
|
||||
|
||||
// grouping, sorting, and de-duplicating
|
||||
// grouping and sorting
|
||||
const [providersFirst] = links;
|
||||
links = sortAndDeduplicate(links);
|
||||
links.sort(ReferencesModel._compareReferences);
|
||||
|
||||
let current: FileReferences | undefined;
|
||||
for (let link of links) {
|
||||
|
@ -168,15 +171,18 @@ export class ReferencesModel implements IDisposable {
|
|||
this.groups.push(current);
|
||||
}
|
||||
|
||||
const oneRef = new OneReference(
|
||||
providersFirst === link,
|
||||
current,
|
||||
link.uri,
|
||||
link.targetSelectionRange || link.range,
|
||||
ref => this._onDidChangeReferenceRange.fire(ref)
|
||||
);
|
||||
this.references.push(oneRef);
|
||||
current.children.push(oneRef);
|
||||
// append, check for equality first!
|
||||
if (current.children.length === 0 || ReferencesModel._compareReferences(link, current.children[current.children.length - 1]) !== 0) {
|
||||
|
||||
const oneRef = new OneReference(
|
||||
providersFirst === link,
|
||||
current,
|
||||
link,
|
||||
ref => this._onDidChangeReferenceRange.fire(ref)
|
||||
);
|
||||
this.references.push(oneRef);
|
||||
current.children.push(oneRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -285,4 +291,8 @@ export class ReferencesModel implements IDisposable {
|
|||
}
|
||||
return this.references[0];
|
||||
}
|
||||
|
||||
private static _compareReferences(a: Location, b: Location): number {
|
||||
return extUri.compare(a.uri, b.uri) || Range.compareRangesUsingStarts(a.range, b.range);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,23 +55,6 @@
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
.monaco-editor .peekview-widget .head .peekview-actions > .monaco-action-bar .action-item {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.monaco-editor .peekview-widget .head .peekview-actions > .monaco-action-bar .action-label {
|
||||
width: 16px;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
line-height: inherit;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
||||
|
||||
.monaco-editor .peekview-widget .head .peekview-actions > .monaco-action-bar .action-label.codicon {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.monaco-editor .peekview-widget > .body {
|
||||
border-top: 1px solid;
|
||||
position: relative;
|
||||
|
|
|
@ -3,6 +3,13 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.monaco-action-bar .action-item.menu-entry .action-label.icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 50%;
|
||||
}
|
||||
|
||||
.monaco-action-bar .action-item.menu-entry .action-label {
|
||||
background-image: var(--menu-entry-icon-light);
|
||||
}
|
||||
|
|
|
@ -25,9 +25,12 @@ export interface IEnvironmentMainService extends INativeEnvironmentService {
|
|||
backupHome: string;
|
||||
backupWorkspacesPath: string;
|
||||
|
||||
// --- V8 script cache path
|
||||
// --- V8 script cache path (ours)
|
||||
nodeCachedDataDir?: string;
|
||||
|
||||
// --- V8 script cache path (chrome)
|
||||
chromeCachedDataDir: string;
|
||||
|
||||
// --- IPC
|
||||
mainIPCHandle: string;
|
||||
|
||||
|
@ -66,4 +69,7 @@ export class EnvironmentMainService extends NativeEnvironmentService implements
|
|||
|
||||
@memoize
|
||||
get nodeCachedDataDir(): string | undefined { return process.env['VSCODE_NODE_CACHED_DATA_DIR'] || undefined; }
|
||||
|
||||
@memoize
|
||||
get chromeCachedDataDir(): string { return join(this.userDataPath, 'Code Cache'); }
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
'use strict';
|
||||
|
||||
/**
|
||||
* @typedef {import('../../environment/common/argv').NativeParsedArgs} NativeParsedArgs
|
||||
*
|
||||
* @param {typeof import('path')} path
|
||||
* @param {typeof import('os')} os
|
||||
* @param {string} productName
|
||||
|
@ -17,7 +19,7 @@
|
|||
function factory(path, os, productName) {
|
||||
|
||||
/**
|
||||
* @param {import('../../environment/common/argv').NativeParsedArgs} cliArgs
|
||||
* @param {NativeParsedArgs} cliArgs
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
|
@ -26,7 +28,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {import('../../environment/common/argv').NativeParsedArgs} cliArgs
|
||||
* @param {NativeParsedArgs} cliArgs
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
|
|
|
@ -133,7 +133,7 @@ export class ExtensionManagementCLIService implements IExtensionManagementCLISer
|
|||
if (vsixs.length) {
|
||||
await Promise.all(vsixs.map(async vsix => {
|
||||
try {
|
||||
const manifest = await this.installVSIX(vsix, force, output);
|
||||
const manifest = await this.installVSIX(vsix, { isBuiltin: false, isMachineScoped }, force, output);
|
||||
if (manifest) {
|
||||
installedExtensionsManifests.push(manifest);
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ export class ExtensionManagementCLIService implements IExtensionManagementCLISer
|
|||
}
|
||||
}
|
||||
|
||||
private async installVSIX(vsix: URI, force: boolean, output: CLIOutput): Promise<IExtensionManifest | null> {
|
||||
private async installVSIX(vsix: URI, installOptions: InstallOptions, force: boolean, output: CLIOutput): Promise<IExtensionManifest | null> {
|
||||
|
||||
const manifest = await this.extensionManagementService.getManifest(vsix);
|
||||
if (!manifest) {
|
||||
|
@ -183,7 +183,7 @@ export class ExtensionManagementCLIService implements IExtensionManagementCLISer
|
|||
const valid = await this.validateVSIX(manifest, force, output);
|
||||
if (valid) {
|
||||
try {
|
||||
await this.extensionManagementService.install(vsix);
|
||||
await this.extensionManagementService.install(vsix, installOptions);
|
||||
output.log(localize('successVsixInstall', "Extension '{0}' was successfully installed.", getBaseLabel(vsix)));
|
||||
return manifest;
|
||||
} catch (error) {
|
||||
|
|
|
@ -388,12 +388,11 @@ export class ExtensionManagementService extends Disposable implements IExtension
|
|||
publisherDisplayName: extension.publisherDisplayName,
|
||||
};
|
||||
|
||||
let zipPath;
|
||||
let zipPath: string | undefined;
|
||||
try {
|
||||
this.logService.trace('Started downloading extension:', extension.identifier.id);
|
||||
const zip = await this.extensionsDownloader.downloadExtension(extension, operation);
|
||||
zipPath = (await this.extensionsDownloader.downloadExtension(extension, operation)).fsPath;
|
||||
this.logService.info('Downloaded extension:', extension.identifier.id, zipPath);
|
||||
zipPath = zip.fsPath;
|
||||
} catch (error) {
|
||||
throw new ExtensionManagementError(this.joinErrors(error).message, INSTALL_ERROR_DOWNLOADING);
|
||||
}
|
||||
|
|
|
@ -158,8 +158,8 @@ export interface IExtensionContributions {
|
|||
}
|
||||
|
||||
export type ExtensionKind = 'ui' | 'workspace' | 'web';
|
||||
export type ExtensionWorkspaceTrustRequirement = false | 'onStart' | 'onDemand';
|
||||
export type ExtensionWorkspaceTrust = { required: ExtensionWorkspaceTrustRequirement, description?: string };
|
||||
export type ExtensionWorkspaceTrustRequestType = 'never' | 'onStart' | 'onDemand';
|
||||
export type ExtensionWorkspaceTrust = { request: 'never'; } | { request: 'onStart' | 'onDemand', description: string };
|
||||
|
||||
export function isIExtensionIdentifier(thing: any): thing is IExtensionIdentifier {
|
||||
return thing
|
||||
|
@ -307,13 +307,13 @@ export function isAuthenticaionProviderExtension(manifest: IExtensionManifest):
|
|||
return manifest.contributes && manifest.contributes.authentication ? manifest.contributes.authentication.length > 0 : false;
|
||||
}
|
||||
|
||||
export function getExtensionWorkspaceTrustRequirement(manifest: IExtensionManifest): ExtensionWorkspaceTrustRequirement {
|
||||
if (manifest.workspaceTrust?.required !== undefined) {
|
||||
return manifest.workspaceTrust.required;
|
||||
export function getExtensionWorkspaceTrustRequestType(manifest: IExtensionManifest): ExtensionWorkspaceTrustRequestType {
|
||||
if (manifest.workspaceTrust?.request !== undefined) {
|
||||
return manifest.workspaceTrust.request;
|
||||
}
|
||||
|
||||
if (!manifest.main) {
|
||||
return false;
|
||||
return 'never';
|
||||
}
|
||||
|
||||
return 'onStart';
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ISandboxConfiguration } from 'vs/base/parts/sandbox/common/sandboxTypes';
|
||||
|
||||
// Since data sent through the service is serialized to JSON, functions will be lost, so Color objects
|
||||
// should not be sent as their 'toString' method will be stripped. Instead convert to strings before sending.
|
||||
export interface WindowStyles {
|
||||
|
@ -67,9 +69,6 @@ export interface ISettingSearchResult {
|
|||
score: number;
|
||||
}
|
||||
|
||||
export interface IssueReporterFeatures {
|
||||
}
|
||||
|
||||
export interface ProcessExplorerStyles extends WindowStyles {
|
||||
hoverBackground?: string;
|
||||
hoverForeground?: string;
|
||||
|
@ -88,3 +87,17 @@ export interface ICommonIssueService {
|
|||
openProcessExplorer(data: ProcessExplorerData): Promise<void>;
|
||||
getSystemStatus(): Promise<string>;
|
||||
}
|
||||
|
||||
export interface IssueReporterWindowConfiguration extends ISandboxConfiguration {
|
||||
disableExtensions: boolean;
|
||||
data: IssueReporterData;
|
||||
os: {
|
||||
type: string;
|
||||
arch: string;
|
||||
release: string;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ProcessExplorerWindowConfiguration extends ISandboxConfiguration {
|
||||
data: ProcessExplorerData;
|
||||
}
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
|
||||
import { localize } from 'vs/nls';
|
||||
import { arch, release, type } from 'os';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { ICommonIssueService, IssueReporterData, ProcessExplorerData } from 'vs/platform/issue/common/issue';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { ICommonIssueService, IssueReporterWindowConfiguration, IssueReporterData, ProcessExplorerData, ProcessExplorerWindowConfiguration } from 'vs/platform/issue/common/issue';
|
||||
import { BrowserWindow, ipcMain, screen, IpcMainEvent, Display } from 'electron';
|
||||
import { ILaunchMainService } from 'vs/platform/launch/electron-main/launchMainService';
|
||||
import { IDiagnosticsService, PerformanceInfo, isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics';
|
||||
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
|
||||
import { isMacintosh, IProcessEnvironment } from 'vs/base/common/platform';
|
||||
import { isMacintosh, IProcessEnvironment, browserCodeLoadingCacheStrategy } from 'vs/base/common/platform';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IWindowState } from 'vs/platform/windows/electron-main/windows';
|
||||
import { listProcesses } from 'vs/base/node/ps';
|
||||
|
@ -22,7 +22,6 @@ import { FileAccess } from 'vs/base/common/network';
|
|||
import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService';
|
||||
import { IIPCObjectUrl, IProtocolMainService } from 'vs/platform/protocol/electron-main/protocol';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { ISandboxConfiguration } from 'vs/base/parts/sandbox/common/sandboxTypes';
|
||||
|
||||
export const IIssueMainService = createDecorator<IIssueMainService>('issueMainService');
|
||||
|
||||
|
@ -41,7 +40,6 @@ export class IssueMainService implements ICommonIssueService {
|
|||
private processExplorerParentWindow: BrowserWindow | null = null;
|
||||
|
||||
constructor(
|
||||
private machineId: string,
|
||||
private userEnv: IProcessEnvironment,
|
||||
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService,
|
||||
@ILaunchMainService private readonly launchMainService: ILaunchMainService,
|
||||
|
@ -49,7 +47,6 @@ export class IssueMainService implements ICommonIssueService {
|
|||
@IDiagnosticsService private readonly diagnosticsService: IDiagnosticsService,
|
||||
@IDialogMainService private readonly dialogMainService: IDialogMainService,
|
||||
@INativeHostMainService private readonly nativeHostMainService: INativeHostMainService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@IProtocolMainService private readonly protocolMainService: IProtocolMainService
|
||||
) {
|
||||
this.registerListeners();
|
||||
|
@ -189,39 +186,25 @@ export class IssueMainService implements ICommonIssueService {
|
|||
if (this.issueReporterParentWindow) {
|
||||
const issueReporterDisposables = new DisposableStore();
|
||||
|
||||
const configuration = {
|
||||
const issueReporterWindowConfigUrl = issueReporterDisposables.add(this.protocolMainService.createIPCObjectUrl<IssueReporterWindowConfiguration>());
|
||||
const position = this.getWindowPosition(this.issueReporterParentWindow, 700, 800);
|
||||
|
||||
this.issueReporterWindow = this.createBrowserWindow(position, issueReporterWindowConfigUrl, data.styles.backgroundColor, localize('issueReporter', "Issue Reporter"), data.zoomLevel);
|
||||
|
||||
// Store into config object URL
|
||||
issueReporterWindowConfigUrl.update({
|
||||
appRoot: this.environmentMainService.appRoot,
|
||||
windowId: 0, // filled in later
|
||||
machineId: this.machineId,
|
||||
windowId: this.issueReporterWindow.id,
|
||||
userEnv: this.userEnv,
|
||||
data,
|
||||
features: {},
|
||||
disableExtensions: this.environmentMainService.disableExtensions,
|
||||
disableExtensions: !!this.environmentMainService.disableExtensions,
|
||||
os: {
|
||||
type: type(),
|
||||
arch: arch(),
|
||||
release: release(),
|
||||
},
|
||||
product: {
|
||||
nameShort: this.productService.nameShort,
|
||||
version: !!this.productService.darwinUniversalAssetId ? `${this.productService.version} (Universal)` : this.productService.version,
|
||||
commit: this.productService.commit,
|
||||
date: this.productService.date,
|
||||
reportIssueUrl: this.productService.reportIssueUrl,
|
||||
reportMarketplaceIssueUrl: this.productService.reportMarketplaceIssueUrl
|
||||
}
|
||||
};
|
||||
|
||||
interface IIssueReporterWindowConfig extends ISandboxConfiguration, Extract<typeof configuration, any> { }
|
||||
|
||||
const issueReporterWindowConfigUrl = issueReporterDisposables.add(this.protocolMainService.createIPCObjectUrl<IIssueReporterWindowConfig>());
|
||||
const position = this.getWindowPosition(this.issueReporterParentWindow, 700, 800);
|
||||
|
||||
this.issueReporterWindow = this.createBrowserWindow(position, issueReporterWindowConfigUrl, data.styles.backgroundColor, localize('issueReporter', "Issue Reporter"), data.zoomLevel);
|
||||
configuration.windowId = this.issueReporterWindow.id;
|
||||
|
||||
// Store into config object URL
|
||||
issueReporterWindowConfigUrl.update(configuration);
|
||||
product
|
||||
});
|
||||
|
||||
this.issueReporterWindow.loadURL(
|
||||
FileAccess.asBrowserUri('vs/code/electron-sandbox/issue/issueReporter.html', require, true).toString(true)
|
||||
|
@ -253,24 +236,19 @@ export class IssueMainService implements ICommonIssueService {
|
|||
if (this.processExplorerParentWindow) {
|
||||
const processExplorerDisposables = new DisposableStore();
|
||||
|
||||
const configuration = {
|
||||
appRoot: this.environmentMainService.appRoot,
|
||||
windowId: 0, // filled in later
|
||||
userEnv: this.userEnv,
|
||||
machineId: this.machineId,
|
||||
data
|
||||
};
|
||||
|
||||
interface IProcessExplorerWindowConfig extends ISandboxConfiguration, Extract<typeof configuration, any> { }
|
||||
|
||||
const processExplorerWindowConfigUrl = processExplorerDisposables.add(this.protocolMainService.createIPCObjectUrl<IProcessExplorerWindowConfig>());
|
||||
const processExplorerWindowConfigUrl = processExplorerDisposables.add(this.protocolMainService.createIPCObjectUrl<ProcessExplorerWindowConfiguration>());
|
||||
const position = this.getWindowPosition(this.processExplorerParentWindow, 800, 500);
|
||||
|
||||
this.processExplorerWindow = this.createBrowserWindow(position, processExplorerWindowConfigUrl, data.styles.backgroundColor, localize('issueReporter', "Issue Reporter"), data.zoomLevel);
|
||||
configuration.windowId = this.processExplorerWindow.id;
|
||||
|
||||
// Store into config object URL
|
||||
processExplorerWindowConfigUrl.update(configuration);
|
||||
processExplorerWindowConfigUrl.update({
|
||||
appRoot: this.environmentMainService.appRoot,
|
||||
windowId: this.processExplorerWindow.id,
|
||||
userEnv: this.userEnv,
|
||||
data,
|
||||
product
|
||||
});
|
||||
|
||||
this.processExplorerWindow.loadURL(
|
||||
FileAccess.asBrowserUri('vs/code/electron-sandbox/processExplorer/processExplorer.html', require, true).toString(true)
|
||||
|
@ -311,7 +289,7 @@ export class IssueMainService implements ICommonIssueService {
|
|||
webPreferences: {
|
||||
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js', require).fsPath,
|
||||
additionalArguments: [`--vscode-window-config=${ipcObjectUrl.resource.toString()}`],
|
||||
v8CacheOptions: 'bypassHeatCheck',
|
||||
v8CacheOptions: browserCodeLoadingCacheStrategy,
|
||||
enableWebSQL: false,
|
||||
enableRemoteModule: false,
|
||||
spellcheck: false,
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ILogService, LogLevel, AbstractLogger, ILoggerService, ILogger } from 'vs/platform/log/common/log';
|
||||
import { ILogService, LogLevel, AbstractLogger, ILoggerService, ILogger, AbstractLoggerService } from 'vs/platform/log/common/log';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ByteSize, FileOperationError, FileOperationResult, IFileService, whenProviderRegistered } from 'vs/platform/files/common/files';
|
||||
import { Queue } from 'vs/base/common/async';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { dirname, joinPath, basename } from 'vs/base/common/resources';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { BufferLogService } from 'vs/platform/log/common/bufferLog';
|
||||
|
||||
|
@ -159,34 +158,19 @@ export class FileLogger extends AbstractLogger implements ILogger {
|
|||
}
|
||||
}
|
||||
|
||||
export class FileLoggerService extends Disposable implements ILoggerService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
private readonly loggers = new Map<string, ILogger>();
|
||||
export class FileLoggerService extends AbstractLoggerService implements ILoggerService {
|
||||
|
||||
constructor(
|
||||
@ILogService private logService: ILogService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@IFileService private fileService: IFileService,
|
||||
@ILogService logService: ILogService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IFileService private readonly fileService: IFileService,
|
||||
) {
|
||||
super();
|
||||
this._register(logService.onDidChangeLogLevel(level => this.loggers.forEach(logger => logger.setLevel(level))));
|
||||
super(logService.getLevel(), logService.onDidChangeLogLevel);
|
||||
}
|
||||
|
||||
createLogger(resource: URI): ILogger {
|
||||
let logger = this.loggers.get(resource.toString());
|
||||
if (!logger) {
|
||||
logger = new BufferLogService(this.logService.getLevel());
|
||||
this.loggers.set(resource.toString(), logger);
|
||||
whenProviderRegistered(resource, this.fileService).then(() => (<BufferLogService>logger).logger = this.instantiationService.createInstance(FileLogger, basename(resource), resource, this.logService.getLevel()));
|
||||
}
|
||||
protected doCreateLogger(resource: URI, logLevel: LogLevel): ILogger {
|
||||
const logger = new BufferLogService(logLevel);
|
||||
whenProviderRegistered(resource, this.fileService).then(() => (<BufferLogService>logger).logger = this.instantiationService.createInstance(FileLogger, basename(resource), resource, logger.getLevel()));
|
||||
return logger;
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.loggers.forEach(logger => logger.dispose());
|
||||
this.loggers.clear();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -487,6 +487,46 @@ export class LogService extends Disposable implements ILogService {
|
|||
}
|
||||
}
|
||||
|
||||
export abstract class AbstractLoggerService extends Disposable implements ILoggerService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
private readonly loggers = new Map<string, ILogger>();
|
||||
private readonly logLevelChangeableLoggers: ILogger[] = [];
|
||||
|
||||
constructor(
|
||||
private logLevel: LogLevel,
|
||||
onDidChangeLogLevel: Event<LogLevel>,
|
||||
) {
|
||||
super();
|
||||
this._register(onDidChangeLogLevel(logLevel => {
|
||||
this.logLevel = logLevel;
|
||||
this.logLevelChangeableLoggers.forEach(logger => logger.setLevel(logLevel));
|
||||
}));
|
||||
}
|
||||
|
||||
createLogger(resource: URI, options?: ILoggerOptions): ILogger {
|
||||
let logger = this.loggers.get(resource.toString());
|
||||
if (!logger) {
|
||||
logger = this.doCreateLogger(resource, options?.always ? LogLevel.Trace : this.logLevel, options);
|
||||
this.loggers.set(resource.toString(), logger);
|
||||
if (!options?.always) {
|
||||
this.logLevelChangeableLoggers.push(logger);
|
||||
}
|
||||
}
|
||||
return logger;
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.logLevelChangeableLoggers.splice(0, this.logLevelChangeableLoggers.length);
|
||||
this.loggers.forEach(logger => logger.dispose());
|
||||
this.loggers.clear();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
protected abstract doCreateLogger(resource: URI, logLevel: LogLevel, options?: ILoggerOptions): ILogger;
|
||||
}
|
||||
|
||||
export class NullLogService implements ILogService {
|
||||
declare readonly _serviceBrand: undefined;
|
||||
readonly onDidChangeLogLevel: Event<LogLevel> = new Emitter<LogLevel>().event;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { LogLevel, ILogService, LogService, ILoggerService, ILogger, AbstractMessageLogger, ILoggerOptions, AdapterLogger } from 'vs/platform/log/common/log';
|
||||
import { LogLevel, ILogService, LogService, ILoggerService, ILogger, AbstractMessageLogger, ILoggerOptions, AdapterLogger, AbstractLoggerService } from 'vs/platform/log/common/log';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
|
@ -113,11 +113,13 @@ export class LoggerChannel implements IServerChannel {
|
|||
}
|
||||
}
|
||||
|
||||
export class LoggerChannelClient implements ILoggerService {
|
||||
export class LoggerChannelClient extends AbstractLoggerService implements ILoggerService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
constructor(private readonly channel: IChannel) { }
|
||||
constructor(logLevel: LogLevel, onDidChangeLogLevel: Event<LogLevel>, private readonly channel: IChannel) {
|
||||
super(logLevel, onDidChangeLogLevel);
|
||||
}
|
||||
|
||||
createConsoleMainLogger(): ILogger {
|
||||
return new AdapterLogger({
|
||||
|
@ -127,8 +129,8 @@ export class LoggerChannelClient implements ILoggerService {
|
|||
});
|
||||
}
|
||||
|
||||
createLogger(file: URI, options?: ILoggerOptions): ILogger {
|
||||
return new Logger(this.channel, file, options);
|
||||
protected doCreateLogger(file: URI, logLevel: LogLevel, options?: ILoggerOptions): ILogger {
|
||||
return new Logger(this.channel, file, logLevel, options);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -141,27 +143,30 @@ class Logger extends AbstractMessageLogger {
|
|||
constructor(
|
||||
private readonly channel: IChannel,
|
||||
private readonly file: URI,
|
||||
logLevel: LogLevel,
|
||||
loggerOptions?: ILoggerOptions,
|
||||
) {
|
||||
super(loggerOptions?.always);
|
||||
this.setLevel(logLevel);
|
||||
this.channel.call('createLogger', [file, loggerOptions])
|
||||
.then(() => {
|
||||
this._log(this.buffer);
|
||||
this.doLog(this.buffer);
|
||||
this.isLoggerCreated = true;
|
||||
});
|
||||
}
|
||||
|
||||
protected log(level: LogLevel, message: string) {
|
||||
this._log([[level, message]]);
|
||||
}
|
||||
|
||||
private _log(messages: [LogLevel, string][]) {
|
||||
const messages: [LogLevel, string][] = [[level, message]];
|
||||
if (this.isLoggerCreated) {
|
||||
this.channel.call('log', [this.file, messages]);
|
||||
this.doLog(messages);
|
||||
} else {
|
||||
this.buffer.push(...messages);
|
||||
}
|
||||
}
|
||||
|
||||
private doLog(messages: [LogLevel, string][]) {
|
||||
this.channel.call('log', [this.file, messages]);
|
||||
}
|
||||
}
|
||||
|
||||
export class FollowerLogService extends LogService implements ILogService {
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ILogService, ILoggerService, ILogger, ILoggerOptions, LogLevel } from 'vs/platform/log/common/log';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { ILogService, ILoggerService, ILogger, ILoggerOptions, AbstractLoggerService, LogLevel } from 'vs/platform/log/common/log';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { basename } from 'vs/base/common/resources';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
|
@ -13,47 +12,25 @@ import { SpdLogLogger } from 'vs/platform/log/node/spdlogLog';
|
|||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
|
||||
export class LoggerService extends Disposable implements ILoggerService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
private readonly loggers = new Map<string, ILogger>();
|
||||
private readonly logLevelChangeableLoggers: ILogger[] = [];
|
||||
export class LoggerService extends AbstractLoggerService implements ILoggerService {
|
||||
|
||||
constructor(
|
||||
@ILogService private logService: ILogService,
|
||||
@IFileService private fileService: IFileService
|
||||
@ILogService logService: ILogService,
|
||||
@IFileService private readonly fileService: IFileService
|
||||
) {
|
||||
super();
|
||||
this._register(logService.onDidChangeLogLevel(level => this.logLevelChangeableLoggers.forEach(logger => logger.setLevel(level))));
|
||||
super(logService.getLevel(), logService.onDidChangeLogLevel);
|
||||
}
|
||||
|
||||
createLogger(resource: URI, options?: ILoggerOptions): ILogger {
|
||||
let logger = this.loggers.get(resource.toString());
|
||||
if (!logger) {
|
||||
if (resource.scheme === Schemas.file) {
|
||||
logger = new SpdLogLogger(options?.name || generateUuid(), resource.fsPath, !options?.donotRotate, this.logService.getLevel());
|
||||
if (options?.donotUseFormatters) {
|
||||
(<SpdLogLogger>logger).clearFormatters();
|
||||
}
|
||||
} else {
|
||||
logger = new FileLogger(options?.name ?? basename(resource), resource, this.logService.getLevel(), this.fileService);
|
||||
}
|
||||
this.loggers.set(resource.toString(), logger);
|
||||
if (options?.always) {
|
||||
logger.setLevel(LogLevel.Trace);
|
||||
} else {
|
||||
this.logLevelChangeableLoggers.push(logger);
|
||||
protected doCreateLogger(resource: URI, logLevel: LogLevel, options?: ILoggerOptions): ILogger {
|
||||
if (resource.scheme === Schemas.file) {
|
||||
const logger = new SpdLogLogger(options?.name || generateUuid(), resource.fsPath, !options?.donotRotate, logLevel);
|
||||
if (options?.donotUseFormatters) {
|
||||
(<SpdLogLogger>logger).clearFormatters();
|
||||
}
|
||||
return logger;
|
||||
} else {
|
||||
return new FileLogger(options?.name ?? basename(resource), resource, logLevel, this.fileService);
|
||||
}
|
||||
return logger;
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.logLevelChangeableLoggers.splice(0, this.logLevelChangeableLoggers.length);
|
||||
this.loggers.forEach(logger => logger.dispose());
|
||||
this.loggers.clear();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,15 +4,49 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
import { isWeb } from 'vs/base/common/platform';
|
||||
import { isWeb, globals } from 'vs/base/common/platform';
|
||||
import { env } from 'vs/base/common/process';
|
||||
import { dirname, joinPath } from 'vs/base/common/resources';
|
||||
import { IProductConfiguration } from 'vs/base/common/product';
|
||||
import { ISandboxConfiguration } from 'vs/base/parts/sandbox/common/sandboxTypes';
|
||||
|
||||
let product: IProductConfiguration;
|
||||
|
||||
// Web or Native (sandbox TODO@sandbox need to add all properties of product.json)
|
||||
if (isWeb || typeof require === 'undefined' || typeof require.__$__nodeRequire !== 'function') {
|
||||
// Native sandbox environment
|
||||
if (typeof globals.vscode !== 'undefined') {
|
||||
const configuration: ISandboxConfiguration | undefined = globals.vscode.context.configuration();
|
||||
if (configuration) {
|
||||
product = configuration.product;
|
||||
} else {
|
||||
throw new Error('Sandbox: unable to resolve product configuration from preload script.');
|
||||
}
|
||||
}
|
||||
|
||||
// Native node.js environment
|
||||
else if (typeof require?.__$__nodeRequire === 'function') {
|
||||
|
||||
// Obtain values from product.json and package.json
|
||||
const rootPath = dirname(FileAccess.asFileUri('', require));
|
||||
|
||||
product = require.__$__nodeRequire(joinPath(rootPath, 'product.json').fsPath);
|
||||
const pkg = require.__$__nodeRequire(joinPath(rootPath, 'package.json').fsPath) as { version: string; };
|
||||
|
||||
// Running out of sources
|
||||
if (env['VSCODE_DEV']) {
|
||||
Object.assign(product, {
|
||||
nameShort: `${product.nameShort} Dev`,
|
||||
nameLong: `${product.nameLong} Dev`,
|
||||
dataFolderName: `${product.dataFolderName}-dev`
|
||||
});
|
||||
}
|
||||
|
||||
Object.assign(product, {
|
||||
version: pkg.version
|
||||
});
|
||||
}
|
||||
|
||||
// Web environment or unknown
|
||||
else {
|
||||
|
||||
// Built time configuration (do NOT modify)
|
||||
product = { /*BUILD->INSERT_PRODUCT_CONFIGURATION*/ } as IProductConfiguration;
|
||||
|
@ -41,27 +75,4 @@ if (isWeb || typeof require === 'undefined' || typeof require.__$__nodeRequire !
|
|||
}
|
||||
}
|
||||
|
||||
// Native (non-sandboxed)
|
||||
else {
|
||||
|
||||
// Obtain values from product.json and package.json
|
||||
const rootPath = dirname(FileAccess.asFileUri('', require));
|
||||
|
||||
product = require.__$__nodeRequire(joinPath(rootPath, 'product.json').fsPath);
|
||||
const pkg = require.__$__nodeRequire(joinPath(rootPath, 'package.json').fsPath) as { version: string; };
|
||||
|
||||
// Running out of sources
|
||||
if (env['VSCODE_DEV']) {
|
||||
Object.assign(product, {
|
||||
nameShort: `${product.nameShort} Dev`,
|
||||
nameLong: `${product.nameLong} Dev`,
|
||||
dataFolderName: `${product.dataFolderName}-dev`
|
||||
});
|
||||
}
|
||||
|
||||
Object.assign(product, {
|
||||
version: pkg.version
|
||||
});
|
||||
}
|
||||
|
||||
export default product;
|
||||
|
|
|
@ -63,7 +63,11 @@ export class RequestService extends Disposable implements IRequestService {
|
|||
this.logService.trace('RequestService#request', options.url);
|
||||
|
||||
const { proxyUrl, strictSSL } = this;
|
||||
const agent = options.agent ? options.agent : await getProxyAgent(options.url || '', await resolveShellEnv(this.logService, this.environmentService.args, process.env), { proxyUrl, strictSSL });
|
||||
const env = {
|
||||
...process.env,
|
||||
...(await resolveShellEnv(this.logService, this.environmentService.args, process.env)),
|
||||
};
|
||||
const agent = options.agent ? options.agent : await getProxyAgent(options.url || '', env, { proxyUrl, strictSSL });
|
||||
|
||||
options.agent = agent;
|
||||
options.strictSSL = strictSSL;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { BrowserWindow, ipcMain, Event as ElectronEvent, MessagePortMain, IpcMainEvent, RenderProcessGoneDetails } from 'electron';
|
||||
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
|
||||
import { Barrier } from 'vs/base/common/async';
|
||||
|
@ -190,7 +191,8 @@ export class SharedProcess extends Disposable implements ISharedProcess {
|
|||
backupWorkspacesPath: this.environmentMainService.backupWorkspacesPath,
|
||||
userEnv: this.userEnv,
|
||||
args: this.environmentMainService.args,
|
||||
logLevel: this.logService.getLevel()
|
||||
logLevel: this.logService.getLevel(),
|
||||
product
|
||||
});
|
||||
|
||||
// Load with config
|
||||
|
|
|
@ -18,7 +18,6 @@ export interface ISharedProcess {
|
|||
|
||||
export interface ISharedProcessConfiguration extends ISandboxConfiguration {
|
||||
readonly machineId: string;
|
||||
readonly windowId: number;
|
||||
|
||||
readonly args: NativeParsedArgs;
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ export interface IOffProcessTerminalService {
|
|||
onPtyHostRestart: Event<void>;
|
||||
|
||||
attachToProcess(id: number): Promise<ITerminalChildProcess | undefined>;
|
||||
listProcesses(reduceGraceTime?: boolean): Promise<IProcessDetails[]>;
|
||||
listProcesses(): Promise<IProcessDetails[]>;
|
||||
setTerminalLayoutInfo(layoutInfo?: ITerminalsLayoutInfoById): Promise<void>;
|
||||
getTerminalLayoutInfo(): Promise<ITerminalsLayoutInfo | undefined>;
|
||||
reduceConnectionGraceTime(): Promise<void>;
|
||||
|
|
|
@ -404,6 +404,12 @@ export const menuSelectionBackground = registerColor('menu.selectionBackground',
|
|||
export const menuSelectionBorder = registerColor('menu.selectionBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('menuSelectionBorder', "Border color of the selected menu item in menus."));
|
||||
export const menuSeparatorBackground = registerColor('menu.separatorBackground', { dark: '#BBBBBB', light: '#888888', hc: contrastBorder }, nls.localize('menuSeparatorBackground', "Color of a separator menu item in menus."));
|
||||
|
||||
/**
|
||||
* Toolbar colors
|
||||
*/
|
||||
export const toolbarHoverBackground = registerColor('toolbar.hoverBackground', { dark: '#5a5d5e50', light: '#b8b8b850', hc: null }, nls.localize('toolbarHoverBackground', "Toolbar background when hovering over actions using the mouse"));
|
||||
export const toolbarActiveBackground = registerColor('toolbar.activeBackground', { dark: lighten(toolbarHoverBackground, 0.1), light: darken(toolbarHoverBackground, 0.1), hc: null }, nls.localize('toolbarActiveBackground', "Toolbar background when holding the mouse over actions"));
|
||||
|
||||
/**
|
||||
* Snippet placeholder colors
|
||||
*/
|
||||
|
|
|
@ -58,9 +58,9 @@ export interface ICheckboxStyleOverrides extends IStyleOverrides {
|
|||
|
||||
export function attachCheckboxStyler(widget: IThemable, themeService: IThemeService, style?: ICheckboxStyleOverrides): IDisposable {
|
||||
return attachStyler(themeService, {
|
||||
inputActiveOptionBorder: (style && style.inputActiveOptionBorderColor) || inputActiveOptionBorder,
|
||||
inputActiveOptionForeground: (style && style.inputActiveOptionForegroundColor) || inputActiveOptionForeground,
|
||||
inputActiveOptionBackground: (style && style.inputActiveOptionBackgroundColor) || inputActiveOptionBackground
|
||||
inputActiveOptionBorder: style?.inputActiveOptionBorderColor || inputActiveOptionBorder,
|
||||
inputActiveOptionForeground: style?.inputActiveOptionForegroundColor || inputActiveOptionForeground,
|
||||
inputActiveOptionBackground: style?.inputActiveOptionBackgroundColor || inputActiveOptionBackground
|
||||
} as ICheckboxStyleOverrides, widget);
|
||||
}
|
||||
|
||||
|
@ -71,8 +71,8 @@ export interface IBadgeStyleOverrides extends IStyleOverrides {
|
|||
|
||||
export function attachBadgeStyler(widget: IThemable, themeService: IThemeService, style?: IBadgeStyleOverrides): IDisposable {
|
||||
return attachStyler(themeService, {
|
||||
badgeBackground: (style && style.badgeBackground) || badgeBackground,
|
||||
badgeForeground: (style && style.badgeForeground) || badgeForeground,
|
||||
badgeBackground: style?.badgeBackground || badgeBackground,
|
||||
badgeForeground: style?.badgeForeground || badgeForeground,
|
||||
badgeBorder: contrastBorder
|
||||
} as IBadgeStyleOverrides, widget);
|
||||
}
|
||||
|
@ -97,18 +97,18 @@ export interface IInputBoxStyleOverrides extends IStyleOverrides {
|
|||
|
||||
export function attachInputBoxStyler(widget: IThemable, themeService: IThemeService, style?: IInputBoxStyleOverrides): IDisposable {
|
||||
return attachStyler(themeService, {
|
||||
inputBackground: (style && style.inputBackground) || inputBackground,
|
||||
inputForeground: (style && style.inputForeground) || inputForeground,
|
||||
inputBorder: (style && style.inputBorder) || inputBorder,
|
||||
inputValidationInfoBorder: (style && style.inputValidationInfoBorder) || inputValidationInfoBorder,
|
||||
inputValidationInfoBackground: (style && style.inputValidationInfoBackground) || inputValidationInfoBackground,
|
||||
inputValidationInfoForeground: (style && style.inputValidationInfoForeground) || inputValidationInfoForeground,
|
||||
inputValidationWarningBorder: (style && style.inputValidationWarningBorder) || inputValidationWarningBorder,
|
||||
inputValidationWarningBackground: (style && style.inputValidationWarningBackground) || inputValidationWarningBackground,
|
||||
inputValidationWarningForeground: (style && style.inputValidationWarningForeground) || inputValidationWarningForeground,
|
||||
inputValidationErrorBorder: (style && style.inputValidationErrorBorder) || inputValidationErrorBorder,
|
||||
inputValidationErrorBackground: (style && style.inputValidationErrorBackground) || inputValidationErrorBackground,
|
||||
inputValidationErrorForeground: (style && style.inputValidationErrorForeground) || inputValidationErrorForeground
|
||||
inputBackground: style?.inputBackground || inputBackground,
|
||||
inputForeground: style?.inputForeground || inputForeground,
|
||||
inputBorder: style?.inputBorder || inputBorder,
|
||||
inputValidationInfoBorder: style?.inputValidationInfoBorder || inputValidationInfoBorder,
|
||||
inputValidationInfoBackground: style?.inputValidationInfoBackground || inputValidationInfoBackground,
|
||||
inputValidationInfoForeground: style?.inputValidationInfoForeground || inputValidationInfoForeground,
|
||||
inputValidationWarningBorder: style?.inputValidationWarningBorder || inputValidationWarningBorder,
|
||||
inputValidationWarningBackground: style?.inputValidationWarningBackground || inputValidationWarningBackground,
|
||||
inputValidationWarningForeground: style?.inputValidationWarningForeground || inputValidationWarningForeground,
|
||||
inputValidationErrorBorder: style?.inputValidationErrorBorder || inputValidationErrorBorder,
|
||||
inputValidationErrorBackground: style?.inputValidationErrorBackground || inputValidationErrorBackground,
|
||||
inputValidationErrorForeground: style?.inputValidationErrorForeground || inputValidationErrorForeground
|
||||
} as IInputBoxStyleOverrides, widget);
|
||||
}
|
||||
|
||||
|
@ -123,39 +123,39 @@ export interface ISelectBoxStyleOverrides extends IStyleOverrides, IListStyleOve
|
|||
|
||||
export function attachSelectBoxStyler(widget: IThemable, themeService: IThemeService, style?: ISelectBoxStyleOverrides): IDisposable {
|
||||
return attachStyler(themeService, {
|
||||
selectBackground: (style && style.selectBackground) || selectBackground,
|
||||
selectListBackground: (style && style.selectListBackground) || selectListBackground,
|
||||
selectForeground: (style && style.selectForeground) || selectForeground,
|
||||
decoratorRightForeground: (style && style.pickerGroupForeground) || pickerGroupForeground,
|
||||
selectBorder: (style && style.selectBorder) || selectBorder,
|
||||
focusBorder: (style && style.focusBorder) || focusBorder,
|
||||
listFocusBackground: (style && style.listFocusBackground) || quickInputListFocusBackground,
|
||||
listFocusForeground: (style && style.listFocusForeground) || listFocusForeground,
|
||||
listFocusOutline: (style && style.listFocusOutline) || ((theme: IColorTheme) => theme.type === ColorScheme.HIGH_CONTRAST ? activeContrastBorder : Color.transparent),
|
||||
listHoverBackground: (style && style.listHoverBackground) || listHoverBackground,
|
||||
listHoverForeground: (style && style.listHoverForeground) || listHoverForeground,
|
||||
listHoverOutline: (style && style.listFocusOutline) || activeContrastBorder,
|
||||
selectListBorder: (style && style.selectListBorder) || editorWidgetBorder
|
||||
selectBackground: style?.selectBackground || selectBackground,
|
||||
selectListBackground: style?.selectListBackground || selectListBackground,
|
||||
selectForeground: style?.selectForeground || selectForeground,
|
||||
decoratorRightForeground: style?.pickerGroupForeground || pickerGroupForeground,
|
||||
selectBorder: style?.selectBorder || selectBorder,
|
||||
focusBorder: style?.focusBorder || focusBorder,
|
||||
listFocusBackground: style?.listFocusBackground || quickInputListFocusBackground,
|
||||
listFocusForeground: style?.listFocusForeground || listFocusForeground,
|
||||
listFocusOutline: style?.listFocusOutline || ((theme: IColorTheme) => theme.type === ColorScheme.HIGH_CONTRAST ? activeContrastBorder : Color.transparent),
|
||||
listHoverBackground: style?.listHoverBackground || listHoverBackground,
|
||||
listHoverForeground: style?.listHoverForeground || listHoverForeground,
|
||||
listHoverOutline: style?.listFocusOutline || activeContrastBorder,
|
||||
selectListBorder: style?.selectListBorder || editorWidgetBorder
|
||||
} as ISelectBoxStyleOverrides, widget);
|
||||
}
|
||||
|
||||
export function attachFindReplaceInputBoxStyler(widget: IThemable, themeService: IThemeService, style?: IInputBoxStyleOverrides): IDisposable {
|
||||
return attachStyler(themeService, {
|
||||
inputBackground: (style && style.inputBackground) || inputBackground,
|
||||
inputForeground: (style && style.inputForeground) || inputForeground,
|
||||
inputBorder: (style && style.inputBorder) || inputBorder,
|
||||
inputActiveOptionBorder: (style && style.inputActiveOptionBorder) || inputActiveOptionBorder,
|
||||
inputActiveOptionForeground: (style && style.inputActiveOptionForeground) || inputActiveOptionForeground,
|
||||
inputActiveOptionBackground: (style && style.inputActiveOptionBackground) || inputActiveOptionBackground,
|
||||
inputValidationInfoBorder: (style && style.inputValidationInfoBorder) || inputValidationInfoBorder,
|
||||
inputValidationInfoBackground: (style && style.inputValidationInfoBackground) || inputValidationInfoBackground,
|
||||
inputValidationInfoForeground: (style && style.inputValidationInfoForeground) || inputValidationInfoForeground,
|
||||
inputValidationWarningBorder: (style && style.inputValidationWarningBorder) || inputValidationWarningBorder,
|
||||
inputValidationWarningBackground: (style && style.inputValidationWarningBackground) || inputValidationWarningBackground,
|
||||
inputValidationWarningForeground: (style && style.inputValidationWarningForeground) || inputValidationWarningForeground,
|
||||
inputValidationErrorBorder: (style && style.inputValidationErrorBorder) || inputValidationErrorBorder,
|
||||
inputValidationErrorBackground: (style && style.inputValidationErrorBackground) || inputValidationErrorBackground,
|
||||
inputValidationErrorForeground: (style && style.inputValidationErrorForeground) || inputValidationErrorForeground
|
||||
inputBackground: style?.inputBackground || inputBackground,
|
||||
inputForeground: style?.inputForeground || inputForeground,
|
||||
inputBorder: style?.inputBorder || inputBorder,
|
||||
inputActiveOptionBorder: style?.inputActiveOptionBorder || inputActiveOptionBorder,
|
||||
inputActiveOptionForeground: style?.inputActiveOptionForeground || inputActiveOptionForeground,
|
||||
inputActiveOptionBackground: style?.inputActiveOptionBackground || inputActiveOptionBackground,
|
||||
inputValidationInfoBorder: style?.inputValidationInfoBorder || inputValidationInfoBorder,
|
||||
inputValidationInfoBackground: style?.inputValidationInfoBackground || inputValidationInfoBackground,
|
||||
inputValidationInfoForeground: style?.inputValidationInfoForeground || inputValidationInfoForeground,
|
||||
inputValidationWarningBorder: style?.inputValidationWarningBorder || inputValidationWarningBorder,
|
||||
inputValidationWarningBackground: style?.inputValidationWarningBackground || inputValidationWarningBackground,
|
||||
inputValidationWarningForeground: style?.inputValidationWarningForeground || inputValidationWarningForeground,
|
||||
inputValidationErrorBorder: style?.inputValidationErrorBorder || inputValidationErrorBorder,
|
||||
inputValidationErrorBackground: style?.inputValidationErrorBackground || inputValidationErrorBackground,
|
||||
inputValidationErrorForeground: style?.inputValidationErrorForeground || inputValidationErrorForeground
|
||||
} as IInputBoxStyleOverrides, widget);
|
||||
}
|
||||
|
||||
|
@ -170,40 +170,40 @@ export interface IQuickInputStyleOverrides extends IListStyleOverrides, IInputBo
|
|||
|
||||
export function attachQuickInputStyler(widget: IThemable, themeService: IThemeService, style?: IQuickInputStyleOverrides): IDisposable {
|
||||
return attachStyler(themeService, {
|
||||
foreground: (style && style.foreground) || foreground,
|
||||
background: (style && style.background) || editorBackground,
|
||||
borderColor: style && style.borderColor || contrastBorder,
|
||||
widgetShadow: style && style.widgetShadow || widgetShadow,
|
||||
progressBarBackground: style && style.progressBarBackground || progressBarBackground,
|
||||
pickerGroupForeground: style && style.pickerGroupForeground || pickerGroupForeground,
|
||||
pickerGroupBorder: style && style.pickerGroupBorder || pickerGroupBorder,
|
||||
inputBackground: (style && style.inputBackground) || inputBackground,
|
||||
inputForeground: (style && style.inputForeground) || inputForeground,
|
||||
inputBorder: (style && style.inputBorder) || inputBorder,
|
||||
inputValidationInfoBorder: (style && style.inputValidationInfoBorder) || inputValidationInfoBorder,
|
||||
inputValidationInfoBackground: (style && style.inputValidationInfoBackground) || inputValidationInfoBackground,
|
||||
inputValidationInfoForeground: (style && style.inputValidationInfoForeground) || inputValidationInfoForeground,
|
||||
inputValidationWarningBorder: (style && style.inputValidationWarningBorder) || inputValidationWarningBorder,
|
||||
inputValidationWarningBackground: (style && style.inputValidationWarningBackground) || inputValidationWarningBackground,
|
||||
inputValidationWarningForeground: (style && style.inputValidationWarningForeground) || inputValidationWarningForeground,
|
||||
inputValidationErrorBorder: (style && style.inputValidationErrorBorder) || inputValidationErrorBorder,
|
||||
inputValidationErrorBackground: (style && style.inputValidationErrorBackground) || inputValidationErrorBackground,
|
||||
inputValidationErrorForeground: (style && style.inputValidationErrorForeground) || inputValidationErrorForeground,
|
||||
listFocusBackground: (style && style.listFocusBackground) || listFocusBackground,
|
||||
listFocusForeground: (style && style.listFocusForeground) || listFocusForeground,
|
||||
listActiveSelectionBackground: (style && style.listActiveSelectionBackground) || darken(listActiveSelectionBackground, 0.1),
|
||||
listActiveSelectionForeground: (style && style.listActiveSelectionForeground) || listActiveSelectionForeground,
|
||||
listFocusAndSelectionBackground: style && style.listFocusAndSelectionBackground || listActiveSelectionBackground,
|
||||
listFocusAndSelectionForeground: (style && style.listFocusAndSelectionForeground) || listActiveSelectionForeground,
|
||||
listInactiveSelectionBackground: (style && style.listInactiveSelectionBackground) || listInactiveSelectionBackground,
|
||||
listInactiveSelectionForeground: (style && style.listInactiveSelectionForeground) || listInactiveSelectionForeground,
|
||||
listInactiveFocusBackground: (style && style.listInactiveFocusBackground) || listInactiveFocusBackground,
|
||||
listHoverBackground: (style && style.listHoverBackground) || listHoverBackground,
|
||||
listHoverForeground: (style && style.listHoverForeground) || listHoverForeground,
|
||||
listDropBackground: (style && style.listDropBackground) || listDropBackground,
|
||||
listFocusOutline: (style && style.listFocusOutline) || activeContrastBorder,
|
||||
listSelectionOutline: (style && style.listSelectionOutline) || activeContrastBorder,
|
||||
listHoverOutline: (style && style.listHoverOutline) || activeContrastBorder
|
||||
foreground: style?.foreground || foreground,
|
||||
background: style?.background || editorBackground,
|
||||
borderColor: style?.borderColor || contrastBorder,
|
||||
widgetShadow: style?.widgetShadow || widgetShadow,
|
||||
progressBarBackground: style?.progressBarBackground || progressBarBackground,
|
||||
pickerGroupForeground: style?.pickerGroupForeground || pickerGroupForeground,
|
||||
pickerGroupBorder: style?.pickerGroupBorder || pickerGroupBorder,
|
||||
inputBackground: style?.inputBackground || inputBackground,
|
||||
inputForeground: style?.inputForeground || inputForeground,
|
||||
inputBorder: style?.inputBorder || inputBorder,
|
||||
inputValidationInfoBorder: style?.inputValidationInfoBorder || inputValidationInfoBorder,
|
||||
inputValidationInfoBackground: style?.inputValidationInfoBackground || inputValidationInfoBackground,
|
||||
inputValidationInfoForeground: style?.inputValidationInfoForeground || inputValidationInfoForeground,
|
||||
inputValidationWarningBorder: style?.inputValidationWarningBorder || inputValidationWarningBorder,
|
||||
inputValidationWarningBackground: style?.inputValidationWarningBackground || inputValidationWarningBackground,
|
||||
inputValidationWarningForeground: style?.inputValidationWarningForeground || inputValidationWarningForeground,
|
||||
inputValidationErrorBorder: style?.inputValidationErrorBorder || inputValidationErrorBorder,
|
||||
inputValidationErrorBackground: style?.inputValidationErrorBackground || inputValidationErrorBackground,
|
||||
inputValidationErrorForeground: style?.inputValidationErrorForeground || inputValidationErrorForeground,
|
||||
listFocusBackground: style?.listFocusBackground || listFocusBackground,
|
||||
listFocusForeground: style?.listFocusForeground || listFocusForeground,
|
||||
listActiveSelectionBackground: style?.listActiveSelectionBackground || darken(listActiveSelectionBackground, 0.1),
|
||||
listActiveSelectionForeground: style?.listActiveSelectionForeground || listActiveSelectionForeground,
|
||||
listFocusAndSelectionBackground: style?.listFocusAndSelectionBackground || listActiveSelectionBackground,
|
||||
listFocusAndSelectionForeground: style?.listFocusAndSelectionForeground || listActiveSelectionForeground,
|
||||
listInactiveSelectionBackground: style?.listInactiveSelectionBackground || listInactiveSelectionBackground,
|
||||
listInactiveSelectionForeground: style?.listInactiveSelectionForeground || listInactiveSelectionForeground,
|
||||
listInactiveFocusBackground: style?.listInactiveFocusBackground || listInactiveFocusBackground,
|
||||
listHoverBackground: style?.listHoverBackground || listHoverBackground,
|
||||
listHoverForeground: style?.listHoverForeground || listHoverForeground,
|
||||
listDropBackground: style?.listDropBackground || listDropBackground,
|
||||
listFocusOutline: style?.listFocusOutline || activeContrastBorder,
|
||||
listSelectionOutline: style?.listSelectionOutline || activeContrastBorder,
|
||||
listHoverOutline: style?.listHoverOutline || activeContrastBorder
|
||||
} as IQuickInputStyleOverrides, widget);
|
||||
}
|
||||
|
||||
|
@ -273,12 +273,12 @@ export interface IButtonStyleOverrides extends IStyleOverrides {
|
|||
|
||||
export function attachButtonStyler(widget: IThemable, themeService: IThemeService, style?: IButtonStyleOverrides): IDisposable {
|
||||
return attachStyler(themeService, {
|
||||
buttonForeground: (style && style.buttonForeground) || buttonForeground,
|
||||
buttonBackground: (style && style.buttonBackground) || buttonBackground,
|
||||
buttonHoverBackground: (style && style.buttonHoverBackground) || buttonHoverBackground,
|
||||
buttonSecondaryForeground: (style && style.buttonSecondaryForeground) || buttonSecondaryForeground,
|
||||
buttonSecondaryBackground: (style && style.buttonSecondaryBackground) || buttonSecondaryBackground,
|
||||
buttonSecondaryHoverBackground: (style && style.buttonSecondaryHoverBackground) || buttonSecondaryHoverBackground,
|
||||
buttonForeground: style?.buttonForeground || buttonForeground,
|
||||
buttonBackground: style?.buttonBackground || buttonBackground,
|
||||
buttonHoverBackground: style?.buttonHoverBackground || buttonHoverBackground,
|
||||
buttonSecondaryForeground: style?.buttonSecondaryForeground || buttonSecondaryForeground,
|
||||
buttonSecondaryBackground: style?.buttonSecondaryBackground || buttonSecondaryBackground,
|
||||
buttonSecondaryHoverBackground: style?.buttonSecondaryHoverBackground || buttonSecondaryHoverBackground,
|
||||
buttonBorder: contrastBorder
|
||||
} as IButtonStyleOverrides, widget);
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ export interface ILinkStyleOverrides extends IStyleOverrides {
|
|||
|
||||
export function attachLinkStyler(widget: IThemable, themeService: IThemeService, style?: ILinkStyleOverrides): IDisposable {
|
||||
return attachStyler(themeService, {
|
||||
textLinkForeground: (style && style.textLinkForeground) || textLinkForeground,
|
||||
textLinkForeground: style?.textLinkForeground || textLinkForeground,
|
||||
} as ILinkStyleOverrides, widget);
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ export interface IProgressBarStyleOverrides extends IStyleOverrides {
|
|||
|
||||
export function attachProgressBarStyler(widget: IThemable, themeService: IThemeService, style?: IProgressBarStyleOverrides): IDisposable {
|
||||
return attachStyler(themeService, {
|
||||
progressBarBackground: (style && style.progressBarBackground) || progressBarBackground
|
||||
progressBarBackground: style?.progressBarBackground || progressBarBackground
|
||||
} as IProgressBarStyleOverrides, widget);
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,6 @@ export interface IOSConfiguration {
|
|||
export interface INativeWindowConfiguration extends IWindowConfiguration, NativeParsedArgs, ISandboxConfiguration {
|
||||
mainPid: number;
|
||||
|
||||
windowId: number;
|
||||
machineId: string;
|
||||
|
||||
execPath: string;
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { release } from 'os';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { localize } from 'vs/nls';
|
||||
import { getMarks, mark } from 'vs/base/common/performance';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage, Rectangle, Display, TouchBarSegmentedControl, NativeImage, BrowserWindowConstructorOptions, SegmentedControlSegment, nativeTheme, Event, RenderProcessGoneDetails } from 'electron';
|
||||
import { screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage, Rectangle, Display, TouchBarSegmentedControl, NativeImage, BrowserWindowConstructorOptions, SegmentedControlSegment, Event, RenderProcessGoneDetails } from 'electron';
|
||||
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
@ -208,7 +207,9 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||
};
|
||||
|
||||
if (browserCodeLoadingCacheStrategy) {
|
||||
this.logService.info(`window#ctor: using vscode-file protocol and V8 cache options: ${browserCodeLoadingCacheStrategy}`);
|
||||
this.logService.info(`window#ctor: using vscode-file:// protocol and V8 cache options: ${browserCodeLoadingCacheStrategy}`);
|
||||
} else {
|
||||
this.logService.trace(`window#ctor: vscode-file:// protocol is explicitly disabled`);
|
||||
}
|
||||
|
||||
// Apply icon to window
|
||||
|
@ -689,40 +690,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||
|
||||
load(configuration: INativeWindowConfiguration, options: ILoadOptions = Object.create(null)): void {
|
||||
|
||||
// If this window was loaded before from the command line
|
||||
// (as indicated by VSCODE_CLI environment), make sure to
|
||||
// preserve that user environment in subsequent loads,
|
||||
// unless the new configuration context was also a CLI
|
||||
// (for https://github.com/microsoft/vscode/issues/108571)
|
||||
const currentUserEnv = (this.currentConfig ?? this.pendingLoadConfig)?.userEnv;
|
||||
if (currentUserEnv && isLaunchedFromCli(currentUserEnv) && !isLaunchedFromCli(configuration.userEnv)) {
|
||||
configuration.userEnv = { ...currentUserEnv, ...configuration.userEnv }; // still allow to override certain environment as passed in
|
||||
}
|
||||
|
||||
// If named pipe was instantiated for the crashpad_handler process, reuse the same
|
||||
// pipe for new app instances connecting to the original app instance.
|
||||
// Ref: https://github.com/microsoft/vscode/issues/115874
|
||||
if (process.env['CHROME_CRASHPAD_PIPE_NAME']) {
|
||||
Object.assign(configuration.userEnv, {
|
||||
CHROME_CRASHPAD_PIPE_NAME: process.env['CHROME_CRASHPAD_PIPE_NAME']
|
||||
});
|
||||
}
|
||||
|
||||
// If this is the first time the window is loaded, we associate the paths
|
||||
// directly with the window because we assume the loading will just work
|
||||
if (this.readyState === ReadyState.NONE) {
|
||||
this.currentConfig = configuration;
|
||||
}
|
||||
|
||||
// Otherwise, the window is currently showing a folder and if there is an
|
||||
// unload handler preventing the load, we cannot just associate the paths
|
||||
// because the loading might be vetoed. Instead we associate it later when
|
||||
// the window load event has fired.
|
||||
else {
|
||||
this.pendingLoadConfig = configuration;
|
||||
this.readyState = ReadyState.NAVIGATING;
|
||||
}
|
||||
|
||||
// Clear Document Edited if needed
|
||||
if (this.isDocumentEdited()) {
|
||||
if (!options.isReload || !this.backupMainService.isHotExitEnabled()) {
|
||||
|
@ -739,11 +706,26 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||
this._win.setTitle(this.productService.nameLong);
|
||||
}
|
||||
|
||||
// Update config object URL
|
||||
this.updateConfigObjectUrl(configuration, options);
|
||||
// Update configuration values based on our window context
|
||||
// and set it into the config object URL for usage.
|
||||
this.updateConfiguration(configuration, options);
|
||||
|
||||
// If this is the first time the window is loaded, we associate the paths
|
||||
// directly with the window because we assume the loading will just work
|
||||
if (this.readyState === ReadyState.NONE) {
|
||||
this.currentConfig = configuration;
|
||||
}
|
||||
|
||||
// Otherwise, the window is currently showing a folder and if there is an
|
||||
// unload handler preventing the load, we cannot just associate the paths
|
||||
// because the loading might be vetoed. Instead we associate it later when
|
||||
// the window load event has fired.
|
||||
else {
|
||||
this.pendingLoadConfig = configuration;
|
||||
this.readyState = ReadyState.NAVIGATING;
|
||||
}
|
||||
|
||||
// Load URL
|
||||
mark('code/willOpenNewWindow');
|
||||
this._win.loadURL(FileAccess.asBrowserUri(this.environmentMainService.sandbox ?
|
||||
'vs/code/electron-sandbox/workbench/workbench.html' :
|
||||
'vs/code/electron-browser/workbench/workbench.html', require
|
||||
|
@ -765,6 +747,45 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||
this._onWillLoad.fire({ workspace: configuration.workspace });
|
||||
}
|
||||
|
||||
private updateConfiguration(configuration: INativeWindowConfiguration, options: ILoadOptions): void {
|
||||
|
||||
// If this window was loaded before from the command line
|
||||
// (as indicated by VSCODE_CLI environment), make sure to
|
||||
// preserve that user environment in subsequent loads,
|
||||
// unless the new configuration context was also a CLI
|
||||
// (for https://github.com/microsoft/vscode/issues/108571)
|
||||
const currentUserEnv = (this.currentConfig ?? this.pendingLoadConfig)?.userEnv;
|
||||
if (currentUserEnv && isLaunchedFromCli(currentUserEnv) && !isLaunchedFromCli(configuration.userEnv)) {
|
||||
configuration.userEnv = { ...currentUserEnv, ...configuration.userEnv }; // still allow to override certain environment as passed in
|
||||
}
|
||||
|
||||
// If named pipe was instantiated for the crashpad_handler process, reuse the same
|
||||
// pipe for new app instances connecting to the original app instance.
|
||||
// Ref: https://github.com/microsoft/vscode/issues/115874
|
||||
if (process.env['CHROME_CRASHPAD_PIPE_NAME']) {
|
||||
Object.assign(configuration.userEnv, {
|
||||
CHROME_CRASHPAD_PIPE_NAME: process.env['CHROME_CRASHPAD_PIPE_NAME']
|
||||
});
|
||||
}
|
||||
|
||||
// Add disable-extensions to the config, but do not preserve it on currentConfig or
|
||||
// pendingLoadConfig so that it is applied only on this load
|
||||
if (options.disableExtensions !== undefined) {
|
||||
configuration['disable-extensions'] = options.disableExtensions;
|
||||
}
|
||||
|
||||
// Update window related properties
|
||||
configuration.fullscreen = this.isFullScreen;
|
||||
configuration.maximized = this._win.isMaximized();
|
||||
|
||||
// Update with latest perf marks
|
||||
mark('code/willOpenNewWindow');
|
||||
configuration.perfMarks = getMarks();
|
||||
|
||||
// Update in config object URL for usage in renderer
|
||||
this.configObjectUrl.update(configuration);
|
||||
}
|
||||
|
||||
async reload(cli?: NativeParsedArgs): Promise<void> {
|
||||
|
||||
// Copy our current config for reuse
|
||||
|
@ -822,59 +843,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||
return configuration.workspace;
|
||||
}
|
||||
|
||||
private updateConfigObjectUrl(baseConfig: INativeWindowConfiguration, options: ILoadOptions): void {
|
||||
|
||||
// Copy the base config to be able to make changes
|
||||
const configuration: INativeWindowConfiguration = { ...this.environmentMainService.args, ...baseConfig };
|
||||
|
||||
// Add disable-extensions to the config, but do not preserve it on currentConfig or
|
||||
// pendingLoadConfig so that it is applied only on this load
|
||||
if (options.disableExtensions !== undefined) {
|
||||
configuration['disable-extensions'] = options.disableExtensions;
|
||||
}
|
||||
|
||||
// Set window ID
|
||||
configuration.windowId = this._win.id;
|
||||
configuration.sessionId = `window:${this._win.id}`;
|
||||
configuration.logLevel = this.logService.getLevel();
|
||||
configuration.logsPath = this.environmentMainService.logsPath;
|
||||
|
||||
// Set zoomlevel
|
||||
const windowConfig = this.configurationService.getValue<IWindowSettings | undefined>('window');
|
||||
const zoomLevel = windowConfig?.zoomLevel;
|
||||
if (typeof zoomLevel === 'number') {
|
||||
configuration.zoomLevel = zoomLevel;
|
||||
}
|
||||
|
||||
// Set fullscreen state
|
||||
configuration.fullscreen = this.isFullScreen;
|
||||
|
||||
// Set Accessibility Config
|
||||
configuration.colorScheme = {
|
||||
dark: nativeTheme.shouldUseDarkColors,
|
||||
highContrast: nativeTheme.shouldUseInvertedColorScheme || nativeTheme.shouldUseHighContrastColors
|
||||
};
|
||||
configuration.autoDetectHighContrast = windowConfig?.autoDetectHighContrast ?? true;
|
||||
configuration.accessibilitySupport = app.accessibilitySupportEnabled;
|
||||
|
||||
// Title style related
|
||||
configuration.maximized = this._win.isMaximized();
|
||||
|
||||
// Dump Perf Counters
|
||||
configuration.perfMarks = getMarks();
|
||||
|
||||
// Parts splash
|
||||
configuration.partsSplashPath = join(this.environmentMainService.userDataPath, 'rapid_render.json');
|
||||
|
||||
// OS Info
|
||||
configuration.os = {
|
||||
release: release()
|
||||
};
|
||||
|
||||
// Store into config object URL
|
||||
this.configObjectUrl.update(configuration);
|
||||
}
|
||||
|
||||
serializeWindowState(): IWindowState {
|
||||
if (!this._win) {
|
||||
return defaultWindowState();
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { statSync } from 'fs';
|
||||
import { release } from 'os';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { getMarks } from 'vs/base/common/performance';
|
||||
import { basename, normalize, join, posix } from 'vs/base/common/path';
|
||||
import { localize } from 'vs/nls';
|
||||
import { coalesce, distinct, firstOrDefault } from 'vs/base/common/arrays';
|
||||
|
@ -13,7 +16,7 @@ import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/e
|
|||
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
import { IStateService } from 'vs/platform/state/node/state';
|
||||
import { CodeWindow } from 'vs/platform/windows/electron-main/window';
|
||||
import { BrowserWindow, MessageBoxOptions, WebContents } from 'electron';
|
||||
import { app, BrowserWindow, MessageBoxOptions, nativeTheme, WebContents } from 'electron';
|
||||
import { ILifecycleMainService, UnloadReason } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
@ -741,7 +744,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
|||
// folder or file paths
|
||||
const cliPaths = cli._;
|
||||
for (const cliPath of cliPaths) {
|
||||
const path = cli.remote ? this.doResolvePathRemote(cliPath, cli.remote) : this.doResolveFilePath(cliPath, pathResolveOptions);
|
||||
const path = pathResolveOptions.remoteAuthority ? this.doResolvePathRemote(cliPath, pathResolveOptions) : this.doResolveFilePath(cliPath, pathResolveOptions);
|
||||
if (path) {
|
||||
pathsToOpen.push(path);
|
||||
}
|
||||
|
@ -900,11 +903,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
|||
let columnNumber: number | undefined;
|
||||
|
||||
if (options.gotoLineMode) {
|
||||
const parsedPath = parseLineAndColumnAware(path);
|
||||
lineNumber = parsedPath.line;
|
||||
columnNumber = parsedPath.column;
|
||||
|
||||
path = parsedPath.path;
|
||||
({ path, line: lineNumber, column: columnNumber } = parseLineAndColumnAware(path));
|
||||
}
|
||||
|
||||
// Ensure the path is normalized and absolute
|
||||
|
@ -947,8 +946,17 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
|||
return undefined;
|
||||
}
|
||||
|
||||
private doResolvePathRemote(path: string, remoteAuthority: string, forceOpenWorkspaceAsFile?: boolean): IPathToOpen | undefined {
|
||||
private doResolvePathRemote(path: string, options: IPathResolveOptions): IPathToOpen | undefined {
|
||||
const first = path.charCodeAt(0);
|
||||
const remoteAuthority = options.remoteAuthority;
|
||||
|
||||
// Extract line/col information from path
|
||||
let lineNumber: number | undefined;
|
||||
let columnNumber: number | undefined;
|
||||
|
||||
if (options.gotoLineMode) {
|
||||
({ path, line: lineNumber, column: columnNumber } = parseLineAndColumnAware(path));
|
||||
}
|
||||
|
||||
// make absolute
|
||||
if (first !== CharCode.Slash) {
|
||||
|
@ -963,21 +971,21 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
|||
|
||||
// guess the file type:
|
||||
// - if it ends with a slash it's a folder
|
||||
// - if it has a file extension, it's a file or a workspace
|
||||
// - if in goto line mode or if it has a file extension, it's a file or a workspace
|
||||
// - by defaults it's a folder
|
||||
if (path.charCodeAt(path.length - 1) !== CharCode.Slash) {
|
||||
|
||||
// file name ends with .code-workspace
|
||||
if (hasWorkspaceFileExtension(path)) {
|
||||
if (forceOpenWorkspaceAsFile) {
|
||||
return { fileUri: uri, remoteAuthority };
|
||||
if (options.forceOpenWorkspaceAsFile) {
|
||||
return { fileUri: uri, lineNumber, columnNumber, remoteAuthority: options.remoteAuthority };
|
||||
}
|
||||
return { workspace: getWorkspaceIdentifier(uri), remoteAuthority };
|
||||
}
|
||||
|
||||
// file name starts with a dot or has an file extension
|
||||
else if (posix.basename(path).indexOf('.') !== -1) {
|
||||
return { fileUri: uri, remoteAuthority };
|
||||
else if (options.gotoLineMode || posix.basename(path).indexOf('.') !== -1) {
|
||||
return { fileUri: uri, lineNumber, columnNumber, remoteAuthority };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1134,33 +1142,57 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
|||
}
|
||||
|
||||
private openInBrowserWindow(options: IOpenBrowserWindowOptions): ICodeWindow {
|
||||
const windowConfig = this.configurationService.getValue<IWindowSettings | undefined>('window');
|
||||
|
||||
// Build `INativeWindowConfiguration` from config and options
|
||||
const configuration = { ...options.cli } as INativeWindowConfiguration;
|
||||
configuration.appRoot = this.environmentMainService.appRoot;
|
||||
configuration.machineId = this.machineId;
|
||||
configuration.nodeCachedDataDir = this.environmentMainService.nodeCachedDataDir;
|
||||
configuration.mainPid = process.pid;
|
||||
configuration.execPath = process.execPath;
|
||||
configuration.userEnv = { ...this.initialUserEnv, ...options.userEnv };
|
||||
configuration.isInitialStartup = options.initialStartup;
|
||||
configuration.workspace = options.workspace;
|
||||
configuration.remoteAuthority = options.remoteAuthority;
|
||||
// Build up the window configuration from provided options, config and environment
|
||||
const configuration: INativeWindowConfiguration = {
|
||||
|
||||
const filesToOpen = options.filesToOpen;
|
||||
if (filesToOpen) {
|
||||
configuration.filesToOpenOrCreate = filesToOpen.filesToOpenOrCreate;
|
||||
configuration.filesToDiff = filesToOpen.filesToDiff;
|
||||
configuration.filesToWait = filesToOpen.filesToWait;
|
||||
}
|
||||
// Inherit CLI arguments from environment and/or
|
||||
// the specific properties from this launch if provided
|
||||
...this.environmentMainService.args,
|
||||
...options.cli,
|
||||
|
||||
// if we know the backup folder upfront (for empty windows to restore), we can set it
|
||||
// directly here which helps for restoring UI state associated with that window.
|
||||
// For all other cases we first call into registerEmptyWindowBackupSync() to set it before
|
||||
// loading the window.
|
||||
if (options.emptyWindowBackupInfo) {
|
||||
configuration.backupPath = join(this.environmentMainService.backupHome, options.emptyWindowBackupInfo.backupFolder);
|
||||
}
|
||||
machineId: this.machineId,
|
||||
|
||||
sessionId: '', // Will be filled in by the window once loaded later
|
||||
windowId: -1, // Will be filled in by the window once loaded later
|
||||
|
||||
mainPid: process.pid,
|
||||
|
||||
appRoot: this.environmentMainService.appRoot,
|
||||
execPath: process.execPath,
|
||||
nodeCachedDataDir: this.environmentMainService.nodeCachedDataDir,
|
||||
partsSplashPath: join(this.environmentMainService.userDataPath, 'rapid_render.json'),
|
||||
// If we know the backup folder upfront (for empty windows to restore), we can set it
|
||||
// directly here which helps for restoring UI state associated with that window.
|
||||
// For all other cases we first call into registerEmptyWindowBackupSync() to set it before
|
||||
// loading the window.
|
||||
backupPath: options.emptyWindowBackupInfo ? join(this.environmentMainService.backupHome, options.emptyWindowBackupInfo.backupFolder) : undefined,
|
||||
|
||||
remoteAuthority: options.remoteAuthority,
|
||||
workspace: options.workspace,
|
||||
userEnv: { ...this.initialUserEnv, ...options.userEnv },
|
||||
|
||||
filesToOpenOrCreate: options.filesToOpen?.filesToOpenOrCreate,
|
||||
filesToDiff: options.filesToOpen?.filesToDiff,
|
||||
filesToWait: options.filesToOpen?.filesToWait,
|
||||
|
||||
logLevel: this.logService.getLevel(),
|
||||
logsPath: this.environmentMainService.logsPath,
|
||||
|
||||
product,
|
||||
isInitialStartup: options.initialStartup,
|
||||
perfMarks: getMarks(),
|
||||
os: { release: release() },
|
||||
zoomLevel: typeof windowConfig?.zoomLevel === 'number' ? windowConfig.zoomLevel : undefined,
|
||||
|
||||
autoDetectHighContrast: windowConfig?.autoDetectHighContrast ?? true,
|
||||
accessibilitySupport: app.accessibilitySupportEnabled,
|
||||
colorScheme: {
|
||||
dark: nativeTheme.shouldUseDarkColors,
|
||||
highContrast: nativeTheme.shouldUseInvertedColorScheme || nativeTheme.shouldUseHighContrastColors
|
||||
}
|
||||
};
|
||||
|
||||
let window: ICodeWindow | undefined;
|
||||
if (!options.forceNewWindow && !options.forceNewTabbedWindow) {
|
||||
|
@ -1227,6 +1259,11 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
|||
}
|
||||
}
|
||||
|
||||
// Update window identifier and session now
|
||||
// that we have the window object in hand.
|
||||
configuration.windowId = window.id;
|
||||
configuration.sessionId = `window:${window.id}`;
|
||||
|
||||
// If the window was already loaded, make sure to unload it
|
||||
// first and only load the new configuration if that was
|
||||
// not vetoed
|
||||
|
|
27
src/vs/vscode.proposed.d.ts
vendored
27
src/vs/vscode.proposed.d.ts
vendored
|
@ -816,11 +816,11 @@ declare module 'vscode' {
|
|||
|
||||
export interface TerminalOptions {
|
||||
/**
|
||||
* Initial text to write to the terminal, note that this is not sent to the process but
|
||||
* rather written directly to the terminal. This supports escape sequences such a setting
|
||||
* text style.
|
||||
* A message to write to the terminal on first launch, note that this is not sent to the
|
||||
* process but, rather written directly to the terminal. This supports escape sequences such
|
||||
* a setting text style.
|
||||
*/
|
||||
readonly initialText?: string;
|
||||
readonly message?: string;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
@ -1090,10 +1090,6 @@ declare module 'vscode' {
|
|||
// todo@API should we really expose this?
|
||||
readonly viewType: string;
|
||||
|
||||
// todo@API cellsAt(range)? getCell(index>)?
|
||||
/** @deprecated Use `getCells(<...>) instead */
|
||||
readonly cells: ReadonlyArray<NotebookCell>;
|
||||
|
||||
/**
|
||||
* The number of cells in the notebook document.
|
||||
*/
|
||||
|
@ -1194,8 +1190,6 @@ declare module 'vscode' {
|
|||
/**
|
||||
* The column in which this editor shows.
|
||||
*/
|
||||
// @jrieken
|
||||
// this is not implemented...
|
||||
readonly viewColumn?: ViewColumn;
|
||||
|
||||
/**
|
||||
|
@ -2894,11 +2888,11 @@ declare module 'vscode' {
|
|||
|
||||
export interface PortAttributesProvider {
|
||||
/**
|
||||
* Provides attributes for the given ports. For ports that your extension doesn't know about, simply don't include
|
||||
* them in the returned array. For example, if `providePortAttributes` is called with ports [3000, 4000] but your
|
||||
* extension doesn't know anything about those ports you can return an empty array.
|
||||
* Provides attributes for the given port. For ports that your extension doesn't know about, simply
|
||||
* return undefined. For example, if `providePortAttributes` is called with ports 3000 but your
|
||||
* extension doesn't know anything about 3000 you should return undefined.
|
||||
*/
|
||||
providePortAttributes(ports: number[], pid: number | undefined, commandLine: string | undefined, token: CancellationToken): ProviderResult<PortAttributes[]>;
|
||||
providePortAttributes(port: number, pid: number | undefined, commandLine: string | undefined, token: CancellationToken): ProviderResult<PortAttributes>;
|
||||
}
|
||||
|
||||
export namespace workspace {
|
||||
|
@ -2909,11 +2903,12 @@ declare module 'vscode' {
|
|||
* ignored, since they don't need to be user facing.
|
||||
*
|
||||
* @param portSelector If registerPortAttributesProvider is called after you start your process then you may already
|
||||
* know the range of ports or the pid of your process.
|
||||
* know the range of ports or the pid of your process. All properties of a the portSelector must be true for your
|
||||
* provider to get called.
|
||||
* The `portRange` is start inclusive and end exclusive.
|
||||
* @param provider The PortAttributesProvider
|
||||
*/
|
||||
export function registerPortAttributesProvider(portSelector: { pid?: number, portRange?: [number, number] }, provider: PortAttributesProvider): Disposable;
|
||||
export function registerPortAttributesProvider(portSelector: { pid?: number, portRange?: [number, number], commandMatcher?: RegExp }, provider: PortAttributesProvider): Disposable;
|
||||
}
|
||||
//#endregion
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ export class MainThreadNotebookDocuments implements MainThreadNotebookDocumentsS
|
|||
notebooksAndEditors.onDidRemoveNotebooks(this._handleNotebooksRemoved, this, this._disposables);
|
||||
|
||||
// forward dirty and save events
|
||||
this._disposables.add(this._notebookEditorModelResolverService.onDidChangeDirty(model => this._proxy.$acceptDirtyStateChanged(model.resource, model.isDirty)));
|
||||
this._disposables.add(this._notebookEditorModelResolverService.onDidChangeDirty(model => this._proxy.$acceptDirtyStateChanged(model.resource, model.isDirty())));
|
||||
this._disposables.add(this._notebookEditorModelResolverService.onDidSaveNotebook(e => this._proxy.$acceptModelSaved(e)));
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,8 @@ export class MainThreadTunnelService extends Disposable implements MainThreadTun
|
|||
const portRange = selector.portRange;
|
||||
const portInRange = portRange ? ports.some(port => portRange[0] <= port && port < portRange[1]) : true;
|
||||
const pidMatches = !selector.pid || (selector.pid === pid);
|
||||
return portInRange || pidMatches;
|
||||
const commandMatches = !selector.commandMatcher || (commandLine && (commandLine.match(selector.commandMatcher)));
|
||||
return portInRange && pidMatches && commandMatches;
|
||||
}).map(entry => entry[0]);
|
||||
|
||||
if (appropriateHandles.length === 0) {
|
||||
|
|
|
@ -213,7 +213,7 @@ function validateProperties(configuration: IConfigurationNode, extension: IExten
|
|||
const propertyConfiguration = properties[key];
|
||||
if (!isObject(propertyConfiguration)) {
|
||||
delete properties[key];
|
||||
extension.collector.error(nls.localize('invalid.property', "'configuration.property' must be an object"));
|
||||
extension.collector.error(nls.localize('invalid.property', "configuration.properties property '{0}' must be an object", key));
|
||||
continue;
|
||||
}
|
||||
if (propertyConfiguration.scope) {
|
||||
|
|
|
@ -633,7 +633,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||
if ('pty' in nameOrOptions) {
|
||||
return extHostTerminalService.createExtensionTerminal(nameOrOptions);
|
||||
}
|
||||
if (nameOrOptions.initialText) {
|
||||
if (nameOrOptions.message) {
|
||||
checkProposedApiEnabled(extension);
|
||||
}
|
||||
if (nameOrOptions.icon) {
|
||||
|
@ -906,7 +906,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||
checkProposedApiEnabled(extension);
|
||||
return extHostTunnelService.onDidChangeTunnels(listener, thisArg, disposables);
|
||||
},
|
||||
registerPortAttributesProvider: (portSelector: { pid?: number, portRange?: [number, number] }, provider: vscode.PortAttributesProvider) => {
|
||||
registerPortAttributesProvider: (portSelector: { pid?: number, portRange?: [number, number], commandMatcher?: RegExp }, provider: vscode.PortAttributesProvider) => {
|
||||
checkProposedApiEnabled(extension);
|
||||
return extHostTunnelService.registerPortsAttributesProvider(portSelector, provider);
|
||||
},
|
||||
|
|
|
@ -1097,6 +1097,7 @@ export enum CandidatePortSource {
|
|||
export interface PortAttributesProviderSelector {
|
||||
pid?: number;
|
||||
portRange?: [number, number];
|
||||
commandMatcher?: RegExp;
|
||||
}
|
||||
|
||||
export interface MainThreadTunnelServiceShape extends IDisposable {
|
||||
|
|
|
@ -384,7 +384,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
|
|||
}
|
||||
};
|
||||
}
|
||||
return this._variableResolver.resolveAny(ws, config);
|
||||
return this._variableResolver.resolveAnyAsync(ws, config);
|
||||
}
|
||||
|
||||
protected createDebugAdapter(adapter: IAdapterDescriptor, session: ExtHostDebugSession): AbstractDebugAdapter | undefined {
|
||||
|
|
|
@ -702,7 +702,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape {
|
|||
if (document) {
|
||||
document.dispose();
|
||||
this._documents.delete(revivedUri);
|
||||
this._textDocumentsAndEditors.$acceptDocumentsAndEditorsDelta({ removedDocuments: document.notebookDocument.cells.map(cell => cell.document.uri) });
|
||||
this._textDocumentsAndEditors.$acceptDocumentsAndEditorsDelta({ removedDocuments: document.notebookDocument.getCells().map(cell => cell.document.uri) });
|
||||
this._onDidCloseNotebookDocument.fire(document.notebookDocument);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ export class ExtHostNotebookConcatDocument implements vscode.NotebookConcatTextD
|
|||
this._cellUris = new ResourceMap();
|
||||
const cellLengths: number[] = [];
|
||||
const cellLineCounts: number[] = [];
|
||||
for (const cell of this._notebook.cells) {
|
||||
for (const cell of this._notebook.getCells()) {
|
||||
if (cell.kind === types.NotebookCellKind.Code && (!this._selector || score(this._selector, cell.document.uri, cell.document.languageId, true))) {
|
||||
this._cellUris.set(cell.document.uri, this._cells.length);
|
||||
this._cells.push(cell);
|
||||
|
|
|
@ -179,7 +179,6 @@ export class ExtHostNotebookDocument extends Disposable {
|
|||
get isUntitled() { return that.uri.scheme === Schemas.untitled; },
|
||||
get isClosed() { return that._disposed; },
|
||||
get metadata() { return that._metadata; },
|
||||
get cells(): ReadonlyArray<vscode.NotebookCell> { return that._cells.map(cell => cell.cell); },
|
||||
get cellCount() { return that._cells.length; },
|
||||
cellAt(index) {
|
||||
index = that._validateIndex(index);
|
||||
|
|
|
@ -46,7 +46,7 @@ export interface IExtHostTunnelService extends ExtHostTunnelServiceShape {
|
|||
getTunnels(): Promise<vscode.TunnelDescription[]>;
|
||||
onDidChangeTunnels: vscode.Event<void>;
|
||||
setTunnelExtensionFunctions(provider: vscode.RemoteAuthorityResolver | undefined): Promise<IDisposable>;
|
||||
registerPortsAttributesProvider(portSelector: { pid?: number, portRange?: [number, number] }, provider: vscode.PortAttributesProvider): IDisposable;
|
||||
registerPortsAttributesProvider(portSelector: { pid?: number, portRange?: [number, number], commandMatcher?: RegExp }, provider: vscode.PortAttributesProvider): IDisposable;
|
||||
}
|
||||
|
||||
export const IExtHostTunnelService = createDecorator<IExtHostTunnelService>('IExtHostTunnelService');
|
||||
|
|
|
@ -66,7 +66,7 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService {
|
|||
withNullAsUndefined(options.cwd),
|
||||
withNullAsUndefined(options.env),
|
||||
withNullAsUndefined(options.icon),
|
||||
withNullAsUndefined(options.initialText),
|
||||
withNullAsUndefined(options.message),
|
||||
/*options.waitOnExit*/ undefined,
|
||||
withNullAsUndefined(options.strictEnv),
|
||||
withNullAsUndefined(options.hideFromUser),
|
||||
|
|
|
@ -22,7 +22,6 @@ import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'
|
|||
import { MovingAverage } from 'vs/base/common/numbers';
|
||||
import { CandidatePort } from 'vs/workbench/services/remote/common/remoteExplorerService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { flatten } from 'vs/base/common/arrays';
|
||||
|
||||
class ExtensionTunnel implements vscode.Tunnel {
|
||||
private _onDispose: Emitter<void> = new Emitter();
|
||||
|
@ -240,17 +239,20 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
|
|||
}
|
||||
|
||||
async $providePortAttributes(handles: number[], ports: number[], pid: number | undefined, commandline: string | undefined, cancellationToken: vscode.CancellationToken): Promise<ProvidedPortAttributes[]> {
|
||||
const providedAttributes = await Promise.all(handles.map(handle => {
|
||||
const providedAttributes: vscode.ProviderResult<vscode.PortAttributes>[] = [];
|
||||
for (const handle of handles) {
|
||||
const provider = this._portAttributesProviders.get(handle);
|
||||
if (!provider) {
|
||||
return [];
|
||||
}
|
||||
return provider.provider.providePortAttributes(ports, pid, commandline, cancellationToken);
|
||||
}));
|
||||
providedAttributes.push(...(await Promise.all(ports.map(async (port) => {
|
||||
return provider.provider.providePortAttributes(port, pid, commandline, cancellationToken);
|
||||
}))));
|
||||
}
|
||||
|
||||
const allAttributes = <vscode.PortAttributes[][]>providedAttributes.filter(attribute => !!attribute && attribute.length > 0);
|
||||
const allAttributes = <vscode.PortAttributes[]>providedAttributes.filter(attribute => !!attribute);
|
||||
|
||||
return (allAttributes.length > 0) ? flatten(allAttributes).map(attributes => {
|
||||
return (allAttributes.length > 0) ? allAttributes.map(attributes => {
|
||||
return {
|
||||
autoForwardAction: <ProvidedOnAutoForward><unknown>attributes.autoForwardAction,
|
||||
port: attributes.port
|
||||
|
|
|
@ -24,6 +24,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
|||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { IWorkspacesService, hasWorkspaceFileExtension } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { WORKSPACE_TRUST_ENABLED } from 'vs/workbench/services/workspaces/common/workspaceTrust';
|
||||
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
|
||||
|
||||
export class OpenFileAction extends Action {
|
||||
|
||||
|
@ -256,7 +257,7 @@ class WorkspaceTrustManageAction extends Action2 {
|
|||
super({
|
||||
id: 'workbench.action.manageTrust',
|
||||
title: { value: localize('manageTrustAction', "Manage Workspace Trust"), original: 'Manage Workspace Trust' },
|
||||
precondition: ContextKeyExpr.equals(`config.${WORKSPACE_TRUST_ENABLED}`, true),
|
||||
precondition: ContextKeyExpr.and(IsWebContext.negate(), ContextKeyExpr.equals(`config.${WORKSPACE_TRUST_ENABLED}`, true)),
|
||||
category: localize('workspacesCategory', "Workspaces"),
|
||||
f1: true
|
||||
});
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue