carlthome / vscode-git-line-blame

Display inline information of the last commit that edited the currently selected line in the editor
https://marketplace.visualstudio.com/items?itemName=carlthome.git-line-blame
GNU Affero General Public License v3.0
20 stars 4 forks source link

Activate for projects within git repos #33

Open oscar-b opened 8 months ago

oscar-b commented 8 months ago

Hi

I have a project which sits inside a subfolder of the git repo, so vscode-git-line-blame isn't initialised since the root folder that vscode sees doesn't hav a .git folder (it's a level higher up).

Is it possible to work around this issue with your extension?

carlthome commented 8 months ago

Ah, not sure. Happy to merge if you get subfolders to work. Seems VS Code is generally very oriented around having the workspace root be the git repo root.

This is the relevant configuration: https://github.com/carlthome/vscode-git-line-blame/blob/main/package.json#L29-L31

Guess it should be possible to set other activation events too, and then double-check that the git command acts in the right directory as per where the file is, somewhere here: https://github.com/carlthome/vscode-git-line-blame/blob/main/src/extension.ts#L34

oscar-b commented 8 months ago

Seems like most git extensions use onStartupFinished. And vscode itself seems to use git rev-parse --show-toplevel for this (a pity they don't expose this as an activation event. https://code.visualstudio.com/docs/sourcecontrol/faq#_why-isnt-vs-code-discovering-git-repositories-in-parent-folders-of-workspaces-or-open-files

I also have git.openRepositoryInParentFolders set to always.

I've never touched vscode extensions before, but I might take a stab at it during christmas if you're not interested in making these changes.

carlthome commented 4 months ago

Would be nice to have this fixed but I've been a bit short on time/flow, sorry!