Merge branch 'main' of labs.scarif.space:chris/nvim
This commit is contained in:
@@ -121,7 +121,9 @@ return {
|
||||
dap.adapters.php = {
|
||||
type = 'executable',
|
||||
command = 'node',
|
||||
args = { '/Users/chris/.local/src/vscode-php-debug/out/phpDebug.js' },
|
||||
args = {
|
||||
vim.fn.expand '$MASON/packages/php-debug-adapter/extension/out/phpDebug.js',
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.php = {
|
||||
@@ -160,10 +162,10 @@ return {
|
||||
},
|
||||
element_mappings = {
|
||||
stacks = {
|
||||
open = "<CR>",
|
||||
expand = "o",
|
||||
}
|
||||
}
|
||||
open = '<CR>',
|
||||
expand = 'o',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Change breakpoint icons
|
||||
|
||||
6
lua/plugins/suda.lua
Normal file
6
lua/plugins/suda.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
'lambdalisue/vim-suda',
|
||||
config = function()
|
||||
vim.g.suda_smart_edit = 1
|
||||
end,
|
||||
}
|
||||
@@ -4,14 +4,26 @@ local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
|
||||
local function get_psr4_root()
|
||||
local handle = io.popen [[php -r "echo array_keys(json_decode(file_get_contents('composer.json'), true)['autoload']['psr-4'])[0];"]]
|
||||
local ns_root = handle and handle:read '*a' or ''
|
||||
if handle then
|
||||
handle:close()
|
||||
end
|
||||
ns_root = ns_root:gsub('\\$', '') -- Remove trailing backslash
|
||||
return ns_root
|
||||
end
|
||||
|
||||
local function psr_namespace(args, snip)
|
||||
local path = snip.env.TM_FILENAME_FULL or ''
|
||||
local root = '/src/'
|
||||
local ns = path:match(root .. '(.*)/[^/]+%.php$')
|
||||
local composer_root = get_psr4_root()
|
||||
-- Find the directory mapped by composer.json
|
||||
local root_dir = composer_root:gsub('\\', '/')
|
||||
local ns = path:match(root_dir .. '/(.*)/[^/]+%.php$')
|
||||
if ns then
|
||||
return ns:gsub('/', '\\')
|
||||
return composer_root .. '\\' .. ns:gsub('/', '\\')
|
||||
else
|
||||
return 'App'
|
||||
return composer_root ~= '' and composer_root or 'App'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user