Skip to content

fix: honor lintr settings for pathless documents - #782

Merged
renkun-ken merged 1 commit into
REditorSupport:masterfrom
renkun-ken:codex/virtual-document-lintr-settings
Oct 3, 2026
Merged

renkun-ken merged 1 commit into
REditorSupport:masterfrom
renkun-ken:codex/virtual-document-lintr-settings

Conversation

@renkun-ken

Copy link
Copy Markdown
Member

Pathless documents currently force linters_with_defaults(), so configured rules are ignored: an Interactive cell or untitled buffer reports line_length_linter and commented_code_linter even when the user's .lintr excludes them.

Load lintr settings from the working directory before linting inline R text, reusing the existing helper for literate documents. This preserves project, home, custom-config and option resolution with lintr 3.0 as well as current versions. Restore lintr settings after success or errors, retain real source filenames for literate exclusions, and disable the disk cache for pathless documents.

The R >= 3.4.0 and lintr >= 3.0.0 requirements remain unchanged. This fixes settings in languageserver rather than patching its namespace from vscode-R. Related: REditorSupport/vscode-R#1805.

Validation:

  • Configuration regression tests: 62 assertions pass with lintr 3.4.0 and 3.0.2.
  • Related diagnostics/linting tests: 43 assertions pass.
  • Changed R files pass lintr.
  • Verified the real home .lintr and an end-to-end VS Code comparison of source documents, cells and inputs, including configuration edits. The comparison fails with released languageserver and passes with this patch plus the input session-context correction in vscode-R.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation is focused, compatible with supported lintr versions, and comprehensively tested.

Review effort: Balanced
Findings: None

What changed in this PR

Updates pathless document diagnostics to honor project and user lintr configuration while preserving existing literate-document behavior.

Changes:

  • Generalizes inline-text linting with safe lintr settings restoration.
  • Disables disk caching for pathless documents.
  • Adds regression coverage for configuration reloads, options, errors, and filename-sensitive linters.
File Description
R/​diagnostics.R Loads working-directory settings for pathless documents.
tests/​testthat/​test-diagnostics-configuration.R Tests pathless configuration behavior and restoration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@renkun-ken
renkun-ken merged commit 4efab20 into REditorSupport:master Oct 3, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants