Coder Social home page Coder Social logo

Comments (8)

chrisbra avatar chrisbra commented on July 4, 2024 1

Hm, I think this patch should do it, no?

diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index d00cdded2..8f2e331ef 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -248,11 +248,13 @@ enddef

 # Get the command to execute the debugger as a list, defaults to ["gdb"].
 def GetCommand(): list<string>
-  var cmd = 'gdb'
+  var cmd: any
   if exists('g:termdebug_config')
     cmd = get(g:termdebug_config, 'command', 'gdb')
   elseif exists('g:termdebugger')
     cmd = g:termdebugger
+  else
+    cmd = 'gdb'
   endif

   return type(cmd) == v:t_list ? copy(cmd) : [cmd]

@ubaldot please :)

from vim.

errael avatar errael commented on July 4, 2024 1

Only loosely related. I wonder if it's work copying all plain config globals, like

if exists('g:termdebugger')
    g:termdebug_config.command = g:termdebugger
endif

during startup, and then only use g:termdebug_config in the mainline code.

from vim.

accellarando avatar accellarando commented on July 4, 2024

Just wrote a quick fix for myself, I have not tested what happens if g:termdebug_config is set though.

# Get the command to execute the debugger as a list, defaults to ["gdb"].
def GetCommand(): list<string>
  var cmd = ['gdb']
  if exists('g:termdebug_config')
    cmd = get(g:termdebug_config, 'command', ['gdb'])
  elseif exists('g:termdebugger')
    cmd = g:termdebugger
  endif

  return type(cmd) == v:t_list ? copy(cmd) : [cmd]
enddef

from vim.

ubaldot avatar ubaldot commented on July 4, 2024

Hm, I think this patch should do it, no?

diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index d00cdded2..8f2e331ef 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -248,11 +248,13 @@ enddef

 # Get the command to execute the debugger as a list, defaults to ["gdb"].
 def GetCommand(): list<string>
-  var cmd = 'gdb'
+  var cmd: any
   if exists('g:termdebug_config')
     cmd = get(g:termdebug_config, 'command', 'gdb')
   elseif exists('g:termdebugger')
     cmd = g:termdebugger
+  else
+    cmd = 'gdb'
   endif

   return type(cmd) == v:t_list ? copy(cmd) : [cmd]

@ubaldot please :)

Thanks, I am going to add it in #15057 (review)

from vim.

ubaldot avatar ubaldot commented on July 4, 2024

Only loosely related. I wonder if it's work copying all plain config globals, like

if exists('g:termdebugger')
    g:termdebug_config.command = g:termdebugger
endif

during startup, and then only use g:termdebug_config in the mainline code.

This is indeed very elegant, I personally like it. :)

TBH 100% honest, I would add a deprecation warning saying that configuring variables of the form g:termdebugger will be ditched at some point in the future, inviting the user to read the :h termdebug to get guidance on how to update their configurations. That would clean up the code. But I don't know if this is inline with Vim vision. :)

from vim.

errael avatar errael commented on July 4, 2024

TBH 100% honest, I would add a deprecation warning saying that configuring variables of the form g:termdebugger will be ditched at some point in the future, inviting the user to read the :h termdebug to get guidance on how to update their configurations. That would clean up the code. But I don't know if this is inline with Vim vision. :)

I'm in enough trouble without commenting on this. ;)

from vim.

chrisbra avatar chrisbra commented on July 4, 2024

But I don't know if this is inline with Vim vision. :)

We don't usually do this. But we can try it out in a plugin and see how people react 🙈. It's not something I'd recommend for core Vim, but for a plugin it should be fine. We should still support the deprecated version for half a year at least.

from vim.

ubaldot avatar ubaldot commented on July 4, 2024

But I don't know if this is inline with Vim vision. :)

We don't usually do this. But we can try it out in a plugin and see how people react 🙈. It's not something I'd recommend for core Vim, but for a plugin it should be fine. We should still support the deprecated version for half a year at least.

I was actually thinking exactly the same thing: for the core I am pretty sure it is a no-no, but perhaps for a plugin it may be allowed. I was also thinking exactly the same: 6-12 months as time window for keeping the deprecation warning before deprecating some feature/setting/whatever.

We may try with termdebug for like six months and see how many people will complain. We won't remove anything, just display a warning message. The sanity-check function looks like a good place to add such a warning. I may work on it during next week.

Loosely related: it would be great if we manage to separate the "frontend" and the "backend" of termdebug but it may be hard and time consuming. At the moment as "backend" we only have gdb, but it would be nice to be able to use also other debuggers (lldb, debugpy, etc.) or implement DAP. Well, food for thoughts...

from vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.