mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 18:22:34 -05:00
Merge from vscode cfc1ab4c5f816765b91fb7ead3c3427a7c8581a3
This commit is contained in:
@@ -9,6 +9,7 @@ import './diffEditorHelper';
|
||||
import './inspectKeybindings';
|
||||
import './largeFileOptimizations';
|
||||
import './inspectEditorTokens/inspectEditorTokens';
|
||||
import './quickaccess/gotoLineQuickAccess';
|
||||
import './saveParticipants';
|
||||
import './toggleColumnSelection';
|
||||
import './toggleMinimap';
|
||||
|
||||
@@ -16,7 +16,7 @@ import { SimpleButton } from 'vs/editor/contrib/find/findWidget';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { editorWidgetBackground, inputActiveOptionBorder, inputActiveOptionBackground, inputBackground, inputBorder, inputForeground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationWarningForeground, widgetShadow, editorWidgetForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { ITheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { IColorTheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { ContextScopedFindInput } from 'vs/platform/browser/contextScopedHistoryWidget';
|
||||
|
||||
const NLS_FIND_INPUT_LABEL = nls.localize('label.find', "Find");
|
||||
@@ -165,7 +165,7 @@ export abstract class SimpleFindWidget extends Widget {
|
||||
return this._focusTracker;
|
||||
}
|
||||
|
||||
public updateTheme(theme: ITheme): void {
|
||||
public updateTheme(theme: IColorTheme): void {
|
||||
const inputStyles: IFindInputStyles = {
|
||||
inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder),
|
||||
inputActiveOptionBackground: theme.getColor(inputActiveOptionBackground),
|
||||
|
||||
@@ -501,7 +501,7 @@ class InspectEditorTokensWidget extends Disposable implements IContentWidget {
|
||||
const range = new Range(line + 1, character + 1, line + 1, character + 1 + len);
|
||||
const definitions = {};
|
||||
const colorMap = this._themeService.getColorTheme().tokenColorMap;
|
||||
const theme = this._themeService.getTheme() as ColorThemeData;
|
||||
const theme = this._themeService.getColorTheme() as ColorThemeData;
|
||||
const tokenStyle = theme.getTokenStyleMetadata(type, modifiers, true, definitions);
|
||||
|
||||
let metadata: IDecodedMetadata | undefined = undefined;
|
||||
@@ -528,7 +528,7 @@ class InspectEditorTokensWidget extends Disposable implements IContentWidget {
|
||||
if (definition === undefined) {
|
||||
return '';
|
||||
}
|
||||
const theme = this._themeService.getTheme() as ColorThemeData;
|
||||
const theme = this._themeService.getColorTheme() as ColorThemeData;
|
||||
|
||||
const isTokenStylingRule = (d: any): d is TokenStylingRule => !!d.value;
|
||||
if (Array.isArray(definition)) {
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { IKeyMods } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { IEditor } from 'vs/editor/common/editorCommon';
|
||||
import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { AbstractGotoLineQuickAccessProvider } from 'vs/editor/contrib/quickAccess/gotoLine';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IQuickAccessRegistry, Extensions } from 'vs/platform/quickinput/common/quickAccess';
|
||||
|
||||
export class GotoLineQuickAccessProvider extends AbstractGotoLineQuickAccessProvider {
|
||||
|
||||
readonly onDidActiveTextEditorControlChange = this.editorService.onDidActiveEditorChange;
|
||||
|
||||
constructor(@IEditorService private readonly editorService: IEditorService) {
|
||||
super();
|
||||
}
|
||||
|
||||
get activeTextEditorControl() {
|
||||
return this.editorService.activeTextEditorControl;
|
||||
}
|
||||
|
||||
protected gotoLine(editor: IEditor, range: IRange, keyMods: IKeyMods): void {
|
||||
|
||||
// Check for sideBySide use
|
||||
if (keyMods.ctrlCmd && this.editorService.activeEditor) {
|
||||
this.editorService.openEditor(this.editorService.activeEditor, { selection: range, pinned: keyMods.alt }, SIDE_GROUP);
|
||||
}
|
||||
|
||||
// Otherwise let parent handle it
|
||||
else {
|
||||
super.gotoLine(editor, range, keyMods);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Registry.as<IQuickAccessRegistry>(Extensions.Quickaccess).registerQuickAccessProvider({
|
||||
ctor: GotoLineQuickAccessProvider,
|
||||
prefix: AbstractGotoLineQuickAccessProvider.PREFIX,
|
||||
placeholder: localize('gotoLineQuickAccessPlaceholder', "Type the line number and optional column to go to (e.g. 42:5 for line 42 and column 5)."),
|
||||
helpEntries: [{ description: localize('gotoLineQuickAccess', "Go to Line"), needsEditor: true }]
|
||||
});
|
||||
@@ -55,7 +55,7 @@ class NotebookUpdateParticipant implements ITextFileSaveParticipant { // {{SQL C
|
||||
}
|
||||
}
|
||||
|
||||
class TrimWhitespaceParticipant implements ITextFileSaveParticipant {
|
||||
export class TrimWhitespaceParticipant implements ITextFileSaveParticipant {
|
||||
|
||||
constructor(
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { FinalNewLineParticipant, TrimFinalNewLinesParticipant } from 'vs/workbench/contrib/codeEditor/browser/saveParticipants';
|
||||
import { FinalNewLineParticipant, TrimFinalNewLinesParticipant, TrimWhitespaceParticipant } from 'vs/workbench/contrib/codeEditor/browser/saveParticipants';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { workbenchInstantiationService, TestServiceAccessor } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { toResource } from 'vs/base/test/common/utils';
|
||||
@@ -16,7 +16,7 @@ import { IResolvedTextFileEditorModel, snapshotToString } from 'vs/workbench/ser
|
||||
import { SaveReason } from 'vs/workbench/common/editor';
|
||||
import { TextFileEditorModelManager } from 'vs/workbench/services/textfile/common/textFileEditorModelManager';
|
||||
|
||||
suite('MainThreadSaveParticipant', function () {
|
||||
suite('Save Participants', function () {
|
||||
|
||||
let instantiationService: IInstantiationService;
|
||||
let accessor: TestServiceAccessor;
|
||||
@@ -151,4 +151,24 @@ suite('MainThreadSaveParticipant', function () {
|
||||
model.textEditorModel.redo();
|
||||
assert.equal(snapshotToString(model.createSnapshot()!), `${textContent}${eol}`);
|
||||
});
|
||||
|
||||
test('trim whitespace', async function () {
|
||||
const model = instantiationService.createInstance(TextFileEditorModel, toResource.call(this, '/path/trim_final_new_line.txt'), 'utf8', undefined) as IResolvedTextFileEditorModel;
|
||||
|
||||
await model.load();
|
||||
const configService = new TestConfigurationService();
|
||||
configService.setUserConfiguration('files', { 'trimTrailingWhitespace': true });
|
||||
const participant = new TrimWhitespaceParticipant(configService, undefined!);
|
||||
const textContent = 'Test';
|
||||
let content = `${textContent} `;
|
||||
model.textEditorModel.setValue(content);
|
||||
|
||||
// save many times
|
||||
for (let i = 0; i < 10; i++) {
|
||||
await participant.participate(model, { reason: SaveReason.EXPLICIT });
|
||||
}
|
||||
|
||||
// confirm trimming
|
||||
assert.equal(snapshotToString(model.createSnapshot()!), `${textContent}`);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user