Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1d8371a

Browse files
committed
1.0.5 修改了解析文本的获取方式,不需要将描述放在代码注释中了。
1 parent 386fabb commit 1d8371a

File tree

3 files changed

+12
-275
lines changed

3 files changed

+12
-275
lines changed

CHANGELOG.md

Lines changed: 2 additions & 273 deletions
Original file line numberDiff line numberDiff line change
@@ -1,276 +1,5 @@
11
# Change Log
22
All notable changes to the "leetcode" extension will be documented in this file.
33

4-
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
5-
6-
## [0.17.0]
7-
### Added
8-
- Add TypeScript support [#560](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/560)
9-
10-
### Changed
11-
- Update the UI resources [PR#561](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/561)
12-
13-
## [0.16.2]
14-
### Added
15-
- New Category: `Concurrency` [CLI#42](https://github.com/leetcode-tools/leetcode-cli/pull/42)
16-
- New configuration to better configure how to show the description [#310](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/310)
17-
18-
### Removed
19-
- Removed the deprecated setting `leetcode.enableShortcuts` [PR#520](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/520)
20-
- Removed the deprecated setting `leetcode.outputFolder` [PR#521](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/521)
21-
22-
## [0.16.1]
23-
### Added
24-
- Can show the problem in current workspace even if it's not a LeetCode workspace [#373](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/373)
25-
26-
### Fixed
27-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.16.1+is%3Aclosed+label%3Abug)
28-
29-
## [0.16.0]
30-
### Added
31-
- Support GitHub login and LinkedIn login [PR#496](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/496)
32-
33-
## [0.15.8]
34-
### Added
35-
- Add a new command `Sign In by Cookie` to workaround the issue that [users cannot login to LeetCode](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/478). Please check the [workaround steps](https://github.com/LeetCode-OpenSource/vscode-leetcode/tree/master#%EF%B8%8F-attention-%EF%B8%8F--workaround-to-login-to-leetcode-endpoint) for more details!
36-
37-
### Changed
38-
- Update the explorer icons to be align with the VS Code design [#460](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/460)
39-
40-
## [0.15.7]
41-
### Fixed
42-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.7+is%3Aclosed+label%3Abug)
43-
44-
## [0.15.6]
45-
### Added
46-
- Add a link to the solution page [#424](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/424)
47-
48-
### Fixed
49-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.6+is%3Aclosed+label%3Abug)
50-
51-
## [0.15.5]
52-
### Added
53-
- Add a link to the discussion page [#420](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/420)
54-
55-
### Fixed
56-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.5+is%3Aclosed+label%3Abug)
57-
58-
## [0.15.4]
59-
### Added
60-
- Add a new setting `leetcode.filePath`. Now users can use this setting to dynamicly specify the relative folder name and file name. [#PR380](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/380)
61-
62-
### Fixed
63-
- Missing language `Rust` in the supported language list. [#PR412](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/412)
64-
- Cannot show output when the answer is wrong. [#414](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/414)
65-
66-
## [0.15.3]
67-
### Added
68-
- Support `Pick One` [#263](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/263)
69-
- Support toggling the favorite problems [#378](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/378)
70-
71-
### Changed
72-
- Update the activity bar icon [#395](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/263)
73-
74-
### Fixed
75-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.3+is%3Aclosed+label%3Abug)
76-
77-
## [0.15.2]
78-
### Added
79-
- Prompt to open the workspace for LeetCode [#130](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/130)
80-
- Support deleting sessions [#198](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/130)
81-
82-
### Fixed
83-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.2+is%3Aclosed+label%3Abug)
84-
85-
## [0.15.1]
86-
### Fixed
87-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.1+is%3Aclosed+label%3Abug)
88-
89-
## [0.15.0]
90-
### Added
91-
- Auto refresh the explorer after submitting [#91](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/91)
92-
- Add a editor shortcut `Description` to show the problem description [#286](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/286)
93-
- Support customizing the shortcuts in editor [#335](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/335)
94-
95-
### Fixed
96-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.15.0+is%3Aclosed+label%3Abug)
97-
98-
## [0.14.3]
99-
### Added
100-
- Support interpolation for `leetcode.outputFolder` settings [#151](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/151)
101-
102-
### Fixed
103-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+is%3Aclosed+milestone%3A0.14.3+label%3Abug)
104-
105-
## [0.14.2]
106-
### Added
107-
- Add the `All` category in the LeetCode Explorer [#184](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/184)
108-
- Add shortcuts for `Show top voted solution` [#269](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/269)
109-
110-
### Fixed
111-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+is%3Aclosed+label%3Abug+milestone%3A0.14.2)
112-
113-
## [0.14.1]
114-
### Added
115-
- Add setting `leetcode.showCommentDescription` to specify whether including the problem description in comments or not [#287](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/287)
116-
117-
## [0.14.0]
118-
### Added
119-
- Add setting `leetcode.enableShortcuts` to specify whether to show the submit/test shortcuts in editor [#146](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/146)
120-
- Add `Like` and `Dislike` counts in the problem description [#267](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/267)
121-
122-
### Changed
123-
- Improve the `Preview`, `Result` and `Solution` views
124-
125-
### Fixed
126-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+label%3Abug+is%3Aclosed+milestone%3A0.14.0)
127-
128-
## [0.13.3]
129-
### Fixed
130-
- Fix the bug that the extension cannot be activated
131-
132-
## [0.13.2]
133-
### Added
134-
- Add a setting `leetcode.enableStatusBar` to specify whether the LeetCode status bar will be shown or not [#156](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/156)
135-
- Add a setting `leetcode.nodePath` to specify the `Node.js` executable path [#227](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/227)
136-
137-
### Changed
138-
- Update the activity bar icon, See: [#225](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/225)
139-
140-
### Fixed
141-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.13.2+is%3Aclosed+label%3Abug)
142-
143-
## [0.13.1]
144-
### Fixed
145-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+milestone%3A0.13.1+is%3Aclosed+label%3Abug)
146-
147-
## [0.13.0]
148-
### Added
149-
- Preview the problem description [#131](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/131)
150-
- Show top voted solution [#193](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/193)
151-
- Add `collapse all` for the explorer [#197](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/197)
152-
153-
### Fixed
154-
[Bugs fixed](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues?q=is%3Aissue+is%3Aclosed+milestone%3A0.13.0+label%3Abug)
155-
156-
## [0.12.0]
157-
### Added
158-
- Add new command `LeetCode: Switch Default Language` to support switching the default language [#115](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/115)
159-
- Support `PHP` and `Rust` ([#83](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/83), [#103](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/103))
160-
161-
### Fixed
162-
- Cannot retrieve time and memory result [#105](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/105)
163-
- Power operator displays in a wrong way [#74](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/74)
164-
165-
## [0.11.0]
166-
### Added
167-
- Add new setting: `leetcode.outputFolder` to customize the sub-directory to save the files generated by 'Show Problem' [#119](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/119)
168-
- Add tooltips for sub-category nodes in LeetCode Explorer [#143](https://github.com/LeetCode-OpenSource/vscode-leetcode/pull/143)
169-
170-
### Changed
171-
- Now when triggering 'Show Problem', the extension will not generate a new file if it already exists [#59](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/59)
172-
173-
### Fixed
174-
- Log in timeout when proxy is enabled [#117](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/117)
175-
176-
## [0.10.2]
177-
### Fixed
178-
- Test cases cannot have double quotes [#60](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/60)
179-
180-
## [0.10.1]
181-
### Changed
182-
- Refine the README page.
183-
184-
## [0.10.0]
185-
### Added
186-
- Add an extension setting to hide solved problems [#95](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/95)
187-
- Support categorize problems by company, tag, difficulty and favorite [#67](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/67)
188-
189-
## [0.9.0]
190-
### Changed
191-
- Improve the experience of switching endpoint [#85](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/85)
192-
- Use web view to show the result page [#76](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/76)
193-
194-
195-
## [0.8.2]
196-
### Added
197-
- Add Code Lens for submitting the answer to LeetCode
198-
199-
### Fixed
200-
- Fix the bug that the extension could not automatically sign in [#72](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/72)
201-
202-
## [0.8.1]
203-
### Changed
204-
- Upgrade LeetCode CLI to v2.6.1
205-
206-
## [0.8.0]
207-
### Added
208-
- Support LeetCode CN [#50](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/50)
209-
- Support Windows Subsystem for Linux [#47](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/47)
210-
211-
## [0.7.0]
212-
### Added
213-
- Add spinner when submitting code [#43](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/43)
214-
215-
## [0.6.1]
216-
### Added
217-
- Add Sign in action into LeetCode Explorer title area [#25](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/25)
218-
219-
## [0.6.0]
220-
### Changed
221-
- Move LeetCode explorer into activity bar [#39](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/39)
222-
223-
### Added
224-
- Support trigger test & submit in the editor [#37](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/37)
225-
226-
### Fixed
227-
- Fix the bug that cannot show problem [#41](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/41)
228-
229-
## [0.5.1]
230-
### Fixed
231-
- Fix the bug when user's path contains white spaces [#34](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/34)
232-
233-
## [0.5.0]
234-
### Added
235-
- Support submit and test solution files from the file explorer in VS Code ([#24](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/24), [#26](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/26))
236-
237-
## [0.4.0]
238-
### Added
239-
- Support locked problem [#20](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/20)
240-
241-
### Changed
242-
- Simplify the command 'LeetCode: Test Current File' to 'LeetCode: Test' [#18](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/18)
243-
- Will automatically save current file when 'LeetCode: Test' command is triggered [#17](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/17)
244-
245-
## [0.3.0]
246-
### Added
247-
- Test current solution file [#15](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/15)
248-
249-
## [0.2.1]
250-
### Fixed
251-
- Fix the wrong icon bug in LeetCode Explorer [#9](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/9)
252-
- Fix the switch session bug when login session is expired [#12](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/12)
253-
254-
## [0.2.0]
255-
### Added
256-
- Support setting the default language to solve problems [#5](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/5)
257-
258-
### Fixed
259-
- When user cancels login, no further actions will happen [#10](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/10)
260-
261-
## [0.1.2]
262-
### Fixed
263-
- Fix the duplicated nodes in LeetCode Explorer bug [#6](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/6)
264-
265-
## [0.1.1]
266-
### Fixed
267-
- Fix a bug in LeetCode Explorer [#3](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/3)
268-
- Remove the show problem command from command palette [#4](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/4)
269-
270-
## [0.1.0]
271-
### Added
272-
- Sign in/out to LeetCode
273-
- Switch and create session
274-
- Show problems in explorer
275-
- Search problems by keywords
276-
- Submit solutions to LeetCode
4+
# "version": "1.0.5"
5+
修改了解析文本的获取方式,不需要将描述放在代码注释中了。

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "python-leetcode",
33
"displayName": "PythonLeetcode",
44
"description": "Solve LeetCode problems in VS Code",
5-
"version": "1.0.4",
5+
"version": "1.0.5",
66
"author": "KuiyuanFu",
77
"publisher": "KuiyuanFu",
88
"license": "MIT",

src/leetCodeExecutor.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,14 @@ class LeetCodeExecutor implements Disposable {
9696
}
9797
// FuTodo 文件内容函数
9898
public async showProblem(problemNode: IProblem, language: string, filePath: string, showDescriptionInComment: boolean = false): Promise<void> {
99-
showDescriptionInComment = true;
99+
// showDescriptionInComment = true;
100100
const templateType: string = showDescriptionInComment ? "-cx" : "-c";
101101

102102

103103
if (!await fse.pathExists(filePath)) {
104104
await fse.createFile(filePath);
105105
const codeTemplate: string = await this.executeCommandWithProgressEx("Fetching problem data...", this.nodeExecutable, [await this.getLeetCodeBinaryPath(), "show", problemNode.id, templateType, "-l", language]);
106+
106107
// FuTodo diy模板的函数
107108
const codeTemplateR: string = await this.diyTemplate(problemNode, language, codeTemplate);
108109
await fse.writeFile(filePath, codeTemplateR);
@@ -139,8 +140,15 @@ class LeetCodeExecutor implements Disposable {
139140
if (language != 'python3' || problemNode == null) {
140141
return codeTemplate;
141142
}
143+
144+
const codeTemplateDescription: string = await this.executeCommandWithProgressEx("Fetching problem data...", this.nodeExecutable, [await this.getLeetCodeBinaryPath(), "show", problemNode.id, "-cx", "-l", language]);
145+
146+
var blocksDescription = this.codeTemplateSplit(codeTemplateDescription)
142147
var blocks = this.codeTemplateSplit(codeTemplate)
148+
149+
143150
var [app, tags, imports, idea, group, rank, code, main,] = blocks
151+
app = blocksDescription[0]
144152

145153
this.generateTags(tags, problemNode)
146154
this.generateImports(imports)

0 commit comments

Comments
 (0)