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 { InlineCompletionContextKeys } from 'vs/editor/contrib/inlineCompletions/browser/inlineCompletionContextKeys';
|
||||
import { SnippetController2 } from 'vs/editor/contrib/snippet/browser/snippetController2';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
|
||||
export interface ICancelEvent {
|
||||
readonly retrigger: boolean;
|
||||
|
@ -158,6 +159,7 @@ export class SuggestModel implements IDisposable {
|
|||
@IContextKeyService private readonly _contextKeyService: IContextKeyService,
|
||||
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
||||
@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService,
|
||||
@IEnvironmentService private readonly _envService: IEnvironmentService,
|
||||
) {
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtil
|
|||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { LanguageFeaturesService } from 'vs/editor/common/services/languageFeaturesService';
|
||||
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
|
||||
suite('SuggestController', function () {
|
||||
|
||||
|
@ -73,6 +74,10 @@ suite('SuggestController', function () {
|
|||
}],
|
||||
[ILabelService, new class extends mock<ILabelService>() { }],
|
||||
[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' })));
|
||||
|
|
|
@ -39,6 +39,7 @@ import { LanguageFeaturesService } from 'vs/editor/common/services/languageFeatu
|
|||
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
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 {
|
||||
|
@ -59,6 +60,10 @@ function createMockEditor(model: TextModel, languageFeaturesService: ILanguageFe
|
|||
}],
|
||||
[ILabelService, new class extends mock<ILabelService>() { }],
|
||||
[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);
|
||||
|
|
Loading…
Reference in a new issue