Skip to content

Commit

Permalink
Fix #107999
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Nov 24, 2020
1 parent 5987e40 commit 66cb21b
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,15 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
}

private onModelAdded(model: ITextModel): void {
const uri = model.uri;
const supportedSchemes = [Schemas.untitled, Schemas.file, Schemas.vscodeRemote];
if (!uri || !supportedSchemes.includes(uri.scheme)) {
return;
}

this.promptRecommendationsForModel(model);
this._register(model.onDidChangeLanguage(() => this.promptRecommendationsForModel(model)));
const disposable = model.onDidChangeLanguage(() => this.promptRecommendationsForModel(model));
model.onWillDispose(() => disposable.dispose());
}

/**
Expand All @@ -160,11 +167,6 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
*/
private promptRecommendationsForModel(model: ITextModel): void {
const uri = model.uri;
const supportedSchemes = [Schemas.untitled, Schemas.file, Schemas.vscodeRemote];
if (!uri || !supportedSchemes.includes(uri.scheme)) {
return;
}

const language = model.getLanguageIdentifier().language;
const fileExtension = extname(uri).toLowerCase();
if (this.processedLanguages.includes(language) && this.processedFileExtensions.includes(fileExtension)) {
Expand Down

0 comments on commit 66cb21b

Please sign in to comment.