eryajf

vscode 中 go 语言的代码片段突然无法使用了

  •  
  •   eryajf ·
    eryajf · Feb 9, 2023 · 3691 views
    This topic created in 1224 days ago, the information mentioned may be changed or developed.

    不知道是什么原因,今天突然发现我的 vscode 开发 go 时的代码片段无法使用了,折腾了许久,也没有找到原因。

    来此发帖求助。

    比如 for range 的时候,我一般会打 forr ,然后 tab 补全,现在输入一个字母 f 之后,按上下键是可以看到这个 forr 在可选列表中的,如图:

    image_20230209_120636

    而当我继续输入字母,却找不到任何匹配的补全了,如图:

    image_20230209_120733

    有没有朋友知道是什么原因的。

    Supplement 1  ·  Feb 10, 2023
    应该是 vscode 的问题,目前已经可以选择更新到最新的 1.75.1 ,实测更新到最新版本之后,该问题消失。

    参考: https://github.com/golang/vscode-go/issues/2650#issuecomment-1424810701
    13 replies    2023-02-22 14:03:29 +08:00
    xyzxiaoking
        1
    xyzxiaoking  
       Feb 9, 2023
    打开 output 看一下输出,看看是不是 gopls 挂掉了
    eryajf
        2
    eryajf  
    OP
       Feb 9, 2023
    看起来应该是 Go 扩展的问题,有人提了 issue 了,关注中: https://github.com/golang/vscode-go/issues/2650
    777777
        3
    777777  
       Feb 9, 2023
    +1 ,昨天我还把 vscode 卸载重装了
    daboluo
        4
    daboluo  
       Feb 9, 2023
    TS 也是这样,参考 https://github.com/microsoft/vscode/issues/173244, 在 setting.json 里加上 "emmet.showExpandedAbbreviation": "never", 试试
    kosmgco
        5
    kosmgco  
       Feb 9, 2023   ❤️ 1
    https://github.com/microsoft/vscode/issues/173244#issuecomment-1420986719

    在这里下载 1.75.1 ,但是别设置自动更新,因为会回滚到 1.75.0
    proxytoworld
        6
    proxytoworld  
       Feb 9, 2023
    1.7.5 有问题,我回滚到了 1.74.3 ,我 1.7.5 python 插件也不能运行,
    Lockeysama
        7
    Lockeysama  
       Feb 9, 2023
    他这个自动更新很烦,我 Python3.6 还在用,他每次自动更新,更新完的,不支持 3.6 了,我还每次都要回滚……各位大佬有什么解决办法吗?
    darkengine
        8
    darkengine  
       Feb 9, 2023
    JS/TS 也一样,clg -> console.log 都无效了
    tabris233
        9
    tabris233  
       Feb 12, 2023
    我隐约记得以前用 vscode 写 Go 的时候还有一个。

    比如 slice 、map 、string 类型的变量,在变量后加 `.!range` 或是 `.range!`(具体哪个忘了)就能生成 `for range`

    类似的还有 slice 类型变量,在变量后加 `.!append` 或是 `.append!` 就能生成 `var = append(var, xxx)`

    在之前的电脑坏掉了后,新电脑怎么都找不到这个对应的配置了。
    tabris233
        10
    tabris233  
       Feb 14, 2023
    @tabris233 找到了,这是 gopls 的特性,只要修改这项配置`"[go]":{ "editor.snippetSuggestions": "none" }`就可以了。 ( none -> bottom/inline/top)
    voidmnwzp
        12
    voidmnwzp  
       Feb 22, 2023
    换 goland
    eryajf
        13
    eryajf  
    OP
       Feb 22, 2023
    @voidmnwzp 哈哈,还是用习惯 vscode ,现在新版本中这个问题已经修复了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5421 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 99ms · UTC 02:55 · PVG 10:55 · LAX 19:55 · JFK 22:55
    ♥ Do have faith in what you're doing.