This repository was archived by the owner on Jun 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Support cross-repository go-to-definition #8
Copy link
Copy link
Closed
Labels
Description
- Extension makes go-to-definition request
- Server detects definition URI is in
node_modules(location will point to a.d.tsfile) - Server reads and parses package.json
- Server maps package to clone URL and rev from the package.json
repositoryandgitHeadfields (gitHeadrequires an npm registry request because of support gitHead property in package.json yarnpkg/yarn#2978) - Server resolves cloneURL and rev to a Sourcegraph raw target root URI (needs new API, e.g.
https://sourcegraph.com/.api/resolve?clone_url=git@github.com/sourcegraph/sourcegraph&rev=abc123) - Server determines repo-root-relative package.json location from
directoryfield proposed in npm RFC Add Monorepo Subdirectory Declaration RFC npm/rfcs#19)- If not present
- MVP: assume root of repo (works for most libraries)
- potentially do PRs to popular monorepos like https://github.com/angular/angular to add the field
- search all package.jsons in repo for the one with the correct
namefield (TODO: how? maybe raw API like/raw/**/package.json)
- MVP: assume root of repo (works for most libraries)
- If not present
- Server reads and parses
.d.ts.mapfile for the definition URI - Server maps definition location in
.d.tsto position in.tsfile (usingsource-maplibrary) - Server resolves package-root-relative
.ts.location from package root innode_modules - Server resolves target URI from target root URI, repo-root-relative package.json location and package-root-relative
.tslocation - Server returns target URI to extension
- Extension returns target URI to Sourcegraph
Reactions are currently unavailable