How alimozdemir/vscode-nuxt-dx-tools works
Project type and purpose
• Type: VS Code extension (open-source tool)
• Purpose: Enhance Nuxt developer DX by auto‑locating & navigating to components, functions, server APIs, page meta, etc.
Main components
a. VS Code Host & Extension Activation
b. Configuration Loader
c. File‐system Watcher
d. Project Parsers & Indexers
• Nuxt config parser (src/nuxt/nuxt.config.parser.ts)
• Nitro routes parser (src/api/nitro/nitro-routes.parser.ts)
• TS/Definition parser (src/definition/*.ts)
• Function & API definition builder (src/functions/*)
e. In‐memory Index/Cache (Maps of routes, components, APIs, types)
f. VS Code Language Features
• HoverProvider (src/hover/main.ts)
• DefinitionProvider (extension.ts → registerDefinitionProvider)
• Peek/Goto commands
g. Utility Layer
• File utilities (src/utils/file.ts)
• Debounce, Node helpers
• VS Code helper (vscode.helper.ts)
Relationships & interactions
1. On activation (extension.ts):
• Load user settings (from package.json contribution points & VS Code settings).
• Read Nuxt workspace — parse nuxt.config.ts.
• Initialize Watcher → watch pages/, components/, server/api/, types/, etc.
• Build initial indexes (components, APIs, routes, custom types).
• Register Hover & Definition providers with VS Code API.
2. On file‐change events:
• Watcher notifies Parsers → re‐index changed files.
3. On user hover or “go to definition”:
• Provider queries Index → resolves path(s) → VS Code UI displays peek or directly opens file.
Architectural patterns & design principles
• Layered architecture (Activation → Watcher → Parsers → Providers)
• Single Responsibility (each parser handles one concern)
• In‐memory cache for fast lookup
• Event‐driven updates via file watcher