Page 1 of 1

QC support for Notepad++

Posted: Thu May 05, 2016 6:31 am
by mankrip
This tutorial will allow Notepad++ to populate the Function List with QC functions.

The functions needs to be in one of the following formats; semicolons are optional:

Code: Select all

void example () { };

void example () = { };

void example () = [$framemacro, thinkfunction] {};
It won't work for functions in the formats void () example = {}; and void () example {}; yet.



Go to the folder where Notepad++ is installed, and open the file functionList.xml .

Insert this line before the line </associationMap>:

Code: Select all

			<association userDefinedLangName="QuakeC" id="qc_function"/>

		</associationMap>
Now, insert this section before the line </parsers>:

Code: Select all

			<parser id="qc_function" displayName="QuakeC" commentExpr="((/\*.*?\*)/|(//.*?$))">
				<function
				    mainExpr="^[\t ]*((static|const|virtual)[\s]+)?[\w:]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+)([\w_]+[\s]*::)?(?!(if|while|for))[\w_]+[\s]*\([^\)\(]*\)([\s]*const[\s]*)?[\n\s]*[=\[\{]"
					displayMode="$functionName">
					<functionName>
						<nameExpr expr="(?!(if|while|for))[\w_~]+[\s]*\("/>
						<nameExpr expr="(?!(if|while|for))[\w_~]+"/>
					</functionName>
				</function>
			</parser>
			
		</parsers>


And here's a file for syntax highlighting. Right-click on this link and choose the "Save link as..." context menu item: NotepadPlusPlus_QC_highlighting.

Some notes on this syntax highlighting file:

- It includes a hack to highlight preprocessor directives. FrikQcc 2.6 supports these: #include #includelist #define #undef #ifdef #ifndef #else #endif #pragma #warning #error.
- Since builtins can be freely named, standard builtin functions' names are in regular color, but in bold format.
- Constants are in green; this includes variables usually treated as constants, like MOVETYPE_WALK.
- Constant strings have a background color to help tracking them across whitespaces, and vectors are underlined for the same reason.
- Flow control commands (switch case default if else break return do while) use a specific color to make it easier to track instruction flow.
- System globals are in bold dark blue, and system fields are in regular dark blue.
- System global functions and system field functions (.void) are in regular blue.
- Data types are in light blue, to help them stand out.
- Operators and separators are in red. The contrast between red, blue and black makes the separators easier to notice, while being easy on the eyes.
- Line comments have a yellow background, but multi-line comments doesn't, because colored backgrounds on multiline comments is distracting when in header-style text. To compensate for this, multi-line comments are in bold gray.
- Macro sections are in bold with a slightly dark blue color, to differentiate their operators from regular ones.

Re: QC support for Notepad++

Posted: Thu May 05, 2016 1:28 pm
by ceriux
nice, i always just used it with the C based settings or just used qcide -.-

Re: QC support for Notepad++

Posted: Fri May 06, 2016 1:26 am
by toneddu2000
I think I love you :biggrin: I was waiting this for a looong time since Notepad++ is my only tool to write qc code. As soon I can get my pc back I'll post my impressions

Thanks for sharing mankrip

Re: QC support for Notepad++

Posted: Mon May 23, 2016 11:06 pm
by c0burn
Very nice, thank you

Re: QC support for Notepad++

Posted: Tue May 24, 2016 8:13 am
by toneddu2000
Tried it. Very cool the fact notepad++ recognize now .qc files and use directly highlight syntax.
Not so sure I like builtins only in bold black, probably I'd have preferred a blue-ish color but I cannot thank you enough for the great work!

Re: QC support for Notepad++

Posted: Thu May 26, 2016 4:37 am
by frag.machine
Image

This is my Notepad++ custom config for QuakeC.
Besides the different color setup, I added support to dpextensions.qc builtins (with a different color from standard QuakeC builtins) plus some constants.
It's not hard to do actually, just a tedious work in progress. :)