File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33local log = require ' nvimgdb.log'
44
55--- @class NvimGdb globally accessible plugin entry point
6- --- @field public efmmgr EfmMgr errorformat manager
76--- @field private apps table<number , App> collection of debugger sessions {tabpage -> App }
87--- @field private apps_size number count of running debugger sessions
98
109-- Global instance
1110NvimGdb = {
12- efmmgr = require ' nvimgdb.efmmgr' ,
1311 apps = {},
1412 apps_size = 0 ,
1513 mt = {},
@@ -111,7 +109,6 @@ function NvimGdb.cleanup(tab)
111109 if NvimGdb .apps_size == 0 then
112110 -- Cleanup commands, autocommands etc
113111 NvimGdb .global_cleanup ()
114- NvimGdb .efmmgr .cleanup ()
115112 app :get_win ():unset_keymaps ()
116113 end
117114 app :cleanup (tab )
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ local NvimGdb = require'nvimgdb'
1616--- @field private parser ParserImpl debugger output parser
1717--- @field private tabpage_created boolean indicates whether the tabpage was created and needs to be closed during cleanup
1818local App = {}
19- App .efmmgr = require ' nvimgdb.efmmgr'
2019App .__index = App
2120
2221--- Create a new instance of the debugger in the current tabpage.
@@ -85,9 +84,6 @@ function App.new(backend_name, client_cmd)
8584 local parser_actions = require ' nvimgdb.parser_actions' .new (self .cursor , self .win )
8685 self .parser = self .backend .create_parser (parser_actions , self .proxy )
8786
88- -- Setup 'errorformat' for the given backend.
89- App .efmmgr .setup (self .backend .get_error_formats ())
90-
9187 return self
9288end
9389
@@ -117,9 +113,6 @@ function App:cleanup(tab)
117113 destr ()
118114 end
119115
120- -- Remove from 'errorformat' for the given backend.
121- App .efmmgr .teardown (self .backend .get_error_formats ())
122-
123116 -- Destroy the parser
124117 self .parser :cleanup ()
125118
Original file line number Diff line number Diff line change @@ -306,11 +306,16 @@ function Win:lopen(cmd, mods)
306306 self :_with_saved_win (false , function ()
307307 self :_ensure_jump_window ()
308308 vim .api .nvim_win_call (self .jump_win , function ()
309+ local efmmgr = require ' nvimgdb.efmmgr'
310+ local backend = NvimGdb .here .backend
311+ -- Setup 'errorformat' for the given backend. Do it locally because 'efm' can change be reset when editing files.
312+ efmmgr .setup (backend .get_error_formats ())
309313 log .debug ({win = self .jump_win , valid = vim .api .nvim_win_is_valid (self .jump_win ), llist = llist })
310314 local res = vim .fn .setloclist (0 , {}, ' ' , {lines = llist })
311315 log .debug ({res = res , loclist = vim .fn .getloclist (0 , {lines = 1 })})
312316 vim .cmd (mods .. ' lopen' )
313317 log .debug ({win = vim .api .nvim_get_current_win (), loclist = vim .fn .getloclist (vim .api .nvim_get_current_win ())})
318+ efmmgr .teardown (backend .get_error_formats ())
314319 end )
315320 end )
316321 end )
You can’t perform that action at this time.
0 commit comments