Forum > Suggestions

IDE autocompletion: "try except" instead of "try finally"

(1/1)

Fibonacci:
I wish I could choose in the IDE to autocomplete the "try" word with "except end" block, not "finally end". Is this perhaps already there and I dont see it? Or maybe I could report it as an idea for a dropdown list that would let you choose whats your preference.

1) try - finally
2) try - except
3) try - except - finally

EDIT WHILE STILL WRITING THIS. I found a solution :D So NVM!

Use Code Templates.

If anyone is interested the template is here:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---try  try    $Param()  except    $Param()  end$AddSemicolon()finally  $Param()end$AddSemicolon()
Use it in Tools -> Code Templates, also assign a hotkey in Tools -> Options -> Key Mappings

Bonus template:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$Param(VarName) := $Param(TMyClassName).Create;try  try    $Param()  except    $Param()  end$AddSemicolon()finally  $Param(VarName,Sync=1).Free;end$AddSemicolon()

ASerge:

--- Quote from: Fibonacci on October 09, 2024, 06:12:56 am ---I wish I could choose in the IDE to autocomplete the "try" word with "except end" block, not "finally end". Is this perhaps already there and I dont see it? Or maybe I could report it as an idea for a dropdown list that would let you choose whats your preference.

--- End quote ---
It's very strange. In my IDE, these are tryf and trye.

Fibonacci:
Yes, but there is no try-except-finally ;D Two in one. I added "tryef".

ASerge:

--- Quote from: Fibonacci on October 10, 2024, 11:31:04 pm ---Yes, but there is no try-except-finally ;D Two in one. I added "tryef".

--- End quote ---
I usually only use try finally. Try except, including nested - a rarity.

Navigation

[0] Message Index

Go to full version