This repository was archived by the owner on Jul 6, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ function M.get_prev_loc()
4343 return # M .location
4444end
4545
46- function jumpToLocation (i )
46+ local function jumpToLocation (i )
4747 if i >= 1 and i <= # M .location then
4848 api .nvim_command (" silent! ll" .. i )
4949 M .openLineDiagnostics ()
@@ -92,6 +92,22 @@ function M.jumpPrevLocationCycle()
9292 end
9393end
9494
95+ function M .jumpFirstLocation ()
96+ M .location = api .nvim_call_function (' getloclist' , {0 })
97+ jumpToLocation (1 )
98+ if # M .location == 0 then
99+ return api .nvim_command (" echohl WarningMsg | echo 'No diagnostics found' | echohl None" )
100+ end
101+ end
102+
103+ function M .jumpLastLocation ()
104+ M .location = api .nvim_call_function (' getloclist' , {0 })
105+ jumpToLocation (# M .location )
106+ if # M .location == 0 then
107+ return api .nvim_command (" echohl WarningMsg | echo 'No diagnostics found' | echohl None" )
108+ end
109+ end
110+
95111-- Open line diagnostics when jump
96112-- Don't do anything if diagnostic_auto_popup_while_jump == 0
97113-- NOTE need to delay a certain amount of time to show correctly
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ command! PrevDiagnosticCycle lua require'jumpLoc'.jumpPrevLocationCycle()
88command ! NextDiagnostic lua require' jumpLoc' .jumpNextLocation ()
99command ! NextDiagnosticCycle lua require' jumpLoc' .jumpNextLocationCycle ()
1010command ! OpenDiagnostic lua require' jumpLoc' .openDiagnostics ()
11+ command ! FirstDiagnostic lua require' jumpLoc' .jumpFirstLocation ()
12+ command ! LastDiagnostic lua require' jumpLoc' .jumpLastLocation ()
1113
1214" lua require'diagnostic'.modifyCallback()
1315
You can’t perform that action at this time.
0 commit comments