Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Content assist is not showing available dsl files for import
Content assist is not showing available dsl files for import [message #1857306] Mon, 30 January 2023 06:10 Go to next message
Loredana Hozan is currently offline Loredana HozanFriend
Messages: 34
Registered: January 2019
Member
Hello,
I have an issue while i try to import a dsl file into another dsl file of another type. I have two languages datamodel and vdatamodel. I am trying to import the datamodel into vdatamodel file but content assist is not showing me the available datamodel files and i don't know what i am missing.

my code for vdatamodel is as follows:

grammar com.vdatamodel.VDatamodel with org.eclipse.xtext.common.Terminals

generate vDatamodel "http://www.myApp.com/vdatamodel/VDatamodel"

import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http://www.myApp.com/datamodel/DatamodelDsl" as datamodelDsl

VirtualDatamodel: 
	('import' imports+=DatamodelImportDeclaration (',' imports+=DatamodelImportDeclaration)*)?  
;
 
DatamodelImportDeclaration returns DatamodelImportDeclaration:
   referenced=[datamodelDsl::Datamodel|CTXT_FQN]; 
   
terminal CTXT_FQN:
    '"'ID '.' 'datamodel"';


In the mwe2 i have:

Workflow {
	
	bean = org.eclipse.emf.mwe.utils.StandaloneSetup {
        scanClassPath = true
        platformUri = "${rootPath}/com.datamodel/"
        registerGeneratedEPackage = "com.datamodel.datamodelDsl.DatamodelDslPackage"
        registerGenModelFile = "platform:/resource/com.datamodel/model//generated/DatamodelDsl.genmodel"
    }
	
	component = org.eclipse.emf.mwe2.ecore.EcoreGenerator {
		genModel = "platform:/resource/com.vdatamodel/model/generated/VDatamodel.genmodel"
		srcPath = "platform:/resource/com.vdatamodel/src-gen"
	}
	
    bean = org.eclipse.emf.mwe.utils.StandaloneSetup {
        scanClassPath = true
        platformUri = "${rootPath}"
     }	

	component = XtextGenerator {
		configuration = {
			project = StandardProjectConfig {
				baseName = "com.vdatamodel"
				rootPath = rootPath
				runtimeTest = {
					enabled = true
				}
				eclipsePlugin = {
					enabled = true
				}
				eclipsePluginTest = {
					enabled = true
				}
				createEclipseMetaData = true
			}
			code = {
				encoding = "windows-1252"
				lineDelimiter = "\r\n"
				fileHeader = "/*\n * generated by Xtext \${version}\n */"
				preferXtendStubs = false
			}
		}
		language = StandardLanguage {
			name = "com.vdatamodel.VDatamodel"
			fileExtensions = "vdatamodel"
			
			referencedResource = "platform:/resource/com.datamodel/model//generated/DatamodelDsl.ecore"
			referencedResource = "platform:/resource/com.datamodel/model//generated/DatamodelDsl.genmodel"
			
			fragment = ecore2xtext.Ecore2XtextValueConverterServiceFragment2 auto-inject {}
			
			fragment = ui.quickfix.QuickfixProviderFragment2 auto-inject {}

			serializer ..
			validator ...
			generator ...
		
		}
	}
}



I've also created the value convertor for CTXT_FQN :
	@ValueConverter(rule="CTXT_FQN")
	def IValueConverter<String> ContextFqn() {
		new ContextFqnConverter()
	}
	
	static class ContextFqnConverter implements IValueConverter<String> {
		override toValue(String string, INode node) {
			return string.substring(1, string.lastIndexOf('.'))
		}

		override toString(String value) {
			return "\"" + value + ".datamodel\""
		}
	}


and i have added the bindings for the value convertor, scope provider, qualified name, IOutputConfig and OutputConfig in the RuntimeModule. Any help would be appreciated.



Re: Content assist is not showing available dsl files for import [message #1857310 is a reply to message #1857306] Mon, 30 January 2023 06:55 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14687
Registered: July 2009
Senior Member
did you check if the datamodelDsl::Datamodel are properly indexed ? (navigate open model element dialog)

and have the proper name following the
terminal CTXT_FQN:
'"'ID '.' 'datamodel"';

pattern

did you debug the proposal provider (DefaultProposalCreator, org.eclipse.xtext.ui.editor.contentassist.AbstractJavaBasedContentProposalProvider.ReferenceProposalCreator.lookupCrossReference(EObject, EReference, ICompletionProposalAcceptor, Predicate<IEObjectDescription>, Function<IEObjectDescription, ICompletionProposal>))


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 30 January 2023 07:35]

Report message to a moderator

Previous Topic:Downloading XText, sdk not found
Next Topic:generator output relative to dsl file
Goto Forum:
  


Current Time: Sun Jun 23 11:28:30 GMT 2024

Powered by FUDForum. Page generated in 0.03190 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top