Revision: 1835 http://geany.svn.sourceforge.net/geany/?rev=1835&view=rev Author: ntrel Date: 2007-08-28 09:15:26 -0700 (Tue, 28 Aug 2007)
Log Message: ----------- Add more complete information for adding a filetype.
Modified Paths: -------------- trunk/ChangeLog trunk/HACKING
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-08-28 15:45:54 UTC (rev 1834) +++ trunk/ChangeLog 2007-08-28 16:15:26 UTC (rev 1835) @@ -6,6 +6,8 @@ doc/geany.html: Add hidden editor preference 'use_gtk_word_boundaries'. Add docs appendix 'Hidden preferences'. + * HACKING: + Add more complete information for adding a filetype.
2007-08-28 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/HACKING =================================================================== --- trunk/HACKING 2007-08-28 15:45:54 UTC (rev 1834) +++ trunk/HACKING 2007-08-28 16:15:26 UTC (rev 1835) @@ -82,7 +82,7 @@ Adding a filetype ----------------- You can add a filetype without syntax highlighting or tag parsing, but check to see if those -features have been written elsewhere. +features have been written in other projects first.
For syntax highlighting, it may be possible to use an existing Scintilla lexer in the scintilla/ subdirectory - if not, you will need to find (or write) one, LexFoo.cxx. Try the Scintilla project @@ -92,6 +92,10 @@
Add GEANY_FILETYPES_FOO to filetypes.h. Initialize GEANY_FILETYPES_FOO in filetypes_init_types() of filetypes.c. +The filetype::style_func_ptr is a callback for setting up styling information. The callback, +styleset_foo(), should be added in highlighting.c. The first time it is called, the configuration +should be loaded in styleset_foo_init(). For more details, see styleset_c(). If there isn't a +Scintilla lexer, use styleset_none(). Rebuild Geany. From your geany/ directory, run: src/geany --generate-data-files @@ -99,9 +103,30 @@ (The src/ prefix may be different, depending on where the binary is generated.) This will update data/filetype_extensions.conf. Note that you need GEANY_DEBUG to be defined when building Geany for the --generate-data-files argument to work - this is always defined in the SVN -version. +version. Alternatively, edit the file by hand.
+Most languages will also need a data/filetypes.foo configuration file. See data/filetypes.c +for an example. For languages with a Scintilla lexer, there should be a [styling] section, to +correspond to the styles used in styleset_foo().
+Programming languages should have: +[keywords] if the lexer supports it. +[settings] mostly for comment settings. +[build_settings] for commands to run. + +Error message parsing is done in msgwin_parse_compiler_error_line() of msgwindow.c. See the +ParseData typedef for more information. (In future this may be done with a regex). + +For brace indentation, see lexer_has_braces() in editor.c; other indentation is done from +on_new_line_added(). + +If the lexer has comment styles, you should add them in is_comment() in editor.c. For now, +this prevents calltips and autocompletion when typing in a comment. + +If the Scintilla lexer supports user type keywords (e.g. SCLEX_CPP), see +editor_lexer_get_type_keyword_idx() in editor.c. + + Adding a TagManager parser -------------------------- This assumes the Geany filetype already exists.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.