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

refactor(lsp): store assets behind a mutex #13414

Merged
merged 2 commits into from
Jan 18, 2022

Conversation

dsherret
Copy link
Member

@dsherret dsherret commented Jan 18, 2022

This PR stores all assests behind a mutex in order to make more language server messages not require mutability.

This is possible to do because the assets are static and it is ok if two threads race to retrieve a non-cached asset from tsc.

This is slowly moving towards #11307.

@dsherret dsherret requested a review from kitsonk January 18, 2022 20:45
@dsherret dsherret changed the title refactor(lsp): store assets behind a lock refactor(lsp): store assets behind a mutex Jan 18, 2022
specifier: &ModuleSpecifier,
// todo(dsherret): this shouldn't be a parameter, but instead retrieved via
// a constructor dependency
get_snapshot: impl Fn() -> LspResult<Arc<StateSnapshot>>,
Copy link
Member Author

Choose a reason for hiding this comment

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

In a future PR, I'm hoping to get rid of this parameter and not have language_server::Inner passed around in other functions.

Copy link
Contributor

@kitsonk kitsonk left a comment

Choose a reason for hiding this comment

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

LGTM

cli/lsp/tsc.rs Outdated Show resolved Hide resolved
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM too

@dsherret dsherret merged commit b3545dd into denoland:main Jan 18, 2022
@dsherret dsherret deleted the refactor_assets_lock branch January 18, 2022 21:28
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