runtime(termdebug): Add Deprecation warnings

Commit: 
https://github.com/vim/vim/commit/e54fd3f7d80502f31259c185798a21d9d1b55315
Author: Ubaldo Tiberi <ubaldo.tib...@google.com>
Date:   Thu Jul 4 17:14:03 2024 +0200

    runtime(termdebug): Add Deprecation warnings
    
    closes: https://github.com/vim/vim/issues/15091
    
    Signed-off-by: Ubaldo Tiberi <ubaldo.tib...@google.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt
index 5058bf05e..6bc980b43 100644
--- a/runtime/doc/terminal.txt
+++ b/runtime/doc/terminal.txt
@@ -1,4 +1,4 @@
-*terminal.txt* For Vim version 9.1.  Last change: 2024 Jun 20
+*terminal.txt* For Vim version 9.1.  Last change: 2024 Jul 04
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1531,7 +1531,10 @@ Prompt mode can be used even when the |+terminal| 
feature is present with: >
        let g:termdebug_config['use_prompt'] = 1
 If there is no g:termdebug_config you can use: >
        let g:termdebug_use_prompt = 1
+
 <
+However, the latter form will be deprecated in future releases.
+
 Mappings ~
 The termdebug plugin enables a few default mappings.  All those mappings
 are reset to their original values once the termdebug session concludes.
@@ -1543,6 +1546,8 @@ mapping to K already exists.  If you do not want this 
use: >
 If there is no g:termdebug_config you can use: >
        let g:termdebug_map_K = 0
 <
+However, the latter form will be deprecated in future releases.
+
                                                *termdebug_map_minus*
 The - key is normally mapped to |:Down| unless a buffer local mapping to the -
 key already exists.  If you do not want this use: >
@@ -1560,6 +1565,9 @@ If you want the Asm window shown by default, set the 
"disasm_window" flag to
        let g:termdebug_config['disasm_window_height'] = 15
 If there is no g:termdebug_config you can use: >
        let g:termdebug_disasm_window = 15
+
+However, the latter form will be deprecated in future releases.
+
 Any value greater than 1 will set the Asm window height to that value.
 If the current window has enough horizontal space, it will be vertically split
 and the Asm window will be shown side by side with the source code window (and
@@ -1573,6 +1581,9 @@ height: >
        let g:termdebug_config['variables_window_height'] = 15
 If there is no g:termdebug_config you can use: >
        let g:termdebug_variables_window = 15
+
+However, the latter form will be deprecated in future releases.
+
 Any value greater than 1 will set the Var window height to that value.
 If the current window has enough horizontal space, it will be vertically split
 and the Var window will be shown side by side with the source code window (and
@@ -1601,6 +1612,8 @@ g:termdebug_config or the "g:termdebugger" variable 
before invoking
 If there is no g:termdebug_config you can use: >
        let g:termdebugger = "mygdb"
 
+However, the latter form will be deprecated in future releases.
+
 If the command needs an argument use a List: >
        let g:termdebug_config['command'] = ['rr', 'replay', '--']
 If there is no g:termdebug_config you can use: >
@@ -1658,6 +1671,7 @@ If you don't want this then disable it with: >
 If there is no g:termdebug_config you can use: >
        let g:termdebug_popup = 0
 
+However, the latter form will be deprecated in future releases.
 
 Change default signs ~
                                                        *termdebug_signs*
@@ -1688,6 +1702,8 @@ split: >
 If there is no g:termdebug_config you can use: >
        let g:termdebug_wide = 163
 
+However, the latter form will be deprecated in future releases.
+
 This will set 'columns' to 163 when `:Termdebug` is used.  The value is
 restored when quitting the debugger.
 
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim 
b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 1d4e338e1..dc8b4adc3 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -4,7 +4,7 @@ vim9script
 
 # Author: Bram Moolenaar
 # Copyright: Vim license applies, see ":help license"
-# Last Change: 2024 Jun 22
+# Last Change: 2024 Jul 04
 # Converted to Vim9: Ubaldo Tiberi <ubaldo.tib...@gmail.com>
 
 # WORK IN PROGRESS - The basics works stable, more to come
@@ -42,6 +42,9 @@ def Echoerr(msg: string)
   echohl ErrorMsg | echom $'[termdebug] {msg}' | echohl None
 enddef
 
+def Echowarn(msg: string)
+  echohl WarningMsg | echom $'[termdebug] {msg}' | echohl None
+enddef
 
 # Variables to keep their status among multiple instances of Termdebug
 # Avoid to source the script twice.
@@ -244,6 +247,31 @@ def SanityCheck(): bool
   return is_check_ok
 enddef
 
+def DeprecationWarnings()
+  # TODO Remove the deprecated features after 1 Jan 2025.
+  var config_param = ''
+  if exists('g:termdebug_wide')
+    config_param = 'g:termdebug_wide'
+  elseif exists('g:termdebug_popup')
+    config_param = 'g:termdebug_popup'
+  elseif exists('g:termdebugger')
+    config_param = 'g:termdebugger'
+  elseif exists('g:termdebug_variables_window')
+    config_param = 'g:termdebug_variables_window'
+  elseif exists('g:termdebug_disasm_window')
+    config_param = 'g:termdebug_disasm_window'
+  elseif exists('g:termdebug_map_K')
+    config_param = 'g:termdebug_map_K'
+  elseif exists('g:termdebug_use_prompt')
+    config_param = 'g:termdebug_use_prompt'
+  endif
+
+  if !empty(config_param)
+    Echowarn($"Deprecation Warning: '{config_param}' parameter
+          \ is deprecated and will be removed in the future. See ':h 
g:termdebug_config' for alternatives.")
+  endif
+
+enddef
 
 # Take a breakpoint number as used by GDB and turn it into an integer.
 # The breakpoint may contain a dot: 123.4 -> 123004
@@ -313,6 +341,7 @@ def StartDebug_internal(dict: dict<any>)
   if !SanityCheck()
     return
   endif
+  DeprecationWarnings()
 
   if exists('#User#TermdebugStartPre')
     doauto <nomodeline> User TermdebugStartPre

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1sPOAq-002Syc-G1%40256bit.org.

Raspunde prin e-mail lui