Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonlyu123 committed Dec 23, 2024
1 parent a33c782 commit bbcdd93
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 105 deletions.
2 changes: 1 addition & 1 deletion packages/language-server/src/plugins/typescript/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ function getOrCreateDocumentRegistry(
compilationSettings
);

// sourceFileOptions.impliedNodeFormat = format;
sourceFileOptions.impliedNodeFormat = format;
}

return acquireDocumentWithKey(
Expand Down
104 changes: 0 additions & 104 deletions packages/language-server/test/plugins/typescript/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,110 +332,6 @@ describe('service', () => {
ls.getService();
});

it.skip('do not throw when ScriptKind changes before new service is created', async () => {
// testing this because the patch rely on ts implementation details
// and we want to be aware of the changes

const dirPath = getRandomVirtualDirPath(testDir);
const { virtualSystem, lsDocumentContext, rootUris } = setup();
const package1Path = path.join(dirPath, 'package1');
const package2Path = path.join(dirPath, 'package2');

virtualSystem.writeFile(
path.join(package1Path, 'tsconfig.json'),
JSON.stringify({
compilerOptions: {
allowJs: true
}
})
);

virtualSystem.writeFile(
path.join(package2Path, 'tsconfig.json'),
JSON.stringify({
compilerOptions: {
allowJs: true
}
})
);

const usagePath = path.join(package1Path, 'usage.svelte');
virtualSystem.writeFile(
usagePath,
'<script>import Library from "../package2/Library.svelte";</script>'
);

const libraryPath = path.join(package2Path, 'Library.svelte');
virtualSystem.writeFile(libraryPath, '<script lang="ts">const a: number = null;</script>');

const lsLibrary = await getService(libraryPath, rootUris, lsDocumentContext);
lsLibrary.getService();

const documentLibrary = new Document(
pathToUrl(libraryPath),
virtualSystem.readFile(libraryPath)!
);
documentLibrary.openedByClient = true;
documentLibrary.update(' ', 0, documentLibrary.getTextLength());
lsLibrary.updateSnapshot(documentLibrary);


const lsUsage = await getService(usagePath, rootUris, lsDocumentContext);
lsUsage.getService();
});

it.skip('do not throw when ScriptKind changes referenced service is updated', async () => {
// testing this because the patch rely on ts implementation details
// and we want to be aware of the changes

const dirPath = getRandomVirtualDirPath(testDir);
const { virtualSystem, lsDocumentContext, rootUris } = setup();
const package1Path = path.join(dirPath, 'package1');
const package2Path = path.join(dirPath, 'package2');

virtualSystem.writeFile(
path.join(package1Path, 'tsconfig.json'),
JSON.stringify({
compilerOptions: {
allowJs: true
}
})
);

virtualSystem.writeFile(
path.join(package2Path, 'tsconfig.json'),
JSON.stringify({
compilerOptions: {
allowJs: true
}
})
);

const usagePath = path.join(package1Path, 'usage.svelte');
virtualSystem.writeFile(
usagePath,
'<script>import Library from "../package2/Library.svelte";</script>'
);

const libraryPath = path.join(package2Path, 'Library.svelte');
virtualSystem.writeFile(libraryPath, '<script lang="ts">const a: number = null;</script>');

const lsLibrary = await getService(libraryPath, rootUris, lsDocumentContext);
lsLibrary.getService().getProgram();
const lsUsage = await getService(usagePath, rootUris, lsDocumentContext);
lsUsage.getService();

const documentLibrary = new Document(
pathToUrl(libraryPath),
virtualSystem.readFile(libraryPath)!
);
documentLibrary.openedByClient = true;
documentLibrary.update(' ', 0, documentLibrary.getTextLength());
lsLibrary.updateSnapshot(documentLibrary);

lsLibrary.getService();
});

function createReloadTester(
docContext: LanguageServiceDocumentContext,
testAfterReload: (reloadingConfigs: string[]) => Promise<boolean>
Expand Down

0 comments on commit bbcdd93

Please sign in to comment.