Skip to content

feat: record installed parser SHA in lock.js#50

Open
taku25 wants to merge 5 commits into
romus204:mainfrom
taku25:feat/parser-lock-file
Open

feat: record installed parser SHA in lock.js#50
taku25 wants to merge 5 commits into
romus204:mainfrom
taku25:feat/parser-lock-file

Conversation

@taku25

@taku25 taku25 commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

Part of #41. This is PR1 of 3 planned PRs for parser revision tracking.

Changes

  • Added lock file utilities to util.lua:
  • lock_set(lang, entry) — saves { url, sha } after installation
  • lock_remove(lang) — removes the entry on parser removal
  • lock_get(lang) — retrieves the entry (for future use in PR2/PR3)
  • After a successful build, git rev-parse HEAD is called to capture the installed commit SHA, which is written to lock.json
  • remove() now cleans up the corresponding lock entry
  • lock.json is stored in the parent of parser_dir (e.g. ~/.local/share/nvim/site/lock.json) to keep the parser directory clean

lock.json example

{
"lua": {
"sha": "abc1234...",
"url": "https://github.com/..."
}
}

@moqodow

moqodow commented Apr 23, 2026

Copy link
Copy Markdown

Hello,
I do like the idea of a lock file for the installed parser in general. I just think the lock file should be in the neovim config directory. Then the user can add it to the tracked files. This would allow to have the same parser installed on each system that uses the same neovim config.
Other tools with lock files also use the user config dir by default e.g. lazy.nvim, vim.pack.
Thanks,
Wilfried

@taku25

taku25 commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator Author

That makes a lot of sense. Storing the lock file in the config directory is much better for users who manage their dotfiles, as it ensures consistent parser versions across different environments. I’ll update the PR accordingly. Please wait a bit!

taku25 added 5 commits April 24, 2026 03:12
 Change lock file location from parent of parser_dir (site/) to
 vim.fn.stdpath("config") so users can track it in their dotfiles,
 consistent with lazy.nvim's lazy-lock.json placement.

 Also rename lock.json -> tsm-lock.json to avoid conflict
@taku25 taku25 force-pushed the feat/parser-lock-file branch from f528fd0 to 3b1681d Compare April 23, 2026 18:14
@ssfdust

ssfdust commented May 25, 2026

Copy link
Copy Markdown

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants