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

${fileBasenameNoExtension} doesn't get substitued if nested in argument #15937

Closed
bayesrule opened this issue Nov 23, 2016 · 9 comments
Closed
Assignees
Milestone

Comments

@bayesrule
Copy link

Hi,

The newly added variable ${fileBasenameNoExtension} (#1104) is not working, please check.

Many thanks!

@bayesrule bayesrule changed the title ${fileBasenameNoExtension} doesn't work BUG: ${fileBasenameNoExtension} doesn't work Nov 23, 2016
@isidorn isidorn assigned isidorn and unassigned dbaeumer Nov 25, 2016
@isidorn isidorn added the info-needed Issue requires more information from poster label Nov 25, 2016
@isidorn
Copy link
Contributor

isidorn commented Nov 25, 2016

Reproducable steps please. What is the file that you have open, what are you expecting to get returned, what actually gets returned?

Thanks

@bayesrule
Copy link
Author

bayesrule commented Nov 25, 2016

Hi @isidorn , many thanks for replying. I simply used it in a build task.

In tasks.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "command": "clenv.bat",
    "isShellCommand": true,
    "showOutput": "always",
    "suppressTaskName": true,
    "tasks": [
        {
            "taskName": "build",
            "args": ["${file} ${fileBasenameNoExtension}"]
        }
    ]
}

Output:
"c:\Users\bayesrule\Desktop\codes\program.c ${fileBasenameNoExtension}"

${file} = c:\Users\bayesrule\Desktop\codes\program.c

${fileBasenameNoExtension} = program , however it cannot be recognised at all.

@isidorn
Copy link
Contributor

isidorn commented Nov 25, 2016

That is the expected result of ${fileBasenameNoExtension}, that is program.c without the extension, thus program.
As to why it is not recognized I have no idea - depends on you build task

Closing as designed - let me know if I misunderstood stomething here

@isidorn isidorn closed this as completed Nov 25, 2016
@isidorn isidorn added *as-designed Described behavior is as designed and removed info-needed Issue requires more information from poster labels Nov 25, 2016
@bayesrule
Copy link
Author

@isidorn sadly you misunderstood me again. I meant ${fileBasenameNoExtension} should be 'program', but it is not.

Like I presented in the quoted line, it displayed as ${fileBasenameNoExtension}, which clearly shows that it is not working...

@xin053
Copy link

xin053 commented Nov 26, 2016

I have this problem too.Using '${fileBasenameNoExtension}' in 'tasks.json' produces '${fileBasenameNoExtension}.exe' , it seems ${fileBasenameNoExtension} doesn't work.

task.json:

{
    "version": "0.1.0",
    "command": "g++",
    "isShellCommand": true,
    "showOutput": "always",
    "args": ["-g","${file}","-o","${fileBasenameNoExtension}.exe"],
    "problemMatcher": {
        "owner": "cpp",
        "fileLocation": ["relative", "${workspaceRoot}"],
        "pattern": {
            "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
            "file": 1,
            "line": 2,
            "column": 3,
            "severity": 4,
            "message": 5
        }
    }
}

@Renkin42
Copy link

${fileBasenameNoExtension} is doing the same thing for me, it should be getting "style.min.css" out of this but instead it literally sends "${fileBasenameNoExtension}.min.css":

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "command": "sass",
    "isShellCommand": true,
    "showOutput": "always",
    "echoCommand": true,
    "suppressTaskName": true,
    "tasks": [
        {
            "taskName": "compile css",
            "args": [
                "${relativeFile}",
                "${fileBasenameNoExtension}.css"
            ]
        },
        {
            "taskName": "minify css",
            "isBuildCommand": true,
            "args": [
                "${relativeFile}",
                "${fileBasenameNoExtension}.min.css",
                "--style",
                "compressed"
            ]
        }
    ]
}

@isidorn
Copy link
Contributor

isidorn commented Nov 28, 2016

Ok looking at all your examples it seems like the issue is that the substition does not work if the variable is nested inside an argument.
My guess is that it will get substiuted if you have it top level in launch.json

Reopening to investigate

@isidorn isidorn reopened this Nov 28, 2016
@isidorn isidorn added bug Issue identified by VS Code Team member as probable bug and removed *as-designed Described behavior is as designed labels Nov 28, 2016
@isidorn isidorn changed the title BUG: ${fileBasenameNoExtension} doesn't work ${fileBasenameNoExtension} doesn't get substitued if nested in argument Nov 28, 2016
@isidorn isidorn added this to the November 2016 milestone Nov 28, 2016
@isidorn
Copy link
Contributor

isidorn commented Nov 29, 2016

This has been fixed in the insiders, please verify with vscode insiders this works fine for you now.
It will be a part of the next stable release in a couple of weeks.

@isidorn isidorn closed this as completed Nov 29, 2016
@isidorn
Copy link
Contributor

isidorn commented Nov 29, 2016

By the way, the original feature #1104 is assigned to November which means it got fixed in the november release and will be available in the november vscode. Which gets released mid december - more details #15099

@isidorn isidorn removed the bug Issue identified by VS Code Team member as probable bug label Nov 29, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
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 a pull request may close this issue.

5 participants