Modes In Text Forge

Text Forge is lightweight and language agnostic, So there is no default dependence on any language. But how you can work with any file type and have special features like syntax highlighters and linters? This is where the modes come in, a mode is a special module designed to adapt to certain types of files and languages, you can install the modes and leave the rest to the editor, everything is automatically managed to you can work with files.

Mode Features

There is a list of all standard available features for modes, some mode can have more features with custom solutions and some modes can haven't one or more feature is this list. In short, you can find optional features with optional tag, features of a mode depends on its developers:

  • Save & Load

    Modes can encode and decode files, with this customizable encoding system you can work with a lot of files, even with files they aren't text files!

  • Syntax Highlighter optional

    We provide both simple and advanced syntax highlighting ability to mode developers, including simple highlighters to fully customized highlighters. Highlighters currently can just one theme and highlighter colors are completely mode-driven.

  • Advanced Commenting Handling optional

    We have easy API for defining comment delimiters and logics. Editor provides line folding and more based on these information.

  • Mode Panels optional

    Modes can have their panels, so you can configure a mode visually based on mode features.

  • Auto Format & Auto Indent optional

    We provide auto format and auto indent options separately, you can run these options to clean your files with modes' power. You can use these features from command palette, menus, or with shortcuts; These features are available in Edit > Indention > Auto Indent and Format > Auto Format, to see shortcuts, type Auto Indent or Auto Format in command palette.

  • Initialization Lifecycle

    We have high standards about your files safety, so a mode will load completely before working with your file, or if initialization fails, we will cancel task.

  • Code Completion optional

    We provide a mode-based code completion to you with complete API for mode developers, so features and smartness of this feature is based on your current mode.

  • Preview Rendering optional

    Modes can generate live preview based on your file, and you can see this preview in Preview Panel in right side of editor.

  • File Outline optional

    You can navigate between sections in your file or review them in Outline Panel in left side of editor, this is a mode-driven feature too, so this section features are based on your mode.

  • Linting optional

    We currently haven't supported LSP & DAP client (feature tracking issue↗️) for complete language based features, but we have a simple mode-driven linting feature, and you can see your file problems in Problems Panel in bottom of editor, in this panel all error and warnings provided by mode will show , and you can navigate between them by clicking on an item.

Note

A lot of above features were added in TFM API v2.0, you can read more about this API here. We provide a lot of these features as optional features, because a mode can work with simple text or non-code files, so there is a lot of optional but basic features.

Note

After TFM API v2.0, we use buffer based save and load instead of file based behavior, this new system have safer error handling and modes can no longer see the file paths in your system directly when you save / load a file.

Important

Modes are unlimited moduless! So you should be sure about a mode before installing it, otherwise modes can get access to your files content, for completely safe experience download official and community modes in mode library.

Note

Auto Format and Auto Indent are triggerable actions, there is an Auto Indention toggleable feature in Format menu that will change indention automatically when you create new line.

Mode Kits

In programming word, there is a lot of types of programmers, for example you can be a web developer, in this case you need to work with some files as your basic workflow, such as .html, .css, and .js. So we provide mode kits, a mode kit is a collection from related modes create for a special type of users.

Installing Modes & Mode Kits

You can find modes and mode kits in official library or community created collections, there is some useful link about modes:

A mode or mode kit is a .zip or .tfmode file, use Mode Manager (Settings > Mode Manager in menus) and select this file with Import Mode / Mode Kit. After loading, you will receive an info notification that says "Load mode / mode kit completed" and you can use your new modes now without restart editor.