Skip to content

Variable transformation doesn't work if undefined variables are used in the same snippet #51769

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
fuzy112 opened this issue Jun 13, 2018 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug snippets verified Verification succeeded
Milestone

Comments

@fuzy112
Copy link

fuzy112 commented Jun 13, 2018

Issue Type: Bug

Consider the following snippet:

{
  "Class": {
    "prefix": "myclass",
    "body": [
      "class ${TM_FILENAME_BASE/(^|_)([a-zA-Z0-9])/${2:/upcase}/g} : public ${BaseClass} {\n",
      "\t$0",
      "};\n"
    ]
  }
}

The transformation ${TM_FILENAME_BASE/(^|_)([a-zA-Z0-9])/${2:/upcase}/g} would normally remove the underscores and capitalize the filename, but in the snippet above, the file name is directly inserted without any transformation. However, after replacing ${BaseClass} with ${1:BaseClass},
the snippet works as expected.

VS Code version: Code 1.24.0 (6a6e02c, 2018-06-06T17:37:01.579Z)
OS version: Linux x64 4.16.14-300.fc28.x86_64

@jrieken jrieken added the bug Issue identified by VS Code Team member as probable bug label Jun 14, 2018
@jrieken jrieken added this to the July 2018 milestone Jun 14, 2018
@jrieken jrieken added info-needed Issue requires more information from poster and removed bug Issue identified by VS Code Team member as probable bug labels Jun 22, 2018
@jrieken
Copy link
Member

jrieken commented Jun 22, 2018

@chingyat I actually cannot reproduce anymore... Can you give it a try with latest insiders please https://code.visualstudio.com/insiders/. We did make some changes in the variables world and this might have been fixed by that.

@fuzy112
Copy link
Author

fuzy112 commented Jun 23, 2018

I tried the snippet above with insiders in file my_class.cpp.
It should inserts:

class MyClass : public BaseClass {

    
};

But it actually inserts:

class My_class : public BaseClass {

    
};

@jrieken
Copy link
Member

jrieken commented Jun 25, 2018

Yeah, it looks like the /g-flag is getting lost

@jrieken jrieken modified the milestones: July 2018, June 2018 Jun 25, 2018
@jrieken jrieken added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Jun 25, 2018
@mjbvz mjbvz added the verified Verification succeeded label Jun 27, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug snippets verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants