├── LICENSE ├── README.md ├── install ├── images │ ├── linux-1.png │ ├── linux-2.png │ ├── linux-3.png │ ├── linux-4.png │ ├── linux-5.png │ ├── mac-1.png │ ├── mac-2.png │ ├── mac-3.png │ ├── mac-4.png │ ├── mac-5.png │ ├── windows-1.png │ ├── windows-2.png │ ├── windows-3.png │ ├── windows-4.png │ ├── windows-5.png │ └── workflow.png ├── linux.md ├── mac.md └── windows.md ├── messages.json ├── messages ├── 1.0.0.txt └── install.txt ├── performance-table.md ├── src ├── elm.sublime-syntax ├── hide-goto.tmPreferences └── whitespace.tmPreferences └── uninstall.md /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019-present Evan Czaplicki 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Elm Syntax Highlighting 2 | 3 | Just add syntax highlighting for Elm. 4 | 5 | 6 | ## Install Instructions 7 | 8 | - [Mac](install/mac.md) 9 | - [Linux](install/linux.md) 10 | - [Windows](install/windows.md) 11 | 12 | 13 | ## Recommended Workflow 14 | 15 | I do all of my Elm development with Terminal and Sublime Text open next to each other like this: 16 | 17 | ![Recommended Workflow](install/images/workflow.png) 18 | 19 | I mostly focus on the code in Sublime Text. 20 | 21 | When I am curious if things work, I switch to Terminal and run something like `elm make src/Main.elm` to see if I get any errors. 22 | 23 | Then I switch back to Sublime Text and use **Ctrl-t** (or **Cmd-t** on Mac) to navigate to the relevant files and make any fixes. 24 | 25 | 26 | ## Workflow Benefits 27 | 28 | The recommended workflow has some underappreciated benefits: 29 | 30 | 1. **Fast** - Never wait for a slow editor. No background tasks eating RAM and CPU. 31 | 2. **Flexibile** - Some projects needs more than an `elm make` call. I can switch to `elm reactor` or a custom `./build.sh` script and keep essentially the same workflow. 32 | 3. **Robust** - Not much can go wrong here, so I never spend time messing with integrations. Changes in `elm`, `elm-test`, or `elm-format` are only a concern in the terminal. 33 | 34 | I really love this balance! It has that particular character of focused designs. 35 | 36 | * * * 37 | 38 | That said, I know some people want a bit more, so I made [`elm-format-on-save`](https://github.com/evancz/elm-format-on-save) as well. It may be worth setting this up once you have been happily using Elm for a while and become curious what it might be like to use Elm at work. 39 | -------------------------------------------------------------------------------- /install/images/linux-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/linux-1.png -------------------------------------------------------------------------------- /install/images/linux-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/linux-2.png -------------------------------------------------------------------------------- /install/images/linux-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/linux-3.png -------------------------------------------------------------------------------- /install/images/linux-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/linux-4.png -------------------------------------------------------------------------------- /install/images/linux-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/linux-5.png -------------------------------------------------------------------------------- /install/images/mac-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/mac-1.png -------------------------------------------------------------------------------- /install/images/mac-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/mac-2.png -------------------------------------------------------------------------------- /install/images/mac-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/mac-3.png -------------------------------------------------------------------------------- /install/images/mac-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/mac-4.png -------------------------------------------------------------------------------- /install/images/mac-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/mac-5.png -------------------------------------------------------------------------------- /install/images/windows-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/windows-1.png -------------------------------------------------------------------------------- /install/images/windows-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/windows-2.png -------------------------------------------------------------------------------- /install/images/windows-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/windows-3.png -------------------------------------------------------------------------------- /install/images/windows-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/windows-4.png -------------------------------------------------------------------------------- /install/images/windows-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/windows-5.png -------------------------------------------------------------------------------- /install/images/workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evancz/elm-syntax-highlighting/151778272b6d28eadb2f04ed44f563d1378e4a43/install/images/workflow.png -------------------------------------------------------------------------------- /install/linux.md: -------------------------------------------------------------------------------- 1 | # Install on Linux 2 | 3 | Editor plugins in Sublime Text are managed with a project called **Package Control**. 4 | 5 | If you just installed Sublime Text, you will need to install Package Control first. 6 | 7 | If you have been using Sublime Text for a while, you may be able to skip to step two. 8 | 9 | 10 | ## 1. Install Package Control 11 | 12 | Open Sublime Text and go to **Tools > Install Package Control...** 13 | 14 | ![Install Package Control](images/linux-1.png) 15 | 16 | Click on that! Next you should see a dialog box like this: 17 | 18 | ![Package Control Dialog](images/linux-2.png) 19 | 20 | Click **OK**. Now you have **Package Control** available! 21 | 22 | **Note:** If you cannot find **Tools > Install Package Control...**, it may be installed already. Try moving on to step two! 23 | 24 | 25 | ## 2. Install elm-syntax-highlighting with Package Control 26 | 27 | With Sublime Text open, go to **Preferences > Package Control** 28 | 29 | ![Open Package Control](images/linux-3.png) 30 | 31 | Click on that, and select **Install Package** from the list of options: 32 | 33 | ![Select Install Package](images/linux-4.png) 34 | 35 | Type in **Elm Syntax Highlighting** and select the package that comes up: 36 | 37 | ![Find Elm Syntax Highlighting](images/linux-5.png) 38 | 39 | 40 | ## 3. Restart Sublime Text 41 | 42 | Once you have **Elm Syntax Highlighting** installed, restart Sublime Text. 43 | 44 | After restarting, files like `src/Main.elm` should have syntax highlighting! 45 | 46 | **Note**: Be sure to ask in a [community forum](https://elm-lang.org/community) if you are having trouble getting this set up! 47 | -------------------------------------------------------------------------------- /install/mac.md: -------------------------------------------------------------------------------- 1 | # Install on Mac 2 | 3 | Editor plugins in Sublime Text are managed with a project called **Package Control**. 4 | 5 | If you just installed Sublime Text, you will need to install Package Control first. 6 | 7 | If you have been using Sublime Text for a while, you may be able to skip to step two. 8 | 9 | 10 | ## 1. Install Package Control 11 | 12 | Open Sublime Text and go to **Tools > Install Package Control...** 13 | 14 | ![Install Package Control](images/mac-1.png) 15 | 16 | Click on that! Next you should see a dialog box like this: 17 | 18 | ![Package Control Dialog](images/mac-2.png) 19 | 20 | Click **OK**. Now you have **Package Control** available! 21 | 22 | **Note:** If you cannot find **Tools > Install Package Control...**, it may be installed already. Try moving on to step two! 23 | 24 | 25 | ## 2. Install elm-syntax-highlighting with Package Control 26 | 27 | With Sublime Text open, go to **Sublime Text > Preferences > Package Control** 28 | 29 | ![Open Package Control](images/mac-3.png) 30 | 31 | Click on that, and select **Install Package** from the list of options: 32 | 33 | ![Select Install Package](images/mac-4.png) 34 | 35 | Type in **Elm Syntax Highlighting** and select the package that comes up: 36 | 37 | ![Find Elm Syntax Highlighting](images/mac-5.png) 38 | 39 | 40 | ## 3. Restart Sublime Text 41 | 42 | Once you have **Elm Syntax Highlighting** installed, restart Sublime Text. 43 | 44 | After restarting, files like `src/Main.elm` should have syntax highlighting! 45 | 46 | **Note**: Be sure to ask in a [community forum](https://elm-lang.org/community) if you are having trouble getting this set up! 47 | -------------------------------------------------------------------------------- /install/windows.md: -------------------------------------------------------------------------------- 1 | # Install on Windows 2 | 3 | Editor plugins in Sublime Text are managed with a project called **Package Control**. 4 | 5 | If you just installed Sublime Text, you will need to install Package Control first. 6 | 7 | If you have been using Sublime Text for a while, you may be able to skip to step two. 8 | 9 | 10 | ## 1. Install Package Control 11 | 12 | Open Sublime Text and go to **Tools > Install Package Control...** 13 | 14 | ![Install Package Control](images/windows-1.png) 15 | 16 | Click on that! Next you should see a dialog box like this: 17 | 18 | ![Package Control Dialog](images/windows-2.png) 19 | 20 | Click **OK**. Now you have **Package Control** available! 21 | 22 | **Note:** If you cannot find **Tools > Install Package Control...**, it may be installed already. Try moving on to step two! 23 | 24 | 25 | ## 2. Install elm-syntax-highlighting with Package Control 26 | 27 | With Sublime Text open, go to **Preferences > Package Control** 28 | 29 | ![Open Package Control](images/windows-3.png) 30 | 31 | Click on that, and select **Install Package** from the list of options: 32 | 33 | ![Select Install Package](images/windows-4.png) 34 | 35 | Type in **Elm Syntax Highlighting** and select the package that comes up: 36 | 37 | ![Find Elm Syntax Highlighting](images/windows-5.png) 38 | 39 | 40 | ## 3. Restart Sublime Text 41 | 42 | Once you have **Elm Syntax Highlighting** installed, restart Sublime Text. 43 | 44 | After restarting, files like `src/Main.elm` should have syntax highlighting! 45 | 46 | **Note**: Be sure to ask in a [community forum](https://elm-lang.org/community) if you are having trouble getting this set up! 47 | -------------------------------------------------------------------------------- /messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "install": "messages/install.txt", 3 | "1.0.0": "messages/1.0.0.txt" 4 | } 5 | -------------------------------------------------------------------------------- /messages/1.0.0.txt: -------------------------------------------------------------------------------- 1 | Elm Syntax Highlighting - 1.0.0 - 7 August 2019 2 | =============================================== 3 | 4 | 5 | New Design 6 | ---------- 7 | 8 | Instead of having a bunch of functionality packed into one 9 | package (some of it in disrepair) we now have two highly 10 | specific packages: 11 | 12 | - https://github.com/evancz/elm-syntax-highlighting 13 | - https://github.com/evancz/elm-format-on-save 14 | 15 | So you now have syntax highlighting that should be reliable 16 | through future releases. 17 | 18 | The new design is described in more detail here: 19 | 20 | https://github.com/evancz/elm-syntax-highlighting 21 | 22 | It outlines a recommended workflow as well. 23 | 24 | 25 | Adding back "Elm Format on Save" 26 | -------------------------------- 27 | 28 | Check out the install instructions here: 29 | 30 | https://github.com/evancz/elm-format-on-save/ 31 | 32 | The new package for running elm-format when you save a file 33 | has some important changes: 34 | 35 | 1. It expects 0.19 code. 36 | 2. It runs *before* a file is written to disk. 37 | 38 | The previous implementation ran *after* the file was saved, 39 | causing a second save with the formatted code. So point (2) 40 | is really important for people with file watchers, allowing 41 | you to avoid a bunch of pointless work. 42 | -------------------------------------------------------------------------------- /messages/install.txt: -------------------------------------------------------------------------------- 1 | Thanks for installing! 2 | 3 | You can start a new project by running `elm init` in the 4 | terminal. From there, you should get syntax highlighting 5 | when you open files like src/Main.elm 6 | 7 | I hope you enjoy working with Elm! 8 | -------------------------------------------------------------------------------- /performance-table.md: -------------------------------------------------------------------------------- 1 | # Performance Table 2 | 3 | This package does syntax highlighting using the standard mechanism for Sublime Text. 4 | 5 | There are no additional features. 6 | 7 | 8 | | Feature | Start Speed | Incremental Speed | Constant RAM Overhead | Cumulative CPU Costs | Battery Implications | 9 | |---------------------|------------------|-------------------|-----------------------|----------------------|----------------------| 10 | | | | | | | | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/elm.sublime-syntax: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | # http://www.sublimetext.com/docs/3/syntax.html 4 | name: Elm 5 | file_extensions: 6 | - elm 7 | scope: source.elm 8 | contexts: 9 | main: 10 | - match: \(\) 11 | scope: constant.language.unit.elm 12 | - match: ^\b((effect|port)\s+)?(module)\s+ 13 | captures: 14 | 1: keyword.other.elm 15 | 3: keyword.other.elm 16 | push: 17 | - meta_scope: meta.declaration.module.elm 18 | - match: $|; 19 | captures: 20 | 1: keyword.other.elm 21 | pop: true 22 | - include: module_name 23 | - match: '(where)\s*\{' 24 | captures: 25 | 1: keyword.other.elm 26 | push: 27 | - match: '\}' 28 | pop: true 29 | - include: type_signature 30 | - match: (exposing) 31 | scope: keyword.other.elm 32 | - include: module_exports 33 | - match: (where) 34 | scope: keyword.other.elm 35 | - match: "[a-z]+" 36 | scope: invalid 37 | - match: ^\b(import)\s+ 38 | captures: 39 | 1: keyword.other.elm 40 | push: 41 | - meta_scope: meta.import.elm 42 | - match: ($|;) 43 | pop: true 44 | - match: (as|exposing) 45 | scope: keyword.import.elm 46 | - include: module_name 47 | - include: module_exports 48 | - match: '(\[)(glsl)(\|)' 49 | captures: 50 | 1: keyword.other.elm 51 | 2: support.function.prelude.elm 52 | 3: keyword.other.elm 53 | push: 54 | - meta_scope: entity.glsl.elm 55 | - match: '\|\]' 56 | scope: keyword.other.elm 57 | pop: true 58 | - include: scope:source.glsl 59 | - match: type( alias)? (\w+) 60 | scope: keyword.other.elm 61 | captures: 62 | 2: entity.name.type.elm 63 | - match: \b(case|of|let|in|as)\s+ 64 | scope: keyword.other.elm 65 | - match: \b(if|then|else)\s+ 66 | scope: keyword.control.elm 67 | - match: '\b([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\b' 68 | comment: Floats are always decimal 69 | scope: constant.numeric.float.elm 70 | - match: '\b([0-9]+)\b' 71 | scope: constant.numeric.elm 72 | - match: '"""' 73 | captures: 74 | 0: punctuation.definition.string.begin.elm 75 | push: 76 | - meta_scope: string.quoted.triple.elm 77 | - match: '"""' 78 | captures: 79 | 0: punctuation.definition.string.end.elm 80 | pop: true 81 | - include: escapes 82 | - match: '"' 83 | captures: 84 | 0: punctuation.definition.string.begin.elm 85 | push: 86 | - meta_scope: string.quoted.double.elm 87 | - match: '"' 88 | captures: 89 | 0: punctuation.definition.string.end.elm 90 | pop: true 91 | - include: escapes 92 | - match: "'" 93 | captures: 94 | 0: punctuation.definition.string.begin.elm 95 | push: 96 | - meta_scope: string.quoted.single.elm 97 | - match: "'" 98 | captures: 99 | 0: punctuation.definition.string.end.elm 100 | pop: true 101 | - include: escapes 102 | - match: '^(port\s+)?([a-z][a-zA-Z0-9_]*)\s*(:)([:]+)?' 103 | captures: 104 | 1: keyword.other.port.elm 105 | 2: entity.name.function.elm hide.from.goto_symbol 106 | 3: keyword.other.colon.elm 107 | 4: invalid 108 | push: 109 | - meta_scope: meta.function.type-declaration.elm 110 | - match: $\n? 111 | pop: true 112 | - include: type_signature 113 | - match: '\b[A-Z]\w*\b' 114 | scope: constant.other.elm 115 | - include: comments 116 | - match: '^[a-z][A-Za-z0-9_]*\s+' 117 | scope: entity.name.function.elm 118 | - include: operator_fn 119 | - match: '[+\-/\\*=.<>:&|^?%!]+' 120 | scope: keyword.operator.elm 121 | - match: '[\[\]\{\},]' 122 | scope: support.function.delimiter.elm 123 | - match: '[\(\)]' 124 | scope: keyword.other.parenthesis.elm 125 | block_comment: 126 | - match: '\{-' 127 | captures: 128 | 0: punctuation.definition.comment.elm 129 | push: 130 | - meta_scope: comment.block.elm 131 | - include: block_comment 132 | - match: '-\}' 133 | captures: 134 | 0: punctuation.definition.comment.elm 135 | pop: true 136 | comments: 137 | - match: (--).*$\n? 138 | scope: comment.line.double-dash.elm 139 | captures: 140 | 1: punctuation.definition.comment.elm 141 | - include: block_comment 142 | operator_fn: 143 | - match: '\([+\-/\\*=.<>:&|^?%!]+\)' 144 | scope: entity.name.function.infix.elm 145 | module_exports: 146 | - match: \( 147 | push: 148 | - meta_scope: meta.declaration.exports.elm 149 | - match: \) 150 | pop: true 151 | - match: '\b[a-z][a-zA-Z_0-9]*' 152 | scope: entity.name.function.elm 153 | - match: '\b[A-Z][A-Za-z_0-9]*' 154 | scope: storage.type.elm 155 | - match: "," 156 | scope: punctuation.separator.comma.elm 157 | - include: operator_fn 158 | - match: \(.*?\) 159 | comment: So named because I don't know what to call this. 160 | scope: meta.other.unknown.elm 161 | module_name: 162 | - match: "[A-Z][A-Za-z._0-9]*" 163 | scope: support.other.module.elm 164 | type_signature: 165 | - match: "->" 166 | scope: keyword.other.arrow.elm 167 | - match: '\b[a-z][a-zA-Z0-9_]*\b' 168 | scope: variable.other.generic-type.elm 169 | - match: '\b[A-Z][a-zA-Z0-9_]*\b' 170 | scope: storage.type.elm 171 | - match: \(\) 172 | scope: support.constant.unit.elm 173 | - include: comments 174 | escapes: 175 | - match: '\\[nrt\\\"'']' 176 | scope: constant.character.escape.elm 177 | - match: '\\u\{[0-9a-fA-F]{4,6}\}' 178 | scope: constant.character.escape.elm 179 | -------------------------------------------------------------------------------- /src/hide-goto.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Symbol List 7 | scope 8 | hide.from.goto_symbol 9 | settings 10 | 11 | showInSymbolList 12 | 0 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/whitespace.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | scope 6 | source.elm 7 | settings 8 | 9 | 10 | increaseIndentPattern 11 | ^.*([+-/*=.<>:&|^?%!]+|\blet|\bthen|\belse|\bof)\s*$ 12 | 13 | shellVariables 14 | 15 | 16 | name 17 | TM_COMMENT_START 18 | value 19 | -- 20 | 21 | 22 | name 23 | TM_COMMENT_START_2 24 | value 25 | {- 26 | 27 | 28 | name 29 | TM_COMMENT_END_2 30 | value 31 | -} 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /uninstall.md: -------------------------------------------------------------------------------- 1 | # Uninstall 2 | 3 | 1. Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac) to open the Command Palette 4 | 2. Select **Package Control: Remove Package** 5 | 3. Select `elm-syntax-highlighting` 6 | --------------------------------------------------------------------------------