mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
log warning when having ignored invalid completion items (#184156)
fixes https://github.com/microsoft/vscode/issues/181464
This commit is contained in:
parent
29c9daaee2
commit
ff47293767
|
@ -31,6 +31,7 @@ import { FuzzyScoreOptions } from 'vs/base/common/filters';
|
||||||
import { assertType } from 'vs/base/common/types';
|
import { assertType } from 'vs/base/common/types';
|
||||||
import { InlineCompletionContextKeys } from 'vs/editor/contrib/inlineCompletions/browser/inlineCompletionContextKeys';
|
import { InlineCompletionContextKeys } from 'vs/editor/contrib/inlineCompletions/browser/inlineCompletionContextKeys';
|
||||||
import { SnippetController2 } from 'vs/editor/contrib/snippet/browser/snippetController2';
|
import { SnippetController2 } from 'vs/editor/contrib/snippet/browser/snippetController2';
|
||||||
|
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||||
|
|
||||||
export interface ICancelEvent {
|
export interface ICancelEvent {
|
||||||
readonly retrigger: boolean;
|
readonly retrigger: boolean;
|
||||||
|
@ -158,6 +159,7 @@ export class SuggestModel implements IDisposable {
|
||||||
@IContextKeyService private readonly _contextKeyService: IContextKeyService,
|
@IContextKeyService private readonly _contextKeyService: IContextKeyService,
|
||||||
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
||||||
@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService,
|
@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService,
|
||||||
|
@IEnvironmentService private readonly _envService: IEnvironmentService,
|
||||||
) {
|
) {
|
||||||
this._currentSelection = this._editor.getSelection() || new Selection(1, 1, 1, 1);
|
this._currentSelection = this._editor.getSelection() || new Selection(1, 1, 1, 1);
|
||||||
|
|
||||||
|
@ -544,6 +546,15 @@ export class SuggestModel implements IDisposable {
|
||||||
// finally report telemetry about durations
|
// finally report telemetry about durations
|
||||||
this._reportDurationsTelemetry(completions.durations);
|
this._reportDurationsTelemetry(completions.durations);
|
||||||
|
|
||||||
|
// report invalid completions by source
|
||||||
|
if (!this._envService.isBuilt || this._envService.isExtensionDevelopment) {
|
||||||
|
for (const item of completions.items) {
|
||||||
|
if (item.isInvalid) {
|
||||||
|
this._logService.warn(`[suggest] did IGNORE invalid completion item from ${item.provider._debugDisplayName}`, item.completion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}).catch(onUnexpectedError);
|
}).catch(onUnexpectedError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtil
|
||||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||||
import { LanguageFeaturesService } from 'vs/editor/common/services/languageFeaturesService';
|
import { LanguageFeaturesService } from 'vs/editor/common/services/languageFeaturesService';
|
||||||
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
|
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
|
||||||
|
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||||
|
|
||||||
suite('SuggestController', function () {
|
suite('SuggestController', function () {
|
||||||
|
|
||||||
|
@ -73,6 +74,10 @@ suite('SuggestController', function () {
|
||||||
}],
|
}],
|
||||||
[ILabelService, new class extends mock<ILabelService>() { }],
|
[ILabelService, new class extends mock<ILabelService>() { }],
|
||||||
[IWorkspaceContextService, new class extends mock<IWorkspaceContextService>() { }],
|
[IWorkspaceContextService, new class extends mock<IWorkspaceContextService>() { }],
|
||||||
|
[IEnvironmentService, new class extends mock<IEnvironmentService>() {
|
||||||
|
override isBuilt: boolean = true;
|
||||||
|
override isExtensionDevelopment: boolean = false;
|
||||||
|
}],
|
||||||
);
|
);
|
||||||
|
|
||||||
model = disposables.add(createTextModel('', undefined, undefined, URI.from({ scheme: 'test-ctrl', path: '/path.tst' })));
|
model = disposables.add(createTextModel('', undefined, undefined, URI.from({ scheme: 'test-ctrl', path: '/path.tst' })));
|
||||||
|
|
|
@ -39,6 +39,7 @@ import { LanguageFeaturesService } from 'vs/editor/common/services/languageFeatu
|
||||||
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
|
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { getSnippetSuggestSupport, setSnippetSuggestSupport } from 'vs/editor/contrib/suggest/browser/suggest';
|
import { getSnippetSuggestSupport, setSnippetSuggestSupport } from 'vs/editor/contrib/suggest/browser/suggest';
|
||||||
|
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||||
|
|
||||||
|
|
||||||
function createMockEditor(model: TextModel, languageFeaturesService: ILanguageFeaturesService): ITestCodeEditor {
|
function createMockEditor(model: TextModel, languageFeaturesService: ILanguageFeaturesService): ITestCodeEditor {
|
||||||
|
@ -59,6 +60,10 @@ function createMockEditor(model: TextModel, languageFeaturesService: ILanguageFe
|
||||||
}],
|
}],
|
||||||
[ILabelService, new class extends mock<ILabelService>() { }],
|
[ILabelService, new class extends mock<ILabelService>() { }],
|
||||||
[IWorkspaceContextService, new class extends mock<IWorkspaceContextService>() { }],
|
[IWorkspaceContextService, new class extends mock<IWorkspaceContextService>() { }],
|
||||||
|
[IEnvironmentService, new class extends mock<IEnvironmentService>() {
|
||||||
|
override isBuilt: boolean = true;
|
||||||
|
override isExtensionDevelopment: boolean = false;
|
||||||
|
}],
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
editor.registerAndInstantiateContribution(SnippetController2.ID, SnippetController2);
|
editor.registerAndInstantiateContribution(SnippetController2.ID, SnippetController2);
|
||||||
|
|
Loading…
Reference in a new issue