diff --git a/package.json b/package.json index 83f04868..642b275c 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "eslint": "^8.27.0", "prettier": "^3.3.2", "release-it": "^15.5.0", - "typescript": ">=5.4.0" + "typescript": ">=5.6.0" }, "resolutions:notes": { "@glimmer/validator": "Newer versions of @glimmer/* are ESM-only, and Glint is compiled to CJS, so newer versions of @glimmer/* are not compatible", diff --git a/packages/core/README.md b/packages/core/README.md index cb22f07b..31ac4691 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -6,15 +6,40 @@ This package contains core functionality to power template-aware typechecking on ## CLI +The `glint` CLI tool is a thin wrapper around `tsc` and hence all documentation / use cases / flags that apply to `tsc` also apply to `glint`. + +Because `glint` is only used for type-checking purposes (or generating declaration files), and not for producing compiled JS output, the emitting of JS should always be disabled by providing either the `--noEmit` or `--emitDeclarationOnly` flags, depending on your use case. + ### Usage +Gemeral Usage: + +```sh +glint --noEmit [--build] [--watch|-w] [--declaration|-d] [--emitDeclarationOnly] [--project path/to/tsconfig.json] +``` + +Type-checking: + +```sh +glint [--build] --noEmit +``` + +Type-checking in watch mode: + ```sh -glint [--watch|-w] [--declaration|-d] [--project path/to/tsconfig.json] +glint [--build] --noEmit --watch ``` -### Flags +Build declaration files: + +``` +glint --build --declaration --emitDeclarationOnly +``` + +Build declaration files in watch mode: + +``` +glint --build --declaration --emitDeclarationOnly --watch +``` -- `--watch` If passed, `glint` will perform a watched typecheck, re-checking your project as files change. -- `--preserveWatchOutput` Used with `--watch`. If passed, `glint` will not clear the screen each time the project is re-checked. -- `--declaration` If passed, `glint` will emit `.d.ts` files according to the configuration in your `tsconfig.json` -- `--project` Overrides where `glint` will look to find your project's `tsconfig.json` +Please refer to `tsc` docs for other use cases and flags. diff --git a/packages/core/__tests__/cli/build.test.ts b/packages/core/__tests__/cli/build.test.ts index 36c9ecfc..2e003d5b 100644 --- a/packages/core/__tests__/cli/build.test.ts +++ b/packages/core/__tests__/cli/build.test.ts @@ -466,8 +466,13 @@ describe('CLI: single-pass build mode typechecking', () => { 2 const A = 2 * C; ~ + src/index.gts:2:15 - error TS2307: Cannot find module '@glint-test/a' or its corresponding type declarations. - Found 1 error. + 2 import A from '@glint-test/a'; + ~~~~~~~~~~~~~~~ + + + Found 2 errors. " `); @@ -573,8 +578,13 @@ describe('CLI: single-pass build mode typechecking', () => { 4 const A = ; ~ + src/index.gts:2:15 - error TS2307: Cannot find module '@glint-test/a' or its corresponding type declarations. - Found 1 error. + 2 import A from '@glint-test/a'; + ~~~~~~~~~~~~~~~ + + + Found 2 errors. " `); @@ -702,8 +712,13 @@ describe('CLI: single-pass build mode typechecking', () => { 1 const B: number = 'ahoy'; ~ + src/index.gts:3:15 - error TS2307: Cannot find module '@glint-test/b' or its corresponding type declarations. - Found 1 error. + 3 import B from '@glint-test/b'; + ~~~~~~~~~~~~~~~ + + + Found 2 errors. " `); @@ -807,8 +822,13 @@ describe('CLI: single-pass build mode typechecking', () => { 2 const Usage = ; ~~~~~~~ + src/index.gts:3:15 - error TS2307: Cannot find module '@glint-test/b' or its corresponding type declarations. - Found 1 error. + 3 import B from '@glint-test/b'; + ~~~~~~~~~~~~~~~ + + + Found 2 errors. " `); @@ -895,8 +915,18 @@ describe('CLI: single-pass build mode typechecking', () => { 1 const C: number = 'world'; ~ + ../a/src/index.gts:1:15 - error TS2307: Cannot find module '@glint-test/c' or its corresponding type declarations. - Found 1 error. + 1 import C from '@glint-test/c'; + ~~~~~~~~~~~~~~~ + + src/index.gts:2:15 - error TS2307: Cannot find module '@glint-test/a' or its corresponding type declarations. + + 2 import A from '@glint-test/a'; + ~~~~~~~~~~~~~~~ + + + Found 3 errors. " `); @@ -915,8 +945,13 @@ describe('CLI: single-pass build mode typechecking', () => { 1 const C: number = 'world'; ~ + src/index.gts:1:15 - error TS2307: Cannot find module '@glint-test/c' or its corresponding type declarations. - Found 1 error. + 1 import C from '@glint-test/c'; + ~~~~~~~~~~~~~~~ + + + Found 2 errors. " `); @@ -1040,8 +1075,18 @@ describe('CLI: single-pass build mode typechecking', () => { 2 const useDouble = ; ~~~~~~~ + ../a/src/index.gts:1:15 - error TS2307: Cannot find module '@glint-test/c' or its corresponding type declarations. - Found 1 error. + 1 import C from '@glint-test/c'; + ~~~~~~~~~~~~~~~ + + src/index.gts:2:15 - error TS2307: Cannot find module '@glint-test/a' or its corresponding type declarations. + + 2 import A from '@glint-test/a'; + ~~~~~~~~~~~~~~~ + + + Found 3 errors. " `); @@ -1060,8 +1105,13 @@ describe('CLI: single-pass build mode typechecking', () => { 2 const useDouble = ; ~~~~~~~ + src/index.gts:1:15 - error TS2307: Cannot find module '@glint-test/c' or its corresponding type declarations. - Found 1 error. + 1 import C from '@glint-test/c'; + ~~~~~~~~~~~~~~~ + + + Found 2 errors. " `); @@ -1614,7 +1664,7 @@ describe('CLI: --build --dry', () => { let buildResult = await projects.root.buildDeclaration({ flags: ['--dry'] }); expect(buildResult.exitCode).toBe(0); expect(stripAnsi(buildResult.stdout)).toMatch( - `A non-dry build would build project '${projects.main.filePath('tsconfig.json')}'`, + ` A non-dry build would update timestamps for output of project '${projects.main.filePath('tsconfig.json')}'`, ); expect(stripAnsi(buildResult.stdout)).toMatch( `A non-dry build would build project '${projects.children.a.filePath('tsconfig.json')}'`, diff --git a/packages/core/__tests__/cli/incremental.test.ts b/packages/core/__tests__/cli/incremental.test.ts index 12635ca0..3596ce63 100644 --- a/packages/core/__tests__/cli/incremental.test.ts +++ b/packages/core/__tests__/cli/incremental.test.ts @@ -40,9 +40,7 @@ describe('CLI: --incremental', () => { expect(existsSync(project.filePath(BUILD_INFO))).toBe(true); let contents = JSON.parse(readFileSync(project.filePath(BUILD_INFO), { encoding: 'utf-8' })); - expect(contents).toHaveProperty('program'); - expect(contents.program).toHaveProperty('fileNames'); - expect(contents.program.fileNames.length).not.toEqual(0); + expect(contents.fileNames.length).not.toEqual(0); }); describe('when a build has occurred', () => { diff --git a/packages/core/__tests__/cli/watch.test.ts b/packages/core/__tests__/cli/watch.test.ts index 4fd1f671..d2a4bf37 100644 --- a/packages/core/__tests__/cli/watch.test.ts +++ b/packages/core/__tests__/cli/watch.test.ts @@ -164,8 +164,6 @@ describe('CLI: watched typechecking', () => { output = await watch.awaitOutput('Watching for file changes.'); expect(output).toMatch('Found 0 errors.'); - expect(watch.allOutput).toMatch(/\033c/); // output should include screen reset control sequence - await watch.terminate(); }); @@ -290,44 +288,4 @@ describe('CLI: watched typechecking', () => { await watch.terminate(); }); - - test('reports on errors introduced and cleared during the watch with --preserveWatchOutput', async () => { - let code = stripIndent` - import Component from '@glimmer/component'; - - type ApplicationArgs = { - version: string; - }; - - export default class Application extends Component<{ Args: ApplicationArgs }> { - private startupTime = new Date().toISOString(); - - - } - `; - - project.write('index.gts', code); - - let watch = project.checkWatch({ flags: ['--preserveWatchOutput'], reject: true }); - - let output = await watch.awaitOutput('Watching for file changes.'); - expect(output).toMatch('Found 0 errors.'); - - project.write('index.gts', code.replace('this.startupTime', 'this.startupTimee')); - - output = await watch.awaitOutput('Watching for file changes.'); - expect(output).toMatch('Found 1 error.'); - - project.write('index.gts', code); - - output = await watch.awaitOutput('Watching for file changes.'); - expect(output).toMatch('Found 0 errors.'); - - expect(watch.allOutput).not.toMatch(/\033c/); // output should not include screen reset control sequence - - await watch.terminate(); - }); }); diff --git a/packages/core/__tests__/language-server/custom-extensions.test.ts b/packages/core/__tests__/language-server/custom-extensions.test.ts index 25f486d6..25fd910d 100644 --- a/packages/core/__tests__/language-server/custom-extensions.test.ts +++ b/packages/core/__tests__/language-server/custom-extensions.test.ts @@ -149,9 +149,24 @@ describe('Language Server: custom file extensions', () => { const { uri } = await server.openTextDocument(tsPath, 'typescript'); let diagnostics = await server.sendDocumentDiagnosticRequest(uri); - expect(definitions).toMatchObject([ - { targetUri: 'file:///path/to/EPHEMERAL_TEST_PROJECT/index.ts' }, - ]); + expect(definitions).toMatchInlineSnapshot(` + [ + { + "range": { + "end": { + "character": 29, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + "uri": "file:///path/to/EPHEMERAL_TEST_PROJECT/index.ts", + }, + ] + `); + expect(diagnostics.items).toEqual([]); project.remove('index.ts'); @@ -162,9 +177,23 @@ describe('Language Server: custom file extensions', () => { definitions = await server.sendDefinitionRequest(consumerURI, { line: 2, character: 4 }); diagnostics = await server.sendDocumentDiagnosticRequest(uri); - expect(definitions).toMatchObject([ - { targetUri: 'file:///path/to/EPHEMERAL_TEST_PROJECT/index.gts' }, - ]); + expect(definitions).toMatchInlineSnapshot(` + [ + { + "range": { + "end": { + "character": 29, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + "uri": "file:///path/to/EPHEMERAL_TEST_PROJECT/index.gts", + }, + ] + `); expect(diagnostics.items).toEqual([]); project.remove('index.gts'); diff --git a/packages/core/__tests__/language-server/definitions.test.ts b/packages/core/__tests__/language-server/definitions.test.ts index eb77dcd3..d61d07e6 100644 --- a/packages/core/__tests__/language-server/definitions.test.ts +++ b/packages/core/__tests__/language-server/definitions.test.ts @@ -63,17 +63,7 @@ describe('Language Server: Definitions', () => { expect(definitions).toMatchInlineSnapshot(` [ { - "originSelectionRange": { - "end": { - "character": 13, - "line": 5, - }, - "start": { - "character": 5, - "line": 5, - }, - }, - "targetRange": { + "range": { "end": { "character": 1, "line": 3, @@ -83,17 +73,7 @@ describe('Language Server: Definitions', () => { "line": 1, }, }, - "targetSelectionRange": { - "end": { - "character": 29, - "line": 1, - }, - "start": { - "character": 21, - "line": 1, - }, - }, - "targetUri": "file:///path/to/EPHEMERAL_TEST_PROJECT/greeting.gts", + "uri": "file:///path/to/EPHEMERAL_TEST_PROJECT/greeting.gts", }, ] `); @@ -133,17 +113,7 @@ describe('Language Server: Definitions', () => { expect(definitions).toMatchInlineSnapshot(` [ { - "originSelectionRange": { - "end": { - "character": 22, - "line": 5, - }, - "start": { - "character": 14, - "line": 5, - }, - }, - "targetRange": { + "range": { "end": { "character": 18, "line": 3, @@ -153,17 +123,7 @@ describe('Language Server: Definitions', () => { "line": 3, }, }, - "targetSelectionRange": { - "end": { - "character": 9, - "line": 3, - }, - "start": { - "character": 2, - "line": 3, - }, - }, - "targetUri": "file:///path/to/EPHEMERAL_TEST_PROJECT/greeting.gts", + "uri": "file:///path/to/EPHEMERAL_TEST_PROJECT/greeting.gts", }, ] `); @@ -193,17 +153,7 @@ describe('Language Server: Definitions', () => { expect(definitions).toMatchInlineSnapshot(` [ { - "originSelectionRange": { - "end": { - "character": 22, - "line": 7, - }, - "start": { - "character": 15, - "line": 7, - }, - }, - "targetRange": { + "range": { "end": { "character": 18, "line": 3, @@ -213,17 +163,7 @@ describe('Language Server: Definitions', () => { "line": 3, }, }, - "targetSelectionRange": { - "end": { - "character": 9, - "line": 3, - }, - "start": { - "character": 2, - "line": 3, - }, - }, - "targetUri": "file:///path/to/EPHEMERAL_TEST_PROJECT/greeting.gts", + "uri": "file:///path/to/EPHEMERAL_TEST_PROJECT/greeting.gts", }, ] `); @@ -260,18 +200,22 @@ describe('Language Server: Definitions', () => { character: 27, }); - expect(definitions).toMatchObject([ - { - targetUri: 'file:///path/to/EPHEMERAL_TEST_PROJECT/greeting.gts', - - // Versions of TS vary on whether they consider the source to be - // the entire module or just the first character, so we'll consider - // the test passing as long as the loose shape is right. - targetRange: { - start: { line: 0, character: 0 }, - end: {}, + expect(definitions).toMatchInlineSnapshot(` + [ + { + "range": { + "end": { + "character": 0, + "line": 0, + }, + "start": { + "character": 0, + "line": 0, + }, + }, + "uri": "file:///path/to/EPHEMERAL_TEST_PROJECT/greeting.gts", }, - }, - ]); + ] + `); }); }); diff --git a/packages/core/__tests__/language-server/diagnostic-augmentation.test.ts b/packages/core/__tests__/language-server/diagnostic-augmentation.test.ts index b3d39113..3d912997 100644 --- a/packages/core/__tests__/language-server/diagnostic-augmentation.test.ts +++ b/packages/core/__tests__/language-server/diagnostic-augmentation.test.ts @@ -583,7 +583,24 @@ describe('Language Server: Diagnostic Augmentation', () => { "line": 10, }, }, - "relatedInformation": [], + "relatedInformation": [ + { + "location": { + "range": { + "end": { + "character": 83, + "line": 18, + }, + "start": { + "character": 69, + "line": 18, + }, + }, + "uri": "file:///PATH_TO_MODULE/@glint/template/-private/integration.d.ts", + }, + "message": "'[InvokeDirect]' is declared here.", + }, + ], "severity": 1, "source": "glint", }, @@ -612,7 +629,24 @@ describe('Language Server: Diagnostic Augmentation', () => { "line": 11, }, }, - "relatedInformation": [], + "relatedInformation": [ + { + "location": { + "range": { + "end": { + "character": 83, + "line": 18, + }, + "start": { + "character": 69, + "line": 18, + }, + }, + "uri": "file:///PATH_TO_MODULE/@glint/template/-private/integration.d.ts", + }, + "message": "'[InvokeDirect]' is declared here.", + }, + ], "severity": 1, "source": "glint", }, @@ -641,7 +675,24 @@ describe('Language Server: Diagnostic Augmentation', () => { "line": 12, }, }, - "relatedInformation": [], + "relatedInformation": [ + { + "location": { + "range": { + "end": { + "character": 83, + "line": 18, + }, + "start": { + "character": 69, + "line": 18, + }, + }, + "uri": "file:///PATH_TO_MODULE/@glint/template/-private/integration.d.ts", + }, + "message": "'[InvokeDirect]' is declared here.", + }, + ], "severity": 1, "source": "glint", }, @@ -670,7 +721,24 @@ describe('Language Server: Diagnostic Augmentation', () => { "line": 14, }, }, - "relatedInformation": [], + "relatedInformation": [ + { + "location": { + "range": { + "end": { + "character": 83, + "line": 18, + }, + "start": { + "character": 69, + "line": 18, + }, + }, + "uri": "file:///PATH_TO_MODULE/@glint/template/-private/integration.d.ts", + }, + "message": "'[InvokeDirect]' is declared here.", + }, + ], "severity": 1, "source": "glint", }, @@ -699,7 +767,24 @@ describe('Language Server: Diagnostic Augmentation', () => { "line": 15, }, }, - "relatedInformation": [], + "relatedInformation": [ + { + "location": { + "range": { + "end": { + "character": 83, + "line": 18, + }, + "start": { + "character": 69, + "line": 18, + }, + }, + "uri": "file:///PATH_TO_MODULE/@glint/template/-private/integration.d.ts", + }, + "message": "'[InvokeDirect]' is declared here.", + }, + ], "severity": 1, "source": "glint", }, @@ -728,7 +813,24 @@ describe('Language Server: Diagnostic Augmentation', () => { "line": 16, }, }, - "relatedInformation": [], + "relatedInformation": [ + { + "location": { + "range": { + "end": { + "character": 83, + "line": 18, + }, + "start": { + "character": 69, + "line": 18, + }, + }, + "uri": "file:///PATH_TO_MODULE/@glint/template/-private/integration.d.ts", + }, + "message": "'[InvokeDirect]' is declared here.", + }, + ], "severity": 1, "source": "glint", }, @@ -757,7 +859,24 @@ describe('Language Server: Diagnostic Augmentation', () => { "line": 17, }, }, - "relatedInformation": [], + "relatedInformation": [ + { + "location": { + "range": { + "end": { + "character": 83, + "line": 18, + }, + "start": { + "character": 69, + "line": 18, + }, + }, + "uri": "file:///PATH_TO_MODULE/@glint/template/-private/integration.d.ts", + }, + "message": "'[InvokeDirect]' is declared here.", + }, + ], "severity": 1, "source": "glint", }, diff --git a/packages/core/package.json b/packages/core/package.json index 28260ffc..07e97bad 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -31,17 +31,17 @@ "prepack": "yarn build" }, "peerDependencies": { - "typescript": ">=5.4.0" + "typescript": ">=5.6.0" }, "dependencies": { "@glimmer/syntax": "^0.84.3", - "@volar/kit": "2.4.0-alpha.16", - "@volar/language-core": "2.4.0-alpha.16", - "@volar/language-server": "2.4.0-alpha.16", - "@volar/language-service": "2.4.0-alpha.16", - "@volar/source-map": "2.4.0-alpha.16", - "@volar/test-utils": "2.4.0-alpha.16", - "@volar/typescript": "2.4.0-alpha.16", + "@volar/kit": "2.4.11", + "@volar/language-core": "2.4.11", + "@volar/language-server": "2.4.11", + "@volar/language-service": "2.4.11", + "@volar/source-map": "2.4.11", + "@volar/test-utils": "2.4.11", + "@volar/typescript": "2.4.11", "computeds": "^0.0.1", "escape-string-regexp": "^4.0.0", "semver": "^7.5.2", diff --git a/packages/core/src/volar/language-server.ts b/packages/core/src/volar/language-server.ts index 1b0b8987..4e61f7c6 100644 --- a/packages/core/src/volar/language-server.ts +++ b/packages/core/src/volar/language-server.ts @@ -22,21 +22,30 @@ import GlimmerASTMappingTree from '../transform/template/glimmer-ast-mapping-tre import { Directive, TransformedModule } from '../transform/index.js'; import { Range } from '../transform/template/transformed-module.js'; import { offsetToPosition } from '../language-server/util/position.js'; +import { Disposable } from '@volar/language-service'; const connection = createConnection(); - const server = createServer(connection); +const EXTENSIONS = ['js', 'ts', 'gjs', 'gts', 'hbs']; + /** * Handle the `initialize` request from the client. This is the first request sent by the client to * the server. It includes the set of capabilities supported by the client as well as * other initialization params needed by the server. */ connection.onInitialize((parameters) => { - const project = createTypeScriptProject(ts, undefined, (projectContext) => { + // Not sure how tsLocalized is used. + const tsLocalized = undefined; + const watchingExtensions = new Set(); + let fileWatcher: Promise | undefined; + + const project = createTypeScriptProject(ts, tsLocalized, (projectContext) => { const configFileName = projectContext.configFileName; const languagePlugins = []; + updateFileWatcher(); + // I don't remember why but there are some contexts where a configFileName is not known, // in which case we cannot fully activate all of the language plugins. if (configFileName) { @@ -94,16 +103,6 @@ connection.onInitialize((parameters) => { const diagnostics = await typeScriptPlugin.provideDiagnostics!(document, token); return filterAndAugmentDiagnostics(context, document, diagnostics); }, - async provideSemanticDiagnostics( - document: TextDocument, - token: vscode.CancellationToken, - ) { - const diagnostics = await typeScriptPlugin.provideSemanticDiagnostics!( - document, - token, - ); - return filterAndAugmentDiagnostics(context, document, diagnostics); - }, }; }, }; @@ -111,8 +110,20 @@ connection.onInitialize((parameters) => { return plugin; } }), - { pullModelDiagnostics: true }, ); + + function updateFileWatcher(): void { + const newExtensions = EXTENSIONS.filter((ext) => !watchingExtensions.has(ext)); + if (newExtensions.length) { + for (const ext of newExtensions) { + watchingExtensions.add(ext); + } + fileWatcher?.then((dispose) => dispose.dispose()); + fileWatcher = server.fileWatcher.watchFiles([ + '**/*.{' + [...watchingExtensions].join(',') + '}', + ]); + } + } }); function filterAndAugmentDiagnostics( @@ -282,41 +293,11 @@ function filterAndAugmentDiagnostics( return allDiagnostics; } -// connection.onRequest('mdx/toggleDelete', async (parameters) => { -// const commands = await getCommands(parameters.uri) -// return commands.toggleDelete(parameters) -// }) - -// connection.onRequest('mdx/toggleEmphasis', async (parameters) => { -// const commands = await getCommands(parameters.uri) -// return commands.toggleEmphasis(parameters) -// }) - -// connection.onRequest('mdx/toggleInlineCode', async (parameters) => { -// const commands = await getCommands(parameters.uri) -// return commands.toggleInlineCode(parameters) -// }) - -// connection.onRequest('mdx/toggleStrong', async (parameters) => { -// const commands = await getCommands(parameters.uri) -// return commands.toggleStrong(parameters) -// }) - /** - * Invoked when client has sent `initialized` notification. Volar takes this - * opportunity to finish initializing, and we tell the client which extensions - * it should add file-watchers for (technically file-watchers could eagerly - * be set up on the client (e.g. when the extension activates), but since Volar - * capabilities use dynamic/deferredregistration, we have the server tell the - * client which files to watch via the deferred `registerCapability` message - * within `watchFiles()`). + * Invoked when client has sent `initialized` notification. */ connection.onInitialized(() => { server.initialized(); - - const extensions = ['js', 'ts', 'gjs', 'gts', 'hbs']; - - server.watchFiles([`**.*.{${extensions.join(',')}}`]); }); connection.listen(); diff --git a/packages/typescript-plugin/package.json b/packages/typescript-plugin/package.json index b25036a0..c3b0e2d6 100644 --- a/packages/typescript-plugin/package.json +++ b/packages/typescript-plugin/package.json @@ -22,7 +22,7 @@ }, "dependencies": { "@glint/core": "^1.4.0", - "@volar/typescript": "2.4.0-alpha.16" + "@volar/typescript": "2.4.11" }, "publishConfig": { "access": "public" diff --git a/packages/vscode/package.json b/packages/vscode/package.json index 446a2d8d..69abe003 100644 --- a/packages/vscode/package.json +++ b/packages/vscode/package.json @@ -232,8 +232,8 @@ "@glint/core": "^1.4.0", "@types/mocha": "^10.0.1", "@types/vscode": "^1.68.1", - "@volar/language-server": "2.4.0-alpha.16", - "@volar/vscode": "2.4.0-alpha.16", + "@volar/language-server": "2.4.11", + "@volar/vscode": "2.4.11", "@vscode/test-electron": "^2.3.8", "@vscode/vsce": "^2.22.0", "esbuild": "^0.15.16", diff --git a/test-packages/test-utils/src/project.ts b/test-packages/test-utils/src/project.ts index 7ab95738..b32b1751 100644 --- a/test-packages/test-utils/src/project.ts +++ b/test-packages/test-utils/src/project.ts @@ -73,10 +73,13 @@ export class Project { // '../', // 'node_modules', // 'typescript', - // 'lib' + // 'lib', // ), // }, }; + + // We need to construct a capabilities object that mirrors how VScode + similar editors + // will initialize the Language Server. const capabilities = { workspace: { // Needed for tests that use didChangeWatchedFiles diff --git a/tsconfig.compileroptions.json b/tsconfig.compileroptions.json index d4ac8bc1..0c2a8cb0 100644 --- a/tsconfig.compileroptions.json +++ b/tsconfig.compileroptions.json @@ -5,7 +5,7 @@ "module": "Node16", "moduleResolution": "Node16", // changing this was necessary for WeakRef to be available (required/referenced in Volar) - "lib": ["ESNext", "dom"], + "lib": ["ES2021", "dom"], "strict": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, diff --git a/yarn.lock b/yarn.lock index 29c7d4dc..5470821b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3440,33 +3440,32 @@ loupe "^2.3.7" pretty-format "^29.7.0" -"@volar/kit@2.4.0-alpha.16": - version "2.4.0-alpha.16" - resolved "https://registry.yarnpkg.com/@volar/kit/-/kit-2.4.0-alpha.16.tgz#9d0329376e6b267587dce8169d6c329eb90eb03b" - integrity sha512-jRPfMrxl8N53UkFINMoY777FBqG49RUqWkJt4yOlNEW8CmUS8fmUw4cz/jMv08KnQUyD3IeZWFtt3XZcQqe4Zw== +"@volar/kit@2.4.11": + version "2.4.11" + resolved "https://registry.yarnpkg.com/@volar/kit/-/kit-2.4.11.tgz#12fa1825bdbaa54752e86d9eecb0d3b6d1c60f5e" + integrity sha512-ups5RKbMzMCr6RKafcCqDRnJhJDNWqo2vfekwOAj6psZ15v5TlcQFQAyokQJ3wZxVkzxrQM+TqTRDENfQEXpmA== dependencies: - "@volar/language-service" "2.4.0-alpha.16" - "@volar/typescript" "2.4.0-alpha.16" + "@volar/language-service" "2.4.11" + "@volar/typescript" "2.4.11" typesafe-path "^0.2.2" vscode-languageserver-textdocument "^1.0.11" vscode-uri "^3.0.8" -"@volar/language-core@2.4.0-alpha.16": - version "2.4.0-alpha.16" - resolved "https://registry.yarnpkg.com/@volar/language-core/-/language-core-2.4.0-alpha.16.tgz#fd4d38ccbf5ad13ebb29eacfdda719807749ffac" - integrity sha512-oOTnIZlx0P/idFwVw+W0NbzKDtZAQMzXSdIFfTePCKcXlb4Ys12GaGkx8NF9dsvPYV3nbv3ZsSxnkZWBmNKd7A== +"@volar/language-core@2.4.11": + version "2.4.11" + resolved "https://registry.yarnpkg.com/@volar/language-core/-/language-core-2.4.11.tgz#d95a9ec4f14fbdb41a6a64f9f321d11d23a5291c" + integrity sha512-lN2C1+ByfW9/JRPpqScuZt/4OrUUse57GLI6TbLgTIqBVemdl1wNcZ1qYGEo2+Gw8coYLgCy7SuKqn6IrQcQgg== dependencies: - "@volar/source-map" "2.4.0-alpha.16" + "@volar/source-map" "2.4.11" -"@volar/language-server@2.4.0-alpha.16": - version "2.4.0-alpha.16" - resolved "https://registry.yarnpkg.com/@volar/language-server/-/language-server-2.4.0-alpha.16.tgz#c47a316e0df523b7b337b5afc5bf7e811e2c62c2" - integrity sha512-DswMBlmmXPo9fb1Dmb2qrCtxRDgQPej5jUjAoUm+1wO5k02Tk+jIvbbd/R3EzyHFTARmiRH5/bSOfRefHyuMsg== +"@volar/language-server@2.4.11": + version "2.4.11" + resolved "https://registry.yarnpkg.com/@volar/language-server/-/language-server-2.4.11.tgz#e0d87bd8d4eee0470e806e832ed26f27caf08d81" + integrity sha512-W9P8glH1M8LGREJ7yHRCANI5vOvTrRO15EMLdmh5WNF9sZYSEbQxiHKckZhvGIkbeR1WAlTl3ORTrJXUghjk7g== dependencies: - "@volar/language-core" "2.4.0-alpha.16" - "@volar/language-service" "2.4.0-alpha.16" - "@volar/snapshot-document" "2.4.0-alpha.16" - "@volar/typescript" "2.4.0-alpha.16" + "@volar/language-core" "2.4.11" + "@volar/language-service" "2.4.11" + "@volar/typescript" "2.4.11" path-browserify "^1.0.1" request-light "^0.7.0" vscode-languageserver "^9.0.1" @@ -3474,54 +3473,46 @@ vscode-languageserver-textdocument "^1.0.11" vscode-uri "^3.0.8" -"@volar/language-service@2.4.0-alpha.16": - version "2.4.0-alpha.16" - resolved "https://registry.yarnpkg.com/@volar/language-service/-/language-service-2.4.0-alpha.16.tgz#b54c4e67eb98e0f56912aaaf8420375adf7d0895" - integrity sha512-iIRUY0EL9jp8Od7Py/GlYpCu469GFDYl7ai716pQgwipjpjEjRQiuGAD2+cSFjOVXDsMPFpJ+Dpei7aSvE/8pQ== +"@volar/language-service@2.4.11": + version "2.4.11" + resolved "https://registry.yarnpkg.com/@volar/language-service/-/language-service-2.4.11.tgz#44008ad68ff82c618fe4f6ad338af9164853e82b" + integrity sha512-KIb6g8gjUkS2LzAJ9bJCLIjfsJjeRtmXlu7b2pDFGD3fNqdbC53cCAKzgWDs64xtQVKYBU13DLWbtSNFtGuMLQ== dependencies: - "@volar/language-core" "2.4.0-alpha.16" + "@volar/language-core" "2.4.11" vscode-languageserver-protocol "^3.17.5" vscode-languageserver-textdocument "^1.0.11" vscode-uri "^3.0.8" -"@volar/snapshot-document@2.4.0-alpha.16": - version "2.4.0-alpha.16" - resolved "https://registry.yarnpkg.com/@volar/snapshot-document/-/snapshot-document-2.4.0-alpha.16.tgz#c0d3d2da941d1f384b9b71590e6fe5ce9b657eb5" - integrity sha512-X9xZeLvkmhjkrz27J6nq9JhYWV8AUT1KS9fi4s+Mo1FOh5HHUIx/QzhrwsUN/pY1z3kO+vtrl2DE6NVJRYwwbw== - dependencies: - vscode-languageserver-protocol "^3.17.5" - vscode-languageserver-textdocument "^1.0.11" - -"@volar/source-map@2.4.0-alpha.16": - version "2.4.0-alpha.16" - resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-2.4.0-alpha.16.tgz#3a86ffadbba6928cd3f6717220dd87f8c1522904" - integrity sha512-sL9vNG7iR2hiKZor7UkD5Sufu3QCia4cbp2gX/nGRNSdaPbhOpdAoavwlBm0PrVkpiA19NZuavZoobD8krviFg== +"@volar/source-map@2.4.11": + version "2.4.11" + resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-2.4.11.tgz#5876d4531508129724c2755e295db1df98bd5895" + integrity sha512-ZQpmafIGvaZMn/8iuvCFGrW3smeqkq/IIh9F1SdSx9aUl0J4Iurzd6/FhmjNO5g2ejF3rT45dKskgXWiofqlZQ== -"@volar/test-utils@2.4.0-alpha.16": - version "2.4.0-alpha.16" - resolved "https://registry.yarnpkg.com/@volar/test-utils/-/test-utils-2.4.0-alpha.16.tgz#20418e679c6f3ef2dc54ae41136e9f7849791109" - integrity sha512-O2MIR0H8f0LGSEWrFk+1g9PQmO9qlsv+djpnrnsBhx+mmnKmsX1T35CujOCvx8LLvlob+qlINrh3kTYCCUH7ww== +"@volar/test-utils@2.4.11": + version "2.4.11" + resolved "https://registry.yarnpkg.com/@volar/test-utils/-/test-utils-2.4.11.tgz#6caddc065d323b404f285473c1535505d67a7d66" + integrity sha512-ogkLldPqFa/j9302Ns+nWeyTCQv8d4c7iN4t8ziq7j0XeMKWYsTAjLsx/9z0MTNrecBAcocgzEvCricASSq+Hw== dependencies: - "@volar/language-core" "2.4.0-alpha.16" - "@volar/language-server" "2.4.0-alpha.16" + "@volar/language-core" "2.4.11" + "@volar/language-server" "2.4.11" vscode-languageserver-textdocument "^1.0.11" vscode-uri "^3.0.8" -"@volar/typescript@2.4.0-alpha.16": - version "2.4.0-alpha.16" - resolved "https://registry.yarnpkg.com/@volar/typescript/-/typescript-2.4.0-alpha.16.tgz#bd267e9389207761e9dcda61ace619a8943384e5" - integrity sha512-WCx7z5O81McCQp2cC0c8081y+MgTiAR2WAiJjVL4tr4Qh4GgqK0lgn3CqAjcKizaK1R5y3wfrUqgIYr+QeFYcw== +"@volar/typescript@2.4.11": + version "2.4.11" + resolved "https://registry.yarnpkg.com/@volar/typescript/-/typescript-2.4.11.tgz#aafbfa413337654db211bf4d8fb6670c89f6fa57" + integrity sha512-2DT+Tdh88Spp5PyPbqhyoYavYCPDsqbHLFwcUI9K1NlY1YgUJvujGdrqUp0zWxnW7KWNTr3xSpMuv2WnaTKDAw== dependencies: - "@volar/language-core" "2.4.0-alpha.16" + "@volar/language-core" "2.4.11" path-browserify "^1.0.1" vscode-uri "^3.0.8" -"@volar/vscode@2.4.0-alpha.16": - version "2.4.0-alpha.16" - resolved "https://registry.yarnpkg.com/@volar/vscode/-/vscode-2.4.0-alpha.16.tgz#c5cb2ac7cc4a389d230f0d1f61888fb25c6d6597" - integrity sha512-VVAuX8zyFglFqnRsLdlSXetDSII3SjLt3Vaaw88iXILP7Wcf0XFzen6jD+yCnMFR8GiFOXikHlcejKnghoBKgQ== +"@volar/vscode@2.4.11": + version "2.4.11" + resolved "https://registry.yarnpkg.com/@volar/vscode/-/vscode-2.4.11.tgz#9faf69ec265484ffe125fc4af9394020720101b3" + integrity sha512-rhGIAMcF/lMBtUXrm7K0HLQlEYSdB7+0JXrkJ1snYv9iH9hiEEioq+jwb40+w2KWYO2HrlpfsQ1m+MvjiwW/AA== dependencies: - "@volar/language-server" "2.4.0-alpha.16" + "@volar/language-server" "2.4.11" path-browserify "^1.0.1" vscode-languageclient "^9.0.1" vscode-nls "^5.2.0" @@ -12914,11 +12905,16 @@ semver@^7.1.3, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semve dependencies: lru-cache "^6.0.0" -semver@^7.5.3, semver@^7.6.2: +semver@^7.5.3: version "7.6.2" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13" integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w== +semver@^7.6.2: + version "7.6.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== + send@0.18.0: version "0.18.0" resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" @@ -14145,9 +14141,9 @@ typesafe-path@^0.2.2: integrity sha512-OJabfkAg1WLZSqJAJ0Z6Sdt3utnbzr/jh+NAHoyWHJe8CMSy79Gm085094M9nvTPy22KzTVn5Zq5mbapCI/hPA== typescript-auto-import-cache@^0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/typescript-auto-import-cache/-/typescript-auto-import-cache-0.3.3.tgz#45f376313d1eb0929ce47ef1d1aae5a353d060a3" - integrity sha512-ojEC7+Ci1ij9eE6hp8Jl9VUNnsEKzztktP5gtYNRMrTmfXVwA1PITYYAkpxCvvupdSYa/Re51B6KMcv1CTZEUA== + version "0.3.5" + resolved "https://registry.yarnpkg.com/typescript-auto-import-cache/-/typescript-auto-import-cache-0.3.5.tgz#402f98995037734ef3fc208180331adfd5e495fc" + integrity sha512-fAIveQKsoYj55CozUiBoj4b/7WpN0i4o74wiGY5JVUEoD0XiqDk1tJqTEjgzL2/AizKQrXxyRosSebyDzBZKjw== dependencies: semver "^7.3.8" @@ -14156,11 +14152,16 @@ typescript-memoize@^1.0.0-alpha.3, typescript-memoize@^1.0.1: resolved "https://registry.yarnpkg.com/typescript-memoize/-/typescript-memoize-1.1.1.tgz#02737495d5df6ebf72c07ba0d002e8f4cf5ccfa0" integrity sha512-GQ90TcKpIH4XxYTI2F98yEQYZgjNMOGPpOgdjIBhaLaWji5HPWlRnZ4AeA1hfBxtY7bCGDJsqDDHk/KaHOl5bA== -typescript@*, typescript@>=5.4.0: +typescript@*: version "5.5.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.3.tgz#e1b0a3c394190838a0b168e771b0ad56a0af0faa" integrity sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ== +typescript@>=5.6.0: + version "5.7.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e" + integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw== + uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" @@ -14509,9 +14510,9 @@ vm2@^3.9.19: acorn-walk "^8.2.0" volar-service-typescript@volar-2.4: - version "0.0.59" - resolved "https://registry.yarnpkg.com/volar-service-typescript/-/volar-service-typescript-0.0.59.tgz#9b549b3fd1e97026f0b4a9de199b39806ee02e5a" - integrity sha512-VCOpfiu+lUo5lapWLB5L5vmQGtwzmNWn5MueV915eku7blpphmE+Z7hCNcL1NApn7AetXWhiblv8ZhmUx/dGIA== + version "0.0.62" + resolved "https://registry.yarnpkg.com/volar-service-typescript/-/volar-service-typescript-0.0.62.tgz#d99c42e2e08742f27b9bb186180dac93ce730ee6" + integrity sha512-p7MPi71q7KOsH0eAbZwPBiKPp9B2+qrdHAd6VY5oTo9BUXatsOAdakTm9Yf0DUj6uWBAaOT01BSeVOPwucMV1g== dependencies: path-browserify "^1.0.1" semver "^7.6.2"