wencan

求个 vscode go 自动加 tag 和注释的办法

  •  
  •   wencan · Dec 16, 2022 · 5228 views
    This topic created in 1422 days ago, the information mentioned may be changed or developed.

    比如,写个字段

    // Name 名称。
    Name string `json:"name"`
    

    期望是,写了“Name string”,自动补上 “名称。”之外的部分。

    16 replies  •  2023-01-24 11:40:14 +08:00
    wuzhewuyou
    wuzhewuyou
    Dec 16, 2022 via Android
    1
    写到吐,吐着吐着也就习惯了
    idblife
    idblife
    Dec 16, 2022
    2
    github copilot ?
    jenlors
    jenlors
    Dec 16, 2022
    3
    Goland
    FrankFang128
    FrankFang128
    Dec 16, 2022
    4
    copilot
    wencan
    wencan
    OP
    Dec 16, 2022
    5
    @idblife
    @FrankFang128
    copilot 60 天试用啊
    janxin
    janxin
    Dec 16, 2022
    6
    @wencan 花钱 or 贡献开源项目
    vvhhaaattt
    vvhhaaattt
    Dec 16, 2022 via Android
    7
    https://app.quicktype.io/ 用 json 转 go struct 也是一个方法。
    securityCoding
    securityCoding
    Dec 16, 2022 via Android
    9
    换 goland 或者 copilot
    bandian
    bandian
    Dec 16, 2022 via iPhone
    10
    试试 maxnatchanon.go-struct-tag-autogen ,目前正在用,需要稍微配置一下,效果还可以
    bandian
    bandian
    Dec 16, 2022 via iPhone
    11
    可以实现输入 Name string `j 补全后面的部分
    LukeEuler
    LukeEuler
    Dec 16, 2022
    12
    官方 golang 插件: https://marketplace.visualstudio.com/items?itemName=golang.Go

    命令:Go: Add Tags To Struct Fields

    至于注释,我就不知道了
    Slurp
    Slurp
    Dec 17, 2022 via iPad
    13
    这种应该可以 snippet… IDEA 上类似的有 live template 。不过说到底是 Go 编译时特性不足,隔壁 Rust 只用在 struct 头上写一次就行…
    zzhzero
    zzhzero
    Dec 17, 2022
    14
    我以为这种 goland 的基础功能 vscode 早就有插件实现了
    yaott2020
    yaott2020
    Jan 24, 2023 via Android
    15
    说实话,不喜欢用 vscode 写 go 就是自动不全太烂了
    yaott2020
    yaott2020
    Jan 24, 2023 via Android
    16
    不如用 goland
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   675 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 21:17 · PVG 05:17 · LAX 13:17 · JFK 16:17
    ♥ Do have faith in what you're doing.