StarlaneStudios / vscode-comment-anchors

⚓A Visual Studio Code extension that adds support for comment anchors 🔭
https://marketplace.visualstudio.com/items?itemName=ExodiusStudios.comment-anchors
MIT License
205 stars 32 forks source link

Easier way to link files far away from each other in directory tree? #213

Open Nezteb opened 9 months ago

Nezteb commented 9 months ago

I use multi-root workspaces, and the comment anchors extension works fine with those. However, I'd like there to be an easier way to link files many directories apart.

Say I have two files in two different projects each added to my multi-root workspace:

// ~/Git/project_abc/src/server/database/schema/cart.ts

const schema = {
    // ...
}
// ~/Git/xyz_project/src/client/web/state/reducers/cart.ts

const checkout = () => {
    // NOTE: See schema for more details:
    // LINK ../../../../../../project_abc/src/server/database/schema/cart.ts
    // ...
}

Notice that the LINK relative path is quite long. I have a few ideas:

// Option 1: Allow a project identifier prefix that only links if the given project is part of the workspace
// LINK project_abc:src/server/database/schema/cart.ts

// Option 2: Support tilde home path expansion
// LINK ~/Git/project_abc/src/server/database/schema/cart.ts

// Option 3: Add a config option to set a base directory to search (defaults to home directory?)
// In settings.json: "commentAnchors.baseDir": "~/Git"
// LINK project_abc/src/server/database/schema/cart.ts

Let me know what y'all think. 😄