Update adding a filetype section, make clearer.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2586 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2008-05-14 16:44:18 +00:00
parent a0337bc281
commit 8fcf2072fe
2 changed files with 22 additions and 10 deletions

View File

@ -33,6 +33,8 @@
* src/document.c: * src/document.c:
Fix line breaking not getting reset for new documents sometimes. Fix line breaking not getting reset for new documents sometimes.
Merge all document default settings into init_doc_struct(). Merge all document default settings into init_doc_struct().
* HACKING:
Update adding a filetype section, make clearer.
2008-05-13 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> 2008-05-13 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

30
HACKING
View File

@ -174,7 +174,8 @@ For tag parsing (e.g. for the symbol list), see 'Adding a TagManager
parser' below. parser' below.
Add GEANY_FILETYPES_FOO to filetypes.h. Add GEANY_FILETYPES_FOO to filetypes.h.
Initialize GEANY_FILETYPES_FOO in filetypes_init_types() of filetypes.c. Initialize GEANY_FILETYPES_FOO in init_builtin_filetypes() of
filetypes.c.
Rebuild Geany. Rebuild Geany.
From your geany/ directory, run: From your geany/ directory, run:
src/geany --generate-data-files src/geany --generate-data-files
@ -186,28 +187,37 @@ you need GEANY_DEBUG to be defined when building Geany for the
--generate-data-files argument to work - this is always defined in the --generate-data-files argument to work - this is always defined in the
SVN version. Alternatively, edit the file by hand. SVN version. Alternatively, edit the file by hand.
filetypes.* configuration file
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
All languages need a data/filetypes.foo configuration file. See All languages need a data/filetypes.foo configuration file. See
data/filetypes.c for an example. For languages with a Scintilla lexer, data/filetypes.c for an example.
there should be a [styling] section, to correspond to the styles used
in styleset_foo().
Programming languages should have: Programming languages should have:
[keywords] if the lexer supports it. [keywords] if the lexer supports it.
[settings] mostly for comment settings. [settings] mostly for comment settings.
[build_settings] for commands to run. [build_settings] for commands to run.
For languages with a Scintilla lexer, there should be a [styling] section,
to correspond to the styles used in styleset_foo() in highlighting.c -
see below.
Syntax highlighting
^^^^^^^^^^^^^^^^^^^
For syntax highlighting, you will need to edit highlighting.c and add For syntax highlighting, you will need to edit highlighting.c and add
the following things: the following things:
1. Write styleset_foo_init() to setup default styles and load style 1. Write styleset_foo_init() to setup default styles and load style
settings from the filetypes.foo configuration file. For details, see settings from the filetypes.foo configuration file. You should probably
styleset_c_init(). start by copying and adapting another filetype's initialization, such
as styleset_asm_init().
2. Write styleset_foo() to apply styles when a new scintilla widget 2. Write styleset_foo() to apply styles when a new scintilla widget
is created. For details, see styleset_c(). is created. Again you could copy and adapt a function like styleset_asm().
3. Add this in highlighting_init_styles(): 3. Add this in highlighting_init_styles():
init_styleset_case(GEANY_FILETYPES_FOO, foo); init_styleset_case(GEANY_FILETYPES_FOO, foo);
4. Add this in highlighting_set_styles(): 4. Add this in highlighting_set_styles():
styleset_case(GEANY_FILETYPES_FOO, foo); styleset_case(GEANY_FILETYPES_FOO, foo);
Other features
^^^^^^^^^^^^^^
Error message parsing is done in msgwin_parse_compiler_error_line() of Error message parsing is done in msgwin_parse_compiler_error_line() of
msgwindow.c. See the ParseData typedef for more information. (In future msgwindow.c. See the ParseData typedef for more information. (In future
this may be done with a regex). this may be done with a regex).
@ -219,13 +229,13 @@ If the lexer has comment styles, you should add them in is_comment()
in editor.c. For now, this prevents calltips and autocompletion when in editor.c. For now, this prevents calltips and autocompletion when
typing in a comment (but it can still be forced by the user). typing in a comment (but it can still be forced by the user).
If the Scintilla lexer supports user type keywords (e.g. SCLEX_CPP), If the Scintilla lexer supports user type keyword highlighting (e.g.
see editor_lexer_get_type_keyword_idx() in editor.c. SCLEX_CPP), update editor_lexer_get_type_keyword_idx() in editor.c.
Adding a TagManager parser Adding a TagManager parser
-------------------------- --------------------------
This assumes the Geany filetype already exists. This assumes the filetype for Geany already exists.
First write or find a CTags compatible parser, foo.c. Note that there First write or find a CTags compatible parser, foo.c. Note that there
are some language patches for CTags at: are some language patches for CTags at: