Skip to content

Clarify function list descriptions #759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions content/docs/config-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,23 +303,22 @@ Defines what counts as a "function" for **View > Function List**. There are some

### Function List Definitions

The `functionList` folder contains a separate XML file (function list parse rule) for each language's function list capability.
Each function list parse rule links to a language with the language default name. For example the file name of php language parse rule is `php.xml`, the file name of Java language parse rule is `java.xml`, Check [overrideMap.xml](https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/installer/functionList/overrideMap.xml) for the naming list of all supported programming languages.
The `functionList` folder contains a separate XML file (function list parser definition) for each language's function list capability. Each function list parser definition links to a language with the language default name. For example the file name of php language parse rule is `php.xml`, the file name of Java language parse rule is `java.xml`, Check [overrideMap.xml](https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/installer/functionList/overrideMap.xml) for the naming list of all supported programming languages.

[overrideMap.xml](https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/installer/functionList/overrideMap.xml) is optional. When you need to override a default parser rule or to define a function list parser for your User Defined Language (UDL), you modify this file.
For built-in languages that already have Function List behavior, editing [overrideMap.xml](https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/installer/functionList/overrideMap.xml) is optional: if you edit the existing `functionList\XYZ.xml` for that language, you don't need to edit `overrideMap.xml`; however, if you create a new `functionList\my_XYZ.xml` that you want to use instead of the default function list definition for XYZ, then you need to copy the an `<association id="{filename.xml}"... />` for language XYZ from inside the `<!-- ... -->` comment block, paste it outside that block, and point the to the new file using `id="my_XYZ.xml`. If you need to link to a function list parser name "udl_ABC.xml" for your User Defined Language (UDL) named "ABC", you need to modify this file to add an `<association id="udl_ABC.xml" userDefinedLangName="ABC">` : the `id` must match the filename exactly, and the `userDefinedLangName` must match the name of your UDL, as seen in the **Language** menu and UDL dialog.

- Override a default parser rule examples
```
<association id= "anotherPhpParser.xml" langID= "1" />
<association id= "myPerlRule.xml" langID= "21"/>
```
If 2 above lines are in *overrideMap.xml*, function list will load your parsers `anotherPhpParser.xml` and `myPerlRule.xml` instead of loaoding `php.xml` and `perl.xml` while showing PHP and Perl function list respectively.
- Example: Override default parser definition files for two languages:
```
<association id= "anotherPhpParser.xml" langID= "1" />
<association id= "myPerlRule.xml" langID= "21"/>
```
If those two are in `overrideMap.xml` (and not commented out), then function list will load your parsers `anotherPhpParser.xml` and `myPerlRule.xml` instead of loaoding `php.xml` and `perl.xml` while showing PHP and Perl function lists, respectively.

- Define your UDL example
```
<association id= "krl.xml" userDefinedLangName="KRL"/>
```
Here you define a parser rule file name for your KRL UDL. When you open a file which is recognized as a KRL file, then the function list engine will load `functionList\krl.xml` to show the KRL function list. If you have no KRL UDL defined in your Notepad++, you have to define a dummy one (with the name "KRL") to make it work.
- Example: Set the parser definition file for your UDL called "KRL":
```
<association id= "krl.xml" userDefinedLangName="KRL"/>
```
Here you define a parser rule file name for your KRL UDL. When you open a file which is recognized as a KRL file, then the function list engine will load `functionList\krl.xml` to show the KRL function list. If you have no KRL UDL defined in your Notepad++, you have to define a dummy one (with the name "KRL") to make it work.

The `functionList\`_languagename_`.xml` parser file itself, whether it's for a builtin language or a UDL-based language, requires the structure `<NotepadPlus><functionList><parser...>...</parser></functionList></NotepadPlus>`, where the attributes and contents of the `<parser>` are described in the documents section about [How to Customize Function List](../function-list/#how-to-customize-function-list). You can look at any of the [default parser files](https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/installer/functionList/) for examples of working Function List configurations.

Expand Down
4 changes: 2 additions & 2 deletions content/docs/function-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ A mixed parser contains a Class parser (`classRange` node) and a Function parser
## Manually verify that your parser works for you
Once you finish defining your parser, save and name the file as the language name with `xml` as file extension to the `functionList` folder in order to make it work with the language you want. (Check [overrideMap.xml](https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/installer/functionList/overrideMap.xml) for the naming list of all supported programming languages.) Then load a file that uses that parser, and make sure it finds all the functions that you expect, in the appropriate classes.

## Use your own personal function list definition for a built-in language
If you do not like the results of the default Function List parser that ships with Notepad++ for a particular language, feel free to write your parser rule then save with a unique filename (like `my_languagename.xml`). (_Note_: if you edit the existing `languagename.xml`, the next update may erase your changes.) Use your [overrideMap.xml](https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/installer/functionList/overrideMap.xml) in the functionList directory to override the default mapping of functionList parser rule files, or to add a mapping to new UDL parser rule files, as described in the [function list config files](../config-files/#function-list) section of the manual.
## Use your own personal function list definition for a built-in language or UDL
If you do not like the results of the default Function List parser that ships with Notepad++ for a particular language, feel free to write your parser rule then save with a unique filename (like `my_languagename.xml`). (_Note_: if you edit the existing `languagename.xml`, the next update may erase your changes.) Use your [overrideMap.xml](https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/installer/functionList/overrideMap.xml) in the functionList directory to override the default mapping of functionList parser rule files and point to your new definition file, or to add a mapping to new UDL parser rule files, as described in the [function list config files](../config-files/#function-list) section of the manual.

## Validating Function List definition files

Expand Down