mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-20 12:00:24 -04:00
Merge from vscode 5e80bf449c995aa32a59254c0ff845d37da11b70 (#9317)
This commit is contained in:
@@ -19,7 +19,7 @@ import { FoldingDecorationProvider } from './foldingDecorations';
|
||||
import { FoldingRegions, FoldingRegion } from './foldingRanges';
|
||||
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
|
||||
import { ConfigurationChangedEvent, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import { IMarginData } from 'vs/editor/browser/controller/mouseTarget';
|
||||
import { IMarginData, IEmptyContentData } from 'vs/editor/browser/controller/mouseTarget';
|
||||
import { HiddenRangeModel } from 'vs/editor/contrib/folding/hiddenRangeModel';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
@@ -62,6 +62,7 @@ export class FoldingController extends Disposable implements IEditorContribution
|
||||
private readonly editor: ICodeEditor;
|
||||
private _isEnabled: boolean;
|
||||
private _useFoldingProviders: boolean;
|
||||
private _unfoldOnClickInEmptyContent: boolean;
|
||||
|
||||
private readonly foldingDecorationProvider: FoldingDecorationProvider;
|
||||
|
||||
@@ -91,6 +92,7 @@ export class FoldingController extends Disposable implements IEditorContribution
|
||||
const options = this.editor.getOptions();
|
||||
this._isEnabled = options.get(EditorOption.folding);
|
||||
this._useFoldingProviders = options.get(EditorOption.foldingStrategy) !== 'indentation';
|
||||
this._unfoldOnClickInEmptyContent = options.get(EditorOption.unfoldOnClickInEmptyContent);
|
||||
|
||||
this.foldingModel = null;
|
||||
this.hiddenRangeModel = null;
|
||||
@@ -128,6 +130,9 @@ export class FoldingController extends Disposable implements IEditorContribution
|
||||
this._useFoldingProviders = options.get(EditorOption.foldingStrategy) !== 'indentation';
|
||||
this.onFoldingStrategyChanged();
|
||||
}
|
||||
if (e.hasChanged(EditorOption.unfoldOnClickInEmptyContent)) {
|
||||
this._unfoldOnClickInEmptyContent = options.get(EditorOption.unfoldOnClickInEmptyContent);
|
||||
}
|
||||
}));
|
||||
this.onModelChanged();
|
||||
}
|
||||
@@ -364,6 +369,15 @@ export class FoldingController extends Disposable implements IEditorContribution
|
||||
|
||||
iconClicked = true;
|
||||
break;
|
||||
case MouseTargetType.CONTENT_EMPTY: {
|
||||
if (this._unfoldOnClickInEmptyContent && this.hiddenRangeModel.hasRanges()) {
|
||||
const data = e.target.detail as IEmptyContentData;
|
||||
if (!data.isAfterLines) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
case MouseTargetType.CONTENT_TEXT: {
|
||||
if (this.hiddenRangeModel.hasRanges()) {
|
||||
let model = this.editor.getModel();
|
||||
|
||||
@@ -397,7 +397,7 @@ class MarkerNavigationAction extends EditorAction {
|
||||
|
||||
return editorService.openCodeEditor({
|
||||
resource: newMarker.resource,
|
||||
options: { pinned: false, revealIfOpened: true, selectionRevealType: TextEditorSelectionRevealType.CenterIfOutsideViewport, selection: newMarker }
|
||||
options: { pinned: false, revealIfOpened: true, selectionRevealType: TextEditorSelectionRevealType.NearTop, selection: newMarker }
|
||||
}, editor).then(editor => {
|
||||
if (!editor) {
|
||||
return undefined;
|
||||
|
||||
@@ -52,11 +52,11 @@ class MessageWidget {
|
||||
|
||||
const domNode = document.createElement('div');
|
||||
domNode.className = 'descriptioncontainer';
|
||||
domNode.setAttribute('aria-live', 'assertive');
|
||||
domNode.setAttribute('role', 'alert');
|
||||
|
||||
this._messageBlock = document.createElement('div');
|
||||
dom.addClass(this._messageBlock, 'message');
|
||||
this._messageBlock.setAttribute('aria-live', 'assertive');
|
||||
this._messageBlock.setAttribute('role', 'alert');
|
||||
domNode.appendChild(this._messageBlock);
|
||||
|
||||
this._relatedBlock = document.createElement('div');
|
||||
@@ -88,7 +88,8 @@ class MessageWidget {
|
||||
dispose(this._disposables);
|
||||
}
|
||||
|
||||
update({ source, message, relatedInformation, code }: IMarker): void {
|
||||
update(marker: IMarker): void {
|
||||
const { source, message, relatedInformation, code } = marker;
|
||||
let sourceAndCodeLength = (source?.length || 0) + '()'.length;
|
||||
if (code) {
|
||||
if (typeof code === 'string') {
|
||||
@@ -106,6 +107,7 @@ class MessageWidget {
|
||||
}
|
||||
|
||||
dom.clearNode(this._messageBlock);
|
||||
this._messageBlock.setAttribute('aria-label', this.getAriaLabel(marker));
|
||||
this._editor.applyFontInfo(this._messageBlock);
|
||||
let lastLineElement = this._messageBlock;
|
||||
for (const line of lines) {
|
||||
@@ -192,6 +194,32 @@ class MessageWidget {
|
||||
getHeightInLines(): number {
|
||||
return Math.min(17, this._lines);
|
||||
}
|
||||
|
||||
private getAriaLabel(marker: IMarker): string {
|
||||
let severityLabel = '';
|
||||
switch (marker.severity) {
|
||||
case MarkerSeverity.Error:
|
||||
severityLabel = nls.localize('Error', "Error");
|
||||
break;
|
||||
case MarkerSeverity.Warning:
|
||||
severityLabel = nls.localize('Warning', "Warning");
|
||||
break;
|
||||
case MarkerSeverity.Info:
|
||||
severityLabel = nls.localize('Info', "Info");
|
||||
break;
|
||||
case MarkerSeverity.Hint:
|
||||
severityLabel = nls.localize('Hint', "Hint");
|
||||
break;
|
||||
}
|
||||
|
||||
let ariaLabel = nls.localize('marker aria', "{0} at {1}. ", severityLabel, marker.startLineNumber + ':' + marker.startColumn);
|
||||
const model = this._editor.getModel();
|
||||
if (model && (marker.startLineNumber <= model.getLineCount()) && (marker.startLineNumber >= 1)) {
|
||||
const lineContent = model.getLineContent(marker.startLineNumber);
|
||||
ariaLabel = `${lineContent}, ${ariaLabel}`;
|
||||
}
|
||||
return ariaLabel;
|
||||
}
|
||||
}
|
||||
|
||||
export class MarkerNavigationWidget extends PeekViewWidget {
|
||||
@@ -316,7 +344,7 @@ export class MarkerNavigationWidget extends PeekViewWidget {
|
||||
}
|
||||
this._icon.className = `codicon ${SeverityIcon.className(MarkerSeverity.toSeverity(this._severity))}`;
|
||||
|
||||
this.editor.revealPositionInCenter(position, ScrollType.Smooth);
|
||||
this.editor.revealPositionNearTop(position, ScrollType.Smooth);
|
||||
this.editor.focus();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user