Page 1 of 4

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

Posted: Mon Jan 10, 2011 2:13 am
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

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

Posted: Mon Jan 10, 2011 3:43 am
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")

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

Posted: Mon Jan 10, 2011 3:47 am
by IdeasVacuum
Column editing like UltraEdit.

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

Posted: Mon Jan 10, 2011 4:46 am
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 :(

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

Posted: Mon Jan 10, 2011 7:04 am
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

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

Posted: Mon Jan 10, 2011 12:09 pm
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.

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

Posted: Mon Jan 10, 2011 12:21 pm
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.

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

Posted: Mon Jan 10, 2011 4:59 pm
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.

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

Posted: Mon Jan 10, 2011 5:40 pm
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)

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

Posted: Mon Jan 10, 2011 6:25 pm
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

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

Posted: Mon Jan 10, 2011 9:05 pm
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:

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

Posted: Tue Jan 11, 2011 1:04 am
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



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

Posted: Thu Jan 20, 2011 4:52 pm
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.

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

Posted: Mon Jan 24, 2011 9:28 pm
by Mohawk70
IdeasVacuum wrote:Column editing like UltraEdit.
I second this one !

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

Posted: Mon Jan 24, 2011 9:29 pm
by Mohawk70
skywalk wrote: 3. Create executables without prompts.
Set the appropriate dialog entries and go.
Automation_MenuCommand("Compiler:Create executable: this.exe")
+1