Merge branch 'main' into fish-shell-integration

This commit is contained in:
Daniel Imms
2022-08-08 15:16:14 -07:00
committed by GitHub
156 changed files with 1492 additions and 684 deletions
+8
View File
@@ -440,5 +440,13 @@
"name": "*workspace-trust-docs",
"action": "close",
"comment": "This issue appears to be the result of the new workspace trust feature shipped in June 2021. This security-focused feature has major impact on the functionality of VS Code. Due to the volume of issues, we ask that you take some time to review our [comprehensive documentation](https://aka.ms/vscode-workspace-trust) on the feature. If your issue is still not resolved, please let us know."
},
{
"type": "label",
"name": "~verification-steps-needed",
"action": "updateLabels",
"addLabel": "verification-steps-needed",
"removeLabel": "~verification-steps-needed",
"comment": "Friendly ping! Looks like this issue requires some further steps to be verified. Please provide us with the steps necessary to verify this issue."
}
]
@@ -0,0 +1,15 @@
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const path = require("path");
const crypto = require("crypto");
const productjson = JSON.parse(fs.readFileSync(path.join(__dirname, '../../../product.json'), 'utf8'));
const shasum = crypto.createHash('sha1');
for (const ext of productjson.builtInExtensions) {
shasum.update(`${ext.name}@${ext.version}`);
}
process.stdout.write(shasum.digest('hex'));
@@ -0,0 +1,17 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as fs from 'fs';
import * as path from 'path';
import * as crypto from 'crypto';
const productjson = JSON.parse(fs.readFileSync(path.join(__dirname, '../../../product.json'), 'utf8'));
const shasum = crypto.createHash('sha1');
for (const ext of productjson.builtInExtensions) {
shasum.update(`${ext.name}@${ext.version}`);
}
process.stdout.write(shasum.digest('hex'));
@@ -38,6 +38,7 @@ steps:
- script: |
mkdir -p .build
node build/azure-pipelines/common/computeNodeModulesCacheKey.js x64 $ENABLE_TERRAPIN > .build/yarnlockhash
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
displayName: Prepare yarn cache flags
- task: Cache@2
@@ -49,7 +50,7 @@ steps:
- task: Cache@2
inputs:
key: '"$(Agent.OS)" | product.json'
key: '"builtInDeps" | .build/builtindepshash'
path: .build/builtInExtensions
displayName: Restore built-in extensions
@@ -38,6 +38,7 @@ steps:
- script: |
mkdir -p .build
node build/azure-pipelines/common/computeNodeModulesCacheKey.js x64 $ENABLE_TERRAPIN > .build/yarnlockhash
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
displayName: Prepare yarn cache flags
- task: Cache@2
@@ -49,7 +50,7 @@ steps:
- task: Cache@2
inputs:
key: '"$(Agent.OS)" | product.json'
key: '"builtInDeps" | .build/builtindepshash'
path: .build/builtInExtensions
displayName: Restore built-in extensions
@@ -72,6 +72,7 @@ steps:
- script: |
mkdir -p .build
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
displayName: Prepare yarn cache flags
- task: Cache@2
@@ -83,7 +84,7 @@ steps:
- task: Cache@2
inputs:
key: '"$(Agent.OS)" | product.json'
key: '"builtInDeps" | .build/builtindepshash'
path: .build/builtInExtensions
displayName: Restore built-in extensions
@@ -58,6 +58,7 @@ steps:
- script: |
mkdir -p .build
node build/azure-pipelines/common/computeNodeModulesCacheKey.js "alpine" $ENABLE_TERRAPIN > .build/yarnlockhash
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
displayName: Prepare yarn cache flags
- task: Cache@2
@@ -69,7 +70,7 @@ steps:
- task: Cache@2
inputs:
key: '"$(Agent.OS)" | product.json'
key: '"builtInDeps" | .build/builtindepshash'
path: .build/builtInExtensions
displayName: Restore built-in extensions
@@ -91,6 +91,7 @@ steps:
- script: |
mkdir -p .build
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
displayName: Prepare yarn cache flags
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
@@ -111,7 +112,7 @@ steps:
- task: Cache@2
inputs:
key: '"$(Agent.OS)" | product.json'
key: '"builtInDeps" | .build/builtindepshash'
path: .build/builtInExtensions
displayName: Restore built-in extensions
@@ -10,6 +10,7 @@ steps:
- script: |
mkdir -p .build
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
displayName: Prepare yarn cache flags
- task: Cache@2
@@ -21,7 +22,7 @@ steps:
- task: Cache@2
inputs:
key: '"$(Agent.OS)" | product.json'
key: '"builtInDeps" | .build/builtindepshash'
path: .build/builtInExtensions
displayName: Restore built-in extensions
+2 -1
View File
@@ -46,6 +46,7 @@ steps:
- script: |
mkdir -p .build
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $ENABLE_TERRAPIN > .build/yarnlockhash
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
displayName: Prepare yarn cache flags
# using `genericNodeModules` instead of `nodeModules` here to avoid sharing the cache with builds running inside containers
@@ -59,7 +60,7 @@ steps:
# Cache built-in extensions to avoid GH rate limits.
- task: Cache@2
inputs:
key: '"$(Agent.OS)" | product.json'
key: '"builtInDeps" | .build/builtindepshash'
path: .build/builtInExtensions
displayName: Restore built-in extensions
@@ -49,6 +49,7 @@ steps:
- script: |
mkdir -p .build
node build/azure-pipelines/common/computeNodeModulesCacheKey.js "web" $ENABLE_TERRAPIN > .build/yarnlockhash
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
displayName: Prepare yarn cache flags
- task: Cache@2
@@ -60,7 +61,7 @@ steps:
- task: Cache@2
inputs:
key: '"$(Agent.OS)" | product.json'
key: '"builtInDeps" | .build/builtindepshash'
path: .build/builtInExtensions
displayName: Restore built-in extensions
@@ -80,6 +80,7 @@ steps:
"$(VSCODE_ARCH)" | Out-File -Encoding ascii -NoNewLine .build\arch
"$env:ENABLE_TERRAPIN" | Out-File -Encoding ascii -NoNewLine .build\terrapin
node build/azure-pipelines/common/computeNodeModulesCacheKey.js > .build/yarnlockhash
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
displayName: Prepare yarn cache flags
- task: Cache@2
@@ -91,7 +92,7 @@ steps:
- task: Cache@2
inputs:
key: '"$(Agent.OS)" | product.json'
key: '"builtInDeps" | .build/builtindepshash'
path: .build/builtInExtensions
displayName: Restore built-in extensions
+8
View File
@@ -351,12 +351,20 @@ function scanBuiltinExtensions(extensionsRoot, exclude = []) {
const children = fs.readdirSync(path.join(extensionsRoot, extensionFolder));
const packageNLSPath = children.filter(child => child === 'package.nls.json')[0];
const packageNLS = packageNLSPath ? JSON.parse(fs.readFileSync(path.join(extensionsRoot, extensionFolder, packageNLSPath)).toString()) : undefined;
let browserNlsMetadataPath;
if (packageJSON.browser) {
const browserEntrypointFolderPath = path.join(extensionFolder, path.dirname(packageJSON.browser));
if (fs.existsSync(path.join(extensionsRoot, browserEntrypointFolderPath, 'nls.metadata.json'))) {
browserNlsMetadataPath = path.join(browserEntrypointFolderPath, 'nls.metadata.json');
}
}
const readme = children.filter(child => /^readme(\.txt|\.md|)$/i.test(child))[0];
const changelog = children.filter(child => /^changelog(\.txt|\.md|)$/i.test(child))[0];
scannedExtensions.push({
extensionPath: extensionFolder,
packageJSON,
packageNLS,
browserNlsMetadataPath,
readmePath: readme ? path.join(extensionFolder, readme) : undefined,
changelogPath: changelog ? path.join(extensionFolder, changelog) : undefined,
});
+9
View File
@@ -412,6 +412,7 @@ export interface IScannedBuiltinExtension {
extensionPath: string;
packageJSON: any;
packageNLS?: any;
browserNlsMetadataPath?: string;
readmePath?: string;
changelogPath?: string;
}
@@ -436,6 +437,13 @@ export function scanBuiltinExtensions(extensionsRoot: string, exclude: string[]
const children = fs.readdirSync(path.join(extensionsRoot, extensionFolder));
const packageNLSPath = children.filter(child => child === 'package.nls.json')[0];
const packageNLS = packageNLSPath ? JSON.parse(fs.readFileSync(path.join(extensionsRoot, extensionFolder, packageNLSPath)).toString()) : undefined;
let browserNlsMetadataPath: string | undefined;
if (packageJSON.browser) {
const browserEntrypointFolderPath = path.join(extensionFolder, path.dirname(packageJSON.browser));
if (fs.existsSync(path.join(extensionsRoot, browserEntrypointFolderPath, 'nls.metadata.json'))) {
browserNlsMetadataPath = path.join(browserEntrypointFolderPath, 'nls.metadata.json');
}
}
const readme = children.filter(child => /^readme(\.txt|\.md|)$/i.test(child))[0];
const changelog = children.filter(child => /^changelog(\.txt|\.md|)$/i.test(child))[0];
@@ -443,6 +451,7 @@ export function scanBuiltinExtensions(extensionsRoot: string, exclude: string[]
extensionPath: extensionFolder,
packageJSON,
packageNLS,
browserNlsMetadataPath,
readmePath: readme ? path.join(extensionFolder, readme) : undefined,
changelogPath: changelog ? path.join(extensionFolder, changelog) : undefined,
});
@@ -21,7 +21,7 @@
},
"dependencies": {
"jsonc-parser": "^2.2.1",
"vscode-nls": "^5.0.0"
"vscode-nls": "^5.1.0"
},
"capabilities": {
"virtualWorkspaces": true,
+4 -4
View File
@@ -12,7 +12,7 @@ jsonc-parser@^2.2.1:
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.2.1.tgz#db73cd59d78cce28723199466b2a03d1be1df2bc"
integrity sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w==
vscode-nls@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
@@ -995,7 +995,7 @@
},
"dependencies": {
"vscode-languageclient": "^8.0.2-next.4",
"vscode-nls": "^5.0.0",
"vscode-nls": "^5.1.0",
"vscode-uri": "^3.0.3"
},
"devDependencies": {
+4 -4
View File
@@ -73,10 +73,10 @@ vscode-languageserver-types@3.17.2-next.2:
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2-next.2.tgz#af5d6978eee7682aab87c1419323f5b141ac6596"
integrity sha512-TiAkLABgqkVWdAlC3XlOfdhdjIAdVU4YntPUm9kKGbXr+MGwpVnKz2KZMNBcvG0CFx8Hi8qliL0iq+ndPB720w==
vscode-nls@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
vscode-uri@^3.0.3:
version "3.0.3"
+1 -1
View File
@@ -33,7 +33,7 @@
]
},
"dependencies": {
"vscode-nls": "^4.0.0"
"vscode-nls": "^5.1.0"
},
"devDependencies": {
"@types/node": "16.x"
+4 -4
View File
@@ -7,7 +7,7 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.6.tgz#6bef7a2a0ad684cf6e90fcfe31cecabd9ce0a3ae"
integrity sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==
vscode-nls@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002"
integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
+1 -1
View File
@@ -150,7 +150,7 @@
]
},
"dependencies": {
"vscode-nls": "^4.0.0"
"vscode-nls": "^5.1.0"
},
"devDependencies": {
"@types/node": "16.x"
+4 -4
View File
@@ -7,7 +7,7 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.6.tgz#6bef7a2a0ad684cf6e90fcfe31cecabd9ce0a3ae"
integrity sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==
vscode-nls@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002"
integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
+1 -1
View File
@@ -29,7 +29,7 @@
"jsonc-parser": "^2.2.1",
"markdown-it": "^12.3.2",
"parse5": "^3.0.2",
"vscode-nls": "^5.0.0"
"vscode-nls": "^5.1.0"
},
"contributes": {
"jsonValidation": [
+4 -4
View File
@@ -67,7 +67,7 @@ uc.micro@^1.0.1, uc.micro@^1.0.5:
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac"
integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==
vscode-nls@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
+1 -1
View File
@@ -100,7 +100,7 @@
]
},
"dependencies": {
"vscode-nls": "^5.0.0"
"vscode-nls": "^5.1.0"
},
"devDependencies": {
"@types/node": "16.x"
+4 -4
View File
@@ -7,7 +7,7 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.21.tgz#474d7589a30afcf5291f59bd49cca9ad171ffde4"
integrity sha512-Pf8M1XD9i1ksZEcCP8vuSNwooJ/bZapNmIzpmsMaL+jMI+8mEYU3PKvs+xDNuQcJWF/x24WzY4qxLtB0zNow9A==
vscode-nls@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
+1 -1
View File
@@ -2719,7 +2719,7 @@
"file-type": "^7.2.0",
"jschardet": "3.0.0",
"picomatch": "2.3.1",
"vscode-nls": "^4.0.0",
"vscode-nls": "^5.1.0",
"vscode-uri": "^2.0.0",
"which": "^1.3.0"
},
+4 -4
View File
@@ -120,10 +120,10 @@ picomatch@2.3.1:
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
vscode-nls@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002"
integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
vscode-uri@^2.0.0:
version "2.0.0"
@@ -62,7 +62,7 @@
"node-fetch": "2.6.7",
"uuid": "8.1.0",
"@vscode/extension-telemetry": "0.6.2",
"vscode-nls": "^5.0.0",
"vscode-nls": "^5.1.0",
"vscode-tas-client": "^0.1.47"
},
"devDependencies": {
+4 -4
View File
@@ -143,10 +143,10 @@ uuid@8.1.0:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.1.0.tgz#6f1536eb43249f473abc6bd58ff983da1ca30d8d"
integrity sha512-CI18flHDznR0lq54xBycOVmphdCYnQLKn8abKn7PXUiKUGdEd+/l9LWNJmugXel4hXq7S+RMNl34ecyC9TntWg==
vscode-nls@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
vscode-tas-client@^0.1.47:
version "0.1.47"
+1 -1
View File
@@ -132,7 +132,7 @@
"dependencies": {
"@octokit/rest": "^18.0.1",
"tunnel": "^0.0.6",
"vscode-nls": "^4.1.2"
"vscode-nls": "^5.1.0"
},
"devDependencies": {
"@types/node": "16.x"
+4 -4
View File
@@ -153,10 +153,10 @@ universal-user-agent@^6.0.0:
resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.0.tgz#3381f8503b251c0d9cd21bc1de939ec9df5480ee"
integrity sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==
vscode-nls@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.2.tgz#ca8bf8bb82a0987b32801f9fddfdd2fb9fd3c167"
integrity sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
webidl-conversions@^3.0.0:
version "3.0.1"
+1 -1
View File
@@ -17,7 +17,7 @@
"watch": "gulp watch-extension:grunt"
},
"dependencies": {
"vscode-nls": "^4.0.0"
"vscode-nls": "^5.1.0"
},
"devDependencies": {
"@types/node": "16.x"
+4 -4
View File
@@ -7,7 +7,7 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.6.tgz#6bef7a2a0ad684cf6e90fcfe31cecabd9ce0a3ae"
integrity sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==
vscode-nls@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002"
integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
+1 -1
View File
@@ -17,7 +17,7 @@
"watch": "gulp watch-extension:gulp"
},
"dependencies": {
"vscode-nls": "^4.0.0"
"vscode-nls": "^5.1.0"
},
"devDependencies": {
"@types/node": "16.x"
+4 -4
View File
@@ -7,7 +7,7 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.6.tgz#6bef7a2a0ad684cf6e90fcfe31cecabd9ce0a3ae"
integrity sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==
vscode-nls@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002"
integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
@@ -260,7 +260,7 @@
"dependencies": {
"@vscode/extension-telemetry": "0.5.1",
"vscode-languageclient": "^8.0.2-next.4",
"vscode-nls": "^5.0.1",
"vscode-nls": "^5.1.0",
"vscode-uri": "^3.0.3"
},
"devDependencies": {
@@ -13,7 +13,7 @@
"vscode-html-languageservice": "^5.0.1",
"vscode-languageserver": "^8.0.2-next.4",
"vscode-languageserver-textdocument": "^1.0.4",
"vscode-nls": "^5.0.1",
"vscode-nls": "^5.1.0",
"vscode-uri": "^3.0.3"
},
"devDependencies": {
@@ -72,6 +72,11 @@ vscode-nls@^5.0.1:
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.1.tgz#ba23fc4d4420d25e7f886c8e83cbdcec47aa48b2"
integrity sha512-hHQV6iig+M21lTdItKPkJAaWrxALQb/nqpVffakO4knJOh3DrU2SXOMzUzNgo1eADPzu3qSsJY1weCzvR52q9A==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
vscode-uri@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.3.tgz#a95c1ce2e6f41b7549f86279d19f47951e4f4d84"
+4 -4
View File
@@ -78,10 +78,10 @@ vscode-languageserver-types@3.17.2-next.2:
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2-next.2.tgz#af5d6978eee7682aab87c1419323f5b141ac6596"
integrity sha512-TiAkLABgqkVWdAlC3XlOfdhdjIAdVU4YntPUm9kKGbXr+MGwpVnKz2KZMNBcvG0CFx8Hi8qliL0iq+ndPB720w==
vscode-nls@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.1.tgz#ba23fc4d4420d25e7f886c8e83cbdcec47aa48b2"
integrity sha512-hHQV6iig+M21lTdItKPkJAaWrxALQb/nqpVffakO4knJOh3DrU2SXOMzUzNgo1eADPzu3qSsJY1weCzvR52q9A==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
vscode-uri@^3.0.3:
version "3.0.3"
+1 -1
View File
@@ -80,7 +80,7 @@
},
"dependencies": {
"@vscode/extension-telemetry": "0.6.2",
"vscode-nls": "^5.0.0"
"vscode-nls": "^5.1.0"
},
"repository": {
"type": "git",
+4 -4
View File
@@ -46,7 +46,7 @@
"@microsoft/1ds-core-js" "^3.2.3"
"@microsoft/1ds-post-js" "^3.2.3"
vscode-nls@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
+17 -1
View File
@@ -9,7 +9,8 @@
"vscode": "^1.57.0"
},
"enabledApiProposals": [
"notebookWorkspaceEdit"
"notebookWorkspaceEdit",
"documentPaste"
],
"activationEvents": [
"*"
@@ -27,6 +28,21 @@
}
},
"contributes": {
"configuration":[
{
"properties": {
"ipynb.experimental.pasteImages.enabled":{
"type": "boolean",
"scope": "resource",
"markdownDescription": "%ipynb.experimental.pasteImages.enabled%",
"default": false,
"tags": [
"experimental"
]
}
}
}
],
"commands": [
{
"command": "ipynb.newUntitledIpynb",
+2 -1
View File
@@ -1,4 +1,5 @@
{
"displayName": ".ipynb support",
"description": "Provides basic support for opening and reading Jupyter's .ipynb notebook files"
"description": "Provides basic support for opening and reading Jupyter's .ipynb notebook files",
"ipynb.experimental.pasteImages.enabled":"Enable/Disable pasting images into markdown cells within ipynb files. Requires enabling `#ipynb.experimental.pasteImages.enabled#`."
}
@@ -22,7 +22,7 @@ export async function activate(ctx: RendererContext<void>) {
md.renderer.rules.image = (tokens: MarkdownItToken[], idx: number, options, env, self) => {
const token = tokens[idx];
const src = token.attrGet('src');
const attachments: Record<string, Record<string, string>> = env.outputItem.metadata().custom?.attachments;
const attachments: Record<string, Record<string, string>> = env.outputItem.metadata.custom?.attachments;
if (attachments && src) {
const imageAttachment = attachments[src.replace('attachment:', '')];
if (imageAttachment) {
+4
View File
@@ -6,6 +6,7 @@
import * as vscode from 'vscode';
import { ensureAllNewCellsHaveCellIds } from './cellIdService';
import { NotebookSerializer } from './notebookSerializer';
import * as NotebookImagePaste from './notebookImagePaste';
// From {nbformat.INotebookMetadata} in @jupyterlab/coreutils
type NotebookMetadata = {
@@ -77,12 +78,15 @@ export function activate(context: vscode.ExtensionContext) {
await vscode.window.showNotebookDocument(document);
}));
context.subscriptions.push(NotebookImagePaste.imagePasteSetup());
// Update new file contribution
vscode.extensions.onDidChange(() => {
vscode.commands.executeCommand('setContext', 'jupyterEnabled', vscode.extensions.getExtension('ms-toolsai.jupyter'));
});
vscode.commands.executeCommand('setContext', 'jupyterEnabled', vscode.extensions.getExtension('ms-toolsai.jupyter'));
return {
exportNotebook: (notebook: vscode.NotebookData): string => {
return exportNotebook(notebook, serializer);
+143
View File
@@ -0,0 +1,143 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
class CopyPasteEditProvider implements vscode.DocumentPasteEditProvider {
async provideDocumentPasteEdits(
_document: vscode.TextDocument,
_ranges: readonly vscode.Range[],
dataTransfer: vscode.DataTransfer,
_token: vscode.CancellationToken
): Promise<vscode.DocumentPasteEdit | undefined> {
const enabled = vscode.workspace.getConfiguration('ipynb', _document).get('experimental.pasteImages.enabled', false);
if (!enabled) {
return undefined;
}
// get b64 data from paste
// TODO: dataTransfer.get() limits to one image pasted
const dataItem = dataTransfer.get('image/png');
if (!dataItem) {
return undefined;
}
const fileDataAsUint8 = await dataItem.asFile()?.data();
if (!fileDataAsUint8) {
return undefined;
}
// get filename data from paste
let pasteFilename = dataItem.asFile()?.name;
if (!pasteFilename) {
return undefined;
}
const separatorIndex = pasteFilename?.lastIndexOf('.');
const filename = pasteFilename?.slice(0, separatorIndex);
const filetype = pasteFilename?.slice(separatorIndex);
if (!filename || !filetype) {
return undefined;
}
// get notebook cell data
let notebookUri;
let currentCell;
for (const notebook of vscode.workspace.notebookDocuments) {
if (notebook.uri.path === _document.uri.path) {
for (const cell of notebook.getCells()) {
if (cell.document === _document) {
currentCell = cell;
notebookUri = notebook.uri;
break;
}
}
}
}
if (!currentCell || !notebookUri) {
return undefined;
}
// create updated metadata for cell (prep for WorkspaceEdit)
const b64string = encodeBase64(fileDataAsUint8);
const startingAttachments = currentCell.metadata?.custom?.attachments;
if (!startingAttachments) {
currentCell.metadata.custom['attachments'] = { [pasteFilename]: { 'image/png': b64string } };
} else {
for (let appendValue = 2; pasteFilename in startingAttachments; appendValue++) {
const objEntries = Object.entries(startingAttachments[pasteFilename]);
if (objEntries.length) { // check that mime:b64 are present
const [, attachmentb64] = objEntries[0];
if (attachmentb64 !== b64string) { // append a "-#" here. same name, diff data. this matches jupyter behavior
pasteFilename = filename.concat(`-${appendValue}`) + filetype;
}
}
}
currentCell.metadata.custom.attachments[pasteFilename] = { 'image/png': b64string };
}
const metadataNotebookEdit = vscode.NotebookEdit.updateCellMetadata(currentCell.index, currentCell.metadata);
const workspaceEdit = new vscode.WorkspaceEdit();
if (metadataNotebookEdit) {
workspaceEdit.set(notebookUri, [metadataNotebookEdit]);
}
// create a snippet for paste
const pasteSnippet = new vscode.SnippetString();
pasteSnippet.appendText('![');
pasteSnippet.appendPlaceholder(`${pasteFilename}`);
pasteSnippet.appendText(`](attachment:${pasteFilename})`);
return { insertText: pasteSnippet, additionalEdit: workspaceEdit };
}
}
export function imagePasteSetup() {
const selector: vscode.DocumentSelector = { notebookType: 'jupyter-notebook', language: 'markdown' }; // this is correct provider
return vscode.languages.registerDocumentPasteEditProvider(selector, new CopyPasteEditProvider(), {
pasteMimeTypes: ['image/png'],
});
}
/**
* Taken from https://github.com/microsoft/vscode/blob/743b016722db90df977feecde0a4b3b4f58c2a4c/src/vs/base/common/buffer.ts#L350-L387
*/
function encodeBase64(buffer: Uint8Array, padded = true, urlSafe = false) {
const base64Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const base64UrlSafeAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
const dictionary = urlSafe ? base64UrlSafeAlphabet : base64Alphabet;
let output = '';
const remainder = buffer.byteLength % 3;
let i = 0;
for (; i < buffer.byteLength - remainder; i += 3) {
const a = buffer[i + 0];
const b = buffer[i + 1];
const c = buffer[i + 2];
output += dictionary[a >>> 2];
output += dictionary[(a << 4 | b >>> 4) & 0b111111];
output += dictionary[(b << 2 | c >>> 6) & 0b111111];
output += dictionary[c & 0b111111];
}
if (remainder === 1) {
const a = buffer[i + 0];
output += dictionary[a >>> 2];
output += dictionary[(a << 4) & 0b111111];
if (padded) { output += '=='; }
} else if (remainder === 2) {
const a = buffer[i + 0];
const b = buffer[i + 1];
output += dictionary[a >>> 2];
output += dictionary[(a << 4 | b >>> 4) & 0b111111];
output += dictionary[(b << 2) & 0b111111];
if (padded) { output += '='; }
}
return output;
}
+2 -1
View File
@@ -9,6 +9,7 @@
"include": [
"src/**/*",
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.notebookWorkspaceEdit.d.ts"
"../../src/vscode-dts/vscode.proposed.notebookWorkspaceEdit.d.ts",
"../../src/vscode-dts/vscode.proposed.documentPaste.d.ts"
]
}
+1 -1
View File
@@ -17,7 +17,7 @@
"watch": "gulp watch-extension:jake"
},
"dependencies": {
"vscode-nls": "^4.0.0"
"vscode-nls": "^5.1.0"
},
"devDependencies": {
"@types/node": "16.x"
+4 -4
View File
@@ -7,7 +7,7 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.6.tgz#6bef7a2a0ad684cf6e90fcfe31cecabd9ce0a3ae"
integrity sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==
vscode-nls@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002"
integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
@@ -156,7 +156,7 @@
"@vscode/extension-telemetry": "0.6.2",
"request-light": "^0.5.8",
"vscode-languageclient": "^8.0.2-next.5",
"vscode-nls": "^5.0.1"
"vscode-nls": "^5.1.0"
},
"devDependencies": {
"@types/node": "16.x"
+4 -4
View File
@@ -122,10 +122,10 @@ vscode-languageserver-types@3.17.2-next.2:
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2-next.2.tgz#af5d6978eee7682aab87c1419323f5b141ac6596"
integrity sha512-TiAkLABgqkVWdAlC3XlOfdhdjIAdVU4YntPUm9kKGbXr+MGwpVnKz2KZMNBcvG0CFx8Hi8qliL0iq+ndPB720w==
vscode-nls@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.1.tgz#ba23fc4d4420d25e7f886c8e83cbdcec47aa48b2"
integrity sha512-hHQV6iig+M21lTdItKPkJAaWrxALQb/nqpVffakO4knJOh3DrU2SXOMzUzNgo1eADPzu3qSsJY1weCzvR52q9A==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
yallist@^4.0.0:
version "4.0.0"
@@ -259,11 +259,10 @@ export const activate: ActivationFunction<void> = (ctx) => {
code {
font-size: 1em;
font-family: var(--vscode-editor-font-family);
}
pre code {
font-family: var(--vscode-editor-font-family);
line-height: 1.357em;
white-space: pre-wrap;
}
@@ -568,7 +568,7 @@
"picomatch": "^2.3.1",
"vscode-languageclient": "^8.0.1",
"vscode-languageserver-textdocument": "^1.0.4",
"vscode-nls": "^5.0.0",
"vscode-nls": "^5.1.0",
"vscode-uri": "^3.0.3"
},
"devDependencies": {
@@ -263,16 +263,16 @@ vscode-markdown-languageservice@^0.0.0-alpha.10:
vscode-nls "^5.0.1"
vscode-uri "^3.0.3"
vscode-nls@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
vscode-nls@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.1.tgz#ba23fc4d4420d25e7f886c8e83cbdcec47aa48b2"
integrity sha512-hHQV6iig+M21lTdItKPkJAaWrxALQb/nqpVffakO4knJOh3DrU2SXOMzUzNgo1eADPzu3qSsJY1weCzvR52q9A==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
vscode-uri@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.3.tgz#a95c1ce2e6f41b7549f86279d19f47951e4f4d84"
+1 -1
View File
@@ -158,7 +158,7 @@
}
},
"dependencies": {
"vscode-nls": "^5.0.0"
"vscode-nls": "^5.1.0"
},
"devDependencies": {
"@types/node": "16.x"
+4 -4
View File
@@ -7,7 +7,7 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.6.tgz#6bef7a2a0ad684cf6e90fcfe31cecabd9ce0a3ae"
integrity sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==
vscode-nls@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
@@ -61,7 +61,7 @@
"stream": "0.0.2",
"uuid": "^8.2.0",
"@vscode/extension-telemetry": "0.6.2",
"vscode-nls": "^5.0.0"
"vscode-nls": "^5.1.0"
},
"repository": {
"type": "git",
@@ -184,6 +184,9 @@ export class AzureActiveDirectoryService {
if (!modifiedScopes.includes('profile')) {
modifiedScopes.push('profile');
}
if (!modifiedScopes.includes('offline_access')) {
modifiedScopes.push('offline_access');
}
modifiedScopes = modifiedScopes.sort();
let modifiedScopesStr = modifiedScopes.join(' ');
@@ -198,10 +198,10 @@ uuid@^8.2.0:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.2.0.tgz#cb10dd6b118e2dada7d0cd9730ba7417c93d920e"
integrity sha512-CYpGiFTUrmI6OBMkAdjSDM0k5h8SkkiTP4WAjQgDgNB1S3Ou9VBEvr6q0Kv2H1mMk7IWfxYGpMH5sd5AvcIV2Q==
vscode-nls@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
webidl-conversions@^3.0.0:
version "3.0.1"
+1 -1
View File
@@ -22,7 +22,7 @@
"jsonc-parser": "^2.2.1",
"minimatch": "^3.0.4",
"request-light": "^0.5.7",
"vscode-nls": "^5.0.0",
"vscode-nls": "^5.1.0",
"which": "^2.0.2",
"which-pm": "^2.0.0"
},
+4 -4
View File
@@ -192,10 +192,10 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"
vscode-nls@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
which-pm@^2.0.0:
version "2.0.0"
@@ -74,7 +74,7 @@
"watch": "npx gulp watch-extension:php-language-features"
},
"dependencies": {
"vscode-nls": "^4.0.0",
"vscode-nls": "^5.1.0",
"which": "^2.0.2"
},
"devDependencies": {
+4 -4
View File
@@ -17,10 +17,10 @@ isexe@^2.0.0:
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
vscode-nls@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002"
integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
which@^2.0.2:
version "2.0.2"
+1 -1
View File
@@ -407,7 +407,7 @@
"watch": "npx gulp watch-extension:references-view"
},
"dependencies": {
"vscode-nls": "^5.0.0"
"vscode-nls": "^5.1.0"
},
"devDependencies": {
"@types/node": "16.x"
+4 -4
View File
@@ -7,7 +7,7 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.33.tgz#566713b1b626f781c5c58fe3531307283e00720c"
integrity sha512-0PJ0vg+JyU0MIan58IOIFRtSvsb7Ri+7Wltx2qAg94eMOrpg4+uuP3aUHCpxXc1i0jCXiC+zIamSZh3l9AbcQA==
vscode-nls@^5.0.0:
version "5.0.1"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.1.tgz#ba23fc4d4420d25e7f886c8e83cbdcec47aa48b2"
integrity sha512-hHQV6iig+M21lTdItKPkJAaWrxALQb/nqpVffakO4knJOh3DrU2SXOMzUzNgo1eADPzu3qSsJY1weCzvR52q9A==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
+40 -19
View File
@@ -70,6 +70,10 @@ function withNodeDefaults(/**@type WebpackConfig*/extConfig) {
return merge(defaultConfig, extConfig);
}
/**
*
* @param {string} context
*/
function nodePlugins(context) {
// Need to find the top-most `package.json` file
const folderName = path.relative(__dirname, context).split(/[\\\/]/)[0];
@@ -109,6 +113,13 @@ function withBrowserDefaults(/**@type WebpackConfig*/extConfig, /** @type Additi
test: /\.ts$/,
exclude: /node_modules/,
use: [{
// vscode-nls-dev loader:
// * rewrite nls-calls
loader: 'vscode-nls-dev/lib/webpack-loader',
options: {
base: path.join(extConfig.context, 'src')
}
}, {
// configure TypeScript loader:
// * enable sources maps for end-to-end source maps
loader: 'ts-loader',
@@ -123,6 +134,7 @@ function withBrowserDefaults(/**@type WebpackConfig*/extConfig, /** @type Additi
},
externals: {
'vscode': 'commonjs vscode', // ignored because it doesn't exist,
'vscode-nls-web-data': 'commonjs vscode-nls-web-data', // ignored because this is injected by the webworker extension host
'applicationinsights-native-metrics': 'commonjs applicationinsights-native-metrics', // ignored because we don't ship native module
'@opentelemetry/tracing': 'commonjs @opentelemetry/tracing' // ignored because we don't ship this module
},
@@ -138,30 +150,39 @@ function withBrowserDefaults(/**@type WebpackConfig*/extConfig, /** @type Additi
},
// yes, really source maps
devtool: 'source-map',
plugins: browserPlugins
plugins: browserPlugins(extConfig.context)
};
return merge(defaultConfig, extConfig);
}
const browserPlugins = [
new optimize.LimitChunkCountPlugin({
maxChunks: 1
}),
new CopyWebpackPlugin({
patterns: [
{ from: 'src', to: '.', globOptions: { ignore: ['**/test/**', '**/*.ts'] }, noErrorOnMissing: true }
]
}),
new DefinePlugin({
'process.platform': JSON.stringify('web'),
'process.env': JSON.stringify({}),
'process.env.BROWSER_ENV': JSON.stringify('true')
})
];
/**
*
* @param {string} context
*/
function browserPlugins(context) {
// Need to find the top-most `package.json` file
const folderName = path.relative(__dirname, context).split(/[\\\/]/)[0];
const pkgPath = path.join(__dirname, folderName, 'package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
const id = `${pkg.publisher}.${pkg.name}`;
return [
new optimize.LimitChunkCountPlugin({
maxChunks: 1
}),
new CopyWebpackPlugin({
patterns: [
{ from: 'src', to: '.', globOptions: { ignore: ['**/test/**', '**/*.ts'] }, noErrorOnMissing: true }
]
}),
new DefinePlugin({
'process.platform': JSON.stringify('web'),
'process.env': JSON.stringify({}),
'process.env.BROWSER_ENV': JSON.stringify('true')
}),
new NLSBundlePlugin(id)
];
}
module.exports = withNodeDefaults;
module.exports.node = withNodeDefaults;
+1 -1
View File
@@ -68,7 +68,7 @@
},
"dependencies": {
"@vscode/extension-telemetry": "0.6.2",
"vscode-nls": "^5.0.0"
"vscode-nls": "^5.1.0"
},
"devDependencies": {
"@types/vscode-webview": "^1.57.0",
+4 -4
View File
@@ -56,7 +56,7 @@ vscode-codicons@^0.0.14:
resolved "https://registry.yarnpkg.com/vscode-codicons/-/vscode-codicons-0.0.14.tgz#e0d05418e2e195564ff6f6a2199d70415911c18f"
integrity sha512-6CEH5KT9ct5WMw7n5dlX7rB8ya4CUI2FSq1Wk36XaW+c5RglFtAanUV0T+gvZVVFhl/WxfjTvFHq06Hz9c1SLA==
vscode-nls@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
@@ -37,7 +37,7 @@ module.exports = withBrowserDefaults({
extension: './src/extension.browser.ts',
},
plugins: [
...browserPlugins, // add plugins, don't replace inherited
...browserPlugins(__dirname), // add plugins, don't replace inherited
// @ts-ignore
new CopyPlugin({
@@ -37,7 +37,7 @@
"@vscode/extension-telemetry": "0.6.2",
"jsonc-parser": "^2.2.1",
"semver": "5.5.1",
"vscode-nls": "^5.0.0",
"vscode-nls": "^5.1.0",
"vscode-tas-client": "^0.1.47",
"vscode-uri": "^3.0.3"
},
@@ -85,10 +85,10 @@ tas-client@0.1.45:
dependencies:
axios "^0.26.1"
vscode-nls@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840"
integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==
vscode-nls@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4"
integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w==
vscode-tas-client@^0.1.47:
version "0.1.47"
@@ -7,7 +7,7 @@ import * as assert from 'assert';
import 'mocha';
import { TextDecoder } from 'util';
import * as vscode from 'vscode';
import { asPromise, assertNoRpc, closeAllEditors, createRandomFile, disposeAll, revertAllDirty, saveAllEditors } from '../utils';
import { asPromise, assertNoRpc, closeAllEditors, createRandomFile, DeferredPromise, disposeAll, revertAllDirty, saveAllEditors } from '../utils';
async function createRandomNotebookFile() {
return createRandomFile('', undefined, '.vsctestnb');
@@ -181,7 +181,7 @@ const apiTestContentProvider: vscode.NotebookContentProvider = {
const editor = vscode.window.activeNotebookEditor!;
const cell = editor.notebook.cellAt(0);
await withEvent(vscode.workspace.onDidChangeNotebookDocument, async (event) => {
await withEvent(vscode.workspace.onDidChangeNotebookDocument, async event => {
await vscode.commands.executeCommand('notebook.execute');
await event;
assert.strictEqual(cell.outputs.length, 1, 'should execute'); // runnable, it worked
@@ -196,7 +196,7 @@ const apiTestContentProvider: vscode.NotebookContentProvider = {
const secondResource = await createRandomNotebookFile();
await vscode.commands.executeCommand('vscode.openWith', secondResource, 'notebookCoreTest');
await withEvent<vscode.NotebookDocumentChangeEvent>(vscode.workspace.onDidChangeNotebookDocument, async (event) => {
await withEvent<vscode.NotebookDocumentChangeEvent>(vscode.workspace.onDidChangeNotebookDocument, async event => {
await vscode.commands.executeCommand('notebook.cell.execute', { start: 0, end: 1 }, notebook.uri);
await event;
assert.strictEqual(cell.outputs.length, 1, 'should execute'); // runnable, it worked
@@ -204,35 +204,33 @@ const apiTestContentProvider: vscode.NotebookContentProvider = {
});
});
// #126371
test('cell execute command takes arguments', async () => {
test('cell execute command takes arguments 2', async () => {
const notebook = await openRandomNotebookDocument();
await vscode.window.showNotebookDocument(notebook);
let firstCellExecuted = false;
let secondCellExecuted = false;
let resolve: () => void;
const p = new Promise<void>(r => resolve = r);
const listener = vscode.workspace.onDidChangeNotebookDocument(e => {
const def = new DeferredPromise<void>();
testDisposables.push(vscode.workspace.onDidChangeNotebookDocument(e => {
e.cellChanges.forEach(change => {
if (change.cell.index === 0) {
if (change.cell.index === 0 && change.executionSummary) {
firstCellExecuted = true;
}
if (change.cell.index === 1) {
if (change.cell.index === 1 && change.executionSummary) {
secondCellExecuted = true;
}
});
if (firstCellExecuted && secondCellExecuted) {
resolve();
def.complete();
}
});
}));
vscode.commands.executeCommand('notebook.cell.execute', { document: notebook.uri, ranges: [{ start: 0, end: 1 }, { start: 1, end: 2 }] });
await p;
listener.dispose();
await def.p;
await saveAllFilesAndCloseAll();
});
@@ -301,27 +299,30 @@ const apiTestContentProvider: vscode.NotebookContentProvider = {
const cell = editor.notebook.cellAt(0);
let eventCount = 0;
let resolve: () => void;
const p = new Promise<void>(r => resolve = r);
const listener = vscode.notebooks.onDidChangeNotebookCellExecutionState(e => {
if (eventCount === 0) {
assert.strictEqual(e.state, vscode.NotebookCellExecutionState.Pending, 'should be set to Pending');
} else if (eventCount === 1) {
assert.strictEqual(e.state, vscode.NotebookCellExecutionState.Executing, 'should be set to Executing');
assert.strictEqual(cell.outputs.length, 0, 'no outputs yet: ' + JSON.stringify(cell.outputs[0]));
} else if (eventCount === 2) {
assert.strictEqual(e.state, vscode.NotebookCellExecutionState.Idle, 'should be set to Idle');
assert.strictEqual(cell.outputs.length, 1, 'should have an output');
resolve();
}
const def = new DeferredPromise<void>();
testDisposables.push(vscode.notebooks.onDidChangeNotebookCellExecutionState(e => {
try {
assert.strictEqual(e.cell.document.uri.toString(), cell.document.uri.toString(), 'event should be fired for the executing cell');
eventCount++;
});
if (eventCount === 0) {
assert.strictEqual(e.state, vscode.NotebookCellExecutionState.Pending, 'should be set to Pending');
} else if (eventCount === 1) {
assert.strictEqual(e.state, vscode.NotebookCellExecutionState.Executing, 'should be set to Executing');
assert.strictEqual(cell.outputs.length, 0, 'no outputs yet: ' + JSON.stringify(cell.outputs[0]));
} else if (e.state === vscode.NotebookCellExecutionState.Idle) {
assert.strictEqual(cell.outputs.length, 1, 'should have an output');
def.complete();
}
eventCount++;
} catch (err) {
def.error(err);
}
}));
vscode.commands.executeCommand('notebook.cell.execute', { document: notebook.uri, ranges: [{ start: 0, end: 1 }] });
await p;
listener.dispose();
await def.p;
});
test('Output changes are applied once the promise resolves', async function () {
+58
View File
@@ -184,3 +184,61 @@ export async function poll<T>(
trial++;
}
}
export type ValueCallback<T = unknown> = (value: T | Promise<T>) => void;
/**
* Creates a promise whose resolution or rejection can be controlled imperatively.
*/
export class DeferredPromise<T> {
private completeCallback!: ValueCallback<T>;
private errorCallback!: (err: unknown) => void;
private rejected = false;
private resolved = false;
public get isRejected() {
return this.rejected;
}
public get isResolved() {
return this.resolved;
}
public get isSettled() {
return this.rejected || this.resolved;
}
public readonly p: Promise<T>;
constructor() {
this.p = new Promise<T>((c, e) => {
this.completeCallback = c;
this.errorCallback = e;
});
}
public complete(value: T) {
return new Promise<void>(resolve => {
this.completeCallback(value);
this.resolved = true;
resolve();
});
}
public error(err: unknown) {
return new Promise<void>(resolve => {
this.errorCallback(err);
this.rejected = true;
resolve();
});
}
public cancel() {
new Promise<void>(resolve => {
this.errorCallback(new Error('Canceled'));
this.rejected = true;
resolve();
});
}
}
+4 -4
View File
@@ -170,11 +170,11 @@
"husky": "^0.13.1",
"innosetup": "6.0.5",
"is": "^3.1.0",
"istanbul-lib-coverage": "^3.0.0",
"istanbul-lib-instrument": "^4.0.0",
"istanbul-lib-coverage": "^3.2.0",
"istanbul-lib-instrument": "^5.2.0",
"istanbul-lib-report": "^3.0.0",
"istanbul-lib-source-maps": "^4.0.0",
"istanbul-reports": "^3.0.0",
"istanbul-lib-source-maps": "^4.0.1",
"istanbul-reports": "^3.1.5",
"lazy.js": "^0.4.2",
"merge-options": "^1.0.1",
"mime": "^1.4.1",
+2 -17
View File
@@ -101,22 +101,6 @@ export function addDisposableGenericMouseUpListener(node: EventTarget, handler:
return addDisposableListener(node, platform.isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture);
}
export function createEventEmitter<K extends keyof HTMLElementEventMap>(target: HTMLElement, type: K, options?: boolean | AddEventListenerOptions): event.Emitter<HTMLElementEventMap[K]> {
let domListener: IDisposable | undefined = undefined;
const handler = (e: HTMLElementEventMap[K]) => result.fire(e);
const onFirstListenerAdd = () => {
if (!domListener) {
domListener = addDisposableListener(target, type, handler, options);
}
};
const onLastListenerRemove = () => {
domListener?.dispose();
domListener = undefined;
};
const result = new event.Emitter<HTMLElementEventMap[K]>({ onFirstListenerAdd, onLastListenerRemove });
return result;
}
interface IRequestAnimationFrame {
(callback: (time: number) => void): number;
}
@@ -836,11 +820,12 @@ export interface EventLike {
}
export const EventHelper = {
stop: function (e: EventLike, cancelBubble?: boolean) {
stop: <T extends EventLike>(e: T, cancelBubble?: boolean): T => {
e.preventDefault();
if (cancelBubble) {
e.stopPropagation();
}
return e;
}
};
-15
View File
@@ -45,18 +45,3 @@ export class DomEmitter<K extends keyof DOMEventMap> implements IDisposable {
this.emitter.dispose();
}
}
export interface CancellableEvent {
preventDefault(): void;
stopPropagation(): void;
}
export function stopEvent<T extends CancellableEvent>(event: T): T {
event.preventDefault();
event.stopPropagation();
return event;
}
export function stop<T extends CancellableEvent>(event: BaseEvent<T>): BaseEvent<T> {
return BaseEvent.map(event, stopEvent);
}
@@ -218,7 +218,7 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
return;
}
const title = this.getTooltip() ?? '';
this.element.setAttribute('aria-label', title);
this.updateAriaLabel();
if (!this.options.hoverDelegate) {
this.element.title = title;
} else {
@@ -232,6 +232,13 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
}
}
protected updateAriaLabel(): void {
if (this.element) {
const title = this.getTooltip() ?? '';
this.element.setAttribute('aria-label', title);
}
}
protected updateClass(): void {
// implement in subclass
}
@@ -388,8 +395,7 @@ export class ActionViewItem extends BaseActionViewItem {
}
}
override updateTooltip(): void {
super.updateTooltip();
override updateAriaLabel(): void {
if (this.label) {
const title = this.getTooltip() ?? '';
this.label.setAttribute('aria-label', title);
+5 -5
View File
@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import { IDragAndDropData } from 'vs/base/browser/dnd';
import { createStyleSheet } from 'vs/base/browser/dom';
import { DomEmitter, stopEvent } from 'vs/base/browser/event';
import { createStyleSheet, EventHelper } from 'vs/base/browser/dom';
import { DomEmitter } from 'vs/base/browser/event';
import { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { Gesture } from 'vs/base/browser/touch';
import { alert } from 'vs/base/browser/ui/aria/aria';
@@ -457,7 +457,7 @@ class TypeNavigationController<T> implements IDisposable {
.map(event => new StandardKeyboardEvent(event))
.filter(e => typing || this.keyboardNavigationEventFilter(e))
.filter(e => this.delegate.mightProducePrintableCharacter(e))
.forEach(stopEvent)
.forEach(e => EventHelper.stop(e, true))
.map(event => event.browserEvent.key)
.event;
@@ -1288,7 +1288,7 @@ export class List<T> implements ISpliceable<T>, IThemable, IDisposable {
const fromKeyDown = this.disposables.add(Event.chain(this.disposables.add(new DomEmitter(this.view.domNode, 'keydown')).event))
.map(e => new StandardKeyboardEvent(e))
.filter(e => didJustPressContextMenuKey = e.keyCode === KeyCode.ContextMenu || (e.shiftKey && e.keyCode === KeyCode.F10))
.map(stopEvent)
.map(e => EventHelper.stop(e, true))
.filter(() => false)
.event as Event<any>;
@@ -1296,7 +1296,7 @@ export class List<T> implements ISpliceable<T>, IThemable, IDisposable {
.forEach(() => didJustPressContextMenuKey = false)
.map(e => new StandardKeyboardEvent(e))
.filter(e => e.keyCode === KeyCode.ContextMenu || (e.shiftKey && e.keyCode === KeyCode.F10))
.map(stopEvent)
.map(e => EventHelper.stop(e, true))
.map(({ browserEvent }) => {
const focus = this.getFocus();
const index = focus.length ? focus[0] : undefined;
@@ -52,7 +52,7 @@ export interface IView<TLayoutContext = undefined> {
readonly minimumSize: number;
/**
* A minimum size for this view.
* A maximum size for this view.
*
* @remarks If none, set it to `Number.POSITIVE_INFINITY`.
*/
+1 -1
View File
@@ -1389,7 +1389,7 @@ export class DeferredPromise<T> {
return this.rejected || this.resolved;
}
public p: Promise<T>;
public readonly p: Promise<T>;
constructor() {
this.p = new Promise<T>((c, e) => {
@@ -103,9 +103,9 @@ import { ExtensionsProfileScannerService, IExtensionsProfileScannerService } fro
import { PolicyChannelClient } from 'vs/platform/policy/common/policyIpc';
import { IPolicyService, NullPolicyService } from 'vs/platform/policy/common/policy';
import { UserDataProfilesNativeService } from 'vs/platform/userDataProfile/electron-sandbox/userDataProfile';
import { OneDataSystemWebAppender } from 'vs/platform/telemetry/browser/1dsAppender';
import { DefaultExtensionsProfileInitService } from 'vs/platform/extensionManagement/electron-sandbox/defaultExtensionsProfileInit';
import { SharedProcessRequestService } from 'vs/platform/request/electron-browser/sharedProcessRequestService';
import { OneDataSystemAppender } from 'vs/platform/telemetry/node/1dsAppender';
class SharedProcessMain extends Disposable {
@@ -283,7 +283,7 @@ class SharedProcessMain extends Disposable {
appenders.push(logAppender);
const { installSourcePath } = environmentService;
if (productService.aiConfig?.ariaKey) {
const collectorAppender = new OneDataSystemWebAppender(internalTelemetry, 'monacoworkbench', null, productService.aiConfig.ariaKey);
const collectorAppender = new OneDataSystemAppender(internalTelemetry, 'monacoworkbench', null, productService.aiConfig.ariaKey);
this._register(toDisposable(() => collectorAppender.flush())); // Ensure the 1DS appender is disposed so that it flushes remaining data
appenders.push(collectorAppender);
}
@@ -73,6 +73,7 @@ export class IssueReporter extends Disposable {
const targetExtension = configuration.data.extensionId ? configuration.data.enabledExtensions.find(extension => extension.id === configuration.data.extensionId) : undefined;
this.issueReporterModel = new IssueReporterModel({
...configuration.data,
issueType: configuration.data.issueType || IssueType.Bug,
versionInfo: {
vscodeVersion: `${configuration.product.nameShort} ${!!configuration.product.darwinUniversalAssetId ? `${configuration.product.version} (Universal)` : configuration.product.version} (${configuration.product.commit || 'Commit unknown'}, ${configuration.product.date || 'Date unknown'})`,
@@ -80,7 +81,7 @@ export class IssueReporter extends Disposable {
},
extensionsDisabled: !!configuration.disableExtensions,
fileOnExtension: configuration.data.extensionId ? !targetExtension?.isBuiltin : undefined,
selectedExtension: targetExtension,
selectedExtension: targetExtension
});
const issueReporterElement = this.getElementById('issue-reporter');
@@ -84,3 +84,15 @@ body {
padding-left: 20px;
white-space: nowrap;
}
.monaco-scrollable-element .scrollbar > .slider {
background: #64646457 !important;
}
.monaco-scrollable-element .scrollbar > .slider:hover {
background: highlight !important;
}
.monaco-scrollable-element .scrollbar > .slider.active {
background: highlight !important;
}
@@ -257,6 +257,7 @@ class ProcessExplorer {
await this.createProcessTree(processRoots);
} else {
this.tree.setInput({ processes: { processRoots } });
this.tree.layout(window.innerHeight, window.innerWidth);
}
this.requestProcessList(0);
@@ -342,6 +343,13 @@ class ProcessExplorer {
this.showContextMenu(e.element, true);
}
});
container.style.height = `${window.innerHeight}px`;
window.addEventListener('resize', () => {
container.style.height = `${window.innerHeight}px`;
this.tree?.layout(window.innerHeight, window.innerWidth);
});
}
private isDebuggable(cmd: string): boolean {
@@ -5,6 +5,7 @@
import * as browser from 'vs/base/browser/browser';
import * as dom from 'vs/base/browser/dom';
import { DomEmitter } from 'vs/base/browser/event';
import { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { RunOnceScheduler } from 'vs/base/common/async';
import { Emitter, Event } from 'vs/base/common/event';
@@ -672,19 +673,19 @@ class ClipboardEventUtils {
export class TextAreaWrapper extends Disposable implements ICompleteTextAreaWrapper {
public readonly onKeyDown = this._register(dom.createEventEmitter(this._actual, 'keydown')).event;
public readonly onKeyPress = this._register(dom.createEventEmitter(this._actual, 'keypress')).event;
public readonly onKeyUp = this._register(dom.createEventEmitter(this._actual, 'keyup')).event;
public readonly onCompositionStart = this._register(dom.createEventEmitter(this._actual, 'compositionstart')).event;
public readonly onCompositionUpdate = this._register(dom.createEventEmitter(this._actual, 'compositionupdate')).event;
public readonly onCompositionEnd = this._register(dom.createEventEmitter(this._actual, 'compositionend')).event;
public readonly onBeforeInput = this._register(dom.createEventEmitter(this._actual, 'beforeinput')).event;
public readonly onInput = <Event<InputEvent>>this._register(dom.createEventEmitter(this._actual, 'input')).event;
public readonly onCut = this._register(dom.createEventEmitter(this._actual, 'cut')).event;
public readonly onCopy = this._register(dom.createEventEmitter(this._actual, 'copy')).event;
public readonly onPaste = this._register(dom.createEventEmitter(this._actual, 'paste')).event;
public readonly onFocus = this._register(dom.createEventEmitter(this._actual, 'focus')).event;
public readonly onBlur = this._register(dom.createEventEmitter(this._actual, 'blur')).event;
public readonly onKeyDown = this._register(new DomEmitter(this._actual, 'keydown')).event;
public readonly onKeyPress = this._register(new DomEmitter(this._actual, 'keypress')).event;
public readonly onKeyUp = this._register(new DomEmitter(this._actual, 'keyup')).event;
public readonly onCompositionStart = this._register(new DomEmitter(this._actual, 'compositionstart')).event;
public readonly onCompositionUpdate = this._register(new DomEmitter(this._actual, 'compositionupdate')).event;
public readonly onCompositionEnd = this._register(new DomEmitter(this._actual, 'compositionend')).event;
public readonly onBeforeInput = this._register(new DomEmitter(this._actual, 'beforeinput')).event;
public readonly onInput = <Event<InputEvent>>this._register(new DomEmitter(this._actual, 'input')).event;
public readonly onCut = this._register(new DomEmitter(this._actual, 'cut')).event;
public readonly onCopy = this._register(new DomEmitter(this._actual, 'copy')).event;
public readonly onPaste = this._register(new DomEmitter(this._actual, 'paste')).event;
public readonly onFocus = this._register(new DomEmitter(this._actual, 'focus')).event;
public readonly onBlur = this._register(new DomEmitter(this._actual, 'blur')).event;
private _onSyntheticTap = this._register(new Emitter<void>());
public readonly onSyntheticTap: Event<void> = this._onSyntheticTap.event;
@@ -323,6 +323,7 @@ export interface IExtension {
readonly changelogUrl?: URI;
readonly isValid: boolean;
readonly validations: readonly [Severity, string][];
readonly browserNlsBundleUris?: { [language: string]: URI };
}
/**
@@ -389,6 +390,7 @@ export interface IRelaxedExtensionDescription extends IRelaxedExtensionManifest
isUserBuiltin: boolean;
isUnderDevelopment: boolean;
extensionLocation: URI;
browserNlsBundleUris?: { [language: string]: URI };
}
export type IExtensionDescription = Readonly<IRelaxedExtensionDescription>;
+3 -3
View File
@@ -31,7 +31,7 @@ export interface IFileService {
readonly onDidChangeFileSystemProviderRegistrations: Event<IFileSystemProviderRegistrationEvent>;
/**
* An event that is fired when a registered file system provider changes it's capabilities.
* An event that is fired when a registered file system provider changes its capabilities.
*/
readonly onDidChangeFileSystemProviderCapabilities: Event<IFileSystemProviderCapabilitiesChangeEvent>;
@@ -80,7 +80,7 @@ export interface IFileService {
hasCapability(resource: URI, capability: FileSystemProviderCapabilities): boolean;
/**
* List the schemes and capabilies for registered file system providers
* List the schemes and capabilities for registered file system providers
*/
listCapabilities(): Iterable<{ scheme: string; capabilities: FileSystemProviderCapabilities }>;
@@ -982,7 +982,7 @@ interface IBaseFileStat {
readonly ctime?: number;
/**
* A unique identifier thet represents the
* A unique identifier that represents the
* current state of the file or directory.
*
* The value may or may not be resolved as
@@ -138,7 +138,7 @@ const terminalPlatformConfiguration: IConfigurationNode = {
},
[TerminalSettingId.AutomationProfileLinux]: {
restricted: true,
markdownDescription: localize('terminal.integrated.automationProfile.linux', "The terminal profile to use on Linux for automation-related terminal usage like tasks and debug. This setting will currently be ignored if {0} is set.", '`#terminal.integrated.automationShell.linux#`'),
markdownDescription: localize('terminal.integrated.automationProfile.linux', "The terminal profile to use on Linux for automation-related terminal usage like tasks and debug. This setting will currently be ignored if {0} (now deprecated) is set.", '`terminal.integrated.automationShell.linux`'),
type: ['object', 'null'],
default: null,
'anyOf': [
@@ -156,7 +156,7 @@ const terminalPlatformConfiguration: IConfigurationNode = {
},
[TerminalSettingId.AutomationProfileMacOs]: {
restricted: true,
markdownDescription: localize('terminal.integrated.automationProfile.osx', "The terminal profile to use on macOS for automation-related terminal usage like tasks and debug. This setting will currently be ignored if {0} is set.", '`#terminal.integrated.automationShell.osx#`'),
markdownDescription: localize('terminal.integrated.automationProfile.osx', "The terminal profile to use on macOS for automation-related terminal usage like tasks and debug. This setting will currently be ignored if {0} (now deprecated) is set.", '`terminal.integrated.automationShell.osx`'),
type: ['object', 'null'],
default: null,
'anyOf': [
@@ -174,7 +174,7 @@ const terminalPlatformConfiguration: IConfigurationNode = {
},
[TerminalSettingId.AutomationProfileWindows]: {
restricted: true,
markdownDescription: localize('terminal.integrated.automationProfile.windows', "The terminal profile to use for automation-related terminal usage like tasks and debug. This setting will currently be ignored if {0} is set.", '`#terminal.integrated.automationShell.windows#`'),
markdownDescription: localize('terminal.integrated.automationProfile.windows', "The terminal profile to use for automation-related terminal usage like tasks and debug. This setting will currently be ignored if {0} (now deprecated) is set.", '`terminal.integrated.automationShell.windows`'),
type: ['object', 'null'],
default: null,
'anyOf': [
+9 -9
View File
@@ -213,9 +213,9 @@ export class PtyService extends Disposable implements IPtyService {
async attachToProcess(id: number): Promise<void> {
try {
await this._throwIfNoPty(id).attach();
this._logService.trace(`Persistent process reconnection "${id}"`);
this._logService.info(`Persistent process reconnection "${id}"`);
} catch (e) {
this._logService.trace(`Persistent process reconnection "${id}" failed`, e.message);
this._logService.warn(`Persistent process reconnection "${id}" failed`, e.message);
throw e;
}
}
@@ -341,7 +341,7 @@ export class PtyService extends Disposable implements IPtyService {
try {
return this._revivedPtyIdMap.get(id)?.newId;
} catch (e) {
this._logService.trace(`Couldn't find terminal ID ${id}`, e.message);
this._logService.warn(`Couldn't find terminal ID ${id}`, e.message);
}
return undefined;
}
@@ -384,7 +384,7 @@ export class PtyService extends Disposable implements IPtyService {
relativeSize: t.relativeSize
};
} catch (e) {
this._logService.trace(`Couldn't get layout info, a terminal was probably disconnected`, e.message);
this._logService.warn(`Couldn't get layout info, a terminal was probably disconnected`, e.message);
// this will be filtered out and not reconnected
return {
terminal: null,
@@ -582,12 +582,12 @@ export class PersistentTerminalProcess extends Disposable {
async attach(): Promise<void> {
this._logService.trace('persistentTerminalProcess#attach', this._persistentProcessId);
// Something wrong happened if the disconnect runner is not canceled, this likely means
// multiple windows attempted to attach.
if (!await this._isOrphaned()) {
throw new Error(`Cannot attach to persistent process "${this._persistentProcessId}", it is already adopted`);
}
if (!this._disconnectRunner1.isScheduled() && !this._disconnectRunner2.isScheduled()) {
// Something wrong happened if the disconnect runner is not canceled, this likely means
// multiple windows attempted to attach.
if (!await this._isOrphaned()) {
throw new Error(`Cannot attach to persistent process "${this._persistentProcessId}", it is already adopted`);
}
this._logService.warn(`Persistent process "${this._persistentProcessId}": Process had no disconnect runners but was an orphan`);
}
this._disconnectRunner1.cancel();
@@ -223,8 +223,9 @@ export enum ShellIntegrationExecutable {
}
export const shellIntegrationArgs: Map<ShellIntegrationExecutable, string[]> = new Map();
shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwsh, ['-noexit', '-command', '. \"{0}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1\"{1}']);
shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwshLogin, ['-l', '-noexit', '-command', '. \"{0}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1\"{1}']);
// The try catch swallows execution policy errors in the case of the archive distributable
shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwsh, ['-noexit', '-command', 'try { . \"{0}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1\" } catch {}{1}']);
shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwshLogin, ['-l', '-noexit', '-command', 'try { . \"{0}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1\" } catch {}{1}']);
shellIntegrationArgs.set(ShellIntegrationExecutable.Pwsh, ['-noexit', '-command', '. "{0}/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1"{1}']);
shellIntegrationArgs.set(ShellIntegrationExecutable.PwshLogin, ['-l', '-noexit', '-command', '. "{0}/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1"']);
shellIntegrationArgs.set(ShellIntegrationExecutable.Zsh, ['-i']);
@@ -583,7 +583,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
return;
}
this._logService.trace('IPty#pid');
exec('lsof -OPln -p ' + this._ptyProcess.pid + ' | grep cwd', (error, stdout, stderr) => {
exec('lsof -OPln -p ' + this._ptyProcess.pid + ' | grep cwd', { env: { ...process.env, LANG: 'en_US.UTF-8' } }, (error, stdout, stderr) => {
if (!error && stdout !== '') {
resolve(stdout.substring(stdout.indexOf('/'), stdout.length - 1));
} else {
@@ -25,14 +25,14 @@ suite('platform - terminalEnvironment', () => {
suite('pwsh', () => {
const expectedPs1 = process.platform === 'win32'
? `${repoRoot}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1`
: `${repoRoot}/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1`;
? `try { . "${repoRoot}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1" } catch {}`
: `. "${repoRoot}/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1"`;
suite('should override args', () => {
const enabledExpectedResult = Object.freeze<IShellIntegrationConfigInjection>({
newArgs: [
'-noexit',
'-command',
`. "${expectedPs1}"`
expectedPs1
],
envMixin: {
VSCODE_INJECTION: '1'
@@ -63,7 +63,7 @@ suite('platform - terminalEnvironment', () => {
'-l',
'-noexit',
'-command',
`. "${expectedPs1}"`
expectedPs1
],
envMixin: {
VSCODE_INJECTION: '1'
@@ -667,14 +667,14 @@ export abstract class AbstractSynchroniser extends Disposable implements IUserDa
return { ref: refOrLastSyncData, content };
} else {
const lastSyncUserData: IUserData | null = refOrLastSyncData ? { ref: refOrLastSyncData.ref, content: refOrLastSyncData.syncData ? JSON.stringify(refOrLastSyncData.syncData) : null } : null;
return this.userDataSyncStoreService.read(this.resource, lastSyncUserData, this.syncHeaders);
return this.userDataSyncStoreService.read(this.resource, lastSyncUserData, undefined, this.syncHeaders);
}
}
protected async updateRemoteUserData(content: string, ref: string | null): Promise<IRemoteUserData> {
const machineId = await this.currentMachineIdPromise;
const syncData: ISyncData = { version: this.version, machineId, content };
ref = await this.userDataSyncStoreService.write(this.resource, JSON.stringify(syncData), ref, this.syncHeaders);
ref = await this.userDataSyncStoreService.write(this.resource, JSON.stringify(syncData), ref, undefined, this.syncHeaders);
return { ref, syncData };
}
@@ -480,7 +480,7 @@ export class UserDataSyncStoreTypeSynchronizer {
private async doSync(userDataSyncStoreType: UserDataSyncStoreType, syncHeaders: IHeaders): Promise<void> {
// Read the global state from remote
const globalStateUserData = await this.userDataSyncStoreClient.read(SyncResource.GlobalState, null, syncHeaders);
const globalStateUserData = await this.userDataSyncStoreClient.readResource(SyncResource.GlobalState, null, syncHeaders);
const remoteGlobalState = this.parseGlobalState(globalStateUserData) || { storage: {} };
// Update the sync store type
@@ -489,7 +489,7 @@ export class UserDataSyncStoreTypeSynchronizer {
// Write the global state to remote
const machineId = await getServiceMachineId(this.environmentService, this.fileService, this.storageService);
const syncDataToUpdate: ISyncData = { version: GLOBAL_STATE_DATA_VERSION, machineId, content: stringify(remoteGlobalState, false) };
await this.userDataSyncStoreClient.write(SyncResource.GlobalState, JSON.stringify(syncDataToUpdate), globalStateUserData.ref, syncHeaders);
await this.userDataSyncStoreClient.writeResource(SyncResource.GlobalState, JSON.stringify(syncDataToUpdate), globalStateUserData.ref, syncHeaders);
}
private parseGlobalState({ content }: IUserData): IGlobalState | null {
@@ -156,7 +156,7 @@ export interface IResourceRefHandle {
created: number;
}
export type ServerResource = SyncResource | 'machines' | 'editSessions';
export type ServerResource = SyncResource | 'machines' | 'editSessions' | 'profiles';
export type UserDataSyncStoreType = 'insiders' | 'stable';
export const IUserDataSyncStoreManagementService = createDecorator<IUserDataSyncStoreManagementService>('IUserDataSyncStoreManagementService');
@@ -168,7 +168,9 @@ export interface IUserDataSyncStoreManagementService {
getPreviousUserDataSyncStore(): Promise<IUserDataSyncStore | undefined>;
}
export interface IUserDataSyncStoreClient {
export const IUserDataSyncStoreService = createDecorator<IUserDataSyncStoreService>('IUserDataSyncStoreService');
export interface IUserDataSyncStoreService {
readonly _serviceBrand: undefined;
readonly onDidChangeDonotMakeRequestsUntil: Event<void>;
readonly donotMakeRequestsUntil: Date | undefined;
@@ -176,20 +178,13 @@ export interface IUserDataSyncStoreClient {
readonly onTokenSucceed: Event<void>;
setAuthToken(token: string, type: string): void;
// Sync requests
manifest(oldValue: IUserDataManifest | null, headers?: IHeaders): Promise<IUserDataManifest | null>;
read(resource: ServerResource, oldValue: IUserData | null, headers?: IHeaders): Promise<IUserData>;
write(resource: ServerResource, content: string, ref: string | null, headers?: IHeaders): Promise<string>;
read(resource: ServerResource, oldValue: IUserData | null, profile?: string, headers?: IHeaders): Promise<IUserData>;
write(resource: ServerResource, content: string, ref: string | null, profile?: string, headers?: IHeaders): Promise<string>;
delete(resource: ServerResource, ref: string | null, profile?: string): Promise<void>;
getAllRefs(resource: ServerResource, profile?: string): Promise<IResourceRefHandle[]>;
resolveContent(resource: ServerResource, ref: string, profile?: string, headers?: IHeaders): Promise<string | null>;
clear(): Promise<void>;
delete(resource: ServerResource, ref: string | null): Promise<void>;
getAllRefs(resource: ServerResource): Promise<IResourceRefHandle[]>;
resolveContent(resource: ServerResource, ref: string, headers?: IHeaders): Promise<string | null>;
}
export const IUserDataSyncStoreService = createDecorator<IUserDataSyncStoreService>('IUserDataSyncStoreService');
export interface IUserDataSyncStoreService extends IUserDataSyncStoreClient {
readonly _serviceBrand: undefined;
}
export const IUserDataSyncBackupStoreService = createDecorator<IUserDataSyncBackupStoreService>('IUserDataSyncBackupStoreService');
@@ -12,6 +12,7 @@ import { Mimes } from 'vs/base/common/mime';
import { isWeb } from 'vs/base/common/platform';
import { ConfigurationSyncStore } from 'vs/base/common/product';
import { joinPath, relativePath } from 'vs/base/common/resources';
import { join } from 'vs/base/common/path';
import { isObject, isString } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import { generateUuid } from 'vs/base/common/uuid';
@@ -23,7 +24,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
import { asJson, asTextOrError, IRequestService, isSuccess as isSuccessContext } from 'vs/platform/request/common/request';
import { getServiceMachineId } from 'vs/platform/externalServices/common/serviceMachineId';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { CONFIGURATION_SYNC_STORE_KEY, HEADER_EXECUTION_ID, HEADER_OPERATION_ID, IAuthenticationProvider, IResourceRefHandle, IUserData, IUserDataManifest, IUserDataSyncLogService, IUserDataSyncStore, IUserDataSyncStoreClient, IUserDataSyncStoreManagementService, IUserDataSyncStoreService, ServerResource, SYNC_SERVICE_URL_TYPE, UserDataSyncErrorCode, UserDataSyncStoreError, UserDataSyncStoreType } from 'vs/platform/userDataSync/common/userDataSync';
import { CONFIGURATION_SYNC_STORE_KEY, HEADER_EXECUTION_ID, HEADER_OPERATION_ID, IAuthenticationProvider, IResourceRefHandle, IUserData, IUserDataManifest, IUserDataSyncLogService, IUserDataSyncStore, IUserDataSyncStoreManagementService, IUserDataSyncStoreService, ServerResource, SYNC_SERVICE_URL_TYPE, UserDataSyncErrorCode, UserDataSyncStoreError, UserDataSyncStoreType } from 'vs/platform/userDataSync/common/userDataSync';
const SYNC_PREVIOUS_STORE = 'sync.previous.store';
const DONOT_MAKE_REQUESTS_UNTIL_KEY = 'sync.donot-make-requests-until';
@@ -140,7 +141,7 @@ export class UserDataSyncStoreManagementService extends AbstractUserDataSyncStor
}
}
export class UserDataSyncStoreClient extends Disposable implements IUserDataSyncStoreClient {
export class UserDataSyncStoreClient extends Disposable {
private userDataSyncStoreUrl: URI | undefined;
@@ -230,12 +231,12 @@ export class UserDataSyncStoreClient extends Disposable implements IUserDataSync
}
}
async getAllRefs(resource: ServerResource): Promise<IResourceRefHandle[]> {
async getAllResourceRefs(path: string): Promise<IResourceRefHandle[]> {
if (!this.userDataSyncStoreUrl) {
throw new Error('No settings sync store url configured.');
}
const uri = joinPath(this.userDataSyncStoreUrl, 'resource', resource);
const uri = joinPath(this.userDataSyncStoreUrl, 'resource', path);
const headers: IHeaders = {};
const context = await this.request(uri.toString(), { type: 'GET', headers }, [], CancellationToken.None);
@@ -244,12 +245,12 @@ export class UserDataSyncStoreClient extends Disposable implements IUserDataSync
return result.map(({ url, created }) => ({ ref: relativePath(uri, uri.with({ path: url }))!, created: created * 1000 /* Server returns in seconds */ }));
}
async resolveContent(resource: ServerResource, ref: string, headers: IHeaders = {}): Promise<string | null> {
async resolveResourceContent(path: string, ref: string, headers: IHeaders = {}): Promise<string | null> {
if (!this.userDataSyncStoreUrl) {
throw new Error('No settings sync store url configured.');
}
const url = joinPath(this.userDataSyncStoreUrl, 'resource', resource, ref).toString();
const url = joinPath(this.userDataSyncStoreUrl, 'resource', path, ref).toString();
headers = { ...headers };
headers['Cache-Control'] = 'no-cache';
@@ -258,23 +259,23 @@ export class UserDataSyncStoreClient extends Disposable implements IUserDataSync
return content;
}
async delete(resource: ServerResource, ref: string | null): Promise<void> {
async deleteResource(path: string, ref: string | null): Promise<void> {
if (!this.userDataSyncStoreUrl) {
throw new Error('No settings sync store url configured.');
}
const url = ref !== null ? joinPath(this.userDataSyncStoreUrl, 'resource', resource, ref).toString() : joinPath(this.userDataSyncStoreUrl, 'resource', resource).toString();
const url = ref !== null ? joinPath(this.userDataSyncStoreUrl, 'resource', path, ref).toString() : joinPath(this.userDataSyncStoreUrl, 'resource', path).toString();
const headers: IHeaders = {};
await this.request(url, { type: 'DELETE', headers }, [], CancellationToken.None);
}
async read(resource: ServerResource, oldValue: IUserData | null, headers: IHeaders = {}): Promise<IUserData> {
async readResource(path: string, oldValue: IUserData | null, headers: IHeaders = {}): Promise<IUserData> {
if (!this.userDataSyncStoreUrl) {
throw new Error('No settings sync store url configured.');
}
const url = joinPath(this.userDataSyncStoreUrl, 'resource', resource, 'latest').toString();
const url = joinPath(this.userDataSyncStoreUrl, 'resource', path, 'latest').toString();
headers = { ...headers };
// Disable caching as they are cached by synchronisers
headers['Cache-Control'] = 'no-cache';
@@ -306,12 +307,12 @@ export class UserDataSyncStoreClient extends Disposable implements IUserDataSync
return userData;
}
async write(resource: ServerResource, data: string, ref: string | null, headers: IHeaders = {}): Promise<string> {
async writeResource(path: string, data: string, ref: string | null, headers: IHeaders = {}): Promise<string> {
if (!this.userDataSyncStoreUrl) {
throw new Error('No settings sync store url configured.');
}
const url = joinPath(this.userDataSyncStoreUrl, 'resource', resource).toString();
const url = joinPath(this.userDataSyncStoreUrl, 'resource', path).toString();
headers = { ...headers };
headers['Content-Type'] = Mimes.text;
if (ref) {
@@ -549,6 +550,33 @@ export class UserDataSyncStoreService extends UserDataSyncStoreClient implements
super(userDataSyncStoreManagementService.userDataSyncStore?.url, productService, requestService, logService, environmentService, fileService, storageService);
this._register(userDataSyncStoreManagementService.onDidChangeUserDataSyncStore(() => this.updateUserDataSyncStoreUrl(userDataSyncStoreManagementService.userDataSyncStore?.url)));
}
getAllRefs(resource: ServerResource, profile?: string): Promise<IResourceRefHandle[]> {
return this.getAllResourceRefs(profile ? this.getProfileResource(resource, profile) : resource);
}
read(resource: ServerResource, oldValue: IUserData | null, profile?: string, headers?: IHeaders): Promise<IUserData> {
return this.readResource(profile ? this.getProfileResource(resource, profile) : resource, oldValue, headers);
}
write(resource: ServerResource, content: string, ref: string | null, profile?: string, headers?: IHeaders): Promise<string> {
return this.writeResource(profile ? this.getProfileResource(resource, profile) : resource, content, ref, headers);
}
delete(resource: ServerResource, ref: string | null, profile?: string): Promise<void> {
return this.deleteResource(profile ? this.getProfileResource(resource, profile) : resource, ref);
}
resolveContent(resource: ServerResource, ref: string, profile?: string, headers?: IHeaders): Promise<string | null> {
return this.resolveResourceContent(profile ? this.getProfileResource(resource, profile) : resource, ref, headers);
}
private getProfileResource(resource: ServerResource, profile: string): string {
if (resource === 'profiles') {
throw new Error(`Invalid Resource Argument: ${resource}`);
}
return join('profiles', profile, resource);
}
}
export class RequestsSession {
@@ -20,9 +20,8 @@ import { ILifecycleMainService, LifecycleMainPhase } from 'vs/platform/lifecycle
import { ILogService } from 'vs/platform/log/common/log';
import { StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { IApplicationStorageMainService } from 'vs/platform/storage/electron-main/storageMainService';
import { ICodeWindow } from 'vs/platform/window/electron-main/window';
import { IRecent, IRecentFile, IRecentFolder, IRecentlyOpened, IRecentWorkspace, isRecentFile, isRecentFolder, isRecentWorkspace, restoreRecentlyOpened, toStoreData } from 'vs/platform/workspaces/common/workspaces';
import { isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, IWorkspaceIdentifier, WORKSPACE_EXTENSION } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceIdentifier, WORKSPACE_EXTENSION } from 'vs/platform/workspace/common/workspace';
import { IWorkspacesManagementMainService } from 'vs/platform/workspaces/electron-main/workspacesManagementMainService';
export const IWorkspacesHistoryMainService = createDecorator<IWorkspacesHistoryMainService>('workspacesHistoryMainService');
@@ -34,7 +33,7 @@ export interface IWorkspacesHistoryMainService {
readonly onDidChangeRecentlyOpened: CommonEvent<void>;
addRecentlyOpened(recents: IRecent[]): Promise<void>;
getRecentlyOpened(include?: ICodeWindow): Promise<IRecentlyOpened>;
getRecentlyOpened(): Promise<IRecentlyOpened>;
removeRecentlyOpened(paths: URI[]): Promise<void>;
clearRecentlyOpened(): Promise<void>;
}
@@ -162,31 +161,10 @@ export class WorkspacesHistoryMainService extends Disposable implements IWorkspa
this._onDidChangeRecentlyOpened.fire();
}
async getRecentlyOpened(include?: ICodeWindow): Promise<IRecentlyOpened> {
async getRecentlyOpened(): Promise<IRecentlyOpened> {
const workspaces: Array<IRecentFolder | IRecentWorkspace> = [];
const files: IRecentFile[] = [];
// Add current workspace to beginning if set
if (include) {
const currentWorkspace = include.config?.workspace;
if (isWorkspaceIdentifier(currentWorkspace) && !this.workspacesManagementMainService.isUntitledWorkspace(currentWorkspace)) {
workspaces.push({ workspace: currentWorkspace, remoteAuthority: include.remoteAuthority });
} else if (isSingleFolderWorkspaceIdentifier(currentWorkspace)) {
workspaces.push({ folderUri: currentWorkspace.uri, remoteAuthority: include.remoteAuthority });
}
}
// Add currently files to open to the beginning if any
const currentFiles = include?.config?.filesToOpenOrCreate;
if (currentFiles) {
for (const currentFile of currentFiles) {
const fileUri = currentFile.fileUri;
if (fileUri && this.indexOfFile(files, fileUri) === -1) {
files.push({ fileUri });
}
}
}
await this.addEntriesFromStorage(workspaces, files);
return { workspaces, files };
@@ -55,7 +55,7 @@ export class WorkspacesMainService implements AddFirstParameterToFunctions<IWork
readonly onDidChangeRecentlyOpened = this.workspacesHistoryMainService.onDidChangeRecentlyOpened;
getRecentlyOpened(windowId: number): Promise<IRecentlyOpened> {
return this.workspacesHistoryMainService.getRecentlyOpened(this.windowsMainService.getWindowById(windowId));
return this.workspacesHistoryMainService.getRecentlyOpened();
}
addRecentlyOpened(windowId: number, recents: IRecent[]): Promise<void> {
@@ -173,7 +173,7 @@ export class MainThreadTesting extends Disposable implements MainThreadTestingSh
canRefresh,
refreshTests: token => this.proxy.$refreshTests(controllerId, token),
configureRunProfile: id => this.proxy.$configureRunProfile(controllerId, id),
runTests: (req, token) => this.proxy.$runControllerTests(req, token),
runTests: (reqs, token) => this.proxy.$runControllerTests(reqs, token),
expandTest: (testId, levels) => this.proxy.$expandTest(testId, isFinite(levels) ? levels : -1),
};

Some files were not shown because too many files have changed in this diff Show More