gauge-sh / tach

A Python tool to enforce dependencies, using modular architecture 🌎 Open source 🐍 Installable via pip πŸ”§ Able to be adopted incrementally - ⚑ Implemented with no runtime impact ♾️ Interoperable with your existing systems πŸ¦€ Written in rust
https://gauge.sh
MIT License
1.15k stars 36 forks source link

vscode extension doesn't show any diagnostics #424

Open DetachHead opened 3 days ago

DetachHead commented 3 days ago

the vscode extension does not show any diagnostics, even though the CLI does

project files

# ./tach.toml

exclude = [
  ".*__pycache__",
  ".*egg-info",
  "docs",
  "tests",
]
source_roots = [
  ".",
]

[[modules]]
path = "sandpit.foo"
depends_on = []
[[modules]]
path = "sandpit.bar"
depends_on = []
// ./.vscode/settings.json
{
    "tach.importStrategy": "fromEnvironment"
}
# ./sandpit/foo.py

from sandpit.bar import a
# ./sandpit/bar.py

a = 1

cli output

> tach check
❌ sandpit\foo.py[L1]: Cannot import 'sandpit.bar.a'. Module 'sandpit.foo' cannot depend on 'sandpit.bar'. 

vscode output

problems tab

image

"Tach" log from the output tab

2024-11-19 10:17:59.432 [info] [Trace - 10:17:59 AM] Sending notification 'textDocument/didChange'.
2024-11-19 10:17:59.686 [info] [Trace - 10:17:59 AM] Sending notification 'textDocument/didChange'.
2024-11-19 10:17:59.784 [info] [Trace - 10:17:59 AM] Sending notification 'textDocument/didSave'.
2024-11-19 10:17:59.790 [info] [Trace - 10:17:59 AM] Received notification 'window/logMessage'.
2024-11-19 10:17:59.790 [info] CWD Linter (no rpc/doc): c:\Users\user\project
2024-11-19 10:18:02.915 [info] [Trace - 10:18:02 AM] Received notification 'window/logMessage'.
2024-11-19 10:18:02.915 [info] file:///c%3A/Users/user/project/sandpit/foo.py :
<tach.extension.CheckDiagnostics object at 0x000001B91A6CC2D0>
2024-11-19 10:18:02.915 [info] [Trace - 10:18:02 AM] Received notification 'textDocument/publishDiagnostics'.

environment info

tach 0.14.3 python 3.13 windows 11

caelean commented 1 day ago

image

This case is working for me, although I'm not on a windows machine. I'll try and get on one and re-test.

One follow up question @DetachHead - is tach.toml in the root of your VSCode's workspace? I have an outstanding TODO to allow configuration of the location of tach.toml as right now there's an assumption in place related to the workspace configuration.

CC @KotlinIsland @scott-au, if you're also experiencing this, curious as to your OS / workspace path vs. tach.toml path.

DetachHead commented 1 day ago

One follow up question @DetachHead - is tach.toml in the root of your VSCode's workspace?

yeah it is