Interesting observation: Jump to Procedure.

Working on new editor enhancements?
Axolotl
Addict
Addict
Posts: 853
Joined: Wed Dec 31, 2008 3:36 pm

Interesting observation: Jump to Procedure.

Post by Axolotl »

I'm currently testing the latest beta version, 630b2. (Checked it with 620 as well)

I've noticed the following:
The IDE does not jump to the procedure of the included file, but to the procedure in the first loaded file.
Maybe this is old news, in which case I apologize for bringing up old stories.

If you want to try it yourself ...
Steps to reproduce:
1. open different source files <<IncFile1.pbi, IncFile2.pbi,...,IncFileN.pbi>> with the same procedure definition. e.g. <<Procedure Test()>>
2. include <<XIncludeFile "IncFileN.pbi">> the last file from the open files. (The tab on the far right)
3. use/call the procedure <<Test()>> in another file <<main.pb>>
4. CTRL + Double-Left-Mouse-Click on the procedure.
5. Check on the activated file.

Question: Which file is expected to be activated?
For me, it is not the included file but the first file that the IDE has read.

This should be kept in mind when calling procedures using CTRL + Double-Left-Mouse-Click.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
User avatar
skywalk
Addict
Addict
Posts: 4223
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Interesting observation: Jump to Procedure.

Post by skywalk »

Did you try the same using projects?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Axolotl
Addict
Addict
Posts: 853
Joined: Wed Dec 31, 2008 3:36 pm

Re: Interesting observation: Jump to Procedure.

Post by Axolotl »

I haven't gathered any insights. I don't use projects.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
User avatar
skywalk
Addict
Addict
Posts: 4223
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Interesting observation: Jump to Procedure.

Post by skywalk »

Ok, like you, I don't use projects. But, I do create my own namespaces with prefixing.
ml_dosomething()
nl_dosomething()
This allows amalgamated code without worry of conflicts.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Axolotl
Addict
Addict
Posts: 853
Joined: Wed Dec 31, 2008 3:36 pm

Re: Interesting observation: Jump to Procedure.

Post by Axolotl »

@skywalk,
thank you very much for your reply.
Yes, I know what you mean. My "problem" was not related to the compiler (I guess).
It is probably the way how I do coding.
I structure my programs in folders. Sometimes more than one tool/program in the same folder.
Then I (very often) use a common.pbi in this folder for shared constants, macros, functions. So it happens that I have several tools/program source codes and their Common.pbi open. If the same procedure (procedure name) occurs in the Common.pbi files, the above described can happen.
The worst thing that can happen is that you make changes in the wrong common.pbi file...
So, as I already wrote, it's actually my own fault/stupidity.
I just thought that maybe some of you do it the same way or something similar. .....
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
User avatar
skywalk
Addict
Addict
Posts: 4223
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Interesting observation: Jump to Procedure.

Post by skywalk »

Ok, you should reduce global variables to a structured type that will further reduce conflict and your technical debt for remembering scope.

If you have a library for math functions?
Make a structure called math_var and populate it with your focused variables.
For constants, prefix them with #math_myconst1, #math_myconst2 etc.
Same with functions as I mentioned above.
Then xincludefile using a relative path.

Never code with 2 files having same name!
Or any with same global variables either.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply