Skip to content

Commit

Permalink
Merge pull request #48 from mizdra/refactor-codes
Browse files Browse the repository at this point in the history
Refactor codes
  • Loading branch information
mizdra authored Dec 8, 2024
2 parents 5070b6b + b8fee73 commit a3ba468
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createLanguageServicePlugin } from '@volar/typescript/lib/quickstart/createLanguageServicePlugin.js';
import { createAssetLanguage } from './language-service/language.js';
import { createAssetLanguagePlugin } from './language-plugin.js';
import { getAssetPluginOptions } from './option.js';

export = createLanguageServicePlugin((ts, info) => {
Expand All @@ -10,7 +10,5 @@ export = createLanguageServicePlugin((ts, info) => {
return { languagePlugins: [] };
}

const assetLanguage = createAssetLanguage(ts.sys, assetPluginOptions);

return { languagePlugins: [assetLanguage] };
return { languagePlugins: [createAssetLanguagePlugin(ts.sys, assetPluginOptions)] };
});
9 changes: 6 additions & 3 deletions src/language-service/language.ts → src/language-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import path from 'node:path';
import type { LanguagePlugin } from '@volar/language-core';
import type {} from '@volar/typescript';
import ts from 'typescript/lib/tsserverlibrary';
import { getDtsContent } from '../dts';
import type { AssetPluginOptions } from '../option';
import { getDtsContent } from './dts';
import type { AssetPluginOptions } from './option';

export function createAssetLanguage(sys: ts.System, assetPluginOptions: AssetPluginOptions): LanguagePlugin<string> {
export function createAssetLanguagePlugin(
sys: ts.System,
assetPluginOptions: AssetPluginOptions,
): LanguagePlugin<string> {
return {
getLanguageId(scriptId) {
if (isMatchFile(scriptId)) return 'asset';
Expand Down

0 comments on commit a3ba468

Please sign in to comment.