Closed ghost closed 10 years ago
The solution i've found for that is to remove the .idea folder and reopen the directory, its not optimal but it works.
@MTon I'm not sure that understand you... Could you please a litle bit more describe the scenario what happens and what should be?
@MTon or a better one i just found is to copy the templates directory from the .idea dir into your old projects.
@vkravets Sorry to be not precise. Next try.
Under the Settings IDE Settings -> File and Code Templates I got these three tabs Templates, Includes and Code
Under the Templates-Tab I got a template for PHP-Classes called PHP Class which looks like this.
<?php
#if (${NAMESPACE})
namespace ${NAMESPACE};
#end
#parse("PHP Class Doc Comment.php")
class ${NAME}
{
}
The Include PHP Class Doc Comment looks like this, where ${AUTHOR}
and ${COPYRIGHT}
are my custom variables that are set under Default Settings -> File and Code Template Variables and Settings -> Project Settings -> File and Code Template Variables
/**
*
* Class ${NAME}
*
#if (${NAMESPACE}) * @package ${NAMESPACE}
#end
*
* @author ${AUTHOR}
* @copyright ${COPYRIGHT}
*/
When I create a new PHP-Class in a project, ${AUTHOR}
and ${COPYRIGHT}
are filled with the correct values from the settings. So far so good.
But when I try to add the docblock from the above Include to an existing class. Eg.
<?php
namespace MyNamespace;
class MyClass
{
// some stuff
}
I'm doing it this by adding /**
and press enter above the class definition. It should add the stuff from the above Include too. But I get
<?php
namespace MyNamespace;
/**
*
* Class MyClass
*
* @package MyNamespace
*
* @author ${AUTHOR}
* @copyright ${COPYRIGHT}
*/
class MyClass
{
// some stuff
}
As you can see, the default variables are filed, but the custom ones aren't.
Hope you can follow now :-)
@th3fallen Thx for the suggestions, will try!
@th3fallen
Removing the .idea
-Folder from the project didn't make any difference to me.
Ok, now it's clear for me what happens. The similar issue was already open (#3) and I cannot implement such functionality since I cannot inject(trigger) my code during docblock insert. IDEA Platform don't have such API, unfortunately... Sorry... =(
Ok! Thanks a lot anyway!
Hi,
first thanks for this great plugin, proved very useful already!
But I have one little issue.
It it's only replacing the variables when using the
"New File" / #parse(<INCLUDE_NAME>)
function. It's not working when I simply add a "File and Code Template - Includes" in an existing file.Thx in advance.
regards