nextone

vs code 的智能提示补全不行呀

  •  
  •   nextone · Sep 27, 2024 · 2667 views
    This topic created in 771 days ago, the information mentioned may be changed or developed.
    def convert_snake(camel):
        convert_chars = ""
        for char in camel:
            if char.isupper():
    convert_snake("littleTest")
    

    当我输入 if char.isup 时,vs code 不能智能提示字符串的方法,这也太不智能了吧

    FishBear
    FishBear
    Sep 27, 2024
    1
    可以试试 cursor 虽然我现在没付费
    AV1
    AV1
    Sep 27, 2024
    2
    定义函数的时候,你把 camel 的类型补上啊,就像这样:
    def convert_snake(camel: str)
    不然它不知道 camel 的类型,也就没法推断 char 类型,也就没法给你补全 char.下面的方法。
    strickczq
    strickczq
    Sep 27, 2024
    3
    type hints 是个好东西
    nextone
    nextone
    OP
    Sep 27, 2024
    4
    @DOLLOR 但是其他的编辑器不加类型提示也可以
    xuld
    xuld
    Sep 27, 2024❤️1
    5
    如果你在别的地方有 convert_snake(1111),你会不会骂它提示出 string 的方法是 bug
    orrinex
    orrinex
    Sep 29, 2024
    6
    试了下,PyCharm 在存在代码 `convert_snake("littleTest")` 的情况下会提示字符串方法,如果存在的是 `convert_snake(1111)` 就不会提示。感觉还挺合理🤔
    nextone
    nextone
    OP
    Sep 30, 2024
    7
    @Wilson233 这些细节上,PyCharm 还是优于 vs code 呀
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1662 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 11:35 · PVG 19:35 · LAX 03:35 · JFK 06:35
    ♥ Do have faith in what you're doing.