mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Make more things private
This commit is contained in:
parent
8aaafddee8
commit
d68616a140
5 changed files with 31 additions and 23 deletions
|
@ -14,6 +14,10 @@ export interface RustAnalyzerExtensionApi {
|
|||
readonly client?: lc.LanguageClient;
|
||||
}
|
||||
|
||||
export async function deactivate() {
|
||||
await setContextValue(RUST_PROJECT_CONTEXT_NAME, undefined);
|
||||
}
|
||||
|
||||
export async function activate(
|
||||
context: vscode.ExtensionContext
|
||||
): Promise<RustAnalyzerExtensionApi> {
|
||||
|
@ -56,12 +60,14 @@ export async function activate(
|
|||
const ctx = new Ctx(context, workspace);
|
||||
// VS Code doesn't show a notification when an extension fails to activate
|
||||
// so we do it ourselves.
|
||||
return await activateServer(ctx).catch((err) => {
|
||||
const api = await activateServer(ctx).catch((err) => {
|
||||
void vscode.window.showErrorMessage(
|
||||
`Cannot activate rust-analyzer extension: ${err.message}`
|
||||
);
|
||||
throw err;
|
||||
});
|
||||
await setContextValue(RUST_PROJECT_CONTEXT_NAME, true);
|
||||
return api;
|
||||
}
|
||||
|
||||
async function activateServer(ctx: Ctx): Promise<RustAnalyzerExtensionApi> {
|
||||
|
@ -112,8 +118,6 @@ async function initCommonContext(ctx: Ctx) {
|
|||
);
|
||||
ctx.pushExtCleanup(defaultOnEnter);
|
||||
|
||||
await setContextValue(RUST_PROJECT_CONTEXT_NAME, true);
|
||||
|
||||
// Commands which invokes manually via command palette, shortcut, etc.
|
||||
ctx.registerCommand("reload", (_) => async () => {
|
||||
void vscode.window.showInformationMessage("Reloading rust-analyzer...");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue