Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesseuh authored and astrobot-houston committed Sep 20, 2024
1 parent 35cf3bc commit 5f79dce
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
38 changes: 26 additions & 12 deletions packages/language-server/src/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,36 @@ export class AstroCheck {
const { languageServiceHost } = project.typescript!;
const astroInstall = getAstroInstall([this.workspacePath]);

addAstroTypes(typeof astroInstall === 'string' ? undefined : astroInstall, this.ts, languageServiceHost);
addAstroTypes(
typeof astroInstall === 'string' ? undefined : astroInstall,
this.ts,
languageServiceHost,
);
},
);
} else {
this.linter = kit.createTypeScriptInferredChecker(languagePlugins, services, () => {
return fg.sync('**/*.astro', {
cwd: this.workspacePath,
ignore: ['node_modules'],
absolute: true,
});
}, undefined, ({ project }) => {
const { languageServiceHost } = project.typescript!;
const astroInstall = getAstroInstall([this.workspacePath]);
this.linter = kit.createTypeScriptInferredChecker(
languagePlugins,
services,
() => {
return fg.sync('**/*.astro', {
cwd: this.workspacePath,
ignore: ['node_modules'],
absolute: true,
});
},
undefined,
({ project }) => {
const { languageServiceHost } = project.typescript!;
const astroInstall = getAstroInstall([this.workspacePath]);

addAstroTypes(typeof astroInstall === 'string' ? undefined : astroInstall, this.ts, languageServiceHost);
});
addAstroTypes(
typeof astroInstall === 'string' ? undefined : astroInstall,
this.ts,
languageServiceHost,
);
},
);
}
}

Expand Down
6 changes: 3 additions & 3 deletions packages/language-server/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const decoratedHosts = new WeakSet<ts.LanguageServiceHost>();
export function addAstroTypes(
astroInstall: AstroInstall | undefined,
ts: typeof import('typescript'),
host: ts.LanguageServiceHost
host: ts.LanguageServiceHost,
) {
if (decoratedHosts.has(host)) {
return;
Expand Down Expand Up @@ -70,7 +70,7 @@ export function addAstroTypes(
}

return [...fileNames, ...addedFileNames];
}
};
host.getCompilationSettings = () => {
const baseCompilationSettings = getCompilationSettings();
return {
Expand All @@ -83,7 +83,7 @@ export function addAstroTypes(
isolatedModules: true,
moduleResolution:
baseCompilationSettings.moduleResolution === ts.ModuleResolutionKind.Classic ||
!baseCompilationSettings.moduleResolution
!baseCompilationSettings.moduleResolution
? ts.ModuleResolutionKind.Node10
: baseCompilationSettings.moduleResolution,
};
Expand Down

0 comments on commit 5f79dce

Please sign in to comment.