Re: [Lazarus] Code completion question

2016-01-26 Thread Michael Van Canneyt



On Tue, 26 Jan 2016, Graeme Geldenhuys wrote:


On 2016-01-26 22:39, Mattias Gaertner wrote:

Maybe it would be better to show them in the completion box with
some warning marker.


+1 for that idea.


+ !

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Code completion question

2016-01-26 Thread Michael Van Canneyt


Hi,

Just curious: if I ask code completion in a class

TMyClass = Class(TMYParentClass)
Protected
  Procedure Valid|

Cursor is at |. I ask the codetools to complete in order to override a 
method in the parent class. 
It doesn't show a procedure that it I KNOW is present in the parent class.


Then it dawned on me: the procedure exists, but is Public. I changed the
visibility to public, and then I got the procedure.

So: 
do the codetools refuse to show identifiers with less restricted visibility ?

(so in a protected section, I will not get public)

Is this intentional ?

I can imagine it is confusing to the beginner and experienced dev alike...

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Code completion question

2016-01-26 Thread Mattias Gaertner
On Tue, 26 Jan 2016 21:50:43 +0100 (CET)
Michael Van Canneyt  wrote:

> [...]
> do the codetools refuse to show identifiers with less restricted visibility ?
> (so in a protected section, I will not get public)
> 
> Is this intentional ?
> 
> I can imagine it is confusing to the beginner and experienced dev alike...

Please report the bug.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Code completion question

2016-01-26 Thread Vojtěch Čihák

Hi,
 
It is a bug? I know this behaviour for a long time and I always believed it is 
by design.
 
V.
__

Od: Mattias Gaertner <nc-gaert...@netcologne.de>
Komu: <lazarus@lists.lazarus.freepascal.org>
Datum: 26.01.2016 22:46
Předmět: Re: [Lazarus] Code completion question


On Tue, 26 Jan 2016 21:50:43 +0100 (CET)
Michael Van Canneyt <mich...@freepascal.org> wrote:


[...]
do the codetools refuse to show identifiers with less restricted visibility ?
(so in a protected section, I will not get public)

Is this intentional ?

I can imagine it is confusing to the beginner and experienced dev alike...


Please report the bug.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus 
<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Code completion question

2016-01-26 Thread Mattias Gaertner
On Tue, 26 Jan 2016 23:12:51 +0100
Vojtěch Čihák  wrote:

> Hi,
>  
> It is a bug? I know this behaviour for a long time and I always believed it 
> is by design.

FPC gives a warning, so it is bad coding, but it is not forbidden.

Maybe it would be better to show them in the completion box with
some warning marker.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Code completion question

2016-01-26 Thread Ondrej Pokorny

On 26.01.2016 23:12, Vojtěch Čihák wrote:
It is a bug? I know this behaviour for a long time and I always 
believed it is by design.


I also came across it and it confused me for a second as well. Then I 
realized my mistake.


But anyway, you can do it and the code compiles, so CodeTools should 
allow it. During the compilation you get a hint about "overriden method 
has lower visibility [...]", if I remember correctly.


So yes, to avoid confusion I would say the visibility filter is 
unnecessarily restrictive.



+ What bugs me even more is that protected methods are not available 
with the inherited keyword:


procedure TMyClass2.Foo;
begin
  inherited Proc // CodeTools do not list Proc that is in protected 
section of parent class from different unit. It works without the 
"inherited" keyword, though

end;

I have to check why.

Ondrej

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Code completion question

2016-01-26 Thread Graeme Geldenhuys
On 2016-01-26 22:39, Mattias Gaertner wrote:
> Maybe it would be better to show them in the completion box with
> some warning marker.

+1 for that idea.


Regards,
  - Graeme -


My public PGP key:  http://tinyurl.com/graeme-pgp

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Code completion question

2016-01-26 Thread Ondrej Pokorny

On 26.01.2016 23:39, Ondrej Pokorny wrote:
+ What bugs me even more is that protected methods are not available 
with the inherited keyword:


procedure TMyClass2.Foo;
begin
  inherited Proc // CodeTools do not list Proc that is in protected 
section of parent class from different unit. It works without the 
"inherited" keyword, though

end;

I have to check why.


Fixed this one in r51425. Hopefully with no regressions.

Ondrej

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Code completion question

2016-01-26 Thread Ondrej Pokorny

On 26.01.2016 21:50, Michael Van Canneyt wrote:


Just curious: if I ask code completion in a class

TMyClass = Class(TMYParentClass)
Protected
  Procedure Valid|


If you complete it like this:

TMyClass = Class(TMYParentClass)
Protected
  Valid|

CodeTools list it (and also add it correctly as "procedure Valid; 
override;").


So yes, it is a bug.

Ondrej

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Code completion question

2016-01-26 Thread Ondrej Pokorny

On 26.01.2016 21:50, Michael Van Canneyt wrote:

Just curious: if I ask code completion in a class

TMyClass = Class(TMYParentClass)
Protected
  Procedure Valid|


Fixed this one as well in r51426. The methods are shown in gray.
Good night :)

Ondrej

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Code completion question

2013-04-04 Thread Lubos Pintes

Hi,
Say I have unit.pp with interface. Then unit.inc where implementation is.
If I add some method to some class in unit.pp and then use Ctrl+Shift+C, 
where Lazarus adds the skeleton for implementation? Do I need to add 
implementation manually into unit.inc?



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Code completion question

2013-04-04 Thread Mattias Gaertner
On Thu, 04 Apr 2013 09:21:44 +0200
Lubos Pintes pin...@gmail.com wrote:

 Hi,
 Say I have unit.pp with interface. Then unit.inc where implementation is.
 If I add some method to some class in unit.pp and then use Ctrl+Shift+C, 
 where Lazarus adds the skeleton for implementation? Do I need to add 
 implementation manually into unit.inc?

Code completion adds methods near existing methods. Just do completion
for the first method(s). If they are not created in unit.inc, then move
them manually there. The next methods will be added to the unit.inc.

Note:
Code completion currently does not see (does not ask) if a position is
in an include file. It simply adds the first method at the end of the
implementation section.

It's somewhat like Kingdom Builder.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus