Skip to content

Conversation

@deepfuriya
Copy link
Contributor

Issue #, if available:

  • We have a caching mechanism in place for Documents inside DocumentManager which cache the document object during creation and points to the TextDocument reference
  • But the other values like languageId, version and 'lineCount' were only initialized in the constructor and never updated which caused a stale value issue

Description of changes:

  • Updated the Document constructor to pass in the TextDocument as a function and get all the above mentioned values through get reference instead of initializing it in constructor.

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 November 20, 2025 15:53
@deepfuriya deepfuriya force-pushed the document-manager-fix branch 3 times, most recently from 3655caf to a63b0ba Compare November 21, 2025 16:01
@Zee2413 Zee2413 force-pushed the document-manager-fix branch from a63b0ba to 56095b7 Compare November 22, 2025 03:19
@satyakigh
Copy link
Collaborator

Hold off on merging this until release bugs are fixed

@deepfuriya deepfuriya force-pushed the document-manager-fix branch 2 times, most recently from 03e47b0 to 9f49305 Compare November 25, 2025 16:10
@satyakigh satyakigh force-pushed the document-manager-fix branch from 9f49305 to b5069bb Compare November 25, 2025 18:02
@deepfuriya deepfuriya force-pushed the document-manager-fix branch 3 times, most recently from ea1654e to edf7021 Compare November 26, 2025 16:20
@deepfuriya deepfuriya force-pushed the document-manager-fix branch from edf7021 to 12faa49 Compare December 1, 2025 03:36
Zee2413
Zee2413 previously approved these changes Dec 1, 2025
@deepfuriya deepfuriya force-pushed the document-manager-fix branch from 12faa49 to 29a517a Compare December 1, 2025 15:56
@deepfuriya deepfuriya force-pushed the document-manager-fix branch 2 times, most recently from be0c017 to b819f6a Compare December 1, 2025 20:29
Zee2413
Zee2413 previously approved these changes Dec 1, 2025
@deepfuriya deepfuriya force-pushed the document-manager-fix branch from b819f6a to ee4b2e6 Compare December 3, 2025 15:54
@deepfuriya deepfuriya force-pushed the document-manager-fix branch 2 times, most recently from c4d5444 to fd3e4a2 Compare December 4, 2025 18:56
@Zee2413 Zee2413 force-pushed the document-manager-fix branch from fd3e4a2 to 31e34a6 Compare December 4, 2025 21:20
@deepfuriya deepfuriya force-pushed the document-manager-fix branch from 31e34a6 to 5e45c96 Compare December 5, 2025 21:01
@deepfuriya deepfuriya force-pushed the document-manager-fix branch 2 times, most recently from 6c85d51 to 7620b6f Compare December 8, 2025 02:46
@satyakigh satyakigh force-pushed the document-manager-fix branch from 7620b6f to 47ac74c Compare December 8, 2025 16:58
@deepfuriya deepfuriya force-pushed the document-manager-fix branch 3 times, most recently from 5a6cbd1 to bb9f841 Compare December 9, 2025 19:27
@deepfuriya deepfuriya force-pushed the document-manager-fix branch from bb9f841 to 08dc41f Compare December 9, 2025 21:30
@deepfuriya deepfuriya marked this pull request as draft December 10, 2025 20:06
@deepfuriya deepfuriya marked this pull request as ready for review December 10, 2025 20:07
@deepfuriya deepfuriya closed this Dec 10, 2025
@deepfuriya deepfuriya reopened this Dec 10, 2025
s3Service,
document.documentType,
document.uri,
document.contents() ?? '',
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably throw at line 100

}

const content = document.contents();
if (!content) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This sill be true if contents is both undefined or empty which breaks line 33

document.documentType,
document.uri,
document.contents(),
document.contents() ?? '',
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be checked at like 92

// Replace entire file with properly formatted JSON
snippetText = docFormattedText;
const endPosition = { line: document.lineCount, character: 0 };
const endPosition = { line: document.lineCount ?? 0, character: 0 };
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we exit early if theres no document?

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.

3 participants