Allow us to disable highlighting/correction of keywords

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Allow us to disable highlighting/correction of keywords

Post by Mistrel »

I would like to disable List and Map as keywords as I want to use my own variables with these names as lower-case and have them not automatically case correct or appear colored (which is confusing).

A possible solution would be to allow prefixing a '-' in the custom keywords list to identify which ones to remove.

So:

Code: Select all

SomeKeyword <- Add
-List <- Remove
-Map <- Remove
I would like to use my own keywords "AsList" and "AsMap" which are actually macros to "List" and "Map" as replacements. This would allow me to have nicely colored keywords for procedure arguments and also free up these two keywords for use with variables. I often use "list" and "map" as short and succinct variable names in other languages but I can't really do this well from the PureBasic IDE due to them being built-in keywords.
User avatar
STARGÅTE
Addict
Addict
Posts: 2085
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Allow us to disable highlighting/correction of keywords

Post by STARGÅTE »

>> Allow us to disable highlighting/correction of keywords

Both is possible:

https://www.purebasic.com/documentation ... ences.html
[x] Enable bolding of keywords
If your font does not display bold characters in the same size as non-bold ones, you should disable this option. If disabled, the keywords will not be shown as bold.

[x] Enable case correction
If enabled, the case of PureBasic keywords, PureBasic Functions as well as predefined constants will automatically be corrected while you type.
Image

Image
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: Allow us to disable highlighting/correction of keywords

Post by Mistrel »

I like highlighting keywords and case correction. I only want to disable it for certain keywords.
User avatar
Derren
Enthusiast
Enthusiast
Posts: 313
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Allow us to disable highlighting/correction of keywords

Post by Derren »

Add them to the list of custom keywords and use the same format as for variables in the dialog STARGATE posted.

downside: If you decide to use "LIST" in another project, it will be corrected to lower case (or however you wrote it in the list of custom keywords), also you can't have any other custom keywords or syntax highlighting for those anymore, of course...

I tried to find the Keywords in the resident file, but couldn't. Apparently those are hardcoded or hidden somewhere else.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: Allow us to disable highlighting/correction of keywords

Post by Mistrel »

Derren wrote:I tried to find the Keywords in the resident file, but couldn't. Apparently those are hardcoded or hidden somewhere else.
I had the same idea. I'm pretty sure that it's hard-coded into the IDE (PureBasic.exe). The trick is that it's probably UTF-16 so you have to use a UTF-aware hex editor search for it. There are a lot of instances of the word "list" and I haven't found the right one yet.
Post Reply