Skip to content

Conversation

@deepfuriya
Copy link
Contributor

Description

Fixes indentation detection for templates that start empty. Previously, when a user opened a new empty
file and started typing with their preferred indentation (e.g., 2 spaces), the language server would use
the fallback tab size instead of detecting the user's actual indentation style.

Changes

  • Added lazy indentation detection that re-evaluates when getTabSize() is called, allowing detection
    after content is added to an initially empty document
  • Track whether indentation has been successfully detected to avoid redundant re-detection
  • Pass detectIndentation setting through to getTabSize() to respect user preferences

Testing

  • Added unit tests for Document indentation detection (lazy detection, fallback behavior, detection
    caching)
  • Added unit tests for DocumentManager.getEditorSettingsForDocument() to validate VS Code settings
    integration
  • Added E2E tests verifying snippet indentation matches user-typed indentation in completions

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@deepfuriya deepfuriya requested a review from a team as a code owner December 26, 2025 18:21
@deepfuriya deepfuriya merged commit d8d26fe into main Jan 6, 2026
16 checks passed
@deepfuriya deepfuriya deleted the fix/indentation branch January 6, 2026 15:57
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.

4 participants