Skip to content

leetcode.outputFolder not work #321

Closed
@jjeejj

Description

@jjeejj

set "leetcode.outputFolder": "E:/study/leetcode/${difficulty}/${tag}/${language}", is not work

it generate file in vscode currently open workspace
image

version: 1.33.1 (user setup)
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 6.1.7601

LeetCode extend is latest version

Activity

jdneo

jdneo commented on May 15, 2019

@jdneo
Member

Hi @jjeejj,

The setting leetcode.outputFolder is to set the relative path, not an absolute path. See: https://github.com/jdneo/vscode-leetcode#settings

To solve your problem, we have several related tracking issues here:

It could be great if you would like to give it a shot for contributing them. 😄

BTW, I'm closing this issue since it's somehow duplicated with existing issues.

added
duplicateThis issue or pull request already exists
on May 15, 2019
jjeejj

jjeejj commented on May 15, 2019

@jjeejj
Author

@jjeejj
i read the related source code

   const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("leetcode");
   let outDir: string = await selectWorkspaceFolder();
   let relativePath: string = (leetCodeConfig.get<string>("outputFolder", "")).trim();
   const matchResult: RegExpMatchArray \| null = relativePath.match(/\$\{(.*?)\}/);
   if (matchResult) {
   const resolvedPath: string \| undefined = await resolveRelativePath(matchResult[1].toLocaleLowerCase(), node, language);
   if (!resolvedPath) {
   leetCodeChannel.appendLine("Showing problem canceled by user.");
   return;
   }
   relativePath = resolvedPath;
   }
   outDir = path.join(outDir, relativePath);

the config leetcode.outputFolder is relative current workspaceFolder

If the open workspace is inconsistent with the previous one, leetcode.outputFolder relative path corresponding actual path is different.

Why not?
if the leetcode.outputFolder config is absolutely path , use this path directly
if the leetcode.outputFolder config is relative path, join currentWorkspaceFolder path

jdneo

jdneo commented on May 15, 2019

@jdneo
Member

You are correct. The config leetcode.outputFolder is relative current workspaceFolder

Just as I have said before. If there is a setting to specify the workspace path for the leetcode files (That's what #130 talks about), then it will be confusing if leetcode.outputFolder can set to an absolute path, since there will be some conflicts there.

jjeejj

jjeejj commented on May 15, 2019

@jjeejj
Author

I don't think so.
I don't think the leetcode outputFolder and current workspaceFolder have anything to do with it.

because i can open one folder in any path , use leetcode extension
if i do it , it will generator many leetcode code file in different workspaceFolder
Hard to maintain local leetcode code

jdneo

jdneo commented on May 16, 2019

@jdneo
Member

The extension can detect if the path is opened in the current workspace. If not, prompt the user to open it or add it into the current workspace

Open a file which does not belong to the current workspace is the thing that I hope to get avoid. That's why I make the outputFolder as a relative path setting.

In short:

The setting which will be added in #130 determines the leetcode specific workspace path, and it will defaults to $home/.leetcode
leetcode.outputFolder determines the relative path in the workspace.

jjeejj

jjeejj commented on May 17, 2019

@jjeejj
Author

that menas ,I can't use this feature right now ?

I hope the config leetcode.outputFolder support relative path and absolutely path
because I often open different projects using leetcode extension at different times

Now vscode support multiple workspace , this feature can avoid conflicts, have a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jdneo@jjeejj

        Issue actions

          leetcode.outputFolder not work · Issue #321 · LeetCode-OpenSource/vscode-leetcode