Imported from mpx-ecology/language-tools (
AGENTS.md). Install upstream withnpx skills add mpx-ecology/language-tools. Copyright stays with the author.
Mpx Language Tools Repository Guide
Project map
- This is a pnpm monorepo for the Mpx VS Code language tooling. Use the Node and pnpm versions declared in
package.json. - The main dependency flow is
language-shared -> language-core -> typescript-plugin/language-service -> language-server -> vscode. packages/language-coreowns Mpx SFC parsing, virtual TypeScript generation, source mappings, template type inference, and generated global types.packages/typescript-pluginserves TypeScript-backed component metadata and requests.packages/language-serviceandpackages/language-serverexpose editor features over Volar/LSP.vscodeis the extension client and bundle entry point.inspect-extensionis the mutable manual integration workspace opened by the F5 Extension Host. It is not a unit-test fixture directory.
Commands
- Install dependencies with
pnpm install. - Build all TypeScript projects with
pnpm build. - Run the complete test suite with
pnpm test. - Run a focused test with
pnpm exec vitest run <spec-file>. - Run repository linting with
pnpm lint. - Do not edit generated
out,dist, bundled extension JavaScript, or generated global-type files undernode_modulesdirectly.
Regression workflow
- For editor-visible bugs, add both layers when practical:
- A deterministic automated fixture and assertion under the owning package's
__tests__directory. - A self-contained manual scenario under the matching
inspect-extensionfeature directory for F5 validation.
- A deterministic automated fixture and assertion under the owning package's
- Keep automated tests independent from generated output and from the mutable
inspect-extensionworkspace. - Mark intentional errors in manual
.mpxscenarios with comments describing the expected diagnostic, hover, completion, navigation, or semantic-token behavior. Do not remove intentional errors merely to make the inspection workspace clean. - For language-core changes, run the focused spec first, then
pnpm build,pnpm test, andpnpm lint.
F5 debugging
- The default
VSCode Extensionlaunch configuration runs the rootwatchtask, loadsvscodeas the development extension, disables the installedmpxjs.mpx-official, and opensinspect-extensionin a new Extension Host. - After changing server or language-core behavior, wait for the watch build and run
Mpx: Restart Serverin the Extension Host. Restart the Extension Host when extension-client activation or bundling behavior changes. - Validate the relevant manual scenario in
inspect-extensionfor diagnostics, hover types, completions, definitions/references, and semantic highlighting as applicable. - Keep the language-server debug port in
.vscode/launch.jsonsynchronized with the port passed fromvscode/src/languageClient.ts.
Virtual-code changes
- Treat
verification,completion,semantic, andnavigationmapping capabilities independently. A duplicated source mapping can cause duplicate diagnostics, conflicting hover/semantic information, or incorrect navigation even when generated TypeScript compiles. - Preserve raw option metadata and source navigation when changing component code generation. Avoid fixing inference by broadly replacing types with
anyor by disabling unrelated mapping capabilities. - Changes to generated component/template context should normally test diagnostics and hover information; add mapping or definition assertions when the bug involves semantic tokens or navigation.
Change hygiene
- Preserve unrelated user changes in the working tree and keep edits scoped to the requested behavior.
- Do not commit, push, publish, or update changelogs unless the user explicitly asks for that action.