Skip to content

Commit 15c4216

Browse files
authored
Remove the deprecated setting: leetcode.enableShortcuts (#520)
1 parent ac9df4d commit 15c4216

File tree

4 files changed

+3
-27
lines changed

4 files changed

+3
-27
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ Thanks for [@yihong0618](https://github.com/yihong0618) provided a workaround wh
129129
| `leetcode.filePath` | Specify the relative path under the workspace and the file name to save the problem files. More details can be found [here](https://github.com/jdneo/vscode-leetcode/wiki/Customize-the-Relative-Folder-and-the-File-Name-of-the-Problem-File). | |
130130
| **[Deprecated] Use `leetcode.filePath` instead** ~~`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>For example: `problem-${tag}-${difficulty}`~~ | ~~N/A~~ |
131131
| `leetcode.enableStatusBar` | Specify whether the LeetCode status bar will be shown or not. | `true` |
132-
| **[Deprecated] Use `leetcode.editor.shortcuts` instead** ~~`leetcode.enableShortcuts`~~ | ~~Specify whether the submit and test shortcuts in editor or not.~~ | ~~`true`~~ |
133132
| `leetcode.editor.shortcuts` | Specify the customized shorcuts in editors. Supported values are: `submit`, `test`, `solution` and `description`. | `["submit, test"]` |
134133
| `leetcode.enableSideMode` | Specify whether `preview`, `solution` and `submission` tab should be grouped into the second editor column when solving a problem. | `true` |
135134
| `leetcode.nodePath` | Specify the `Node.js` executable path. for example, C:\Program Files\nodejs\node.exe | `node` |

docs/README_zh-CN.md

-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@
130130
| `leetcode.filePath` | 指定生成题目文件的相对文件夹路径名和文件名。点击查看[更多详细用法](https://github.com/jdneo/vscode-leetcode/wiki/%E8%87%AA%E5%AE%9A%E4%B9%89%E9%A2%98%E7%9B%AE%E6%96%87%E4%BB%B6%E7%9A%84%E7%9B%B8%E5%AF%B9%E6%96%87%E4%BB%B6%E5%A4%B9%E8%B7%AF%E5%BE%84%E5%92%8C%E6%96%87%E4%BB%B6%E5%90%8D)| |
131131
| **[Deprecated] 请使用 `leetcode.filePath`** ~~`leetcode.outputFolder`~~ | ~~指定保存文件时所用的相对文件夹路径。除了用户自定义路径外,也可以使用保留项,包括:<ul><li>`${tag}`: 根据题目的类别进行分类。<li>`${language}`: 根据题目的语言进行分类。</li><li>`${difficulty}`: 根据题目的难度进行分类。</li></ul>例如:`problem-${tag}-${difficulty}`~~ | ~~N/A~~ |
132132
| `leetcode.enableStatusBar` | 指定是否在 VS Code 下方显示插件状态栏。 | `true` |
133-
| **[Deprecated] 请使用 `leetcode.editor.shortcuts`** ~~`leetcode.enableShortcuts`~~ | ~~指定是否在 VS Code 编辑文件下方显示提交和测试的快捷按钮。~~ | ~~`true`~~ |
134133
| `leetcode.editor.shortcuts` | 指定在编辑器内所自定义的快捷方式。可用的快捷方式有: `submit`, `test`, `solution`, `description`| `["submit, test"]` |
135134
| `leetcode.enableSideMode` | 指定在解决一道题时,是否将`问题预览``高票答案``提交结果`窗口集中在编辑器的第二栏。 | `true` |
136135
| `leetcode.nodePath` | 指定 `Node.js` 可执行文件的路径。如:C:\Program Files\nodejs\node.exe | `node` |

package.json

-6
Original file line numberDiff line numberDiff line change
@@ -621,12 +621,6 @@
621621
"scope": "application",
622622
"description": "Show the LeetCode status bar or not."
623623
},
624-
"leetcode.enableShortcuts": {
625-
"type": "boolean",
626-
"default": true,
627-
"scope": "application",
628-
"description": "[Deprecated] Show the submit and test shortcuts in editor or not."
629-
},
630624
"leetcode.editor.shortcuts": {
631625
"type": "array",
632626
"default": [

src/codelens/CodeLensController.ts

+3-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) jdneo. All rights reserved.
22
// Licensed under the MIT license.
33

4-
import { ConfigurationChangeEvent, Disposable, languages, workspace, WorkspaceConfiguration } from "vscode";
4+
import { ConfigurationChangeEvent, Disposable, languages, workspace } from "vscode";
55
import { CustomCodeLensProvider } from "./CustomCodeLensProvider";
66

77
class CodeLensController implements Disposable {
@@ -13,14 +13,12 @@ class CodeLensController implements Disposable {
1313
this.internalProvider = new CustomCodeLensProvider();
1414

1515
this.configurationChangeListener = workspace.onDidChangeConfiguration((event: ConfigurationChangeEvent) => {
16-
if (event.affectsConfiguration("leetcode.enableShortcuts")) {
17-
this.setCodeLensVisibility();
18-
} else if (event.affectsConfiguration("leetcode.editor.shortcuts")) {
16+
if (event.affectsConfiguration("leetcode.editor.shortcuts")) {
1917
this.internalProvider.refresh();
2018
}
2119
}, this);
2220

23-
this.setCodeLensVisibility();
21+
this.registeredProvider = languages.registerCodeLensProvider({ scheme: "file" }, this.internalProvider);
2422
}
2523

2624
public dispose(): void {
@@ -29,20 +27,6 @@ class CodeLensController implements Disposable {
2927
}
3028
this.configurationChangeListener.dispose();
3129
}
32-
33-
private setCodeLensVisibility(): void {
34-
if (this.isShortcutsEnabled() && !this.registeredProvider) {
35-
this.registeredProvider = languages.registerCodeLensProvider({ scheme: "file" }, this.internalProvider);
36-
} else if (!this.isShortcutsEnabled() && this.registeredProvider) {
37-
this.registeredProvider.dispose();
38-
this.registeredProvider = undefined;
39-
}
40-
}
41-
42-
private isShortcutsEnabled(): boolean {
43-
const configuration: WorkspaceConfiguration = workspace.getConfiguration();
44-
return configuration.get<boolean>("leetcode.enableShortcuts", true);
45-
}
4630
}
4731

4832
export const codeLensController: CodeLensController = new CodeLensController();

0 commit comments

Comments
 (0)