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 Mar 13, 2024
1 parent f1447ef commit f4ea483
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
10 changes: 4 additions & 6 deletions packages/language-server/src/languageServerPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function createServerOptions(
let prettier: ReturnType<typeof importPrettier>;
let prettierPluginPath: ReturnType<typeof getPrettierPluginPath>;
return createPrettierService(
context => {
(context) => {
const workspaceUri = URI.parse(context.env.workspaceFolder);
if (workspaceUri.scheme === 'file') {
prettier = importPrettier(workspaceUri.fsPath);
Expand Down Expand Up @@ -131,10 +131,7 @@ export function createServerOptions(

return {
...resolvedConfig,
plugins: [
...await getAstroPrettierPlugin(),
...resolvedConfig.plugins ?? [],
],
plugins: [...(await getAstroPrettierPlugin()), ...(resolvedConfig.plugins ?? [])],
parser: 'astro',
};

Expand All @@ -150,6 +147,7 @@ export function createServerOptions(
return hasPluginLoadedAlready ? [] : [prettierPluginPath];
}
},
});
}
);
}
}
17 changes: 13 additions & 4 deletions packages/language-server/src/plugins/typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { enhancedProvideSemanticDiagnostics } from './diagnostics.js';

export const create = (ts: typeof import('typescript')): ServicePlugin[] => {
const tsServicePlugins = createTypeScriptServices(ts as typeof import('typescript'), {});
return tsServicePlugins.map<ServicePlugin>(plugin => {
return tsServicePlugins.map<ServicePlugin>((plugin) => {
if (plugin.name === 'typescript-semantic') {
return {
...plugin,
Expand All @@ -27,7 +27,10 @@ export const create = (ts: typeof import('typescript')): ServicePlugin[] => {
return enhancedProvideCompletionItems(originalCompletions);
},
async resolveCompletionItem(item, token) {
const resolvedCompletionItem = await typeScriptPlugin.resolveCompletionItem!(item, token);
const resolvedCompletionItem = await typeScriptPlugin.resolveCompletionItem!(
item,
token
);
if (!resolvedCompletionItem) return item;

return enhancedResolveCompletionItem(resolvedCompletionItem, context);
Expand All @@ -44,7 +47,10 @@ export const create = (ts: typeof import('typescript')): ServicePlugin[] => {
return enhancedProvideCodeActions(originalCodeActions, context);
},
async resolveCodeAction(codeAction, token) {
const resolvedCodeAction = await typeScriptPlugin.resolveCodeAction!(codeAction, token);
const resolvedCodeAction = await typeScriptPlugin.resolveCodeAction!(
codeAction,
token
);
if (!resolvedCodeAction) return codeAction;

return enhancedResolveCodeAction(resolvedCodeAction, context);
Expand All @@ -62,7 +68,10 @@ export const create = (ts: typeof import('typescript')): ServicePlugin[] => {
tsxLineCount = code.astroMeta.tsxRanges.body.end.line;
}

const diagnostics = await typeScriptPlugin.provideSemanticDiagnostics!(document, token);
const diagnostics = await typeScriptPlugin.provideSemanticDiagnostics!(
document,
token
);
if (!diagnostics) return null;

return enhancedProvideSemanticDiagnostics(diagnostics, tsxLineCount);
Expand Down

0 comments on commit f4ea483

Please sign in to comment.