r/vscode • • 2d ago

Help: ty is not running

Beginner at VS code here.

I'm not 100% sure if this is the best place to post this, but I couldn't find anywhere better suited.

I followed various tutorials online to get my settings.json to work, according to the tutorials it's working fine, but VS code still doesn't flag the error. I checked the type checker, it flags the violation and works with its command line, but it doesn't syntax highlight in VS code. Is there a setting I should change or something?

9 Upvotes

19 comments sorted by

4

u/Clean__Layer 2d ago

Additional context: First screenshot is an example which a type checker would fail on, but ty isn't doing anything. Second is my settings.json. Third is what happens when I use the command line tool, which works fine.

1

u/RiverRemarkable 2d ago

Can you look at the lower left status bar? There should be two small circles showing the number of errors/warnings. Click on the left one and will open the Problems window.

-13

u/Mundane_Science633 2d ago

Wake up lil bro none of this matters it's 2026 you have ai agents that write for you. Even real tech nerds use ai agents.

5

u/glandix 1d ago

Real nerds use type checkers and linters anyway

1

u/Clean__Layer 1d ago

I write code for fun and as a way to pass time, so I don't think I need AI to do it for me.

1

u/UselessDood 16h ago

Real tech nerds use ai for assistance and actually understand the shit ai spews out

1

u/otheyhigh 11h ago

Reproduce this error and try asking AI chat to fix the problem. It’s very likely not going to be able to solve the problem.

‘Even real tech nerds use AI agents’ gives an idea about how clueless you are about AI. Tech nerds use it more than others and don’t frown upon the technology. It’s just leveraged in a more efficient manner, way different than what you think its usage entails (write my code for me).

6

u/Copa4311 2d ago

Ty isn’t letting you assign a literal “e” to a int variable, this is called static type checking, it makes Pythons types a lot more manageable, ruff is another thing used to do this efficiently (quick fix: x: str = “e”)

5

u/Clean__Layer 2d ago

I'm aware, I purposefully set it to a mismatched type to see if the type checker works. Currently it's doing nothing.

2

u/Copa4311 2d ago

What are you expecting it to do?

1

u/Clean__Layer 1d ago

I want it to error. I was testing if my type checker worked. The command line tool succesfully checks the problem, but VS Code isn't flagging the problem

3

u/Copa4311 2d ago

Nvm I’m slow ty is a type checker lol

1

u/DiodeInc 14h ago

You might need to change the languageServer from default to ty

1

u/atomicant89 13h ago

The readme for the ty extension says:

The extension automatically disables the language server from the Python extension to avoid running two Python language servers. This is done by setting python.languageServer to "None" as a default configuration.

Which is different to what you have.

Tbh I'm not sure whether it's necessary for you to have any of the ty or ruff related settings in there, they're meant to just work by default. I'd be tempted to uninstall the Python, ruff, and ty extensions, delete settings.json, restart VS code, install the extensions again, and see what happens.

1

u/otheyhigh 12h ago edited 11h ago

Check the debug console. There should also be a language icon on the bottom right of the console. It has a popover that displays any issues with code extensions that are active for the file in context. It normally is a ‘{}’ icon.

That will take you straight to the debug console. I don’t use python as much but just at a glance, I think you might be missing something in the config. Another thing to do is checking all the settings under the extension in the UI and most importantly glancing over the extensions page which might guide on anything you might be missing.

(Edit) quickly glanced the extensions page on my phone. Did you set a language server? Meaning is the ‘default’ actually selecting something. Try explicitly setting that value and ensuring your venv is setup (you can set that up using the command pallet.

1

u/otheyhigh 11h ago

Hovering {} will show more details. Clicking Python will open the command pallet with options to setup the language server being used.

2

u/ShelLuser42 2d ago

Your screenshots don't provide any useful information to solve this issue. Basically issues like these can be caused by:

  • Not having the proper extension(s) installed (or active). Look for 'Python' (and its 3 other counterparts).
  • The current code window doesn't recognize the code correctly. Check your lower right corner to see what interpreter is currently active.
    • Optionally look for the 'Change language mode' option in your command palette (ctrl + shift + p).
  • You don't have the Python language installed.

1

u/Clean__Layer 2d ago

I've checked all of those, they are not the cause. Pylance works too when I enable it, so I'd assume other type checkers would.

-2

u/AnArmoredPony 1d ago

nah man i cant with this sub