Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Content Assist don't work in first column of second line...
Content Assist don't work in first column of second line... [message #848050] Tue, 17 April 2012 18:48 Go to next message
Eclipse UserFriend
Hi again,
I've implemented a new pilot to test importing resources stuffs... It is reaally cool !

But there are something wrong with content assist that I couldn't find why...:

If I type crtl-space in a empty file at first position, It shows me the content assist with Risk:, Roles: and import options.

So, If I choose any option and type enter, at the second line and first column the content assist doesn't work. It just works after I enter a space...

could someone give me a tip here?

That is my grammar:
grammar org.xtext.example.risks.RiskDsl with org.eclipse.xtext.common.Terminals hidden(WS, NewLine)

generate riskDsl "http://www.xtext.org/example/risks/RiskDsl"

RiskModel :
	{RiskModel}
	(
	(imports += Import*)
	(rolesLibrary=RoleLibrary)?
	(risks+=Risk*)
	)

;

Risk:
	{Risk}
	'Risk:' ((name=STRING)
	('roles=' (assignedRoles+=[Role|STRING]) (',' roles+=[Role|STRING])*)? 
	)
;

RoleLibrary :
	{RoleLibrary}
	'Roles:' (id=ID
		(roles+=Role*)
	)
;

Role :
	{Role}
	'Role:' 
		(id=ID 'name=' name=STRING)
	
;

Import hidden (WS, ID):
	'import' (importURI=STRING) 
;
terminal SL_COMMENT 	: '!-' -> NewLine
	
;
terminal WS:
	(' ' | '\t')+
;
terminal NewLine:
	('\r'? '\n')+
;


This is the text that I enter. repare in the space that I'm forced to enter before "Role:"
Roles:
 Role: id=kb name="Kill Bill"
 Role: id=jim name="Jim M"

[Updated on: Tue, 17 April 2012 21:57] by Moderator

Re: Content Assist don't work in first column of second line... [message #849017 is a reply to message #848050] Wed, 18 April 2012 16:06 Go to previous messageGo to next message
Eclipse UserFriend
That's intended Eclipse behavior. Content assist tries to complete the
current word when there is no whitespace before the caret position. Same
as in JDT and any other editor.

Am 18.04.12 00:49, schrieb Cristiano Gaviao:
> Hi again,
> I've implemented a new pilot to test importing resources stuffs... It is
> reaally cool !
>
> But there are something wrong with content assist that I couldn't find
> why...:
> If I type crtl-space in a empty file at first position, It shows me the
> content assist with Risk:, Roles: and import options.
>
> So, If I choose anyone option and type enter, at the second line and
> first column the content assist doesn't work. It just works after I
> enter a space...
>
> could someone give me a tip here?
>
> That is my grammar:
>
> grammar org.xtext.example.risks.RiskDsl with
> org.eclipse.xtext.common.Terminals hidden(WS, NewLine)
>
> generate riskDsl "http://www.xtext.org/example/risks/RiskDsl"
>
> RiskModel :
> {RiskModel}
> (
> (imports += Import*)
> (rolesLibrary=RoleLibrary)?
> (risks+=Risk*)
> )
> ;
> Risk:
> {Risk}
> ('Risk:' ('name=' name=STRING)
> ('roles=' (roles+=[Role|STRING]) ((',' (roles+=[Role|STRING]))*)?)? )
> ;
> RoleLibrary :
> {RoleLibrary}
> ('Roles:'
> (roles+=Role*)
> )
> ;
> Role :
> ('Role:' ('id=' id=ID 'name=' name=STRING)
> )
> ;
> Import hidden (WS, ID):
> ('import' importURI=STRING) ;
> terminal SL_COMMENT : '!-' -> NewLine
>
> ;
> terminal WS:
> (' ' | '\t')+
> ;
> terminal NewLine:
> ('\r'? '\n')+
> ;
>
>
> This is the text that I enter. repare in the space that I'm forced to
> enter before "Role:"
>
> Roles:
> Role: id=kb name="Kill Bill"
> Role: id=jim name="Jim M"
>


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Content Assist don't work in first column of second line... [message #849803 is a reply to message #849017] Thu, 19 April 2012 09:11 Go to previous messageGo to next message
Eclipse UserFriend
Jan Kohnlein wrote on Wed, 18 April 2012 23:06
That's intended Eclipse behavior. Content assist tries to complete the
current word when there is no whitespace before the caret position. Same
as in JDT and any other editor.


Hi Jan,

Thanks for the worry, but I think you didn't understood well my point Smile


In JDT or Xtend Class for example, if I enter this
import whatever.package.clazz; [hit enter here]


and hit a enter, the content assist will work properly in the first column of the line below the first import, am I right ?

so in this example we will have this:
import whatever.package.clazz;[hit enter here]
<content assist works here in the first column of the next line>


and in my dsl it just don't happen... if I hit the enter after the first import sentence, content assist doesn't appears in the next line at the first column...

So, or I just did something wrong (that I can't find or it is a bug)

regards,

Cristiano
Re: Content Assist don't work in first column of second line... [message #851053 is a reply to message #848050] Fri, 20 April 2012 11:49 Go to previous messageGo to next message
Eclipse UserFriend
After long hours of trials and errors I've found the culprit. :/

It seems that exists some code in content assist api that is based on WS terminal.

After I've removed this:
terminal WS:
	(' ' | '\t')+
;
terminal NewLine:
	('\r'? '\n')+
;


This change let me use the content assist in first column, but still showing something that wouldn't appear. So after I have included '{' '}' delimiters the content assist starts to work properly.

Could someone explain me this relationship between WS terminal and delimiters with Content Assist ?

cheers,

Cristiano
Re: Content Assist don't work in first column of second line... [message #851152 is a reply to message #851053] Fri, 20 April 2012 13:53 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

i just gave it a debug session. the problem is a combination of
you not obeying Xtext's naming conventions
and Xtext relying on this conventions

The name of the Rule is NewLine but Xtext searches for NEWLINE in
org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser.createLeafNode(Token, EObject)

would you please file a bugzilla

~Christian
Re: Content Assist don't work in first column of second line... [message #851235 is a reply to message #851152] Fri, 20 April 2012 15:45 Go to previous message
Eclipse UserFriend
Hi Christian,

I've confirmed the problem... it have worked after I have changed the terminal named as NewLine to NEWLINE instead...

I've opened the bug.

thanks,

Cristiano


Previous Topic:append instead of appendImmediate for "AFTER" in loops
Next Topic:Another Content Assist doubt
Goto Forum:
  


Current Time: Tue Jul 22 11:47:14 EDT 2025

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

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

Back to the top