Add article "Eclipse TM4E - Sharing features between code editors.."
A long time ago I had written this article https://www.eclipse.org/community/eclipse_newsletter/2018/june/tm4e.php which is a simple article which I think provide a good start to use tm4e as user or as developer who whishes integrate textmate in their plugin.
What do you think to add this article in the README? If yes where?
Thanks for your suggestion
Maybe you can reference it directly before the install section in the readme.
Great article https://www.eclipse.org/community/eclipse_newsletter/2018/june/tm4e.php. Unfortunately if I follow the plug-in section on implementation I get at runtime lots of warnings, something like this:
Nov 20, 2024 5:00:11 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [source.applescript]
Nov 20, 2024 5:00:11 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [text.html.textile]
Nov 20, 2024 5:00:11 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [source.c++]
Nov 20, 2024 5:00:11 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [source.js.jquery]
Nov 20, 2024 5:00:12 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [source.scala]
Nov 20, 2024 5:00:12 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [text.log]
Is there a description how to avoid these?
This means the currently parsed grammar has inline references to these other grammars that are not installed. To avoid them you would have to install grammars with these scope names or remove these references from that particular grammar.
Thanks @sebthom. I can confirm that if I use a simpler file it works flawless. I pushed the smaller file to https://www.vogella.com/tutorials/EclipseEditors/article.html#exercise-implementing-syntax-highlighting-using-text-mate (using and giving credit to @angelozerr original post) so that other can also follow without errors. Unfortunately the tutorial build takes 1-2 hours, so the update will only be available later.
This is example grammer I will use:
{
{
"scopeName": "source.shell",
"name": "Shell Script",
"fileTypes": ["sh", "bash"],
"patterns": [
{
"name": "comment.line.number-sign.shell",
"match": "#.*$"
},
{
"name": "string.quoted.double.shell",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "variable.other.shell",
"match": "\\$[a-zA-Z_][a-zA-Z0-9_]*"
}
]
},
{
"name": "string.quoted.single.shell",
"begin": "'",
"end": "'"
},
{
"name": "variable.other.shell",
"match": "\\$[a-zA-Z_][a-zA-Z0-9_]*"
},
{
"name": "keyword.control.shell",
"match": "\\b(if|then|else|fi|for|while|do|done|case|esac)\\b"
},
{
"name": "keyword.operator.shell",
"match": "\\b(and|or|not)\\b"
},
{
"name": "support.function.builtin.shell",
"match": "\\b(echo|cd|exit|pwd|read)\\b"
}
],
"repository": {},
"uuid": "eae8d676-1b23-11e0-ac64-0800200c9a66"
}
Thanks @sebthom. I can confirm that if I use a simpler file it works flawless. I pushed the smaller file to https://www.vogella.com/tutorials/EclipseEditors/article.html#exercise-implementing-syntax-highlighting-using-text-mate (using and giving credit to @angelozerr original post) so that other can also follow without errors.
Thanks @vogella !
Unfortunately the tutorial build takes 1-2 hours, so the update will only be available later.
This is example grammer I will use:
{ { "scopeName": "source.shell", "name": "Shell Script", "fileTypes": ["sh", "bash"], "patterns": [ { "name": "comment.line.number-sign.shell", "match": "#.*$" }, { "name": "string.quoted.double.shell", "begin": "\"", "end": "\"", "patterns": [ { "name": "variable.other.shell", "match": "\\$[a-zA-Z_][a-zA-Z0-9_]*" } ] }, { "name": "string.quoted.single.shell", "begin": "'", "end": "'" }, { "name": "variable.other.shell", "match": "\\$[a-zA-Z_][a-zA-Z0-9_]*" }, { "name": "keyword.control.shell", "match": "\\b(if|then|else|fi|for|while|do|done|case|esac)\\b" }, { "name": "keyword.operator.shell", "match": "\\b(and|or|not)\\b" }, { "name": "support.function.builtin.shell", "match": "\\b(echo|cd|exit|pwd|read)\\b" } ], "repository": {}, "uuid": "eae8d676-1b23-11e0-ac64-0800200c9a66" }
@vogella Maybe you could use another grammar than https://raw.githubusercontent.com/textmate/shellscript.tmbundle/master/Syntaxes/Shell-Unix-Bash.tmLanguage for your exercise. If you look for source. in that file you will find all the references to other languages. For example this one https://github.com/textmate/ini.tmbundle/blob/master/Syntaxes/Ini.plist
Thanks @sebthom for the suggestion. I will add this as an additional exercise. For the first example I wanted to have something which also demonstrates the folding in the second step for the same editor.
FYI I opened https://github.com/eclipse-lemminx/lemminx/issues/1709 as by default the XML file comes up with tons of errors and it is hard to find the correct preference for it.
For this issue, I suggest to put the link to @angelozerr and my tutorial into a documentation file in the /documentation folder. Is that OK @sebthom? How should the file be called?
Either creating a documentation/README.md, or even creating a new "Documentation" entry in the main README with links to those resources and to the documentation folder.