@@ -113,55 +113,6 @@ function M.pick_process()
113113end
114114
115115
116- ---- - Get a ts compatible range of the current visual selection.
117- ----
118- ---- The range of ts nodes start with 0 and the ending range is exclusive.
119- function M .visual_selection_range ()
120- local msg = " dap.utils.visual_selection_range is deprecated for removal in 0.3.0. "
121- .. " If you're using it with dap.ui.widgets.hover you no longer need it. "
122- .. " See https://github.com/mfussenegger/nvim-dap/pull/621"
123- if vim .notify_once then
124- vim .notify_once (msg , vim .log .levels .WARN )
125- else
126- M .notify (msg , vim .log .levels .WARN )
127- end
128- local _ , csrow , cscol , _ = unpack (vim .fn .getpos (" '<" ))
129- local _ , cerow , cecol , _ = unpack (vim .fn .getpos (" '>" ))
130- if csrow < cerow or (csrow == cerow and cscol <= cecol ) then
131- return csrow - 1 , cscol - 1 , cerow - 1 , cecol
132- else
133- return cerow - 1 , cecol - 1 , csrow - 1 , cscol
134- end
135- end
136-
137-
138- ---- Returns visual selection if it exists or nil
139- function M .get_visual_selection_text ()
140- local msg = " dap.utils.get_visual_selection_text is deprecated for removal in 0.3.0. "
141- .. " If you're using it with dap.ui.widgets.hover you no longer need it. "
142- .. " See https://github.com/mfussenegger/nvim-dap/pull/621"
143- if vim .notify_once then
144- vim .notify_once (msg , vim .log .levels .WARN )
145- else
146- M .notify (msg , vim .log .levels .WARN )
147- end
148- local bufnr = vim .api .nvim_get_current_buf ()
149-
150- -- We have to remember that end_col is end-exclusive
151- local start_row , start_col , end_row , end_col = M .visual_selection_range ()
152-
153- if start_row ~= end_row then
154- local lines = vim .api .nvim_buf_get_lines (bufnr , start_row , end_row + 1 , false )
155- lines [1 ] = string.sub (lines [1 ], start_col + 1 )
156- lines [# lines ] = string.sub (lines [# lines ], 1 , end_col )
157- return table.concat (lines , ' \n ' )
158- else
159- local line = vim .api .nvim_buf_get_lines (bufnr , start_row , start_row + 1 , false )[1 ]
160- -- If line is nil then the line is empty
161- return line and table.concat ({ string.sub (line , start_col + 1 , end_col ) }, ' \n ' )
162- end
163- end
164-
165116function M .notify (msg , log_level )
166117 if vim .in_fast_event () then
167118 vim .schedule (function ()
0 commit comments