diff options
| author | dundargoc <gocdundar@gmail.com> | 2024-12-01 12:57:16 +0100 |
|---|---|---|
| committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2024-12-01 15:11:38 +0100 |
| commit | 90c1c6cc822b1836209514c096069b9bbeab63d9 (patch) | |
| tree | a553e1bb6bfe7a5cf81fcbef587b9095c0184c0f /scripts/docgen.lua | |
| parent | build(editorconfig): set max_line_length to 120 only for lua files (diff) | |
| download | nvim-lspconfig-90c1c6cc822b1836209514c096069b9bbeab63d9.tar nvim-lspconfig-90c1c6cc822b1836209514c096069b9bbeab63d9.tar.gz nvim-lspconfig-90c1c6cc822b1836209514c096069b9bbeab63d9.tar.bz2 nvim-lspconfig-90c1c6cc822b1836209514c096069b9bbeab63d9.tar.lz nvim-lspconfig-90c1c6cc822b1836209514c096069b9bbeab63d9.tar.xz nvim-lspconfig-90c1c6cc822b1836209514c096069b9bbeab63d9.tar.zst nvim-lspconfig-90c1c6cc822b1836209514c096069b9bbeab63d9.zip | |
refactor: use simpler file existence check
The vimscript function `getftype` is an easier way to check for file
existence compared to vim.uv.
Diffstat (limited to 'scripts/docgen.lua')
| -rw-r--r-- | scripts/docgen.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/docgen.lua b/scripts/docgen.lua index ee275f24..47e2fe28 100644 --- a/scripts/docgen.lua +++ b/scripts/docgen.lua @@ -63,7 +63,7 @@ local function make_section(indentlvl, sep, parts) end local function readfile(path) - assert((uv.fs_stat(path) or {}).type == 'file') + assert(vim.fn.getftype(path) == 'file') return io.open(path):read '*a' end @@ -181,10 +181,10 @@ local function make_lsp_sections() function() local package_json_name = util.path.join(tempdir, config_name .. '.package.json') if docs.package_json then - if not ((uv.fs_stat(package_json_name) or {}).type == 'file') then + if vim.fn.getftype(package_json_name) ~= 'file' then os.execute(string.format('curl -v -L -o %q %q', package_json_name, docs.package_json)) end - if not ((uv.fs_stat(package_json_name) or {}).type == 'file') then + if vim.fn.getftype(package_json_name) ~= 'file' then print(string.format('Failed to download package.json for %q at %q', config_name, docs.package_json)) os.exit(1) return |
