Hi,
Is there any way to get auto-completion for words from other files than the file I am currently working on?
I’d want to auto complete CSS classes / IDs when working on php files.
Thank you.
Hi,
Is there any way to get auto-completion for words from other files than the file I am currently working on?
I’d want to auto complete CSS classes / IDs when working on php files.
Thank you.
Since I’m not a PHP dev, could you answer a quick question(s)?
In your PHP, do you indicate the name of the css file anywhere (for example: UseThisAsCSS = "style.css), or does it look at anything in your directory that ends in .CSS?
EDIT: How is your project structure set up? (are php and css in the same directory)?
Hi C0D312,
The plugin would be great!
[quote=“C0D312”]
In your PHP, do you indicate the name of the css file anywhere (for example: UseThisAsCSS = "style.css), or does it look at anything in your directory that ends in .CSS?
EDIT: How is your project structure set up? (are php and css in the same directory)?[/quote]
I use this feature in PHPdesigner when working on WordPress projects. I think it looks for .css files and scans directories recursively i.e it doesn’t matter where the css files are.
But if it is a problem, scanning directory of the current file (or using .css from the same directory) should be enough for the start
I already had a plugin that did something similar so I just made some modifications. Since I’m not positive what your looking for just let me know if there’s something you’d like me to change. I put the plugin on Github: https://github.com/BoundInCode/CSS-completion-for-PHP because it uses several files and so anyone can make a change if they need to.
Usage: in a PHP file, press ‘#’ to open the autocomplete box which lists all the classes and ids from your css file (in the current directory). Let me know if it should be in a different directory.
Enjoy. Hope this helps!
wow it was quick
Thank you!
I copied the plugin into the packages folder. Pressing ‘#’ didn’t open auto-completion box… I tried to remap the ‘#’ to something else but still no success.
Did I miss something? Any dependencies?
EDIT:
<?php ...here it works... ?>
when I have code like this
?> <div class="[here I'd like to open auto-compl. box]"></div> <?php
nothing happens
It scans only first .css file found in directory
the classes and ids should be printed without ‘.’ or ‘#’
like ‘myclass’, not ‘.myclass’
Thank you
EDIT: That was a lot easier to fix than I thought. See the new version here: https://github.com/BoundInCode/CSS-completion-for-PHP
Magnifique!
We have a brand new plugin!
Now I am going to look at some regex tutorial and play with your plugin (it prints classes with empty space after word).
btw is there any way to avoid showing duplicated classes and ids (words)?
Thank you so much C0D312.
It didn’t work.
When I removed this line, the autocompl. box appeeared but with duplicated words.
completions = list(set(completions))
Sorry that was my bad… It should be fixed now. Let me know. https://github.com/BoundInCode/CSS-completion-for-PHP