TypeScript/JavaScript code intelligence via typescript-language-server
The TypeScript/JavaScript LSP Bundle provides pre-configured language support for Amplifier's LSP capabilities, enabling semantic code navigation, type information, and intelligent code exploration for TypeScript, JavaScript, React, Node.js, and other JavaScript ecosystem projects.
This bundle extends the core LSP bundle with TypeScript/JavaScript-specific configuration, allowing AI agents to:
- Navigate TypeScript/JavaScript code - Jump to definitions, find references, locate implementations
- Understand types - Get type information, hover documentation, and call hierarchies (even in plain JavaScript!)
- Explore modules - List symbols, search across the workspace, trace imports
- Support all JavaScript flavors - TypeScript, JavaScript, React/JSX, Node.js, CommonJS, ESM
This bundle provides:
- typescript-lsp - Behavior configuring typescript-language-server for TypeScript and JavaScript
- typescript-code-intel - Agent specialized for TypeScript/JavaScript code exploration
- typescript-lsp - Context providing TypeScript/JavaScript-specific LSP usage guidance
The bundle includes the core lsp bundle, which provides the tool-lsp module and general LSP capabilities.
typescript-language-server and TypeScript must be installed:
# Using npm (recommended)
npm install -g typescript-language-server typescript
# Verify installation
typescript-language-server --version
tsc --versionLoad the bundle directly with Amplifier:
# Load from git URL
amplifier bundle use git+https://github.com/robotdad/amplifier-bundle-lsp-typescript@mainAdd to your bundle's includes: section:
includes:
- bundle: git+https://github.com/robotdad/amplifier-bundle-lsp-typescript@main# Start a session with TypeScript/JavaScript LSP capabilities
amplifier run --bundle lsp-typescript
# Navigate TypeScript/JavaScript code
> Find all references to the UserService class
> Go to the definition of authenticateUser
> What parameters does createSession accept?
> Show me the call hierarchy for the validateToken method# Type information
> What type does getUserById() return?
> Show me the interface for UserConfig
# Symbol search
> Find all classes that implement IAuthProvider
> Where is the Express Request type used?
# References
> Where is the authenticateUser function called in this project?
> Show me all usages of the APP_CONFIG constant
# Call hierarchy
> What functions call sendNotification?
> What does the handleRequest middleware call?
# React-specific
> Find all usages of the UserContext provider
> What props does the Button component accept?
> Where is the useAuth hook used?
# Module navigation
> Show me what this import resolves to
> Trace the dependency chain for this utility functionThis bundle works with all JavaScript ecosystem projects:
- TypeScript - Full type checking and navigation
- JavaScript - Type inference from JSDoc and usage patterns
- React - JSX/TSX support, component props, hooks
- Node.js - Built-in modules, require/import, CommonJS/ESM
- Express - Middleware types, request/response
- Next.js - Page components, API routes
- Deno - Deno-flavored TypeScript
- Vue/Angular - TypeScript support in frameworks
The bundle comes pre-configured with sensible defaults. The default configuration:
tools:
- module: tool-lsp
config:
languages:
typescript:
extensions: [.ts, .tsx, .mts, .cts]
workspace_markers: [tsconfig.json, package.json, .git]
server:
command: [typescript-language-server, --stdio]
javascript:
extensions: [.js, .jsx, .mjs, .cjs]
workspace_markers: [jsconfig.json, package.json, .git]
server:
command: [typescript-language-server, --stdio]Override the configuration in your behavior:
tools:
- module: tool-lsp
config:
languages:
typescript:
initialization_options:
preferences:
includeInlayParameterNameHints: all
includeInlayFunctionParameterTypeHints: trueAll operations from the core LSP bundle are available:
| Operation | Description |
|---|---|
goToDefinition |
Find where a symbol is defined |
findReferences |
Find all references to a symbol |
hover |
Get documentation and type info |
documentSymbol |
List all symbols in a file |
workspaceSymbol |
Search for symbols across the workspace |
goToImplementation |
Find implementations of interfaces |
prepareCallHierarchy |
Get call hierarchy at a position |
incomingCalls |
Find callers of a function |
outgoingCalls |
Find functions called by a function |
amplifier-bundle-lsp-typescript/
bundle.yaml # Bundle definition, includes lsp
behaviors/
typescript-lsp.yaml # typescript-language-server configuration
agents/
typescript-code-intel.md # TypeScript/JavaScript-specialized agent
context/
typescript-lsp.md # TypeScript/JavaScript LSP usage guidance
examples/
combined-bundle.yaml # Example: combining foundation + lsp-typescript
Ensure you have a tsconfig.json:
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}For best results, add a jsconfig.json:
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"checkJs": true
},
"exclude": ["node_modules"]
}Install type definitions for better type inference:
# Node.js
npm install --save-dev @types/node
# React
npm install --save-dev @types/react @types/react-dom
# Express
npm install --save-dev @types/express
# Jest
npm install --save-dev @types/jestnpm install -g typescript-language-server typescript
which typescript-language-server # Should show a path
typescript-language-server --versionCheck that TypeScript is installed:
npm install -g typescript
tsc --versionInstall missing type definitions:
npm install --save-dev @types/node @types/reactEnsure Node.js is activated:
nvm use --lts
npm install -g typescript-language-server typescriptThe TypeScript/JavaScript LSP Bundle follows Amplifier's core principles:
- Composable - Extends the core LSP bundle with TypeScript/JavaScript specifics
- Pre-configured - Works out of the box with typescript-language-server
- Observable - All operations emit events for logging and debugging
- Minimal - Adds only TypeScript/JavaScript-specific configuration
- Universal - Works for all JavaScript ecosystem projects
To use this bundle alongside Amplifier Foundation, create a custom bundle in your project directory:
Your project's .amplifier/bundle.yaml:
bundle:
name: my-dev-bundle
version: 1.0.0
includes:
- bundle: git+https://github.com/microsoft/amplifier-foundation@main
- bundle: git+https://github.com/robotdad/amplifier-bundle-lsp-typescript@main
default_behavior: foundationThen activate it:
amplifier bundle use .amplifier/bundle.yaml
amplifier runSee also: examples/combined-bundle.yaml for a complete working example.
This bundle is open for contributions! To contribute:
- Fork the repository
- Create a feature branch
- Test your changes thoroughly
- Submit a pull request
MIT License - See LICENSE file for details
Created by @robotdad
ACTIVE DEVELOPMENT
This bundle is under active development. Feedback and contributions are welcome!
For issues and questions:
- Open an issue on GitHub
- Discuss in Amplifier community channels
Ready to navigate TypeScript/JavaScript code semantically? Install the bundle and start exploring!