Autocompletion for CakePHP finders in VSCode? - visual-studio-code

is there a way in VScode to have autocompletion for custom finders when using $this->Table->find('finderName') ? Each time I have to check in the Table file to see which finder exists.
I tried using PHP doc when defining the finder function
Thanks !

According to https://github.com/dereuromark/cakephp-ide-helper/wiki/Visual-Studio-Code
https://github.com/dereuromark/cakephp-ide-helper should work fine as long as you have Intelephense Extension.

Related

Vscode language configuration - autocompletion is not triggering automatically in some specific situation

I have problem with automatic invoke code completion when I press dot inside the string when the previous panel is already opened.
I'm using standard yaml language configuration, I added dot notation into some strings. Codecopletion is working, but I have troubles in some specific situation.
Do you know where it is a possible to config some detail around language autocompletion?
Description of the video:
write system without selecting it
add . (dot)
suggestion is NOT automatically invoked (vscode client doesn't create request to LSP)
delete .
add .
suggestion is invoke automatically OK
Note that when I select item from suggested items, everything works ok. When I type the string manually (without selecting it) it works odd.
I tried define this in wordPattern but without success.
https://github.com/redhat-developer/vscode-yaml/blob/a9689529c28cfe83c87e0734e3aa0a84994e76fd/language-configuration.json#L37
Another idea is tmLanguage.json, but not sure where to start.
https://github.com/redhat-developer/vscode-yaml/blob/main/syntaxes/yaml.tmLanguage.json
Note that typescript language is working ok
I will appreciate any help
Thanks

Dynamically add VSCode snippets from an extension

I was asking myself recently if it is possible to add snippets to either one of the workspace, language-specific or global json snippet files through a VSCode extension.
// something like
Command.addSnippet('''
{
"prefix": "my_snippt",
.... etc.
}
''')
Reading through the API documentation I did not find anything. If there is no way, how would you go about creating kind of a snippet manager?
You can use SnippetString and a CompletionItemProvider to dynamically suggest snippets.
Here is an example.

How to do a popup

I'm currently working on an vscode extension. I'm trying to understand how I can create a "popup"/"tooltip" like this
.
I would like to know methods that I'm expected to use or an github link for an extension that is doing it.
Thanks
You could use the vscode.languages.registerHoverProvider function (Documentation) to do this.
I wrote a little demo extension that you can see here: https://github.com/ShPelles/vscode-hover-demo.

Get Visual Studio Code snippets scope programmatically using API

Can I get the list of the available scopes for snippets?
Is there any native functionality that would control what files to create and where?
Snippets are scoped to languages and introduced to VS Code as global or local to a workspace. Languages can be contributed to VS Code by exceptions. Typically by declaring a language in the package.json, adding a syntax and snippet files. Update:
Here is the guide how to add a snippet to any language via your extension. If you follow the guide and add a snippet to the current workspace, you will notice that the file with extension .code-snippets gets created under the .vscode folder in the workspace. Therefore you can enumerate all such files using the vscode.workspace.workspaceFolders and fs.readDir APIs.
vscode.workspace.workspaceFolders!.forEach(workspaceFolder => {
const snippetFiles = fs.readdirSync(path.join(workspaceFolder.uri.fsPath, '.vscode'))
.filter(el => /\.code-snippets$/.test(el));
});
Similarly, the global snippets get added as .code-snippets files into the user profile folder - on Windows it looks like this: C:\Users\currentUser\AppData\Roaming\Code\User\snippets\*.code-snippets. Both locations you can scan for *.code-snippets files as well as programmatically add such files to those folders.
Here is the documentation how to add snippets to a scope via a file. There does not seem to be any public API to enumerate all such snippet files in a programmatic way.
But if you want to retrieve list of the languages in the screenshot you posted, use this API:
vscode.languages.getLanguages()
It could help if you explained what are you trying to achieve. Do you want to find where a particular snippet is coming from to change it? Do you want to add a snippet to a language in this list? Or to a language that is not on this list?

Phpfox Register Page Plugin Call

Can someone please explain this piece of code works in phpfox {plugin call='user.template_default_block_register_step2_7'}
Thanks in advance.
plugins are works in phpfox as a hook.
to add your custom code with in default phpfox system without changing any file we used plugin.
{plugin call='user.template_default_block_register_step2_7'}
to use this plugin you must create a file name user.template_default_block_register_step2_7.php
in any module even in your custom module.
what ever you write in this file it's automatically added where this plugin call.
you can add multiple plugin with same name in different module.
plugin file path
module_name/include/plugin/
It will include a block file in the following location,that block file has the registration page.
www/projectname/Module/user/template/default/block/register/step2.html