Register
Bitwise»Forums»Provisional Ion syntax highlighting in Sublime Text 3
Jorge A. Gomes
1 posts
Provisional Ion syntax highlighting in Sublime Text 3
2 years, 5 months ago Edited by Jorge A. Gomes on April 26, 2018, 3:11 a.m. Reason: Initial post
I've been playing around with sublime-syntax files in attempt to get Ion syntax highlighting working by using as template this C.syntax-definition. The bad news is that I didn't figured out how the file works (yet). The good news is that, with some minor changes, it is possible to get large Ion syntax coverage.

What was changed?
Basically 3 things:
1st, At the top of the file:
1
2
3
4
name: C
file_extensions:
  - c
  - h

changed to
1
2
3
name: Ion
file_extensions:
  - ion


2nd, the key 'basic_types' under 'variables', in line 11:
1
basic_types: 'asm|__asm__|auto|bool|_Bool|char|_Complex|double|float|_Imaginary|int|long|short|signed|unsigned|void'

changed to include all ion basic types (the example below requires verification):
1
basic_types: 'bool|char|schar|uchar|double|float|int|uint|uintptr||long|ulong|llong|ullong|short|ushort|signed|unsigned|void'


And 3rd, every scope name terminated in .c got replaced by .ion. Example:
1
2
3
4
- match: ^/\* =(\s*.*?)\s*= \*/$\n?
   scope: comment.block.c
   captures:
     1: meta.toc-list.banner.block.c

becomes
1
2
3
4
- match: ^/\* =(\s*.*?)\s*= \*/$\n?
   scope: comment.block.ion
   captures:
     1: meta.toc-list.banner.block.ion


To add this definition in ST, you must:
1. Install the Sublime Text package PackageDev;
2. After installation, click on "New Syntax Definition..." under Tools>Packages>PackageDevelopment menu;
3. A new template syntax will be created, but you can replace its contents with the C.sublime-syntax file contents (change it as above);
4. Save it and enjoy.

P.S.: Sorry for any bad english in the text.
2 posts
Provisional Ion syntax highlighting in Sublime Text 3
2 years, 5 months ago
I did already make one it's up on github.
Works with sublime/textmate/vscode (vs apparently through bundle)

https://github.com/Platin21/ion.tmbundle