mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode 0a7364f00514c46c9caceece15e1f82f82e3712f
This commit is contained in:
@@ -419,7 +419,7 @@ export function registerModelAndPositionCommand(id: string, handler: (model: ITe
|
||||
const model = accessor.get(IModelService).getModel(resource);
|
||||
if (model) {
|
||||
const editorPosition = Position.lift(position);
|
||||
return handler(model, editorPosition, args.slice(2));
|
||||
return handler(model, editorPosition, ...args.slice(2));
|
||||
}
|
||||
|
||||
return accessor.get(ITextModelService).createModelReference(resource).then(reference => {
|
||||
|
||||
@@ -381,7 +381,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements IC
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (typeof baseValue === 'object' && typeof subsetValue === 'object') {
|
||||
if (baseValue && typeof baseValue === 'object' && subsetValue && typeof subsetValue === 'object') {
|
||||
if (!this._subsetEquals(baseValue, subsetValue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2576,9 +2576,9 @@ class EditorPixelRatio extends ComputedEditorOption<EditorOption.pixelRatio, num
|
||||
* Configuration options for quick suggestions
|
||||
*/
|
||||
export interface IQuickSuggestionsOptions {
|
||||
other: boolean;
|
||||
comments: boolean;
|
||||
strings: boolean;
|
||||
other?: boolean;
|
||||
comments?: boolean;
|
||||
strings?: boolean;
|
||||
}
|
||||
|
||||
export type ValidQuickSuggestionsOptions = boolean | Readonly<Required<IQuickSuggestionsOptions>>;
|
||||
|
||||
@@ -153,9 +153,14 @@ export class LanguagesRegistry extends Disposable {
|
||||
}
|
||||
|
||||
if (Array.isArray(lang.extensions)) {
|
||||
if (lang.configuration) {
|
||||
// insert first as this appears to be the 'primary' language definition
|
||||
resolvedLanguage.extensions = lang.extensions.concat(resolvedLanguage.extensions);
|
||||
} else {
|
||||
resolvedLanguage.extensions = resolvedLanguage.extensions.concat(lang.extensions);
|
||||
}
|
||||
for (let extension of lang.extensions) {
|
||||
mime.registerTextMime({ id: langId, mime: primaryMime, extension: extension }, this._warnOnOverwrite);
|
||||
resolvedLanguage.extensions.push(extension);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ export class ModesHoverController implements IEditorContribution {
|
||||
this._toUnhook.add(this._editor.onDidChangeModelDecorations(() => this._onModelDecorationsChanged()));
|
||||
} else {
|
||||
this._toUnhook.add(this._editor.onMouseMove(hideWidgetsEventHandler));
|
||||
this._toUnhook.add(this._editor.onKeyDown((e: IKeyboardEvent) => this._onKeyDown(e)));
|
||||
}
|
||||
|
||||
this._toUnhook.add(this._editor.onMouseLeave(hideWidgetsEventHandler));
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.monaco-editor .on-type-rename-decoration {
|
||||
background: rgba(255, 0, 0, 0.3);
|
||||
border-left: 1px solid rgba(255, 0, 0, 0.3);
|
||||
border-left: 1px solid transparent;
|
||||
/* So border can be transparent */
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { onUnexpectedError, onUnexpectedExternalError } from 'vs/base/common/errors';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
|
||||
export const CONTEXT_ONTYPE_RENAME_INPUT_VISIBLE = new RawContextKey<boolean>('onTypeRenameInputVisible', false);
|
||||
|
||||
@@ -360,6 +363,13 @@ export function getOnTypeRenameRanges(model: ITextModel, position: Position, tok
|
||||
}), result => !!result && arrays.isNonEmptyArray(result?.ranges));
|
||||
}
|
||||
|
||||
export const editorOnTypeRenameBackground = registerColor('editor.onTypeRenameBackground', { dark: Color.fromHex('#f00').transparent(0.3), light: Color.fromHex('#f00').transparent(0.3), hc: Color.fromHex('#f00').transparent(0.3) }, nls.localize('editorOnTypeRenameBackground', 'Background color when the editor auto renames on type.'));
|
||||
registerThemingParticipant((theme, collector) => {
|
||||
const editorOnTypeRenameBackgroundColor = theme.getColor(editorOnTypeRenameBackground);
|
||||
if (editorOnTypeRenameBackgroundColor) {
|
||||
collector.addRule(`.monaco-editor .on-type-rename-decoration { background: ${editorOnTypeRenameBackgroundColor}; border-left-color: ${editorOnTypeRenameBackgroundColor}; }`);
|
||||
}
|
||||
});
|
||||
|
||||
registerModelAndPositionCommand('_executeRenameOnTypeProvider', (model, position) => getOnTypeRenameRanges(model, position, CancellationToken.None));
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { illegalArgument, onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { registerEditorAction, registerEditorContribution, ServicesAccessor, EditorAction, EditorCommand, registerEditorCommand, registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions';
|
||||
import { registerEditorAction, registerEditorContribution, ServicesAccessor, EditorAction, EditorCommand, registerEditorCommand, registerModelAndPositionCommand } from 'vs/editor/browser/editorExtensions';
|
||||
import { IEditorContribution } from 'vs/editor/common/editorCommon';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
|
||||
@@ -33,6 +33,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IConfigurationRegistry, ConfigurationScope, Extensions } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { assertType } from 'vs/base/common/types';
|
||||
|
||||
class RenameSkeleton {
|
||||
|
||||
@@ -350,11 +351,9 @@ registerEditorCommand(new RenameCommand({
|
||||
|
||||
// ---- api bridge command
|
||||
|
||||
registerDefaultLanguageCommand('_executeDocumentRenameProvider', function (model, position, args) {
|
||||
let { newName } = args;
|
||||
if (typeof newName !== 'string') {
|
||||
throw illegalArgument('newName');
|
||||
}
|
||||
registerModelAndPositionCommand('_executeDocumentRenameProvider', function (model, position, ...args) {
|
||||
const [newName] = args;
|
||||
assertType(typeof newName === 'string');
|
||||
return rename(model, position, newName);
|
||||
});
|
||||
|
||||
|
||||
@@ -211,4 +211,15 @@ suite('Common Editor Config', () => {
|
||||
strings: false
|
||||
});
|
||||
});
|
||||
|
||||
test('issue #102920: Can\'t snap or split view with JSON files', () => {
|
||||
const config = new TestConfiguration({ quickSuggestions: null! });
|
||||
config.updateOptions({ quickSuggestions: { strings: true } });
|
||||
const actual = <Readonly<Required<IQuickSuggestionsOptions>>>config.options.get(EditorOption.quickSuggestions);
|
||||
assert.deepEqual(actual, {
|
||||
other: true,
|
||||
comments: false,
|
||||
strings: true
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -221,6 +221,32 @@ suite('LanguagesRegistry', () => {
|
||||
assert.deepEqual(registry.getExtensions('aName'), ['aExt', 'aExt2']);
|
||||
});
|
||||
|
||||
test('extensions of primary language registration come first', () => {
|
||||
let registry = new LanguagesRegistry(false);
|
||||
|
||||
registry._registerLanguages([{
|
||||
id: 'a',
|
||||
extensions: ['aExt3']
|
||||
}]);
|
||||
|
||||
assert.deepEqual(registry.getExtensions('a')[0], 'aExt3');
|
||||
|
||||
registry._registerLanguages([{
|
||||
id: 'a',
|
||||
configuration: URI.file('conf.json'),
|
||||
extensions: ['aExt']
|
||||
}]);
|
||||
|
||||
assert.deepEqual(registry.getExtensions('a')[0], 'aExt');
|
||||
|
||||
registry._registerLanguages([{
|
||||
id: 'a',
|
||||
extensions: ['aExt2']
|
||||
}]);
|
||||
|
||||
assert.deepEqual(registry.getExtensions('a')[0], 'aExt');
|
||||
});
|
||||
|
||||
test('filenames', () => {
|
||||
let registry = new LanguagesRegistry(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user