Skip to content

Commit

Permalink
h
Browse files Browse the repository at this point in the history
Merge branch 'main' into merogge/problem-marker
  • Loading branch information
meganrogge committed Jun 23, 2022
2 parents 4040a3b + 9cd2caf commit c10717a
Show file tree
Hide file tree
Showing 50 changed files with 582 additions and 498 deletions.
20 changes: 0 additions & 20 deletions extensions/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1893,26 +1893,6 @@
"default": [],
"scope": "resource"
},
"git.branchProtectionIndicator": {
"type": "object",
"additionalProperties": false,
"description": "%config.branchProtectionIndicator%",
"properties": {
"quickOpen": {
"type": "boolean",
"description": "%config.branchProtectionIndicator.quickOpen%"
},
"statusBar": {
"type": "boolean",
"description": "%config.branchProtectionIndicator.statusBar%"
}
},
"default": {
"quickOpen": true,
"statusBar": true
},
"scope": "resource"
},
"git.branchProtectionPrompt": {
"type": "string",
"description": "%config.branchProtectionPrompt%",
Expand Down
3 changes: 0 additions & 3 deletions extensions/git/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@
"config.checkoutType.remote": "Remote branches",
"config.branchPrefix": "Prefix used when creating a new branch.",
"config.branchProtection": "List of protected branches. By default, a prompt is shown before changes are committed to a protected branch. The prompt can be controlled using the `#git.branchProtectionPrompt#` setting.",
"config.branchProtectionIndicator": "Controls whether an indicator is being displayed for a protected branch.",
"config.branchProtectionIndicator.quickOpen": "Display an indicator in the quick open.",
"config.branchProtectionIndicator.statusBar": "Display an indicator in the status bar.",
"config.branchProtectionPrompt": "Controls whether a prompt is being before changes are committed to a protected branch.",
"config.branchProtectionPrompt.alwaysCommit": "Always commit changes to the protected branch.",
"config.branchProtectionPrompt.alwaysCommitToNewBranch": "Always commit changes to a new branch.",
Expand Down
2 changes: 1 addition & 1 deletion extensions/git/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const localize = nls.loadMessageBundle();
class CheckoutItem implements QuickPickItem {

protected get shortCommit(): string { return (this.ref.commit || '').substr(0, 8); }
get label(): string { return this.ref.name ? `${this.ref.name}${this.repository.isBranchProtected(this.ref.name, 'quickOpen') ? ' $(lock-small)' : ''}` : this.shortCommit; }
get label(): string { return this.ref.name ? `${this.ref.name}${this.repository.isBranchProtected(this.ref.name) ? ' $(lock-small)' : ''}` : this.shortCommit; }
get description(): string { return this.shortCommit; }

constructor(protected repository: Repository, protected ref: Ref) { }
Expand Down
13 changes: 1 addition & 12 deletions extensions/git/src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,6 @@ export class Repository implements Disposable {

filterEvent(workspace.onDidChangeConfiguration, e =>
e.affectsConfiguration('git.branchProtection', root)
|| e.affectsConfiguration('git.branchProtectionIndicator', root)
|| e.affectsConfiguration('git.branchSortOrder', root)
|| e.affectsConfiguration('git.untrackedChanges', root)
|| e.affectsConfiguration('git.ignoreSubmodules', root)
Expand Down Expand Up @@ -2230,17 +2229,7 @@ export class Repository implements Disposable {
}
}

public isBranchProtected(name: string = this.HEAD?.name ?? '', indicator?: 'quickOpen' | 'statusBar'): boolean {
if (indicator) {
const scopedConfig = workspace.getConfiguration('git', Uri.file(this.repository.root));
const branchProtectionIndicator = scopedConfig.get<{ quickOpen: boolean; statusBar: boolean }>('branchProtectionIndicator', { quickOpen: true, statusBar: true });

if ((indicator === 'quickOpen' && !branchProtectionIndicator.quickOpen) ||
(indicator === 'statusBar' && !branchProtectionIndicator.statusBar)) {
return false;
}
}

public isBranchProtected(name: string = this.HEAD?.name ?? ''): boolean {
return this.isBranchProtectedMatcher ? this.isBranchProtectedMatcher(name) : false;
}

Expand Down
2 changes: 1 addition & 1 deletion extensions/git/src/statusbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CheckoutStatusBar {

get command(): Command | undefined {
const rebasing = !!this.repository.rebaseCommit;
const isBranchProtected = this.repository.isBranchProtected(undefined, 'statusBar');
const isBranchProtected = this.repository.isBranchProtected();
const title = `${isBranchProtected ? '$(lock)' : '$(git-branch)'} ${this.repository.headLabel}${rebasing ? ` (${localize('rebasing', 'Rebasing')})` : ''}`;

return {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/base/common/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface IRemoteConsoleLog {
arguments: string;
}

interface IStackArgument {
export interface IStackArgument {
__$stack: string;
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/code/electron-main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ export class CodeApplication extends Disposable {
mainProcessElectronServer.registerChannel(LOCAL_FILE_SYSTEM_CHANNEL_NAME, fileSystemProviderChannel);
sharedProcessClient.then(client => client.registerChannel(LOCAL_FILE_SYSTEM_CHANNEL_NAME, fileSystemProviderChannel));

// Profiles
// User Data Profiles
const userDataProfilesService = ProxyChannel.fromService(accessor.get(IUserDataProfilesMainService));
mainProcessElectronServer.registerChannel('userDataProfiles', userDataProfilesService);
sharedProcessClient.then(client => client.registerChannel('userDataProfiles', userDataProfilesService));
Expand Down
6 changes: 2 additions & 4 deletions src/vs/editor/browser/config/domFontInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as browser from 'vs/base/browser/browser';
import { FastDomNode } from 'vs/base/browser/fastDomNode';
import { EDITOR_FONT_DEFAULTS } from 'vs/editor/common/config/editorOptions';
import { BareFontInfo } from 'vs/editor/common/config/fontInfo';

export function applyFontInfo(domNode: FastDomNode<HTMLElement> | HTMLElement, fontInfo: BareFontInfo): void {
if (domNode instanceof FastDomNode) {
domNode.setFontFamily(fontInfo.getMassagedFontFamily(browser.isSafari ? EDITOR_FONT_DEFAULTS.fontFamily : null));
domNode.setFontFamily(fontInfo.getMassagedFontFamily());
domNode.setFontWeight(fontInfo.fontWeight);
domNode.setFontSize(fontInfo.fontSize);
domNode.setFontFeatureSettings(fontInfo.fontFeatureSettings);
domNode.setLineHeight(fontInfo.lineHeight);
domNode.setLetterSpacing(fontInfo.letterSpacing);
} else {
domNode.style.fontFamily = fontInfo.getMassagedFontFamily(browser.isSafari ? EDITOR_FONT_DEFAULTS.fontFamily : null);
domNode.style.fontFamily = fontInfo.getMassagedFontFamily();
domNode.style.fontWeight = fontInfo.fontWeight;
domNode.style.fontSize = fontInfo.fontSize + 'px';
domNode.style.fontFeatureSettings = fontInfo.fontFeatureSettings;
Expand Down
5 changes: 3 additions & 2 deletions src/vs/editor/common/config/fontInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import * as platform from 'vs/base/common/platform';
import { EditorOptions, EditorOption, FindComputedEditorOptionValueById } from 'vs/editor/common/config/editorOptions';
import { EditorOptions, EditorOption, FindComputedEditorOptionValueById, EDITOR_FONT_DEFAULTS } from 'vs/editor/common/config/editorOptions';
import { EditorZoom } from 'vs/editor/common/config/editorZoom';

/**
Expand Down Expand Up @@ -125,7 +125,8 @@ export class BareFontInfo {
/**
* @internal
*/
public getMassagedFontFamily(fallbackFontFamily: string | null): string {
public getMassagedFontFamily(): string {
const fallbackFontFamily = EDITOR_FONT_DEFAULTS.fontFamily;
const fontFamily = BareFontInfo._wrapInQuotes(this.fontFamily);
if (fallbackFontFamily && this.fontFamily !== fallbackFontFamily) {
return `${fontFamily}, ${fallbackFontFamily}`;
Expand Down
30 changes: 23 additions & 7 deletions src/vs/editor/contrib/hover/browser/contentHover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ export class ContentHoverController extends Disposable {

private readonly _participants: IEditorHoverParticipant[];
private readonly _widget = this._register(this._instantiationService.createInstance(ContentHoverWidget, this._editor));
private readonly _decorations = this._editor.createDecorationsCollection();
private readonly _computer: ContentHoverComputer;
private readonly _hoverOperation: HoverOperation<IHoverPart>;

private _messages: IHoverPart[];
private _messagesAreComplete: boolean;
private _isChangingDecorations: boolean = false;

constructor(
private readonly _editor: ICodeEditor,
Expand All @@ -61,7 +61,12 @@ export class ContentHoverController extends Disposable {
this._register(this._hoverOperation.onResult((result) => {
this._withResult(result.value, result.isComplete, result.hasLoadingMessage);
}));
this._register(this._decorations.onDidChange(() => this._onModelDecorationsChanged()));
this._register(this._editor.onDidChangeModelDecorations(() => {
if (this._isChangingDecorations) {
return;
}
this._onModelDecorationsChanged();
}));
this._register(dom.addStandardDisposableListener(this._widget.getDomNode(), 'keydown', (e) => {
if (e.equals(KeyCode.Escape)) {
this.hide();
Expand Down Expand Up @@ -225,12 +230,23 @@ export class ContentHoverController extends Disposable {

if (fragment.hasChildNodes()) {
if (highlightRange) {
this._decorations.set([{
range: highlightRange,
options: ContentHoverController._DECORATION_OPTIONS
}]);
const highlightDecoration = this._editor.createDecorationsCollection();
try {
this._isChangingDecorations = true;
highlightDecoration.set([{
range: highlightRange,
options: ContentHoverController._DECORATION_OPTIONS
}]);
} finally {
this._isChangingDecorations = false;
}
disposables.add(toDisposable(() => {
this._decorations.clear();
try {
this._isChangingDecorations = true;
highlightDecoration.clear();
} finally {
this._isChangingDecorations = false;
}
}));
}

Expand Down
5 changes: 2 additions & 3 deletions src/vs/editor/contrib/suggest/browser/suggestWidgetDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { isSafari } from 'vs/base/browser/browser';
import * as dom from 'vs/base/browser/dom';
import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
import { Codicon } from 'vs/base/common/codicons';
Expand All @@ -12,7 +11,7 @@ import { MarkdownString } from 'vs/base/common/htmlContent';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { MarkdownRenderer } from 'vs/editor/contrib/markdownRenderer/browser/markdownRenderer';
import { ICodeEditor, IOverlayWidget } from 'vs/editor/browser/editorBrowser';
import { EditorOption, EDITOR_FONT_DEFAULTS } from 'vs/editor/common/config/editorOptions';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { ResizableHTMLElement } from 'vs/editor/contrib/suggest/browser/resizable';
import * as nls from 'vs/nls';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
Expand Down Expand Up @@ -84,7 +83,7 @@ export class SuggestDetailsWidget {
private _configureFont(): void {
const options = this._editor.getOptions();
const fontInfo = options.get(EditorOption.fontInfo);
const fontFamily = fontInfo.getMassagedFontFamily(isSafari ? EDITOR_FONT_DEFAULTS.fontFamily : null);
const fontFamily = fontInfo.getMassagedFontFamily();
const fontSize = options.get(EditorOption.suggestFontSize) || fontInfo.fontSize;
const lineHeight = options.get(EditorOption.suggestLineHeight) || fontInfo.lineHeight;
const fontWeight = fontInfo.fontWeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { isSafari } from 'vs/base/browser/browser';
import { $, append, hide, show } from 'vs/base/browser/dom';
import { IconLabel, IIconLabelValueOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
import { IListRenderer } from 'vs/base/browser/ui/list/list';
Expand All @@ -13,7 +12,7 @@ import { createMatches } from 'vs/base/common/filters';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorOption, EDITOR_FONT_DEFAULTS } from 'vs/editor/common/config/editorOptions';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { CompletionItemKind, CompletionItemKinds, CompletionItemTag } from 'vs/editor/common/languages';
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
import { IModelService } from 'vs/editor/common/services/model';
Expand Down Expand Up @@ -130,7 +129,7 @@ export class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTe
const configureFont = () => {
const options = this._editor.getOptions();
const fontInfo = options.get(EditorOption.fontInfo);
const fontFamily = fontInfo.getMassagedFontFamily(isSafari ? EDITOR_FONT_DEFAULTS.fontFamily : null);
const fontFamily = fontInfo.getMassagedFontFamily();
const fontFeatureSettings = fontInfo.fontFeatureSettings;
const fontSize = options.get(EditorOption.suggestFontSize) || fontInfo.fontSize;
const lineHeight = options.get(EditorOption.suggestLineHeight) || fontInfo.lineHeight;
Expand Down

0 comments on commit c10717a

Please sign in to comment.