mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-27 23:30:30 -04:00
Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 (#7206)
* Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 * fix config changes * fix strictnull checks
This commit is contained in:
@@ -20,6 +20,7 @@ import { SnippetController2 } from 'vs/editor/contrib/snippet/snippetController2
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
|
||||
import { WordDistance } from 'vs/editor/contrib/suggest/wordDistance';
|
||||
import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
|
||||
export interface ICancelEvent {
|
||||
readonly retrigger: boolean;
|
||||
@@ -172,7 +173,7 @@ export class SuggestModel implements IDisposable {
|
||||
// --- handle configuration & precondition changes
|
||||
|
||||
private _updateQuickSuggest(): void {
|
||||
this._quickSuggestDelay = this._editor.getConfiguration().contribInfo.quickSuggestionsDelay;
|
||||
this._quickSuggestDelay = this._editor.getOption(EditorOption.quickSuggestionsDelay);
|
||||
|
||||
if (isNaN(this._quickSuggestDelay) || (!this._quickSuggestDelay && this._quickSuggestDelay !== 0) || this._quickSuggestDelay < 0) {
|
||||
this._quickSuggestDelay = 10;
|
||||
@@ -183,9 +184,9 @@ export class SuggestModel implements IDisposable {
|
||||
|
||||
dispose(this._triggerCharacterListener);
|
||||
|
||||
if (this._editor.getConfiguration().readOnly
|
||||
if (this._editor.getOption(EditorOption.readOnly)
|
||||
|| !this._editor.hasModel()
|
||||
|| !this._editor.getConfiguration().contribInfo.suggestOnTriggerCharacters) {
|
||||
|| !this._editor.getOption(EditorOption.suggestOnTriggerCharacters)) {
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -277,7 +278,7 @@ export class SuggestModel implements IDisposable {
|
||||
|
||||
if (this._state === State.Idle) {
|
||||
|
||||
if (this._editor.getConfiguration().contribInfo.quickSuggestions === false) {
|
||||
if (this._editor.getOption(EditorOption.quickSuggestions) === false) {
|
||||
// not enabled
|
||||
return;
|
||||
}
|
||||
@@ -287,7 +288,7 @@ export class SuggestModel implements IDisposable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._editor.getConfiguration().contribInfo.suggest.snippetsPreventQuickSuggestions && SnippetController2.get(this._editor).isInSnippet()) {
|
||||
if (this._editor.getOption(EditorOption.suggest).snippetsPreventQuickSuggestions && SnippetController2.get(this._editor).isInSnippet()) {
|
||||
// no quick suggestion when in snippet mode
|
||||
return;
|
||||
}
|
||||
@@ -307,7 +308,7 @@ export class SuggestModel implements IDisposable {
|
||||
const model = this._editor.getModel();
|
||||
const pos = this._editor.getPosition();
|
||||
// validate enabled now
|
||||
const { quickSuggestions } = this._editor.getConfiguration().contribInfo;
|
||||
const quickSuggestions = this._editor.getOption(EditorOption.quickSuggestions);
|
||||
if (quickSuggestions === false) {
|
||||
return;
|
||||
} else if (quickSuggestions === true) {
|
||||
@@ -387,10 +388,11 @@ export class SuggestModel implements IDisposable {
|
||||
this._requestToken = new CancellationTokenSource();
|
||||
|
||||
// kind filter and snippet sort rules
|
||||
const { contribInfo } = this._editor.getConfiguration();
|
||||
const suggestOptions = this._editor.getOption(EditorOption.suggest);
|
||||
const snippetSuggestions = this._editor.getOption(EditorOption.snippetSuggestions);
|
||||
let itemKindFilter = new Set<CompletionItemKind>();
|
||||
let snippetSortOrder = SnippetSortOrder.Inline;
|
||||
switch (contribInfo.suggest.snippets) {
|
||||
switch (snippetSuggestions) {
|
||||
case 'top':
|
||||
snippetSortOrder = SnippetSortOrder.Top;
|
||||
break;
|
||||
@@ -407,9 +409,9 @@ export class SuggestModel implements IDisposable {
|
||||
}
|
||||
|
||||
// kind filter
|
||||
for (const key in contribInfo.suggest.filteredTypes) {
|
||||
for (const key in suggestOptions.filteredTypes) {
|
||||
const kind = completionKindFromString(key, true);
|
||||
if (typeof kind !== 'undefined' && contribInfo.suggest.filteredTypes[key] === false) {
|
||||
if (typeof kind !== 'undefined' && suggestOptions.filteredTypes[key] === false) {
|
||||
itemKindFilter.add(kind);
|
||||
}
|
||||
}
|
||||
@@ -449,7 +451,8 @@ export class SuggestModel implements IDisposable {
|
||||
characterCountDelta: ctx.column - this._context!.column
|
||||
},
|
||||
wordDistance,
|
||||
this._editor.getConfiguration().contribInfo.suggest
|
||||
this._editor.getOption(EditorOption.suggest),
|
||||
this._editor.getOption(EditorOption.snippetSuggestions)
|
||||
);
|
||||
|
||||
// store containers so that they can be disposed later
|
||||
|
||||
Reference in New Issue
Block a user