summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim/provider/python.lua
diff options
context:
space:
mode:
authorYochem van Rosmalen <git@yochem.nl>2026-03-20 10:08:00 +0100
committerGitHub <noreply@github.com>2026-03-20 05:08:00 -0400
commit72a63346d866c320bbf77c90db0574952bd1c076 (patch)
treee5859ec1c68e81456ec0d2d9b5d82adaf758091c /runtime/lua/vim/provider/python.lua
parent1244fe157f9fffb2dca540410bd8c88540339240 (diff)
feat(stdlib): vim.fs.ext() returns file extension #36997
Problem: Checking the extension of a file is done often, e.g. in Nvim's codebase for differentiating Lua and Vimscript files in the runtime. The current way to do this in Lua is (1) a Lua pattern match, which has pitfalls such as not considering filenames starting with a dot, or (2) fnamemodify() which is both hard to discover and hard to use / read if not very familiar with the possible modifiers. vim.fs.ext() returns the file extension including the leading dot of the extension. Similar to the "file extension" implementation of many other stdlibs (including fnamemodify(file, ":e")), a leading dot doesn't indicate the start of the extension. E.g.: the .git folder in a repository doesn't have the extension .git, but it simply has no extension, similar to a folder named git or any other filename without dot(s).
Diffstat (limited to 'runtime/lua/vim/provider/python.lua')
0 files changed, 0 insertions, 0 deletions