This configuration provides a comprehensive TypeScript and JavaScript development environment using LazyVim with modern tooling and best practices.
- vtsls: Modern TypeScript Language Server (replaces legacy tsserver)
- ESLint LSP: Advanced linting with flat config support
- JSON LSP: Enhanced JSON support with schema validation
- HTML/CSS LSP: Complete markup and styling support
- Tailwind CSS LSP: Utility-first CSS framework support
- React/Next.js: Complete JSX/TSX support with debugging
- Vue.js: SFC support with proper TypeScript integration
- Svelte: Modern component framework support
- Astro: Multi-framework static site generator
- Angular: Enterprise-grade framework support
- Jest: Popular testing framework with debugging
- Vitest: Fast unit testing for Vite projects
- Playwright: End-to-end testing support
- Neotest: Unified testing interface in Neovim
- Node.js: Server-side JavaScript/TypeScript debugging
- Browser: Client-side debugging for React, Vue, etc.
- Jest/Vitest: Test debugging with breakpoints
- Chrome DevTools: Integration for web applications
- Auto-imports: Intelligent import management
- Code actions: Automated refactoring and fixes
- Inlay hints: Type information display
- Package management: npm/yarn/pnpm integration
- Import cost: Bundle size analysis
- Coverage: Test coverage visualization
-
Ensure Prerequisites:
# Node.js (recommended version 18+) node --version # Package manager (npm/yarn/pnpm) npm --version
-
Open Neovim: The configuration will automatically install required tools
nvim
-
Wait for Setup: LazyVim will install all plugins and Mason will install language servers
-
Verify Installation: Open a TypeScript file and check:
:checkhealth vim.lsp :Mason
| Key | Action | Description |
|---|---|---|
gd |
Go to Definition | Jump to symbol definition |
gD |
Go to Declaration | Jump to symbol declaration |
gi |
Go to Implementation | Jump to implementation |
gr |
References | Show all references |
gt |
Type Definition | Jump to type definition |
K |
Hover | Show documentation |
<C-k> |
Signature Help | Show function signature |
| Key | Action | Description |
|---|---|---|
<leader>ca |
Code Action | Show available code actions |
<leader>cr |
Rename | Rename symbol |
<leader>co |
Organize Imports | Organize import statements |
<leader>cM |
Add Missing Imports | Add missing imports |
<leader>cu |
Remove Unused | Remove unused imports |
<leader>cD |
Fix All | Fix all issues |
<leader>cV |
TS Version | Select TypeScript version |
| Key | Action | Description |
|---|---|---|
<leader>tr |
Run Test | Run nearest test |
<leader>tR |
Run File Tests | Run current file tests |
<leader>ta |
Run All Tests | Run entire test suite |
<leader>td |
Debug Test | Debug nearest test |
<leader>ts |
Test Summary | Toggle test summary |
<leader>tw |
Watch Tests | Toggle test watch mode |
| Key | Action | Description |
|---|---|---|
<leader>db |
Toggle Breakpoint | Set/remove breakpoint |
<leader>dB |
Conditional Breakpoint | Set conditional breakpoint |
<leader>dc |
Continue | Start/continue debugging |
<leader>di |
Step Into | Step into function |
<leader>do |
Step Over | Step over statement |
<leader>dO |
Step Out | Step out of function |
<leader>du |
Toggle UI | Toggle debug UI |
| Key | Action | Description |
|---|---|---|
<leader>ns |
Show Versions | Show package versions |
<leader>nu |
Update Package | Update package on line |
<leader>ni |
Install Package | Install new package |
<leader>np |
Change Version | Change package version |
.ts- TypeScript files.tsx- TypeScript React files.js- JavaScript files.jsx- JavaScript React files.vue- Vue.js Single File Components.svelte- Svelte components.astro- Astro components
package.json- Package configurationtsconfig.json- TypeScript configuration.eslintrc.*- ESLint configurationprettier.config.*- Prettier configurationjest.config.*- Jest configurationvitest.config.*- Vitest configuration
Create .eslintrc.js for legacy config:
module.exports = {
extends: [
'eslint:recommended',
'@typescript-eslint/recommended',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
// Your custom rules
},
};Or eslint.config.js for flat config:
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
export default [
js.configs.recommended,
...tseslint.configs.recommended,
{
rules: {
// Your custom rules
},
},
];Create .prettierrc.js:
module.exports = {
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
printWidth: 100,
};Example tsconfig.json:
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"~/*": ["./*"]
}
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}# Install dependencies
npm install react react-dom
npm install -D @types/react @types/react-dom
# For Next.js
npm install next# Install dependencies
npm install vue
npm install -D @vue/tsconfig
# For Nuxt.js
npm install nuxtnpm install -D jest @types/jest ts-jestnpm install -D vitest @vitest/ui-
TypeScript not working:
:LspInfo :Mason
Ensure vtsls is installed and running.
-
ESLint not linting: Check ESLint configuration and ensure eslint-lsp is installed.
-
Prettier not formatting: Verify Prettier configuration exists and conform.nvim is set up.
-
Tests not running: Ensure test framework is installed and Neotest adapters are configured.
-
Debugging not working: Check that js-debug-adapter is installed via Mason.
For large projects, consider:
-- In your configuration
vim.g.lazyvim_typescript_performance = {
max_ts_server_memory = 8192, -- MB
disable_automatic_type_acquisition = true,
exclude_directories = { "node_modules", "dist", "build" },
}:TSOrganizeImports- Organize imports:TSAddMissingImports- Add missing imports:TSRemoveUnusedImports- Remove unused imports:TSFixAll- Fix all TypeScript issues:TSSelectVersion- Select TypeScript version:TSRenameFile- Rename current file
:PackageInstall- Install packages:PackageUpdate- Update packages:PackageAudit- Audit packages:NpmRun [script]- Run npm script:DetectProject- Detect project type
:FormatAndLint- Format and lint current buffer:ToggleAutoOrganizeImports- Toggle auto-organize imports:ToggleAutoFormat- Toggle auto-format on save
- Use TypeScript project references for monorepos
- Configure path mapping in tsconfig.json for better imports
- Use .nvmrc for consistent Node.js versions
- Set up workspace-specific settings for large projects
- Use incremental compilation with TypeScript
- TypeScript Handbook
- ESLint Configuration
- Prettier Configuration
- Jest Documentation
- Vitest Guide
- LazyVim Documentation
This configuration is designed to be modular and extensible. Feel free to customize based on your specific needs and workflow preferences.