Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Sublime Text 3 - kOS Syntax Highlighting

This syntax definition is a fork of xeger's Atom package. This is not a direct port, but an updated syntax definition to reflect changes since the original release of the Atom package two years ago.

In addition to general updates, various features have been added to bring syntax highlighting in line with Sublime defaults. xeger provided an excellent foundation that made adding new updates and functionality much easier, and my thanks goes out to him for sharing his work. Additional thanks goes to Alexical, who created the original Sublime Text 3 port of of xeger's module. Those looking to use or build off of a functionally similar version of xeger's work can find Alexical's package here.

Installation

Download kOS.sublime-syntax (provided by dimir29) or kOS.tmLanguage, and kOS.tmPreferences and place them in the your User package directory, which can be found by opening Sublime Text and selecting the following:

Preferences > Browse Packages > User

If you just want the path information, you can find the default Packages directory for Windows, Linux, and OSX here

Those looking to modify the syntax definition to suit their preferences can find more information in the Customization section.

NOTE: Only kOS.sublime-syntax or kOS.tmLanguage should be added to your User folder, not both.

Supported Features

A summary of features and updates to the kOS syntax for ST3 are highlighted here. Check the commit logs for additional details.

Changes Include:

  • Delimiter Contrast

    • Certain punctuation/delimiters were stripped of highlighting to improve readability and provide contrast where needed. For example: colons, when used to access structure fields, are no longer highlighted with the attached member, which helps distinguish breaks in long STRUCTURE:MEMBER chains.
  • User-Defined and General Function Support

    • User function definitions, and calls to those functions, are highlighted like function calls and definitions in C and Python. Delegate/function references are also now supported; the delegate identifier @, along with delegate's name, receive different highlighting.
  • Contextual Distinction

    • Keywords usable in multiple contexts are highlighted based on that context. For example, SHIP:HEADING vs HEADING(90,90). Highlighting applied to HEADING differs based on whether its used as a structure member, or as a traditional function call. The same is true for parameters that can be used as structures.
  • Extended Action Groups

    • Action Groups 0-250 are now supported; anything outside that range won't be highlighted.
  • Comment Toggling

    • The keyboard shortcut for toggling comments (Default: CTRL + /) now works with all .ks files.

Upcoming/Ongoing Changes Include:

  • Additional Keyword Coverage
    • Check commit logs for all updates
  • Partial STRUCTURE:MEMBER Validation
    • Highlighting for some STRUCTURE:MEMBER combinations break if an incorrect parameter is applied. This is only implemented for structures that can't be set to another reference, else some parameters would never receive highlighting if their parent structure is being referenced by a variable.
  • Anonymous function distinction.
  • Parameter Declarations
    • Lines containing single parameter definitions is currently supported. Instances where multiple parameters are declared on the same line are not supported, although development of this feature is in progress.

Updated Syntax Support

The following items in this section represent support for structures, parameters, and methods that were not available when the original Atom package was released. This list doesn't represent all updates, just entirely new structure additions.

Examples

Monokai Monokai

Solarized Dark Solarized Dark

Solarized Light Solarized Light

Twilight Twilight


Customization

If you wish to make alternations or additions to the definition, you can use PackageDev along with the kOS.YAML-tmlLanguage file in the src directory to create your own version. If using kOS.sublime-syntax, PackageDev is not required as the syntax file can be edited directly.

While both methods work, .sublime-syntax files are much easier to read and work with.

An overview of creating syntax definitions in Sublime Text can be found here.

Suggestions and Requests

If you feel a current feature could be improved, or if you would like a new feature entirely, I'm always open suggestions and requests.