Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autoload/laravel.vim
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ endfunction
" { 'route.name': 'GET|POST route/url', ... }
function! s:app_routes() abort dict
if self.cache.needs('routes')
let lines = laravel#artisan#capture('route:list')
let lines = laravel#artisan#capture(laravel#app(), 'route:list')
call filter(lines, 'v:val =~# ''^| ''')
" Remove header line
call remove(lines, 0)
Expand Down
4 changes: 2 additions & 2 deletions autoload/laravel/artisan.vim
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ endfunction

""
" Get output from Artisan with {args} in project's root directory.
function! s:artisan_capture(app, args) abort
function! laravel#artisan#capture(app, args) abort
try
let cwd = s:cd(a:app.path())
let result = systemlist(a:app.makeprg(a:args))
Expand All @@ -72,7 +72,7 @@ endfunction
" Get Dict from artisan list --format=json.
function! s:artisan_json(app) abort
if a:app.cache.needs('artisan_json')
let lines = s:artisan_capture(a:app, ['list', '--format=json'])
let lines = laravel#artisan#capture(a:app, ['list', '--format=json'])

let json = {}

Expand Down
12 changes: 6 additions & 6 deletions autoload/laravel/completion.vim
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
" autoload/laravel/completion.vim - Completion sources
" Maintainer: Noah Frederick

function! laravel#completion#cm_routes(opt, ctx) abort
function! laravel#completion#cm_routes(ctx) abort
if exists('b:laravel_root')
call s:cm_complete(laravel#app().routes(), a:opt, a:ctx)
call s:cm_complete(laravel#app().routes(), a:ctx)
endif
endfunction

function! laravel#completion#cm_views(opt, ctx) abort
function! laravel#completion#cm_views(ctx) abort
if exists('b:laravel_root')
call s:cm_complete(laravel#app().templates(), a:opt, a:ctx)
call s:cm_complete(laravel#app().templates(), a:ctx)
endif
endfunction

function! s:cm_complete(candidates, opt, ctx) abort
function! s:cm_complete(candidates, ctx) abort
let matches = map(keys(a:candidates), '{"word": v:val, "info": a:candidates[v:val]}')
call cm#complete(a:opt, a:ctx, a:ctx['startcol'], matches)
call ncm2#complete(a:ctx, a:ctx['startccol'], matches)
endfunction

" vim: fdm=marker:sw=2:sts=2:et
26 changes: 14 additions & 12 deletions plugin/laravel.vim
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,25 @@ augroup laravel_completion
autocmd!
" Set up nvim-completion-manager sources
" :help NCM-source-examples
autocmd User CmSetup call cm#register_source({'name' : 'Laravel Route',
\ 'abbreviation': 'Route',
au User Ncm2Plugin call ncm2#register_source({
\ 'name' : 'Laravel Route',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\ 'name' : 'Laravel Route',
\ 'name': 'Laravel Route',
\ 'priority': 9,
\ 'scoping': 1,
\ 'scopes': ['php', 'blade'],
\ 'subscope_enable': 1,
\ 'scope': ['php','blade'],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\ 'scope': ['php','blade'],
\ 'scope': ['php', 'blade'],
\ 'mark': 'Route',
\ 'word_pattern': '[A-Za-z0-9_.:-]+',
\ 'cm_refresh_patterns': ['\broute\([''"]'],
\ 'cm_refresh': 'laravel#completion#cm_routes',
\ 'complete_pattern': ['\broute\([''"]'],
\ 'on_complete': 'laravel#completion#cm_routes',
\ })
autocmd User CmSetup call cm#register_source({'name' : 'Laravel View',
\ 'abbreviation': 'View',
au User Ncm2Plugin call ncm2#register_source({
\ 'name' : 'Laravel View',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\ 'name' : 'Laravel View',
\ 'name': 'Laravel View',
\ 'priority': 9,
\ 'scoping': 1,
\ 'scopes': ['php', 'blade'],
\ 'subscope_enable': 1,
\ 'scope': ['php','blade'],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\ 'scope': ['php','blade'],
\ 'scope': ['php', 'blade'],
\ 'mark': 'View',
\ 'word_pattern': '[A-Za-z0-9_.:-]+',
\ 'cm_refresh_patterns': ['\bview\([''"]', '@(component|extends|include)\([''"]'],
\ 'cm_refresh': 'laravel#completion#cm_views',
\ 'complete_pattern': ['\bview\([''"]', '@(component|extends|include)\([''"]'],
\ 'on_complete': 'laravel#completion#cm_views',
\ })
augroup END

Expand Down