Skip to content

Commit 38c4d80

Browse files
Format fixes
1 parent e44c3c4 commit 38c4d80

File tree

2 files changed

+44
-10
lines changed

2 files changed

+44
-10
lines changed

src/tools/rust-analyzer/editors/code/src/config.ts

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ export type RunnableEnvCfgItem = {
1313
};
1414

1515
export type ConfigurationTree = { [key: string]: ConfigurationValue };
16-
export type ConfigurationValue = undefined | null | boolean | number | string | ConfigurationValue[] | ConfigurationTree;
16+
export type ConfigurationValue =
17+
| undefined
18+
| null
19+
| boolean
20+
| number
21+
| string
22+
| ConfigurationValue[]
23+
| ConfigurationTree;
1724

1825
type ShowStatusBar = "always" | "never" | { documentSelector: vscode.DocumentSelector };
1926

@@ -34,7 +41,11 @@ export class Config {
3441

3542
constructor(ctx: vscode.ExtensionContext) {
3643
this.workspaceState = ctx.workspaceState;
37-
vscode.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration, this, ctx.subscriptions);
44+
vscode.workspace.onDidChangeConfiguration(
45+
this.onDidChangeConfiguration,
46+
this,
47+
ctx.subscriptions,
48+
);
3849
this.refreshLogging();
3950
this.configureLanguage();
4051
}
@@ -49,13 +60,19 @@ export class Config {
4960
/// configuration items overridden by (present) extensions.
5061
get extensionConfigurations(): Record<string, Record<string, unknown>> {
5162
return pickBy(
52-
this.workspaceState.get<Record<string, ConfigurationTree>>("extensionConfigurations", {}),
63+
this.workspaceState.get<Record<string, ConfigurationTree>>(
64+
"extensionConfigurations",
65+
{},
66+
),
5367
// ignore configurations from disabled/removed extensions
5468
(_, extensionId) => vscode.extensions.getExtension(extensionId) !== undefined,
5569
);
5670
}
5771

58-
async addExtensionConfiguration(extensionId: string, configuration: Record<string, unknown>): Promise<void> {
72+
async addExtensionConfiguration(
73+
extensionId: string,
74+
configuration: Record<string, unknown>,
75+
): Promise<void> {
5976
const oldConfiguration = this.cfg;
6077

6178
const extCfgs = this.extensionConfigurations;
@@ -66,8 +83,11 @@ export class Config {
6683
const prefix = `${this.rootSection}.`;
6784
await this.onDidChangeConfiguration({
6885
affectsConfiguration(section: string, _scope?: vscode.ConfigurationScope): boolean {
69-
return section.startsWith(prefix) &&
70-
get(oldConfiguration, section.slice(prefix.length)) !== get(newConfiguration, section.slice(prefix.length));
86+
return (
87+
section.startsWith(prefix) &&
88+
get(oldConfiguration, section.slice(prefix.length)) !==
89+
get(newConfiguration, section.slice(prefix.length))
90+
);
7191
},
7292
});
7393
}
@@ -224,8 +244,14 @@ export class Config {
224244
for (const [extensionId, items] of Object.entries(this.extensionConfigurations)) {
225245
for (const [k, v] of Object.entries(items)) {
226246
const i = this.rawCfg.inspect(k);
227-
if (i?.workspaceValue !== undefined || i?.workspaceFolderValue !== undefined || i?.globalValue !== undefined) {
228-
log.trace(`Ignoring configuration override for ${k} from extension ${extensionId}`);
247+
if (
248+
i?.workspaceValue !== undefined ||
249+
i?.workspaceFolderValue !== undefined ||
250+
i?.globalValue !== undefined
251+
) {
252+
log.trace(
253+
`Ignoring configuration override for ${k} from extension ${extensionId}`,
254+
);
229255
continue;
230256
}
231257
log.trace(`Extension ${extensionId} overrides configuration ${k} to `, v);
@@ -303,7 +329,12 @@ export class Config {
303329
overrideInLanguage = config.defaultLanguageValue;
304330
value = config.defaultValue || config.defaultLanguageValue;
305331
}
306-
await this.rawCfg.update("checkOnSave", !(value || false), target || null, overrideInLanguage);
332+
await this.rawCfg.update(
333+
"checkOnSave",
334+
!(value || false),
335+
target || null,
336+
overrideInLanguage,
337+
);
307338
}
308339

309340
get problemMatcher(): string[] {

src/tools/rust-analyzer/editors/code/src/ctx.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ export class Ctx implements RustAnalyzerExtensionApi {
150150
});
151151
}
152152

153-
async addConfiguration(extensionId: string, configuration: Record<string, unknown>): Promise<void> {
153+
async addConfiguration(
154+
extensionId: string,
155+
configuration: Record<string, unknown>,
156+
): Promise<void> {
154157
await this.config.addExtensionConfiguration(extensionId, configuration);
155158
}
156159

0 commit comments

Comments
 (0)