Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"Just work" is certainly subjective, but the introspection in all the JetBrains products are what make them ferocious. If one has never heard of all the 18 quadrillion lint tools before, you can immediately get value from opening a file in PyCharm and having it point out the ways it is going to fail on you, including one of my favorite tricks that no VSCode+lint horseshit has ever thought about trying:

  import re
  import sys
  if re.match(r"[A-Za-z}", sys.stdin):
      print("ok")
PyCharm will spot that error immediately, no insaneo configuration required

PyCharm Professional also gets into the SQL side of things:

    with connect(":memory:") as conn:
        c = conn.cursor()
        c.execute("SELECT * FROM oops WHERE NAME IN ('alpha, 'beta')")
instantly spotted, no configuration required

I was going to be cute and use json.loads as an example, but it seems somewhere along the way they botched the fact that the first argument to json.loads is a fucking JSON string. But, it does allow showcasing that you can have PyCharm syntax check the "inner" language of any string literal you'd like via their language injection annotations:

  import json

  # language=json
  bogus = """{"this is subtly wrong"; true}"""

  json.loads(bogus)

  # and the same with tomllib:

  import tomllib
  # language=toml
  bogus = """
  [alpha]
  beta = []onoz
  """
  tomllib.loads(bogus)

  # or, if you have some tricky internal stuff

  def do_the_thing(
    # language=sql
    s: str
  ):
      with connect(something) as conn:
          c = conn.cursor()
          c.execute(s)

  do_the_thing("SELECT * FROM oops WHERE NAME IN ('alpha, 'beta')")
  #            ^^^ also gets syntax checked because it knows the first arg is SQL


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: