Hello, I first would like to say that I am a happy user of Geany: it's not to heavy requiring a lot of configuration and start-up time as compared with other IDEs and it's interface is also not cluttered with too many functions. Therefore I use it for coding sessions that exeeed the simple text editing. It is also the only editor that shows also vaiables ant to only functions in the overview on the left side.
I have one question though: Does Geany support or will it support calltips for the following languages: * python like for instance in Editra: http://editra.org/images/preview/Windows/editra_pycomp.png * xhtml * CSS
This would be a perfect killer feature!
Thanks for your good work. Timmie
On Mon, 18 Feb 2008 14:22:01 +0000 (UTC), Tim Michelsen timmichelsen@gmx-topmail.de wrote:
Hi,
I first would like to say that I am a happy user of Geany: it's not to heavy
I have one question though: Does Geany support or will it support calltips for the following languages:
- python like for instance in Editra:
On the screenshot there are not calltips shown but usual symbol autocompletion. This is basically possible with Geany, you just need a file with known symbols(methods) of some common python classes. As you probably might have experienced, Geany already suggests you known methods in the current file while typing. Calltips are even more than this. Calltips mean the whole method/function signature, i.e. the return value and the arguments.
- xhtml
For HTML, we have entity auto completion, e.g. . What else could/should be auto completed?
- CSS
Mainly the same as for Python: it's basically possible but one has to create a list with known common symbols.
Regards, Enrico
On Feb 18, 2008 1:55 PM, Enrico Tröger enrico.troeger@uvena.de wrote:
On Mon, 18 Feb 2008 14:22:01 +0000 (UTC), Tim Michelsen timmichelsen@gmx-topmail.de wrote:
Does Geany support or will it support calltips for the following languages:
On the screenshot there are not calltips shown but usual symbol autocompletion. This is basically possible with Geany, you just need a file with known symbols(methods) of some common python classes. As you probably might have experienced, Geany already suggests you known methods in the current file while typing. Calltips are even more than this. Calltips mean the whole method/function signature, i.e. the return value and the arguments.
I'm not really sure how Geany handles calltips. The docs seem to blur the line between tags and calltips.
NEdit has a calltips feature. The way it works is, each filetype may have an associated calltip file (for Geany, this might be ~/.geany/calltips/<filetype>.tips or something). The calltip file is just a simple text file that has a line or two associated with each symbol you're providing a calltip for.
In the editor, things are set up so if you perform some action (like hovering the mouse over a symbol, or putting the cursor somewhere in a symbol and hitting a key combo) you get popup bubble help (if there's a calltip defined for that symbol).
Having such a simple calltips system could be interesting. Users could write their own calltips files for anything, for example, for commands that they're always forgetting syntax for (for any filetype). Or they could write scripts to parse their own custom formats creating tips files. Seems like this sort feature would be pretty easy to implement as well...
Hm... gets me thinking. Since it could apply to any symbol in general (not just function calls), this sort of feature might be better called "bubbletips" rather than "calltips" (which Geany already seems to have, in some fashion) ...
Tim, is bubbletips the sort of feature you were looking for?
---John
On Mon, 18 Feb 2008 17:52:39 -0500, "John Gabriele" jmg3000@gmail.com wrote:
On Feb 18, 2008 1:55 PM, Enrico Tröger enrico.troeger@uvena.de wrote:
On Mon, 18 Feb 2008 14:22:01 +0000 (UTC), Tim Michelsen timmichelsen@gmx-topmail.de wrote:
Does Geany support or will it support calltips for the following languages:
On the screenshot there are not calltips shown but usual symbol autocompletion. This is basically possible with Geany, you just need a file with known symbols(methods) of some common python classes. As you probably might have experienced, Geany already suggests you known methods in the current file while typing. Calltips are even more than this. Calltips mean the whole method/function signature, i.e. the return value and the arguments.
I'm not really sure how Geany handles calltips. The docs seem to blur the line between tags and calltips.
Calltips are shown with Ctrl-Alt-Space inside a function's argument list, between the "()". They show the whole function signature, including the function's return value and the full argument list. This is a _tip_ on how to _call_ the function.
Tags are just any kind of symbols in source code.These can be functions, (global) variables, preprocessor macros, classes, methods, members, interfaces, whatever (maybe other programing language dependent things).
Having such a simple calltips system could be interesting. Users could write their own calltips files for anything, for example, for commands that they're always forgetting syntax for (for any filetype). Or they could write scripts to parse their own custom formats creating tips files. Seems like this sort feature would be pretty easy to implement
^^^^^^^^^^^^^^^^^^^^^^^^ I'm in doubt whether this is really "pretty easy to implement". Maybe, hopefully, I'm wrong. But
About the general "bubbletips": this can be indeed done without too much effort. there is also some code which takes (in C files) macros and other globally defined stuff and put it in a "user list" (Scintilla term) which looks like and works like the usual symbol auto completion list. However, this code wasn't touched for a very long time and as far as I remember it was never finished by me ;-(. But we could skip the current behaviour of reading some macros and similar unuseful things and instead, read a user's global list(maybe per filetype) of "tips". That is, you create a file with some text per line and each line will be shown in a list inside Geany similar to the usual symbol auto completion. If the above is desired, patches are welcome ;-). I won't work on this in the next months. Even better would be to solve this by a plugin. This is not yet possible due to missing keybinding support and because there is not yet a "char added" signal. Both will come in the near future.
Regards, Enrico
On Mon, 18 Feb 2008 17:52:39 -0500 "John Gabriele" jmg3000@gmail.com wrote:
I'm not really sure how Geany handles calltips. The docs seem to blur the line between tags and calltips.
Calltips can be shown if the filetype language parser can parse argument lists to a function. Currently I think it's only C-like languages that have this (because this is only what CTags has implemented). I'm hoping that over time other languages can have calltips support.
[...]
Having such a simple calltips system could be interesting. Users could write their own calltips files for anything, for example, for commands that they're always forgetting syntax for (for any filetype). Or they could write scripts to parse their own custom formats creating tips files. Seems like this sort feature would be pretty easy to implement as well...
But it would be better if Geany generated the file from source files, without someone having to write it. The advantage to your proposal would be that maybe the user could use some other scripting language instead of writing/extending a parser in C and getting it into Geany. But even then you would probably want some kind of scripting framework for parsing source files (maybe some already exist).
Hm... gets me thinking. Since it could apply to any symbol in general (not just function calls), this sort of feature might be better called "bubbletips" rather than "calltips" (which Geany already seems to have, in some fashion) ...
Can you give some examples?
It sounds interesting, but for now we will probably stay with the current system.
Regards, Nick
On Mon, 18 Feb 2008 14:22:01 +0000 (UTC) Tim Michelsen timmichelsen@gmx-topmail.de wrote:
[...]
I have one question though: Does Geany support or will it support calltips for the following languages:
- python like for instance in Editra:
http://editra.org/images/preview/Windows/editra_pycomp.png
- xhtml
- CSS
As Enrico said, the screenshot shows autocompletion entries. For Python and CSS (and maybe XHTML) you can generate a global tags file which will enable autocompletion for any symbol names that would normally appear in the symbol browser.
See: http://geany.uvena.de/manual/0.13/index.html#tags
Actual calltip support (shown when typing function arguments) for more languages is on the TODO list, but is not a high priority at the moment (ideally someone familiar with each language and C would extend the current parsers).
Regards, Nick
On Feb 19, 2008 8:20 AM, Nick Treleaven nick.treleaven@btinternet.com wrote:
On Mon, 18 Feb 2008 17:52:39 -0500 "John Gabriele" jmg3000@gmail.com wrote: [snip]
Hm... gets me thinking. Since it could apply to any symbol in general (not just function calls), this sort of feature might be better called "bubbletips" rather than "calltips" (which Geany already seems to have, in some fashion) ...
Can you give some examples?
Ok. But just to be clear: I'm talking about a feature separate, distinct from, and in addition to calltips. Maybe the name "bubbletips" is too general, and "symboltips" or "identifiertips", or something else would be more accurate. Anyways, here's an example:
Use case: User is writing a C source code file and keeps forgetting what the difference between functions foob1() and foob2().
Solution: User writes a file named `c_mine.tips` and drops it into `~/geany_tips`. The directory `~/.geany/calltips` contains the tips that come stock with Geany. The `c_mine.tips` file contains the following:
=== snip === foob1 Only call this when the frobnicator is positive.
foob2 Only call this when the frobnicator is negative. === /snip ===
The user then goes to Geany and does "File --> Load tips file..." and chooses `c_mine.tips`. The tips are now available everywhere (while editing any file). Perhaps there were check boxes in the "load tips file" dialog that let you choose to either have the tips work for all filetypes or specific ones, and the user chose "all filetypes".
Now the user is editing, types "foob1" and -- with the cursor somewhere in the foob1 string (or at either end) -- hits a key-combo that makes a bubble pop up which says "Only call this when the frobnicator is positive.". After that, they might then hit the key combo to get the calltip for foob1.
It sounds interesting, but for now we will probably stay with the current system.
Enrico's idea for doing it as a plug-in sounds good. I probably will not do it at the moment. Also, I took a quick peek at plugindata.h (and the geanylua ref doc) and didn't see anything in there about bubbles or popup help.
---John
On Feb 19, 2008 12:31 PM, John Gabriele jmg3000@gmail.com wrote:
geanylua ref doc) and didn't see anything in there about bubbles or popup help.
geany.scintilla("CALLTIPSHOW", geany.caret(), "hello world")
The rest is up to you :-)
- Jeff
I have one question though: Does Geany support or will it support calltips for the following languages:
- python like for instance in Editra:
On the screenshot there are not calltips shown but usual symbol autocompletion. This is basically possible with Geany,
another screen shot from PyDev: http://pydev.sourceforge.net/images/codecompletion/codecompletionattr1.png
For instance Stanis IDE recognises imported modules in python and then provides the namespace as calltip. from easygui import easygui easygui.{msgbox} {choicebox} ...
If I am looking for a feature already implemented then please give me a pointer to it. But again, it will not be possible to create a methods file for every python module in the world...
you just need a file with known symbols(methods) of some common python classes.
How does one create such a file?
As you probably might have experienced, Geany already suggests you known methods in the current file while typing. Calltips are even more than this. Calltips mean the whole method/function signature, i.e. the return value and the arguments.
- CSS
Mainly the same as for Python: it's basically possible but one has to create a list with known common symbols.
again, see above. I expect to have something like: background-color:{color} width{px,|em,etc.}
Actual calltip support (shown when typing function arguments) for more languages is on the TODO list, but is not a high priority at the moment (ideally someone familiar with each language and C would extend the current parsers).
Is there not any library that can be build upon? For instance for syntax highlighting in webpages there is geshi.
Maybe there's something similar for these tag files.
I still don't know how other python IDEs succeed in providing this kind of autocompletion for any module that one imports.
On Wed, 20 Feb 2008 00:28:52 +0100, Tim Michelsen timmichelsen@gmx-topmail.de wrote:
Actual calltip support (shown when typing function arguments) for more languages is on the TODO list, but is not a high priority at the moment (ideally someone familiar with each language and C would extend the current parsers).
Is there not any library that can be build upon?
There is at least one: ctags And we are using this one. But it only supports (at the moment) calltips for C-like filetypes.
I still don't know how other python IDEs succeed in providing this kind of autocompletion for any module that one imports.
I assume they are parsing the python modules in some way and extract the necessary information. (this is only a guess without any knowledge)
Regards, Enrico
On Tue, 19 Feb 2008 20:37:55 +0100, Tim Michelsen timmichelsen@gmx-topmail.de wrote:
I have one question though: Does Geany support or will it support calltips for the following languages:
- python like for instance in Editra:
On the screenshot there are not calltips shown but usual symbol autocompletion. This is basically possible with Geany,
another screen shot from PyDev: http://pydev.sourceforge.net/images/codecompletion/codecompletionattr1.png
For instance Stanis IDE recognises imported modules in python and then provides the namespace as calltip. from easygui import easygui easygui.{msgbox} {choicebox}
These are not calltips, at least not in Geany. You are talking about symbol auto completion. And again, this feature is available but you need some data. At the moment, I'm not sure how to create a tags file for this. Nick, could maybe the --generate-tags be used?
As you probably might have experienced, Geany already suggests you known methods in the current file while typing. Calltips are even more than this. Calltips mean the whole method/function signature, i.e. the return value and the arguments.
- CSS
Mainly the same as for Python: it's basically possible but one has to create a list with known common symbols.
again, see above. I expect to have something like: background-color:{color} width{px,|em,etc.}
I think for CSS a tags list can be created manually, at least for the most common symbols. But it seems symbol auto completion for CSS doesn't work completely. I'll have a look at this.
Regards, Enrico
On Wed, 2008-02-20 at 13:39 +0100, Enrico Tröger wrote:
I still don't know how other python IDEs succeed in providing this kind of autocompletion for any module that one imports.
I assume they are parsing the python modules in some way and extract the necessary information. (this is only a guess without any knowledge)
Maybe using the function "dir":
import os.path dir(os.path)
['__all__', '__builtins__', '__doc__', '__file__', '__name__', '_resolve_link', '_varprog', 'abspath', 'altsep', 'basename', 'commonprefix', 'curdir', 'defpath', 'devnull', 'dirname', 'exists', 'expanduser', 'expandvars', 'extsep', 'getatime', 'getctime', 'getmtime', 'getsize', 'isabs', 'isdir', 'isfile', 'islink', 'ismount', 'join', 'lexists', 'normcase', 'normpath', 'os', 'pardir', 'pathsep', 'realpath', 'samefile', 'sameopenfile', 'samestat', 'sep', 'split', 'splitdrive', 'splitext', 'stat', 'supports_unicode_filenames', 'walk']
Getting function description:
print os.path.isfile.__doc__
Test whether a path is a regular file
But I still don't know how to extract the parameters that any function needs...
Hope this help ;-), I really miss "real autocompletion" in Python.
Tonight I'll take a look inside pydev. Pydev autocompletion is very very good, but I don't have RAM enough for Eclipse at work :-/.
Best Regards!
nat:.
On Wed, 20 Feb 2008 13:39:04 +0100 Enrico Tröger enrico.troeger@uvena.de wrote:
On Tue, 19 Feb 2008 20:37:55 +0100, Tim Michelsen timmichelsen@gmx-topmail.de wrote:
another screen shot from PyDev: http://pydev.sourceforge.net/images/codecompletion/codecompletionattr1.png
For instance Stanis IDE recognises imported modules in python and then provides the namespace as calltip. from easygui import easygui easygui.{msgbox} {choicebox}
These are not calltips, at least not in Geany. You are talking about symbol auto completion. And again, this feature is available but you need some data. At the moment, I'm not sure how to create a tags file for this. Nick, could maybe the --generate-tags be used?
If msgbox and choicebox are things that produce tags if the relevant library source file is loaded, then using --generate-tags and loading the tags file would enable autocompletion for them.
Regards, Nick
On Wed, 20 Feb 2008 00:28:52 +0100 Tim Michelsen timmichelsen@gmx-topmail.de wrote:
Actual calltip support (shown when typing function arguments) for more languages is on the TODO list, but is not a high priority at the moment (ideally someone familiar with each language and C would extend the current parsers).
Is there not any library that can be build upon? For instance for syntax highlighting in webpages there is geshi.
(We already have python syntax highlighting ;-))
I expect there is code that other editors may use for parsing calltips, but it can still be a fair bit of work getting the code to work with something it wasn't designed for. Maybe it doesn't support all the things Geany currently does, so you can't just replace geany_python_parser with some_other_python_parser. A more fundamental problem is the code for Python editors is probably written in Python.
Maybe there is a suitable extension to the CTags Python parser, but I haven't found it.
Just to explain the potential problems ;-)
Regards, Nick
Following John's idea, here is a Lua script to implement some crude "bubbletip" support...
First, create the calltips file: ~/.geany/plugins/geanylua/support/calltips
This syntax for the file is simply pairs of lines, the first line is the identifier and the second is the calltip. for example:
-------------<snip>------------- someword This is the calltip for some word anotherword This is the calltip for another word thirdword This is the calltip for the third word -------------</snip>-------------
Next, make a copy of the script shown below and put it somewhere in your scripts folder, for instance: ~/.geany/plugins/geanylua/show-calltips.lua
-------------<snip>------------- -- @ACCEL@ <Shift><Control>h
if geany.count()==0 then return end
local ds=geany.dirsep local tipfile=geany.appinfo().scriptdir..ds.."support"..ds.."calltips" local token=#geany.word()>0 and geany.word() or geany.text():sub(1,geany.caret()):gsub("(.*%W)(%a%w*)(.*)", "%2")
if not (token and #token>0) then return end
local tips, err=io.open(tipfile) if not tips then geany.message("Can't file tips file!",err) return end
local found=nil for line in tips:lines() do if found then found=line break end if line==token then found=line end end
tips:close()
if found then geany.scintilla("CALLTIPSHOW", geany.caret(), found) end -------------</snip>-------------
And then restart Geany.
Now, when you type any one of the identifiers from the calltips file and then press [Ctrl][Shift]H you should see a calltip for that identifier.
Notes: Identifiers must start with an alphabetic character, followed by zero or more alphanumeric characters. (But the calltip itself can contain puncuation, etc.)
You still need to press [Escape] to get the calltip to disappear when you are done with it.
You can change the first line of the script to something else if you want a different hotkey.
It should also be possible to use different calltips files for different filetypes by testing the .ext field from the geany.fileinfo function, but I will leave that as an exercise for the reader :-)
- Jeff
On Fri, 2008-02-22 at 16:12 -0600, Jeff Pohlmeyer wrote:
Following John's idea, here is a Lua script to implement some crude "bubbletip" support...
First, create the calltips file: ~/.geany/plugins/geanylua/support/calltips
This syntax for the file is simply pairs of lines, the first line is the identifier and the second is the calltip. for example:
-------------<snip>------------- someword This is the calltip for some word anotherword This is the calltip for another word thirdword This is the calltip for the third word -------------</snip>-------------
That could work for the python libraries (standing that will not change very often), but that will not work when I import a "write by myself" library... I still thinks that the solution is using the python's built-in functions for documentation:
import os.path
Getting function description:
print os.path.isfile.__doc__
Test whether a path is a regular file
We could import automatically (dynamically) any library or function that the user imports in his/her code, and access to its __doc__ property whenever he types it. Also, when the user uses an object, we can call the dir function, to give him autocompletion.
The only drawback I see for this approach is that we need to have a python console up (and consuming memory), but just that.
Any ideas for implementing a Proof of Concept?
Best regards,
nat:.