Skip to content

Commit c7bd3c6

Browse files
committed
Always reload onEnter configuration
Configuration reload doesn't happen often anyway, and there will always be a set of onEnter rules to load
1 parent 992bafa commit c7bd3c6

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

editors/code/src/config.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ export type RunnableEnvCfg =
1111

1212
export class Config {
1313
readonly extensionId = "rust-lang.rust-analyzer";
14-
configureLang:
15-
| { handle: vscode.Disposable; typingContinueCommentsOnNewline: boolean }
16-
| undefined;
14+
configureLang: vscode.Disposable | undefined;
1715

1816
readonly rootSection = "rust-analyzer";
1917
private readonly requiresReloadOpts = [
@@ -45,7 +43,7 @@ export class Config {
4543
}
4644

4745
dispose() {
48-
this.configureLang?.handle.dispose();
46+
this.configureLang?.dispose();
4947
}
5048

5149
private refreshLogging() {
@@ -89,12 +87,8 @@ export class Config {
8987
*/
9088
private configureLanguage() {
9189
// Only need to dispose of the config if there's a change
92-
if (
93-
this.configureLang &&
94-
this.typingContinueCommentsOnNewline !==
95-
this.configureLang.typingContinueCommentsOnNewline
96-
) {
97-
this.configureLang.handle.dispose();
90+
if (this.configureLang) {
91+
this.configureLang.dispose();
9892
this.configureLang = undefined;
9993
}
10094

@@ -167,12 +161,9 @@ export class Config {
167161
];
168162
}
169163

170-
this.configureLang = {
171-
handle: vscode.languages.setLanguageConfiguration("rust", {
172-
onEnterRules,
173-
}),
174-
typingContinueCommentsOnNewline: this.typingContinueCommentsOnNewline,
175-
};
164+
this.configureLang = vscode.languages.setLanguageConfiguration("rust", {
165+
onEnterRules,
166+
});
176167
}
177168

178169
// We don't do runtime config validation here for simplicity. More on stackoverflow:

0 commit comments

Comments
 (0)