Controlling the IDE - What features would you like to see?

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Controlling the IDE - What features would you like to see?

Post by freak »

I am in the process of adding an 'Automation'-framework to the IDE. Basically there will be a dll that programs can load that provides functions for controlling the IDE in a simple way (the communication part will be done by the dll).

Obviously I cannot export every piece of functionality from the IDE, as that would be way too much work so I will have to limit the exported features. I'd like to know what kind of features people want for this. So I am now interested in the following:
  • What kind of actions would you like to carry out in the IDE from an external program?
  • What kind of information would you like to query from the IDE.
Let me know what you think and I will see what I can do :wink:


Here is a short test example of what it will look like to load the library, connect to the IDE and have it open the Preferences window:

Code: Select all

If Automation_Initialize()
  Debug "Library initialized"

  If Automation_ConnectToProgram(#PB_Compiler_Home + "PureBasic.exe")
    Debug "Connected to the IDE"
  
    If Automation_MenuCommand("Preferences")
      Debug "Preferences opened"
    Else
      Debug "Error: " + Automation_ErrorMessage()
    EndIf
  
    Automation_Disconnect()
  Else
    Debug "Error: " + Automation_ErrorMessage()
  EndIf

  Automation_Shutdown()
Else
  Debug "Could not load Automation library"
EndIf
quidquid Latine dictum sit altum videtur
User avatar
skywalk
Addict
Addict
Posts: 4210
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Controlling the IDE - What features would you like to se

Post by skywalk »

Whoa! This sounds great.
My goals are to automate lots of redundant keystrokes out of my day. (and nights too) :(

For instance - you have the most excellent "Find in files..." dialog, but it is a lot of keystrokes and eye motion to get the IDE to move to the search result I want. Adding this item to your Automation dll would allow unprompted, decision based jumping.

And I have already mentioned the "change Tab" experience:
a) Mouse - DoubleClick a Project Folder ListBox entry
b) KeyBoard [Ctrl+TAB] or [Ctrl+Shift+TAB]
c) Menu - File - Recent - 1,2,3,etc. as long as they are in the MRU list and in the project.
d) Run Find in File(s)... - then DoubleClick entry in Search Results window.

Automation DLL requests: Not sure of the format you prefer?

1. [Ctrl+G] Goto inputbox to allow entry of line x col x file.
Automation_MenuCommand("Goto:File 2 x Line 410 x Col 25-32")

2. No Prompt Find in files - Results.
Automation_MenuCommand("Find in files: #This")
Automation_MenuCommand("Find in files:Results?") <-- this isn't in a menu

3. Create executables without prompts.
Set the appropriate dialog entries and go.
Automation_MenuCommand("Compiler:Create executable: this.exe")
Last edited by skywalk on Mon Jul 07, 2014 11:35 pm, edited 1 time in total.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Controlling the IDE - What features would you like to se

Post by IdeasVacuum »

Column editing like UltraEdit.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
skywalk
Addict
Addict
Posts: 4210
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Controlling the IDE - What features would you like to se

Post by skywalk »

IdeasVacuum wrote:Column editing like UltraEdit.
I think freak is asking what automation features we want?
You are requesting a new built-in feature in the IDE.
Column editing is a time saver for sure, but while we wait for it, it could be "automated" in a Tool.
And you could replace the text in whatever increment pattern you decide to code.

But(there are a lot of buts), I crash the IDE while attempting to retrieve text from the Scintilla gadget.

pseudo code...
1. Get current column selection <- - - Series of SendMessage_(hSCI)
<- - - I get all garbled "?????"s when I try now.
2. InputRequester("Tool Paster", "Enter replacement char(s):", "")
3. Replace multi-selection <- - - This is now hard to do without SendKeys()

Code: Select all

hSCI = Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))
ri.i = SendMessage_(hSCI, #SCI_GETTEXTLENGTH, 0, 0) + 1
r$ = Space(ri)
ri2 = SendMessage_(hSCI, #SCI_GETTEXT, ri, @r$)  ; <--- WARNING IDE CRASH HERE :(
Little John
Addict
Addict
Posts: 4774
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Controlling the IDE - What features would you like to se

Post by Little John »

Hello freak, thanks a lot for asking this!

Maybe there could be some functions for use by self-written pre-processors?

For example, say we have a program that is going to be pre-processed (by LPP, in this case), and contains an Include statement:

Image

The included file contains a syntax error:

Image

When running the program, we'll get this:

Image


LPP -- like many other pre-processors, I think -- generates temporary files, and the IDE shows the syntax error in such a temporary file. However, the user will have to correct the syntax error not in the temporary file, but in the original one. So it would be nice if we could do something like this (pseudocode):

Code: Select all

On IDE error:
TabName$ = ErrorTabName()      ; name of the tab in which the error occured
ActivateTab(Mid(TabName$, 6))  ; activate a tab of our choice
HighlightLine(ErrorLine())     ; highlight the line with the error in the tab that is now active
CloseTab(TabName$)             ; close the tab which shows the temporary file
If something like that is possible, it would allow to integrate pre-prpcessors more tightly into the IDE, and so would make their usage more comfortable.


Or another idea to achieve the same goal:

Code: Select all

#Tool_TempFile_Prefix = "~Lpp_"
Now if there is an error in a source file whose name begins with this prefix, then the IDE will not open that file, but a file that has the same name, only without that prefix.

Regards, Little John
Last edited by Little John on Sun Jul 31, 2011 9:36 pm, edited 1 time in total.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Controlling the IDE - What features would you like to se

Post by blueznl »

I would like to have a 'shared memory' option, so that a plugin, or an external application, can process 1. what's on screen, 2. what keyword is under the cursor at that moment, and 3. what's selected...

Yeah, I know, external tools can process this information, but I want it real time :-)

Also, I'd like to interact with the source code, ie. the plugin should be able to manipulate the sourcecode without the 'export / import' route that external tools need to take now.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Controlling the IDE - What features would you like to se

Post by Trond »

Return the compilation options saved at the end of the file as a string of parameters that is ready to pass to the compiler.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Controlling the IDE - What features would you like to se

Post by Tenaja »

I'd like to control the SEARCH position... I can't stand that the page scrolls when the text found is only two lines down, and on the screen.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Controlling the IDE - What features would you like to se

Post by Kwai chang caine »

Thanks FREAKS 8)
Is it possible to output the mode of compilation for use with CompilerIf and CompilerEndif it's very very important for all my codes :(

Code: Select all

CompilerIf #PB_CompilerOutput = #PB_Compiler_EXE
 ; Code here
CompilerEndIf

CompilerIf #PB_CompilerOutput = #PB_Compiler_DLL
 ; Code here
CompilerEndIf
Because i use the same code for make DLL or EXE, and i have no way for detecting the mode of compilation dynamically.
The most important case for the time, and for me obviously, is the END, not allowed in a DLL

Code: Select all

ProcedureDLL Function()
 ; Code
EndProcedure 

If Not Function()

 CompilerIf #PB_CompilerOutput = #PB_Compiler_EXE
  End
 CompilerEndIf
 
 CompilerIf #PB_CompilerOutput = #PB_Compiler_DLL
  ProcedureReturn #False
 CompilerEndIf

EndIf
Thanks again and good day 8)
ImageThe happiness is a road...
Not a destination
Little John
Addict
Addict
Posts: 4774
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Controlling the IDE - What features would you like to se

Post by Little John »

Hello KCC!

I don't think that your wish relates to controlling the IDE. :-)
Anyway, you can do what you want easily right now: 8)

Code: Select all

#Compile_To_EXE = #True      ; <== If needed, only change this line!

ProcedureDLL Function()
 ; Code
EndProcedure 

If Not Function()

 CompilerIf #Compile_To_EXE = #True
  End
 CompilerEndIf
 
 CompilerIf #Compile_To_EXE = #False
  ProcedureReturn #False
 CompilerEndIf

EndIf
Regards, Little John
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Controlling the IDE - What features would you like to se

Post by Kwai chang caine »

I don't think that your wish relates to controlling the IDE
Oooohh excuse me FREAK and Little john, but i never know really who do what, between compiler and IDE :oops:

Code: Select all

#Compile_To_EXE = #True      ; <== If needed, only change this line!
Yes you are right, it's that i do actually, but sometime i forget to modify the constant after modify the compiler, but if the IDE or Compiler do this at my place no problem to forget
Further more, i'm sure there are several another examples who be more simple, if this compiler constant exist :D
It's often possible to do numerous things manually, see the #PB_Compiler_CompileCount, it's also possible to do this manually

Code: Select all

#PB_Kcc_CompileCount = 5
After

Code: Select all

#PB_Kcc_CompileCount = 6
Etc ... :lol: :lol:
ImageThe happiness is a road...
Not a destination
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Re: Controlling the IDE - What features would you like to se

Post by eddy »

Code: Select all

If Automation_FileCommand("Loaded") Or Automation_TabCommand("Changed")
   
   If Automation_BeforeScintillaNotification(*SciMsg.SCNotification)
      Sci=Automation_CurrentScintilla()
      ;prepare custom styling
      ;prepare smart indent
      ;
   ElseIf Automation_AfterScintillaNotification(*SciMsg.SCNotification)
      Sci=Automation_CurrentScintilla()
      ;apply custom styling to extend common styling
      ;apply smart indent
      ;
   EndIf
   
   If Automation_BeforePasteToScintilla()
      ;prepare custom paste
      ;
   ElseIf Automation_AfterPasteToScintilla()
      ;apply custom paste
      ;apply smart indent
      ;
   EndIf
   
EndIf


Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Controlling the IDE - What features would you like to se

Post by c4s »

I don't know if it belongs here but I'd like to have the possibility to quickly switch between the color schemes either via shortcuts or with a toolbar button.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Mohawk70
Enthusiast
Enthusiast
Posts: 404
Joined: Thu May 11, 2006 1:04 am
Location: Florida, USA

Re: Controlling the IDE - What features would you like to se

Post by Mohawk70 »

IdeasVacuum wrote:Column editing like UltraEdit.
I second this one !
HP Z800 Workstation
CPU : Dual Xeon 5690 3.46GHz
RAM : 96GB RAM ( 8GB x 12 )
PSU : 1100W
GPU : NVIDIA RTX 3050 8GB
STORAGE : 9TB
(4) 2TB Seagate IronWolf Pro HDD
(1) 1TB Samsung 870 EVO SSD
Mohawk70
Enthusiast
Enthusiast
Posts: 404
Joined: Thu May 11, 2006 1:04 am
Location: Florida, USA

Re: Controlling the IDE - What features would you like to se

Post by Mohawk70 »

skywalk wrote: 3. Create executables without prompts.
Set the appropriate dialog entries and go.
Automation_MenuCommand("Compiler:Create executable: this.exe")
+1
HP Z800 Workstation
CPU : Dual Xeon 5690 3.46GHz
RAM : 96GB RAM ( 8GB x 12 )
PSU : 1100W
GPU : NVIDIA RTX 3050 8GB
STORAGE : 9TB
(4) 2TB Seagate IronWolf Pro HDD
(1) 1TB Samsung 870 EVO SSD
Post Reply