IcCube - How to add Help on Custom widgets / Custom cell renderers? - widget

I created some Custom widget types and cell renderers using IcCube reporting V8 (ic3-reporting-api).
Is there a way to link some help to these as it exists for original components ?
Custom widget :
Custom cell renderer :

Widgets
You can add some documentation/help that will be available in the editor via the (?) icon. The framework is searching in the server Docs for an MD file located either in the ic3-reporting/app-local folder or in the official documentation folder (i.e., ic3-reporting/doc).
The name of the file is built from the widget template as following:
"widgets." + pluginId + "." + templateType + "." + templateId
So, let's say you've created a custom table widget named SimpleTable in your plugin named MyPluginJS and register this widget into the chart section, then the MD filename would be:
widgets.MyPluginJS.chart.SimpleTable.md
This name is then translated into a path:
widgets/MyPluginJS/chart/SimpleTable.md
And it is searched first in ic3-reporting/app-local using first the user's locale and then English:
/icCube/report/ic3-reporting/app-local/doc/
fr/widgets/MyPluginJS/chart/SimpleTable.md
en/widgets/MyPluginJS/chart/SimpleTable.md
Eventually, it is searched in the ic3-reporting/doc folder for the English locale only:
/icCube/report/ic3-reporting/doc/
en/widgets/MyPluginJS/chart/SimpleTable.md
But, adding your documentation to the ic3-reporting/doc folder is not recommended as this directory will be overwritten on each installation of a new version of the reporting application.
Transformations
The same mechanism is used for the transformations. The path would be as following:
tidyTable/transformations/MyPluginJS/SimpleRenderer.md
Note that the pluginId is not used for the transformations path in v8.2.2 (this will be fixed in v8.3).
Edit: Forgot to mention the app-local/ic3report-config.js must be updated as folllowing:
// extra. doc. localization folder
options.appDocUrlEx = "doc";

Related

How to include software in PhpStorm project

I have just started using PhpStorm. In my project I am receiving a lot of undefined variable errors because I am creating a plugin for vBulletin.
I was wondering is there a way to include the main software I am working with in my plugin development, to avoid getting undefined vars, and functions? Kind of how the WordPress plugin development works.
For example I have my projects folder: c://wamp/www/projects/projectname/ and I have vBulletin in c://wamp/www/vb3/
I want to be able to tell PhpStorm "hey the core scripts to this project are here".
As LazyOne said I was able to achieve this using include paths.
Include paths are used for holding third-party code that is used for completion and reference resolution in some functions/methods that use file paths as arguments, for example, require() or include().
Note that the files added via include paths are not meant to be edited within the scope of your project. If you have the existing code that you need to access and modify from within several projects, consider adding it via an additional content root.
Do one of the following:
To configure the include paths for the current project, in the
Settings/Preferences dialog Ctrl+Alt+S, click PHP under Languages &
Frameworks.
To configure the include paths that will be applied to all newly
created projects, use the default new project settings (File | New
Projects Settings | Settings for New Projects ).
On the PHP page that opens, configure the list of include paths on the Include path tab:
Use Add and Remove to add and remove paths.
Use Move up and Move down to reorder the items in the list.
Click the Sort Alphabetically button to sort the paths alphabetically in the ascending order.

PhpStorm insert current namespace

I want the PhpStorm to insert current namespace by default or with a hotkey or with live templates.
Whet I create new Php class ("New | PHP Class" dialog) there is a field for a namespace. Is there a way for it to be filled automatically? It does not look a big deal because in my case a namespace is just directory path (I use composer) starting from src. My search efforts did not give my anything about this at all. Looks like PhpStrom does not have this feauture. But maybe there is some plugin or a hack?
New | PHP Class dialog should fill the namespace automatically based on the directory where file will be created. If it does not then you have not configured your project properly.
Settings/Preferences | Directories -- ensure that your src folder is marked as Source Root. That's depends on project, of course: for Laravel project you need to map app folder to App\ namespace (typical case).
PhpStorm can also detect source roots from your composer.json settings and can even keep it in sync since 2017.2 version (see https://blog.jetbrains.com/phpstorm/2017/07/configuring-with-composer-in-phpstorm-2017-2/).
Some links to read (official help pages):
https://www.jetbrains.com/help/phpstorm/configuring-php-namespaces-in-a-project.html
https://www.jetbrains.com/help/phpstorm/configuring-content-roots.html
https://www.jetbrains.com/help/phpstorm/directories.html

In PhpStorm, can I create a new "module" (i.e. handful of files at the same time)

I would like to be able to right click in a folder in PhpStorm, and select something like, "New Custom Module", which will then create directories and files as per a definition that I set up somewhere.
Is this possible at all?
Detailed description of what I would do:
In the "Edit File Templates" window (or something similar), I would add a new entry, calling it "New Custom Module". I would then +/- directories and file types that I would like to be created when I select to create that module.
For example, I could set up the "New Custom Module" to create a Controllers directory with a controller class inside it, a Model directory with a model class inside it, a composer.json file and a registration.php file. So when selecting this menu option from right clicking on a directory in the Project panel, I would get the following:
[top-level-directory]
- Controllers
- People.php
- Models
- Person.php
- composer.json
- registration.php
Ideally I could also select what the starting contents of the files would be, but if I can just create blank file/directories for now, that would be pretty great
Closest you can get is a "Project template" (saving project as a template). But unfortunately there's nothing similar to what you're requesting.
There's an existing feature request for this: https://youtrack.jetbrains.com/issue/IDEA-91565. Feel free to vote/comment.

How to exclude files from a project in PhpStorm by pattern?

I'm using PhpStorm 10.0.1. I want to exclude files in directories that match a pattern. I want this exclusion to remove the excluded files from the set of files that PhpStorm uses when - for example - finding duplicate definitions of classes.
I've gotten part of the way through the solution, which involves Scopes:
Open a project in PhpStorm
Go to Settings (File -> Settings)
Navigate to Appearance & Behavior -> Scopes
Create a scope to exclude the appropriate file(s).
Click the + icon
Select either Local or Shared
Give the scope a name
Enter an appropriate pattern
For example, to exclude files in directories that match *-b0*, enter !file:*-b0*/*
Click Exclude Recursively
Verify in the tree view that the appropriate file(s) are excluded.
Click OK.
This is where I'm stuck. I can't find any reference anywhere in the UI to that named scope - except in the settings dialog where I created it.
The documentation is no help:
https://www.jetbrains.com/phpstorm/help/scopes.html - "Scopes" describes how to create scopes but not how to use them
https://www.jetbrains.com/phpstorm/help/configuring-scopes-and-file-colors.html - "Configuring Scopes and File Colors" describes how to color files in a scope differently but not how to apply them to a project
How do I apply that scope to the current project?
(It may be the case that scopes are applied automatically. In that case, the Scopes dialog and the rest of PhpStorm disagree on what is included and what excluded and I'll need to file a bug.)
Scopes can be used in Project tool window - click the Project popup in upper left corner and choose the desired scope. They can only be used for search filtering (in Edit/Find/Find in path dialog), in Inspections profiles, file watchers, etc.
But note that choosing your scope in Project window is just a view option, files excluded from scope are NOT excluded from project - they will still be indexed, used in completion/navigation, etc. If you like to exclude certain files/folders completely, so that they are not included in file index, you need adding them to 'Ignore files and folders' in Settings | Editor | File Types. Folders can also be excluded using Mark directory as/Excluded
I've never heard of the ability to apply a custom scope globally. I believe they can only be used to allow specific components of PhpStorm (like code inspections & find/replace) to operate on a subset of your project's files. Edit: This is not accurate; please see the comments below.
This hacky workaround might just do the trick, if the files you'd like to exclude from your project are never going to change:
(a) Using the pattern you've already identified, create a new custom scope that specifically includes the undesirable files.
(b) Perform a very broad search against that scope (Find in Path > Scope > Custom > Custom Scopes), so that every undesired file is matched. You could potentially search for the text <?php, or use a regular expression like .+
(c) Create a new Favorites list, and add all of the search results to that list.
(d) From the Favorites window, highlight all of the files. Right click them and choose "Mark as plain text". This will prevent PhpStorm from indexing them, so they'll no longer be considered by the IDE's static code analysis.

PhpStorm Ignore files/directories in TODO feature

Is it possible to exclude certain files from the TODO function in PhpStorm? For example, I'm using the highcharts javascript library. I don't want to see the few dozen or so TODO's they have marked mixed in with my own. I don't want to exclude this directory, because I still want to be able to view the files in a convenient manner.
In File > Settings > Scope add a new scope and make sure the files you like are green.
Open TODO Tab View > Tool Windows > TODO (Alt + 6)
In the top of TODOs click on Scope Based
Below select your new scope from step 1 below Custom Local Scopes
Yes, you can -- via custom scope that would include all but unwanted files/folders (Settings | Scopes) and then just choose it in TODO window.
Check these articles for details:
http://blog.jetbrains.com/webide/2012/10/managing-todo/
http://confluence.jetbrains.com/display/PhpStorm/Working+with+todo+comments+and+the+todo+tool+window
P.S.
This functionality is available since v6 only.
For libraries, there is a one click solution as I have just found out.
You can use the "External Libraries" feature to include the specific library folder, after which PHPStorm / IDEA will mark the folder as a library home and exclude it from inspection.
Note that you can include folders inside your project directroy, even though it's called "External" Libraries.
To exclude code (usually composer dependencies) from analysis.
Right click on desired folder
Click 'Mark Directory As'
Click 'Excluded'
Screenshot example below: