Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Can hide the status bar#230

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jdneo merged 3 commits intomasterfromcs/statusbar
Mar 22, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionsREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -137,6 +137,7 @@
| `leetcode.useWsl` | Specify whether to use WSL or not | `false` |
| `leetcode.endpoint` | Specify the active endpoint. Supported endpoints are: `leetcode`, `leetcode-cn` | `leetcode` |
| `leetcode.outputFolder`| Specify the relative path to save the problem files. Besides using customized path, there are also several reserved words which can be used here: <ul><li>`${tag}`: Categorize the problem according to their tags.<li>`${language}`: Categorize the problem according to their language.</li><li>`${difficulty}`: Categorize the problem according to their difficulty.</li></ul> | N/A |
| `leetcode.enableStatusBar` | Specify whether the LeetCode status bar will be shown or not. | `true` |

## Troubleshooting
When you meet any problem, you can check the [Troubleshooting Page](https://github.com/jdneo/vscode-leetcode/wiki/Troubleshooting) first.
Expand Down
1 change: 1 addition & 0 deletionsdocs/README_zh-CN.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -137,6 +137,7 @@
| `leetcode.useWsl` | 指定是否启用 WSL | `false` |
| `leetcode.endpoint` | 指定使用的终端,可用终端有:`leetcode`, `leetcode-cn` | `leetcode` |
| `leetcode.outputFolder` | 指定保存文件时所用的相对文件夹路径。除了用户自定义路径外,也可以使用保留项,包括:<ul><li>`${tag}`: 根据题目的类别进行分类。<li>`${language}`: 根据题目的语言进行分类。</li><li>`${difficulty}`: 根据题目的难度进行分类。</li></ul> | N/A |
| `leetcode.enableStatusBar` | 指定是否在 VS Code 下方显示插件状态栏。 | `true` |

## 疑难解答
在遇到任何问题时,可以先查看一下[疑难解答](https://github.com/jdneo/vscode-leetcode/wiki/%E7%96%91%E9%9A%BE%E8%A7%A3%E7%AD%94)文档寻求帮助。
Expand Down
6 changes: 6 additions & 0 deletionspackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -287,6 +287,12 @@
"type": "string",
"scope": "application",
"description": "Specify the relative path to save the problem files."
},
"leetcode.enableStatusBar": {
"type": "boolean",
"default": true,
"scope": "application",
"description": "Specify whether the LeetCode status bar will be shown or not."
}
}
}
Expand Down
6 changes: 3 additions & 3 deletionssrc/extension.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,7 @@ import { LeetCodeTreeDataProvider } from "./explorer/LeetCodeTreeDataProvider";
import { leetCodeChannel } from "./leetCodeChannel";
import { leetCodeExecutor } from "./leetCodeExecutor";
import { leetCodeManager } from "./leetCodeManager";
import {leetCodeStatusBarItem } from "./leetCodeStatusBarItem";
import {leetCodeStatusBarController } from "./statusbar/leetCodeStatusBarController";
import { leetCodePreviewProvider } from "./webview/leetCodePreviewProvider";
import { leetCodeResultProvider } from "./webview/leetCodeResultProvider";
import { leetCodeSolutionProvider } from "./webview/leetCodeSolutionProvider";
Expand All@@ -26,7 +26,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
}

leetCodeManager.on("statusChanged", () => {
leetCodeStatusBarItem.updateStatusBar(leetCodeManager.getStatus(), leetCodeManager.getUser());
leetCodeStatusBarController.updateStatusBar(leetCodeManager.getStatus(), leetCodeManager.getUser());
leetCodeTreeDataProvider.refresh();
});

Expand All@@ -36,7 +36,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
leetCodeSolutionProvider.initialize(context);

context.subscriptions.push(
leetCodeStatusBarItem,
leetCodeStatusBarController,
leetCodeChannel,
leetCodePreviewProvider,
leetCodeResultProvider,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,9 +2,9 @@
// Licensed under the MIT license.

import * as vscode from "vscode";
import { UserStatus } from "./shared";
import { UserStatus } from "../shared";

class LeetCodeStatusBarItem implements vscode.Disposable {
exportclass LeetCodeStatusBarItem implements vscode.Disposable {
private readonly statusBarItem: vscode.StatusBarItem;

constructor() {
Expand All@@ -25,9 +25,15 @@ class LeetCodeStatusBarItem implements vscode.Disposable {
}
}

public show(): void {
this.statusBarItem.show();
}

public hide(): void {
this.statusBarItem.hide();
}

public dispose(): void {
this.statusBarItem.dispose();
}
}

export const leetCodeStatusBarItem: LeetCodeStatusBarItem = new LeetCodeStatusBarItem();
48 changes: 48 additions & 0 deletionssrc/statusbar/leetCodeStatusBarController.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
// Copyright (c) jdneo. All rights reserved.
// Licensed under the MIT license.

import { ConfigurationChangeEvent, Disposable, workspace, WorkspaceConfiguration } from "vscode";
import { UserStatus } from "../shared";
import { LeetCodeStatusBarItem } from "./LeetCodeStatusBarItem";

class LeetCodeStatusBarController implements Disposable {
private statusBar: LeetCodeStatusBarItem;
private configurationChangeListener: Disposable;

constructor() {
this.statusBar = new LeetCodeStatusBarItem();
this.setStatusBarVisibility();

this.configurationChangeListener = workspace.onDidChangeConfiguration((event: ConfigurationChangeEvent) => {
if (event.affectsConfiguration("leetcode.enableStatusBar")) {
this.setStatusBarVisibility();
}
}, this);
}

public updateStatusBar(status: UserStatus, user?: string): void {
if (this.statusBar) {
this.statusBar.updateStatusBar(status, user);
}
}

public dispose(): void {
this.statusBar.dispose();
this.configurationChangeListener.dispose();
}

private setStatusBarVisibility(): void {
if (this.isStatusBarEnabled()) {
this.statusBar.show();
} else {
this.statusBar.hide();
}
}

private isStatusBarEnabled(): boolean {
const configuration: WorkspaceConfiguration = workspace.getConfiguration();
return configuration.get<boolean>("leetcode.enableStatusBar", false);
}
}

export const leetCodeStatusBarController: LeetCodeStatusBarController = new LeetCodeStatusBarController();

[8]ページ先頭

©2009-2025 Movatter.jp