This is a first attempt with little testing, but it seems to work pretty OK.  
However, please review all levels, from design to implementation.

To summarize, what this does is look for `stylename.N` for styles that are 
known to be sub-stylable[^1], as well as the corresponding 
keywords/identifiers[^2].  From there, it's just regular styles one can map 
as usual.

One limitation I am already aware of is that as it's not regular keywords, 
it doesn't integrate with the code merging the ctags symbols into them.  It 
could be possible to augment this to work, but with the current design this 
would need a way of representing this in the filetypes file (which would be 
good, but is not the case currently).

One arbitrary design choice was to use the syntax `stylename.N`.  This is 
mostly because using `stylename[i]` is tricky/hacky using `GKeyFile`, because 
it looks similar to Scintilla's properties, and doesn't clash with any 
style name.  Other suggestions are welcome.


[^1]: we unfortunately cannot use 
[`SCI_GETSUBSTYLEBASES`](https://scintilla.org/ScintillaDoc.html#SCI_GETSUBSTYLEBASES)
 because we don't have access to a Scintilla instance when loading style 
data.  Hence adding a new field in `HLStyle`.
[^2]: Note here that this feature is styles-based in Scintilla, meaning that 
there is no regular keywords entry associated, it's defined as kind of a 
style property.
You can view, comment on, or merge this pull request online at:

  https://github.com/geany/geany/pull/3794

-- Commit Summary --

  * Initial support for Scintilla sub-styles
  * DO NOT MERGE: Add sample sub-styles for Python
  * Make sci_get_style_at() work with larger number of styles
  * Display sub-styles in the statusbar %Y placeholder

-- File Changes --

    M data/filedefs/filetypes.python.in (7)
    M src/highlighting.c (111)
    M src/highlightingmappings.h (1897)
    M src/sciwrappers.c (2)
    M src/ui_utils.c (14)

-- Patch Links --

https://github.com/geany/geany/pull/3794.patch
https://github.com/geany/geany/pull/3794.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3794
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/3...@github.com>

Reply via email to