mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-21 20:30:29 -04:00
Vscode merge (#4582)
* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd * fix issues with merges * bump node version in azpipe * replace license headers * remove duplicate launch task * fix build errors * fix build errors * fix tslint issues * working through package and linux build issues * more work * wip * fix packaged builds * working through linux build errors * wip * wip * wip * fix mac and linux file limits * iterate linux pipeline * disable editor typing * revert series to parallel * remove optimize vscode from linux * fix linting issues * revert testing change * add work round for new node * readd packaging for extensions * fix issue with angular not resolving decorator dependencies
This commit is contained in:
@@ -25,17 +25,18 @@ import { DefinitionAction, DefinitionActionConfig } from './goToDefinitionComman
|
||||
import { ClickLinkGesture, ClickLinkMouseEvent, ClickLinkKeyboardEvent } from 'vs/editor/contrib/goToDefinition/clickLinkGesture';
|
||||
import { IWordAtPosition, IModelDeltaDecoration, ITextModel, IFoundBracket } from 'vs/editor/common/model';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
|
||||
class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorContribution {
|
||||
|
||||
private static readonly ID = 'editor.contrib.gotodefinitionwithmouse';
|
||||
static MAX_SOURCE_PREVIEW_LINES = 8;
|
||||
|
||||
private editor: ICodeEditor;
|
||||
private readonly editor: ICodeEditor;
|
||||
private toUnhook: IDisposable[];
|
||||
private decorations: string[];
|
||||
private currentWordUnderMouse: IWordAtPosition;
|
||||
private previousPromise: CancelablePromise<LocationLink[]>;
|
||||
private currentWordUnderMouse: IWordAtPosition | null;
|
||||
private previousPromise: CancelablePromise<LocationLink[] | null> | null;
|
||||
|
||||
constructor(
|
||||
editor: ICodeEditor,
|
||||
@@ -51,7 +52,7 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC
|
||||
this.toUnhook.push(linkGesture);
|
||||
|
||||
this.toUnhook.push(linkGesture.onMouseMoveOrRelevantKeyDown(([mouseEvent, keyboardEvent]) => {
|
||||
this.startFindDefinition(mouseEvent, keyboardEvent);
|
||||
this.startFindDefinition(mouseEvent, withNullAsUndefined(keyboardEvent));
|
||||
}));
|
||||
|
||||
this.toUnhook.push(linkGesture.onExecute((mouseEvent: ClickLinkMouseEvent) => {
|
||||
@@ -79,20 +80,20 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.isEnabled(mouseEvent, withKey)) {
|
||||
if (!this.editor.hasModel() || !this.isEnabled(mouseEvent, withKey)) {
|
||||
this.currentWordUnderMouse = null;
|
||||
this.removeDecorations();
|
||||
return;
|
||||
}
|
||||
|
||||
// Find word at mouse position
|
||||
let position = mouseEvent.target.position;
|
||||
let word = position ? this.editor.getModel().getWordAtPosition(position) : null;
|
||||
const word = mouseEvent.target.position ? this.editor.getModel().getWordAtPosition(mouseEvent.target.position) : null;
|
||||
if (!word) {
|
||||
this.currentWordUnderMouse = null;
|
||||
this.removeDecorations();
|
||||
return;
|
||||
}
|
||||
const position = mouseEvent.target.position!;
|
||||
|
||||
// Return early if word at position is still the same
|
||||
if (this.currentWordUnderMouse && this.currentWordUnderMouse.startColumn === word.startColumn && this.currentWordUnderMouse.endColumn === word.endColumn && this.currentWordUnderMouse.word === word.word) {
|
||||
@@ -158,9 +159,10 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC
|
||||
wordRange = new Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn);
|
||||
}
|
||||
|
||||
const modeId = this.modeService.getModeIdByFilepathOrFirstLine(textEditorModel.uri.fsPath);
|
||||
this.addDecoration(
|
||||
wordRange,
|
||||
new MarkdownString().appendCodeblock(this.modeService.getModeIdByFilepathOrFirstLine(textEditorModel.uri.fsPath), previewValue)
|
||||
new MarkdownString().appendCodeblock(modeId ? modeId : '', previewValue)
|
||||
);
|
||||
ref.dispose();
|
||||
});
|
||||
@@ -274,10 +276,10 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC
|
||||
}
|
||||
|
||||
private isEnabled(mouseEvent: ClickLinkMouseEvent, withKey?: ClickLinkKeyboardEvent): boolean {
|
||||
return this.editor.getModel() &&
|
||||
return this.editor.hasModel() &&
|
||||
mouseEvent.isNoneOrSingleMouseDown &&
|
||||
(mouseEvent.target.type === MouseTargetType.CONTENT_TEXT) &&
|
||||
(mouseEvent.hasTriggerModifier || (withKey && withKey.keyCodeIsTriggerKey)) &&
|
||||
(mouseEvent.hasTriggerModifier || (withKey ? withKey.keyCodeIsTriggerKey : false)) &&
|
||||
DefinitionProviderRegistry.has(this.editor.getModel());
|
||||
}
|
||||
|
||||
@@ -287,12 +289,12 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
return getDefinitionsAtPosition(model, target.position, token);
|
||||
return getDefinitionsAtPosition(model, target.position!, token);
|
||||
}
|
||||
|
||||
private gotoDefinition(target: IMouseTarget, sideBySide: boolean): Promise<any> {
|
||||
this.editor.setPosition(target.position);
|
||||
const action = new DefinitionAction(new DefinitionActionConfig(sideBySide, false, true, false), { alias: undefined, label: undefined, id: undefined, precondition: undefined });
|
||||
this.editor.setPosition(target.position!);
|
||||
const action = new DefinitionAction(new DefinitionActionConfig(sideBySide, false, true, false), { alias: '', label: '', id: '', precondition: null });
|
||||
return this.editor.invokeWithinContext(accessor => action.run(accessor, this.editor));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user