Merge branch 'master' of github.com:microsoft/vscode
This commit is contained in:
commit
75b075962a
9 changed files with 171 additions and 27 deletions
|
@ -31,7 +31,7 @@
|
|||
},
|
||||
{
|
||||
"name": "ms-vscode.references-view",
|
||||
"version": "0.0.33",
|
||||
"version": "0.0.34",
|
||||
"repo": "https://github.com/Microsoft/vscode-reference-view",
|
||||
"metadata": {
|
||||
"id": "dc489f46-520d-4556-ae85-1f9eab3c412d",
|
||||
|
|
|
@ -1813,6 +1813,12 @@ export class Repository {
|
|||
}
|
||||
|
||||
cleanupCommitEditMessage(message: string): string {
|
||||
// If the message is a single line starting with whitespace followed by `#`, just allow it.
|
||||
if (/^\s*#[^\n]*$/.test(message)) {
|
||||
return message;
|
||||
}
|
||||
|
||||
// Else, remove all lines starting with whitespace followed by `#`.
|
||||
//TODO: Support core.commentChar
|
||||
return message.replace(/^\s*#.*$\n?/gm, '').trim();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
"iconv-lite": "0.5.0",
|
||||
"jschardet": "1.6.0",
|
||||
"keytar": "^4.11.0",
|
||||
"native-is-elevated": "0.3.0",
|
||||
"native-is-elevated": "0.4.1",
|
||||
"native-keymap": "2.0.0",
|
||||
"native-watchdog": "1.2.0",
|
||||
"node-pty": "^0.10.0-beta2",
|
||||
|
|
10
src/typings/native-is-elevated.d.ts
vendored
10
src/typings/native-is-elevated.d.ts
vendored
|
@ -1,10 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'native-is-elevated' {
|
||||
function isElevated(): boolean;
|
||||
|
||||
export = isElevated;
|
||||
}
|
|
@ -648,7 +648,8 @@ registerEditorAction(class PeekReferencesAction extends ReferencesAction {
|
|||
class GenericGoToLocationAction extends SymbolNavigationAction {
|
||||
|
||||
constructor(
|
||||
private readonly _references: Location[]
|
||||
private readonly _references: Location[],
|
||||
private readonly _gotoMultipleBehaviour: GoToLocationValues | undefined
|
||||
) {
|
||||
super({
|
||||
muteMessage: true,
|
||||
|
@ -674,7 +675,7 @@ class GenericGoToLocationAction extends SymbolNavigationAction {
|
|||
}
|
||||
|
||||
protected _getGoToPreference(editor: IActiveCodeEditor): GoToLocationValues {
|
||||
return editor.getOption(EditorOption.gotoLocation).multipleReferences;
|
||||
return this._gotoMultipleBehaviour ?? editor.getOption(EditorOption.gotoLocation).multipleReferences;
|
||||
}
|
||||
|
||||
protected _getMetaTitle() { return ''; }
|
||||
|
@ -689,12 +690,14 @@ CommandsRegistry.registerCommand({
|
|||
{ name: 'uri', description: 'The text document in which to start', constraint: URI },
|
||||
{ name: 'position', description: 'The position at which to start', constraint: corePosition.Position.isIPosition },
|
||||
{ name: 'locations', description: 'An array of locations.', constraint: Array },
|
||||
{ name: 'multiple', description: 'Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto' },
|
||||
]
|
||||
},
|
||||
handler: async (accessor: ServicesAccessor, resource: any, position: any, references: any) => {
|
||||
handler: async (accessor: ServicesAccessor, resource: any, position: any, references: any, multiple?: any) => {
|
||||
assertType(URI.isUri(resource));
|
||||
assertType(corePosition.Position.isIPosition(position));
|
||||
assertType(Array.isArray(references));
|
||||
assertType(typeof multiple === 'undefined' || typeof multiple === 'string');
|
||||
|
||||
const editorService = accessor.get(ICodeEditorService);
|
||||
const editor = await editorService.openCodeEditor({ resource }, editorService.getFocusedCodeEditor());
|
||||
|
@ -704,7 +707,7 @@ CommandsRegistry.registerCommand({
|
|||
editor.revealPositionInCenterIfOutsideViewport(position, ScrollType.Smooth);
|
||||
|
||||
return editor.invokeWithinContext(accessor => {
|
||||
const command = new GenericGoToLocationAction(references);
|
||||
const command = new GenericGoToLocationAction(references, multiple as GoToLocationValues);
|
||||
accessor.get(IInstantiationService).invokeFunction(command.run.bind(command), editor);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -25,10 +25,21 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
|||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { ActivePanelContext } from 'vs/workbench/common/panel';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { Disposable, MutableDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IStatusbarEntryAccessor, IStatusbarService, StatusbarAlignment, IStatusbarEntry } from 'vs/workbench/services/statusbar/common/statusbar';
|
||||
import { IMarkerService, MarkerStatistics } from 'vs/platform/markers/common/markers';
|
||||
import { IMarkerService, MarkerStatistics, IMarker, MarkerSeverity, IMarkerData } from 'vs/platform/markers/common/markers';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { IEditorContribution } from 'vs/editor/common/editorCommon';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { isEqual } from 'vs/base/common/resources';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { compare } from 'vs/base/common/strings';
|
||||
|
||||
registerSingleton(IMarkersWorkbenchService, MarkersWorkbenchService, false);
|
||||
|
||||
|
@ -81,6 +92,11 @@ Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfigurat
|
|||
'description': Messages.PROBLEMS_PANEL_CONFIGURATION_AUTO_REVEAL,
|
||||
'type': 'boolean',
|
||||
'default': true
|
||||
},
|
||||
'problems.showCurrentInStatus': {
|
||||
'description': Messages.PROBLEMS_PANEL_CONFIGURATION_SHOW_CURRENT_STATUS,
|
||||
'type': 'boolean',
|
||||
'default': false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -343,3 +359,136 @@ class MarkersStatusBarContributions extends Disposable implements IWorkbenchCont
|
|||
}
|
||||
|
||||
workbenchRegistry.registerWorkbenchContribution(MarkersStatusBarContributions, LifecyclePhase.Restored);
|
||||
|
||||
class ShowCurrentMarkerInStatusbarContribution extends Disposable implements IEditorContribution {
|
||||
|
||||
public static readonly ID = 'editor.contrib.showCurrentMarkerInStatusbar';
|
||||
|
||||
private readonly rendererDisposable: MutableDisposable<ShowCurrentMarkerInStatusbarRenderer>;
|
||||
|
||||
constructor(
|
||||
private readonly editor: ICodeEditor,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService
|
||||
) {
|
||||
super();
|
||||
this.rendererDisposable = new MutableDisposable<ShowCurrentMarkerInStatusbarRenderer>();
|
||||
this.onDidConfigurationChange();
|
||||
this._register(Event.filter(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('problems.showCurrentInStatus'))(() => this.onDidConfigurationChange()));
|
||||
}
|
||||
|
||||
private onDidConfigurationChange(): void {
|
||||
this.rendererDisposable.clear();
|
||||
if (this.configurationService.getValue<boolean>('problems.showCurrentInStatus')) {
|
||||
this.rendererDisposable.value = this.instantiationService.createInstance(ShowCurrentMarkerInStatusbarRenderer, this.editor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ShowCurrentMarkerInStatusbarRenderer extends Disposable {
|
||||
|
||||
private readonly statusBarEntryAccessor: MutableDisposable<IStatusbarEntryAccessor>;
|
||||
private markers: IMarker[] = [];
|
||||
private currentMarker: IMarker | null = null;
|
||||
|
||||
constructor(
|
||||
private readonly editor: ICodeEditor,
|
||||
@IStatusbarService private readonly statusbarService: IStatusbarService,
|
||||
@IMarkerService private readonly markerService: IMarkerService
|
||||
) {
|
||||
super();
|
||||
this.statusBarEntryAccessor = this._register(new MutableDisposable<IStatusbarEntryAccessor>());
|
||||
this._register(markerService.onMarkerChanged(changedResources => this.onMarkerChanged(changedResources)));
|
||||
this._register(editor.onDidChangeModel(() => this.updateMarkers()));
|
||||
this._register(editor.onDidChangeCursorPosition(() => this.render()));
|
||||
this.render();
|
||||
}
|
||||
|
||||
private render(): void {
|
||||
const previousMarker = this.currentMarker;
|
||||
this.currentMarker = this.getMarker();
|
||||
if (this.hasToUpdateStatus(previousMarker, this.currentMarker)) {
|
||||
this.updateStatus();
|
||||
}
|
||||
}
|
||||
|
||||
private hasToUpdateStatus(previousMarker: IMarker | null, currentMarker: IMarker | null): boolean {
|
||||
if (!currentMarker) {
|
||||
return true;
|
||||
}
|
||||
if (!previousMarker) {
|
||||
return true;
|
||||
}
|
||||
return IMarkerData.makeKey(previousMarker) !== IMarkerData.makeKey(currentMarker);
|
||||
}
|
||||
|
||||
private updateStatus(): void {
|
||||
if (this.currentMarker) {
|
||||
const line = this.currentMarker.message.split(/\r\n|\r|\n/g)[0];
|
||||
const text = `${this.getType(this.currentMarker)} ${line}`;
|
||||
if (this.statusBarEntryAccessor.value) {
|
||||
this.statusBarEntryAccessor.value.update({ text });
|
||||
} else {
|
||||
this.statusBarEntryAccessor.value = this.statusbarService.addEntry({ text }, 'statusbar.currentProblem', localize('currentProblem', "Current Problem"), StatusbarAlignment.LEFT);
|
||||
}
|
||||
} else {
|
||||
this.statusBarEntryAccessor.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private getType(marker: IMarker): string {
|
||||
switch (marker.severity) {
|
||||
case MarkerSeverity.Error: return '$(error)';
|
||||
case MarkerSeverity.Warning: return '$(warning)';
|
||||
case MarkerSeverity.Info: return '$(info)';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
private getMarker(): IMarker | null {
|
||||
const model = this.editor.getModel();
|
||||
if (!model) {
|
||||
return null;
|
||||
}
|
||||
const position = this.editor.getPosition();
|
||||
if (!position) {
|
||||
return null;
|
||||
}
|
||||
return find(this.markers, marker => Range.containsPosition(marker, position)) || null;
|
||||
}
|
||||
|
||||
private onMarkerChanged(changedResources: ReadonlyArray<URI>): void {
|
||||
const editorModel = this.editor.getModel();
|
||||
if (editorModel && !changedResources.some(r => isEqual(editorModel.uri, r))) {
|
||||
return;
|
||||
}
|
||||
this.updateMarkers();
|
||||
}
|
||||
|
||||
private updateMarkers(): void {
|
||||
const editorModel = this.editor.getModel();
|
||||
if (editorModel) {
|
||||
this.markers = this.markerService.read({
|
||||
resource: editorModel.uri,
|
||||
severities: MarkerSeverity.Error | MarkerSeverity.Warning | MarkerSeverity.Info
|
||||
});
|
||||
this.markers.sort(compareMarker);
|
||||
} else {
|
||||
this.markers = [];
|
||||
}
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
|
||||
function compareMarker(a: IMarker, b: IMarker): number {
|
||||
let res = compare(a.resource.toString(), b.resource.toString());
|
||||
if (res === 0) {
|
||||
res = MarkerSeverity.compare(a.severity, b.severity);
|
||||
}
|
||||
if (res === 0) {
|
||||
res = Range.compareRangesUsingStarts(a, b);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
registerEditorContribution(ShowCurrentMarkerInStatusbarContribution.ID, ShowCurrentMarkerInStatusbarContribution);
|
||||
|
|
|
@ -18,11 +18,6 @@ import { ResourceMap } from 'vs/base/common/map';
|
|||
|
||||
export const IMarkersWorkbenchService = createDecorator<IMarkersWorkbenchService>('markersWorkbenchService');
|
||||
|
||||
export interface IFilter {
|
||||
filterText: string;
|
||||
useFilesExclude: boolean;
|
||||
}
|
||||
|
||||
export interface IMarkersWorkbenchService {
|
||||
_serviceBrand: undefined;
|
||||
readonly markersModel: MarkersModel;
|
||||
|
|
|
@ -16,6 +16,7 @@ export default class Messages {
|
|||
|
||||
public static PROBLEMS_PANEL_CONFIGURATION_TITLE: string = nls.localize('problems.panel.configuration.title', "Problems View");
|
||||
public static PROBLEMS_PANEL_CONFIGURATION_AUTO_REVEAL: string = nls.localize('problems.panel.configuration.autoreveal', "Controls whether Problems view should automatically reveal files when opening them.");
|
||||
public static PROBLEMS_PANEL_CONFIGURATION_SHOW_CURRENT_STATUS: string = nls.localize('problems.panel.configuration.showCurrentInStatus', "When enabled shows the current problem in the status bar.");
|
||||
|
||||
public static MARKERS_PANEL_TITLE_PROBLEMS: string = nls.localize('markers.panel.title.problems', "Problems");
|
||||
|
||||
|
|
|
@ -5623,10 +5623,10 @@ napi-build-utils@^1.0.1:
|
|||
resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.1.tgz#1381a0f92c39d66bf19852e7873432fc2123e508"
|
||||
integrity sha512-boQj1WFgQH3v4clhu3mTNfP+vOBxorDlE8EKiMjUlLG3C4qAESnn9AxIOkFgTR2c9LtzNjPrjS60cT27ZKBhaA==
|
||||
|
||||
native-is-elevated@0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/native-is-elevated/-/native-is-elevated-0.3.0.tgz#6c5d8f57daeec129abd03b5606a55e56e4337423"
|
||||
integrity sha512-QJgU7vaCZ199PSEC4LAmwtGfqwGaz8a51YDeze3DPiRzcOq25LIQpxCbBWunIu+csMMHFsDuyO2OVfeSD4ioHQ==
|
||||
native-is-elevated@0.4.1:
|
||||
version "0.4.1"
|
||||
resolved "https://registry.yarnpkg.com/native-is-elevated/-/native-is-elevated-0.4.1.tgz#f6391aafb13441f5b949b39ae0b466b06e7f3986"
|
||||
integrity sha512-2vBXCXCXYKLDjP0WzrXs/AFjDb2njPR31EbGiZ1mR2fMJg211xClK1Xm19RXve35kvAL4dBKOFGCMIyc2+pPsw==
|
||||
|
||||
native-keymap@2.0.0:
|
||||
version "2.0.0"
|
||||
|
|
Loading…
Reference in a new issue