Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-09

Find declaration bug?

8 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

patspiper

Hi,

I am not sure if this is the intended behaviour, and hence my post.

Under Ubuntu 11.04:

Create a new project, set its Target OS (Code Generation) to win32 and set LCLWidgetType to Win32 in IDE Macro Values. Add unit seri and try autocomplete. Code Tools will not suggest anything as expected since the FPC serial unit is unix only. Complete it manually to serial. Hovering the mouse over 'Serial' will show the hint:
unit
Serial
/home/me/Programs/fpc/fpsrc/exported/2.6.1/rtl/unix/serial.pp(5,6)

Right clicking / Find Declaration will open the serial unit, when it is not available for Win32. Right click/Open File at Cursor opens it too as expected. Should Find Declaration open it in the first place?

Stephano

Reply by email

Mark Morgan Lloyd
to patspiper
patspiper wrote 18 lines
Hi, I am not sure if this is the intended behaviour, and hence my post. Under Ubuntu 11.04: Create a new project, set its Target OS (Code Generation) to win32 and set LCLWidgetType to Win32 in IDE Macro Values. Add unit seri and try autocomplete. Code Tools will not suggest anything as expected since the FPC serial unit is unix only. Complete it manually to serial. Hovering the mouse over 'Serial' will show the hint: unit Serial /home/me/Programs/fpc/fpsrc/exported/2.6.1/rtl/unix/serial.pp(5,6) Right clicking / Find Declaration will open the serial unit, when it is not available for Win32. Right click/Open File at Cursor opens it too as expected. Should Find Declaration open it in the first place?

I submitted a patch which added Windows support about a year ago. Hasn't been applied.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

patspiper
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 23 lines
patspiper wrote: > Hi, > > I am not sure if this is the intended behaviour, and hence my post. > > Under Ubuntu 11.04: > > Create a new project, set its Target OS (Code Generation) to win32 > and set LCLWidgetType to Win32 in IDE Macro Values. Add unit seri and > try autocomplete. Code Tools will not suggest anything as expected > since the FPC serial unit is unix only. Complete it manually to > serial. Hovering the mouse over 'Serial' will show the hint: > unit > Serial > /home/me/Programs/fpc/fpsrc/exported/2.6.1/rtl/unix/serial.pp(5,6) > > Right clicking / Find Declaration will open the serial unit, when it > is not available for Win32. Right click/Open File at Cursor opens it > too as expected. Should Find Declaration open it in the first place? I submitted a patch which added Windows support about a year ago. Hasn't been applied.

The issue here is not the serial unit, but rather the Find Declaration behaviour.

Regarding your windows serial unit patch, you should check on the FPC list especially that a windows equivalent is logically needed. Moreover, IIRC, there was somebody else who submitted such a unit.

Stephano

Reply by email

Mattias Gaertner
to patspiper: I am not sure if this is the intended behaviour, and hence my post. Under Ubuntu 11.04:…
Show quoted text 18 lines
Hi, I am not sure if this is the intended behaviour, and hence my post. Under Ubuntu 11.04: Create a new project, set its Target OS (Code Generation) to win32 and set LCLWidgetType to Win32 in IDE Macro Values. Add unit seri and try autocomplete. Code Tools will not suggest anything as expected since the FPC serial unit is unix only. Complete it manually to serial. Hovering the mouse over 'Serial' will show the hint: unit Serial /home/me/Programs/fpc/fpsrc/exported/2.6.1/rtl/unix/serial.pp(5,6) Right clicking / Find Declaration will open the serial unit, when it is not available for Win32. Right click/Open File at Cursor opens it too as expected. Should Find Declaration open it in the first place?

This feature allows to explore code for non installed target platforms. Maybe this can be made optional.

Mattias

Reply by email

patspiper
to Mattias Gaertner
Mattias Gaertner wrote 23 lines
On Sat, 29 Sep 2012 22:33:34 +0300 patspiper wrote: > Hi, > > I am not sure if this is the intended behaviour, and hence my post. > > Under Ubuntu 11.04: > > Create a new project, set its Target OS (Code Generation) to win32 and > set LCLWidgetType to Win32 in IDE Macro Values. Add unit seri and try > autocomplete. Code Tools will not suggest anything as expected since the > FPC serial unit is unix only. Complete it manually to serial. Hovering > the mouse over 'Serial' will show the hint: > unit > Serial > /home/me/Programs/fpc/fpsrc/exported/2.6.1/rtl/unix/serial.pp(5,6) > > Right clicking / Find Declaration will open the serial unit, when it is > not available for Win32. Right click/Open File at Cursor opens it too as > expected. Should Find Declaration open it in the first place? This feature allows to explore code for non installed target platforms. Maybe this can be made optional.

The feature is handy indeed. One question arises though: If the unit is different for several other target platforms, which one would be opened?

I can see the following possibilities:
- Keep it as it is
- Make it an optional setting
- Find Declaration looks for units only in the path while Open File at Cursor opens the unit even if it is not in the path
- Find Declaration presents a list of targets for which this unit exists for the user to choose from (if it does not exist for the current target)

Stephano

Reply by email

Mattias Gaertner
to patspiper
Show quoted text 11 lines
[...] > This feature allows to explore code for non installed target platforms. > Maybe this can be made optional. The feature is handy indeed. One question arises though: If the unit is different for several other target platforms, which one would be opened? I can see the following possibilities: - Keep it as it is - Make it an optional setting - Find Declaration looks for units only in the path while Open File at Cursor opens the unit even if it is not in the path

That means almost all codetools won't work because of "unit not found".

- Find Declaration presents a list of targets for which this unit exists for the user to choose from (if it does not exist for the current target)

I guess there is no FPC devel that knows that for all sources.

Mattias

Reply by email

patspiper
to Mattias Gaertner
Mattias Gaertner wrote 15 lines
On Sun, 30 Sep 2012 12:16:51 +0300 patspiper wrote: > [...] >> This feature allows to explore code for non installed target platforms. >> Maybe this can be made optional. > The feature is handy indeed. One question arises though: If the unit is > different for several other target platforms, which one would be opened? > > I can see the following possibilities: > - Keep it as it is > - Make it an optional setting > - Find Declaration looks for units only in the path while Open File at > Cursor opens the unit even if it is not in the path That means almost all codetools won't work because of "unit not found".

Maybe I chose the wrong terminology. By path I meant files/folders usable/accessible for a certain target. For example the serial unit is in <folder>/rtl/unix and will not be reachable for win32 targets. Find Declaration will fail with unit not found whereas Open File at Cursor will open it.

> - Find Declaration presents a list of targets for which this unit exists > for the user to choose from (if it does not exist for the current target) I guess there is no FPC devel that knows that for all sources.

It could be a list of paths instead.

Anyway, IMHO the logical choice is for Find Declaration to fail when looking for serial.pp for win32, and allow Open File at Cursor to open it. In case Open File at Cursor finds several paths leading to the same file, it could present a list of these for the user to choose.

Stephano

Reply by email

Mattias Gaertner
to patspiper
Show quoted text 21 lines
On 30/09/12 20:09, Mattias Gaertner wrote: > On Sun, 30 Sep 2012 12:16:51 +0300 > patspiper wrote: > >> [...] >>> This feature allows to explore code for non installed target platforms. >>> Maybe this can be made optional. >> The feature is handy indeed. One question arises though: If the unit is >> different for several other target platforms, which one would be opened? >> >> I can see the following possibilities: >> - Keep it as it is >> - Make it an optional setting >> - Find Declaration looks for units only in the path while Open File at >> Cursor opens the unit even if it is not in the path > That means almost all codetools won't work because of "unit not found". Maybe I chose the wrong terminology. By path I meant files/folders usable/accessible for a certain target. For example the serial unit is in <folder>/rtl/unix and will not be reachable for win32 targets. Find Declaration will fail with unit not found whereas Open File at Cursor will open it.

Yes, I understood right. Many codetools will cease to work.

Show quoted text 9 lines
>> - Find Declaration presents a list of targets for which this unit exists >> for the user to choose from (if it does not exist for the current target) > I guess there is no FPC devel that knows that for all sources. It could be a list of paths instead. Anyway, IMHO the logical choice is for Find Declaration to fail when looking for serial.pp for win32, and allow Open File at Cursor to open it. In case Open File at Cursor finds several paths leading to the same file, it could present a list of these for the user to choose.

Sometimes it helps to switch from the simple example of one unit to the more complex example of having a project that uses indirectly many units.

Mattias

Reply by email