Closed
Description
The problem
All of the Cursorless code exists as part of the VSCode extension and has many references to vscode
. We'd like to abstract away VSCode and turn Cursorless into a generic npm package to enable the following:
- Extract cursorless core into a node.js server #435 to support Cursorless in other IDEs
- Allow other applications (eg rango, MS Word plugin) to leverage the Cursorless engine
- Embed Cursorless in Talon for OCR-based global hats
- Support Cursorless VSCode on the web
- Share code with our docs site, which would enable one source of truth between docs and code
- Allow us to fake / mock pieces of VSCode to enable proper unit testing (today nearly all Cursorless tests are end-to-end)
The solution
We'd like to migrate to nx. Let's use pnpm
Experiments to run
- When you do auto-import in VSCode, does it look at
node_modules
of the package containing the file you're doing auto-import from even if your VSCode workspace is opened to the root directory of the project? - When you do a rename, will it apply across package boundaries?
To discuss
- What to do about type imports?
Todo
- Enforce pnpm https://www.npmjs.com/package/only-allow
- Setup syncpack to ensure we use consistent versions
- Run typescript scripts directly rather than after compiling? could use https://github.com/esbuild-kit/tsx or https://bun.sh/
- Meta-updater to keep references + other stuff in tsconfig / package.json up to date
- Consider wireit (https://github.com/google/wireit) or turborepo for building / caching
old We'll proceed as follows
- Superficial transformation where we convert Cursorless to an nx repo, but keep all of the extension code in a single nx app. Note that the current
cursorless-nx
directory will become the root of the repo - Migrate the
website
directory to adocs
nx app. Not sure exactly how to get docusaurus to work as an nx app - Migrate pieces of the Cursorless core to nx libraries as needed for using them in docs site or Extract cursorless core into a node.js server #435. Note that we'll rely on the abstractions introduced in https://github.com/cursorless-dev/cursorless/tree/main/src/ide to abstract away VSCode
- Run
nx migrate
to get up to date