diff --git a/eclipse-solargraph-plugin/grammar/erb.tmLanguage.json b/eclipse-solargraph-plugin/grammar/erb.tmLanguage.json new file mode 100644 index 0000000..0a1d88c --- /dev/null +++ b/eclipse-solargraph-plugin/grammar/erb.tmLanguage.json @@ -0,0 +1,151 @@ +{ + "name": "HTML (Ruby - ERB)", + "scopeName": "text.html.erb", + "fileTypes": ["rhtml", "html.erb"], + "injections": { + "text.html.erb - (meta.embedded.block.erb | meta.embedded.line.erb | meta.tag | comment), L:meta.tag, L:source.js.embedded.html": { + "patterns": [ + { + "begin": "(^\\s*)(?=<%+#(?![^%]*%>))", + "beginCaptures": { + "0": { + "name": "punctuation.whitespace.comment.leading.erb" + } + }, + "end": "(?!\\G)(\\s*$\\n)?", + "endCaptures": { + "0": { + "name": "punctuation.whitespace.comment.trailing.erb" + } + }, + "patterns": [ + { + "include": "#comment" + } + ] + }, + { + "begin": "(^\\s*)(?=<%(?![^%]*%>))", + "beginCaptures": { + "0": { + "name": "punctuation.whitespace.embedded.leading.erb" + } + }, + "end": "(?!\\G)(\\s*$\\n)?", + "endCaptures": { + "0": { + "name": "punctuation.whitespace.embedded.trailing.erb" + } + }, + "patterns": [ + { + "include": "#tags" + } + ] + }, + { + "include": "#comment" + }, + { + "include": "#tags" + } + ] + } + }, + "patterns": [ + { + "include": "text.html.basic" + } + ], + "repository": { + "comment": { + "patterns": [ + { + "begin": "<%+#", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.begin.erb" + } + }, + "end": "%>", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.end.erb" + } + }, + "name": "comment.block.erb" + } + ] + }, + "tags": { + "patterns": [ + { + "begin": "<%+(?!>)[-=]?(?![^%]*%>)", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.erb" + } + }, + "contentName": "source.ruby.embedded.erb", + "end": "-?%>", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.erb" + }, + "1": { + "name": "source.ruby" + } + }, + "name": "meta.embedded.block.erb", + "patterns": [ + { + "captures": { + "1": { + "name": "punctuation.definition.comment.erb" + } + }, + "match": "(#).*?(?=-?%>)", + "name": "comment.line.number-sign.erb" + }, + { + "include": "source.ruby" + } + ] + }, + { + "begin": "<%+(?!>)[-=]?", + "beginCaptures": { + "0": { + "name": "punctuation.section.embedded.begin.erb" + } + }, + "contentName": "source.ruby.embedded.erb", + "end": "-?%>", + "endCaptures": { + "0": { + "name": "punctuation.section.embedded.end.erb" + }, + "1": { + "name": "source.ruby" + } + }, + "name": "meta.embedded.line.erb", + "patterns": [ + { + "captures": { + "1": { + "name": "punctuation.definition.comment.erb" + } + }, + "match": "(#).*?(?=-?%>)", + "name": "comment.line.number-sign.erb" + }, + { + "include": "source.ruby" + } + ] + } + ] + } + } +} diff --git a/eclipse-solargraph-plugin/icon/erb-editor.png b/eclipse-solargraph-plugin/icon/erb-editor.png new file mode 100644 index 0000000..5f9510a Binary files /dev/null and b/eclipse-solargraph-plugin/icon/erb-editor.png differ diff --git a/eclipse-solargraph-plugin/language-configuration/erb-configuration.json b/eclipse-solargraph-plugin/language-configuration/erb-configuration.json new file mode 100644 index 0000000..91a7600 --- /dev/null +++ b/eclipse-solargraph-plugin/language-configuration/erb-configuration.json @@ -0,0 +1,31 @@ +{ + "comments": { + "blockComment": [ "<%#", "%>" ] + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["<", ">"] + ], + "autoClosingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"], + ["`", "`"], + ["<", ">"], + ["%", "%"] + ], + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"], + ["`", "`"], + ["<", ">"], + ["%", "%"] + ] +} diff --git a/eclipse-solargraph-plugin/language-configuration/language-configuration.json b/eclipse-solargraph-plugin/language-configuration/ruby-configuration.json similarity index 100% rename from eclipse-solargraph-plugin/language-configuration/language-configuration.json rename to eclipse-solargraph-plugin/language-configuration/ruby-configuration.json diff --git a/eclipse-solargraph-plugin/plugin.xml b/eclipse-solargraph-plugin/plugin.xml index 792077d..05323ed 100644 --- a/eclipse-solargraph-plugin/plugin.xml +++ b/eclipse-solargraph-plugin/plugin.xml @@ -31,6 +31,13 @@ name="Gemfile" priority="high"> + + @@ -42,6 +49,10 @@ contentTypeId="io.github.pyvesb.eclipse_solargraph.gemfile" editorId="org.eclipse.ui.genericeditor.GenericEditor"> + + @@ -58,6 +69,10 @@ contentType="io.github.pyvesb.eclipse_solargraph.gemfile" id="io.github.pyvesb.eclipse_solargraph"> + + @@ -69,6 +84,10 @@ path="grammar/gemfile.tmLanguage.json" scopeName="source.ruby.gemfile"> + + @@ -77,6 +96,10 @@ contentTypeId="io.github.pyvesb.eclipse_solargraph.gemfile" scopeName="source.ruby.gemfile"> + + @@ -88,6 +111,10 @@ class="org.eclipse.tm4e.ui.text.TMPresentationReconciler" contentType="io.github.pyvesb.eclipse_solargraph.gemfile"> + + @@ -99,16 +126,24 @@ icon="icon/ruby-editor.png" contentType="io.github.pyvesb.eclipse_solargraph.gemfile"> + + + path="language-configuration/ruby-configuration.json"> + path="language-configuration/ruby-configuration.json"> + + + + diff --git a/eclipse-solargraph-plugin/snippet/sample.erb b/eclipse-solargraph-plugin/snippet/sample.erb new file mode 100644 index 0000000..46ed635 --- /dev/null +++ b/eclipse-solargraph-plugin/snippet/sample.erb @@ -0,0 +1,6 @@ + + + +

Hello, <%= user.first_name %>.

+ +