V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
samleong019
V2EX  ›  Visual Studio Code

vscode 怎么实现类似 webstorm 上 console.log 的 autocomplete 呢

  •  
  •   samleong019 · 2018-10-10 15:55:17 +08:00 · 4233 次点击
    这是一个创建于 1996 天前的主题,其中的信息可能已经有所发展或是发生改变。

    在 webstorm 上,输入 a.log 按 tab 后会扩展为 console.log(a) 输出多个变量的时候,可以 a, b, c.log 也会转为 console.log(a, b, c) 这个功能习惯后是非常顺手的,在 vscode 上,用 snippets 怎么实现这个功能呢

    6 条回复    2021-12-15 21:00:08 +08:00
    cyberpoint
        1
    cyberpoint  
       2018-10-10 17:21:39 +08:00
    兄弟,你可能要改变一下调试习惯,尽量减少使用 console 调试。
    TabGre
        2
    TabGre  
       2018-10-11 07:14:05 +08:00 via iPhone
    @cyberpoint 那应该怎么调试呀?真心请教,输入 debugger 吗?
    ZxBing0066
        3
    ZxBing0066  
       2018-10-11 22:02:20 +08:00
    ...直接 log snippet console.log($1) 就行了吧
    Ethan92
        4
    Ethan92  
       2019-01-15 17:24:52 +08:00
    我也遇到这个问题,解决办法是用会 webstorm🤨
    Ethan92
        5
    Ethan92  
       2019-01-15 17:27:00 +08:00
    vscode 自己设置 snippet 最多只能输入.log 按 tab 出来 console.log(),没法把.log 前的内容自动放到括号里
    jaluik
        6
    jaluik  
       2021-12-15 21:00:08 +08:00
    我也遇到了这个问题,然后写了一个很轻量的 vscode 插件:Dot Log

    可以实现和 webstorm 一样的效果
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3482 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:00 · PVG 19:00 · LAX 04:00 · JFK 07:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.