mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-19 22:59:48 +01:00
Merge branch 'main' into notebook/dev
This commit is contained in:
@@ -92,26 +92,6 @@ export function startClient(context: ExtensionContext, newLanguageClient: Langua
|
||||
// client can be deactivated on extension deactivation
|
||||
context.subscriptions.push(disposable);
|
||||
|
||||
let indentationRules = {
|
||||
increaseIndentPattern: /(^.*\{[^}]*$)/,
|
||||
decreaseIndentPattern: /^\s*\}/
|
||||
};
|
||||
|
||||
languages.setLanguageConfiguration('css', {
|
||||
wordPattern: /(#?-?\d*\.\d\w*%?)|(::?[\w-]*(?=[^,{;]*[,{]))|(([@#.!])?[\w-?]+%?|[@#!.])/g,
|
||||
indentationRules: indentationRules
|
||||
});
|
||||
|
||||
languages.setLanguageConfiguration('less', {
|
||||
wordPattern: /(#?-?\d*\.\d\w*%?)|(::?[\w-]+(?=[^,{;]*[,{]))|(([@#.!])?[\w-?]+%?|[@#!.])/g,
|
||||
indentationRules: indentationRules
|
||||
});
|
||||
|
||||
languages.setLanguageConfiguration('scss', {
|
||||
wordPattern: /(#?-?\d*\.\d\w*%?)|(::?[\w-]*(?=[^,{;]*[,{]))|(([@$#.!])?[\w-?]+%?|[@#!$.])/g,
|
||||
indentationRules: indentationRules
|
||||
});
|
||||
|
||||
client.onReady().then(() => {
|
||||
context.subscriptions.push(initCompletionProvider());
|
||||
});
|
||||
|
||||
@@ -26,5 +26,10 @@
|
||||
"start": "^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/",
|
||||
"end": "^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/"
|
||||
}
|
||||
}
|
||||
},
|
||||
"indentationRules": {
|
||||
"increaseIndentPattern": "(^.*\\{[^}]*$)",
|
||||
"decreaseIndentPattern": "^\\s*\\}"
|
||||
},
|
||||
"wordPattern": "(#?-?\\d*\\.\\d\\w*%?)|(::?[\\w-]*(?=[^,{;]*[,{]))|(([@#.!])?[\\w-?]+%?|[@#!.])"
|
||||
}
|
||||
|
||||
@@ -22,5 +22,21 @@
|
||||
{ "open": "\"", "close": "\"" },
|
||||
{ "open": "<", "close": ">" },
|
||||
{ "open": "{", "close": "}" }
|
||||
]
|
||||
],
|
||||
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\$\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\s]+)",
|
||||
"onEnterRules": [
|
||||
{
|
||||
"beforeText": { "pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!\\/)>)[^<]*$", "flags": "i" },
|
||||
"afterText": { "pattern": "^<\\/([_:\\w][_:\\w-.\\d]*)\\s*>", "flags": "i" },
|
||||
"action": {
|
||||
"indent": "indentOutdent"
|
||||
}
|
||||
},
|
||||
{
|
||||
"beforeText": { "pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))(\\w[\\w\\d]*)([^/>]*(?!\\/)>)[^<]*$", "flags": "i" },
|
||||
"action": {
|
||||
"indent": "indent"
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as nls from 'vscode-nls';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
import {
|
||||
languages, ExtensionContext, IndentAction, Position, TextDocument, Range, CompletionItem, CompletionItemKind, SnippetString, workspace, extensions,
|
||||
languages, ExtensionContext, Position, TextDocument, Range, CompletionItem, CompletionItemKind, SnippetString, workspace, extensions,
|
||||
Disposable, FormattingOptions, CancellationToken, ProviderResult, TextEdit, CompletionContext, CompletionList, SemanticTokensLegend,
|
||||
DocumentSemanticTokensProvider, DocumentRangeSemanticTokensProvider, SemanticTokens, window, commands
|
||||
} from 'vscode';
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
LanguageClientOptions, RequestType, TextDocumentPositionParams, DocumentRangeFormattingParams,
|
||||
DocumentRangeFormattingRequest, ProvideCompletionItemsSignature, TextDocumentIdentifier, RequestType0, Range as LspRange, NotificationType, CommonLanguageClient
|
||||
} from 'vscode-languageclient';
|
||||
import { EMPTY_ELEMENTS } from './htmlEmptyTagsShared';
|
||||
import { activateTagClosing } from './tagClosing';
|
||||
import { RequestService } from './requests';
|
||||
import { getCustomDataSource } from './customData';
|
||||
@@ -197,40 +196,6 @@ export function startClient(context: ExtensionContext, newLanguageClient: Langua
|
||||
}
|
||||
}
|
||||
|
||||
languages.setLanguageConfiguration('html', {
|
||||
indentationRules: {
|
||||
increaseIndentPattern: /<(?!\?|(?:area|base|br|col|frame|hr|html|img|input|keygen|link|menuitem|meta|param|source|track|wbr)\b|[^>]*\/>)([-_\.A-Za-z0-9]+)(?=\s|>)\b[^>]*>(?!.*<\/\1>)|<!--(?!.*-->)|\{[^}"']*$/,
|
||||
decreaseIndentPattern: /^\s*(<\/(?!html)[-_\.A-Za-z0-9]+\b[^>]*>|-->|\})/
|
||||
},
|
||||
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
|
||||
onEnterRules: [
|
||||
{
|
||||
beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join('|')}))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
|
||||
afterText: /^<\/([_:\w][_:\w-.\d]*)\s*>/i,
|
||||
action: { indentAction: IndentAction.IndentOutdent }
|
||||
},
|
||||
{
|
||||
beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join('|')}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
|
||||
action: { indentAction: IndentAction.Indent }
|
||||
}
|
||||
],
|
||||
});
|
||||
|
||||
languages.setLanguageConfiguration('handlebars', {
|
||||
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
|
||||
onEnterRules: [
|
||||
{
|
||||
beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join('|')}))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
|
||||
afterText: /^<\/([_:\w][_:\w-.\d]*)\s*>/i,
|
||||
action: { indentAction: IndentAction.IndentOutdent }
|
||||
},
|
||||
{
|
||||
beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join('|')}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),
|
||||
action: { indentAction: IndentAction.Indent }
|
||||
}
|
||||
],
|
||||
});
|
||||
|
||||
const regionCompletionRegExpr = /^(\s*)(<(!(-(-\s*(#\w*)?)?)?)?)?$/;
|
||||
const htmlSnippetCompletionRegExpr = /^(\s*)(<(h(t(m(l)?)?)?)?)?$/;
|
||||
languages.registerCompletionItemProvider(documentSelector, {
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export const EMPTY_ELEMENTS: string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
|
||||
@@ -29,5 +29,25 @@
|
||||
"start": "^\\s*<!--\\s*#region\\b.*-->",
|
||||
"end": "^\\s*<!--\\s*#endregion\\b.*-->"
|
||||
}
|
||||
},
|
||||
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\$\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\s]+)",
|
||||
"onEnterRules": [
|
||||
{
|
||||
"beforeText": { "pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!\\/)>)[^<]*$", "flags": "i" },
|
||||
"afterText": { "pattern": "^<\\/([_:\\w][_:\\w-.\\d]*)\\s*>", "flags": "i" },
|
||||
"action": {
|
||||
"indent": "indentOutdent"
|
||||
}
|
||||
},
|
||||
{
|
||||
"beforeText": { "pattern": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))(\\w[\\w\\d]*)([^/>]*(?!\\/)>)[^<]*$", "flags": "i" },
|
||||
"action": {
|
||||
"indent": "indent"
|
||||
}
|
||||
}
|
||||
],
|
||||
"indentationRules": {
|
||||
"increaseIndentPattern": "<(?!\\?|(?:area|base|br|col|frame|hr|html|img|input|keygen|link|menuitem|meta|param|source|track|wbr)\\b|[^>]*\\/>)([-_\\.A-Za-z0-9]+)(?=\\s|>)\\b[^>]*>(?!.*<\\/\\1>)|<!--(?!.*-->)|\\{[^}\"']*$",
|
||||
"decreaseIndentPattern": "^\\s*(<\\/(?!html)[-_\\.A-Za-z0-9]+\\b[^>]*>|-->|\\})"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as nls from 'vscode-nls';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
import {
|
||||
workspace, window, languages, commands, ExtensionContext, extensions, Uri, LanguageConfiguration,
|
||||
workspace, window, languages, commands, ExtensionContext, extensions, Uri,
|
||||
Diagnostic, StatusBarAlignment, TextEditor, TextDocument, FormattingOptions, CancellationToken,
|
||||
ProviderResult, TextEdit, Range, Position, Disposable, CompletionItem, CompletionList, CompletionContext, Hover, MarkdownString,
|
||||
} from 'vscode';
|
||||
@@ -358,17 +358,6 @@ export function startClient(context: ExtensionContext, newLanguageClient: Langua
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
const languageConfiguration: LanguageConfiguration = {
|
||||
wordPattern: /("(?:[^\\\"]*(?:\\.)?)*"?)|[^\s{}\[\],:]+/,
|
||||
indentationRules: {
|
||||
increaseIndentPattern: /({+(?=([^"]*"[^"]*")*[^"}]*$))|(\[+(?=([^"]*"[^"]*")*[^"\]]*$))/,
|
||||
decreaseIndentPattern: /^\s*[}\]],?\s*$/
|
||||
}
|
||||
};
|
||||
languages.setLanguageConfiguration('json', languageConfiguration);
|
||||
languages.setLanguageConfiguration('jsonc', languageConfiguration);
|
||||
|
||||
}
|
||||
|
||||
function getSchemaAssociations(_context: ExtensionContext): ISchemaAssociation[] {
|
||||
|
||||
@@ -14,5 +14,10 @@
|
||||
{ "open": "'", "close": "'", "notIn": ["string"] },
|
||||
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] },
|
||||
{ "open": "`", "close": "`", "notIn": ["string", "comment"] }
|
||||
]
|
||||
],
|
||||
"wordPattern": "(\"(?:[^\\\\\\\"]*(?:\\\\.)?)*\"?)|[^\\s{}\\[\\],:]+",
|
||||
"indentationRules": {
|
||||
"increaseIndentPattern": "({+(?=([^\"]*\"[^\"]*\")*[^\"}]*$))|(\\[+(?=([^\"]*\"[^\"]*\")*[^\"\\]]*$))",
|
||||
"decreaseIndentPattern": "^\\s*[}\\]],?\\s*$"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,15 @@
|
||||
["\"", "\""],
|
||||
["'", "'"]
|
||||
],
|
||||
"indentationRules": {
|
||||
"increaseIndentPattern": "(^.*\\{[^}]*$)",
|
||||
"decreaseIndentPattern": "^\\s*\\}"
|
||||
},
|
||||
"folding": {
|
||||
"markers": {
|
||||
"start": "^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/",
|
||||
"end": "^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"indentationRules": {
|
||||
"increaseIndentPattern": "(^.*\\{[^}]*$)",
|
||||
"decreaseIndentPattern": "^\\s*\\}"
|
||||
},
|
||||
"wordPattern": "(#?-?\\d*\\.\\d\\w*%?)|(::?[\\w-]+(?=[^,{;]*[,{]))|(([@#.!])?[\\w-?]+%?|[@#!.])"
|
||||
}
|
||||
|
||||
@@ -49,5 +49,6 @@
|
||||
"start": "^\\s*<!--\\s*#?region\\b.*-->",
|
||||
"end": "^\\s*<!--\\s*#?endregion\\b.*-->"
|
||||
}
|
||||
}
|
||||
},
|
||||
"wordPattern": { "pattern": "(\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark})(((\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark})|[_])?(\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark}))*", "flags": "ug" },
|
||||
}
|
||||
|
||||
@@ -52,12 +52,7 @@ function registerMarkdownLanguageFeatures(
|
||||
): vscode.Disposable {
|
||||
const selector: vscode.DocumentSelector = { language: 'markdown', scheme: '*' };
|
||||
|
||||
const charPattern = '(\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark})';
|
||||
|
||||
return vscode.Disposable.from(
|
||||
vscode.languages.setLanguageConfiguration('markdown', {
|
||||
wordPattern: new RegExp(`${charPattern}((${charPattern}|[_])?${charPattern})*`, 'ug'),
|
||||
}),
|
||||
vscode.languages.registerDocumentSymbolProvider(selector, symbolProvider),
|
||||
vscode.languages.registerDocumentLinkProvider(selector, new LinkProvider()),
|
||||
vscode.languages.registerFoldingRangeProvider(selector, new MarkdownFoldingProvider(engine)),
|
||||
|
||||
@@ -19,37 +19,4 @@ export function activate(context: vscode.ExtensionContext): any {
|
||||
context.subscriptions.push(vscode.languages.registerCompletionItemProvider('php', new PHPCompletionItemProvider(), '>', '$'));
|
||||
context.subscriptions.push(vscode.languages.registerHoverProvider('php', new PHPHoverProvider()));
|
||||
context.subscriptions.push(vscode.languages.registerSignatureHelpProvider('php', new PHPSignatureHelpProvider(), '(', ','));
|
||||
|
||||
// need to set in the extension host as well as the completion provider uses it.
|
||||
vscode.languages.setLanguageConfiguration('php', {
|
||||
wordPattern: /(-?\d*\.\d\w*)|([^\-\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
||||
onEnterRules: [
|
||||
{
|
||||
// e.g. /** | */
|
||||
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
|
||||
afterText: /^\s*\*\/$/,
|
||||
action: { indentAction: vscode.IndentAction.IndentOutdent, appendText: ' * ' }
|
||||
},
|
||||
{
|
||||
// e.g. /** ...|
|
||||
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
|
||||
action: { indentAction: vscode.IndentAction.None, appendText: ' * ' }
|
||||
},
|
||||
{
|
||||
// e.g. * ...|
|
||||
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
|
||||
action: { indentAction: vscode.IndentAction.None, appendText: '* ' }
|
||||
},
|
||||
{
|
||||
// e.g. */|
|
||||
beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
|
||||
action: { indentAction: vscode.IndentAction.None, removeText: 1 }
|
||||
},
|
||||
{
|
||||
// e.g. *-----*/|
|
||||
beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/,
|
||||
action: { indentAction: vscode.IndentAction.None, removeText: 1 }
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,5 +33,49 @@
|
||||
"start": "^\\s*(#|\/\/)region\\b",
|
||||
"end": "^\\s*(#|\/\/)endregion\\b"
|
||||
}
|
||||
}
|
||||
},
|
||||
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\-\\`\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)",
|
||||
"onEnterRules": [
|
||||
{
|
||||
// e.g. /** | */
|
||||
"beforeText": "^\\s*\\/\\*\\*(?!\\/)([^\\*]|\\*(?!\\/))*$",
|
||||
"afterText": "^\\s*\\*\\/$",
|
||||
"action": {
|
||||
"indent": "indentOutdent",
|
||||
"appendText": " * "
|
||||
}
|
||||
},
|
||||
{
|
||||
// e.g. /** ...|
|
||||
"beforeText": "^\\s*\\/\\*\\*(?!\\/)([^\\*]|\\*(?!\\/))*$",
|
||||
"action": {
|
||||
"indent": "none",
|
||||
"appendText": " * "
|
||||
}
|
||||
},
|
||||
{
|
||||
// e.g. * ...|
|
||||
"beforeText": "^(\\t|(\\ \\ ))*\\ \\*(\\ ([^\\*]|\\*(?!\\/))*)?$",
|
||||
"action": {
|
||||
"indent": "none",
|
||||
"appendText": "* ",
|
||||
},
|
||||
},
|
||||
{
|
||||
// e.g. */|
|
||||
"beforeText": "^(\\t|(\\ \\ ))*\\ \\*\\/\\s*$",
|
||||
"action": {
|
||||
"indent": "none",
|
||||
"removeText": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
// e.g. *-----*/|
|
||||
"beforeText": "^(\\t|(\\ \\ ))*\\ \\*[^/]*\\*\\/\\s*$",
|
||||
"action": {
|
||||
"indent": "none",
|
||||
"removeText": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -27,5 +27,10 @@
|
||||
"start": "^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/",
|
||||
"end": "^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"indentationRules": {
|
||||
"increaseIndentPattern": "(^.*\\{[^}]*$)",
|
||||
"decreaseIndentPattern": "^\\s*\\}"
|
||||
},
|
||||
"wordPattern": "(#?-?\\d*\\.\\d\\w*%?)|(::?[\\w-]*(?=[^,{;]*[,{]))|(([@$#.!])?[\\w-?]+%?|[@#!$.])"
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "code-oss-dev",
|
||||
"version": "1.58.0",
|
||||
"distro": "33b93a117b5bff11c3fe9d4a6fa49e9895d38c08",
|
||||
"distro": "3f43781e788d694f33746808cc5182852222f935",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
|
||||
+5
-1
@@ -73,6 +73,10 @@ function code-wsl()
|
||||
|
||||
if [ "$IN_WSL" == "true" ] && [ -z "$DISPLAY" ]; then
|
||||
code-wsl "$@"
|
||||
elif [ -f /mnt/wslg/versions.txt ]; then
|
||||
code --disable-gpu "$@"
|
||||
else
|
||||
code "$@"
|
||||
fi
|
||||
code "$@"
|
||||
|
||||
exit $?
|
||||
|
||||
+11
-4
@@ -39,7 +39,7 @@ export enum RimRafMode {
|
||||
* - `MOVE`: faster variant that first moves the target to temp dir and then
|
||||
* deletes it in the background without waiting for that to finish.
|
||||
*/
|
||||
export async function rimraf(path: string, mode = RimRafMode.UNLINK): Promise<void> {
|
||||
async function rimraf(path: string, mode = RimRafMode.UNLINK): Promise<void> {
|
||||
if (isRootOrDriveLetter(path)) {
|
||||
throw new Error('rimraf - will refuse to recursively delete root');
|
||||
}
|
||||
@@ -179,7 +179,7 @@ function handleDirectoryChildren(children: (string | IDirent)[]): (string | IDir
|
||||
* A convinience method to read all children of a path that
|
||||
* are directories.
|
||||
*/
|
||||
export async function readDirsInDir(dirPath: string): Promise<string[]> {
|
||||
async function readDirsInDir(dirPath: string): Promise<string[]> {
|
||||
const children = await readdir(dirPath);
|
||||
const directories: string[] = [];
|
||||
|
||||
@@ -474,7 +474,7 @@ function ensureWriteOptions(options?: IWriteFileOptions): IEnsuredWriteFileOptio
|
||||
* - updates the `mtime` of the `source` after the operation
|
||||
* - allows to move across multiple disks
|
||||
*/
|
||||
export async function move(source: string, target: string): Promise<void> {
|
||||
async function move(source: string, target: string): Promise<void> {
|
||||
if (source === target) {
|
||||
return; // simulate node.js behaviour here and do a no-op if paths match
|
||||
}
|
||||
@@ -536,7 +536,7 @@ interface ICopyPayload {
|
||||
* links should be handled when encountered. Set to
|
||||
* `false` to not preserve them and `true` otherwise.
|
||||
*/
|
||||
export async function copy(source: string, target: string, options: { preserveSymlinks: boolean }): Promise<void> {
|
||||
async function copy(source: string, target: string, options: { preserveSymlinks: boolean }): Promise<void> {
|
||||
return doCopy(source, target, { root: { source, target }, options, handledSourcePaths: new Set<string>() });
|
||||
}
|
||||
|
||||
@@ -698,8 +698,15 @@ export const Promises = new class {
|
||||
}
|
||||
|
||||
get readdir() { return readdir; }
|
||||
get readDirsInDir() { return readDirsInDir; }
|
||||
|
||||
get writeFile() { return writeFile; }
|
||||
|
||||
get rm() { return rimraf; }
|
||||
|
||||
get move() { return move; }
|
||||
get copy() { return copy; }
|
||||
|
||||
//#endregion
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as path from 'vs/base/common/path';
|
||||
import { createWriteStream, WriteStream } from 'fs';
|
||||
import { Readable } from 'stream';
|
||||
import { Sequencer, createCancelablePromise } from 'vs/base/common/async';
|
||||
import { Promises, rimraf } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { open as _openZip, Entry, ZipFile } from 'yauzl';
|
||||
import * as yazl from 'yazl';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
@@ -218,7 +218,7 @@ export function extract(zipPath: string, targetPath: string, options: IExtractOp
|
||||
let promise = openZip(zipPath, true);
|
||||
|
||||
if (options.overwrite) {
|
||||
promise = promise.then(zipfile => rimraf(targetPath).then(() => zipfile));
|
||||
promise = promise.then(zipfile => Promises.rm(targetPath).then(() => zipfile));
|
||||
}
|
||||
|
||||
return promise.then(zipfile => extractZip(zipfile, targetPath, { sourcePathRegex }, token));
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Event } from 'vs/base/common/event';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
import { mapToString, setToString } from 'vs/base/common/map';
|
||||
import { basename } from 'vs/base/common/path';
|
||||
import { copy, Promises } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { IStorageDatabase, IStorageItemsChangeEvent, IUpdateRequest } from 'vs/base/parts/storage/common/storage';
|
||||
|
||||
interface IDatabaseConnection {
|
||||
@@ -216,7 +216,7 @@ export class SQLiteStorageDatabase implements IStorageDatabase {
|
||||
private backup(): Promise<void> {
|
||||
const backupPath = this.toBackupPath(this.path);
|
||||
|
||||
return copy(this.path, backupPath, { preserveSymlinks: false });
|
||||
return Promises.copy(this.path, backupPath, { preserveSymlinks: false });
|
||||
}
|
||||
|
||||
private toBackupPath(path: string): string {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Storage, IStorageDatabase, IStorageItemsChangeEvent } from 'vs/base/par
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { tmpdir } from 'os';
|
||||
import { strictEqual, ok } from 'assert';
|
||||
import { rimraf, Promises } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
@@ -26,7 +26,7 @@ flakySuite('Storage Library', function () {
|
||||
});
|
||||
|
||||
teardown(function () {
|
||||
return rimraf(testDir);
|
||||
return Promises.rm(testDir);
|
||||
});
|
||||
|
||||
test('basics', async () => {
|
||||
@@ -299,7 +299,7 @@ flakySuite('SQLite Storage Library', function () {
|
||||
});
|
||||
|
||||
teardown(function () {
|
||||
return rimraf(testdir);
|
||||
return Promises.rm(testdir);
|
||||
});
|
||||
|
||||
async function testDBBasics(path: string, logError?: (error: Error | string) => void) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { checksum } from 'vs/base/node/crypto';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { tmpdir } from 'os';
|
||||
import { Promises, rimraf } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { flakySuite, getRandomTestPath } from 'vs/base/test/node/testUtils';
|
||||
|
||||
flakySuite('Crypto', () => {
|
||||
@@ -20,7 +20,7 @@ flakySuite('Crypto', () => {
|
||||
});
|
||||
|
||||
teardown(function () {
|
||||
return rimraf(testDir);
|
||||
return Promises.rm(testDir);
|
||||
});
|
||||
|
||||
test('checksum', async () => {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { tmpdir } from 'os';
|
||||
import { Promises, rimraf } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { realcaseSync, realpath, realpathSync } from 'vs/base/node/extpath';
|
||||
import { flakySuite, getRandomTestPath } from 'vs/base/test/node/testUtils';
|
||||
|
||||
@@ -19,7 +19,7 @@ flakySuite('Extpath', () => {
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
return rimraf(testDir);
|
||||
return Promises.rm(testDir);
|
||||
});
|
||||
|
||||
test('realcase', async () => {
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as fs from 'fs';
|
||||
import { tmpdir } from 'os';
|
||||
import { join, sep } from 'vs/base/common/path';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { copy, move, Promises, readDirsInDir, rimraf, RimRafMode, rimrafSync, SymlinkSupport, writeFileSync } from 'vs/base/node/pfs';
|
||||
import { Promises, RimRafMode, rimrafSync, SymlinkSupport, writeFileSync } from 'vs/base/node/pfs';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
import { canNormalize } from 'vs/base/common/normalization';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
@@ -26,7 +26,7 @@ flakySuite('PFS', function () {
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
return rimraf(testDir);
|
||||
return Promises.rm(testDir);
|
||||
});
|
||||
|
||||
test('writeFile', async () => {
|
||||
@@ -77,7 +77,7 @@ flakySuite('PFS', function () {
|
||||
fs.writeFileSync(join(testDir, 'somefile.txt'), 'Contents');
|
||||
fs.writeFileSync(join(testDir, 'someOtherFile.txt'), 'Contents');
|
||||
|
||||
await rimraf(testDir);
|
||||
await Promises.rm(testDir);
|
||||
assert.ok(!fs.existsSync(testDir));
|
||||
});
|
||||
|
||||
@@ -85,7 +85,7 @@ flakySuite('PFS', function () {
|
||||
fs.writeFileSync(join(testDir, 'somefile.txt'), 'Contents');
|
||||
fs.writeFileSync(join(testDir, 'someOtherFile.txt'), 'Contents');
|
||||
|
||||
await rimraf(testDir, RimRafMode.MOVE);
|
||||
await Promises.rm(testDir, RimRafMode.MOVE);
|
||||
assert.ok(!fs.existsSync(testDir));
|
||||
});
|
||||
|
||||
@@ -95,7 +95,7 @@ flakySuite('PFS', function () {
|
||||
fs.mkdirSync(join(testDir, 'somefolder'));
|
||||
fs.writeFileSync(join(testDir, 'somefolder', 'somefile.txt'), 'Contents');
|
||||
|
||||
await rimraf(testDir);
|
||||
await Promises.rm(testDir);
|
||||
assert.ok(!fs.existsSync(testDir));
|
||||
});
|
||||
|
||||
@@ -105,7 +105,7 @@ flakySuite('PFS', function () {
|
||||
fs.mkdirSync(join(testDir, 'somefolder'));
|
||||
fs.writeFileSync(join(testDir, 'somefolder', 'somefile.txt'), 'Contents');
|
||||
|
||||
await rimraf(testDir, RimRafMode.MOVE);
|
||||
await Promises.rm(testDir, RimRafMode.MOVE);
|
||||
assert.ok(!fs.existsSync(testDir));
|
||||
});
|
||||
|
||||
@@ -113,7 +113,7 @@ flakySuite('PFS', function () {
|
||||
fs.writeFileSync(join(testDir, 'somefile.txt'), 'Contents');
|
||||
fs.writeFileSync(join(testDir, 'someOtherFile.txt'), 'Contents');
|
||||
|
||||
await rimraf(testDir, RimRafMode.MOVE);
|
||||
await Promises.rm(testDir, RimRafMode.MOVE);
|
||||
assert.ok(!fs.existsSync(testDir));
|
||||
});
|
||||
|
||||
@@ -121,7 +121,7 @@ flakySuite('PFS', function () {
|
||||
fs.writeFileSync(join(testDir, 'somefile.txt'), 'Contents');
|
||||
fs.writeFileSync(join(testDir, 'someOtherFile.txt'), 'Contents');
|
||||
|
||||
await rimraf(`${testDir}${sep}`, RimRafMode.MOVE);
|
||||
await Promises.rm(`${testDir}${sep}`, RimRafMode.MOVE);
|
||||
assert.ok(!fs.existsSync(testDir));
|
||||
});
|
||||
|
||||
@@ -161,7 +161,7 @@ flakySuite('PFS', function () {
|
||||
const targetDir = join(parentDir, id);
|
||||
const targetDir2 = join(parentDir, id2);
|
||||
|
||||
await copy(sourceDir, targetDir, { preserveSymlinks: true });
|
||||
await Promises.copy(sourceDir, targetDir, { preserveSymlinks: true });
|
||||
|
||||
assert.ok(fs.existsSync(targetDir));
|
||||
assert.ok(fs.existsSync(join(targetDir, 'index.html')));
|
||||
@@ -170,7 +170,7 @@ flakySuite('PFS', function () {
|
||||
assert.ok(fs.statSync(join(targetDir, 'examples')).isDirectory());
|
||||
assert.ok(fs.existsSync(join(targetDir, 'examples', 'small.jxs')));
|
||||
|
||||
await move(targetDir, targetDir2);
|
||||
await Promises.move(targetDir, targetDir2);
|
||||
|
||||
assert.ok(!fs.existsSync(targetDir));
|
||||
assert.ok(fs.existsSync(targetDir2));
|
||||
@@ -180,12 +180,12 @@ flakySuite('PFS', function () {
|
||||
assert.ok(fs.statSync(join(targetDir2, 'examples')).isDirectory());
|
||||
assert.ok(fs.existsSync(join(targetDir2, 'examples', 'small.jxs')));
|
||||
|
||||
await move(join(targetDir2, 'index.html'), join(targetDir2, 'index_moved.html'));
|
||||
await Promises.move(join(targetDir2, 'index.html'), join(targetDir2, 'index_moved.html'));
|
||||
|
||||
assert.ok(!fs.existsSync(join(targetDir2, 'index.html')));
|
||||
assert.ok(fs.existsSync(join(targetDir2, 'index_moved.html')));
|
||||
|
||||
await rimraf(parentDir);
|
||||
await Promises.rm(parentDir);
|
||||
|
||||
assert.ok(!fs.existsSync(parentDir));
|
||||
});
|
||||
@@ -209,7 +209,7 @@ flakySuite('PFS', function () {
|
||||
// Windows: this test does not work because creating symlinks
|
||||
// requires priviledged permissions (admin).
|
||||
if (!isWindows) {
|
||||
await copy(symLink, copyTarget, { preserveSymlinks: true });
|
||||
await Promises.copy(symLink, copyTarget, { preserveSymlinks: true });
|
||||
|
||||
assert.ok(fs.existsSync(copyTarget));
|
||||
|
||||
@@ -222,8 +222,8 @@ flakySuite('PFS', function () {
|
||||
|
||||
// Copy does not preserve symlinks if configured as such
|
||||
|
||||
await rimraf(copyTarget);
|
||||
await copy(symLink, copyTarget, { preserveSymlinks: false });
|
||||
await Promises.rm(copyTarget);
|
||||
await Promises.copy(symLink, copyTarget, { preserveSymlinks: false });
|
||||
|
||||
assert.ok(fs.existsSync(copyTarget));
|
||||
|
||||
@@ -233,10 +233,10 @@ flakySuite('PFS', function () {
|
||||
|
||||
// Copy does not fail over dangling symlinks
|
||||
|
||||
await rimraf(copyTarget);
|
||||
await rimraf(symbolicLinkTarget);
|
||||
await Promises.rm(copyTarget);
|
||||
await Promises.rm(symbolicLinkTarget);
|
||||
|
||||
await copy(symLink, copyTarget, { preserveSymlinks: true }); // this should not throw
|
||||
await Promises.copy(symLink, copyTarget, { preserveSymlinks: true }); // this should not throw
|
||||
|
||||
if (!isWindows) {
|
||||
const { symbolicLink } = await SymlinkSupport.stat(copyTarget);
|
||||
@@ -270,7 +270,7 @@ flakySuite('PFS', function () {
|
||||
// Windows: this test does not work because creating symlinks
|
||||
// requires priviledged permissions (admin).
|
||||
if (!isWindows) {
|
||||
await copy(sourceLinkTestFolder, targetLinkTestFolder, { preserveSymlinks: true });
|
||||
await Promises.copy(sourceLinkTestFolder, targetLinkTestFolder, { preserveSymlinks: true });
|
||||
|
||||
assert.ok(fs.existsSync(targetLinkTestFolder));
|
||||
assert.ok(fs.existsSync(targetLinkMD5JSFolder));
|
||||
@@ -285,7 +285,7 @@ flakySuite('PFS', function () {
|
||||
}
|
||||
|
||||
// Copy with `preserveSymlinks: false` and verify result
|
||||
await copy(sourceLinkTestFolder, targetLinkTestFolder, { preserveSymlinks: false });
|
||||
await Promises.copy(sourceLinkTestFolder, targetLinkTestFolder, { preserveSymlinks: false });
|
||||
|
||||
assert.ok(fs.existsSync(targetLinkTestFolder));
|
||||
assert.ok(fs.existsSync(targetLinkMD5JSFolder));
|
||||
@@ -301,7 +301,7 @@ flakySuite('PFS', function () {
|
||||
fs.writeFileSync(join(testDir, 'somefile.txt'), 'Contents');
|
||||
fs.writeFileSync(join(testDir, 'someOtherFile.txt'), 'Contents');
|
||||
|
||||
const result = await readDirsInDir(testDir);
|
||||
const result = await Promises.readDirsInDir(testDir);
|
||||
assert.strictEqual(result.length, 3);
|
||||
assert.ok(result.indexOf('somefolder1') !== -1);
|
||||
assert.ok(result.indexOf('somefolder2') !== -1);
|
||||
@@ -338,7 +338,7 @@ flakySuite('PFS', function () {
|
||||
|
||||
fs.symlinkSync(directory, symbolicLink, 'junction');
|
||||
|
||||
await rimraf(directory);
|
||||
await Promises.rm(directory);
|
||||
|
||||
const statAndIsLink = await SymlinkSupport.stat(symbolicLink);
|
||||
assert.ok(statAndIsLink?.symbolicLink);
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as assert from 'assert';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { tmpdir } from 'os';
|
||||
import { extract } from 'vs/base/node/zip';
|
||||
import { rimraf, Promises } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { createCancelablePromise } from 'vs/base/common/async';
|
||||
import { getRandomTestPath, getPathFromAmdModule } from 'vs/base/test/node/testUtils';
|
||||
|
||||
@@ -22,7 +22,7 @@ suite('Zip', () => {
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
return rimraf(testDir);
|
||||
return Promises.rm(testDir);
|
||||
});
|
||||
|
||||
test('extract should handle directories', async () => {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { basename, dirname, join } from 'vs/base/common/path';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { Promises, rimraf } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
@@ -58,7 +58,7 @@ export class CodeCacheCleaner extends Disposable {
|
||||
if (codeCacheEntryStat.isDirectory() && (now - codeCacheEntryStat.mtime.getTime()) > this._DataMaxAge) {
|
||||
this.logService.info(`[code cache cleanup]: Removing code cache folder ${codeCache}.`);
|
||||
|
||||
return rimraf(codeCacheEntryPath);
|
||||
return Promises.rm(codeCacheEntryPath);
|
||||
}
|
||||
}));
|
||||
} catch (error) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { Promises, rimraf } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { IStringDictionary } from 'vs/base/common/collections';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
@@ -80,7 +80,7 @@ export class LanguagePackCachedDataCleaner extends Disposable {
|
||||
|
||||
this.logService.info(`[language pack cache cleanup]: Removing unused language pack: ${entry}`);
|
||||
|
||||
await rimraf(join(cacheDir, entry));
|
||||
await Promises.rm(join(cacheDir, entry));
|
||||
}
|
||||
|
||||
const now = Date.now();
|
||||
@@ -97,7 +97,7 @@ export class LanguagePackCachedDataCleaner extends Disposable {
|
||||
if (stat.isDirectory() && (now - stat.mtime.getTime()) > this._DataMaxAge) {
|
||||
this.logService.info(`[language pack cache cleanup]: Removing language pack cache folder: ${join(packEntry, entry)}`);
|
||||
|
||||
await rimraf(candidate);
|
||||
await Promises.rm(candidate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { join, dirname, basename } from 'vs/base/common/path';
|
||||
import { Promises, rimraf } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
@@ -41,7 +41,7 @@ export class LogsDataCleaner extends Disposable {
|
||||
if (sessionsToDelete.length > 0) {
|
||||
this.logService.info(`[logs cleanup]: Removing log folders '${sessionsToDelete.join(', ')}'`);
|
||||
|
||||
await Promise.all(sessionsToDelete.map(sessionToDelete => rimraf(join(logsRoot, sessionToDelete))));
|
||||
await Promise.all(sessionsToDelete.map(sessionToDelete => Promises.rm(join(logsRoot, sessionToDelete))));
|
||||
}
|
||||
} catch (error) {
|
||||
onUnexpectedError(error);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { Promises, rimraf } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IBackupWorkspacesFormat } from 'vs/platform/backup/node/backup';
|
||||
@@ -52,7 +52,7 @@ export class StorageDataCleaner extends Disposable {
|
||||
if (emptyWorkspaces.indexOf(storageFolder) === -1) {
|
||||
this.logService.info(`[storage cleanup]: Deleting storage folder ${storageFolder}.`);
|
||||
|
||||
await rimraf(join(this.environmentService.workspaceStorageHome.fsPath, storageFolder));
|
||||
await Promises.rm(join(this.environmentService.workspaceStorageHome.fsPath, storageFolder));
|
||||
}
|
||||
}));
|
||||
} catch (error) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as fs from 'fs';
|
||||
import { createHash } from 'crypto';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { isLinux } from 'vs/base/common/platform';
|
||||
import { writeFileSync, rimraf, RimRafMode, Promises } from 'vs/base/node/pfs';
|
||||
import { writeFileSync, RimRafMode, Promises } from 'vs/base/node/pfs';
|
||||
import { IBackupMainService, IWorkspaceBackupInfo, isWorkspaceBackupInfo } from 'vs/platform/backup/electron-main/backup';
|
||||
import { IBackupWorkspacesFormat, IEmptyWindowBackupInfo } from 'vs/platform/backup/node/backup';
|
||||
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
|
||||
@@ -313,7 +313,7 @@ export class BackupMainService implements IBackupMainService {
|
||||
private async deleteStaleBackup(backupPath: string): Promise<void> {
|
||||
try {
|
||||
if (await Promises.exists(backupPath)) {
|
||||
await rimraf(backupPath, RimRafMode.MOVE);
|
||||
await Promises.rm(backupPath, RimRafMode.MOVE);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logService.error(`Backup: Could not delete stale backup: ${error.toString()}`);
|
||||
|
||||
@@ -132,7 +132,7 @@ flakySuite('BackupMainService', () => {
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
return pfs.rimraf(testDir);
|
||||
return pfs.Promises.rm(testDir);
|
||||
});
|
||||
|
||||
test('service validates backup workspaces on startup and cleans up (folder workspaces)', async function () {
|
||||
|
||||
@@ -112,7 +112,7 @@ export interface IConfigurationService {
|
||||
updateValue(key: string, value: any, target: ConfigurationTarget): Promise<void>;
|
||||
updateValue(key: string, value: any, overrides: IConfigurationOverrides, target: ConfigurationTarget, donotNotifyError?: boolean): Promise<void>;
|
||||
|
||||
inspect<T>(key: string, overrides?: IConfigurationOverrides): IConfigurationValue<T>;
|
||||
inspect<T>(key: string, overrides?: IConfigurationOverrides): IConfigurationValue<Readonly<T>>;
|
||||
|
||||
reloadConfiguration(target?: ConfigurationTarget | IWorkspaceFolder): Promise<void>;
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ function getCoreTranslationAssets(version: IRawGalleryExtensionVersion): [string
|
||||
function getRepositoryAsset(version: IRawGalleryExtensionVersion): IGalleryExtensionAsset | null {
|
||||
if (version.properties) {
|
||||
const results = version.properties.filter(p => p.key === AssetType.Repository);
|
||||
const gitRegExp = new RegExp('((git|ssh|http(s)?)|(git@[\w.]+))(:(//)?)([\w.@\:/\-~]+)(.git)(/)?');
|
||||
const gitRegExp = new RegExp('((git|ssh|http(s)?)|(git@[\\w.]+))(:(//)?)([\\w.@\:/\\-~]+)(.git)(/)?');
|
||||
|
||||
const uri = results.filter(r => gitRegExp.test(r.value))[0];
|
||||
return uri ? { uri: uri.value, fallbackUri: uri.value } : null;
|
||||
|
||||
@@ -12,7 +12,7 @@ import { join } from 'vs/base/common/path';
|
||||
import { Limiter } from 'vs/base/common/async';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { rimraf } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
|
||||
export class ExtensionsLifecycle extends Disposable {
|
||||
@@ -34,7 +34,7 @@ export class ExtensionsLifecycle extends Disposable {
|
||||
this.runLifecycleHook(script.script, 'uninstall', script.args, true, extension)
|
||||
.then(() => this.logService.info(extension.identifier.id, extension.manifest.version, `Finished running post uninstall script`), err => this.logService.error(extension.identifier.id, extension.manifest.version, `Failed to run post uninstall script: ${err}`)));
|
||||
}
|
||||
return rimraf(this.getExtensionStoragePath(extension)).then(undefined, e => this.logService.error('Error while removing extension storage path', e));
|
||||
return Promises.rm(this.getExtensionStoragePath(extension)).then(undefined, e => this.logService.error('Error while removing extension storage path', e));
|
||||
}
|
||||
|
||||
private parseScript(extension: ILocalExtension, type: string): { script: string, args: string[] } | null {
|
||||
|
||||
@@ -36,6 +36,6 @@ export class ExtensionsManifestCache extends Disposable {
|
||||
}
|
||||
|
||||
invalidate(): void {
|
||||
pfs.rimraf(this.extensionsManifestCache, pfs.RimRafMode.MOVE).then(() => { }, () => { });
|
||||
pfs.Promises.rm(this.extensionsManifestCache, pfs.RimRafMode.MOVE).then(() => { }, () => { });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,10 +106,10 @@ export class ExtensionsScanner extends Disposable {
|
||||
const extensionPath = path.join(this.extensionsPath, folderName);
|
||||
|
||||
try {
|
||||
await pfs.rimraf(extensionPath);
|
||||
await pfs.Promises.rm(extensionPath);
|
||||
} catch (error) {
|
||||
try {
|
||||
await pfs.rimraf(extensionPath);
|
||||
await pfs.Promises.rm(extensionPath);
|
||||
} catch (e) { /* ignore */ }
|
||||
throw new ExtensionManagementError(localize('errorDeleting', "Unable to delete the existing folder '{0}' while installing the extension '{1}'. Please delete the folder manually and try again", extensionPath, identifierWithVersion.id), INSTALL_ERROR_DELETING);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ export class ExtensionsScanner extends Disposable {
|
||||
this.logService.info('Renamed to', extensionPath);
|
||||
} catch (error) {
|
||||
try {
|
||||
await pfs.rimraf(tempPath);
|
||||
await pfs.Promises.rm(tempPath);
|
||||
} catch (e) { /* ignore */ }
|
||||
if (error.code === 'ENOTEMPTY') {
|
||||
this.logService.info(`Rename failed because extension was installed by another source. So ignoring renaming.`, identifierWithVersion.id);
|
||||
@@ -210,7 +210,7 @@ export class ExtensionsScanner extends Disposable {
|
||||
if (Object.keys(uninstalled).length) {
|
||||
await pfs.Promises.writeFile(this.uninstalledPath, JSON.stringify(uninstalled));
|
||||
} else {
|
||||
await pfs.rimraf(this.uninstalledPath);
|
||||
await pfs.Promises.rm(this.uninstalledPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ export class ExtensionsScanner extends Disposable {
|
||||
|
||||
async removeExtension(extension: ILocalExtension, type: string): Promise<void> {
|
||||
this.logService.trace(`Deleting ${type} extension from disk`, extension.identifier.id, extension.location.fsPath);
|
||||
await pfs.rimraf(extension.location.fsPath);
|
||||
await pfs.Promises.rm(extension.location.fsPath);
|
||||
this.logService.info('Deleted from disk', extension.identifier.id, extension.location.fsPath);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ export class ExtensionsScanner extends Disposable {
|
||||
|
||||
// Clean the location
|
||||
try {
|
||||
await pfs.rimraf(location);
|
||||
await pfs.Promises.rm(location);
|
||||
} catch (e) {
|
||||
throw new ExtensionManagementError(this.joinErrors(e).message, INSTALL_ERROR_DELETING);
|
||||
}
|
||||
@@ -243,7 +243,7 @@ export class ExtensionsScanner extends Disposable {
|
||||
await extract(zipPath, location, { sourcePath: 'extension', overwrite: true }, token);
|
||||
this.logService.info(`Extracted extension to ${location}:`, identifier.id);
|
||||
} catch (e) {
|
||||
try { await pfs.rimraf(location); } catch (e) { /* Ignore */ }
|
||||
try { await pfs.Promises.rm(location); } catch (e) { /* Ignore */ }
|
||||
throw new ExtensionManagementError(e.message, e instanceof ExtractError && e.type ? e.type : INSTALL_ERROR_EXTRACTING);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { FileSystemProviderCapabilities, IFileChange, IWatchOptions, IStat, File
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { isLinux, isWindows } from 'vs/base/common/platform';
|
||||
import { SymlinkSupport, move, copy, rimraf, RimRafMode, IDirent, Promises } from 'vs/base/node/pfs';
|
||||
import { SymlinkSupport, RimRafMode, IDirent, Promises } from 'vs/base/node/pfs';
|
||||
import { normalize, basename, dirname } from 'vs/base/common/path';
|
||||
import { joinPath } from 'vs/base/common/resources';
|
||||
import { isEqual } from 'vs/base/common/extpath';
|
||||
@@ -435,7 +435,7 @@ export class DiskFileSystemProvider extends Disposable implements
|
||||
|
||||
protected async doDelete(filePath: string, opts: FileDeleteOptions): Promise<void> {
|
||||
if (opts.recursive) {
|
||||
await rimraf(filePath, RimRafMode.MOVE);
|
||||
await Promises.rm(filePath, RimRafMode.MOVE);
|
||||
} else {
|
||||
await Promises.unlink(filePath);
|
||||
}
|
||||
@@ -455,7 +455,7 @@ export class DiskFileSystemProvider extends Disposable implements
|
||||
await this.validateTargetDeleted(from, to, 'move', opts.overwrite);
|
||||
|
||||
// Move
|
||||
await move(fromFilePath, toFilePath);
|
||||
await Promises.move(fromFilePath, toFilePath);
|
||||
} catch (error) {
|
||||
|
||||
// rewrite some typical errors that can happen especially around symlinks
|
||||
@@ -482,7 +482,7 @@ export class DiskFileSystemProvider extends Disposable implements
|
||||
await this.validateTargetDeleted(from, to, 'copy', opts.overwrite);
|
||||
|
||||
// Copy
|
||||
await copy(fromFilePath, toFilePath, { preserveSymlinks: true });
|
||||
await Promises.copy(fromFilePath, toFilePath, { preserveSymlinks: true });
|
||||
} catch (error) {
|
||||
|
||||
// rewrite some typical errors that can happen especially around symlinks
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Schemas } from 'vs/base/common/network';
|
||||
import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider';
|
||||
import { flakySuite, getRandomTestPath, getPathFromAmdModule } from 'vs/base/test/node/testUtils';
|
||||
import { join, basename, dirname, posix } from 'vs/base/common/path';
|
||||
import { copy, Promises, rimraf, rimrafSync } from 'vs/base/node/pfs';
|
||||
import { Promises, rimrafSync } from 'vs/base/node/pfs';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { existsSync, statSync, readdirSync, readFileSync, writeFileSync, renameSync, unlinkSync, mkdirSync, createReadStream } from 'fs';
|
||||
import { FileOperation, FileOperationEvent, IFileStat, FileOperationResult, FileSystemProviderCapabilities, FileChangeType, IFileChange, FileChangesEvent, FileOperationError, etag, IStat, IFileStatWithMetadata, IReadFileOptions, FilePermission, NotModifiedSinceFileOperationError } from 'vs/platform/files/common/files';
|
||||
@@ -154,13 +154,13 @@ flakySuite('Disk File Service', function () {
|
||||
|
||||
const sourceDir = getPathFromAmdModule(require, './fixtures/service');
|
||||
|
||||
await copy(sourceDir, testDir, { preserveSymlinks: false });
|
||||
await Promises.copy(sourceDir, testDir, { preserveSymlinks: false });
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
disposables.clear();
|
||||
|
||||
return rimraf(testDir);
|
||||
return Promises.rm(testDir);
|
||||
});
|
||||
|
||||
test('createFolder', async () => {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { readFileSync } from 'fs';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { flakySuite, getRandomTestPath } from 'vs/base/test/node/testUtils';
|
||||
import { FileStorage } from 'vs/platform/state/electron-main/stateMainService';
|
||||
import { Promises, rimraf, writeFileSync } from 'vs/base/node/pfs';
|
||||
import { Promises, writeFileSync } from 'vs/base/node/pfs';
|
||||
import { ILogService, NullLogService } from 'vs/platform/log/common/log';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { FileService } from 'vs/platform/files/common/fileService';
|
||||
@@ -40,7 +40,7 @@ flakySuite('StateMainService', () => {
|
||||
fileService.dispose();
|
||||
diskFileSystemProvider.dispose();
|
||||
|
||||
return rimraf(testDir);
|
||||
return Promises.rm(testDir);
|
||||
});
|
||||
|
||||
test('Basics', async function () {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { StorageScope, IS_NEW_KEY, AbstractStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { StorageScope, IS_NEW_KEY, AbstractStorageService, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||
import { IWorkspaceInitializationPayload } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IStorage, Storage, IStorageDatabase, IUpdateRequest, InMemoryStorageDatabase } from 'vs/base/parts/storage/common/storage';
|
||||
import { Promises } from 'vs/base/common/async';
|
||||
@@ -154,16 +154,22 @@ export class BrowserStorageService extends AbstractStorageService {
|
||||
|
||||
async clear(): Promise<void> {
|
||||
|
||||
// Note: used for testing purposes only!
|
||||
// Clear key/values
|
||||
for (const scope of [StorageScope.GLOBAL, StorageScope.WORKSPACE]) {
|
||||
for (const target of [StorageTarget.USER, StorageTarget.MACHINE]) {
|
||||
for (const key of this.keys(scope, target)) {
|
||||
this.remove(key, scope);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear DBs
|
||||
await this.getStorage(scope)?.whenFlushed();
|
||||
}
|
||||
|
||||
// Clear databases
|
||||
await Promises.settled([
|
||||
this.globalStorageDatabase?.clear() ?? Promise.resolve(),
|
||||
this.workspaceStorageDatabase?.clear() ?? Promise.resolve()
|
||||
]);
|
||||
|
||||
// Flush to ensure data has been cleared
|
||||
await this.flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,24 +15,33 @@ import { InMemoryFileSystemProvider } from 'vs/platform/files/common/inMemoryFil
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||
|
||||
async function createStorageService(): Promise<[DisposableStore, BrowserStorageService]> {
|
||||
const disposables = new DisposableStore();
|
||||
const logService = new NullLogService();
|
||||
|
||||
const fileService = disposables.add(new FileService(logService));
|
||||
|
||||
const userDataProvider = disposables.add(new InMemoryFileSystemProvider());
|
||||
disposables.add(fileService.registerProvider(Schemas.userData, userDataProvider));
|
||||
|
||||
const storageService = disposables.add(new BrowserStorageService({ id: 'workspace-storage-test' }, logService, { userRoamingDataHome: URI.file('/User').with({ scheme: Schemas.userData }) } as unknown as IEnvironmentService, fileService));
|
||||
|
||||
await storageService.initialize();
|
||||
|
||||
return [disposables, storageService];
|
||||
}
|
||||
|
||||
flakySuite('StorageService (browser)', function () {
|
||||
|
||||
const disposables = new DisposableStore();
|
||||
let storageService: BrowserStorageService;
|
||||
|
||||
createSuite<BrowserStorageService>({
|
||||
setup: async () => {
|
||||
const logService = new NullLogService();
|
||||
|
||||
const fileService = disposables.add(new FileService(logService));
|
||||
|
||||
const userDataProvider = disposables.add(new InMemoryFileSystemProvider());
|
||||
disposables.add(fileService.registerProvider(Schemas.userData, userDataProvider));
|
||||
|
||||
storageService = disposables.add(new BrowserStorageService({ id: 'workspace-storage-test' }, logService, { userRoamingDataHome: URI.file('/User').with({ scheme: Schemas.userData }) } as unknown as IEnvironmentService, fileService));
|
||||
|
||||
await storageService.initialize();
|
||||
const res = await createStorageService();
|
||||
disposables.add(res[0]);
|
||||
storageService = res[1];
|
||||
|
||||
return storageService;
|
||||
},
|
||||
@@ -43,6 +52,39 @@ flakySuite('StorageService (browser)', function () {
|
||||
});
|
||||
});
|
||||
|
||||
flakySuite('StorageService (browser specific)', () => {
|
||||
const disposables = new DisposableStore();
|
||||
let storageService: BrowserStorageService;
|
||||
|
||||
setup(async () => {
|
||||
const res = await createStorageService();
|
||||
disposables.add(res[0]);
|
||||
|
||||
storageService = res[1];
|
||||
});
|
||||
|
||||
teardown(async () => {
|
||||
await storageService.clear();
|
||||
disposables.clear();
|
||||
});
|
||||
|
||||
test('clear', async () => {
|
||||
storageService.store('bar', 'foo', StorageScope.GLOBAL, StorageTarget.MACHINE);
|
||||
storageService.store('bar', 3, StorageScope.GLOBAL, StorageTarget.USER);
|
||||
storageService.store('bar', 'foo', StorageScope.WORKSPACE, StorageTarget.MACHINE);
|
||||
storageService.store('bar', 3, StorageScope.WORKSPACE, StorageTarget.USER);
|
||||
|
||||
await storageService.clear();
|
||||
|
||||
for (const scope of [StorageScope.GLOBAL, StorageScope.WORKSPACE]) {
|
||||
for (const target of [StorageTarget.USER, StorageTarget.MACHINE]) {
|
||||
strictEqual(storageService.get('bar', scope), undefined);
|
||||
strictEqual(storageService.keys(scope, target).length, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
flakySuite('IndexDBStorageDatabase (browser)', () => {
|
||||
|
||||
const id = 'workspace-storage-db-test';
|
||||
@@ -71,6 +113,9 @@ flakySuite('IndexDBStorageDatabase (browser)', () => {
|
||||
strictEqual(storage.get('barUndefined'), undefined);
|
||||
strictEqual(storage.get('barNull'), undefined);
|
||||
|
||||
strictEqual(storage.size, 3);
|
||||
strictEqual(storage.items.size, 3);
|
||||
|
||||
await storage.close();
|
||||
|
||||
storage = new Storage(await IndexedDBStorageDatabase.create(id, logService));
|
||||
@@ -84,6 +129,9 @@ flakySuite('IndexDBStorageDatabase (browser)', () => {
|
||||
strictEqual(storage.get('barUndefined'), undefined);
|
||||
strictEqual(storage.get('barNull'), undefined);
|
||||
|
||||
strictEqual(storage.size, 3);
|
||||
strictEqual(storage.items.size, 3);
|
||||
|
||||
// Update data
|
||||
storage.set('bar', 'foo2');
|
||||
storage.set('barNumber', 552);
|
||||
@@ -104,6 +152,9 @@ flakySuite('IndexDBStorageDatabase (browser)', () => {
|
||||
strictEqual(storage.get('barUndefined'), undefined);
|
||||
strictEqual(storage.get('barNull'), undefined);
|
||||
|
||||
strictEqual(storage.size, 3);
|
||||
strictEqual(storage.items.size, 3);
|
||||
|
||||
// Delete data
|
||||
storage.delete('bar');
|
||||
storage.delete('barNumber');
|
||||
@@ -113,6 +164,9 @@ flakySuite('IndexDBStorageDatabase (browser)', () => {
|
||||
strictEqual(storage.get('barNumber', 'undefinedNumber'), 'undefinedNumber');
|
||||
strictEqual(storage.get('barBoolean', 'undefinedBoolean'), 'undefinedBoolean');
|
||||
|
||||
strictEqual(storage.size, 0);
|
||||
strictEqual(storage.items.size, 0);
|
||||
|
||||
await storage.close();
|
||||
|
||||
storage = new Storage(await IndexedDBStorageDatabase.create(id, logService));
|
||||
@@ -122,6 +176,38 @@ flakySuite('IndexDBStorageDatabase (browser)', () => {
|
||||
strictEqual(storage.get('bar', 'undefined'), 'undefined');
|
||||
strictEqual(storage.get('barNumber', 'undefinedNumber'), 'undefinedNumber');
|
||||
strictEqual(storage.get('barBoolean', 'undefinedBoolean'), 'undefinedBoolean');
|
||||
|
||||
strictEqual(storage.size, 0);
|
||||
strictEqual(storage.items.size, 0);
|
||||
});
|
||||
|
||||
test('Clear', async () => {
|
||||
let storage = new Storage(await IndexedDBStorageDatabase.create(id, logService));
|
||||
|
||||
await storage.init();
|
||||
|
||||
storage.set('bar', 'foo');
|
||||
storage.set('barNumber', 55);
|
||||
storage.set('barBoolean', true);
|
||||
|
||||
await storage.close();
|
||||
|
||||
const db = await IndexedDBStorageDatabase.create(id, logService);
|
||||
storage = new Storage(db);
|
||||
|
||||
await storage.init();
|
||||
await db.clear();
|
||||
|
||||
storage = new Storage(await IndexedDBStorageDatabase.create(id, logService));
|
||||
|
||||
await storage.init();
|
||||
|
||||
strictEqual(storage.get('bar'), undefined);
|
||||
strictEqual(storage.get('barNumber'), undefined);
|
||||
strictEqual(storage.get('barBoolean'), undefined);
|
||||
|
||||
strictEqual(storage.size, 0);
|
||||
strictEqual(storage.items.size, 0);
|
||||
});
|
||||
|
||||
test('Inserts and Deletes at the same time', async () => {
|
||||
|
||||
@@ -81,7 +81,7 @@ export class IgnoredExtensionsManagementService implements IIgnoredExtensionsMan
|
||||
return distinct([...defaultIgnoredExtensions, ...added,].filter(setting => removed.indexOf(setting) === -1));
|
||||
}
|
||||
|
||||
private getConfiguredIgnoredExtensions(): string[] {
|
||||
private getConfiguredIgnoredExtensions(): ReadonlyArray<string> {
|
||||
let userValue = this.configurationService.inspect<string[]>('settingsSync.ignoredExtensions').userValue;
|
||||
if (userValue !== undefined) {
|
||||
return userValue;
|
||||
|
||||
@@ -21,7 +21,7 @@ export interface IMergeResult {
|
||||
}
|
||||
|
||||
export function getIgnoredSettings(defaultIgnoredSettings: string[], configurationService: IConfigurationService, settingsContent?: string): string[] {
|
||||
let value: string[] = [];
|
||||
let value: ReadonlyArray<string> = [];
|
||||
if (settingsContent) {
|
||||
value = getIgnoredSettingsFromContent(settingsContent);
|
||||
} else {
|
||||
@@ -40,7 +40,7 @@ export function getIgnoredSettings(defaultIgnoredSettings: string[], configurati
|
||||
return distinct([...defaultIgnoredSettings, ...added,].filter(setting => removed.indexOf(setting) === -1));
|
||||
}
|
||||
|
||||
function getIgnoredSettingsFromConfig(configurationService: IConfigurationService): string[] {
|
||||
function getIgnoredSettingsFromConfig(configurationService: IConfigurationService): ReadonlyArray<string> {
|
||||
let userValue = configurationService.inspect<string[]>('settingsSync.ignoredSettings').userValue;
|
||||
if (userValue !== undefined) {
|
||||
return userValue;
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ flakySuite('WorkspacesManagementMainService', () => {
|
||||
teardown(() => {
|
||||
service.dispose();
|
||||
|
||||
return pfs.rimraf(testDir);
|
||||
return pfs.Promises.rm(testDir);
|
||||
});
|
||||
|
||||
function assertPathEquals(p1: string, p2: string): void {
|
||||
|
||||
@@ -75,7 +75,11 @@ export function extractEditorsDropData(e: DragEvent, externalOnly?: boolean): Ar
|
||||
const rawResourcesData = e.dataTransfer.getData(DataTransfers.RESOURCES);
|
||||
if (rawResourcesData) {
|
||||
const resourcesRaw: string[] = JSON.parse(rawResourcesData);
|
||||
editors.push(...resourcesRaw.map(resourceRaw => ({ resource: URI.parse(resourceRaw) })));
|
||||
for (const resourceRaw of resourcesRaw) {
|
||||
if (resourceRaw.indexOf(':') > 0) { // mitigate https://github.com/microsoft/vscode/issues/124946
|
||||
editors.push({ resource: URI.parse(resourceRaw) });
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
// Invalid transfer
|
||||
|
||||
@@ -42,6 +42,7 @@ import { createAndFillInContextMenuActions, createAndFillInActionBarActions } fr
|
||||
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { Codicon } from 'vs/base/common/codicons';
|
||||
import { equals } from 'vs/base/common/arrays';
|
||||
|
||||
const $ = dom.$;
|
||||
|
||||
@@ -76,6 +77,7 @@ export class BreakpointsView extends ViewPane {
|
||||
private breakpointSupportsCondition: IContextKey<boolean>;
|
||||
private _inputBoxData: InputBoxData | undefined;
|
||||
breakpointInputFocused: IContextKey<boolean>;
|
||||
private autoFocusedIndex = -1;
|
||||
|
||||
constructor(
|
||||
options: IViewletViewOptions,
|
||||
@@ -257,6 +259,7 @@ export class BreakpointsView extends ViewPane {
|
||||
|
||||
private onStateChange(): void {
|
||||
const thread = this.debugService.getViewModel().focusedThread;
|
||||
let found = false;
|
||||
if (thread && thread.stoppedDetails && thread.stoppedDetails.hitBreakpointIds && thread.stoppedDetails.hitBreakpointIds.length > 0) {
|
||||
const hitBreakpointIds = thread.stoppedDetails.hitBreakpointIds;
|
||||
const elements = this.elements;
|
||||
@@ -267,8 +270,20 @@ export class BreakpointsView extends ViewPane {
|
||||
if (index >= 0) {
|
||||
this.list.setFocus([index]);
|
||||
this.list.setSelection([index]);
|
||||
found = true;
|
||||
this.autoFocusedIndex = index;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
// Deselect breakpoint in breakpoint view when no longer stopped on it #125528
|
||||
const focus = this.list.getFocus();
|
||||
const selection = this.list.getSelection();
|
||||
if (this.autoFocusedIndex >= 0 && equals(focus, selection) && focus.indexOf(this.autoFocusedIndex) >= 0) {
|
||||
this.list.setFocus([]);
|
||||
this.list.setSelection([]);
|
||||
}
|
||||
this.autoFocusedIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private get elements(): BreakpointItem[] {
|
||||
|
||||
@@ -182,7 +182,6 @@ export class ExtensionEditor extends EditorPane {
|
||||
private layoutParticipants: ILayoutParticipant[] = [];
|
||||
private readonly contentDisposables = this._register(new DisposableStore());
|
||||
private readonly transientDisposables = this._register(new DisposableStore());
|
||||
private readonly keybindingLabelStylers = this.contentDisposables.add(new DisposableStore());
|
||||
private activeElement: IActiveElement | null = null;
|
||||
private editorLoadComplete: boolean = false;
|
||||
|
||||
@@ -1278,12 +1277,11 @@ export class ExtensionEditor extends EditorPane {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.keybindingLabelStylers.clear();
|
||||
const renderKeybinding = (keybinding: ResolvedKeybinding): HTMLElement => {
|
||||
const element = $('');
|
||||
const kbl = new KeybindingLabel(element, OS);
|
||||
kbl.set(keybinding);
|
||||
this.keybindingLabelStylers.add(attachKeybindingLabelStyler(kbl, this.themeService));
|
||||
this.contentDisposables.add(attachKeybindingLabelStyler(kbl, this.themeService));
|
||||
return element;
|
||||
};
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ export class RemoteTerminalService extends Disposable implements IRemoteTerminal
|
||||
}));
|
||||
}
|
||||
this._register(channel.onPtyHostRequestResolveVariables(async e => {
|
||||
const activeWorkspaceRootUri = historyService.getLastActiveWorkspaceRoot(Schemas.file);
|
||||
const activeWorkspaceRootUri = historyService.getLastActiveWorkspaceRoot(Schemas.vscodeRemote);
|
||||
const lastActiveWorkspaceRoot = activeWorkspaceRootUri ? withNullAsUndefined(workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri)) : undefined;
|
||||
const resolveCalls: Promise<string>[] = e.originalText.map(t => {
|
||||
return configurationResolverService.resolveAsync(lastActiveWorkspaceRoot, t);
|
||||
|
||||
@@ -77,7 +77,7 @@ export const terminalSendSequenceCommand = (accessor: ServicesAccessor, args: {
|
||||
const configurationResolverService = accessor.get(IConfigurationResolverService);
|
||||
const workspaceContextService = accessor.get(IWorkspaceContextService);
|
||||
const historyService = accessor.get(IHistoryService);
|
||||
const activeWorkspaceRootUri = historyService.getLastActiveWorkspaceRoot(Schemas.file);
|
||||
const activeWorkspaceRootUri = historyService.getLastActiveWorkspaceRoot(t.isRemote ? Schemas.vscodeRemote : Schemas.file);
|
||||
const lastActiveWorkspaceRoot = activeWorkspaceRootUri ? withNullAsUndefined(workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri)) : undefined;
|
||||
const resolvedText = await configurationResolverService.resolveAsync(lastActiveWorkspaceRoot, args.text);
|
||||
t.sendText(resolvedText, false);
|
||||
|
||||
@@ -281,6 +281,12 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
||||
this._terminalProfileResolverService.resolveIcon(this._shellLaunchConfig, OS);
|
||||
}
|
||||
|
||||
// When a custom pty is used set the name immediately so it gets passed over to the exthost
|
||||
// and is available when Pseudoterminal.open fires.
|
||||
if (this.shellLaunchConfig.customPtyImplementation) {
|
||||
this.setTitle(this._shellLaunchConfig.name, TitleEventSource.Api);
|
||||
}
|
||||
|
||||
this._initDimensions();
|
||||
this._createProcessManager();
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@ export abstract class BaseTerminalProfileResolverService implements ITerminalPro
|
||||
|
||||
// Resolve path variables
|
||||
const env = await this._context.getEnvironment(options.remoteAuthority);
|
||||
const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot(Schemas.file);
|
||||
const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot(options.remoteAuthority ? Schemas.vscodeRemote : Schemas.file);
|
||||
const lastActiveWorkspace = activeWorkspaceRootUri ? withNullAsUndefined(this._workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri)) : undefined;
|
||||
profile.path = this._resolveVariables(profile.path, env, lastActiveWorkspace);
|
||||
|
||||
|
||||
@@ -450,8 +450,12 @@ export class SimpleFileDialog {
|
||||
|
||||
private constructFullUserPath(): string {
|
||||
const currentFolderPath = this.pathFromUri(this.currentFolder);
|
||||
if (equalsIgnoreCase(this.filePickBox.value.substr(0, this.userEnteredPathSegment.length), this.userEnteredPathSegment) && equalsIgnoreCase(this.filePickBox.value.substr(0, currentFolderPath.length), currentFolderPath)) {
|
||||
return currentFolderPath;
|
||||
if (equalsIgnoreCase(this.filePickBox.value.substr(0, this.userEnteredPathSegment.length), this.userEnteredPathSegment)) {
|
||||
if (equalsIgnoreCase(this.filePickBox.value.substr(0, currentFolderPath.length), currentFolderPath)) {
|
||||
return currentFolderPath;
|
||||
} else {
|
||||
return this.userEnteredPathSegment;
|
||||
}
|
||||
} else {
|
||||
return this.pathAppend(this.currentFolder, this.userEnteredPathSegment);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ export class CachedExtensionScanner {
|
||||
}
|
||||
|
||||
try {
|
||||
await pfs.rimraf(cacheFile, pfs.RimRafMode.MOVE);
|
||||
await pfs.Promises.rm(cacheFile, pfs.RimRafMode.MOVE);
|
||||
} catch (err) {
|
||||
errors.onUnexpectedError(err);
|
||||
console.error(err);
|
||||
|
||||
@@ -505,7 +505,7 @@ class DefaultExtensionResolver implements IExtensionResolver {
|
||||
constructor(private root: string) { }
|
||||
|
||||
resolveExtensions(): Promise<IExtensionReference[]> {
|
||||
return pfs.readDirsInDir(this.root)
|
||||
return pfs.Promises.readDirsInDir(this.root)
|
||||
.then(folders => folders.map(name => ({ name, path: path.join(this.root, name) })));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { release, tmpdir, hostname } from 'os';
|
||||
import { resolveWorkbenchCommonProperties } from 'vs/workbench/services/telemetry/electron-sandbox/workbenchCommonProperties';
|
||||
import { getRandomTestPath } from 'vs/base/test/node/testUtils';
|
||||
import { IStorageService, StorageScope, InMemoryStorageService, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||
import { Promises, rimraf } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { FileService } from 'vs/platform/files/common/fileService';
|
||||
@@ -40,7 +40,7 @@ suite('Telemetry - common properties', function () {
|
||||
teardown(() => {
|
||||
diskFileSystemProvider.dispose();
|
||||
|
||||
return rimraf(parentDir);
|
||||
return Promises.rm(parentDir);
|
||||
});
|
||||
|
||||
test('default', async function () {
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { TextFileEditorModelManager } from 'vs/workbench/services/textfile/common/textFileEditorModelManager';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { rimraf, copy, Promises } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { FileService } from 'vs/platform/files/common/fileService';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
@@ -55,7 +55,7 @@ flakySuite('Files - NativeTextFileService i/o', function () {
|
||||
testDir = getRandomTestPath(tmpdir(), 'vsctests', 'textfileservice');
|
||||
const sourceDir = getPathFromAmdModule(require, './fixtures');
|
||||
|
||||
await copy(sourceDir, testDir, { preserveSymlinks: false });
|
||||
await Promises.copy(sourceDir, testDir, { preserveSymlinks: false });
|
||||
|
||||
return { service, testDir };
|
||||
},
|
||||
@@ -65,7 +65,7 @@ flakySuite('Files - NativeTextFileService i/o', function () {
|
||||
|
||||
disposables.clear();
|
||||
|
||||
return rimraf(testDir);
|
||||
return Promises.rm(testDir);
|
||||
},
|
||||
|
||||
exists: Promises.exists,
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ import { hash } from 'vs/base/common/hash';
|
||||
import { isEqual } from 'vs/base/common/resources';
|
||||
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
|
||||
import { dirname, join } from 'vs/base/common/path';
|
||||
import { Promises, readdirSync, rimraf } from 'vs/base/node/pfs';
|
||||
import { Promises, readdirSync } from 'vs/base/node/pfs';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { WorkingCopyBackupsModel, hashIdentifier } from 'vs/workbench/services/workingCopy/common/workingCopyBackupService';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
@@ -156,7 +156,7 @@ suite('WorkingCopyBackupService', () => {
|
||||
|
||||
teardown(() => {
|
||||
service.dispose();
|
||||
return rimraf(testDir);
|
||||
return Promises.rm(testDir);
|
||||
});
|
||||
|
||||
suite('hashIdentifier', () => {
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ import * as assert from 'assert';
|
||||
import { isMacintosh, isWindows } from 'vs/base/common/platform';
|
||||
import { tmpdir } from 'os';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { Promises, rimraf } from 'vs/base/node/pfs';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { flakySuite, getRandomTestPath } from 'vs/base/test/node/testUtils';
|
||||
import { hash } from 'vs/base/common/hash';
|
||||
@@ -113,7 +113,7 @@ flakySuite('WorkingCopyBackupTracker (native)', function () {
|
||||
teardown(async () => {
|
||||
disposables.clear();
|
||||
|
||||
return rimraf(testDir);
|
||||
return Promises.rm(testDir);
|
||||
});
|
||||
|
||||
async function createTracker(autoSaveEnabled = false): Promise<{ accessor: TestServiceAccessor, part: EditorPart, tracker: TestWorkingCopyBackupTracker, instantiationService: IInstantiationService, cleanup: () => Promise<void> }> {
|
||||
|
||||
@@ -101,7 +101,7 @@ function getDescription(color: ColorContribution) {
|
||||
|
||||
async function getColorsFromExtension(): Promise<{ [id: string]: string }> {
|
||||
let extPath = getPathFromAmdModule(require, '../../../../../extensions');
|
||||
let extFolders = await pfs.readDirsInDir(extPath);
|
||||
let extFolders = await pfs.Promises.readDirsInDir(extPath);
|
||||
let result: { [id: string]: string } = Object.create(null);
|
||||
for (let folder of extFolders) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user