From fa281082352d1d9aa153f5d3e339af1e589f7db2 Mon Sep 17 00:00:00 2001 From: FireZenk Date: Sun, 2 Mar 2014 13:37:35 +0100 Subject: [PATCH] Initial commit --- CONTRIBUTING.md | 1 + LICENSE-MIT | 22 ++++ README.md | 9 ++ grammars/lua.cson | 156 ++++++++++++++++++++++++++++ package.json | 14 +++ scoped-properties/language-lua.cson | 4 + snippets/language-lua.cson | 22 ++++ 7 files changed, 228 insertions(+) create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE-MIT create mode 100644 README.md create mode 100644 grammars/lua.cson create mode 100644 package.json create mode 100644 scoped-properties/language-lua.cson create mode 100644 snippets/language-lua.cson diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..e70782f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1 @@ +See the [Atom contributing guide](https://atom.io/docs/latest/contributing) diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..8007bae --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) 2014 FireZenk + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e0806e2 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Lua language support in Atom + +Add syntax highlighting and snippets to Lua files in Atom. + +Originally [converted](http://atom.io/docs/latest/converting-a-text-mate-bundle) +from the [Lua TextMate bundle](https://github.com/textmate/lua.tmbundle). + +Contributions are greatly appreciated. Please fork this repository and open a +pull request to add snippets, make grammar tweaks, etc. diff --git a/grammars/lua.cson b/grammars/lua.cson new file mode 100644 index 0000000..8f4273a --- /dev/null +++ b/grammars/lua.cson @@ -0,0 +1,156 @@ +'comment': 'Lua Syntax: version 0.8' +'fileTypes': [ + 'lua' +] +'firstLineMatch': '\\A#!.*?\\blua\\b' +'name': 'Lua' +'patterns': [ + { + 'captures': + '1': + 'name': 'keyword.control.lua' + '2': + 'name': 'entity.name.function.scope.lua' + '3': + 'name': 'entity.name.function.lua' + '4': + 'name': 'punctuation.definition.parameters.begin.lua' + '5': + 'name': 'variable.parameter.function.lua' + '6': + 'name': 'punctuation.definition.parameters.end.lua' + 'match': '\\b(function)(?:\\s+([a-zA-Z_.:]+[.:])?([a-zA-Z_]\\w*)\\s*)?(\\()([^)]*)(\\))' + 'name': 'meta.function.lua' + } + { + 'match': '(?=?|(?", + "description": "Add syntax highlighting and snippets to Lua files in Atom", + "repository": "https://github.com/FireZenk/language-lua", + "license": "MIT", + "engines": { + "atom": ">0.50.0" + }, + "dependencies": { + } +} diff --git a/scoped-properties/language-lua.cson b/scoped-properties/language-lua.cson new file mode 100644 index 0000000..72000f5 --- /dev/null +++ b/scoped-properties/language-lua.cson @@ -0,0 +1,4 @@ +'.source.lua': + 'editor': + 'increaseIndentPattern': '\\b(else|elseif|(local\\s+)?function|then|do|repeat)\\b((?!end).)*$|\\{\\s*$' + 'decreaseIndentPattern': '^\\s*(elseif|else|end|\\})\\s*$' diff --git a/snippets/language-lua.cson b/snippets/language-lua.cson new file mode 100644 index 0000000..6f4d463 --- /dev/null +++ b/snippets/language-lua.cson @@ -0,0 +1,22 @@ +'.source.lua': + 'for i,v in ipairs()': + 'prefix': 'fori' + 'body': 'for ${1:i},${2:v} in ipairs(${3:table_name}) do\n\t${0:print(i,v)}\nend' + 'for i=1,10': + 'prefix': 'for' + 'body': 'for ${1:i}=${2:1},${3:10} do\n\t${0:print(i)}\nend' + 'for k,v in pairs()': + 'prefix': 'forp' + 'body': 'for ${1:k},${2:v} in pairs(${3:table_name}) do\n\t${0:print(k,v)}\nend' + 'function': + 'prefix': 'function' + 'body': 'function ${1:function_name}( ${2:...} )\n\t${0:-- body}\nend' + 'local x = 1': + 'prefix': 'local' + 'body': 'local ${1:x} = ${0:1}' + 'table.concat': + 'prefix': 'table.concat' + 'body': 'table.concat( ${1:tablename}${2:, ", "}${3:, start_index}${4:, end_index} )' + 'table.sort': + 'prefix': 'table.sort' + 'body': 'table.sort( ${1:tablename}${2:, sortfunction} )'