aboutsummaryrefslogtreecommitdiff
path: root/buildroot/share/sublime
diff options
context:
space:
mode:
Diffstat (limited to 'buildroot/share/sublime')
-rw-r--r--buildroot/share/sublime/MarlinFirmware.sublime-project35
-rw-r--r--buildroot/share/sublime/RepRapTools/G-Code.sublime-syntax225
-rw-r--r--buildroot/share/sublime/RepRapTools/syntax_test_G-code.gcode106
-rw-r--r--buildroot/share/sublime/auto_build_sublime_menu/000_read_me.txt40
-rw-r--r--buildroot/share/sublime/auto_build_sublime_menu/Main.sublime-menu66
5 files changed, 472 insertions, 0 deletions
diff --git a/buildroot/share/sublime/MarlinFirmware.sublime-project b/buildroot/share/sublime/MarlinFirmware.sublime-project
new file mode 100644
index 0000000..e0cf953
--- /dev/null
+++ b/buildroot/share/sublime/MarlinFirmware.sublime-project
@@ -0,0 +1,35 @@
+{
+ "folders":
+ [
+ {
+ "folder_exclude_patterns":
+ [
+ ".pio*",
+ "MarlinFirmware/lib",
+ "Marlin/lib",
+ "datatmp",
+ ".vscode"
+ ],
+ "binary_file_patterns":
+ [ "*.psd", "*.png", "*.jpg", "*.jpeg", "*.bdf", "*.patch", "avrdude_5.*", "*.svg", "*.bin", "*.woff" ],
+ "file_exclude_patterns":
+ [
+ "Marlin/platformio.ini",
+ "Marlin/.travis.yml",
+ "Marlin/.gitignore",
+ "Marlin/*/platformio.ini",
+ "Marlin/*/.travis.yml",
+ "Marlin/*/.gitignore",
+ "*.d"
+ ],
+ "path": "../../.."
+ }
+ ],
+ "settings":
+ {
+ "ensure_newline_at_eof_on_save": true,
+ "tab_size": 2,
+ "translate_tabs_to_spaces": true,
+ "trim_trailing_white_space_on_save": true
+ }
+}
diff --git a/buildroot/share/sublime/RepRapTools/G-Code.sublime-syntax b/buildroot/share/sublime/RepRapTools/G-Code.sublime-syntax
new file mode 100644
index 0000000..d1571e3
--- /dev/null
+++ b/buildroot/share/sublime/RepRapTools/G-Code.sublime-syntax
@@ -0,0 +1,225 @@
+%YAML 1.2
+---
+#
+# G-Code (RepRap, not ISO-6983)
+# Author: @thinkyhead
+#
+# RapRap G-Code is very simple.
+#
+# TODO: Lines that start with N get a different context, accepting a checksum.
+#
+name: G-Code (RepRap)
+file_extensions:
+ - [ g, gco, gcode ]
+scope: source.gcode
+variables:
+ decimal: '[+-]?\d+(\.\d*)?'
+
+contexts:
+ prototype:
+ - match: \s+
+
+ - include: mixin_comment
+
+ - match: $
+ pop: true
+
+ main:
+ - meta_scope: line.gcode
+
+ - match: '([Nn]\s*(\d+))'
+ captures:
+ 1: entity.nword.gcode
+ 2: constant.numeric.line-number.gcode
+
+ - match: ()
+ set: gcode_command
+
+ # G, M, or T command
+ gcode_command:
+ - meta_content_scope: ctx.command.gcode
+
+ # M20 S2 P/path/to/file/name.gco
+ - match: ([Mm](20))\s*((S)(2)\s*(P))
+ captures:
+ 1: entity.command.gcode markup.bold.gcode
+ 2: constant.numeric.command.gcode
+ 3: ctx.params.gcode
+ 4: keyword.param.gcode
+ 5: constant.numeric.param.gcode
+ 6: keyword.param.gcode
+ set: gcode_string_arg
+
+ # M117 or M118 - Commands taking a string
+ - match: ([Mm]\s*(11[78]))\b
+ captures:
+ 1: entity.command.gcode markup.bold.gcode
+ 2: constant.numeric.command.gcode
+ set: gcode_string_arg
+
+ # Other commands, followed by data
+ - match: ([GMTgmt]\s*(\d+)((\.)(\d+))?)
+ captures:
+ 1: entity.command.gcode markup.bold.gcode
+ 2: constant.numeric.command.gcode
+ 4: entity.separator.subcode
+ 5: constant.numeric.subcode
+ set: gcode_params
+
+ - match: ()
+ set: syntax_error
+
+ # Parameters of a command
+ gcode_params:
+ - meta_content_scope: ctx.params.gcode
+
+ # M32 [S<pos>] [P<bool>] !/path/file.gco#
+ - match: \!
+ scope: punctuation.string.path.open.gcode
+ push: gcode_path_arg
+
+ # asterisk starts a checksum
+ - match: \*
+ scope: punctuation.marker.checksum.gcode
+ set: gcode_checksum
+
+ # parameter and single-quoted value
+ - match: ([A-Za-z])\s*(')
+ captures:
+ 1: keyword.param.gcode
+ 2: punctuation.quote.single.open.gcode
+ push: gcode_string_arg_quoted_single
+
+ # parameter and double-quoted value
+ - match: ([A-Za-z])\s*(")
+ captures:
+ 1: keyword.param.gcode
+ 2: punctuation.quote.double.open.gcode
+ push: gcode_string_arg_quoted_double
+
+ # parameter and list of values
+ - match: ([Ee])\s*(({{decimal}}\s*:\s*)+{{decimal}})
+ captures:
+ 1: keyword.param.gcode
+ 2: constant.numeric.param.gcode
+
+ # parameter and numeric value
+ - match: ([A-Za-z])\s*({{decimal}})
+ captures:
+ 1: keyword.param.gcode
+ 2: constant.numeric.param.gcode
+
+ # parameter with no value
+ - match: '[A-Za-z]'
+ scope: keyword.param.gcode
+ set: gcode_params
+
+ - match: ()
+ set: syntax_error
+
+ gcode_string_arg_quoted_single:
+ - meta_content_scope: string.quoted.single.gcode
+
+ - match: ([^'\\]+)
+
+ - match: (\\)
+ scope: punctuation.string.escape.gcode
+ push: escape_char
+
+ - match: (')
+ scope: punctuation.quote.single.close.gcode
+ pop: true
+
+ - match: ()
+ set: syntax_error
+
+ gcode_string_arg_quoted_double:
+ - meta_content_scope: string.quoted.double.gcode
+
+ - match: ([^"\\]+)
+
+ - match: (\\)
+ scope: punctuation.string.escape.gcode
+ push: escape_char
+
+ - match: (")
+ scope: punctuation.quote.double.close.gcode
+ pop: true
+
+ - match: ()
+ set: syntax_error
+
+ gcode_string_arg:
+ - meta_content_scope: ctx.string.gcode
+
+ - match: ([^;]+)
+ scope: string.unquoted.gcode
+
+ escape_char:
+ - meta_scope: string.escape.gcode punctuation.string.escape.gcode
+
+ - match: '.'
+ pop: true
+
+ gcode_path_arg:
+ - meta_content_scope: string.unquoted.path.gcode
+
+ - match: (#)
+ scope: punctuation.string.path.close.gcode
+ pop: true
+
+ gcode_checksum:
+ - meta_content_scope: constant.numeric.checksum.gcode
+ - meta_include_prototype: false
+
+ - match: \d+
+
+ - match: ( *)$
+ pop: true
+
+ - include: mixin_comment
+
+ - match: ()
+ set: syntax_error
+
+ # Done interpreting to the end of the line
+ gcode_line_done:
+ - match: \s*$
+ pop: true
+
+ # Comments begin with a ';' and finish at the end of the line.
+ mixin_comment:
+ - match: ^\s*;
+ scope: punctuation.comment.line.start
+ set: gcode_comment
+ - match: \s*;
+ scope: punctuation.comment.eol.start
+ set: gcode_comment
+ - match: \s*\(
+ scope: punctuation.paren.comment.open
+ push: gcode_comment_paren
+
+ # Comment to end of line.
+ gcode_comment:
+ - meta_content_scope: comment.gcode
+ - match: \s*$
+ pop: true
+
+ gcode_comment_paren:
+ - meta_content_scope: paren.comment.gcode
+
+ - match: '[^)]+'
+
+ - match: '[)]'
+ scope: punctuation.paren.comment.close
+ pop: true
+
+ - match: \s*$
+ pop: true
+
+ # Everything after this point is broken by a syntax error
+ syntax_error:
+ - meta_scope: invalid.error.syntax.gcode
+
+ - match: .*$
+ pop: true
diff --git a/buildroot/share/sublime/RepRapTools/syntax_test_G-code.gcode b/buildroot/share/sublime/RepRapTools/syntax_test_G-code.gcode
new file mode 100644
index 0000000..643f271
--- /dev/null
+++ b/buildroot/share/sublime/RepRapTools/syntax_test_G-code.gcode
@@ -0,0 +1,106 @@
+; SYNTAX TEST "G-code.sublime-syntax"
+
+; This is a G-code comment
+;^comment
+
+G1 X100 Y100 ; Move to 100,100
+;^entity.command.gcode
+; ^keyword.param.gcode
+; ^constant.numeric.param.gcode
+; ^comment
+
+T0 (This is a comment) S12
+;^entity.command.gcode
+; ^punctuation.paren.comment.open
+; ^paren.comment.gcode
+; ^punctuation.paren.comment.close
+; ^keyword.param.gcode
+; ^constant.numeric.param.gcode
+
+M20 P'/path/to/macro/macro.g' R12
+;<-entity.command.gcode
+;^constant.numeric.command.gcode
+; ^keyword.param.gcode
+; ^punctuation.quote.single.open.gcode
+; ^string.quoted.single.gcode
+; ^punctuation.quote.single.close.gcode
+; ^keyword.param.gcode
+; ^constant.numeric.param.gcode
+
+M117 This is a message ; and comment
+;<-entity.command.gcode
+;^constant.numeric.command.gcode
+; ^string.unquoted.gcode
+; ^punctuation.comment.eol.start
+; ^comment.gcode
+
+M118 This is a message ; and comment
+;<-entity.command.gcode
+;^constant.numeric.command.gcode
+; ^string.unquoted.gcode
+; ^punctuation.comment.eol.start
+; ^comment.gcode
+
+M98 P'/path/to/macro/macro.g' R12
+;<-entity.command.gcode
+;^constant.numeric.command.gcode
+; ^keyword.param.gcode
+; ^punctuation.quote.single.open.gcode
+; ^string.quoted.single.gcode
+; ^punctuation.quote.single.close.gcode
+
+M98 P"/path/to/macro/macro.g" R12
+;<-entity.command.gcode
+;^constant.numeric.command.gcode
+; ^keyword.param.gcode
+; ^punctuation.quote.double.open.gcode
+; ^string.quoted.double.gcode
+; ^punctuation.quote.double.close.gcode
+
+M32 S100 P0 !/path/file.gco#
+;<-entity.command.gcode
+;^constant.numeric.command.gcode
+; ^keyword.param.gcode
+; ^constant.numeric.param.gcode
+; ^punctuation.string.path.open.gcode
+; ^string.unquoted.path.gcode
+; ^punctuation.string.path.close.gcode
+
+G28 ; Home All
+;<-entity.command.gcode
+;^constant.numeric.command.gcode
+; ^punctuation.comment.eol.start
+; ^comment.gcode
+
+N123 G1 X5 Y0 *64 ; EOL Comment
+;<-entity.nword.gcode
+;^constant.numeric.line-number.gcode
+; ^entity.command.gcode
+; ^constant.numeric.command.gcode
+; ^keyword.param.gcode
+; ^constant.numeric.param.gcode
+; ^punctuation.marker.checksum.gcode
+; ^constant.numeric.checksum.gcode
+
+N234 G1 X-5 Y+2 *64 error
+;<-entity.nword.gcode
+;^constant.numeric.line-number.gcode
+; ^entity.command.gcode
+; ^constant.numeric.command.gcode
+; ^keyword.param.gcode
+; ^constant.numeric.param.gcode
+; ^punctuation.marker.checksum.gcode
+; ^constant.numeric.checksum.gcode
+; ^invalid.error.syntax.gcode
+
+N234 M107 *64
+; ^-invalid.error.syntax.gcode
+
+M92 E304.5:304.5:420:420:420:420 ; EOL Comment
+;<-entity.command.gcode
+;^constant.numeric.command.gcode
+; ^keyword.param.gcode
+; ^constant.numeric.param.gcode
+; ^constant.numeric.param.gcode
+; ^punctuation.comment.eol.start
+; ^comment.gcode
diff --git a/buildroot/share/sublime/auto_build_sublime_menu/000_read_me.txt b/buildroot/share/sublime/auto_build_sublime_menu/000_read_me.txt
new file mode 100644
index 0000000..5853977
--- /dev/null
+++ b/buildroot/share/sublime/auto_build_sublime_menu/000_read_me.txt
@@ -0,0 +1,40 @@
+Overview:
+1) Install Sublime
+2) Install Deviot (?optional?)
+3) Install WebDevShell (this will execute the auto-build script)
+4) Copy the menu configuration to the proper Sublime directory
+5) Add platformio to your path (usually not needed)
+
+
+Sublime with autobuild
+ Tools
+ Install Package Control
+ Tools
+ Command Palette
+ Package Control: Install Package
+ type in deviot and click on it
+ Tools
+ Command Palette
+ Package Control: Install Package
+ type in WebDevShell and click on it
+
+ in Sublime, open Marlin directory with "platformio.ini" in it
+
+ starting in the top level directory, go to the folder "Buildroot/shared/Sublime"
+ copy the folder "auto_build_sublime_menu" and contents to:
+ Windows
+ \Users\your_user_name\AppData\Roaming\Sublime Text 3\Packages
+ Linux
+ /home/your_user_name/.config/sublime-text-3/Packages/User
+ macOS (Click on the Finder's 'Go' menu and hold down Option to open...)
+ ~/Library/Application Support/Sublime Text 3/Packages/User
+
+The menu should now be visible
+
+If you get an error message that says "file not found" and "subprocess.Popen(['platformio' ... "
+then you'll need to add platformio to your path.
+ macOS
+ sudo nano /etc/paths
+ add these to the bottom
+ /Users/bob/.platformio
+ /Users/bob/.platformio/penv/bin
diff --git a/buildroot/share/sublime/auto_build_sublime_menu/Main.sublime-menu b/buildroot/share/sublime/auto_build_sublime_menu/Main.sublime-menu
new file mode 100644
index 0000000..60939d1
--- /dev/null
+++ b/buildroot/share/sublime/auto_build_sublime_menu/Main.sublime-menu
@@ -0,0 +1,66 @@
+[
+
+ {
+ "caption": "Auto Build",
+ "children": [
+ {
+ "caption": "PIO Build",
+ "command": "webdevshell",
+ "args": {
+ "command": "python buildroot/share/vscode/auto_build.py build"
+ }
+ },
+ {
+ "caption": "PIO Clean",
+ "command": "webdevshell",
+ "args": {
+ "command": "python buildroot/share/vscode/auto_build.py clean"
+ }
+ },
+ {
+ "caption": "PIO Upload",
+ "command": "webdevshell",
+ "args": {
+ "command": "python buildroot/share/vscode/auto_build.py upload"
+ }
+ },
+ {
+ "caption": "PIO Upload (traceback)",
+ "command": "webdevshell",
+ "args": {
+ "command": "python buildroot/share/vscode/auto_build.py traceback"
+ }
+ },
+ {
+ "caption": "PIO Upload using Programmer",
+ "command": "webdevshell",
+ "args": {
+ "command": "python buildroot/share/vscode/auto_build.py program"
+ }
+ },
+ {
+ "caption": "PIO Test",
+ "command": "webdevshell",
+ "args": {
+ "command": "python buildroot/share/vscode/auto_build.py test"
+ }
+ },
+ {
+ "caption": "PIO Debug",
+ "command": "webdevshell",
+ "args": {
+ "command": "python buildroot/share/vscode/auto_build.py debug"
+ }
+ },
+ {
+ "caption": "PIO Remote",
+ "command": "webdevshell",
+ "args": {
+ "command": "python buildroot/share/vscode/auto_build.py remote"
+ }
+ }
+ ],
+ "id": "AutoBuild",
+ "mnemonic": "A"
+ }
+]