Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: trigger initial update when lazy loading #61

Merged
merged 1 commit into from
May 4, 2023

Conversation

MunifTanjim
Copy link
Contributor

Fix the scenario when lazy loading with BufRead Cargo.toml event, M.update() was not called immediately.

Copy link
Owner

@saecki saecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one nitpick otherwise this looks good to go

@@ -80,6 +80,10 @@ function M.setup(cfg: Config)

local group = vim.api.nvim_create_augroup("Crates", {})
if state.cfg.autoload then
if vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":t") == "Cargo.toml" then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent, since we use this already elsewhere

Suggested change
if vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":t") == "Cargo.toml" then
if vim.fn.expand("%:t") == "Cargo.toml" then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated 👍🏼

@saecki saecki merged commit 0c21ec2 into saecki:main May 4, 2023
@MunifTanjim MunifTanjim deleted the fix-lazy-load branch May 4, 2023 10:33
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.

2 participants