mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 01:40:05 +08:00
feat(maven): add maven task provider
This commit is contained in:
parent
91e367637a
commit
6f96cce5e5
@ -186,6 +186,18 @@ function! SpaceVim#layers#lang#java#config() abort
|
|||||||
endif
|
endif
|
||||||
call SpaceVim#layers#edit#add_ft_head_tamplate('java', s:java_file_head)
|
call SpaceVim#layers#edit#add_ft_head_tamplate('java', s:java_file_head)
|
||||||
call SpaceVim#plugins#projectmanager#reg_callback(function('s:handle_java_project_changed'))
|
call SpaceVim#plugins#projectmanager#reg_callback(function('s:handle_java_project_changed'))
|
||||||
|
call SpaceVim#plugins#tasks#reg_provider(function('s:maven_tasks'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:maven_tasks() abort
|
||||||
|
let detect_task = {}
|
||||||
|
let conf = {}
|
||||||
|
if filereadable('pom.xml')
|
||||||
|
call extend(detect_task, {
|
||||||
|
\ 'compile' : {'command' : 'mvn', 'args' : ['compile'], 'isDetected' : 1, 'detectedName' : 'mvn:'}
|
||||||
|
\ })
|
||||||
|
endif
|
||||||
|
return detect_task
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:handle_java_project_changed() abort
|
function! s:handle_java_project_changed() abort
|
||||||
|
@ -38,11 +38,13 @@ local function show_taskconfig(opts)
|
|||||||
desc = desc .. ' ' .. table.concat(entry.value.task.args, ' ')
|
desc = desc .. ' ' .. table.concat(entry.value.task.args, ' ')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local task_name = entry.value.name
|
||||||
local task_type = 'local'
|
local task_type = 'local'
|
||||||
if entry.value.task.isGlobal == 1 then
|
if entry.value.task.isGlobal == 1 then
|
||||||
task_type = 'global'
|
task_type = 'global'
|
||||||
elseif entry.value.task.isDetected == 1 then
|
elseif entry.value.task.isDetected == 1 then
|
||||||
task_type = 'detected'
|
task_type = 'detected'
|
||||||
|
task_name = (entry.value.task.detectedName or '') .. task_name
|
||||||
end
|
end
|
||||||
-- @todo the text maybe changed
|
-- @todo the text maybe changed
|
||||||
local background = 'no-background'
|
local background = 'no-background'
|
||||||
@ -50,7 +52,7 @@ local function show_taskconfig(opts)
|
|||||||
background = 'background'
|
background = 'background'
|
||||||
end
|
end
|
||||||
return displayer({
|
return displayer({
|
||||||
{ '[' .. entry.value.name .. ']', 'TelescopeResultsVariable' },
|
{ '[' .. task_name .. ']', 'TelescopeResultsVariable' },
|
||||||
{ '[' .. task_type .. ']', 'TelescopeResultsNumber' },
|
{ '[' .. task_type .. ']', 'TelescopeResultsNumber' },
|
||||||
{ '[' .. background .. ']', 'TelescopeResultsNumber' },
|
{ '[' .. background .. ']', 'TelescopeResultsNumber' },
|
||||||
{ desc, 'TelescopeResultsComment' },
|
{ desc, 'TelescopeResultsComment' },
|
||||||
|
Loading…
Reference in New Issue
Block a user