V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Yukee798

VSCode 如何快捷打印变量

  •  
  •   Yukee798 · Jun 20, 2022 · 2003 views
    This topic created in 1412 days ago, the information mentioned may be changed or developed.

    开发调试的时候很多时候需要去打印变量值是什么,有没有什么插件或者快捷键,可以快捷打印选中的变量。

    比如有下面这个函数,我同时选中了 a1 、a2 、a3 、n 这四个变量。

    function test(a1, a2, a3) {
      let n = a1 + a2 + a3;
    }
    

    可不可以通过某种快捷方式,自动生成如下代码:

    function test(a1, a2, a3) {
      let n = a1 + a2 + a3;
      
      console.log('a1:', a1);
      console.log('a2:', a2);
      console.log('a3:', a3);
      console.log('n:', n);
    }
    
    3 replies    2024-03-22 11:18:13 +08:00
    waiaan
        1
    waiaan  
       Jun 20, 2022   ❤️ 1
    扩展 turbo console log 勉强满足
    Yukee798
        2
    Yukee798  
    OP
       Jun 20, 2022
    @waiaan #1 非常感谢!已经能完全满足我的需求了。
    vcj2exwi8c
        3
    vcj2exwi8c  
       Mar 22, 2024
    扩展 variable-print, 支持多语言
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2128 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 00:33 · PVG 08:33 · LAX 17:33 · JFK 20:33
    ♥ Do have faith in what you're doing.