mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
Merge remote-tracking branch 'origin/master' into joao/build-cleanup
This commit is contained in:
commit
c6688faf96
30
.vscode/searches/es6.code-search
vendored
30
.vscode/searches/es6.code-search
vendored
|
@ -5,21 +5,21 @@
|
|||
10 results - 2 files
|
||||
|
||||
src/vs/base/browser/dom.ts:
|
||||
83 };
|
||||
84
|
||||
85: /** @deprecated ES6 - use classList*/
|
||||
86 export function hasClass(node: HTMLElement | SVGElement, className: string): boolean { return _classList.hasClass(node, className); }
|
||||
87: /** @deprecated ES6 - use classList*/
|
||||
88 export function addClass(node: HTMLElement | SVGElement, className: string): void { return _classList.addClass(node, className); }
|
||||
89: /** @deprecated ES6 - use classList*/
|
||||
90 export function addClasses(node: HTMLElement | SVGElement, ...classNames: string[]): void { return _classList.addClasses(node, ...classNames); }
|
||||
91: /** @deprecated ES6 - use classList*/
|
||||
92 export function removeClass(node: HTMLElement | SVGElement, className: string): void { return _classList.removeClass(node, className); }
|
||||
93: /** @deprecated ES6 - use classList*/
|
||||
94 export function removeClasses(node: HTMLElement | SVGElement, ...classNames: string[]): void { return _classList.removeClasses(node, ...classNames); }
|
||||
95: /** @deprecated ES6 - use classList*/
|
||||
96 export function toggleClass(node: HTMLElement | SVGElement, className: string, shouldHaveIt?: boolean): void { return _classList.toggleClass(node, className, shouldHaveIt); }
|
||||
97
|
||||
74 };
|
||||
75
|
||||
76: /** @deprecated ES6 - use classList*/
|
||||
77 export function hasClass(node: HTMLElement | SVGElement, className: string): boolean { return _classList.hasClass(node, className); }
|
||||
78: /** @deprecated ES6 - use classList*/
|
||||
79 export function addClass(node: HTMLElement | SVGElement, className: string): void { return _classList.addClass(node, className); }
|
||||
80: /** @deprecated ES6 - use classList*/
|
||||
81 export function addClasses(node: HTMLElement | SVGElement, ...classNames: string[]): void { return _classList.addClasses(node, ...classNames); }
|
||||
82: /** @deprecated ES6 - use classList*/
|
||||
83 export function removeClass(node: HTMLElement | SVGElement, className: string): void { return _classList.removeClass(node, className); }
|
||||
84: /** @deprecated ES6 - use classList*/
|
||||
85 export function removeClasses(node: HTMLElement | SVGElement, ...classNames: string[]): void { return _classList.removeClasses(node, ...classNames); }
|
||||
86: /** @deprecated ES6 - use classList*/
|
||||
87 export function toggleClass(node: HTMLElement | SVGElement, className: string, shouldHaveIt?: boolean): void { return _classList.toggleClass(node, className, shouldHaveIt); }
|
||||
88
|
||||
|
||||
src/vs/base/common/strings.ts:
|
||||
15
|
||||
|
|
|
@ -456,7 +456,7 @@ suite('Notebook API tests', () => {
|
|||
});
|
||||
|
||||
test('edit API (replaceMetadata)', async function () {
|
||||
|
||||
this.skip();
|
||||
assertInitalState();
|
||||
const resource = await createRandomFile('', undefined, 'first', '.vsctestnb');
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
|
@ -475,7 +475,7 @@ suite('Notebook API tests', () => {
|
|||
});
|
||||
|
||||
test('edit API (replaceMetadata, event)', async function () {
|
||||
|
||||
this.skip();
|
||||
assertInitalState();
|
||||
const resource = await createRandomFile('', undefined, 'first', '.vsctestnb');
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
|
@ -624,6 +624,7 @@ suite('Notebook API tests', () => {
|
|||
});
|
||||
|
||||
test('edit API batch edits', async function () {
|
||||
this.skip();
|
||||
assertInitalState();
|
||||
const resource = await createRandomFile('', undefined, 'first', '.vsctestnb');
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
|
@ -643,6 +644,7 @@ suite('Notebook API tests', () => {
|
|||
});
|
||||
|
||||
test('edit API batch edits undo/redo', async function () {
|
||||
this.skip();
|
||||
assertInitalState();
|
||||
const resource = await createRandomFile('', undefined, 'first', '.vsctestnb');
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
|
|
|
@ -695,13 +695,13 @@ export function isAncestor(testChild: Node | null, testAncestor: Node | null): b
|
|||
|
||||
export function findParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null {
|
||||
while (node && node.nodeType === node.ELEMENT_NODE) {
|
||||
if (hasClass(node, clazz)) {
|
||||
if (node.classList.contains(clazz)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
if (stopAtClazzOrNode) {
|
||||
if (typeof stopAtClazzOrNode === 'string') {
|
||||
if (hasClass(node, stopAtClazzOrNode)) {
|
||||
if (node.classList.contains(stopAtClazzOrNode)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -336,7 +336,7 @@ export class BreadcrumbsWidget {
|
|||
item.render(container);
|
||||
container.tabIndex = -1;
|
||||
container.setAttribute('role', 'listitem');
|
||||
dom.addClasses(container, 'monaco-breadcrumb-item');
|
||||
container.classList.add('monaco-breadcrumb-item');
|
||||
const iconContainer = dom.$(breadcrumbSeparatorIcon.cssSelector);
|
||||
container.appendChild(iconContainer);
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ class Label {
|
|||
if (typeof label === 'string') {
|
||||
if (!this.singleLabel) {
|
||||
this.container.innerText = '';
|
||||
dom.removeClass(this.container, 'multiple');
|
||||
this.container.classList.remove('multiple');
|
||||
this.singleLabel = dom.append(this.container, dom.$('a.label-name', { id: options?.domId }));
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ class LabelWithHighlights {
|
|||
if (typeof label === 'string') {
|
||||
if (!this.singleLabel) {
|
||||
this.container.innerText = '';
|
||||
dom.removeClass(this.container, 'multiple');
|
||||
this.container.classList.remove('multiple');
|
||||
this.singleLabel = new HighlightedLabel(dom.append(this.container, dom.$('a.label-name', { id: options?.domId })), this.supportCodicons);
|
||||
}
|
||||
|
||||
|
|
|
@ -191,42 +191,42 @@ export function isEqual(pathA: string, pathB: string, ignoreCase?: boolean): boo
|
|||
return equalsIgnoreCase(pathA, pathB);
|
||||
}
|
||||
|
||||
export function isEqualOrParent(path: string, candidate: string, ignoreCase?: boolean, separator = sep): boolean {
|
||||
if (path === candidate) {
|
||||
export function isEqualOrParent(base: string, parentCandidate: string, ignoreCase?: boolean, separator = sep): boolean {
|
||||
if (base === parentCandidate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!path || !candidate) {
|
||||
if (!base || !parentCandidate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (candidate.length > path.length) {
|
||||
if (parentCandidate.length > base.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ignoreCase) {
|
||||
const beginsWith = startsWithIgnoreCase(path, candidate);
|
||||
const beginsWith = startsWithIgnoreCase(base, parentCandidate);
|
||||
if (!beginsWith) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (candidate.length === path.length) {
|
||||
if (parentCandidate.length === base.length) {
|
||||
return true; // same path, different casing
|
||||
}
|
||||
|
||||
let sepOffset = candidate.length;
|
||||
if (candidate.charAt(candidate.length - 1) === separator) {
|
||||
let sepOffset = parentCandidate.length;
|
||||
if (parentCandidate.charAt(parentCandidate.length - 1) === separator) {
|
||||
sepOffset--; // adjust the expected sep offset in case our candidate already ends in separator character
|
||||
}
|
||||
|
||||
return path.charAt(sepOffset) === separator;
|
||||
return base.charAt(sepOffset) === separator;
|
||||
}
|
||||
|
||||
if (candidate.charAt(candidate.length - 1) !== separator) {
|
||||
candidate += separator;
|
||||
if (parentCandidate.charAt(parentCandidate.length - 1) !== separator) {
|
||||
parentCandidate += separator;
|
||||
}
|
||||
|
||||
return path.indexOf(candidate) === 0;
|
||||
return base.indexOf(parentCandidate) === 0;
|
||||
}
|
||||
|
||||
export function isWindowsDriveLetter(char0: number): boolean {
|
||||
|
|
|
@ -9,7 +9,7 @@ import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
|
|||
import { NativeHostService } from 'vs/platform/native/electron-sandbox/nativeHostService';
|
||||
import { ipcRenderer, process } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { applyZoom, zoomIn, zoomOut } from 'vs/platform/windows/electron-sandbox/window';
|
||||
import { $, reset, windowOpenNoOpener, addClass } from 'vs/base/browser/dom';
|
||||
import { $, reset, windowOpenNoOpener } from 'vs/base/browser/dom';
|
||||
import { Button } from 'vs/base/browser/ui/button/button';
|
||||
import { CodiconLabel } from 'vs/base/browser/ui/codicons/codiconLabel';
|
||||
import * as collections from 'vs/base/common/collections';
|
||||
|
@ -56,7 +56,7 @@ export interface IssueReporterConfiguration extends IWindowConfiguration {
|
|||
|
||||
export function startup(configuration: IssueReporterConfiguration) {
|
||||
const platformClass = platform.isWindows ? 'windows' : platform.isLinux ? 'linux' : 'mac';
|
||||
addClass(document.body, platformClass); // used by our fonts
|
||||
document.body.classList.add(platformClass); // used by our fonts
|
||||
|
||||
document.body.innerHTML = BaseHtml();
|
||||
const issueReporter = new IssueReporter(configuration);
|
||||
|
|
|
@ -14,7 +14,7 @@ import { applyZoom, zoomIn, zoomOut } from 'vs/platform/windows/electron-sandbox
|
|||
import { IContextMenuItem } from 'vs/base/parts/contextmenu/common/contextmenu';
|
||||
import { popup } from 'vs/base/parts/contextmenu/electron-sandbox/contextmenu';
|
||||
import { ProcessItem } from 'vs/base/common/processes';
|
||||
import { addDisposableListener, addClass, $ } from 'vs/base/browser/dom';
|
||||
import { addDisposableListener, $ } from 'vs/base/browser/dom';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { isRemoteDiagnosticError, IRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics';
|
||||
import { MainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService';
|
||||
|
@ -417,7 +417,7 @@ class ProcessExplorer {
|
|||
|
||||
export function startup(windowId: number, data: ProcessExplorerData): void {
|
||||
const platformClass = data.platform === 'win32' ? 'windows' : data.platform === 'linux' ? 'linux' : 'mac';
|
||||
addClass(document.body, platformClass); // used by our fonts
|
||||
document.body.classList.add(platformClass); // used by our fonts
|
||||
applyZoom(data.zoomLevel);
|
||||
|
||||
const processExplorer = new ProcessExplorer(windowId, data);
|
||||
|
|
|
@ -55,14 +55,6 @@ const autoCloseAlways = () => true;
|
|||
const autoCloseNever = () => false;
|
||||
const autoCloseBeforeWhitespace = (chr: string) => (chr === ' ' || chr === '\t');
|
||||
|
||||
function appendEntry<K, V>(target: Map<K, V[]>, key: K, value: V): void {
|
||||
if (target.has(key)) {
|
||||
target.get(key)!.push(value);
|
||||
} else {
|
||||
target.set(key, [value]);
|
||||
}
|
||||
}
|
||||
|
||||
export class CursorConfiguration {
|
||||
_cursorMoveConfigurationBrand: void;
|
||||
|
||||
|
@ -136,8 +128,6 @@ export class CursorConfiguration {
|
|||
this.autoSurround = options.get(EditorOption.autoSurround);
|
||||
this.autoIndent = options.get(EditorOption.autoIndent);
|
||||
|
||||
this.autoClosingPairsOpen2 = new Map<string, StandardAutoClosingPairConditional[]>();
|
||||
this.autoClosingPairsClose2 = new Map<string, StandardAutoClosingPairConditional[]>();
|
||||
this.surroundingPairs = {};
|
||||
this._electricChars = null;
|
||||
|
||||
|
@ -146,15 +136,9 @@ export class CursorConfiguration {
|
|||
bracket: CursorConfiguration._getShouldAutoClose(languageIdentifier, this.autoClosingBrackets)
|
||||
};
|
||||
|
||||
let autoClosingPairs = CursorConfiguration._getAutoClosingPairs(languageIdentifier);
|
||||
if (autoClosingPairs) {
|
||||
for (const pair of autoClosingPairs) {
|
||||
appendEntry(this.autoClosingPairsOpen2, pair.open.charAt(pair.open.length - 1), pair);
|
||||
if (pair.close.length === 1) {
|
||||
appendEntry(this.autoClosingPairsClose2, pair.close, pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
const autoClosingPairs = LanguageConfigurationRegistry.getAutoClosingPairs(languageIdentifier.id);
|
||||
this.autoClosingPairsOpen2 = autoClosingPairs.autoClosingPairsOpen;
|
||||
this.autoClosingPairsClose2 = autoClosingPairs.autoClosingPairsClose;
|
||||
|
||||
let surroundingPairs = CursorConfiguration._getSurroundingPairs(languageIdentifier);
|
||||
if (surroundingPairs) {
|
||||
|
@ -190,15 +174,6 @@ export class CursorConfiguration {
|
|||
}
|
||||
}
|
||||
|
||||
private static _getAutoClosingPairs(languageIdentifier: LanguageIdentifier): StandardAutoClosingPairConditional[] | null {
|
||||
try {
|
||||
return LanguageConfigurationRegistry.getAutoClosingPairs(languageIdentifier.id);
|
||||
} catch (e) {
|
||||
onUnexpectedError(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static _getShouldAutoClose(languageIdentifier: LanguageIdentifier, autoCloseConfig: EditorAutoClosingStrategy): (ch: string) => boolean {
|
||||
switch (autoCloseConfig) {
|
||||
case 'beforeWhitespace':
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { ReplaceCommand } from 'vs/editor/common/commands/replaceCommand';
|
||||
import { EditorAutoClosingStrategy } from 'vs/editor/common/config/editorOptions';
|
||||
import { CursorColumns, CursorConfiguration, EditOperationResult, EditOperationType, ICursorSimpleModel, isQuote } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { MoveOperations } from 'vs/editor/common/controller/cursorMoveOperations';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { ICommand } from 'vs/editor/common/editorCommon';
|
||||
import { StandardAutoClosingPairConditional } from 'vs/editor/common/modes/languageConfiguration';
|
||||
|
||||
export class DeleteOperations {
|
||||
|
||||
|
@ -47,8 +49,14 @@ export class DeleteOperations {
|
|||
return [shouldPushStackElementBefore, commands];
|
||||
}
|
||||
|
||||
private static _isAutoClosingPairDelete(config: CursorConfiguration, model: ICursorSimpleModel, selections: Selection[]): boolean {
|
||||
if (config.autoClosingBrackets === 'never' && config.autoClosingQuotes === 'never') {
|
||||
public static isAutoClosingPairDelete(
|
||||
autoClosingBrackets: EditorAutoClosingStrategy,
|
||||
autoClosingQuotes: EditorAutoClosingStrategy,
|
||||
autoClosingPairsOpen: Map<string, StandardAutoClosingPairConditional[]>,
|
||||
model: ICursorSimpleModel,
|
||||
selections: Selection[]
|
||||
): boolean {
|
||||
if (autoClosingBrackets === 'never' && autoClosingQuotes === 'never') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -61,24 +69,27 @@ export class DeleteOperations {
|
|||
}
|
||||
|
||||
const lineText = model.getLineContent(position.lineNumber);
|
||||
const character = lineText[position.column - 2];
|
||||
if (position.column < 2 || position.column >= lineText.length + 1) {
|
||||
return false;
|
||||
}
|
||||
const character = lineText.charAt(position.column - 2);
|
||||
|
||||
const autoClosingPairCandidates = config.autoClosingPairsOpen2.get(character);
|
||||
const autoClosingPairCandidates = autoClosingPairsOpen.get(character);
|
||||
if (!autoClosingPairCandidates) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isQuote(character)) {
|
||||
if (config.autoClosingQuotes === 'never') {
|
||||
if (autoClosingQuotes === 'never') {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (config.autoClosingBrackets === 'never') {
|
||||
if (autoClosingBrackets === 'never') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const afterCharacter = lineText[position.column - 1];
|
||||
const afterCharacter = lineText.charAt(position.column - 1);
|
||||
|
||||
let foundAutoClosingPair = false;
|
||||
for (const autoClosingPairCandidate of autoClosingPairCandidates) {
|
||||
|
@ -111,7 +122,7 @@ export class DeleteOperations {
|
|||
|
||||
public static deleteLeft(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ICursorSimpleModel, selections: Selection[]): [boolean, Array<ICommand | null>] {
|
||||
|
||||
if (this._isAutoClosingPairDelete(config, model, selections)) {
|
||||
if (this.isAutoClosingPairDelete(config.autoClosingBrackets, config.autoClosingQuotes, config.autoClosingPairsOpen2, model, selections)) {
|
||||
return this._runAutoClosingPairDelete(config, model, selections);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,12 +5,15 @@
|
|||
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { EditorAutoClosingStrategy } from 'vs/editor/common/config/editorOptions';
|
||||
import { CursorConfiguration, ICursorSimpleModel, SingleCursorState } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { DeleteOperations } from 'vs/editor/common/controller/cursorDeleteOperations';
|
||||
import { WordCharacterClass, WordCharacterClassifier, getMapForWordSeparators } from 'vs/editor/common/controller/wordCharacterClassifier';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { ITextModel, IWordAtPosition } from 'vs/editor/common/model';
|
||||
import { AutoClosingPairs } from 'vs/editor/common/modes/languageConfiguration';
|
||||
|
||||
interface IFindWordResult {
|
||||
/**
|
||||
|
@ -44,6 +47,16 @@ export const enum WordNavigationType {
|
|||
WordAccessibility = 3 // Respect chrome defintion of a word
|
||||
}
|
||||
|
||||
export interface DeleteWordContext {
|
||||
wordSeparators: WordCharacterClassifier;
|
||||
model: ITextModel;
|
||||
selection: Selection;
|
||||
whitespaceHeuristics: boolean;
|
||||
autoClosingBrackets: EditorAutoClosingStrategy;
|
||||
autoClosingQuotes: EditorAutoClosingStrategy;
|
||||
autoClosingPairs: AutoClosingPairs;
|
||||
}
|
||||
|
||||
export class WordOperations {
|
||||
|
||||
private static _createWord(lineContent: string, wordType: WordType, nextCharClass: WordCharacterClass, start: number, end: number): IFindWordResult {
|
||||
|
@ -361,11 +374,21 @@ export class WordOperations {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static deleteWordLeft(wordSeparators: WordCharacterClassifier, model: ICursorSimpleModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range | null {
|
||||
public static deleteWordLeft(ctx: DeleteWordContext, wordNavigationType: WordNavigationType): Range | null {
|
||||
const wordSeparators = ctx.wordSeparators;
|
||||
const model = ctx.model;
|
||||
const selection = ctx.selection;
|
||||
const whitespaceHeuristics = ctx.whitespaceHeuristics;
|
||||
|
||||
if (!selection.isEmpty()) {
|
||||
return selection;
|
||||
}
|
||||
|
||||
if (DeleteOperations.isAutoClosingPairDelete(ctx.autoClosingBrackets, ctx.autoClosingQuotes, ctx.autoClosingPairs.autoClosingPairsOpen, ctx.model, [ctx.selection])) {
|
||||
const position = ctx.selection.getPosition();
|
||||
return new Range(position.lineNumber, position.column - 1, position.lineNumber, position.column + 1);
|
||||
}
|
||||
|
||||
const position = new Position(selection.positionLineNumber, selection.positionColumn);
|
||||
|
||||
let lineNumber = position.lineNumber;
|
||||
|
@ -447,7 +470,12 @@ export class WordOperations {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static deleteWordRight(wordSeparators: WordCharacterClassifier, model: ICursorSimpleModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range | null {
|
||||
public static deleteWordRight(ctx: DeleteWordContext, wordNavigationType: WordNavigationType): Range | null {
|
||||
const wordSeparators = ctx.wordSeparators;
|
||||
const model = ctx.model;
|
||||
const selection = ctx.selection;
|
||||
const whitespaceHeuristics = ctx.whitespaceHeuristics;
|
||||
|
||||
if (!selection.isEmpty()) {
|
||||
return selection;
|
||||
}
|
||||
|
@ -621,21 +649,21 @@ export class WordOperations {
|
|||
}
|
||||
|
||||
export class WordPartOperations extends WordOperations {
|
||||
public static deleteWordPartLeft(wordSeparators: WordCharacterClassifier, model: ICursorSimpleModel, selection: Selection, whitespaceHeuristics: boolean): Range {
|
||||
public static deleteWordPartLeft(ctx: DeleteWordContext): Range {
|
||||
const candidates = enforceDefined([
|
||||
WordOperations.deleteWordLeft(wordSeparators, model, selection, whitespaceHeuristics, WordNavigationType.WordStart),
|
||||
WordOperations.deleteWordLeft(wordSeparators, model, selection, whitespaceHeuristics, WordNavigationType.WordEnd),
|
||||
WordOperations._deleteWordPartLeft(model, selection)
|
||||
WordOperations.deleteWordLeft(ctx, WordNavigationType.WordStart),
|
||||
WordOperations.deleteWordLeft(ctx, WordNavigationType.WordEnd),
|
||||
WordOperations._deleteWordPartLeft(ctx.model, ctx.selection)
|
||||
]);
|
||||
candidates.sort(Range.compareRangesUsingEnds);
|
||||
return candidates[2];
|
||||
}
|
||||
|
||||
public static deleteWordPartRight(wordSeparators: WordCharacterClassifier, model: ICursorSimpleModel, selection: Selection, whitespaceHeuristics: boolean): Range {
|
||||
public static deleteWordPartRight(ctx: DeleteWordContext): Range {
|
||||
const candidates = enforceDefined([
|
||||
WordOperations.deleteWordRight(wordSeparators, model, selection, whitespaceHeuristics, WordNavigationType.WordStart),
|
||||
WordOperations.deleteWordRight(wordSeparators, model, selection, whitespaceHeuristics, WordNavigationType.WordEnd),
|
||||
WordOperations._deleteWordPartRight(model, selection)
|
||||
WordOperations.deleteWordRight(ctx, WordNavigationType.WordStart),
|
||||
WordOperations.deleteWordRight(ctx, WordNavigationType.WordEnd),
|
||||
WordOperations._deleteWordPartRight(ctx.model, ctx.selection)
|
||||
]);
|
||||
candidates.sort(Range.compareRangesUsingStarts);
|
||||
return candidates[0];
|
||||
|
|
|
@ -358,7 +358,7 @@ export const completionKindToCssClass = (function () {
|
|||
data[CompletionItemKind.User] = 'account';
|
||||
data[CompletionItemKind.Issue] = 'issues';
|
||||
|
||||
return function (kind: CompletionItemKind) {
|
||||
return function (kind: CompletionItemKind): string {
|
||||
const name = data[kind];
|
||||
let codicon = name && iconRegistry.get(name);
|
||||
if (!codicon) {
|
||||
|
|
|
@ -289,3 +289,31 @@ export class StandardAutoClosingPairConditional {
|
|||
return (this._standardTokenMask & <number>standardToken) === 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export class AutoClosingPairs {
|
||||
|
||||
public readonly autoClosingPairsOpen: Map<string, StandardAutoClosingPairConditional[]>;
|
||||
public readonly autoClosingPairsClose: Map<string, StandardAutoClosingPairConditional[]>;
|
||||
|
||||
constructor(autoClosingPairs: StandardAutoClosingPairConditional[]) {
|
||||
this.autoClosingPairsOpen = new Map<string, StandardAutoClosingPairConditional[]>();
|
||||
this.autoClosingPairsClose = new Map<string, StandardAutoClosingPairConditional[]>();
|
||||
for (const pair of autoClosingPairs) {
|
||||
appendEntry(this.autoClosingPairsOpen, pair.open.charAt(pair.open.length - 1), pair);
|
||||
if (pair.close.length === 1) {
|
||||
appendEntry(this.autoClosingPairsClose, pair.close, pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function appendEntry<K, V>(target: Map<K, V[]>, key: K, value: V): void {
|
||||
if (target.has(key)) {
|
||||
target.get(key)!.push(value);
|
||||
} else {
|
||||
target.set(key, [value]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import { Range } from 'vs/editor/common/core/range';
|
|||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { DEFAULT_WORD_REGEXP, ensureValidWordDefinition } from 'vs/editor/common/model/wordHelper';
|
||||
import { LanguageId, LanguageIdentifier } from 'vs/editor/common/modes';
|
||||
import { EnterAction, FoldingRules, IAutoClosingPair, IndentAction, IndentationRule, LanguageConfiguration, StandardAutoClosingPairConditional, CompleteEnterAction } from 'vs/editor/common/modes/languageConfiguration';
|
||||
import { EnterAction, FoldingRules, IAutoClosingPair, IndentAction, IndentationRule, LanguageConfiguration, StandardAutoClosingPairConditional, CompleteEnterAction, AutoClosingPairs } from 'vs/editor/common/modes/languageConfiguration';
|
||||
import { createScopedLineTokens, ScopedLineTokens } from 'vs/editor/common/modes/supports';
|
||||
import { CharacterPairSupport } from 'vs/editor/common/modes/supports/characterPair';
|
||||
import { BracketElectricCharacterSupport, IElectricAction } from 'vs/editor/common/modes/supports/electricCharacter';
|
||||
|
@ -235,12 +235,9 @@ export class LanguageConfigurationRegistryImpl {
|
|||
return value.characterPair || null;
|
||||
}
|
||||
|
||||
public getAutoClosingPairs(languageId: LanguageId): StandardAutoClosingPairConditional[] {
|
||||
let characterPairSupport = this._getCharacterPairSupport(languageId);
|
||||
if (!characterPairSupport) {
|
||||
return [];
|
||||
}
|
||||
return characterPairSupport.getAutoClosingPairs();
|
||||
public getAutoClosingPairs(languageId: LanguageId): AutoClosingPairs {
|
||||
const characterPairSupport = this._getCharacterPairSupport(languageId);
|
||||
return new AutoClosingPairs(characterPairSupport ? characterPairSupport.getAutoClosingPairs() : []);
|
||||
}
|
||||
|
||||
public getAutoCloseBeforeSet(languageId: LanguageId): string {
|
||||
|
|
|
@ -149,7 +149,7 @@ export class OutlineElementRenderer implements ITreeRenderer<OutlineElement, Fuz
|
|||
if (this._configurationService.getValue(OutlineConfigKeys.icons)) {
|
||||
// add styles for the icons
|
||||
template.iconClass.className = '';
|
||||
dom.addClasses(template.iconClass, `outline-element-icon ${SymbolKinds.toCssClassName(element.symbol.kind, true)}`);
|
||||
template.iconClass.classList.add(`outline-element-icon`, ...SymbolKinds.toCssClassName(element.symbol.kind, true).split(' '));
|
||||
}
|
||||
if (element.symbol.tags.indexOf(SymbolTag.Deprecated) >= 0) {
|
||||
options.extraClasses.push(`deprecated`);
|
||||
|
|
|
@ -13,7 +13,7 @@ import * as strings from 'vs/base/common/strings';
|
|||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { IDisposable, dispose, toDisposable, DisposableStore, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { append, $, hide, show, getDomNodePagePosition, addDisposableListener, addStandardDisposableListener, addClasses } from 'vs/base/browser/dom';
|
||||
import { append, $, hide, show, getDomNodePagePosition, addDisposableListener, addStandardDisposableListener } from 'vs/base/browser/dom';
|
||||
import { IListVirtualDelegate, IListEvent, IListRenderer, IListMouseEvent, IListGestureEvent } from 'vs/base/browser/ui/list/list';
|
||||
import { List } from 'vs/base/browser/ui/list/listWidget';
|
||||
import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
|
||||
|
@ -233,7 +233,7 @@ class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTemplateD
|
|||
// normal icon
|
||||
data.icon.className = 'icon hide';
|
||||
data.iconContainer.className = '';
|
||||
addClasses(data.iconContainer, `suggest-icon ${completionKindToCssClass(suggestion.kind)}`);
|
||||
data.iconContainer.classList.add('suggest-icon', ...completionKindToCssClass(suggestion.kind).split(' '));
|
||||
}
|
||||
|
||||
if (suggestion.tags && suggestion.tags.indexOf(CompletionItemTag.Deprecated) >= 0) {
|
||||
|
|
|
@ -13,6 +13,10 @@ import { CursorWordEndLeft, CursorWordEndLeftSelect, CursorWordEndRight, CursorW
|
|||
import { withTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
|
||||
import { CoreEditingCommands } from 'vs/editor/browser/controller/coreCommands';
|
||||
import { ViewModel } from 'vs/editor/common/viewModel/viewModelImpl';
|
||||
import { LanguageIdentifier } from 'vs/editor/common/modes';
|
||||
import { MockMode } from 'vs/editor/test/common/mocks/mockMode';
|
||||
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
||||
|
||||
suite('WordOperations', () => {
|
||||
|
||||
|
@ -721,4 +725,29 @@ suite('WordOperations', () => {
|
|||
deleteWordLeft(editor); assert.equal(model.getLineContent(1), 'A line with text. And another one', '001');
|
||||
});
|
||||
});
|
||||
|
||||
test('deleteWordLeft - issue #91855: Matching (quote, bracket, paren) doesn\'t get deleted when hitting Ctrl+Backspace', () => {
|
||||
const languageId = new LanguageIdentifier('myTestMode', 5);
|
||||
class TestMode extends MockMode {
|
||||
constructor() {
|
||||
super(languageId);
|
||||
this._register(LanguageConfigurationRegistry.register(this.getLanguageIdentifier(), {
|
||||
autoClosingPairs: [
|
||||
{ open: '\"', close: '\"' }
|
||||
]
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
const mode = new TestMode();
|
||||
const model = createTextModel('a ""', undefined, languageId);
|
||||
|
||||
withTestCodeEditor(null, { model }, (editor, _) => {
|
||||
editor.setPosition(new Position(1, 4));
|
||||
deleteWordLeft(editor); assert.equal(model.getLineContent(1), 'a ');
|
||||
});
|
||||
|
||||
model.dispose();
|
||||
mode.dispose();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ import { EditorCommand, ICommandOptions, ServicesAccessor, registerEditorCommand
|
|||
import { ReplaceCommand } from 'vs/editor/common/commands/replaceCommand';
|
||||
import { CursorState } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents';
|
||||
import { WordNavigationType, WordOperations } from 'vs/editor/common/controller/cursorWordOperations';
|
||||
import { DeleteWordContext, WordNavigationType, WordOperations } from 'vs/editor/common/controller/cursorWordOperations';
|
||||
import { WordCharacterClassifier, getMapForWordSeparators } from 'vs/editor/common/controller/wordCharacterClassifier';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
|
@ -21,6 +21,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
|
|||
import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vs/platform/accessibility/common/accessibility';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { EditorOption, EditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
|
||||
export interface MoveWordOptions extends ICommandOptions {
|
||||
inSelectionMode: boolean;
|
||||
|
@ -354,9 +355,20 @@ export abstract class DeleteWordCommand extends EditorCommand {
|
|||
const wordSeparators = getMapForWordSeparators(editor.getOption(EditorOption.wordSeparators));
|
||||
const model = editor.getModel();
|
||||
const selections = editor.getSelections();
|
||||
const autoClosingBrackets = editor.getOption(EditorOption.autoClosingBrackets);
|
||||
const autoClosingQuotes = editor.getOption(EditorOption.autoClosingQuotes);
|
||||
const autoClosingPairs = LanguageConfigurationRegistry.getAutoClosingPairs(model.getLanguageIdentifier().id);
|
||||
|
||||
const commands = selections.map((sel) => {
|
||||
const deleteRange = this._delete(wordSeparators, model, sel, this._whitespaceHeuristics, this._wordNavigationType);
|
||||
const deleteRange = this._delete({
|
||||
wordSeparators,
|
||||
model,
|
||||
selection: sel,
|
||||
whitespaceHeuristics: this._whitespaceHeuristics,
|
||||
autoClosingBrackets,
|
||||
autoClosingQuotes,
|
||||
autoClosingPairs,
|
||||
}, this._wordNavigationType);
|
||||
return new ReplaceCommand(deleteRange, '');
|
||||
});
|
||||
|
||||
|
@ -365,12 +377,12 @@ export abstract class DeleteWordCommand extends EditorCommand {
|
|||
editor.pushUndoStop();
|
||||
}
|
||||
|
||||
protected abstract _delete(wordSeparators: WordCharacterClassifier, model: ITextModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range;
|
||||
protected abstract _delete(ctx: DeleteWordContext, wordNavigationType: WordNavigationType): Range;
|
||||
}
|
||||
|
||||
export class DeleteWordLeftCommand extends DeleteWordCommand {
|
||||
protected _delete(wordSeparators: WordCharacterClassifier, model: ITextModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range {
|
||||
let r = WordOperations.deleteWordLeft(wordSeparators, model, selection, whitespaceHeuristics, wordNavigationType);
|
||||
protected _delete(ctx: DeleteWordContext, wordNavigationType: WordNavigationType): Range {
|
||||
let r = WordOperations.deleteWordLeft(ctx, wordNavigationType);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
|
@ -379,13 +391,13 @@ export class DeleteWordLeftCommand extends DeleteWordCommand {
|
|||
}
|
||||
|
||||
export class DeleteWordRightCommand extends DeleteWordCommand {
|
||||
protected _delete(wordSeparators: WordCharacterClassifier, model: ITextModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range {
|
||||
let r = WordOperations.deleteWordRight(wordSeparators, model, selection, whitespaceHeuristics, wordNavigationType);
|
||||
protected _delete(ctx: DeleteWordContext, wordNavigationType: WordNavigationType): Range {
|
||||
let r = WordOperations.deleteWordRight(ctx, wordNavigationType);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
const lineCount = model.getLineCount();
|
||||
const maxColumn = model.getLineMaxColumn(lineCount);
|
||||
const lineCount = ctx.model.getLineCount();
|
||||
const maxColumn = ctx.model.getLineMaxColumn(lineCount);
|
||||
return new Range(lineCount, maxColumn, lineCount, maxColumn);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,11 +5,10 @@
|
|||
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { registerEditorCommand } from 'vs/editor/browser/editorExtensions';
|
||||
import { WordNavigationType, WordPartOperations } from 'vs/editor/common/controller/cursorWordOperations';
|
||||
import { DeleteWordContext, WordNavigationType, WordPartOperations } from 'vs/editor/common/controller/cursorWordOperations';
|
||||
import { WordCharacterClassifier } from 'vs/editor/common/controller/wordCharacterClassifier';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { DeleteWordCommand, MoveWordCommand } from 'vs/editor/contrib/wordOperations/wordOperations';
|
||||
|
@ -32,8 +31,8 @@ export class DeleteWordPartLeft extends DeleteWordCommand {
|
|||
});
|
||||
}
|
||||
|
||||
protected _delete(wordSeparators: WordCharacterClassifier, model: ITextModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range {
|
||||
let r = WordPartOperations.deleteWordPartLeft(wordSeparators, model, selection, whitespaceHeuristics);
|
||||
protected _delete(ctx: DeleteWordContext, wordNavigationType: WordNavigationType): Range {
|
||||
let r = WordPartOperations.deleteWordPartLeft(ctx);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
|
@ -57,13 +56,13 @@ export class DeleteWordPartRight extends DeleteWordCommand {
|
|||
});
|
||||
}
|
||||
|
||||
protected _delete(wordSeparators: WordCharacterClassifier, model: ITextModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range {
|
||||
let r = WordPartOperations.deleteWordPartRight(wordSeparators, model, selection, whitespaceHeuristics);
|
||||
protected _delete(ctx: DeleteWordContext, wordNavigationType: WordNavigationType): Range {
|
||||
let r = WordPartOperations.deleteWordPartRight(ctx);
|
||||
if (r) {
|
||||
return r;
|
||||
}
|
||||
const lineCount = model.getLineCount();
|
||||
const maxColumn = model.getLineMaxColumn(lineCount);
|
||||
const lineCount = ctx.model.getLineCount();
|
||||
const maxColumn = ctx.model.getLineMaxColumn(lineCount);
|
||||
return new Range(lineCount, maxColumn, lineCount, maxColumn);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -262,5 +262,7 @@ export interface IExtensionTipsService {
|
|||
|
||||
export const DefaultIconPath = require.toUrl('./media/defaultIcon.png');
|
||||
export const ExtensionsLabel = localize('extensions', "Extensions");
|
||||
export const ExtensionsLocalizedLabel = { value: ExtensionsLabel, original: 'Extensions' };
|
||||
export const ExtensionsChannelId = 'extensions';
|
||||
export const PreferencesLabel = localize('preferences', "Preferences");
|
||||
export const PreferencesLocalizedLabel = { value: PreferencesLabel, original: 'Preferences' };
|
||||
|
|
|
@ -138,7 +138,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
|
|||
logMessage: l.logMessage
|
||||
}
|
||||
);
|
||||
this.debugService.addBreakpoints(uri.revive(dto.uri), rawbps, 'extension');
|
||||
this.debugService.addBreakpoints(uri.revive(dto.uri), rawbps);
|
||||
} else if (dto.type === 'function') {
|
||||
this.debugService.addFunctionBreakpoint(dto.functionName, dto.id);
|
||||
} else if (dto.type === 'data') {
|
||||
|
|
|
@ -80,6 +80,12 @@ const apiMenus: IAPIMenu[] = [
|
|||
proposed: true,
|
||||
supportsSubmenus: false
|
||||
},
|
||||
{
|
||||
key: 'menuBar/file',
|
||||
id: MenuId.MenubarFileMenu,
|
||||
description: localize('menus.file', "The top level file menu"),
|
||||
proposed: true
|
||||
},
|
||||
{
|
||||
key: 'scm/title',
|
||||
id: MenuId.SCMTitle,
|
||||
|
|
|
@ -550,9 +550,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
|
|||
|
||||
if (input.value === '') {
|
||||
this._pendingComment = '';
|
||||
if (dom.hasClass(this._commentForm, 'expand')) {
|
||||
dom.removeClass(this._commentForm, 'expand');
|
||||
}
|
||||
this._commentForm.classList.remove('expand');
|
||||
this._commentEditor.getDomNode()!.style.outline = '';
|
||||
this._error.textContent = '';
|
||||
dom.addClass(this._error, 'hidden');
|
||||
|
@ -698,8 +696,8 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
|
|||
}
|
||||
|
||||
private expandReplyArea() {
|
||||
if (!dom.hasClass(this._commentForm, 'expand')) {
|
||||
dom.addClass(this._commentForm, 'expand');
|
||||
if (!this._commentForm.classList.contains('expand')) {
|
||||
this._commentForm.classList.add('expand');
|
||||
this._commentEditor.focus();
|
||||
}
|
||||
}
|
||||
|
@ -707,9 +705,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
|
|||
private hideReplyArea() {
|
||||
this._commentEditor.setValue('');
|
||||
this._pendingComment = '';
|
||||
if (dom.hasClass(this._commentForm, 'expand')) {
|
||||
dom.removeClass(this._commentForm, 'expand');
|
||||
}
|
||||
this._commentForm.classList.remove('expand');
|
||||
this._commentEditor.getDomNode()!.style.outline = '';
|
||||
this._error.textContent = '';
|
||||
dom.addClass(this._error, 'hidden');
|
||||
|
@ -725,7 +721,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
|
|||
this._disposables.add(dom.addDisposableListener(this._reviewThreadReplyButton, 'focus', _ => this.expandReplyArea()));
|
||||
|
||||
this._commentEditor.onDidBlurEditorWidget(() => {
|
||||
if (this._commentEditor.getModel()!.getValueLength() === 0 && dom.hasClass(this._commentForm, 'expand')) {
|
||||
if (this._commentEditor.getModel()!.getValueLength() === 0 && this._commentForm.classList.add('expand')) {
|
||||
dom.removeClass(this._commentForm, 'expand');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -240,7 +240,7 @@ export class BreakpointEditorContribution implements IBreakpointEditorContributi
|
|||
breakpoints.forEach(bp => this.debugService.removeBreakpoints(bp.getId()));
|
||||
}
|
||||
} else if (canSetBreakpoints) {
|
||||
this.debugService.addBreakpoints(uri, [{ lineNumber }], `debugEditorGutter`);
|
||||
this.debugService.addBreakpoints(uri, [{ lineNumber }]);
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
@ -349,7 +349,7 @@ export class BreakpointEditorContribution implements IBreakpointEditorContributi
|
|||
nls.localize('addBreakpoint', "Add Breakpoint"),
|
||||
undefined,
|
||||
true,
|
||||
() => this.debugService.addBreakpoints(uri, [{ lineNumber, column }], `debugEditorContextMenu`)
|
||||
() => this.debugService.addBreakpoints(uri, [{ lineNumber, column }])
|
||||
));
|
||||
actions.push(new Action(
|
||||
'addConditionalBreakpoint',
|
||||
|
@ -583,7 +583,7 @@ class InlineBreakpointWidget implements IContentWidget, IDisposable {
|
|||
if (this.breakpoint) {
|
||||
await this.debugService.removeBreakpoints(this.breakpoint.getId());
|
||||
} else {
|
||||
await this.debugService.addBreakpoints(this.editor.getModel().uri, [{ lineNumber: this.range!.startLineNumber, column: this.range!.startColumn }], 'debugEditorInlineWidget');
|
||||
await this.debugService.addBreakpoints(this.editor.getModel().uri, [{ lineNumber: this.range!.startLineNumber, column: this.range!.startColumn }]);
|
||||
}
|
||||
}));
|
||||
this.toDispose.push(dom.addDisposableListener(this.domNode, dom.EventType.CONTEXT_MENU, e => {
|
||||
|
|
|
@ -325,7 +325,7 @@ export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWi
|
|||
condition,
|
||||
hitCondition,
|
||||
logMessage
|
||||
}], `breakpointWidget`);
|
||||
}]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -527,7 +527,7 @@ export function registerCommands(): void {
|
|||
.some(bp => (bp.sessionAgnosticData.column === position.column || (!bp.column && position.column <= 1)));
|
||||
|
||||
if (!breakpointAlreadySet) {
|
||||
debugService.addBreakpoints(modelUri, [{ lineNumber: position.lineNumber, column: position.column > 1 ? position.column : undefined }], 'debugCommands.inlineBreakpointCommand');
|
||||
debugService.addBreakpoints(modelUri, [{ lineNumber: position.lineNumber, column: position.column > 1 ? position.column : undefined }]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class ToggleBreakpointAction extends EditorAction {
|
|||
if (bps.length) {
|
||||
return Promise.all(bps.map(bp => debugService.removeBreakpoints(bp.getId())));
|
||||
} else if (canSet) {
|
||||
return (debugService.addBreakpoints(modelUri, [{ lineNumber: line }], 'debugEditorActions.toggleBreakpointAction'));
|
||||
return (debugService.addBreakpoints(modelUri, [{ lineNumber: line }]));
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ export class RunToCursorAction extends EditorAction {
|
|||
column = position.column;
|
||||
}
|
||||
|
||||
const breakpoints = await debugService.addBreakpoints(uri, [{ lineNumber: position.lineNumber, column }], 'debugEditorActions.runToCursorAction', false);
|
||||
const breakpoints = await debugService.addBreakpoints(uri, [{ lineNumber: position.lineNumber, column }], false);
|
||||
if (breakpoints && breakpoints.length) {
|
||||
breakpointToRemove = breakpoints[0];
|
||||
}
|
||||
|
|
|
@ -860,12 +860,11 @@ export class DebugService implements IDebugService {
|
|||
this.debugStorage.storeBreakpoints(this.model);
|
||||
}
|
||||
|
||||
async addBreakpoints(uri: uri, rawBreakpoints: IBreakpointData[], context: string, ariaAnnounce = true): Promise<IBreakpoint[]> {
|
||||
async addBreakpoints(uri: uri, rawBreakpoints: IBreakpointData[], ariaAnnounce = true): Promise<IBreakpoint[]> {
|
||||
const breakpoints = this.model.addBreakpoints(uri, rawBreakpoints);
|
||||
if (ariaAnnounce) {
|
||||
breakpoints.forEach(bp => aria.status(nls.localize('breakpointAdded', "Added breakpoint, line {0}, file {1}", bp.lineNumber, uri.fsPath)));
|
||||
}
|
||||
breakpoints.forEach(bp => this.telemetry.logDebugAddBreakpoint(bp, context));
|
||||
|
||||
// In some cases we need to store breakpoints before we send them because sending them can take a long time
|
||||
// And after sending them because the debug adapter can attach adapter data to a breakpoint
|
||||
|
|
|
@ -804,7 +804,7 @@ export interface IDebugService {
|
|||
/**
|
||||
* Adds new breakpoints to the model for the file specified with the uri. Notifies debug adapter of breakpoint changes.
|
||||
*/
|
||||
addBreakpoints(uri: uri, rawBreakpoints: IBreakpointData[], context: string, ariaAnnounce?: boolean): Promise<IBreakpoint[]>;
|
||||
addBreakpoints(uri: uri, rawBreakpoints: IBreakpointData[], ariaAnnounce?: boolean): Promise<IBreakpoint[]>;
|
||||
|
||||
/**
|
||||
* Updates the breakpoints.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IDebugModel, IDebugSession, AdapterEndEvent, IBreakpoint } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { IDebugModel, IDebugSession, AdapterEndEvent } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { Debugger } from 'vs/workbench/contrib/debug/common/debugger';
|
||||
|
||||
|
@ -59,22 +59,4 @@ export class DebugTelemetry {
|
|||
watchExpressionsCount: this.model.getWatchExpressions().length
|
||||
});
|
||||
}
|
||||
|
||||
logDebugAddBreakpoint(breakpoint: IBreakpoint, context: string): Promise<any> {
|
||||
/* __GDPR__
|
||||
"debugAddBreakpoint" : {
|
||||
"context": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"hasCondition": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"hasHitCondition": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
|
||||
"hasLogMessage": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
|
||||
return this.telemetryService.publicLog('debugAddBreakpoint', {
|
||||
context: context,
|
||||
hasCondition: !!breakpoint.condition,
|
||||
hasHitCondition: !!breakpoint.hitCondition,
|
||||
hasLogMessage: !!breakpoint.logMessage
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,11 +6,10 @@
|
|||
import { localize } from 'vs/nls';
|
||||
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { SyncActionDescriptor, MenuRegistry, MenuId, registerAction2, Action2 } from 'vs/platform/actions/common/actions';
|
||||
import { MenuRegistry, MenuId, registerAction2, Action2 } from 'vs/platform/actions/common/actions';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { ExtensionsLabel, ExtensionsChannelId, PreferencesLabel, IExtensionManagementService, IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionsLabel, ExtensionsLocalizedLabel, ExtensionsChannelId, IExtensionManagementService, IExtensionGalleryService, PreferencesLocalizedLabel } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManagementServerService, IExtensionRecommendationsService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { IWorkbenchActionRegistry, Extensions as WorkbenchActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IOutputChannelRegistry, Extensions as OutputExtensions } from 'vs/workbench/services/output/common/output';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
|
@ -27,7 +26,7 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtensions, Configur
|
|||
import * as jsonContributionRegistry from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
|
||||
import { ExtensionsConfigurationSchema, ExtensionsConfigurationSchemaId } from 'vs/workbench/contrib/extensions/common/extensionsFileTemplate';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { KeymapExtensions } from 'vs/workbench/contrib/extensions/common/extensionsUtils';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { EditorDescriptor, IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
|
||||
|
@ -42,7 +41,7 @@ import { RemoteExtensionsInstaller } from 'vs/workbench/contrib/extensions/brows
|
|||
import { IViewContainersRegistry, ViewContainerLocation, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ContextKeyAndExpr, ContextKeyExpr, ContextKeyOrExpr, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { IQuickAccessRegistry, Extensions } from 'vs/platform/quickinput/common/quickAccess';
|
||||
import { InstallExtensionQuickAccessProvider, ManageExtensionsQuickAccessProvider } from 'vs/workbench/contrib/extensions/browser/extensionsQuickAccess';
|
||||
|
@ -53,6 +52,8 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
|
|||
import { MultiCommand } from 'vs/editor/browser/editorExtensions';
|
||||
import { Webview } from 'vs/workbench/contrib/webview/browser/webview';
|
||||
import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/browser/extensionsWorkbenchService';
|
||||
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { WorkbenchStateContext } from 'vs/workbench/browser/contextkeys';
|
||||
|
||||
// Singletons
|
||||
registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService);
|
||||
|
@ -92,69 +93,6 @@ Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegis
|
|||
}, ViewContainerLocation.Sidebar);
|
||||
|
||||
|
||||
// Global actions
|
||||
const actionRegistry = Registry.as<IWorkbenchActionRegistry>(WorkbenchActionExtensions.WorkbenchActions);
|
||||
|
||||
const openViewletActionDescriptor = SyncActionDescriptor.from(OpenExtensionsViewletAction, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_X });
|
||||
actionRegistry.registerWorkbenchAction(openViewletActionDescriptor, 'View: Show Extensions', localize('view', "View"));
|
||||
|
||||
const installActionDescriptor = SyncActionDescriptor.from(InstallExtensionsAction);
|
||||
actionRegistry.registerWorkbenchAction(installActionDescriptor, 'Extensions: Install Extensions', ExtensionsLabel);
|
||||
|
||||
const listOutdatedActionDescriptor = SyncActionDescriptor.from(ShowOutdatedExtensionsAction);
|
||||
actionRegistry.registerWorkbenchAction(listOutdatedActionDescriptor, 'Extensions: Show Outdated Extensions', ExtensionsLabel);
|
||||
|
||||
const recommendationsActionDescriptor = SyncActionDescriptor.from(ShowRecommendedExtensionsAction);
|
||||
actionRegistry.registerWorkbenchAction(recommendationsActionDescriptor, 'Extensions: Show Recommended Extensions', ExtensionsLabel);
|
||||
|
||||
const keymapRecommendationsActionDescriptor = SyncActionDescriptor.from(ShowRecommendedKeymapExtensionsAction, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_M) });
|
||||
actionRegistry.registerWorkbenchAction(keymapRecommendationsActionDescriptor, 'Preferences: Keymaps', PreferencesLabel);
|
||||
|
||||
const languageExtensionsActionDescriptor = SyncActionDescriptor.from(ShowLanguageExtensionsAction);
|
||||
actionRegistry.registerWorkbenchAction(languageExtensionsActionDescriptor, 'Preferences: Language Extensions', PreferencesLabel);
|
||||
|
||||
const popularActionDescriptor = SyncActionDescriptor.from(ShowPopularExtensionsAction);
|
||||
actionRegistry.registerWorkbenchAction(popularActionDescriptor, 'Extensions: Show Popular Extensions', ExtensionsLabel);
|
||||
|
||||
const enabledActionDescriptor = SyncActionDescriptor.from(ShowEnabledExtensionsAction);
|
||||
actionRegistry.registerWorkbenchAction(enabledActionDescriptor, 'Extensions: Show Enabled Extensions', ExtensionsLabel);
|
||||
|
||||
const installedActionDescriptor = SyncActionDescriptor.from(ShowInstalledExtensionsAction);
|
||||
actionRegistry.registerWorkbenchAction(installedActionDescriptor, 'Extensions: Show Installed Extensions', ExtensionsLabel);
|
||||
|
||||
const disabledActionDescriptor = SyncActionDescriptor.from(ShowDisabledExtensionsAction);
|
||||
actionRegistry.registerWorkbenchAction(disabledActionDescriptor, 'Extensions: Show Disabled Extensions', ExtensionsLabel);
|
||||
|
||||
const builtinActionDescriptor = SyncActionDescriptor.from(ShowBuiltInExtensionsAction);
|
||||
actionRegistry.registerWorkbenchAction(builtinActionDescriptor, 'Extensions: Show Built-in Extensions', ExtensionsLabel);
|
||||
|
||||
const updateAllActionDescriptor = SyncActionDescriptor.from(UpdateAllAction);
|
||||
actionRegistry.registerWorkbenchAction(updateAllActionDescriptor, 'Extensions: Update All Extensions', ExtensionsLabel);
|
||||
|
||||
const installVSIXActionDescriptor = SyncActionDescriptor.from(InstallVSIXAction);
|
||||
actionRegistry.registerWorkbenchAction(installVSIXActionDescriptor, 'Extensions: Install from VSIX...', ExtensionsLabel);
|
||||
|
||||
const disableAllAction = SyncActionDescriptor.from(DisableAllAction);
|
||||
actionRegistry.registerWorkbenchAction(disableAllAction, 'Extensions: Disable All Installed Extensions', ExtensionsLabel);
|
||||
|
||||
const disableAllWorkspaceAction = SyncActionDescriptor.from(DisableAllWorkspaceAction);
|
||||
actionRegistry.registerWorkbenchAction(disableAllWorkspaceAction, 'Extensions: Disable All Installed Extensions for this Workspace', ExtensionsLabel);
|
||||
|
||||
const enableAllAction = SyncActionDescriptor.from(EnableAllAction);
|
||||
actionRegistry.registerWorkbenchAction(enableAllAction, 'Extensions: Enable All Extensions', ExtensionsLabel);
|
||||
|
||||
const enableAllWorkspaceAction = SyncActionDescriptor.from(EnableAllWorkspaceAction);
|
||||
actionRegistry.registerWorkbenchAction(enableAllWorkspaceAction, 'Extensions: Enable All Extensions for this Workspace', ExtensionsLabel);
|
||||
|
||||
const checkForUpdatesAction = SyncActionDescriptor.from(CheckForUpdatesAction);
|
||||
actionRegistry.registerWorkbenchAction(checkForUpdatesAction, `Extensions: Check for Extension Updates`, ExtensionsLabel);
|
||||
|
||||
actionRegistry.registerWorkbenchAction(SyncActionDescriptor.from(ClearExtensionsSearchResultsAction), 'Extensions: Clear Extensions Search Results', ExtensionsLabel);
|
||||
actionRegistry.registerWorkbenchAction(SyncActionDescriptor.from(EnableAutoUpdateAction), `Extensions: Enable Auto Updating Extensions`, ExtensionsLabel);
|
||||
actionRegistry.registerWorkbenchAction(SyncActionDescriptor.from(DisableAutoUpdateAction), `Extensions: Disable Auto Updating Extensions`, ExtensionsLabel);
|
||||
actionRegistry.registerWorkbenchAction(SyncActionDescriptor.from(InstallSpecificVersionOfExtensionAction), 'Install Specific Version of Extension...', ExtensionsLabel);
|
||||
actionRegistry.registerWorkbenchAction(SyncActionDescriptor.from(ReinstallAction), 'Reinstall Extension...', localize({ key: 'developer', comment: ['A developer on Code itself or someone diagnosing issues in Code'] }, "Developer"));
|
||||
|
||||
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
||||
.registerConfiguration({
|
||||
id: 'extensions',
|
||||
|
@ -372,8 +310,476 @@ MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|||
order: 3
|
||||
});
|
||||
|
||||
// Extension Context Menu
|
||||
function overrideActionForActiveExtensionEditorWebview(command: MultiCommand | undefined, f: (webview: Webview) => void) {
|
||||
command?.addImplementation(105, (accessor) => {
|
||||
const editorService = accessor.get(IEditorService);
|
||||
const editor = editorService.activeEditorPane;
|
||||
if (editor instanceof ExtensionEditor) {
|
||||
if (editor.activeWebview?.isFocused) {
|
||||
f(editor.activeWebview);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
overrideActionForActiveExtensionEditorWebview(CopyAction, webview => webview.copy());
|
||||
overrideActionForActiveExtensionEditorWebview(CutAction, webview => webview.cut());
|
||||
overrideActionForActiveExtensionEditorWebview(PasteAction, webview => webview.paste());
|
||||
|
||||
// Contexts
|
||||
export const CONTEXT_HAS_GALLERY = new RawContextKey<boolean>('hasGallery', false);
|
||||
export const CONTEXT_HAS_LOCAL_SERVER = new RawContextKey<boolean>('hasLocalServer', false);
|
||||
export const CONTEXT_HAS_REMOTE_SERVER = new RawContextKey<boolean>('hasRemoteServer', false);
|
||||
export const CONTEXT_HAS_WEB_SERVER = new RawContextKey<boolean>('hasWebServer', false);
|
||||
|
||||
class ExtensionsContributions implements IWorkbenchContribution {
|
||||
|
||||
constructor(
|
||||
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@IExtensionGalleryService extensionGalleryService: IExtensionGalleryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
) {
|
||||
const hasGalleryContext = CONTEXT_HAS_GALLERY.bindTo(contextKeyService);
|
||||
if (extensionGalleryService.isEnabled()) {
|
||||
hasGalleryContext.set(true);
|
||||
}
|
||||
|
||||
const hasLocalServerContext = CONTEXT_HAS_LOCAL_SERVER.bindTo(contextKeyService);
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer) {
|
||||
hasLocalServerContext.set(true);
|
||||
}
|
||||
|
||||
const hasRemoteServerContext = CONTEXT_HAS_REMOTE_SERVER.bindTo(contextKeyService);
|
||||
if (this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
hasRemoteServerContext.set(true);
|
||||
}
|
||||
|
||||
const hasWebServerContext = CONTEXT_HAS_WEB_SERVER.bindTo(contextKeyService);
|
||||
if (this.extensionManagementServerService.webExtensionManagementServer) {
|
||||
hasWebServerContext.set(true);
|
||||
}
|
||||
|
||||
this.registerGlobalActions();
|
||||
this.registerContextMenuActions();
|
||||
this.registerQuickAccessProvider();
|
||||
}
|
||||
|
||||
private registerQuickAccessProvider(): void {
|
||||
if (this.extensionManagementServerService.localExtensionManagementServer
|
||||
|| this.extensionManagementServerService.remoteExtensionManagementServer
|
||||
|| this.extensionManagementServerService.webExtensionManagementServer
|
||||
) {
|
||||
Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess).registerQuickAccessProvider({
|
||||
ctor: InstallExtensionQuickAccessProvider,
|
||||
prefix: InstallExtensionQuickAccessProvider.PREFIX,
|
||||
placeholder: localize('installExtensionQuickAccessPlaceholder', "Type the name of an extension to install or search."),
|
||||
helpEntries: [{ description: localize('installExtensionQuickAccessHelp', "Install or Search Extensions"), needsEditor: false }]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Global actions
|
||||
private registerGlobalActions(): void {
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: OpenExtensionsViewletAction.ID,
|
||||
title: { value: OpenExtensionsViewletAction.LABEL, original: 'Show Extensions' },
|
||||
category: { value: localize('view', "View"), original: 'View' },
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
},
|
||||
keybinding: {
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_X,
|
||||
weight: KeybindingWeight.WorkbenchContrib
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(OpenExtensionsViewletAction, OpenExtensionsViewletAction.ID, OpenExtensionsViewletAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: InstallExtensionsAction.ID,
|
||||
title: { value: InstallExtensionsAction.LABEL, original: 'Install Extensions' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyAndExpr.create([CONTEXT_HAS_GALLERY, ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER])])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(InstallExtensionsAction, InstallExtensionsAction.ID, InstallExtensionsAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: ShowOutdatedExtensionsAction.ID,
|
||||
title: { value: ShowOutdatedExtensionsAction.LABEL, original: 'Show Outdated Extensions' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyAndExpr.create([CONTEXT_HAS_GALLERY, ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER])])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(ShowOutdatedExtensionsAction, ShowOutdatedExtensionsAction.ID, ShowOutdatedExtensionsAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: ShowRecommendedExtensionsAction.ID,
|
||||
title: { value: ShowRecommendedExtensionsAction.LABEL, original: 'Show Recommended Extensions' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: CONTEXT_HAS_GALLERY
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(ShowRecommendedExtensionsAction, ShowRecommendedExtensionsAction.ID, ShowRecommendedExtensionsAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: ShowRecommendedKeymapExtensionsAction.ID,
|
||||
title: { value: ShowRecommendedKeymapExtensionsAction.LABEL, original: 'Keymaps' },
|
||||
category: PreferencesLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: CONTEXT_HAS_GALLERY
|
||||
},
|
||||
keybinding: {
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_M),
|
||||
weight: KeybindingWeight.WorkbenchContrib
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(ShowRecommendedKeymapExtensionsAction, ShowRecommendedKeymapExtensionsAction.ID, ShowRecommendedKeymapExtensionsAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: ShowLanguageExtensionsAction.ID,
|
||||
title: { value: ShowLanguageExtensionsAction.LABEL, original: 'Language Extensions' },
|
||||
category: PreferencesLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: CONTEXT_HAS_GALLERY
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(ShowLanguageExtensionsAction, ShowLanguageExtensionsAction.ID, ShowLanguageExtensionsAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: ShowPopularExtensionsAction.ID,
|
||||
title: { value: ShowPopularExtensionsAction.LABEL, original: 'Show Popular Extensions' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: CONTEXT_HAS_GALLERY
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(ShowPopularExtensionsAction, ShowPopularExtensionsAction.ID, ShowPopularExtensionsAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: ShowEnabledExtensionsAction.ID,
|
||||
title: { value: ShowEnabledExtensionsAction.LABEL, original: 'Show Enabled Extensions' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(ShowEnabledExtensionsAction, ShowEnabledExtensionsAction.ID, ShowEnabledExtensionsAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: ShowInstalledExtensionsAction.ID,
|
||||
title: { value: ShowInstalledExtensionsAction.LABEL, original: 'Show Installed Extensions' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(ShowInstalledExtensionsAction, ShowInstalledExtensionsAction.ID, ShowInstalledExtensionsAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: ShowDisabledExtensionsAction.ID,
|
||||
title: { value: ShowDisabledExtensionsAction.LABEL, original: 'Show Disabled Extensions' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(ShowDisabledExtensionsAction, ShowDisabledExtensionsAction.ID, ShowDisabledExtensionsAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: ShowBuiltInExtensionsAction.ID,
|
||||
title: { value: ShowBuiltInExtensionsAction.LABEL, original: 'Show Built-in Extensions' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(ShowBuiltInExtensionsAction, ShowBuiltInExtensionsAction.ID, ShowBuiltInExtensionsAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: UpdateAllAction.ID,
|
||||
title: { value: UpdateAllAction.LABEL, original: 'Update All Extensions' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyAndExpr.create([CONTEXT_HAS_GALLERY, ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER])])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(UpdateAllAction, UpdateAllAction.ID, UpdateAllAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: InstallVSIXAction.ID,
|
||||
title: { value: InstallVSIXAction.LABEL, original: 'Install from VSIX...' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(InstallVSIXAction, InstallVSIXAction.ID, InstallVSIXAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: DisableAllAction.ID,
|
||||
title: { value: DisableAllAction.LABEL, original: 'Disable All Installed Extensions' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(DisableAllAction, DisableAllAction.ID, DisableAllAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: DisableAllWorkspaceAction.ID,
|
||||
title: { value: DisableAllWorkspaceAction.LABEL, original: 'Disable All Installed Extensions for this Workspace' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyAndExpr.create([WorkbenchStateContext.notEqualsTo('empty'), ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER])])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(DisableAllWorkspaceAction, DisableAllWorkspaceAction.ID, DisableAllWorkspaceAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: EnableAllAction.ID,
|
||||
title: { value: EnableAllAction.LABEL, original: 'Enable All Extensions' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(EnableAllAction, EnableAllAction.ID, EnableAllAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: EnableAllWorkspaceAction.ID,
|
||||
title: { value: EnableAllWorkspaceAction.LABEL, original: 'Enable All Extensions for this Workspace' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyAndExpr.create([WorkbenchStateContext.notEqualsTo('empty'), ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER])])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(EnableAllWorkspaceAction, EnableAllWorkspaceAction.ID, EnableAllWorkspaceAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: CheckForUpdatesAction.ID,
|
||||
title: { value: CheckForUpdatesAction.LABEL, original: 'Check for Extension Updates' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyAndExpr.create([CONTEXT_HAS_GALLERY, ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER])])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(CheckForUpdatesAction, CheckForUpdatesAction.ID, CheckForUpdatesAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: ClearExtensionsSearchResultsAction.ID,
|
||||
title: { value: ClearExtensionsSearchResultsAction.LABEL, original: 'Clear Extensions Search Results' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(ClearExtensionsSearchResultsAction, ClearExtensionsSearchResultsAction.ID, ClearExtensionsSearchResultsAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: EnableAutoUpdateAction.ID,
|
||||
title: { value: EnableAutoUpdateAction.LABEL, original: 'Enable Auto Updating Extensions' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(EnableAutoUpdateAction, EnableAutoUpdateAction.ID, EnableAutoUpdateAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: DisableAutoUpdateAction.ID,
|
||||
title: { value: DisableAutoUpdateAction.LABEL, original: 'Disable Auto Updating Extensions' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(DisableAutoUpdateAction, DisableAutoUpdateAction.ID, DisableAutoUpdateAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: InstallSpecificVersionOfExtensionAction.ID,
|
||||
title: { value: InstallSpecificVersionOfExtensionAction.LABEL, original: 'Install Specific Version of Extension...' },
|
||||
category: ExtensionsLocalizedLabel,
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyAndExpr.create([CONTEXT_HAS_GALLERY, ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER, CONTEXT_HAS_WEB_SERVER])])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(InstallSpecificVersionOfExtensionAction, InstallSpecificVersionOfExtensionAction.ID, InstallSpecificVersionOfExtensionAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: ReinstallAction.ID,
|
||||
title: { value: ReinstallAction.LABEL, original: 'Reinstall Extension...' },
|
||||
category: localize({ key: 'developer', comment: ['A developer on Code itself or someone diagnosing issues in Code'] }, "Developer"),
|
||||
menu: {
|
||||
id: MenuId.CommandPalette,
|
||||
when: ContextKeyAndExpr.create([CONTEXT_HAS_GALLERY, ContextKeyOrExpr.create([CONTEXT_HAS_LOCAL_SERVER, CONTEXT_HAS_REMOTE_SERVER])])
|
||||
}
|
||||
});
|
||||
}
|
||||
run(accessor: ServicesAccessor) {
|
||||
return accessor.get(IInstantiationService).createInstance(ReinstallAction, ReinstallAction.ID, ReinstallAction.LABEL).run();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Extension Context Menu
|
||||
private registerContextMenuActions(): void {
|
||||
registerAction2(class extends Action2 {
|
||||
|
||||
constructor() {
|
||||
|
@ -463,48 +869,10 @@ registerAction2(class extends Action2 {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
function overrideActionForActiveExtensionEditorWebview(command: MultiCommand | undefined, f: (webview: Webview) => void) {
|
||||
command?.addImplementation(105, (accessor) => {
|
||||
const editorService = accessor.get(IEditorService);
|
||||
const editor = editorService.activeEditorPane;
|
||||
if (editor instanceof ExtensionEditor) {
|
||||
if (editor.activeWebview?.isFocused) {
|
||||
f(editor.activeWebview);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
overrideActionForActiveExtensionEditorWebview(CopyAction, webview => webview.copy());
|
||||
overrideActionForActiveExtensionEditorWebview(CutAction, webview => webview.cut());
|
||||
overrideActionForActiveExtensionEditorWebview(PasteAction, webview => webview.paste());
|
||||
|
||||
|
||||
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
||||
|
||||
class ExtensionsContributions implements IWorkbenchContribution {
|
||||
|
||||
constructor(
|
||||
@IExtensionManagementServerService extensionManagementServerService: IExtensionManagementServerService
|
||||
) {
|
||||
|
||||
if (extensionManagementServerService.localExtensionManagementServer
|
||||
|| extensionManagementServerService.remoteExtensionManagementServer
|
||||
|| extensionManagementServerService.webExtensionManagementServer
|
||||
) {
|
||||
Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess).registerQuickAccessProvider({
|
||||
ctor: InstallExtensionQuickAccessProvider,
|
||||
prefix: InstallExtensionQuickAccessProvider.PREFIX,
|
||||
placeholder: localize('installExtensionQuickAccessPlaceholder', "Type the name of an extension to install or search."),
|
||||
helpEntries: [{ description: localize('installExtensionQuickAccessHelp', "Install or Search Extensions"), needsEditor: false }]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
workbenchRegistry.registerWorkbenchContribution(ExtensionsContributions, LifecyclePhase.Starting);
|
||||
workbenchRegistry.registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Restored);
|
||||
workbenchRegistry.registerWorkbenchContribution(MaliciousExtensionChecker, LifecyclePhase.Eventually);
|
||||
|
|
|
@ -224,38 +224,38 @@ registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) =
|
|||
}
|
||||
|
||||
const listActiveSelectionForegroundColor = theme.getColor(listActiveSelectionForeground);
|
||||
const listActiveSelectionBackgroundColor = theme.getColor(listActiveSelectionBackground);
|
||||
if (listActiveSelectionForegroundColor && listActiveSelectionBackgroundColor) {
|
||||
const authorForeground = listActiveSelectionForegroundColor.transparent(.9).makeOpaque(listActiveSelectionBackgroundColor);
|
||||
collector.addRule(`.extensions-list .monaco-list:focus .monaco-list-row:not(.disabled).selected .author { color: ${authorForeground}; }`);
|
||||
const disabledExtensionForeground = listActiveSelectionForegroundColor.transparent(.5).makeOpaque(listActiveSelectionBackgroundColor);
|
||||
collector.addRule(`.extensions-list .monaco-list:focus .monaco-list-row.disabled.selected { color: ${disabledExtensionForeground}; }`);
|
||||
if (listActiveSelectionForegroundColor) {
|
||||
const backgroundColor = theme.getColor(listActiveSelectionBackground) || WORKBENCH_BACKGROUND(theme);
|
||||
const authorForeground = listActiveSelectionForegroundColor.transparent(.9).makeOpaque(backgroundColor);
|
||||
collector.addRule(`.extensions-list .monaco-list:focus .monaco-list-row:not(.disabled).focused.selected .author { color: ${authorForeground}; }`);
|
||||
const disabledExtensionForeground = listActiveSelectionForegroundColor.transparent(.5).makeOpaque(backgroundColor);
|
||||
collector.addRule(`.extensions-list .monaco-list:focus .monaco-list-row.disabled.focused.selected { color: ${disabledExtensionForeground}; }`);
|
||||
}
|
||||
|
||||
const listInactiveSelectionForegroundColor = theme.getColor(listInactiveSelectionForeground);
|
||||
const listInactiveSelectionBackgroundColor = theme.getColor(listInactiveSelectionBackground);
|
||||
if (listInactiveSelectionForegroundColor && listInactiveSelectionBackgroundColor) {
|
||||
const authorForeground = listInactiveSelectionForegroundColor.transparent(.9).makeOpaque(listInactiveSelectionBackgroundColor);
|
||||
if (listInactiveSelectionForegroundColor) {
|
||||
const backgroundColor = theme.getColor(listInactiveSelectionBackground) || WORKBENCH_BACKGROUND(theme);
|
||||
const authorForeground = listInactiveSelectionForegroundColor.transparent(.9).makeOpaque(backgroundColor);
|
||||
collector.addRule(`.extensions-list .monaco-list .monaco-list-row:not(.disabled).selected .author { color: ${authorForeground}; }`);
|
||||
const disabledExtensionForeground = listInactiveSelectionForegroundColor.transparent(.5).makeOpaque(listInactiveSelectionBackgroundColor);
|
||||
const disabledExtensionForeground = listInactiveSelectionForegroundColor.transparent(.5).makeOpaque(backgroundColor);
|
||||
collector.addRule(`.extensions-list .monaco-list .monaco-list-row.disabled.selected { color: ${disabledExtensionForeground}; }`);
|
||||
}
|
||||
|
||||
const listFocusForegroundColor = theme.getColor(listFocusForeground);
|
||||
const listFocusBackgroundColor = theme.getColor(listFocusBackground);
|
||||
if (listFocusForegroundColor && listFocusBackgroundColor) {
|
||||
const authorForeground = listFocusForegroundColor.transparent(.9).makeOpaque(listFocusBackgroundColor);
|
||||
if (listFocusForegroundColor) {
|
||||
const backgroundColor = theme.getColor(listFocusBackground) || WORKBENCH_BACKGROUND(theme);
|
||||
const authorForeground = listFocusForegroundColor.transparent(.9).makeOpaque(backgroundColor);
|
||||
collector.addRule(`.extensions-list .monaco-list:focus .monaco-list-row:not(.disabled).focused .author { color: ${authorForeground}; }`);
|
||||
const disabledExtensionForeground = listFocusForegroundColor.transparent(.5).makeOpaque(listFocusBackgroundColor);
|
||||
const disabledExtensionForeground = listFocusForegroundColor.transparent(.5).makeOpaque(backgroundColor);
|
||||
collector.addRule(`.extensions-list .monaco-list:focus .monaco-list-row.disabled.focused { color: ${disabledExtensionForeground}; }`);
|
||||
}
|
||||
|
||||
const listHoverForegroundColor = theme.getColor(listHoverForeground);
|
||||
const listHoverBackgroundColor = theme.getColor(listHoverBackground);
|
||||
if (listHoverForegroundColor && listHoverBackgroundColor) {
|
||||
const authorForeground = listHoverForegroundColor.transparent(.9).makeOpaque(listHoverBackgroundColor);
|
||||
if (listHoverForegroundColor) {
|
||||
const backgroundColor = theme.getColor(listHoverBackground) || WORKBENCH_BACKGROUND(theme);
|
||||
const authorForeground = listHoverForegroundColor.transparent(.9).makeOpaque(backgroundColor);
|
||||
collector.addRule(`.extensions-list .monaco-list .monaco-list-row:hover:not(.disabled):not(.selected):.not(.focused) .author { color: ${authorForeground}; }`);
|
||||
const disabledExtensionForeground = listHoverForegroundColor.transparent(.5).makeOpaque(listHoverBackgroundColor);
|
||||
const disabledExtensionForeground = listHoverForegroundColor.transparent(.5).makeOpaque(backgroundColor);
|
||||
collector.addRule(`.extensions-list .monaco-list .monaco-list-row.disabled:hover:not(.selected):.not(.focused) { color: ${disabledExtensionForeground}; }`);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { INotebookEditor, INotebookEditorMouseEvent, INotebookEditorContribution, NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_IS_ACTIVE_EDITOR } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { CellFoldingState, FoldingModel } from 'vs/workbench/contrib/notebook/browser/contrib/fold/foldingModel';
|
||||
import { CellKind, ICellRange } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { registerNotebookContribution } from 'vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
|
||||
|
@ -117,10 +116,10 @@ export class FoldingController extends Disposable implements INotebookEditorCont
|
|||
|
||||
const target = e.event.target as HTMLElement;
|
||||
|
||||
if (DOM.hasClass(target, 'codicon-chevron-down') || DOM.hasClass(target, 'codicon-chevron-right')) {
|
||||
if (target.classList.contains('codicon-chevron-down') || target.classList.contains('codicon-chevron-right')) {
|
||||
const parent = target.parentElement as HTMLElement;
|
||||
|
||||
if (!DOM.hasClass(parent, 'notebook-folding-indicator')) {
|
||||
if (!parent.classList.contains('notebook-folding-indicator')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ class PropertyHeader extends Disposable {
|
|||
buildHeader(): void {
|
||||
let metadataChanged = this.accessor.checkIfModified(this.cell);
|
||||
this._foldingIndicator = DOM.append(this.metadataHeaderContainer, DOM.$('.property-folding-indicator'));
|
||||
DOM.addClass(this._foldingIndicator, this.accessor.prefix);
|
||||
this._foldingIndicator.classList.add(this.accessor.prefix);
|
||||
this._updateFoldingIcon();
|
||||
const metadataStatus = DOM.append(this.metadataHeaderContainer, DOM.$('div.property-status'));
|
||||
this._statusSpan = DOM.append(metadataStatus, DOM.$('span'));
|
||||
|
@ -107,7 +107,7 @@ class PropertyHeader extends Disposable {
|
|||
if (metadataChanged) {
|
||||
this._statusSpan.textContent = this.accessor.changedLabel;
|
||||
this._statusSpan.style.fontWeight = 'bold';
|
||||
DOM.addClass(this.metadataHeaderContainer, 'modified');
|
||||
this.metadataHeaderContainer.classList.add('modified');
|
||||
} else {
|
||||
this._statusSpan.textContent = this.accessor.unChangedLabel;
|
||||
}
|
||||
|
@ -142,18 +142,18 @@ class PropertyHeader extends Disposable {
|
|||
|
||||
const target = e.event.target as HTMLElement;
|
||||
|
||||
if (DOM.hasClass(target, 'codicon-chevron-down') || DOM.hasClass(target, 'codicon-chevron-right')) {
|
||||
if (target.classList.contains('codicon-chevron-down') || target.classList.contains('codicon-chevron-right')) {
|
||||
const parent = target.parentElement as HTMLElement;
|
||||
|
||||
if (!parent) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!DOM.hasClass(parent, this.accessor.prefix)) {
|
||||
if (!parent.classList.contains(this.accessor.prefix)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!DOM.hasClass(parent, 'property-folding-indicator')) {
|
||||
if (!parent.classList.contains('property-folding-indicator')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ class PropertyHeader extends Disposable {
|
|||
if (metadataChanged) {
|
||||
this._statusSpan.textContent = this.accessor.changedLabel;
|
||||
this._statusSpan.style.fontWeight = 'bold';
|
||||
DOM.addClass(this.metadataHeaderContainer, 'modified');
|
||||
this.metadataHeaderContainer.classList.add('modified');
|
||||
const actions: IAction[] = [];
|
||||
createAndFillInActionBarActions(this._menu, undefined, actions);
|
||||
this._toolbar.setActions(actions);
|
||||
|
@ -264,13 +264,13 @@ abstract class AbstractCellRenderer extends Disposable {
|
|||
this._diffEditorContainer = DOM.$('.cell-diff-editor-container');
|
||||
switch (this.style) {
|
||||
case 'left':
|
||||
DOM.addClass(body, 'left');
|
||||
body.classList.add('left');
|
||||
break;
|
||||
case 'right':
|
||||
DOM.addClass(body, 'right');
|
||||
body.classList.add('right');
|
||||
break;
|
||||
default:
|
||||
DOM.addClass(body, 'full');
|
||||
body.classList.add('full');
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,7 @@ abstract class AbstractCellRenderer extends Disposable {
|
|||
ignoreTrimWhitespace: false
|
||||
});
|
||||
|
||||
DOM.addClass(this._metadataEditorContainer!, 'diff');
|
||||
this._metadataEditorContainer?.classList.add('diff');
|
||||
|
||||
const mode = this.modeService.create('json');
|
||||
const originalMetadataModel = this.modelService.createModel(originalMetadataSource, mode, CellUri.generateCellMetadataUri(this.cell.original!.uri, this.cell.original!.handle), false);
|
||||
|
@ -611,7 +611,7 @@ abstract class AbstractCellRenderer extends Disposable {
|
|||
ignoreTrimWhitespace: false
|
||||
});
|
||||
|
||||
DOM.addClass(this._outputEditorContainer!, 'diff');
|
||||
this._outputEditorContainer?.classList.add('diff');
|
||||
|
||||
const mode = this.modeService.create('json');
|
||||
const originalModel = this.modelService.createModel(originalOutputsSource, mode, undefined, true);
|
||||
|
@ -708,7 +708,7 @@ export class DeletedCell extends AbstractCellRenderer {
|
|||
}
|
||||
|
||||
styleContainer(container: HTMLElement) {
|
||||
DOM.addClass(container, 'removed');
|
||||
container.classList.add('removed');
|
||||
}
|
||||
|
||||
buildSourceEditor(sourceContainer: HTMLElement): void {
|
||||
|
@ -795,7 +795,7 @@ export class InsertCell extends AbstractCellRenderer {
|
|||
}
|
||||
|
||||
styleContainer(container: HTMLElement): void {
|
||||
DOM.addClass(container, 'inserted');
|
||||
container.classList.add('inserted');
|
||||
}
|
||||
|
||||
buildSourceEditor(sourceContainer: HTMLElement): void {
|
||||
|
@ -899,7 +899,7 @@ export class ModifiedCell extends AbstractCellRenderer {
|
|||
originalEditable: false,
|
||||
ignoreTrimWhitespace: false
|
||||
});
|
||||
DOM.addClass(this._editorContainer, 'diff');
|
||||
this._editorContainer.classList.add('diff');
|
||||
|
||||
this._editor.layout({
|
||||
width: this.notebookEditor.getLayoutInfo().width - 2 * DIFF_CELL_MARGIN,
|
||||
|
|
|
@ -371,7 +371,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
|
|||
&&
|
||||
container !== this._body) {
|
||||
|
||||
if (DOM.hasClass(container as HTMLElement, 'output')) {
|
||||
if ((container as HTMLElement).classList.contains('output')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -385,7 +385,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
|
|||
const id = generateUuid();
|
||||
this._overlayContainer.id = `notebook-${id}`;
|
||||
this._overlayContainer.className = 'notebookOverlay';
|
||||
DOM.addClass(this._overlayContainer, 'notebook-editor');
|
||||
this._overlayContainer.classList.add('notebook-editor');
|
||||
this._overlayContainer.style.visibility = 'hidden';
|
||||
|
||||
this.layoutService.container.appendChild(this._overlayContainer);
|
||||
|
@ -512,7 +512,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
|
|||
this._webviewTransparentCover.style.display = 'none';
|
||||
|
||||
this._register(DOM.addStandardDisposableGenericMouseDownListner(this._overlayContainer, (e: StandardMouseEvent) => {
|
||||
if (DOM.hasClass(e.target, 'slider') && this._webviewTransparentCover) {
|
||||
if (e.target.classList.contains('slider') && this._webviewTransparentCover) {
|
||||
this._webviewTransparentCover.style.display = 'block';
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -1041,7 +1041,7 @@ export class SettingsEditor2 extends EditorPane {
|
|||
const focusedKey = focusedSetting.getAttribute(AbstractSettingRenderer.SETTING_KEY_ATTR);
|
||||
if (focusedKey === key &&
|
||||
// update `list`s live, as they have a separate "submit edit" step built in before this
|
||||
(focusedSetting.parentElement && !DOM.hasClass(focusedSetting.parentElement, 'setting-item-list'))
|
||||
(focusedSetting.parentElement && !focusedSetting.parentElement.classList.contains('setting-item-list'))
|
||||
) {
|
||||
|
||||
this.updateModifiedLabelForKey(key);
|
||||
|
|
|
@ -846,7 +846,8 @@ class AutomaticPortForwarding extends Disposable implements IWorkbenchContributi
|
|||
@INotificationService readonly notificationService: INotificationService,
|
||||
@IOpenerService readonly openerService: IOpenerService,
|
||||
@IViewsService readonly viewsService: IViewsService,
|
||||
@IRemoteExplorerService readonly remoteExplorerService: IRemoteExplorerService
|
||||
@IRemoteExplorerService readonly remoteExplorerService: IRemoteExplorerService,
|
||||
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
|
||||
) {
|
||||
super();
|
||||
const urlFinder = this._register(new UrlFinder(terminalService));
|
||||
|
@ -854,17 +855,24 @@ class AutomaticPortForwarding extends Disposable implements IWorkbenchContributi
|
|||
const forwarded = await this.remoteExplorerService.forward(localUrl);
|
||||
if (forwarded) {
|
||||
const address = MakeAddress(forwarded.tunnelRemoteHost, forwarded.tunnelRemotePort);
|
||||
const message = nls.localize('remote.tunnelsView.automaticForward', "{0} has been forwarded to {1} locally.",
|
||||
const message = nls.localize('remote.tunnelsView.automaticForward', "{0} from the remote has been forwarded to {1} locally.",
|
||||
address, forwarded.localAddress);
|
||||
const browserChoice: IPromptChoice = {
|
||||
label: OpenPortInBrowserAction.LABEL,
|
||||
run: () => OpenPortInBrowserAction.run(this.remoteExplorerService.tunnelModel, openerService, address)
|
||||
};
|
||||
const showChoice: IPromptChoice = {
|
||||
label: nls.localize('remote.tunnelsView.showView', "Show Tunnels View"),
|
||||
run: () => viewsService.openViewContainer(VIEWLET_ID)
|
||||
label: nls.localize('remote.tunnelsView.showView', "Show Forwarded Ports"),
|
||||
run: () => {
|
||||
const remoteAuthority = environmentService.configuration.remoteAuthority;
|
||||
const explorerType: string[] | undefined = remoteAuthority ? [remoteAuthority.split('+')[0]] : undefined;
|
||||
if (explorerType) {
|
||||
remoteExplorerService.targetType = explorerType;
|
||||
}
|
||||
viewsService.openViewContainer(VIEWLET_ID);
|
||||
}
|
||||
};
|
||||
notificationService.prompt(Severity.Info, message, [browserChoice, showChoice]);
|
||||
notificationService.prompt(Severity.Info, message, [browserChoice, showChoice], { neverShowAgain: { id: 'remote.tunnelsView.autoForwardNeverShow', isSecondary: true } });
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -1142,7 +1142,7 @@ export class SearchView extends ViewPane {
|
|||
}
|
||||
|
||||
private showsFileTypes(): boolean {
|
||||
return dom.hasClass(this.queryDetails, 'more');
|
||||
return this.queryDetails.classList.contains('more');
|
||||
}
|
||||
|
||||
toggleCaseSensitive(): void {
|
||||
|
@ -1193,13 +1193,13 @@ export class SearchView extends ViewPane {
|
|||
|
||||
toggleQueryDetails(moveFocus = true, show?: boolean, skipLayout?: boolean, reverse?: boolean): void {
|
||||
const cls = 'more';
|
||||
show = typeof show === 'undefined' ? !dom.hasClass(this.queryDetails, cls) : Boolean(show);
|
||||
show = typeof show === 'undefined' ? !this.queryDetails.classList.contains(cls) : Boolean(show);
|
||||
this.viewletState['query.queryDetailsExpanded'] = show;
|
||||
skipLayout = Boolean(skipLayout);
|
||||
|
||||
if (show) {
|
||||
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'true');
|
||||
dom.addClass(this.queryDetails, cls);
|
||||
this.queryDetails.classList.add(cls);
|
||||
if (moveFocus) {
|
||||
if (reverse) {
|
||||
this.inputPatternExcludes.focus();
|
||||
|
@ -1211,7 +1211,7 @@ export class SearchView extends ViewPane {
|
|||
}
|
||||
} else {
|
||||
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'false');
|
||||
dom.removeClass(this.queryDetails, cls);
|
||||
this.queryDetails.classList.remove(cls);
|
||||
if (moveFocus) {
|
||||
this.searchWidget.focus();
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ export class SearchWidget extends Widget {
|
|||
}
|
||||
|
||||
isReplaceShown(): boolean {
|
||||
return !dom.hasClass(this.replaceContainer, 'disabled');
|
||||
return !this.replaceContainer.classList.contains('disabled');
|
||||
}
|
||||
|
||||
isReplaceActive(): boolean {
|
||||
|
|
|
@ -591,17 +591,17 @@ export class SearchEditor extends BaseTextEditor {
|
|||
|
||||
private toggleIncludesExcludes(_shouldShow?: boolean): void {
|
||||
const cls = 'expanded';
|
||||
const shouldShow = _shouldShow ?? !DOM.hasClass(this.includesExcludesContainer, cls);
|
||||
const shouldShow = _shouldShow ?? !this.includesExcludesContainer.classList.contains(cls);
|
||||
|
||||
if (shouldShow) {
|
||||
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'true');
|
||||
DOM.addClass(this.includesExcludesContainer, cls);
|
||||
this.includesExcludesContainer.classList.add(cls);
|
||||
} else {
|
||||
this.toggleQueryDetailsButton.setAttribute('aria-expanded', 'false');
|
||||
DOM.removeClass(this.includesExcludesContainer, cls);
|
||||
this.includesExcludesContainer.classList.remove(cls);
|
||||
}
|
||||
|
||||
this.showingIncludesExcludes = DOM.hasClass(this.includesExcludesContainer, cls);
|
||||
this.showingIncludesExcludes = this.includesExcludesContainer.classList.contains(cls);
|
||||
|
||||
this.reLayout();
|
||||
}
|
||||
|
|
|
@ -730,7 +730,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
|||
dispose(this._widgetManager);
|
||||
|
||||
if (this._xterm && this._xterm.element) {
|
||||
this._hadFocusOnExit = dom.hasClass(this._xterm.element, 'focus');
|
||||
this._hadFocusOnExit = this._xterm.element.classList.contains('focus');
|
||||
}
|
||||
if (this._wrapperElement) {
|
||||
if (this._wrapperElement.xterm) {
|
||||
|
|
|
@ -154,11 +154,7 @@ export class WatermarkContribution extends Disposable implements IWorkbenchContr
|
|||
}
|
||||
|
||||
private handleEditorPartSize(container: HTMLElement, dimension: dom.IDimension): void {
|
||||
if (dimension.height <= 478) {
|
||||
dom.addClass(container, 'max-height-478px');
|
||||
} else {
|
||||
dom.removeClass(container, 'max-height-478px');
|
||||
}
|
||||
container.classList.toggle('max-height-478px', dimension.height <= 478);
|
||||
}
|
||||
|
||||
private destroy(): void {
|
||||
|
|
|
@ -205,7 +205,7 @@ class WelcomeOverlay extends Disposable {
|
|||
if (this._overlay.style.display !== 'block') {
|
||||
this._overlay.style.display = 'block';
|
||||
const workbench = document.querySelector('.monaco-workbench') as HTMLElement;
|
||||
dom.addClass(workbench, 'blur-background');
|
||||
workbench.classList.add('blur-background');
|
||||
this._overlayVisible.set(true);
|
||||
this.updateProblemsKey();
|
||||
this.updateActivityBarKeys();
|
||||
|
@ -252,7 +252,7 @@ class WelcomeOverlay extends Disposable {
|
|||
if (this._overlay.style.display !== 'none') {
|
||||
this._overlay.style.display = 'none';
|
||||
const workbench = document.querySelector('.monaco-workbench') as HTMLElement;
|
||||
dom.removeClass(workbench, 'blur-background');
|
||||
workbench.classList.remove('blur-background');
|
||||
this._overlayVisible.reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ export class UserDataInitializationService implements IUserDataInitializationSer
|
|||
return;
|
||||
}
|
||||
|
||||
if (!this.environmentService.options?.enableSyncByDefault && !this.environmentService.options?.enableSettingsSync) {
|
||||
if (!this.environmentService.options?.enableSyncByDefault && !this.environmentService.options?.settingsSyncOptions?.enabled) {
|
||||
this.logService.trace(`Skipping initializing user data as settings sync is not enabled`);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue