flyinghigherair

vscode html 代码 单行注释 块注释

  •  
  •   flyinghigherair · Apr 18, 2023 · 3255 views
    This topic created in 1143 days ago, the information mentioned may be changed or developed.
    https://i2.100024.xyz/2023/04/18/j1fw0k.webp
    之前一直在用 webstorm ,默认 html 部分是每行注释,偶尔需要 vscode 编辑发现都是块注释很不方便,网上搜了一圈没找到是哪里设置的(有搜到行注释和块注释快捷键但还是整段注释的),求问这个设置的办法是?
    7 replies    2023-04-18 16:27:49 +08:00
    Alias4ck
        1
    Alias4ck  
       Apr 18, 2023   ❤️ 1
    先选中用 shift+option(mac) 选中所有行的开头 拉到每一行的行尾 再 command+/ 即可多段单行了
    或者直接 shift+option+i 直接定位到行尾 再 command+/ 也可以

    这个链接的第一个动画就是上述操作了
    https://qawithexperts.com/article/technology/how-to-comment-multiple-lines-in-visual-studio-vs-code/443

    也可以安装外部插件
    https://www.taeluf.com/blog/vs-code/single-line-comments/ (要安装 multi-command extension)
    https://marketplace.visualstudio.com/items?itemName=8rin5x.onelinecomments
    AV1
        2
    AV1  
       Apr 18, 2023   ❤️ 1
    用鼠标中键来选要注释的行,再按注释快捷键,这样每行都是单独的注释了。
    jiayouzl
        3
    jiayouzl  
       Apr 18, 2023
    @Alias4ck 你有点东西
    daolanfler
        4
    daolanfler  
       Apr 18, 2023
    @Alias4ck 用了这么多年 VS Code 才发现还有这种通过鼠标拖动的多光标编辑
    daolanfler
        5
    daolanfler  
       Apr 18, 2023
    如果用 vim 插件可以 ctrl+v 进入块选择,选择多行,然后 ctrl(cmd) + / 也可以单行注释 html
    flyinghigherair
        6
    flyinghigherair  
    OP
       Apr 18, 2023
    感谢 1 楼和 2 楼的回复
    不过 shift+alt+a 貌似只能在 js 区域生效? html 区域两种注释还是都只有头尾
    2 楼的方法可以,不过 css 部分还是头尾注释的
    Alias4ck
        7
    Alias4ck  
       Apr 18, 2023
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1004 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 22:28 · PVG 06:28 · LAX 15:28 · JFK 18:28
    ♥ Do have faith in what you're doing.