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

file_name inserted in first line #63

Open
gtataranni opened this issue Jul 6, 2016 · 4 comments
Open

file_name inserted in first line #63

gtataranni opened this issue Jul 6, 2016 · 4 comments

Comments

@gtataranni
Copy link

If {{file_name}} is inserted in the header template, no matter which line, when opening an existing file, the first line is substituted with the line from the header template containing {{file_name}}

@gillett-hernandez
Copy link

could you provide the language you were using and the contents of the header/template file?
testing with python, with the template file 2nd line being "# File name: {{file_name}}" did not reproduce the issue.

@gtataranni
Copy link
Author

it was with c++ language files (extensions c/cc/h/hh)

@gillett-hernandez
Copy link

sorry i can't reproduce the issue.
my cpp file:

/*
* @Author: gilletthernandez
* @Date:   2016-07-27 22:56:27
* @File name: base.cpp
* @Last Modified by:   gilletthernandez
* @Last Modified time: 2016-08-16 20:06:48
*/
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    cout << "Hello World!" << endl;
    return 0;
}

and my tmpl file "C++.tmpl"

/*
* @Author: {{author}}
* @Date:   {{create_time}}
* @File name: {{file_name}}
* @Last Modified by:   {{last_modified_by}}
* @Last Modified time: {{last_modified_time}}
*/

and the command was just a simple Add Header to an existing file.

@tonyandrys
Copy link

tonyandrys commented Jul 6, 2017

I just noticed this issue w/ a custom Python template.

I overrode the default Python template with a simpler one in my User plugins folder (also namedPython.tmpl).

###
# {{file_name}}
#
# Tony Andrys <anthony-andrys@uiowa.edu>
###

Ctrl+super+a adds the template to an open file correctly. However, switching to a different file in the editor (or perhaps returning to the initial) seems to trigger the bug.

fileheader-bug

The issue does seem to be related to the file_name variable; replacing {{file_name}} with {{created_time}} eliminates the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants