diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-01-07 21:13:23 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-01-07 21:13:28 +0900 |
| commit | 3d090767b8a19b238d789b94b012eac94a36a034 (patch) | |
| tree | 5a539845d18fe945e91a7246b68ff1925ed23d1c /.config/nvim/after/ftplugin/php.lua | |
| parent | b2e3489dca73960777dbb389916c9bec8e7bd12f (diff) | |
| download | dotfiles-3d090767b8a19b238d789b94b012eac94a36a034.tar.gz dotfiles-3d090767b8a19b238d789b94b012eac94a36a034.tar.zst dotfiles-3d090767b8a19b238d789b94b012eac94a36a034.zip | |
nvim: support more kinds of PSR-4 definition
Diffstat (limited to '.config/nvim/after/ftplugin/php.lua')
| -rw-r--r-- | .config/nvim/after/ftplugin/php.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/.config/nvim/after/ftplugin/php.lua b/.config/nvim/after/ftplugin/php.lua index d6dbf6b..31d85aa 100644 --- a/.config/nvim/after/ftplugin/php.lua +++ b/.config/nvim/after/ftplugin/php.lua @@ -45,6 +45,16 @@ vimrc.after_ftplugin('php', function(conf) psr4_namespace = k psr4_dir = v end + if type(psr4_dir) == 'table' then + if #psr4_dir == 1 then + psr4_dir = psr4_dir[1] + else + return nil -- psr-4 section is ambiguous + end + end + if type(psr4_namespace) ~= 'string' or type(psr4_dir) ~= 'string' then + return nil -- psr-4 section is invalid + end if psr4_namespace:sub(-1, -1) == '\\' then psr4_namespace = psr4_namespace:sub(0, -2) end |
