Skip to content

leetcode.outputFolder not work #321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jjeejj opened this issue May 15, 2019 · 6 comments
Closed

leetcode.outputFolder not work #321

jjeejj opened this issue May 15, 2019 · 6 comments
Labels
duplicate This issue or pull request already exists

Comments

@jjeejj
Copy link

jjeejj commented May 15, 2019

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

@jdneo
Copy link
Member

jdneo commented May 15, 2019

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.

@jdneo jdneo closed this as completed May 15, 2019
@jdneo jdneo added the duplicate This issue or pull request already exists label May 15, 2019
@jjeejj
Copy link
Author

jjeejj commented May 15, 2019

@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
Copy link
Member

jdneo commented May 15, 2019

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
Copy link
Author

jjeejj commented May 15, 2019

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
Copy link
Member

jdneo commented May 16, 2019

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
Copy link
Author

jjeejj commented May 17, 2019

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
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants