Hi,
Here's a small patch that adds support for lambdas in the Python tagmanager. What it does it report Python's lambdas as functions (with arguments) rather than as variables. Nested lambda are supported too.
Attached is the patch (0001-lambda-support.diff) and a small python file that tests it (test.py).
Regards, Colomban
On Thu, 11 Mar 2010 15:29:48 +0100 Colomban Wendling lists.ban@herbesfolles.org wrote:
Here's a small patch that adds support for lambdas in the Python tagmanager. What it does it report Python's lambdas as functions (with arguments) rather than as variables. Nested lambda are supported too.
I haven't tried it but do we really want this? Aren't lambda functions supposed to be short and limited to local scope? We don't parse other local things other than nested functions, but they can be quite long.
Regards, Nick
Am 16.03.2010 18:59, schrieb Nick Treleaven:
I haven't tried it but do we really want this? Aren't lambda functions supposed to be short and limited to local scope? We don't parse other local things other than nested functions, but they can be quite long.
Regards, Nick
Is this intention or unwanted limitation? I ask because I would indeed like to have e.g. the C parser to parse local variables (and of course only show them in the same scope in the tag completition list).
Best regards.
On Tue, 16 Mar 2010 19:07:05 +0100 Thomas Martitz thomas.martitz@student.HTW-Berlin.de wrote:
I haven't tried it but do we really want this? Aren't lambda functions supposed to be short and limited to local scope? We don't parse other local things other than nested functions, but they can be quite long.
Is this intention or unwanted limitation? I ask because I would indeed
We inherited tagmanager/ctags and probably want to maintain some kind of closeness with ctags, which mainly only parses file-level tags (except C, which we haven't ported over to Geany).
But there is an advantage that less memory is used.
like to have e.g. the C parser to parse local variables (and of course only show them in the same scope in the tag completition list).
Whilst this would be nice, another problem is that tagmanager (still?) can't parse tags from a memory buffer, only from disk. So until the user saves the file, they still wouldn't get local tag completion.
All this isn't to say we shouldn't do it, just that there are issues involved.
Regards, Nick
Hi,
Nick Treleaven a écrit :
On Thu, 11 Mar 2010 15:29:48 +0100 Colomban Wendling lists.ban@herbesfolles.org wrote:
Here's a small patch that adds support for lambdas in the Python tagmanager. What it does it report Python's lambdas as functions (with arguments) rather than as variables. Nested lambda are supported too.
I haven't tried it but do we really want this? Aren't lambda functions supposed to be short and limited to local scope? We don't parse other local things other than nested functions, but they can be quite long.
I don't know if lambda are "supposed" to be local, but I personally tend to use them for most of very small functions, regardless they are local or not. But don't trust me for Python's "good practices".
And then, well... I personally see the point for this, but if I'm alone I'd be completely fine just to keep my patch on my local build.
Regards, Colomban
On Tue, 16 Mar 2010 19:23:32 +0100, Colomban wrote:
Hi,
Nick Treleaven a écrit :
On Thu, 11 Mar 2010 15:29:48 +0100 Colomban Wendling lists.ban@herbesfolles.org wrote:
Here's a small patch that adds support for lambdas in the Python tagmanager. What it does it report Python's lambdas as functions (with arguments) rather than as variables. Nested lambda are supported too.
I haven't tried it but do we really want this? Aren't lambda functions supposed to be short and limited to local scope? We don't parse other local things other than nested functions, but they can be quite long.
I don't know if lambda are "supposed" to be local, but I personally tend to use them for most of very small functions, regardless they are local or not. But don't trust me for Python's "good practices".
I'd say if ever lamda's are used as some kind of anonymous functions or just short forms of longer terms. But I also doubt it would be useful to generate tags of them and so list them in the symbol list.
Regards, Enrico
2010/3/17 Enrico Tröger enrico.troeger@uvena.de
On Tue, 16 Mar 2010 19:23:32 +0100, Colomban wrote:
Hi,
Nick Treleaven a écrit :
On Thu, 11 Mar 2010 15:29:48 +0100 Colomban Wendling lists.ban@herbesfolles.org wrote:
Here's a small patch that adds support for lambdas in the Python tagmanager. What it does it report Python's lambdas as functions (with arguments) rather than as variables. Nested lambda are supported too.
I haven't tried it but do we really want this? Aren't lambda functions supposed to be short and limited to local scope? We don't parse other local things other than nested functions, but they can be quite long.
I don't know if lambda are "supposed" to be local, but I personally tend to use them for most of very small functions, regardless they are local or not. But don't trust me for Python's "good practices".
I'd say if ever lamda's are used as some kind of anonymous functions or just short forms of longer terms. But I also doubt it would be useful to generate tags of them and so list them in the symbol list.
Regards, Enrico
IIUC lambdas are anonymous so generating tags would be questionable but scope effects would be useful
Cheers Lex
-- Get my GPG key from http://www.uvena.de/pub.asc
Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
On Tue, 16 Mar 2010 19:23:32 +0100 Colomban Wendling lists.ban@herbesfolles.org wrote:
Here's a small patch that adds support for lambdas in the Python tagmanager. What it does it report Python's lambdas as functions (with arguments) rather than as variables. Nested lambda are supported too.
I haven't tried it but do we really want this? Aren't lambda functions supposed to be short and limited to local scope? We don't parse other local things other than nested functions, but they can be quite long.
I don't know if lambda are "supposed" to be local, but I personally tend to use them for most of very small functions, regardless they are local or not. But don't trust me for Python's "good practices".
Actually maybe I'm wrong, probably lambdas can be used e.g. as class members.
I see that the patch might be useful to show toplevel lambdas in scripts or class member lambdas in the symbol list.
Now committed with above modification, thanks.
Regards, Nick