Package-level declarations
Types
This represents a string whose leading underscore have been escaped by adding extra leading underscores. The shape of this brand is rather unique compared to others we've used. Instead of just an intersection of a string and an object, it is that union-ed with an intersection of void and an object. This makes it wholly incompatible with a normal string (which is good, it cannot be misused on assignment or on usage), while still being comparable with a normal string via === (also good) and castable from a string.
A set of one or more available refactoring actions, grouped under a parent refactoring.
Builder to manage the program state changes
A list of comma-separated expressions. This node is only created by transformations.
Reports config file diagnostics
Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program
A linked list of formatted diagnostic messages to be used as part of a multiline message. It is built from the bottom up, leaving the head to be the "main" diagnostic. While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage, the difference is that messages are all preformatted in DMC.
The document registry represents a store of SourceFile objects that can be shared between multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) of files in the context. SourceFile objects account for most of the memory usage by the language service. Sharing the same DocumentRegistry instance between different instances of LanguageService allow for more efficient memory utilization since all projects will share at least the library file (lib.d.ts).
The builder that can handle the changes in program and iterate through changed file to emit the files The semantic diagnostics are cached per file and managed by clearing for the changed/affected files
Return code used by getEmitOutput function to indicate status of the function
This is either an export =
or an export default
declaration. Unless isExportEquals
is set, this node was parsed as an export default
.
Several node kinds share function-like features such as a signature, a name, and a body. These nodes should extend FunctionLikeDeclarationBase. Examples:
One of:
Deprecated, please use UpdateExpression
Class and interface types (ObjectFlags.Class and ObjectFlags.Interface).
Represents an immutable snapshot of a script at a specified time.Once acquired, the snapshot is observably immutable. i.e. the same calls with the same parameters will return the same values.
Note that @extends
is a synonym of @augments
. Both tags are represented by this interface.
Class#method reference in JSDoc
Used by services to specify the minimum host area required to set up source files under any compilation settings
Navigation bar interface designed for visual studio's dual-column layout. This does not form a proper tree. The navbar is returned as a list of top-level items, each of which has a list of child items. Child items always have an empty array for their childItems
.
Node in a tree of nested declarations in a file. The top node is always a script or module node.
A function that walks a node array using the given visitor, returning an array whose contents satisfy the test.
A function that walks a node using the given visitor, lifting node arrays into single nodes, returning an node which satisfies the test.
Stored map from non-relative module name to a table: directory -> result of module lookup in this directory We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive.
Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute.
This interface is a base interface for ObjectLiteralExpression and JSXAttributes to extend from. JSXAttributes is similar to ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.)
Interface extending ParseConfigHost to support ParseConfigFile that reads config file and reports errors
Either a parsed command line or a parsed tsconfig.json
Cached resolutions per containing directory. This assumes that any module id will have the same resolution for sibling files located in the same folder.
Brand for a PropertyAccessExpression which, like a QualifiedName, consists of a sequence of identifiers separated by dots.
Represents a bigint literal value without requiring bigint support
Represents a single refactoring action - for example, the "Extract Method..." refactor might offer several actions, each corresponding to a surround class or closure to extract into.
A set of edits to make in response to a refactor action, plus an optional location where renaming should be invoked from
Branded string for keeping track of when we've turned an ambiguous path specified like "./blah" to an absolute path to an actual tsconfig file, e.g. "/root/blah/tsconfig.json"
Represents the result of module resolution. Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off. The Program will then filter results based on these flags.
ResolvedModule with an explicitly provided extension
property. Prefer this over ResolvedModule
. If changing this, remember to change moduleResolutionIsEqualTo
.
The builder that caches the semantic diagnostics for the program and handles the changed files and affected files
For when we encounter a semicolon in a class declaration. ES6 allows these as class elements.
Signals that the signature help request came from a user typing a character. Depending on the character and the syntactic context, the request may or may not be served a result.
Signals that the user manually requested signature help. The language service will unconditionally attempt to provide a result.
Represents a single signature to show in signature help. The id is used for subsequent calls into the language service to ask questions about the signature help item in the context of any documents that have been updated. i.e. after an edit has happened, while signature help is still active, the host can ask important questions like 'what parameter is the user currently contained within?'.
Represents a set of signature help items, and the preferred item that should be selected.
Signals that this signature help request came from typing a character or moving the cursor. This should only occur if a signature help session was already active and the editor needs to see if it should adjust. The language service will unconditionally attempt to provide a result. triggerCharacter
can be undefined
for a retrigger caused by a cursor move.
Subset of properties from SourceFile that are used in multiple utility functions
SymbolTable based on ES6 Map interface.
A function that transforms a node.
A function that is used to initialize and return a Transformer
callback, which in turn will be used to transform one or more nodes.
Type references (ObjectFlags.Reference). When a class or interface has type parameters or a "this" type, references to the class or interface are made using type references. The typeArguments property specifies the types to substitute for the type parameters of the class or interface and optionally includes an extra element that specifies the type to substitute for "this" in the resulting instantiation. When no extra argument is present, the type reference itself is substituted for "this". The typeArguments property is undefined if the class or interface has no type parameters and the reference isn't specifying an explicit "this" argument.
Host to create watch with config file
Host to create watch with root files and options
Creates the watch what generates program using the config file
Creates the watch that generates program using the root files and compiler options
Properties
Functions
Adds an EmitHelper to a node.
Add EmitHelpers to a node.
Called to merge all the changes that occurred across several versions of a script snapshot into a single change. i.e. if a user keeps making successive edits to a script we will have a text change from V1 to V2, V2 to V3, ..., Vn.
Convert the json syntax tree into the json value
Creates a builder thats just abstraction over program and can be used with watch
Create a function that reports watch status by writing to the system and handles the formating of the diagnostic
The classifier is used for syntactic highlighting in editors via the TSServer
Create the builder that can handle the changes in program and iterate through changed files to emit the those files and manage semantic diagnostics cache as well
Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' that represent a compilation unit.
Create the builder to manage semantic diagnostics and cache them
Create an external source map source file reference
Create the watch compiler host for either configFile or fileNames and its options
Creates the watch from the host for config file
Creates the watch from the host for root files and compiler options
Clears any EmitNode
entries from parse-tree nodes.
Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like 'proto'
Iterates through the parent chain of a node and performs the callback on each parent until the callback returns a truthy value, then returns that value. If no such value is found, it applies the callback until the parent pointer is undefined or the callback returns "quit" At that point findAncestor returns undefined.
Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, embedded arrays are flattened and the 'cbNode' callback is invoked for each element. If a callback returns a truthy value, iteration stops and that value is returned. Otherwise, undefined is returned.
Gets all JSDoc tags that match a specified predicate
Gets all JSDoc tags of a specified kind
Given a set of options, returns the set of type directive names that should be included for this program automatically. This list could either come from the config file, or from enumerating the types root + initial secondary types lookup location. More type directives might appear in the program later as a result of loading actual source files; this list is only the set of defaults that are implicitly included.
Gets a custom text range to use when emitting comments.
Gets the constant value to emit for an expression representing an enum.
Get the path of the default library files (lib.d.ts) as distributed with the typescript node package. The functionality is not supported if the ts module is consumed outside of a node module.
Gets the effective type parameters. If the node was parsed in a JavaScript file, gets the type parameters from the @template
tag from JSDoc.
Gets the EmitHelpers of a node.
A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the options
parameter.
Gets the JSDoc augments tag for the node if present
Gets the JSDoc class tag for the node if present
This function checks multiple locations for JSDoc comments that apply to a host node. At each location, the whole comment may apply to the node, or only a specific tag in the comment. In the first case, location adds the entire {@link JSDoc} object. In the second case, it adds the applicable {@link JSDocTag}.
Gets the JSDoc deprecated tag for the node if present
Gets the JSDoc enum tag for the node if present
Gets the JSDoc implements tags for the node if present
Gets the JSDoc parameter tags for the node if present.
Gets the JSDoc private tag for the node if present
Gets the JSDoc protected tag for the node if present
Gets the JSDoc public tag for the node if present
Gets the JSDoc protected tag for the node if present
Gets the JSDoc return tag for the node if present
Gets the return type node for the node if provided via JSDoc return tag or type tag.
Get all JSDoc tags related to a node, including those on parent nodes.
Gets the JSDoc template tag for the node if present
Gets the JSDoc this tag for the node if present
Gets the type node for the node if provided via JSDoc.
Gets the JSDoc type parameter tags for the node if present.
Gets the JSDoc type tag for the node if present and valid
Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
Use program.getModeForResolutionAtIndex
, which retrieves the correct compilerOptions
, instead of this function whenever possible. Calculates the final resolution mode for an import at some index within a file's imports
list. This is the resolution mode explicitly provided via import attributes, if present, or the syntax the usage would have if emitted to JavaScript. In --module node16
or nodenext
, this may depend on the file's impliedNodeFormat
. In --module preserve
, it depends only on the input syntax of the reference. In other module
modes, when overriding import attributes are not provided, this function returns undefined
, as the result would have no impact on module resolution, emit, or type checking.
Use program.getModeForUsageLocation
, which retrieves the correct compilerOptions
, instead of this function whenever possible. Calculates the final resolution mode for a given module reference node. This is the resolution mode explicitly provided via import attributes, if present, or the syntax the usage would have if emitted to JavaScript. In --module node16
or nodenext
, this may depend on the file's impliedNodeFormat
. In --module preserve
, it depends only on the input syntax of the reference. In other module
modes, when overriding import attributes are not provided, this function returns undefined
, as the result would have no impact on module resolution, emit, or type checking.
Reads the config file, reports errors if any and exits if the config file cannot be found
Optionally, get the shebang
Gets a custom text range to use when emitting source maps.
Gets the text of a jsdoc comment, flattening links to their text.
Gets the TextRange to use for source maps for a token of a node.
Return true if the node has JSDoc parameter tags.
True if has initializer node attached to it.
If the text of an Identifier matches a keyword (including contextual and TypeScript-specific keywords), returns the SyntaxKind for the matching keyword.
Determines whether a node is an expression based only on its kind.
True if node is of a kind that may contain comment text.
Gets a value indicating whether a node originated in the parse tree.
True if kind is of some token syntax kind. For example, this is true for an IfKeyword but not for an IfStatement. Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail.
Node test that determines whether a node is a valid type node. This differs from the isPartOfTypeNode
function which determines whether a node is part of a TypeNode.
Does not include line breaks. For that, see isWhiteSpaceLike.
Moves matching emit helpers from a source node to a target node.
Parse the text of the tsconfig.json file
Parse the contents of a config file (tsconfig.json).
Parse the contents of a config file (tsconfig.json).
Parse json text into SyntaxTree and return node and parse errors if any
Read tsconfig.json file
Read tsconfig.json file
Removes an EmitHelper from a node.
Returns the target config filename of a project reference. Note: The file might not exist.
Sets the constant value to emit for an expression.
Sets a custom text range to use when emitting source maps.
Sets the TextRange to use for source maps for a token of a node.
Transform one or more nodes using the supplied transformers.
Remove extra underscore from escaped identifier text content.
Checks to see if the locale is in the appropriate format, and if it is, attempts to set the appropriate language.
Visits the elements of a {@link CommaListExpression}.
Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place.
Resumes a suspended lexical environment and visits a concise body, ending the lexical environment and merging hoisted declarations upon completion.
Resumes a suspended lexical environment and visits a function body, ending the lexical environment and merging hoisted declarations upon completion.
Visits an iteration body, adding any block-scoped variables required by the transformation.
Starts a new lexical environment and visits a statement list, ending the lexical environment and merging hoisted declarations upon completion.
Visits a Node using the supplied visitor, possibly returning a new Node in its place.
Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
Starts a new lexical environment and visits a parameter list, suspending the lexical environment upon completion.