24 lines
915 B
Markdown
24 lines
915 B
Markdown
# JavaScript and TypeScript
|
|
|
|
`.js`, `.mjs`, `.ts` files use Monaco's JavaScript / TypeScript service (the one of VS Code): completion, hover, go to definition,
|
|
errors.
|
|
|
|
## Completion that knows the project
|
|
|
|
The IDE gives the service the files your code uses:
|
|
|
|
- the modules a file imports (relative paths);
|
|
- Symfony AssetMapper: the `importmap.php` entries map to their files, and `assets/vendor/` copies are read
|
|
(`import { Controller } from '@hotwired/stimulus'`, then `this.` completes);
|
|
- `node_modules` types (`package.json` `types`, `@types/`).
|
|
|
|
It stays bounded (150 files, 6 MB) and is refreshed when the imports change.
|
|
|
|
## Paths
|
|
|
|
`import` / `import()` / `require` / `new URL` paths are completed (folders first; bare names from importmap.php, package.json and
|
|
`node_modules`) and are links (`Ctrl+click`).
|
|
|
|
## Tests
|
|
|
|
`*.test.mjs` run with `node --test`, Vitest or Jest in the [Tests](tests.md) window.
|