mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 01:25:39 -05:00
Isolate features (#6792)
* working; new query and scripting * working; removing manage from menus and combining data explorer contributions * consolidate dashboard contributions; move manage action to dashboard contributions; make groupings the same * fix notebook actions * fix tests
This commit is contained in:
@@ -14,7 +14,6 @@ import { KeyMod, KeyCode, KeyChord } from 'vs/base/common/keyCodes';
|
||||
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { ContextKeyExpr, ContextKeyEqualsExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { isMacintosh } from 'vs/base/common/platform';
|
||||
|
||||
import { QueryEditor } from 'sql/workbench/parts/query/browser/queryEditor';
|
||||
import { QueryResultsEditor } from 'sql/workbench/parts/query/browser/queryResultsEditor';
|
||||
@@ -34,6 +33,9 @@ import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } fr
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { TimeElapsedStatusBarContributions, RowCountStatusBarContributions, QueryStatusStatusBarContributions } from 'sql/workbench/parts/query/browser/statusBarItems';
|
||||
import { SqlFlavorStatusbarItem } from 'sql/workbench/parts/query/browser/flavorStatus';
|
||||
import { NewQueryTask, OE_NEW_QUERY_ACTION_ID, DE_NEW_QUERY_COMMAND_ID } from 'sql/workbench/parts/query/browser/queryActions';
|
||||
import { TreeNodeContextKey } from 'sql/workbench/parts/objectExplorer/common/treeNodeContextKey';
|
||||
import { MssqlNodeContext } from 'sql/workbench/parts/dataExplorer/common/mssqlNodeContext';
|
||||
|
||||
const gridCommandsWeightBonus = 100; // give our commands a little bit more weight over other default list/tree commands
|
||||
|
||||
@@ -61,7 +63,30 @@ const queryEditorDescriptor = new EditorDescriptor(
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(queryEditorDescriptor, [new SyncDescriptor(QueryInput)]);
|
||||
|
||||
let actionRegistry = <IWorkbenchActionRegistry>Registry.as(Extensions.WorkbenchActions);
|
||||
const actionRegistry = <IWorkbenchActionRegistry>Registry.as(Extensions.WorkbenchActions);
|
||||
|
||||
new NewQueryTask().registerTask();
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.ObjectExplorerItemContext, {
|
||||
group: '0_query',
|
||||
order: 0,
|
||||
command: {
|
||||
id: OE_NEW_QUERY_ACTION_ID,
|
||||
title: localize('newQuery', "New Query")
|
||||
},
|
||||
when: ContextKeyExpr.or(ContextKeyExpr.and(TreeNodeContextKey.Status.notEqualsTo('Unavailable'), TreeNodeContextKey.NodeType.isEqualTo('Server')), ContextKeyExpr.and(TreeNodeContextKey.Status.notEqualsTo('Unavailable'), TreeNodeContextKey.NodeType.isEqualTo('Database')))
|
||||
});
|
||||
|
||||
// New Query
|
||||
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
||||
group: '0_query',
|
||||
order: 0,
|
||||
command: {
|
||||
id: DE_NEW_QUERY_COMMAND_ID,
|
||||
title: localize('newQuery', "New Query")
|
||||
},
|
||||
when: MssqlNodeContext.IsDatabaseOrServer
|
||||
});
|
||||
|
||||
// Query Actions
|
||||
actionRegistry.registerWorkbenchAction(
|
||||
@@ -74,15 +99,12 @@ actionRegistry.registerWorkbenchAction(
|
||||
RunQueryKeyboardAction.LABEL
|
||||
);
|
||||
|
||||
// Touch Bar
|
||||
if (isMacintosh) {
|
||||
// Only show Run Query if the active editor is a query editor.
|
||||
MenuRegistry.appendMenuItem(MenuId.TouchBarContext, {
|
||||
command: { id: RunQueryKeyboardAction.ID, title: RunQueryKeyboardAction.LABEL },
|
||||
group: 'query',
|
||||
when: ContextKeyEqualsExpr.create('activeEditor', 'workbench.editor.queryEditor')
|
||||
});
|
||||
}
|
||||
// Only show Run Query if the active editor is a query editor.
|
||||
MenuRegistry.appendMenuItem(MenuId.TouchBarContext, {
|
||||
command: { id: RunQueryKeyboardAction.ID, title: RunQueryKeyboardAction.LABEL },
|
||||
group: 'query',
|
||||
when: ContextKeyEqualsExpr.create('activeEditor', 'workbench.editor.queryEditor')
|
||||
});
|
||||
|
||||
actionRegistry.registerWorkbenchAction(
|
||||
new SyncActionDescriptor(
|
||||
@@ -260,7 +282,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
});
|
||||
|
||||
// Intellisense and other configuration options
|
||||
let registryProperties = {
|
||||
const registryProperties = {
|
||||
'sql.saveAsCsv.includeHeaders': {
|
||||
'type': 'boolean',
|
||||
'description': localize('sql.saveAsCsv.includeHeaders', "[Optional] When true, column headers are included when saving results as CSV"),
|
||||
@@ -480,7 +502,7 @@ let registryProperties = {
|
||||
};
|
||||
|
||||
// Setup keybindings
|
||||
let initialShortcuts = [
|
||||
const initialShortcuts = [
|
||||
{ name: 'sp_help', primary: KeyMod.Alt + KeyCode.F2 },
|
||||
// Note: using Ctrl+Shift+N since Ctrl+N is used for "open editor at index" by default. This means it's different from SSMS
|
||||
{ name: 'sp_who', primary: KeyMod.WinCtrl + KeyMod.Shift + KeyCode.KEY_1 },
|
||||
@@ -512,7 +534,7 @@ for (let i = 0; i < 9; i++) {
|
||||
}
|
||||
|
||||
// Register the query-related configuration options
|
||||
let configurationRegistry = <IConfigurationRegistry>Registry.as(ConfigExtensions.Configuration);
|
||||
const configurationRegistry = <IConfigurationRegistry>Registry.as(ConfigExtensions.Configuration);
|
||||
configurationRegistry.registerConfiguration({
|
||||
'id': 'sqlEditor',
|
||||
'title': 'SQL Editor',
|
||||
|
||||
Reference in New Issue
Block a user