mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 20:30: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
|
||||
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#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
|
||||
|
||||
function! s:handle_java_project_changed() abort
|
||||
|
@ -38,11 +38,13 @@ local function show_taskconfig(opts)
|
||||
desc = desc .. ' ' .. table.concat(entry.value.task.args, ' ')
|
||||
end
|
||||
end
|
||||
local task_name = entry.value.name
|
||||
local task_type = 'local'
|
||||
if entry.value.task.isGlobal == 1 then
|
||||
task_type = 'global'
|
||||
elseif entry.value.task.isDetected == 1 then
|
||||
task_type = 'detected'
|
||||
task_name = (entry.value.task.detectedName or '') .. task_name
|
||||
end
|
||||
-- @todo the text maybe changed
|
||||
local background = 'no-background'
|
||||
@ -50,7 +52,7 @@ local function show_taskconfig(opts)
|
||||
background = 'background'
|
||||
end
|
||||
return displayer({
|
||||
{ '[' .. entry.value.name .. ']', 'TelescopeResultsVariable' },
|
||||
{ '[' .. task_name .. ']', 'TelescopeResultsVariable' },
|
||||
{ '[' .. task_type .. ']', 'TelescopeResultsNumber' },
|
||||
{ '[' .. background .. ']', 'TelescopeResultsNumber' },
|
||||
{ desc, 'TelescopeResultsComment' },
|
||||
|
Loading…
Reference in New Issue
Block a user