Skip to content

Commit a4df16d

Browse files
committed
new command : show leetcode problems
1 parent 35b5be4 commit a4df16d

File tree

5 files changed

+37
-20
lines changed

5 files changed

+37
-20
lines changed

CHANGELOG.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2828

2929
----------------------------------------------------------------------------------------------------------
3030

31-
## modifications #2
31+
## Modifications #2
3232

3333
### Added
3434
- Added Leetcode helper:Command in commandTreeDataProvider.ts file to view all the command directly from the pannel(manually seleting the command from command palette feature is also available by ctrl+shift+P)
@@ -45,4 +45,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4545
- updated the package.json file for proper functioning of Leetcode Helper:Command pannel(also added the icon)
4646

4747
### Fixed
48-
- updated the logic for fetching test cases
48+
- updated the logic for fetching test cases
49+
50+
----------------------------------------------------------------------------------------------------------
51+
52+
## Modifications #3
53+
54+
### Added
55+
- added a new command show leetcode problems where links of every question on leetcode is availabe you can run this command and a text file will get opened and you can use (ctrl+f) to search for the specific leetcode question
56+
57+
### Changed
58+
- updated extension.ts to ensure proper execution of showleetcodeproblem command
59+
- updated commandTreeDataProvider.ts to add a new command to the panel
60+
- updated package.json file too

dist/extension.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -297356,19 +297356,10 @@ function saveTestCasesToFiles(testCases) {
297356297356
console.log(`Test cases saved successfully to ${testCasesDir}`);
297357297357
}
297358297358
function extractRawData(input) {
297359-
if (input.includes("target")) {
297360-
const [numsPart, targetPart] = input.split(", target = ");
297361-
const nums = numsPart.split("=")[1].trim();
297362-
const target = targetPart.trim();
297363-
return `${nums}
297364-
${target}`;
297365-
}
297366-
const regex = /=(.+)/;
297367-
const match = input.match(regex);
297368-
if (match && match[1]) {
297369-
return match[1].trim();
297370-
}
297371-
return input.trim();
297359+
const regex = /[a-zA-Z_]\w*\s*=\s*(\[.*?\]|{.*?}|".*?"|'.*?'|[^,\s]+)/g;
297360+
const matches = [...input.matchAll(regex)];
297361+
const values = matches.map((match) => match[0].split("=")[1].trim());
297362+
return values.join(" ");
297372297363
}
297373297364
async function addAdditionalTestCases(count, existingCount) {
297374297365
const baseDirectory = path10.join(__dirname, "test_cases");
@@ -297557,7 +297548,8 @@ var CommandTreeDataProvider = class {
297557297548
"leetcode-cph-helper-by-ashish.runTestCases": "\u{1F449}\u{1F3FB} Run Test Cases",
297558297549
"leetcode-cph-helper-by-ashish.writeSolutionFile": "\u{1F449}\u{1F3FB} Write Solution File",
297559297550
"leetcode-test-case-manager.getSolutionFileDirectory": "\u{1F449}\u{1F3FB} Get Solution File Directory",
297560-
"leetcode-cph-helper-by-ashish.getIOFileDirectory": "\u{1F449}\u{1F3FB} Get I/O File Directory"
297551+
"leetcode-cph-helper-by-ashish.getIOFileDirectory": "\u{1F449}\u{1F3FB} Get I/O File Directory",
297552+
"leetcode-cph-helper-by-ashish.showLeetCodeProblemLinks": "\u{1F449}\u{1F3FB}Show LeetCode Problem Links "
297561297553
};
297562297554
}
297563297555
// Returns a TreeItem representation of the given element
@@ -297962,7 +297954,15 @@ ${summary}`, { modal: true });
297962297954
}
297963297955
}
297964297956
);
297965-
context2.subscriptions.push(fetchCommand, getIOFileDirectoryCommand, getSolutionFileDirectoryCommand, writeSolutionFileCommand, runCommand);
297957+
const showLeetCodeProblemLinksCommand = vscode3.commands.registerCommand(
297958+
"leetcode-cph-helper-by-ashish.showLeetCodeProblemLinks",
297959+
async () => {
297960+
const problemLinksFilePath = path12.join(context2.extensionPath, "leetcode_problems_link.txt");
297961+
const document2 = await vscode3.workspace.openTextDocument(problemLinksFilePath);
297962+
await vscode3.window.showTextDocument(document2);
297963+
}
297964+
);
297965+
context2.subscriptions.push(fetchCommand, showLeetCodeProblemLinksCommand, getIOFileDirectoryCommand, getSolutionFileDirectoryCommand, writeSolutionFileCommand, runCommand);
297966297966
const commandTreeDataProvider = new CommandTreeDataProvider();
297967297967
vscode3.window.registerTreeDataProvider("leetcodeHelperCommands", commandTreeDataProvider);
297968297968
vscode3.commands.executeCommand("workbench.view.extension.leetcodeHelper");

dist/extension.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@
3131
{
3232
"command": "leetcode-cph-helper-by-ashish.getIOFileDirectory",
3333
"title": "Get IO File Directory"
34-
}
34+
},
35+
{
36+
"command": "leetcode-cph-helper-by-ashish.showLeetCodeProblemLinks",
37+
"title": "Show LeetCode Problem Links"
38+
}
3539
],
3640
"views": {
3741
"explorer": [

src/commandTreeDataProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export class CommandTreeDataProvider implements vscode.TreeDataProvider<vscode.T
1111
'leetcode-cph-helper-by-ashish.runTestCases': '👉🏻 Run Test Cases',
1212
'leetcode-cph-helper-by-ashish.writeSolutionFile': '👉🏻 Write Solution File',
1313
'leetcode-test-case-manager.getSolutionFileDirectory': '👉🏻 Get Solution File Directory',
14-
'leetcode-cph-helper-by-ashish.getIOFileDirectory': '👉🏻 Get I/O File Directory'
14+
'leetcode-cph-helper-by-ashish.getIOFileDirectory': '👉🏻 Get I/O File Directory',
15+
'leetcode-cph-helper-by-ashish.showLeetCodeProblemLinks': '👉🏻Show LeetCode Problem Links '
1516
};
1617

1718
// Returns a TreeItem representation of the given element

0 commit comments

Comments
 (0)