Ruff produces Python linting diagnostics on untitled (unsaved) tabs whose language is set to Markdown. Any text content triggers errors since Ruff parses the entire document as Python source code. This appears to be a regression introduced by #950, which added onLanguage:markdown to the activation events.
Steps to reproduce
- Open a new untitled tab (
Cmd+N)
- Set the language mode to Markdown (via the language selector in the status bar)
- Type any plain text, e.g.
hello
- Observe Python diagnostics reported on line 1 (e.g.
F821 Undefined name 'hello', syntax errors, etc.)
Expected behavior
No diagnostics. The file is a Markdown document, not a Python file. Ruff correctly handles saved .md files (only linting inside ```python fences) and the same should apply to unsaved Markdown tabs.
Actual behavior
Ruff parses the entire document as Python source and reports errors on arbitrary prose content.
Root cause hypothesis
For untitled: URIs there is no file extension to infer the language from. Ruff's native server appears to fall back to treating the document as Python rather than reading the languageId (markdown) from the LSP textDocument/didOpen notification. Saved .md files work correctly because the .md extension provides a reliable signal.
Environment
- Extension version:
2026.38.0
- Ruff version:
v0.15.7 (bundled)
- VS Code version:
1.115.0
- OS: macOS
Ruff produces Python linting diagnostics on untitled (unsaved) tabs whose language is set to Markdown. Any text content triggers errors since Ruff parses the entire document as Python source code. This appears to be a regression introduced by #950, which added
onLanguage:markdownto the activation events.Steps to reproduce
Cmd+N)helloF821 Undefined name 'hello', syntax errors, etc.)Expected behavior
No diagnostics. The file is a Markdown document, not a Python file. Ruff correctly handles saved
.mdfiles (only linting inside```pythonfences) and the same should apply to unsaved Markdown tabs.Actual behavior
Ruff parses the entire document as Python source and reports errors on arbitrary prose content.
Root cause hypothesis
For
untitled:URIs there is no file extension to infer the language from. Ruff's native server appears to fall back to treating the document as Python rather than reading thelanguageId(markdown) from the LSPtextDocument/didOpennotification. Saved.mdfiles work correctly because the.mdextension provides a reliable signal.Environment
2026.38.0v0.15.7(bundled)1.115.0