Skip to content

Commit 80628ad

Browse files
committed
fix: pr feedback from ai
1 parent c0c04c7 commit 80628ad

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

packages/salesforcedx-lwc-language-server/src/baseServer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,17 +488,17 @@ export abstract class BaseServer {
488488
}
489489
}
490490

491-
public onShutdown(): void {
491+
public async onShutdown(): Promise<void> {
492492
// Persist custom components for faster startup on next session
493493
if (this.componentIndexer) {
494-
this.componentIndexer.persistCustomComponents();
494+
await this.componentIndexer.persistCustomComponents();
495495
}
496496
}
497497

498-
public onExit(): void {
498+
public async onExit(): Promise<void> {
499499
// Persist custom components for faster startup on next session
500500
if (this.componentIndexer) {
501-
this.componentIndexer.persistCustomComponents();
501+
await this.componentIndexer.persistCustomComponents();
502502
}
503503
}
504504

packages/salesforcedx-lwc-language-server/src/componentIndexer.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,14 @@ export default class ComponentIndexer {
245245
}
246246
}
247247

248-
public persistCustomComponents(): void {
248+
public async persistCustomComponents(): Promise<void> {
249249
const indexJsonString = JSON.stringify(this.getCustomData());
250250

251251
// Store the component index data for the client to process
252-
void this.fileSystemAccessor.updateFileContent('lwc:componentIndex', indexJsonString);
252+
await this.fileSystemAccessor.updateFileContent(
253+
path.join(this.workspaceRoot, CUSTOM_COMPONENT_INDEX_FILE),
254+
indexJsonString
255+
);
253256
}
254257

255258
public async insertSfdxTsConfigPath(filePaths: string[]): Promise<void> {
@@ -400,6 +403,6 @@ export default class ComponentIndexer {
400403

401404
(await this.getStaleTags()).forEach(tag => this.tags.delete(getTagName(tag)));
402405

403-
this.persistCustomComponents();
406+
await this.persistCustomComponents();
404407
}
405408
}

0 commit comments

Comments
 (0)