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 12, 2024
1 parent 85b42dc commit b707b06
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
8 changes: 2 additions & 6 deletions packages/language-server/src/languageServerPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { create as createTypeScriptService } from './plugins/typescript/index.js

export function createServerOptions(
connection: Connection,
ts: typeof import("typescript")
ts: typeof import('typescript')
): ServerOptions {
return {
watchFileExtensions: [
Expand Down Expand Up @@ -64,11 +64,7 @@ export function createServerOptions(
const rootPath = projectContext.typescript.configFileName
? projectContext.typescript.configFileName.split('/').slice(0, -1).join('/')
: serviceEnv.typescript!.uriToFileName(serviceEnv.workspaceFolder);
const nearestPackageJson = ts.findConfigFile(
rootPath,
ts.sys.fileExists,
'package.json'
);
const nearestPackageJson = ts.findConfigFile(rootPath, ts.sys.fileExists, 'package.json');

const astroInstall = getAstroInstall([rootPath], {
nearestPackageJson: nearestPackageJson,
Expand Down
11 changes: 5 additions & 6 deletions packages/language-server/src/nodeServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ const server = createServer(connection);
connection.listen();

connection.onInitialize((params) => {
const tsdk = params.initializationOptions?.typescript?.tsdk
const tsdk = params.initializationOptions?.typescript?.tsdk;

if (!tsdk) {
throw new Error('The `typescript.tsdk` init option is required. It should point to a directory containing a `typescript.js` or `tsserverlibrary.js` file, such as `node_modules/typescript/lib`.');
throw new Error(
'The `typescript.tsdk` init option is required. It should point to a directory containing a `typescript.js` or `tsserverlibrary.js` file, such as `node_modules/typescript/lib`.'
);
}

const {typescript, diagnosticMessages} = loadTsdkByPath(
tsdk,
params.locale
)
const { typescript, diagnosticMessages } = loadTsdkByPath(tsdk, params.locale);

return server.initialize(
params,
Expand Down
10 changes: 5 additions & 5 deletions packages/vscode/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
activateTsConfigStatusItem,
activateTsVersionStatusItem,
createLabsInfo,
getTsdk
getTsdk,
} from '@volar/vscode';
import * as vscode from 'vscode';
import * as lsp from 'vscode-languageclient/node';
Expand Down Expand Up @@ -72,7 +72,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<LabsIn
const clientOptions = {
documentSelector: [{ language: 'astro' }],
initializationOptions,
} satisfies lsp.LanguageClientOptions
} satisfies lsp.LanguageClientOptions;
client = new lsp.LanguageClient('astro', 'Astro Language Server', serverOptions, clientOptions);
await client.start();

Expand All @@ -89,10 +89,10 @@ export async function activate(context: vscode.ExtensionContext): Promise<LabsIn
(text) => text
);

const volarLabs = createLabsInfo(protocol)
volarLabs.addLanguageClient(client)
const volarLabs = createLabsInfo(protocol);
volarLabs.addLanguageClient(client);

return volarLabs.extensionExports
return volarLabs.extensionExports;
}

export function deactivate(): Thenable<any> | undefined {
Expand Down
4 changes: 1 addition & 3 deletions packages/vscode/syntaxes/astro.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"name": "Astro",
"scopeName": "source.astro",
"fileTypes": [
"astro"
],
"fileTypes": ["astro"],
"injections": {
"L:(meta.script.astro) (meta.lang.json) - (meta source)": {
"patterns": [
Expand Down

0 comments on commit b707b06

Please sign in to comment.