Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » References across files
References across files [message #1411082] Fri, 22 August 2014 10:48 Go to next message
Konstantin Stupnik is currently offline Konstantin StupnikFriend
Messages: 9
Registered: July 2009
Junior Member
I'm very new to xtext, so I might be missing something obvious, but...
I have some strange problem with subj.
If I use 'Launch Runtime Eclipse', then in that Eclipse names are global, and I can use names from one file in another.
But if I deploy plugin and run my CDT+Xtext+PDE/API+mydsl Eclipse, and either I open
my dsl files in existing C++ project (after adding corresponding flavour) or by
creating new generic project and dropping my dsl files there, the result is the same:
names cannot be resolved across files.

I have 'fragment = exporting.SimpleNamesFragment auto-inject {}' and 'fragment = scoping.ImportURIScopingFragment auto-inject {}'.
I have 'include' directive in my dsl and it is defined as
Include: 'include' importURI=FILENAME EOLN;
But it doesn't help at all.

What I'm missing?
Re: References across files [message #1411085 is a reply to message #1411082] Fri, 22 August 2014 10:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13271
Registered: July 2009
Senior Member
Hi,

did you disables xbase and typesgenerator fragments as well. can you share a little example, grammar and models


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: References across files [message #1411155 is a reply to message #1411085] Fri, 22 August 2014 14:26 Go to previous messageGo to next message
Konstantin Stupnik is currently offline Konstantin StupnikFriend
Messages: 9
Registered: July 2009
Junior Member
That's what happening when you try to make a post at the end of a busy day.
I didn't even typed 'Hello'.
So, Hello everyone Smile

Definition sample:
Toggle Spoiler


Grammar:
Toggle Spoiler


Terms.xtext is copy of Terminals.xtext with modified WS and INT.
I realized that you can override terminals in your grammar a little too late.

Fragment of generateDef.mw2:
Toggle Spoiler


So, no I haven't disabled Xbase.

Little note - I need this plugin for the sake of editing only.

Actually I have a few more questions.
I have 'package' keyword.
But it lasts till next package or till the end of file.
I'm not entirely sure how can I express this in the grammar...
And it mostly affects fields in fieldsets only.
Like this:
package Base
fieldset MyFieldset
  1 int id 
  2 string name
end
package Main
message SomeMsg 1
  Base.id
  Base.name
end
// or this
message AltMsg 2
  package Base
  id
  name
end


I wonder how cumbersome it is to implement it properly...
Re: References across files [message #1411165 is a reply to message #1411155] Fri, 22 August 2014 14:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13271
Registered: July 2009
Senior Member
Hi,

first of all,

if you want to use importURIs you have to disable/remove

    fragment = types.TypesGeneratorFragment auto-inject {}
  
        // generates the required bindings only if the grammar inherits from Xbase
        fragment = xbase.XbaseGeneratorFragment auto-inject {}
      
        // generates the required bindings only if the grammar inherits from Xtype
        fragment = xbase.XtypeGeneratorFragment auto-inject {}



to solve the packages problem: are they optional or not?

what about

Model:

packages+=Package+;

Package:
"package" name=ID
elements+=Element*




Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: References across files [message #1412078 is a reply to message #1411165] Mon, 25 August 2014 08:34 Go to previous messageGo to next message
Konstantin Stupnik is currently offline Konstantin StupnikFriend
Messages: 9
Registered: July 2009
Junior Member
I commented out xbase lines and it didn't really helped.
For some mysterious reason I can't find types from other file.
What bugs me - why it works when I'm launching Runtime Eclipse?


And packages are, unfortunately, optional.
Re: References across files [message #1412096 is a reply to message #1412078] Mon, 25 August 2014 09:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13271
Registered: July 2009
Senior Member
hi,

sorry then i have no idea what is going wrong can you make sure ImportUriGlobalScopeProvider is used/bound and ImportedNamespaceAwareLocalScopeProvider is not used? (AbstractYourdslRuntimeModule)


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: References across files [message #1412490 is a reply to message #1412096] Tue, 26 August 2014 09:41 Go to previous messageGo to next message
Konstantin Stupnik is currently offline Konstantin StupnikFriend
Messages: 9
Registered: July 2009
Junior Member
I double checked everything. Yes, it is required scoping.
That's really confusing.
I enabled this:
composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
Now if filename is invalid, it is underlined with red. But filename is valid!
In debugging mode everything is just fine.
The problem is with deployed plugin.

How can I add development version of plugin to production Eclipse?
Simply creating directory and copying content of bin/ and META-INF doesn't work...
Re: References across files [message #1412507 is a reply to message #1412490] Tue, 26 August 2014 10:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13271
Registered: July 2009
Senior Member
you can use the export -> deployable plugins wizard. (better if you create a feature, add the pluggins (should be already done in the sdk project) and export as deployable features - a category.xml ro catgeorize the items may help)


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: References across files [message #1412508 is a reply to message #1412507] Tue, 26 August 2014 10:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13271
Registered: July 2009
Senior Member
p.s:

how does your valid/invalid filename look like and where is it loacated relatively to the importing file


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: References across files [message #1412521 is a reply to message #1412508] Tue, 26 August 2014 11:07 Go to previous messageGo to next message
Konstantin Stupnik is currently offline Konstantin StupnikFriend
Messages: 9
Registered: July 2009
Junior Member
Plugin created with deployable plugin wizard have this strange misbehaviour.

File that is being included is in the same directory as the file that includes it. If I change it's name to non-existent, then filename is underlined with red.
I even copy/pasted files from my working project into test project in eclipse that is running plugin in debug mode.
It works just fine there.

Hm. My workspace is really really old. There is A LOT of stuff in .metadata from many versions of eclipse.
Is there a chance, that some of files in .metadata are causing this?
Ha... That's it.
I backed up .plugins directory and now it works fine.
Tomorrow I'll try bisectional method of culprit finding.
Re: References across files [message #1412795 is a reply to message #1412521] Wed, 27 August 2014 04:50 Go to previous messageGo to next message
Konstantin Stupnik is currently offline Konstantin StupnikFriend
Messages: 9
Registered: July 2009
Junior Member
Most definite culprit was line:
content-types/org.eclipse.core.runtime.text/file-extensions=def
in .plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.runtime.pre
But for some reason removing this line alone didn't help. But removing this file and org.eclipse.core.resources.prefs with org.eclipse.core.variables.prefs as well helped (nothing really suspicious was in these files).

Christian thank you for your help anyway Smile

p.s. Is there a relatively easy way to exclude files from indexing?
Re: References across files [message #1412809 is a reply to message #1412795] Wed, 27 August 2014 05:49 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13271
Registered: July 2009
Senior Member
https://www.eclipse.org/forums/index.php/m/1405243/?srch=xtext+exclude#msg_1405243

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:resolve EClass from base grammar during post processing
Next Topic:Code Formatter and comments.
Goto Forum:
  


Current Time: Thu Dec 12 14:17:13 GMT 2019

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

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

Back to the top