mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-27 07:10:30 -04:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -7,12 +7,13 @@
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
|
||||
import { TimeoutTimer } from 'vs/base/common/async';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ITextModel, IWordAtPosition } from 'vs/editor/common/model';
|
||||
import { ISuggestSupport, SuggestRegistry, StandardTokenType, SuggestTriggerKind, SuggestContext } from 'vs/editor/common/modes';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { provideSuggestionItems, getSuggestionComparator, ISuggestionItem } from './suggest';
|
||||
import { CompletionModel } from './completionModel';
|
||||
import { CursorChangeReason, ICursorSelectionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
|
||||
@@ -46,6 +47,7 @@ export class LineContext {
|
||||
}
|
||||
const pos = editor.getPosition();
|
||||
model.tokenizeIfCheap(pos.lineNumber);
|
||||
|
||||
const word = model.getWordAtPosition(pos);
|
||||
if (!word) {
|
||||
return false;
|
||||
@@ -92,12 +94,12 @@ export class SuggestModel implements IDisposable {
|
||||
|
||||
private _requestPromise: TPromise<void>;
|
||||
private _context: LineContext;
|
||||
private _currentPosition: Position;
|
||||
private _currentSelection: Selection;
|
||||
|
||||
private _completionModel: CompletionModel;
|
||||
private _onDidCancel: Emitter<ICancelEvent> = new Emitter<ICancelEvent>();
|
||||
private _onDidTrigger: Emitter<ITriggerEvent> = new Emitter<ITriggerEvent>();
|
||||
private _onDidSuggest: Emitter<ISuggestEvent> = new Emitter<ISuggestEvent>();
|
||||
private readonly _onDidCancel: Emitter<ICancelEvent> = new Emitter<ICancelEvent>();
|
||||
private readonly _onDidTrigger: Emitter<ITriggerEvent> = new Emitter<ITriggerEvent>();
|
||||
private readonly _onDidSuggest: Emitter<ISuggestEvent> = new Emitter<ISuggestEvent>();
|
||||
|
||||
readonly onDidCancel: Event<ICancelEvent> = this._onDidCancel.event;
|
||||
readonly onDidTrigger: Event<ITriggerEvent> = this._onDidTrigger.event;
|
||||
@@ -110,7 +112,7 @@ export class SuggestModel implements IDisposable {
|
||||
this._requestPromise = null;
|
||||
this._completionModel = null;
|
||||
this._context = null;
|
||||
this._currentPosition = this._editor.getPosition() || new Position(1, 1);
|
||||
this._currentSelection = this._editor.getSelection() || new Selection(1, 1, 1, 1);
|
||||
|
||||
// wire up various listeners
|
||||
this._toDispose.push(this._editor.onDidChangeModel(() => {
|
||||
@@ -243,8 +245,8 @@ export class SuggestModel implements IDisposable {
|
||||
|
||||
private _onCursorChange(e: ICursorSelectionChangedEvent): void {
|
||||
|
||||
const prevPosition = this._currentPosition;
|
||||
this._currentPosition = this._editor.getPosition();
|
||||
const prevSelection = this._currentSelection;
|
||||
this._currentSelection = this._editor.getSelection();
|
||||
|
||||
if (!e.selection.isEmpty()
|
||||
|| e.reason !== CursorChangeReason.NotSet
|
||||
@@ -272,9 +274,9 @@ export class SuggestModel implements IDisposable {
|
||||
// trigger 24x7 IntelliSense when idle, enabled, when cursor
|
||||
// moved RIGHT, and when at a good position
|
||||
if (this._editor.getConfiguration().contribInfo.quickSuggestions !== false
|
||||
&& prevPosition.isBefore(this._currentPosition)
|
||||
&& (prevSelection.containsRange(this._currentSelection)
|
||||
|| prevSelection.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))
|
||||
) {
|
||||
|
||||
this.cancel();
|
||||
|
||||
this._triggerAutoSuggestPromise = TPromise.timeout(this._quickSuggestDelay);
|
||||
@@ -404,6 +406,12 @@ export class SuggestModel implements IDisposable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx.leadingWord.startColumn < this._context.leadingWord.startColumn) {
|
||||
// happens when the current word gets outdented
|
||||
this.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx.column < this._context.column) {
|
||||
// typed -> moved cursor LEFT -> retrigger if still on a word
|
||||
if (ctx.leadingWord.word) {
|
||||
|
||||
Reference in New Issue
Block a user