Column/Table Drag & Drop (#10702)

* able to drag objects from left pane

* changed scheme from file

* base functionality working

* extended functionality to tables

* added string literals and formatting

* cleanup

* cleanup

* added table/column parsing

* removed bad logic

* updated to use metadata

* cleanup and added sql carbon edit tags

* moved changes from vs into sql code base

* refactoring drag and drop

* cleanup

* cleanup

* cleanup

* added unit tests

* pr changes

* moved treeMock file

* fixed small bug
This commit is contained in:
Christopher Suh
2020-06-15 23:52:46 -04:00
committed by GitHub
parent 0f9f9c851e
commit 0c56e4a603
6 changed files with 169 additions and 17 deletions

View File

@@ -4,7 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/editordroptarget';
import { LocalSelectionTransfer, DraggedEditorIdentifier, ResourcesDropHandler, DraggedEditorGroupIdentifier, DragAndDropObserver, containsDragType } from 'vs/workbench/browser/dnd';
// {{SQL CARBON EDIT}}
import { LocalSelectionTransfer, DraggedEditorIdentifier, ResourcesDropHandler, DraggedEditorGroupIdentifier, DragAndDropObserver, containsDragType, extractResources } from 'vs/workbench/browser/dnd';
import { addDisposableListener, EventType, EventHelper, isAncestor, toggleClass, addClass, removeClass } from 'vs/base/browser/dom';
import { IEditorGroupsAccessor, EDITOR_TITLE_HEIGHT, IEditorGroupView, getActiveTextEditorOptions } from 'vs/workbench/browser/parts/editor/editor';
import { EDITOR_DRAG_AND_DROP_BACKGROUND } from 'vs/workbench/common/theme';
@@ -25,6 +26,9 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { assertIsDefined, assertAllDefined } from 'vs/base/common/types';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { localize } from 'vs/nls';
// {{SQL CARBON EDIT}}
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { SnippetController2 } from 'vs/editor/contrib/snippet/snippetController2';
interface IDropOperation {
splitDirection?: GroupDirection;
@@ -346,6 +350,20 @@ class DropOverlay extends Themable {
// Check for URI transfer
else {
const dropHandler = this.instantiationService.createInstance(ResourcesDropHandler, { allowWorkspaceOpen: true /* open workspace instead of file if dropped */ });
// {{SQL CARBON EDIT}}
const untitledOrFileResources = extractResources(event);
if (!untitledOrFileResources.length) {
return;
}
// {{SQL CARBON EDIT}}
const editor = this.editorService.activeTextEditorControl as ICodeEditor;
if (untitledOrFileResources[0].resource.scheme === 'Column' || untitledOrFileResources[0].resource.scheme === 'Table') {
SnippetController2.get(editor).insert(`[${untitledOrFileResources[0].resource.query}]`);
return;
}
dropHandler.handleDrop(event, () => ensureTargetGroup(), targetGroup => {
if (targetGroup) {
targetGroup.focus();