Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@volar/typescript

volarjs7.4mMIT2.4.11TypeScript support: included

null

readme

Volar.js

Packages

@volar/language-core
  |
  |--- @volar/language-service
        |
        |--- @volar/language-server
        |     |
        |     |--- @volar/vscode (as a client to the language server)
        |
        |--- @volar/kit (encapsulates @volar/language-service for Node.js applications)
        |
        |--- @volar/monaco (integrates @volar/language-service into Monaco Editor)

@volar/language-core

This module contains the core language processing functionalities, such as creating and updating virtual code objects. It serves as the foundation for the other modules, providing basic language processing capabilities.

@volar/language-service

This module provides language service functionalities, such as offering IntelliSense features. It depends on @volar/language-core for obtaining and processing virtual code, and then provides corresponding language services.

@volar/language-server

This module acts as a language server, utilizing the language services provided by @volar/language-service and offering these services to clients (like VS Code) through the Language Server Protocol (LSP). It also relies on @volar/language-core for handling basic language processing tasks.

@volar/vscode

This module acts as a Language Server Protocol (LSP) language client. Its primary responsibility is to communicate with the @volar/language-server module (acting as an LSP server) and integrate the language services provided by the server into the VS Code editor. This architecture allows for the reuse of language services across different editors and IDEs, with the implementation of the corresponding LSP client. In this case, @volar/vscode is the LSP client implementation for VS Code.

@volar/kit

@volar/kit is a module that encapsulates @volar/language-service. It provides a simplified interface for using Volar's diagnostic and formatting features within Node.js applications.

@volar/monaco

This module is an extension of Volar.js for the Monaco Editor. It utilizes the language services provided by @volar/language-service and integrates these services into the Monaco Editor. This includes features like syntax highlighting, code completion, and definition jumping. Essentially, @volar/monaco serves as a bridge to bring Volar.js's language services into the Monaco Editor.

Sponsors

Special Sponsor

Stay in the flow with instant dev experiences.
No more hours stashing/pulling/installing locally

— just click, and start coding.

Platinum Sponsors

An approachable, performant and versatile framework for building web user interfaces.

Astro powers the world's fastest websites, client-side web apps, dynamic API endpoints, and everything in-between.

Essential tools for software developers and teams.

Open Source enables Microsoft products and services to bring choice, technology and community to our customers.

Silver Sponsors

Become a sponsor

changelog

Changelog

2.4.10 (2024-11-08)

Bug Fixes

  • typescript: fix interactive refactors (#244) - Thanks to @andrewbranch!

2.4.9 (2024-11-07)

Bug Fixes

  • typescript: avoid crash when converting relatedInformation from overly large files

2.4.8 (2024-10-26)

Bug Fixes

  • typescript: content-sensitive features are only allowed to return results in contiguous mapped ranges (#243)

2.4.7 (2024-10-25)

Bug Fixes

  • typescript: set module resolution cache (#242) - Thanks to @Princesseuh!

2.4.6 (2024-10-07)

Bug Fixes

  • language-server: correctly calculate coalesced document change (#240) - Thanks to @rchl!

2.4.5 (2024-09-14)

Bug Fixes

  • typescript: avoid duplicate completion items in plugin mode

Refactors

  • typescript: deprecated resolveLanguageServiceHost
  • kit: add setup hook for create checker functions

2.4.4 (2024-09-08)

Bug Fixes

  • monaco: requests always cancel

2.4.3 (2024-09-08)

Bug Fixes

  • language-server: handle completion item snippet unsupported (withastro/language-tools#948)
  • monaco: getDiagnostics throws "TypeError: response is not a function"

Refactors

  • language-server: improve error handling for unsupported capabilities

2.4.2 (2024-09-04)

Bug Fixes

  • language-server: prepare language service for synchronized documents
  • typescript: fix inlay hints mapping for large chunks of source code mapped verbatim to generated code (#236) - Thanks to @piotrtomiak!

2.4.1 (2024-08-29)

Features

  • language-server: support files that do not exist in FS but are open in the editor for TS project (#235)

Bug Fixes

  • typescript: ensure unopened files are synced to project (vuejs/language-tools#4711) (vuejs/language-tools#4632) - Thanks to @davidmatter!
  • language-server: avoid project initialized twice
  • language-service: don't set item data if item has been resolved
  • language-service: don't set item data if LanguageServicePlugin does not provide resolve hook (#233)
  • test-utils: correct openUntitledDocument params order
  • typescript: runTsc does not recognize service script with preventLeadingOffset enabled
  • language-server: replace setTimeout with setImmediate (#234) - Thanks to @nieyuyao!

Refactors

  • language-server: add onDidChange API for LanguageServer.workspaceFolders
  • language-core: add error, source params for verification.shouldReport hook

2.4.0 (2024-08-18)

Features

Bug Fixes

  • language-service: multi-level DocumentSymbol results from different virtual code are not merged accurately
  • typescript: use Proxy instead of modifying LanguageService instance (#216)
  • typescript: implement directoryExists for language service host
  • typescript: improve accuracy of runTsc extensions parameter behavior (#222)
  • typescript: synchronize script snapshots in a side-effect-free manner (#226)
  • typescript: add missing workspace symbols support for TS plugin (vuejs/language-tools#4595)
  • typescript: add missing code actions support for TS plugin (vuejs/language-tools#4586)
  • monaco: can't recognize the package with type definitions in @types/xxx (#81)
  • language-server: simplify asFileName result if possible (volarjs/vscode-typescript-web#4497)
  • language-server: avoid loading diagnosticMessages for en language
  • language-server: use Program.getSourceFile instead of askedFiles to more accurately determine indirect reference files
  • language-server: respect client linkSupport property for declaration, definition, typeDefinition, implementation requests
  • jsdelivr: avoid sending read file request if pkgFilePath is empty
  • jsdelivr: avoid sending flat request for xxx.ts, xxx.d.ts module names
  • jsdelivr: avoid sending flat request for @types/xxx if package xxx do not exist
  • source-map: don't throw when fromOffsets is not sorted
  • labs: associated script mappings are not visible

Refactors

  • language-server: update watchFiles API to return Disposable
  • language-server: only register event handlers when the language server does support a certain language feature
  • language-server: add setup hook for createTypeScriptProject function
  • langauge-server: improve LSP diagnostic integration (#230)
  • language-server: split code based on logical concerns (#231)
  • typescript: add setup hook for runTsc function
  • typescript: add extraExtensionsToRemove option for runTsc function for glint emit support
  • typescript: createAsyncLanguageServicePlugin's scriptKind param allows pass a getter
  • monaco: add setup hook for createSimpleWorkerLanguageService, createTypeScriptWorkerService functions
  • monaco: replace activateAutomaticTypeAcquisition with createNpmFileSystem from the new @volar/jsdelivr package (#218) (#219)
  • monaco: rename servicePlugins option to languageServicePlugins
  • monaco: update to monaco-languageserver-types 0.4 (#225) - Thanks @remcohaszing
  • language-core: no longer coupled to the TypeScript context, TypeScript properties are defined via interface merging in @volar/typescript (#215)
  • language-service: move project context from Language to language service option (#217)
  • test-utils: update startLanguageServer function to accept multiple workspace folders (#229)

2.3.4 (2024-06-25)

Bug Fixes

  • language-service: EmbeddedCodeFormattingOptions.level value incorrect

2.3.3 (2024-06-24)

Bug Fixes

2.3.2 (2024-06-24)

Bug Fixes

  • language-core: re-export SourceMap (#210) - Thanks @KermanX
  • language-service: make sure provideSelectionRanges array length is valid
  • language-service: don't format parent virtual code if formatting range inside embedded code
  • language-core: assert virtual code ID must be lowercase
  • language-server: fix Webpack compatibility

2.3.1 (2024-06-22)

Features

  • labs: improving the capabilities of the virtual code editor (#208)

Bug Fixes

  • labs: language client ID should not be case sensitive
  • language-server: fix URI conversion for file names with similar embedded code ID
  • language-server: write virtual file command broken
  • vscode: error tolerant to contentChanges length (vuejs/language-tools#4457)

Performance

  • source-map: use binary search for translateOffset

Refactors

  • source-map: decoupling from muggle-string
  • source-map: improve range mapping accuracy (#204)
  • source-map: API refactoring (Part of #206) - Thanks @piotrtomiak
  • language-service: delete SourceMapWithDocuments, LinkedCodeMapWithDocument
  • language-core: pluginized source map factory function (#207)

Other Changes

  • language-service: fix SourceMapWithDocuments virtualCode typo (#190) - Thanks @machty

2.3.0 (2024-06-09)

Features

  • language-core: added option to resolve hidden extensions (#190)
  • language-core: reimplemented multi-source mapping (#194)
  • language-core: completed support for multi-source mapping in plugin mode (#197) - Thanks @piotrtomiak
  • language-server: added support for Workspace Diagnostics (#199)
  • language-server: accurately defined language server capabilities (#185)
  • typescript: added option to prevent offset in plugin mode (#191)

Bug Fixes

  • language-service: fixed conversion of markdown links
  • vscode: showed error on missing TypeScript lib (#195) - Thanks @msujew
  • monaco: fixed Monaco selection ranges conversion (#198) - Thanks @remcohaszing

Performance

  • vscode: auto insertion request now exits early on vscode (#157)
  • language-server: improved snapshot reusability (#196)
  • typescript: skips searchExternalFiles if extra extensions are empty

Refactors

  • typescript: added setup option for createLanguageServicePlugin, createAsyncLanguageServicePlugin
  • language-core: LanguagePlugin now requires the first generic parameter to specify the script ID type
  • language-core: updateVirtualCode is now optional, if not provided, createVirtualCode is always called to update source script
  • language-server: createTypeScriptProjectProvider has been renamed to createTypeScriptProject
  • language-server: createSimpleProjectProvider has been renamed to createSimpleProject
  • language-server: no longer handles @vscode/l10n
  • language-server: removed InitializationOptions interface
  • language-service: LSP related logic has been changed to be completely based on URI (#182)
  • language-service: LanguageServiceEnvironment#workapceFolder is now a URI array and has been renamed to workspaceFolders
  • language-service: provideAutoInsertionEdit has been renamed to provideAutoInsertSnippet
  • language-service: normalized LanguageService API name format
  • labs: Codegen Stacks debug feature has been removed (#184)

2.2.5 (2024-05-23)

Features

  • source-map: add API to support generated code with different length than original code #183 - Thanks @piotrtomiak

2.2.4 (2024-05-15)

Bug Fixes

  • typescript: path completion not working for meta files

2.2.3 (2024-05-15)

Bug Fixes

  • typescript: empty items list should be valid completion result vuejs/language-tools#4368
  • typescript: deduplication when merging hover infos #178
  • language-service: transforming volar embedded URIs in markdown #180 - Thanks @remcohaszing
  • language-server: memorize URI conversion results of synchronized documents #181

2.2.2 (2024-05-10)

Bug Fixes

  • typescript: TS plugin only displays the first hover info
  • language-core: isRenameEnabled respect CodeInformation.navigation.shouldRename
  • test-utils: use stdio transport for test server #175

2.2.1 (2024-05-06)

Features

  • language-server: restored support for "Reload Project" command

Bug Fixes

  • typescript: additional completion not working in TS plugin vuejs/language-tools#4323
  • language-server: pass correct languageId when creating virtual code #173

2.2.0 (2024-05-01)

Features

  • Add ESLint integration #171
  • language-service: auto insertion does not abstract selection #156

Bug Fixes

  • typescript: runTsc cannot display source code for errors vuejs/language-tools#4099
  • typescript: runTsc cannot display source code for errors with --incremental #158 #162 - Thanks @wangshunnn
  • typescript: handle invalid references result
  • typescript: parameter hints not working in TS plugin vuejs/language-tools#3948
  • typescript: fault tolerance with TS file size assertion vuejs/language-tools#4278
  • typescript: TS plugin find reference result's definition span should be able to fall back to file root
  • typescript: prioritize resolving JS virtual script to matched .d.ts file
  • typescript: more inclusive performance rename operation vuejs/language-tools#4297
  • typescript: normalize filePath for language service APIs vuejs/language-tools#4297
  • typescript: avoid eagerly updating source scripts #166
  • vscode: newly created file failed to match tsconfig immediately vuejs/language-tools#4297
  • vscode: avoid crash when workspace tsdk does not exist
  • language-server: fault-tolerant URI translation #159
  • language-core: handle empty mappings in updateVirtualCodeMapOfMap #161 - Thanks @remcohaszing

Performance

Refactors

  • More accurate interface design and terminology #154
  • language-server: architecture improvements #167
  • language-server: remove ConfigurationHost abstract
  • language-service: expose changed setting sections on onDidChangeConfiguration
  • language-service: ServiceContext.inject method return nullable
  • typescript: decorateLanguageServiceHost less side effects #160
  • language-core: make CodeInformation properties optional
  • language-core: resolved language ID by LangaugePlugin #168

2.1.6 (2024-03-28)

Bug Fixes

2.1.5 (2024-03-23)

Bug Fixes

  • language-server: GetVirtualCodeRequest incorrectly responses empty vritual code if no mappings
  • typescript: mark the parent directory as exists when created a file

2.1.4 (2024-03-22)

Features

  • test-utils: add 3 APIs: updateTextDocument, updateConfiguration, didChangeWatchedFiles

Bug Fixes

2.1.3 (2024-03-20)

Bug Fixes

  • typescript: fix emit signature to enable incremental work to function properly #150 - thanks @skywalker512
  • language-server: also consider deletions for getRootFiles #152 - thanks @Princesseuh

Other Changes

  • language-service: add name for SemanticToken tuple members
  • vscode: migrate from StatusBarItem to LanguageStatusItem

2.1.2 (2024-03-07)

Bug Fixes

2.1.1 (2024-03-05)

Bug Fixes

  • test-utils: allow unknown initialization options and expose locale option #142
  • typescript: virtual file update condition should be based generated snapshot rather than source script version
  • monaco: correct package name resolve on ATA #149
  • language-service: provideCodeActions's range param is not accurately mapped
  • language-service: provideInlayHints's range param is not accurately mapped

Refactors

  • Webpack compatibility #144
  • language-service: add provide generic to ServicePlugin type #143

2.1.0 (2024-02-26)

Features

  • language-service: more reliable embedded code formatting #138
    • Embedded code indentation is no longer handled by @volar/language-service, but instead calculated and passed as initialIndentLevel, which is then reliably handled by ServicePlugin for additional indentation in specific languages.
    • The provideDocumentFormattingEdits and provideOnTypeFormattingEdits APIs now accept the EmbeddedCodeFormattingOptions parameter, which includes initialIndentLevel.
    • Formatting ranges are now correctly mapped to embedded code formatting ranges.
    • Removed the no longer needed ServicePlugin.provideFormattingIndentSensitiveLines API.
    • No longer relies on the conventional volar.format.initialIndent editor setting.
    • Added ServicePlugin.resolveEmbeddedCodeFormattingOptions API, allowing downstream tools to modify the initialIndentLevel passed to ServicePlugin based on custom settings (replacing volar.format.initialIndent).

Refactors

  • test-utils: server tester support ClientCapabilities param for initialize() API
  • test-utils: server tester expose sendDocumentRangeFormattingRequestRequest() and shutdown() API
  • language-core: make embeddedCodes optional in VirtualCode #137
  • language-server: SemanticTokens requests are no longer delayed by 200ms
  • language-server: APIs updates #140
    • createSimpleProjectProvider has been renamed to createSimpleProjectProviderFactory and needs to be invoked with no arguments.
    • createTypeScriptProjectProvider has been renamed to createTypeScriptProjectProviderFactory and needs to be invoked with a TS module as an argument.
    • Deprecate typescript#tsdk, typescript#tsdkUrl, ignoreTriggerCharacters initialization options.
    • Deprecate fullCompletionList initialization option. #139
    • Remove experimental provideDiagnosticMarkupContent API.

Bug Fixes

  • language-server: language features not working for untitled documents #135
  • language-server: pushDiagnostics should not be notified when closing a file if server push diagnostics are not enabled
  • language-service provideSelectionRanges API multiple result merging method is inconsistent with VSCode
  • language-service provideDocumentSemanticTokens API's range param is not mapped to virtual code
  • language-service provideDocumentFormattingEdits API's range param is not accurately mapped to virtual code #136
  • language-service fix caching of semantic diagnostics #141
  • test-utils: invalidate cache when calling openInMemoryDocument()
  • monaco: insertText and range properties of completion item not converted correctly
  • typescript: ts plugin incorrectly resolve module name

2.0.4 (2024-02-13)

Features

Bug Fixes

2.0.3 (2024-02-10)

Features

  • labs: recognize Glint and other file extensions via reading installed extensions language configuration
  • labs: improve mapping decorations display

Bug Fixes

2.0.2 (2024-02-08)

Bug Fixes

  • labs: extension not working with framework version 2.0.0
  • typescript: remove runtime dependency on @volar/language-service
  • typescript: additional completion not working in ts plugin
  • typescript: remove warning when allowNonTsExtensions is not set

2.0.1 (2024-02-05)

Features

  • typescript: expose FileRegistry in proxyCreateProgram() #128
  • typescript: re-support extra virtual scripts for LSP and Kit #132

Bug Fixes

  • vscode: update currentLabsVersion to 2
  • typescript: remove mistakenly published scripts lib/quickstart/create(Async)TSServerPlugin, please use lib/quickstart/create(Async)LanguageServicePlugin instead of

2.0.0 (2024-01-21)

Please refer to #85 for details.