gitdoc icon indicating copy to clipboard operation
gitdoc copied to clipboard

vsls-contrib.gitdoc broken by foam.foam-vscode; requires Enable/Disable/Enable command on every new session to function.

Open AJMansfield opened this issue 1 year ago • 9 comments

Problem

Some time before August 2024, GitDoc started to behave strangely with regards to its enable/disable status. Each time I launch VSCode, the extension appears to start disabled (despite configurations that should enable it), and only becomes functional after running commands to enable, disable, and then re-enable it a second time.

I've isolated this issue to some kind of interaction with the foam.foam-vscode extension that I also wish to run in the same workspace. Disabling this extension resolves these symptoms; vsls-contrib.gitdoc starts and runs normally when foam.foam-vscode is disabled or absent.

This exact set of symptoms occurs across both of the computers I regularly use for my notes repository where I make use of these extensions.

With vsls-contrib.gitdoc and foam.foam-vscode as the only two extensions enabled, and every other non-builtin extension disabled:

Enable/Disable Stateful Behavior

For the sake of being fully explicit, there seem to be four different system states involved, which I'll label State A through State D:

State A is the proper enabled and running state. The book icon is visible in the bottom bar whenever I have a file open that it's configured to operate on, auto-commits are created automatically when files are changed, and the GitDoc: Disable and GitDoc: Commit commands are visible in the command palette. If I close VSCode, then start VSCode, I expect it to re-open in State A; however, it instead launches in what I'm labeled State B.

State B appears to be a disabled state. GitDoc is not running, no book icon is visible, no auto-commits are created, and only the GitDoc: Enable command is visible in the palette. Running GitDoc: Enable transitions the system to State C (not to State A).

State C is a sort of pseudo-enabled state. The book icon is not visible on any configured file, and commits are not created automatically when files are changed, but he GitDoc: Disable and GitDoc: Commit commands are visible in the palette and GitDoc: Enable is not. Running GitDoc: Commit does successfully create a commit, but leaves the system in State C. Running GitDoc: Disable transitions the system to State D.

State D is also a 'disabled' state, with the same visible symptoms as State B, except that running GitDoc: Enable transitions the system to the (desired) State A (not to State C).

Environment

My workspace configures Foam and GitDoc via config keys in the .vscode/settings.json file located relative to the workspace root, the relevant lines of which are:

{
  "foam.edit.linkReferenceDefinitions": "off",
  "foam.openDailyNote.directory": "journal",
  "foam.openDailyNote.titleFormat": "fullDate",
  "gitdoc.enabled": true,
  "gitdoc.filePattern": "**/*",
  "gitdoc.commitValidationLevel": "none",
}

The last two lines were added recently as another attempts to try to resolve it this issue; but the problem occurs regardless of whether those values are inherited from the defaults or specified explicitly in the workspace settings.

This workspace root is also the git repository root; with these settings captured as part of the version control for this repository.

The only two non-builtin extensions enabled are:

foam.foam-vscode
vsls-contrib.gitdoc

Software Version Info

VSCode About Info:

Version: 1.96.2 (system setup)
Commit: fabdb6a30b49f79a7aba0f2ad9df9b399473380f
Date: 2024-12-19T10:22:47.216Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.22631

GitDoc Installation Info:

Identifier vsls-contrib.gitdoc
Version 0.2.3
Last Updated 2024-12-27, 14:29:58
Size 2.5 MB

Foam Installation Info:

Identifier foam.foam-vscode
Version 0.26.4
Last Updated 2024-11-13, 16:09:33
Size 1.5 MB

Extension Host Logs

Here's the Extension Host logs for each of these states. Starting in State B, I get:

2025-01-11 12:23:00.996 [info] Extension host with pid ***** started
2025-01-11 12:23:00.996 [info] Skipping acquiring lock for c:\Users\*****\AppData\Roaming\Code\User\workspaceStorage\********************************.
2025-01-11 12:23:01.293 [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
2025-01-11 12:23:01.346 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage'
2025-01-11 12:23:01.373 [info] ExtensionService#_doActivateExtension vscode.extension-editing, startup: false, activationEvent: 'onLanguage:markdown'
2025-01-11 12:23:01.396 [info] ExtensionService#_doActivateExtension vscode.markdown-language-features, startup: false, activationEvent: 'onLanguage:markdown'
2025-01-11 12:23:01.536 [info] ExtensionService#_doActivateExtension vscode.configuration-editing, startup: false, activationEvent: 'onLanguage:jsonc'
2025-01-11 12:23:01.555 [info] ExtensionService#_doActivateExtension vscode.json-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
2025-01-11 12:23:01.641 [info] ExtensionService#_doActivateExtension vscode.typescript-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
2025-01-11 12:23:02.313 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.git
2025-01-11 12:23:02.317 [info] ExtensionService#_doActivateExtension foam.foam-vscode, startup: true, activationEvent: 'workspaceContains:.vscode/foam.json'
2025-01-11 12:23:02.581 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
2025-01-11 12:23:02.694 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
2025-01-11 12:23:02.750 [info] ExtensionService#_doActivateExtension vscode.markdown-math, startup: false, activationEvent: 'api', root cause: vscode.markdown-language-features
2025-01-11 12:23:03.789 [info] Eager extensions activated
2025-01-11 12:23:03.899 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2025-01-11 12:23:03.904 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2025-01-11 12:23:03.932 [info] ExtensionService#_doActivateExtension vsls-contrib.gitdoc, startup: false, activationEvent: 'onStartupFinished'

No additional log entries appear when running any of the commands that transition the symptoms to one of the other states.

AJMansfield avatar Jan 11 '25 17:01 AJMansfield

Cross-posted with https://github.com/foambubble/foam/issues/1419.

AJMansfield avatar Jan 11 '25 18:01 AJMansfield

Hi! On my VSCode, it seems the bug still exist without the foam-vscode extension.

jcalixte avatar Jan 17 '25 15:01 jcalixte

It looks like foam.foam-vscode isn't the only extension that can cause this issue: after re-enabling all of my other extensions, it seems like enabling tekumara.typos-vscode can also make this issue happen about half the time?

To be precise:

{ // always works perfectly in isolation
  "recommendations": [
    "vsls-contrib.gitdoc",
  ]
}
{ // always malfunctions when paired with foam
  "recommendations": [
    "vsls-contrib.gitdoc",
    "foam.foam-vscode",
  ]
}
{ // seems to always work correctly with this set
  "recommendations": [
    "vsls-contrib.gitdoc",
    "yzhang.markdown-all-in-one",
    "mushan.vscode-paste-image",
    "bierner.markdown-mermaid",
    "bpruitt-goddard.mermaid-markdown-syntax-highlighting",
    "alefragnani.project-manager",
    "goessner.mdmath",
    "bierner.markdown-footnotes",
    "Gruntfuggly.todo-tree",
  ]
}
{ // malfunctions occasionally with this set
  "recommendations": [
    "vsls-contrib.gitdoc",
    "yzhang.markdown-all-in-one",
    "mushan.vscode-paste-image",
    "bierner.markdown-mermaid",
    "bpruitt-goddard.mermaid-markdown-syntax-highlighting",
    "alefragnani.project-manager",
    "goessner.mdmath",
    "bierner.markdown-footnotes",
    "Gruntfuggly.todo-tree",
    "tekumara.typos-vscode",
  ]
}

I've added "gitdoc.commitValidationLevel": "none", to my settings.json to ensure the warnings tekumara.typos-vscode has the potential to generate aren't inhibiting it, but, the occasional malfunctions seem to occur independent of this, with the same enable-disable-enable loop correcting it for the current session as reported before.

Something about this feels like it might be related to load timing? The issue with tekumara.typos-vscode is sporadic so I've not yet managed to capture a copy of the Extension Host log that would show the failed version of the timing, but when I do I'll update with logs from both failed and successful launches.

AJMansfield avatar Jan 17 '25 19:01 AJMansfield

@jcalixte Could you share your extension host log output? That'll let us see what your full extension list is, to see if any of the extensions you do have have anything in common with others that seem to be causing this issue.

(If not sure how to access this log: open the command palette with Ctrl+Shift+P, run > Output: Show Output Channels..., and select Extension Host from the options that follow.)

AJMansfield avatar Jan 17 '25 20:01 AJMansfield

Yup, here it is.

2025-01-20 23:44:24.296 [info] Extension host with pid 9867 started
2025-01-20 23:44:24.316 [info] Lock '/home/julien/.vscode-server/data/User/workspaceStorage/6aaf34801a1cea9927fee8dccee3cd6c/vscode.lock': Lock acquired.
2025-01-20 23:44:24.356 [info] ExtensionService#_doActivateExtension GitHub.copilot-chat, startup: false, activationEvent: 'onChatParticipant:github.copilot.editingSession'
2025-01-20 23:44:24.358 [info] ExtensionService#_doActivateExtension Vue.volar, startup: false, activationEvent: 'onLanguage:plaintext'
2025-01-20 23:44:24.358 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage'
2025-01-20 23:44:24.358 [info] ExtensionService#_doActivateExtension vscode.extension-editing, startup: false, activationEvent: 'onLanguage:markdown'
2025-01-20 23:44:24.359 [info] ExtensionService#_doActivateExtension vscode.markdown-language-features, startup: false, activationEvent: 'onLanguage:markdown'
2025-01-20 23:44:24.359 [info] ExtensionService#_doActivateExtension antfu.slidev, startup: false, activationEvent: 'onLanguage:markdown'
2025-01-20 23:44:24.359 [info] ExtensionService#_doActivateExtension DavidAnson.vscode-markdownlint, startup: false, activationEvent: 'onLanguage:markdown'
2025-01-20 23:44:24.360 [info] ExtensionService#_doActivateExtension stevensona.character-count, startup: false, activationEvent: 'onLanguage:markdown'
2025-01-20 23:44:24.360 [info] ExtensionService#_doActivateExtension yzhang.markdown-all-in-one, startup: false, activationEvent: 'onLanguage:markdown'
2025-01-20 23:44:24.645 [info] ExtensionService#_doActivateExtension vscode.markdown-math, startup: false, activationEvent: 'api', root cause: yzhang.markdown-all-in-one
2025-01-20 23:44:24.660 [info] ExtensionService#_doActivateExtension vscode.configuration-editing, startup: false, activationEvent: 'onLanguage:jsonc'
2025-01-20 23:44:24.660 [info] ExtensionService#_doActivateExtension vscode.json-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
2025-01-20 23:44:24.660 [info] ExtensionService#_doActivateExtension vscode.typescript-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
2025-01-20 23:44:26.109 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: false, activationEvent: 'api', root cause: GitHub.copilot-chat
2025-01-20 23:44:26.198 [info] ExtensionService#_doActivateExtension firsttris.vscode-jest-runner, startup: true, activationEvent: '*'
2025-01-20 23:44:26.605 [info] ExtensionService#_doActivateExtension vscode.tunnel-forwarding, startup: false, activationEvent: 'onTunnel'
2025-01-20 23:44:26.687 [info] ExtensionService#_doActivateExtension vscode.npm, startup: true, activationEvent: 'workspaceContains:package.json'
2025-01-20 23:44:26.687 [info] ExtensionService#_doActivateExtension lokalise.i18n-ally, startup: true, activationEvent: 'workspaceContains:package.json'
2025-01-20 23:44:27.327 [info] ExtensionService#_doActivateExtension vscode.git, startup: false, activationEvent: 'api', root cause: GitHub.copilot-chat
2025-01-20 23:44:27.327 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
2025-01-20 23:44:27.632 [info] Eager extensions activated
2025-01-20 23:44:27.632 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2025-01-20 23:44:27.632 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2025-01-20 23:44:27.633 [info] ExtensionService#_doActivateExtension antfu.retypewriter, startup: false, activationEvent: 'onStartupFinished'
2025-01-20 23:44:27.633 [info] ExtensionService#_doActivateExtension bradlc.vscode-tailwindcss, startup: false, activationEvent: 'onStartupFinished'
2025-01-20 23:44:27.633 [info] ExtensionService#_doActivateExtension dbaeumer.vscode-eslint, startup: false, activationEvent: 'onStartupFinished'
2025-01-20 23:44:27.633 [info] ExtensionService#_doActivateExtension esbenp.prettier-vscode, startup: false, activationEvent: 'onStartupFinished'
2025-01-20 23:44:27.633 [info] ExtensionService#_doActivateExtension GitHub.copilot, startup: false, activationEvent: 'onStartupFinished'
2025-01-20 23:44:27.633 [info] ExtensionService#_doActivateExtension Gruntfuggly.todo-tree, startup: false, activationEvent: 'onStartupFinished'
2025-01-20 23:44:27.633 [info] ExtensionService#_doActivateExtension jcalixte.doc-jit, startup: false, activationEvent: 'onStartupFinished'
2025-01-20 23:44:27.634 [info] ExtensionService#_doActivateExtension ms-dotnettools.vscode-dotnet-runtime, startup: false, activationEvent: 'onStartupFinished'
2025-01-20 23:44:27.634 [info] ExtensionService#_doActivateExtension vsls-contrib.gitdoc, startup: false, activationEvent: 'onStartupFinished'

~~But, without knowing what's happening, it's now working just fine.. Maybe the VS Code update between my two messages can explain the diff?~~

Still a problem, I don't know why sometimes it looks like it worked first try.

jcalixte avatar Jan 20 '25 22:01 jcalixte

I've been encountering this problem, as well, even when Foam isn't involved (I use Foam, but I think that's just a red herring, as Foam does nothing with git).

I first noticed the behavior when I started using VS Code's Profiles feature, and I wonder if it might be related to that? I have gitdoc enabled only in my writing profiles, and disabled in everything else.

Others who are seeing this problem - do you use VS Code's Profiles feature?

ShaunaGordon avatar Mar 08 '25 21:03 ShaunaGordon

I don't actually know why gitdoc is broken, but I couldn't get gitdoc to run on the latest version, it seems to only work on 0.1

strazto avatar Jul 03 '25 06:07 strazto

Also hit by this bug - my initial impression was that the commit message was not being filled automatically and it is silently failing on it (always manually need to go to source control, write something in the commit message & click "commit & sync" - otherwise the changes are not synced).

Can also confirm that the disable-enable cycling seems to resolve that issue - so as long as it is not fixed at the root, I at least have a temporary workaround now, thanks for that.

sintel-be avatar Aug 12 '25 11:08 sintel-be

I've got the same issue, discovered today, that whenever i reconnect to vs-code -> GitDoc is disabled and found this issue here with a google search.

The difference here is: I'm not using foam. My Addons are gitdoc and Insert Date String

Image

jsuelwald avatar Nov 27 '25 17:11 jsuelwald