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(api): vim.fn.writefile() to accept lua strings as input #30763 #31930

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AbhijithKumble
Copy link

Fix #30763

This is my first time contributing to this project, so how do i add test case coverage to the pr ?



Problem: writefile() only accepts list or blob as input to write to a
file

Solution: accept string and intrepret it as a blob
@github-actions github-actions bot added the api libnvim, Nvim RPC API label Jan 9, 2025
@luukvbaal
Copy link
Member

luukvbaal commented Jan 9, 2025

Thanks for working on this. Test coverage should probably go in test/functional/vimscript/writefile_spec.lua. Adding a testcase there should not prove to be too difficult if you look at the pre-existing tests.

///
/// @return true on success, or false on failure.

static bool write_string(FileDescriptor *const fp, const char *const data)
Copy link
Member

Choose a reason for hiding this comment

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

nearly identical to write_blob. can we parameterize write_blob instead of copy-pasting it

@justinmk
Copy link
Member

justinmk commented Jan 9, 2025

@justinmk justinmk added the needs:response waiting for reply from the author label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api libnvim, Nvim RPC API needs:response waiting for reply from the author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lua: writefile() "fast", Blob argument should accept Lua string
3 participants
  NODES
COMMUNITY 2
Project 6
USERS 1