Skip to content

Conversation

@sgavriil01
Copy link
Contributor

Summary

This PR adds LSP diagnostics for config file (pyrefly.toml/pyproject.toml) parsing errors. When a config file has invalid syntax, diagnostics now appear in VS Code's Problems panel and clear automatically when the file is fixed.

Changes:

  • Modified ConfigError to include file path information
  • Fixed bug in workspace.rs where config errors were being discarded
  • Added publish_config_diagnostics() to emit LSP diagnostics for config files
  • Added caching to ensure diagnostics persist across publish cycles

Fixes #2078

Test Plan

  • Added integration test test_config_file_diagnostics() that creates invalid TOML and verifies proper handling
  • Manually tested by creating syntax errors in pyrefly.toml - diagnostics appear in Problems panel with correct line/column positions
  • Verified diagnostics clear when config is fixed
  • Ran ./test.py --no-test --no-conformance - formatting and linting pass

@meta-cla meta-cla bot added the cla signed label Feb 2, 2026
Emit diagnostics for config file parse errors (facebook#2078)

Config errors (pyrefly.toml/pyproject.toml) now appear as LSP diagnostics
in the Problems panel and clear when fixed.
@sgavriil01 sgavriil01 force-pushed the emit-config-diagnostics branch from c487ef4 to 5393991 Compare February 2, 2026 14:55
@github-actions
Copy link

github-actions bot commented Feb 2, 2026

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make some sort of UI signal in VS Code if we fail to parse pyproject.toml

1 participant