From 54901594d5630e2b0b77c3804b3c2604ed032f5c Mon Sep 17 00:00:00 2001 From: aebopp Date: Thu, 25 Jun 2020 03:03:31 -0400 Subject: [PATCH 1/2] Update show.ts --- src/commands/show.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/commands/show.ts b/src/commands/show.ts index 70474426..d81d0fe0 100644 --- a/src/commands/show.ts +++ b/src/commands/show.ts @@ -153,8 +153,21 @@ async function showProblemInternal(node: IProblem): Promise { leetCodeConfig.get(`filePath.default.filename`) || genFileName(node, language), ) .trim(); - - let finalPath: string = path.join(workspaceFolder, fileFolder, fileName); + + var i = fileName.indexOf('.'); + const files: string[] = [fileName.slice(0, i), fileName.slice(i + 1)]; + let id: string = node["id"]; + if (id.length == 1) { + id = "000" + id; + } + else if (id.length == 2) { + id = "00" + id; + } + else if (id.length == 3) { + id = "0" + id; + } + const zeroFileName: string = id + "." + files[1] + let finalPath: string = path.join(workspaceFolder, fileFolder, zeroFileName); if (finalPath) { finalPath = await resolveRelativePath(finalPath, node, language); From 0c416b4630185a7a9784179ec5e3e77288735b89 Mon Sep 17 00:00:00 2001 From: aebopp Date: Thu, 25 Jun 2020 10:50:56 -0400 Subject: [PATCH 2/2] Update show.ts --- src/commands/show.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/commands/show.ts b/src/commands/show.ts index d81d0fe0..1047c952 100644 --- a/src/commands/show.ts +++ b/src/commands/show.ts @@ -157,16 +157,9 @@ async function showProblemInternal(node: IProblem): Promise { var i = fileName.indexOf('.'); const files: string[] = [fileName.slice(0, i), fileName.slice(i + 1)]; let id: string = node["id"]; - if (id.length == 1) { - id = "000" + id; - } - else if (id.length == 2) { - id = "00" + id; - } - else if (id.length == 3) { - id = "0" + id; - } - const zeroFileName: string = id + "." + files[1] + let pad = "0000"; + let zeroid = pad.substring(0, 4 - id.length) + id + const zeroFileName: string = zeroid + "." + files[1] let finalPath: string = path.join(workspaceFolder, fileFolder, zeroFileName); if (finalPath) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy