[Geany-Devel] [Geany-devel] Fix autocompletion for CSS files

Colomban Wendling lists.ban at herbesfolles.org
Sat Oct 6 12:30:55 UTC 2012


Le 05/10/2012 07:58, Thanh Tran a écrit :
> Hi guys,
> I'm a front-end web developer and I enjoy using Geany so much. Currently
> with some global tags files and minor filetypes tweak, I'm able to code
> HTML & JavaScript quite comfortably. 
> However, it is still a pain to make use of the global tag completion in
> CSS since Geany doesn't recognize minus/short dash "-" character as a
> word character and terminate the auto completion hint box as soon as I
> type the "-" character. Another issue with this is experimental vendor
> prefixed properties (for e.g: -webkit-filter) are not hinted if I don't
> remove the initial "-".

I fixed this one (and you did it correctly -- at least as correctly as
we do now).  And you're right, it gives a way better CSS experience :)

> I'm not an experienced C/C++ developer so I avoided touching Geany
> source code as much as possible. But for this one I have to tinker with
> the source and was able to fix the issue with some quick edits. I'm
> aware that my edits might break things and are not root cause solutions.
> So I'm hoping that you guys can help fix it. My edits whi ch I'm sharing
> here are just to get the ideas:
> https://github.com/trongthanh/geany/commit/35d782ce584006d5570657b08cf2be3ca5e9635e
> https://github.com/trongthanh/geany/commit/da01cf86ff09b5ac5c083b7dd05b6770fbf6c9bf
> Besides, my edits also add colon ":" as trigger character to show the
> calltip (in CSS ONLY of course) so that it will display useful
> information to set value for the CSS property. (see attachment). With a
> full CSS tags file, the autocompletion and the calltip will greatly
> enhance CSS coding experience in Geany. Again, this is just my proposal.

This may be interesting, though I'm not 100% sure it fits that well in
Geany's core, it might be too specific -- and although it's not strictly
speaking a problem, things should rather either be general-purpose,
configurable or provided with language-specific goodies.  I'll take a
look at it.

BTW, I'm not aware of any CSS tag file that includes the properties'
descriptions, do you have one?  And if yes, would you mind providing it
for other to use it, e.g. on our wiki?  :)

> In another note, I already tried adding "-" to wordchars settings in
> filetypes.css and use editor_find_current_word_sciwc() but it is only
> effective if I r emove the dash in whitespace_chars in filetypes.common.
> The risk of breaking things by changing the filetypes.common is too
> great that I can't use that function. But ultimately, I have a feeling
> that current Geany hasn't use everything Scintilla providing and is not
> flexible enough when handling word chars & white space chars.

The problem is that our filetypes.common's whitespace_chars overrides
every wordchars -- even filetype-specific ones.  I fixed this in the Git
for wordchars to take precedence over whitespace_chars, which actually
seems more natural and more useful to me too.

Actually Scintilla classifies 4 kinds of characters: newlines, spaces
words and punctuation.  We only define spaces and words.  I'm not sure
if we should rather set punctuation, or if we should provide a setting
for it, I don't know correctly enough what Scintilla does with those to
decide.  Word is pretty obvious -- and documented -- but the other three
seems more vague.

Anyway, it should be better now.

> Anyway, I'm pretty happy with Geany right now and believe that Geany can
> be better than commercialized one like SublimeText which I think is
> overrated.

He he, thanks!


More information about the Devel mailing list