|
|
|
|
Re: Highlight keywords with dashes [message #1841983 is a reply to message #1841952] |
Sat, 05 June 2021 20:22 |
Nico-Pascal Huch Messages: 6 Registered: June 2021 |
Junior Member |
|
|
It seems like an edgecase, but one that could be easily fixed. As of now it's not possible to generate a mode.js file for the CodeMirror editor that highlights all keywords correctly when theres the same keyword without the dash already.
foobar
foobar-baz
baz is not highlighted, presumingly as the regex already finished on finding "foobar", so a reverse ordering would help in my opinion.
Also, as of now the list of keywords is applied as it is, even though the dash would need to be escaped if my understanding of regex is correct?
It generated a second regex for the dash alone but even here the dash would need to be escaped I think, and I'm not quite sure I understand what the second regex is doing, but it doesn't help with the highlighting.
var keywords = "foobar|foobar-baz";
var extraKeywords = "-";
{token: "keyword", regex: "\\b(?:" + keywords + ")\\b"},
{token: "keyword", regex: "(?:^|\\s)(?:" + extraKeywords + ")(?=[\\s.:;,!?+\\-*/&|<>()[\\]{}]|$)"}
As of now I see no other way but to edit the file by hand so it will work. Is there anyone I can contact so this might get looked at?
|
|
|
|
Re: Highlight keywords with dashes [message #1842658 is a reply to message #1841931] |
Sun, 27 June 2021 16:19 |
Nico-Pascal Huch Messages: 6 Registered: June 2021 |
Junior Member |
|
|
Hello again, thanks for your help so far. Currently I am trying to subclassing the WebIntegrationFragment-class. I created a new class called "CustomWebIntegrationFragment" and tried to add it to my mwe2-Configuration file by adding the import and classname to the file:
webSupport = CustomWebIntegrationFragment {
[...]
codeMirrorVersion = "5.52.2"
framework = "CodeMirror"
generateJsHighlighting = true
keywordsFilter = "[a-zA-Z0-9_-]+"
}
The class currently contains no logic as I wanted to test if it builds first:
import org.eclipse.xtext.xtext.generator.web.WebIntegrationFragment
class CustomWebIntegrationFragment extends WebIntegrationFragment {
}
But when I try to built the language I also get an error that he cannot find my subclassed WebIntegrationFragment .
[ERROR] [XtextLinkingDiagnostic: null:76 Couldn't resolve reference to JvmType 'CustomWebIntegrationFragment'., XtextLinkingDiagnostic: null:77 Couldn't resolve reference to JvmIdentifiableElement 'generateHtmlExample'., XtextLinkingDiagnostic: null:78 Couldn't resolve reference to JvmIdentifiableElement 'codeMirrorVersion'., XtextLinkingDiagnostic: null:79 Couldn't resolve reference to JvmIdentifiableElement 'requireJsVersion'., XtextLinkingDiagnostic: null:80 Couldn't resolve reference to JvmIdentifiableElement 'requireJsTextVersion'., XtextLinkingDiagnostic: null:81 Couldn't resolve reference to JvmIdentifiableElement 'jQueryVersion'., XtextLinkingDiagnostic: null:82 Couldn't resolve reference to JvmIdentifiableElement 'framework'., XtextLinkingDiagnostic: null:83 Couldn't resolve reference to JvmIdentifiableElement 'generateJettyLauncher'., XtextLinkingDiagnostic: null:84 Couldn't resolve reference to JvmIdentifiableElement 'generateJsHighlighting'., XtextLinkingDiagnostic: null:85 Couldn't resolve reference to JvmIdentifiableElement 'generateServlet'., XtextLinkingDiagnostic: null:86 Couldn't resolve reference to JvmIdentifiableElement 'generateWebXml'., XtextLinkingDiagnostic: null:87 Couldn't resolve reference to JvmIdentifiableElement 'highlightingModuleName'., XtextLinkingDiagnostic: null:88 Couldn't resolve reference to JvmIdentifiableElement 'keywordsFilter'., XtextLinkingDiagnostic: null:90 Couldn't resolve reference to JvmIdentifiableElement 'suppressPattern'., XtextLinkingDiagnostic: null:91 Couldn't resolve reference to JvmIdentifiableElement 'suppressPattern'., XtextLinkingDiagnostic: null:92 Couldn't resolve reference to JvmIdentifiableElement 'suppressPattern'., XtextLinkingDiagnostic: null:93 Couldn't resolve reference to JvmIdentifiableElement 'suppressPattern'., XtextLinkingDiagnostic: null:94 Couldn't resolve reference to JvmIdentifiableElement 'suppressPattern'., XtextLinkingDiagnostic: null:95 Couldn't resolve reference to JvmIdentifiableElement 'suppressPattern'.]
java.lang.IllegalStateException: [XtextLinkingDiagnostic: null:76 Couldn't resolve reference to JvmType 'CustomWebIntegrationFragment'., XtextLinkingDiagnostic: null:77 Couldn't resolve reference to JvmIdentifiableElement 'generateHtmlExample'., XtextLinkingDiagnostic: null:78 Couldn't resolve reference to JvmIdentifiableElement 'codeMirrorVersion'., XtextLinkingDiagnostic: null:79 Couldn't resolve reference to JvmIdentifiableElement 'requireJsVersion'., XtextLinkingDiagnostic: null:80 Couldn't resolve reference to JvmIdentifiableElement 'requireJsTextVersion'., XtextLinkingDiagnostic: null:81 Couldn't resolve reference to JvmIdentifiableElement 'jQueryVersion'., XtextLinkingDiagnostic: null:82 Couldn't resolve reference to JvmIdentifiableElement 'framework'., XtextLinkingDiagnostic: null:83 Couldn't resolve reference to JvmIdentifiableElement 'generateJettyLauncher'., XtextLinkingDiagnostic: null:84 Couldn't resolve reference to JvmIdentifiableElement 'generateJsHighlighting'., XtextLinkingDiagnostic: null:85 Couldn't resolve reference to JvmIdentifiableElement 'generateServlet'., XtextLinkingDiagnostic: null:86 Couldn't resolve reference to JvmIdentifiableElement 'generateWebXml'., XtextLinkingDiagnostic: null:87 Couldn't resolve reference to JvmIdentifiableElement 'highlightingModuleName'., XtextLinkingDiagnostic: null:88 Couldn't resolve reference to JvmIdentifiableElement 'keywordsFilter'., XtextLinkingDiagnostic: null:90 Couldn't resolve reference to JvmIdentifiableElement 'suppressPattern'., XtextLinkingDiagnostic: null:91 Couldn't resolve reference to JvmIdentifiableElement 'suppressPattern'., XtextLinkingDiagnostic: null:92 Couldn't resolve reference to JvmIdentifiableElement 'suppressPattern'., XtextLinkingDiagnostic: null:93 Couldn't resolve reference to JvmIdentifiableElement 'suppressPattern'., XtextLinkingDiagnostic: null:94 Couldn't resolve reference to JvmIdentifiableElement 'suppressPattern'., XtextLinkingDiagnostic: null:95 Couldn't resolve reference to JvmIdentifiableElement 'suppressPattern'.]
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:89)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:63)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:53)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:79)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:37)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:254)
at java.base/java.lang.Thread.run(Thread.java:834)
First I thought it's a problem because my CustomWebIntegrationFragment is in separate Webproject that gets built after the language, but also moving the class to the actual language project didn't help. Eclipse shows no error in the mwe2 file but does so when I remove the import which makes me think that the mwe2 file should be correct.
Am I missing something?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08850 seconds