aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha
diff options
context:
space:
mode:
authorAriel D'Alessandro <ariel.dalessandro@auto1.com>2022-09-21 09:34:54 +0200
committerAriel D'Alessandro <ariel.dalessandro@auto1.com>2022-09-21 09:34:54 +0200
commit1d5036f411392a199f205a868fe793f1e33718cc (patch)
treec91f1fc32007a26eaf0b5d632865f2eebfd224eb /lua/alpha
parent4dd074a3b6f27d5db0cfc32031c06c86b498a967 (diff)
downloadnvim-conf-1d5036f411392a199f205a868fe793f1e33718cc.tar.gz
nvim-conf-1d5036f411392a199f205a868fe793f1e33718cc.zip
Fix the symfony reference for the null ls and composer to load in from worktree folders
Diffstat (limited to 'lua/alpha')
-rw-r--r--lua/alpha/composer.lua19
1 files changed, 15 insertions, 4 deletions
diff --git a/lua/alpha/composer.lua b/lua/alpha/composer.lua
index e67d523..4792979 100644
--- a/lua/alpha/composer.lua
+++ b/lua/alpha/composer.lua
@@ -1,13 +1,24 @@
local M = {}
+local function get_composer_file()
+ if vim.fn.findfile("composer.json") ~= "" then
+ return vim.fn.json_decode(vim.fn.readfile(vim.fn.getcwd() .. "/composer.json"))
+ end
+
+ if vim.fn.findfile("master/composer.json") ~= "" then
+ return vim.fn.json_decode(vim.fn.readfile(vim.fn.getcwd() .. "/master/composer.json"))
+ end
+
+ return nil
+end
+
M.query = function (path)
- if vim.fn.findfile("composer.json") == "" then
- P("did not found the file")
+ local target = get_composer_file()
+
+ if target == nil then
return nil
end
- local target = vim.fn.json_decode(vim.fn.readfile(vim.fn.getcwd() .. "/composer.json"))
-
for _, part in ipairs(path) do
target = target[part]
if target == nil then