{"_id":"typescript-language-server@6.0.3","bin":{"typescript-language-server":"lib/cli.mjs"},"bugs":{"url":"https://github.com/typescript-language-server/typescript-language-server/issues"},"dist":{"shasum":"0d169fec685d4a79f36d5fcc046c7617135500d1","tarball":"http://registry-npm.ywwl.com/typescript-language-server/download/typescript-language-server-6.0.3.tgz","fileCount":5,"integrity":"sha512-iAxKyLXRNbnxGfCGZ/j4ilAb0PSNommvTvcghF8B8sq5JFGDKEQwzNEFZ0KTYEwzcA7rtRa+2OPeouiFR8L5KA==","signatures":[{"sig":"MEYCIQCfgfvvrt6P7PwHONVDzo8kYB+azMsEIJtq/towwz/9CgIhANYlB0QG0RZYMrdMjd9FbS1TfsySP0ICWCw/ca+qEGKe","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCHTrl6r1AtDqCGEgnExUOsNv5ChUypwY4EfxTZvBmDlwIhAPiYLqsjhiyQdCwif11wvijeAnUGhcBrnMZHzXGYRynd"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/typescript-language-server@6.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":2421102,"size":514069,"noattachment":false,"key":"/typescript-language-server/-/typescript-language-server-6.0.3.tgz"},"name":"typescript-language-server","type":"module","author":{"name":"TypeFox and others"},"engines":{"node":">=22.22.2"},"gitHead":"77bec1d1ac9a21ca0fefdb37dc248443df959fc5","license":"Apache-2.0","scripts":{"dev":"rimraf lib && rollup --config rollup.config.ts --configPlugin \"typescript={sourceMap: false}\" --watch","fix":"eslint --ext \".js,.ts\" --fix src","lint":"eslint --ext \".js,.ts\" src","size":"pnpm build && size-limit","test":"cross-env CONSOLE_LOG_LEVEL=warning vitest --coverage","build":"rimraf lib && rollup --config rollup.config.ts --configPlugin \"typescript={sourceMap: false}\"","clean":"rimraf lib *.tsbuildinfo","prepare":"husky","typecheck":"tsc","postversion":"git push --follow-tags","test:commit":"cross-env CONSOLE_LOG_LEVEL=warning vitest run"},"version":"6.0.3","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"bd2659ec-0ca6-40c3-b06a-1ab7a1120dd1"}},"homepage":"https://github.com/typescript-language-server/typescript-language-server#readme","repository":{"url":"git+https://github.com/typescript-language-server/typescript-language-server.git","type":"git"},"_npmVersion":"11.19.1","description":"Language Server Protocol (LSP) implementation for TypeScript using tsserver","directories":{},"maintainers":[{"name":"prabir","email":"mail@prabir.me"},{"name":"donniewest","email":"me@donniewest.com"},{"name":"rchl","email":"rchl2k@gmail.com"}],"_nodeVersion":"24.22.2","eslintIgnore":["!.eslintrc.cjs"],"_hasShrinkwrap":false,"packageManager":"pnpm@12.15.0","devDependencies":{"husky":"^9.1.7","tempy":"^3.2.0","which":"^7.0.0","eslint":"^10.13.0","rimraf":"^6.1.3","rollup":"^4.65.0","semver":"^7.8.5","vitest":"^5.0.5","globals":"^17.13.0","fs-extra":"^11.4.1","commander":"^15.0.0","cross-env":"^10.1.0","@eslint/js":"^10.0.1","p-debounce":"^6.0.0","package-up":"^5.0.0","size-limit":"^14.3.0","typescript":"^6.0.3","vscode-uri":"^3.2.0","@types/node":"^22.20.5","@types/which":"^3.0.4","concurrently":"^10.0.6","@types/semver":"^7.8.0","vscode-jsonrpc":"^10.0.0","@types/fs-extra":"^11.0.4","@size-limit/file":"^14.3.0","typescript-eslint":"^8.72.0","source-map-support":"^0.5.21","@rollup/plugin-json":"^6.1.0","@vitest/coverage-v8":"5.0.5","why-is-node-running":"^3.2.3","@rollup/plugin-terser":"^1.0.2","@vitest/eslint-plugin":"^1.6.28","vscode-languageserver":"^11.0.0","@rollup/plugin-commonjs":"^29.0.3","@stylistic/eslint-plugin":"^5.10.0","@rollup/plugin-typescript":"^12.3.1","@rollup/plugin-node-resolve":"^16.0.3","vscode-languageserver-protocol":"^3.18.5","vscode-languageserver-textdocument":"1.0.16"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/typescript-language-server_6.0.3_1793610870029_0.1145436774260874"},"readme":"[![Discord][discord-src]][discord-href]\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n\n# TypeScript Language Server\n\n<!-- MarkdownTOC -->\n\n- [What is it, exactly?](#what-is-it-exactly)\n- [Installing](#installing)\n- [Running the language server](#running-the-language-server)\n- [CLI Options](#cli-options)\n- [Configuration](#configuration)\n- [Features](#features)\n    - [Code actions on save](#code-actions-on-save)\n    - [Workspace commands \\(`workspace/executeCommand`\\)](#workspace-commands-workspaceexecutecommand)\n        - [Go to Source Definition](#go-to-source-definition)\n        - [Apply Refactoring](#apply-refactoring)\n        - [Organize Imports](#organize-imports)\n        - [Rename File](#rename-file)\n        - [Send Tsserver Command](#send-tsserver-command)\n        - [Configure plugin](#configure-plugin)\n    - [Code Lenses \\(`textDocument/codeLens`\\)](#code-lenses-textdocumentcodelens)\n    - [Inlay hints \\(`textDocument/inlayHint`\\)](#inlay-hints-textdocumentinlayhint)\n    - [TypeScript Version Notification](#typescript-version-notification)\n    - [Workspace Configuration request for formatting settings](#workspace-configuration-request-for-formatting-settings)\n- [Development](#development)\n    - [Build](#build)\n    - [Dev](#dev)\n    - [Test](#test)\n    - [Publishing](#publishing)\n\n<!-- /MarkdownTOC -->\n\n## What is it, exactly?\n\nThe [TypeScript](https://github.com/microsoft/TypeScript) project/package includes a `tsserver` component which provides a custom API that can be used for gathering various intelligence about a typescript/javascript project. The [VSCode](https://github.com/microsoft/vscode) team has built a project called `Typescript Language Features` (and bundled it as an internal extension in VSCode) that provides code intelligence for your javascript and typescript projects by utilizing that `tsserver` API. Since that extension doesn't use the standardized [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) to communicate with the editor, other editors that implement LSP can't directly utilize it. Here is where the `TypeScript Language Server` project comes in with the aim to provide a thin LSP interface on top of that extension's code base for the benefit of all other editors that implement the LSP protocol.\n\nOriginally based on concepts and ideas from https://github.com/prabirshrestha/typescript-language-server and maintained by [TypeFox](https://typefox.io). Currently maintained by a [community of contributors](https://github.com/typescript-language-server/typescript-language-server/graphs/contributors) like you.\n\nThis project is not directly associated with Microsoft and is not used in their [VSCode](https://github.com/microsoft/vscode) editor. If you have an issue with VSCode functionality, report it in their repository instead.\n\nCurrently Microsoft is working on [TypeScript 7](https://github.com/microsoft/typescript-go) written natively in the go language that will include the LSP implementation and will hopefully supersede this project.\n\n## Installing\n\n```sh\nnpm install -g typescript-language-server typescript@6\n```\n\n## Running the language server\n\n```\ntypescript-language-server --stdio\n```\n\n## CLI Options\n\n```\n  Usage: typescript-language-server [options]\n\n\n  Options:\n\n    -V, --version                          output the version number\n    --stdio                                use stdio (required option)\n    --log-level <log-level>                A number indicating the log level (4 = log, 3 = info, 2 = warn, 1 = error). Defaults to `3`.\n    -h, --help                             output usage information\n```\n\n## Configuration\n\nSee [configuration documentation](./docs/configuration.md).\n\n## Features\n\n### Code actions on save\n\nServer announces support for the following code action kinds:\n\n - `source.fixAll.ts` - despite the name, fixes a couple of specific issues: unreachable code, await in non-async functions, incorrectly implemented interface\n - `source.removeUnused.ts` - removes declared but unused variables\n - `source.addMissingImports.ts` - adds imports for used but not imported symbols\n - `source.removeUnusedImports.ts` - removes unused imports\n - `source.sortImports.ts` - sorts imports\n - `source.organizeImports.ts` - organizes and removes unused imports\n\nThis allows editors that support running code actions on save to automatically run fixes associated with those kinds.\n\nThose code actions, if they apply in the current code, should also be presented in the list of \"Source Actions\" if the editor exposes those.\n\nThe user can enable it with a setting similar to (can vary per-editor):\n\n```js\n\"codeActionsOnSave\": {\n    \"source.organizeImports.ts\": true,\n    // or just\n    \"source.organizeImports\": true,\n}\n```\n\n### Workspace commands (`workspace/executeCommand`)\n\nSee [LSP specification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_executeCommand).\n\nMost of the time, you'll execute commands with arguments retrieved from another request like `textDocument/codeAction`. There are some use cases for calling them manually.\n\n`lsp` refers to the language server protocol types, `tsp` refers to the typescript server protocol types.\n\n#### Go to Source Definition\n\nRequest:\n\n```ts\n{\n    command: '_typescript.goToSourceDefinition'\n    arguments: [\n        lsp.DocumentUri,  // String URI of the document\n        lsp.Position,     // Line and character position (zero-based)\n    ]\n}\n```\n\nResponse:\n\n```ts\nlsp.Location[] | null\n```\n\n(This command is supported from Typescript 4.7.)\n\n#### Apply Refactoring\n\nRequest:\n\n```ts\n{\n    command: '_typescript.applyRefactoring'\n    arguments: [\n        tsp.GetEditsForRefactorRequestArgs,\n    ]\n}\n```\n\nResponse:\n\n```ts\nvoid\n```\n\n#### Organize Imports\n\nRequest:\n\n```ts\n{\n    command: '_typescript.organizeImports'\n    arguments: [\n        string,  // file path\n        // Optional options:\n        {\n            // @deprecated - use \"mode\". Supported from Typescript 4.4+.\n            skipDestructiveCodeActions?: boolean\n            // 'All' - organizes imports including destructive actions (removing unused imports)\n            // 'SortAndCombine' - Doesn't perform destructive actions.\n            // 'RemoveUnused' - Only removes unused imports.\n            mode?: 'All' | 'SortAndCombine' | 'RemoveUnused'\n        },\n    ]\n}\n```\n\nResponse:\n\n```ts\nvoid\n```\n\n#### Rename File\n\nRequest:\n\n```ts\n{\n    command: '_typescript.applyRenameFile'\n    arguments: [\n        { sourceUri: string; targetUri: string; },\n    ]\n}\n```\n\nResponse:\n\n```ts\nvoid\n```\n\n#### Send Tsserver Command\n\nRequest:\n\n```ts\n{\n    command: 'typescript.tsserverRequest'\n    arguments: [\n        string,       // command\n        any,          // command arguments in a format that the command expects\n        ExecuteInfo,  // configuration object used for the tsserver request (see below)\n    ]\n}\n```\n\nResponse:\n\n```ts\nany\n```\n\nThe `ExecuteInfo` object is defined as follows:\n\n```ts\ntype ExecuteInfo = {\n    executionTarget?: number;  // 0 - semantic server, 1 - syntax server; default: 0\n    expectsResult?: boolean;   // default: true\n    isAsync?: boolean;         // default: false\n    lowPriority?: boolean;     // default: true\n};\n```\n\n#### Configure plugin\n\nRequest:\n\n```ts\n{\n    command: '_typescript.configurePlugin'\n    arguments: [pluginName: string, configuration: any]\n}\n```\n\nResponse:\n\n```ts\nvoid\n```\n\n### Code Lenses (`textDocument/codeLens`)\n\nCode lenses can be enabled using the `implementationsCodeLens` and `referencesCodeLens` [workspace configuration options](/docs/configuration.md/#workspacedidchangeconfiguration).\n\nCode lenses provide a count of **references** and/or **implemenations** for symbols in the document. For clients that support it it's also possible to click on those to navigate to the relevant locations in the the project. Do note that clicking those trigger a `editor.action.showReferences` command which is something that client needs to have explicit support for. Many do by default but some don't. An example command will look like this:\n\n```ts\ncommand: {\n    title: '1 reference',\n    command: 'editor.action.showReferences',\n    arguments: [\n        'file://project/foo.ts',    // URI\n        { line: 1, character: 1 },  // Position\n        [                           // A list of Location objects.\n            {\n                uri: 'file://project/bar.ts',\n                range: {\n                    start: {\n                        line: 7,\n                        character: 24,\n                    },\n                    end: {\n                        line: 7,\n                        character: 28,\n                    },\n                },\n            },\n        ],\n    ],\n}\n```\n\n### Inlay hints (`textDocument/inlayHint`)\n\nFor the request to return any results, some or all of the following options need to be enabled through `preferences`:\n\n```ts\nexport interface InlayHintsOptions extends UserPreferences {\n    includeInlayParameterNameHints: 'none' | 'literals' | 'all';\n    includeInlayParameterNameHintsWhenArgumentMatchesName: boolean;\n    includeInlayFunctionParameterTypeHints: boolean;\n    includeInlayVariableTypeHints: boolean;\n    includeInlayVariableTypeHintsWhenTypeMatchesName: boolean;\n    includeInlayPropertyDeclarationTypeHints: boolean;\n    includeInlayFunctionLikeReturnTypeHints: boolean;\n    includeInlayEnumMemberValueHints: boolean;\n}\n```\n\n### TypeScript Version Notification\n\nRight after initializing, the server sends a custom `$/typescriptVersion` notification that carries information about the version of TypeScript that is utilized by the server. The editor can then display that information in the UI.\n\nThe `$/typescriptVersion` notification params include two properties:\n\n - `version` - a semantic version (for example `4.8.4`)\n - `source` - a string specifying whether used TypeScript version comes from the local workspace (`workspace`), is explicitly specified through a `initializationOptions.tsserver.path` setting (`user-setting`) or was bundled with the server (`bundled`)\n\n\n### Workspace Configuration request for formatting settings\n\nServer asks the client (provided client supports `workspace/configuration` capability) for file-specific configuration options (`tabSize` and `insertSpaces`) that are required by `tsserver` to properly format file edits when for example using \"Organize imports\" or performing other file modifications. Those options have to be dynamically provided by the client/editor since the values can differ for each file. For this reason server sends a `workspace/configuration` request with `scopeUri` equal to file's URI and `section` equal to `formattingOptions`. The client is expected to return a configuration that includes the following properties:\n\n```js\n{\n    \"tabSize\": number\n    \"insertSpaces\": boolean\n}\n```\n\n## Development\n\n### Build\n\n```sh\npnpm build\n```\n\n### Dev\n\nBuild and rebuild on change.\n\n```sh\npnpm dev\n```\n\n### Test\n\n - `pnpm test` - run all tests in watch mode for developing\n - `pnpm test:commit` - run all tests once\n\nBy default only console logs of level `warning` and higher are printed to the console. You can override the `CONSOLE_LOG_LEVEL` level in `package.json` to either `log`, `info`, `warning` or `error` to log other levels.\n\n### Publishing\n\nThe project uses https://github.com/google-github-actions/release-please-action Github action to automatically release new version on merging a release PR.\n\n[npm-version-src]: https://img.shields.io/npm/dt/typescript-language-server.svg?style=flat-square\n[npm-version-href]: https://npmjs.com/package/typescript-language-server\n[npm-downloads-src]: https://img.shields.io/npm/v/typescript-language-server/latest.svg?style=flat-square\n[npm-downloads-href]: https://npmjs.com/package/typescript-language-server\n[discord-src]: https://img.shields.io/discord/873659987413573634?style=flat-square\n[discord-href]: https://discord.gg/AC7Vs6hwFa\n","publish_time":1793610870154,"_cnpm_publish_time":1793610870154,"dist-tags":{"latest":"6.0.3","logs":"3.3.3-0"}}