diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-03-09 20:13:56 +0100 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-03-09 20:13:56 +0100 |
| commit | 3505100073d973c9f4f75e11ecaa777d84775984 (patch) | |
| tree | ec082550ae2fa4ce09adcd54a7874f294e9c2099 /lua | |
| parent | 71f2be8e0d59e609eecf282e86d6c0de1dccac75 (diff) | |
| download | nvim-conf-3505100073d973c9f4f75e11ecaa777d84775984.tar.gz nvim-conf-3505100073d973c9f4f75e11ecaa777d84775984.zip | |
feat: update with composer version
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/alpha/lsp/null-ls.lua | 4 | ||||
| -rw-r--r-- | lua/alpha/snips/ft/php.lua | 33 |
2 files changed, 3 insertions, 34 deletions
diff --git a/lua/alpha/lsp/null-ls.lua b/lua/alpha/lsp/null-ls.lua index f80b183..91caa82 100644 --- a/lua/alpha/lsp/null-ls.lua +++ b/lua/alpha/lsp/null-ls.lua @@ -20,14 +20,14 @@ local sources = { }, } -if composer.query { "require", "symfony/framework-bundle" } ~= nil then +if composer.query_composer_file { "require", "symfony/framework-bundle" } ~= nil then table.insert( sources, null_ls.builtins.diagnostics.phpcs.with { method = null_ls.methods.DIAGNOSTICS_ON_SAVE, } ) -elseif composer.query { "require", "laravel/framework" } ~= nil then +elseif composer.query_composer_file { "require", "laravel/framework" } ~= nil then table.insert(sources, null_ls.builtins.formatting.pint) -- table.insert(sources, laravel_actions.relationships) end diff --git a/lua/alpha/snips/ft/php.lua b/lua/alpha/snips/ft/php.lua index ac1c3fb..f977bfd 100644 --- a/lua/alpha/snips/ft/php.lua +++ b/lua/alpha/snips/ft/php.lua @@ -28,37 +28,6 @@ local visibility = function(position, default) return c(position, options) end --- FIX: This logic does not work properly -local namespace = function() - local dir = vim.fn.expand "%:h" - local autoloads = composer.query { "autoload", "psr-4" } - local dev_autoloads = composer.query { "autoload-dev", "psr-4" } - - if autoloads == nil then - return (dir:gsub("^%l", string.upper)) - end - - for index, value in pairs(dev_autoloads) do - autoloads[index] = value - end - - P(dir) - local globalNamespace - for key, value in pairs(autoloads) do - if string.starts(dir, value:sub(1, -2)) then - globalNamespace = key:sub(1, -2) - dir = dir:sub(#key + 1) - break - end - end - dir = dir:gsub("/", "\\") - if dir == "" then - return globalNamespace - end - - return string.format("%s\\%s", globalNamespace, dir) -end - local class_name = function() return vim.fn.expand "%:t:r" end @@ -92,7 +61,7 @@ class {} }} ]], { - f(namespace), + f(composer.resolve_php_namespace), f(class_name), i(0), } |