Skip to content
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

Fix #79428 - add "$WORKSPACE_FOLDER" for snippet #79764

Merged
merged 5 commits into from Oct 7, 2019

Conversation

hunghw
Copy link
Contributor

@hunghw hunghw commented Aug 25, 2019

Add a new snippet variable WORKSPACE_FOLDER.

Copy link
Member

@jrieken jrieken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add tests

@hunghw
Copy link
Contributor Author

hunghw commented Aug 28, 2019

@jrieken I added tests.

@jrieken jrieken added this to the September 2019 milestone Aug 29, 2019
@@ -272,13 +274,31 @@ export class WorkspaceBasedVariableResolver implements VariableResolver {
}

if (isSingleFolderWorkspaceIdentifier(workspaceIdentifier)) {
return path.basename(workspaceIdentifier.path);
if (variable.name === 'WORKSPACE_NAME') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this repeated-if-else is a little ugly, can't you change it be two methods, like _resolveWorkspaceName and _resoveWorkspacePath?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I can do it later.

Copy link
Contributor Author

@hunghw hunghw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrieken I separate it into two functions.

@@ -272,13 +274,31 @@ export class WorkspaceBasedVariableResolver implements VariableResolver {
}

if (isSingleFolderWorkspaceIdentifier(workspaceIdentifier)) {
return path.basename(workspaceIdentifier.path);
if (variable.name === 'WORKSPACE_NAME') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I can do it later.

@jrieken jrieken modified the milestones: September 2019, October 2019 Oct 1, 2019
@jrieken jrieken merged commit 511137f into microsoft:master Oct 7, 2019
@hunghw hunghw deleted the issue-79428 branch October 29, 2019 16:15
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants