Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: Don't read file for InteractiveSemanticdbdb if it doesn't exist #5749

Merged
merged 2 commits into from
Oct 16, 2023

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Oct 13, 2023

Previously, we would assume that any file that we want to calculate InteractiveSemanticdb for exists on the filesystem, which is not true. For example renamed files if renamed from terminal will stick in the editor and cause exceptions to be throw. Now, we also try to read it from buffers and from filesystem as a fallback if it exists on the filesystem.

}
} else
existingDoc
buffers.get(source).orElse {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry to bother you, but out of curiosity, what is the difference between the unsavedContents (which by the way is still used above in the shouldTryCalculateInteractiveSemanticdb, not sure if that's intended now) and buffers.get(source)? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Och, actually unsavedContents is unused and it should be used 😱 We use it for to warm up scalafix at the start 🤔

I changed it as a first option with fallback to buffers then to filesystem.

Previously, we would assume that any file that we want to calculate InteractiveSemanticdb for exists on the filesystem, which is not true. For example renamed files if renamed from terminal will stick in the editor and cause exceptions to be throw. Now, we also try to read it from buffers and from filesystem as a fallback if it exists on the filesystem.
Copy link
Member

@jkciesluk jkciesluk left a comment

Choose a reason for hiding this comment

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

lgtm

@tgodzik tgodzik merged commit 635956d into scalameta:main Oct 16, 2023
21 of 24 checks passed
@tgodzik tgodzik deleted the dont-read branch October 16, 2023 16:02
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