Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Mar 8, 2024
1 parent 6e79999 commit 5a93cb7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function create(
},
};

function createSemanticServicePlugin(context: ServiceContext, { sys, languageServiceHost }: NonNullable<ServiceContext['language']['typescript']>) {
function createSemanticServicePlugin(context: ServiceContext, { sys, languageServiceHost }: NonNullable<ServiceContext['language']['typescript']>): ServicePluginInstance<Provide> {

const created = tsWithImportCache.createLanguageService(
ts,
Expand Down Expand Up @@ -239,7 +239,7 @@ export function create(
const getSelectionRanges = selectionRanges.register(ctx);
const doValidation = diagnostics.register(ctx);
const getDocumentSemanticTokens = semanticTokens.register(ctx);
const plugin: ServicePluginInstance<Provide> = {
return {

provide: {
'typescript/typescript': () => ts,
Expand Down Expand Up @@ -547,8 +547,6 @@ export function create(
},
};

return plugin;

function isSemanticDocument(document: TextDocument, withJson = false) {
const virtualScript = getVirtualScriptByUri(document.uri);
if (virtualScript) {
Expand Down Expand Up @@ -600,7 +598,7 @@ export function create(
}
}

function createSyntacticServicePlugin(context: ServiceContext) {
function createSyntacticServicePlugin(context: ServiceContext): ServicePluginInstance<Provide> {
let currentProjectVersion = -1;
let currentDocument: TextDocument | undefined;
let currentDocumentVersion: number | undefined;
Expand All @@ -619,7 +617,8 @@ export function create(
fileExists: fileName => fileName === currentFileName,
};
const languageService = ts.createLanguageService(host, undefined, 2 satisfies ts.LanguageServiceMode.Syntactic);
const plugin: ServicePluginInstance<Provide> = {

return {

provide: {
'typescript/typescript': () => ts,
Expand Down Expand Up @@ -722,7 +721,6 @@ export function create(
});
},
};
return plugin;

function worker<T>(document: TextDocument, cb: () => T) {
if (currentDocument !== document || currentDocumentVersion !== document.version) {
Expand Down

0 comments on commit 5a93cb7

Please sign in to comment.