Search code examples
xtexteclipse-orion

Xtext Content Assist not triggered by CTRL+SPACE inside the Orion web editor


I am trying to use Xtext (2.14.0) together with the Orion web editor, but even with a simple example the Content Assist is not triggered by CTRL+SPACE inside the Orion editor.

From what I know, CTRL+SPACE is used by default to trigger the Content Assist inside the Orion editor.

I also want to mention that if I add a character to the "contentAssistCharTriggers" option (as described in the Xtext documentation), than the specified character triggers the Content Assist, but CTRL+SPACE still doesn't work.

Does anyone know what could be the problem?

Update: I am using the basic xtext state machine example. Below is the html file used to embed the Orion Editor:

<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="Content-Language" content="en-us">
	<title>Example Web Editor</title>
	<link rel="stylesheet" type="text/css" href="dependencies/orion/code_edit/built-codeEdit.css"/>
	<link rel="stylesheet" type="text/css" href="xtext/2.14.0/xtext-orion.css"/>
	<link rel="stylesheet" type="text/css" href="style.css"/>
	<script src="webjars/requirejs/2.3.2/require.min.js"></script>
	<script type="text/javascript">
		var baseUrl = window.location.pathname;
		var fileIndex = baseUrl.indexOf("index.html");
		if (fileIndex > 0)
			baseUrl = baseUrl.slice(0, fileIndex);
		require.config({
			baseUrl: baseUrl,
			paths: {
				"text": "webjars/requirejs-text/2.0.15/text",
				"jquery": "webjars/jquery/2.2.4/jquery.min",
				"xtext/xtext-orion": "xtext/2.14.0/xtext-orion"
			}
		});
		require(["dependencies/orion/code_edit/built-codeEdit-amd"], function() {
			require(["xtext/xtext-orion"], function(xtext) {
				xtext.createEditor({
					baseUrl: baseUrl,
					syntaxDefinition: "xtext-resources/generated/mylang-syntax",
					contentAssistCharTriggers: " "				
				});
			});
		});
	</script>
</head>
<body>

<div class="container">
	<div class="header">
		<h1>Demo</h1>
	</div>
	<div class="content">
		<div id="xtext-editor" data-editor-xtext-lang="mylang"></div>
	</div>
</div>

</body>
</html>


Solution

  • here is the index html that works fine for me (content assist with crtl+space)

    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="Content-Language" content="en-us">
        <title>Example Web Editor</title>
        <link rel="stylesheet" type="text/css" href="orion/code_edit/built-codeEdit.css"/>
        <link rel="stylesheet" type="text/css" href="xtext/2.14.0/xtext-orion.css"/>
        <link rel="stylesheet" type="text/css" href="style.css"/>
        <script src="webjars/requirejs/2.3.2/require.min.js"></script>
        <script type="text/javascript">
            var baseUrl = window.location.pathname;
            var fileIndex = baseUrl.indexOf("index.html");
            if (fileIndex > 0)
                baseUrl = baseUrl.slice(0, fileIndex);
            require.config({
                baseUrl: baseUrl,
                paths: {
                    "text": "webjars/requirejs-text/2.0.15/text",
                    "jquery": "webjars/jquery/2.2.4/jquery.min",
                    "xtext/xtext-orion": "xtext/2.14.0/xtext-orion"
                }
            });
            require(["orion/code_edit/built-codeEdit-amd"], function() {
                require(["xtext/xtext-orion"], function(xtext) {
                    xtext.createEditor({
                        baseUrl: baseUrl,
                        syntaxDefinition: "xtext-resources/generated/mydsl-syntax"
                    });
                });
            });
        </script>
    </head>
    <body>
    
    <div class="container">
        <div class="header">
            <h1>Example MyDsl Web Editor</h1>
        </div>
        <div class="content">
            <div id="xtext-editor" data-editor-xtext-lang="mydsl">
            </div>  
        </div>
    </div>
    
    </body>
    </html>
    

    and here is how your stuff looks like

    enter image description here