Please consider editing your post and mark it as obsolete instead. Do you want to delete post?
Why must IDEA insert space after IntellijIdeaRulezzz?
Permanently deleted user
Created
It seems that IDEA messes up my parser when it inserts a space after IntellijIdeaRulezzz during completion. Is this necessary? Why? How should I avoid it?
Why should you? the whitespace is there to delimit the created token from the next one. Without it, it would be IntellijIdeaRulezzzBlahBlah, so that we won't recognize our inserted token. Why do you have problems with that?
It seems that IDEA messes up my parser when it inserts a space after IntellijIdeaRulezzz during completion. Is this necessary? Why? How should I avoid it?
I feel sure that you can imagine a situation where "a b(x)" is an entirely different construct than "ab(x)", which I believe is the case here. I didn't write the parser for this language, so I'm not sure about it, but I think the space is a problem.
Why does IDEA need to delimit the token from the next one, or recognize the inserted token?
Eugene Vigdorchik (JetBrains) wrote:
Why should you? the whitespace is there to delimit the created token from the next one. Without it, it would be IntellijIdeaRulezzzBlahBlah, so that we won't recognize our inserted token. Why do you have problems with that?
>>It seems that IDEA messes up my parser when it inserts a space after >>IntellijIdeaRulezzz during completion. Is this necessary? Why? How should >>I avoid it?
a b(x) is different form ab(x) in all languages excluding probably some very exotic that I cannot recall right now. Idea needs to recognize this token since it is synthetic, so it needs to be later deleted. And in order to find it, we insert the space (and of course it is deleted with the IntellijIdeaRulezzz token :) I still don't get your problem here.
Eugene.
"Keith Lea" <keith@cs.oswego.edu> wrote in message news:dk7vc3$8gr$1@is.intellij.net... >I feel sure that you can imagine a situation where "a b(x)" is an entirely >different construct than "ab(x)", which I believe is the case here. I >didn't write the parser for this language, so I'm not sure about it, but I >think the space is a problem. >
Why does IDEA need to delimit the token from the next one, or recognize the inserted token?
>
Eugene Vigdorchik (JetBrains) wrote:
>> Why should you? >> the whitespace is there to delimit the created token from the next one. >> Without it, it would be >> IntellijIdeaRulezzzBlahBlah, so that we won't recognize our inserted >> token. Why do you have problems with that? >> >> Eugene. >> >> "Keith Lea" <keith@cs.oswego.edu> wrote in message >> news:dk64an$gpo$1@is.intellij.net... >> >>>It seems that IDEA messes up my parser when it inserts a space after >>>IntellijIdeaRulezzz during completion. Is this necessary? Why? How should >>>I avoid it? >> >>
Let's say in my language, "ab(x)" contains a reference, but "a b(x)" contains no reference. So, when a user has "a(x)" and cursor is after "a", inside a reference, he presses Ctrl+Space and now there is no reference, so completion fails. Do you see the problem?
Eugene Vigdorchik (JetBrains) wrote:
a b(x) is different form ab(x) in all languages excluding probably some very exotic that I cannot recall right now. Idea needs to recognize this token since it is synthetic, so it needs to be later deleted. And in order to find it, we insert the space (and of course it is deleted with the IntellijIdeaRulezzz token :) I still don't get your problem here.
>>I feel sure that you can imagine a situation where "a b(x)" is an entirely >>different construct than "ab(x)", which I believe is the case here. I >>didn't write the parser for this language, so I'm not sure about it, but I >>think the space is a problem. >> >>Why does IDEA need to delimit the token from the next one, or recognize >>the inserted token? >> >>Eugene Vigdorchik (JetBrains) wrote: >> >>>Why should you? >>>the whitespace is there to delimit the created token from the next one. >>>Without it, it would be >>> IntellijIdeaRulezzzBlahBlah, so that we won't recognize our inserted >>>token. Why do you have problems with that? >>> >>>Eugene. >>> >>>"Keith Lea" <keith@cs.oswego.edu> wrote in message >>>news:dk64an$gpo$1@is.intellij.net... >>> >>> >>>>It seems that IDEA messes up my parser when it inserts a space after >>>>IntellijIdeaRulezzz during completion. Is this necessary? Why? How should >>>>I avoid it? >>> >>>
I see (though I was thinking you talk about inserting a space after the dummy identifier), and now that I look at the code itself I don't see where the space is inserted. Are you sure this hapens at the same time when dummy identifier is inserted?
Let's say in my language, "ab(x)" contains a reference, but "a b(x)" contains no reference. So, when a user has "a(x)" and cursor is after "a", inside a reference, he presses Ctrl+Space and now there is no reference, so completion fails. Do you see the problem?
>
Eugene Vigdorchik (JetBrains) wrote:
>> a b(x) is different form ab(x) in all languages excluding probably some >> very exotic that I cannot recall right now. >> Idea needs to recognize this token since it is synthetic, so it needs to >> be later deleted. And in order to find it, we insert the space >> (and of course it is deleted with the IntellijIdeaRulezzz token :) >> I still don't get your problem here. >> >> Eugene. >> >> >> "Keith Lea" <keith@cs.oswego.edu> wrote in message >> news:dk7vc3$8gr$1@is.intellij.net... >> >>>I feel sure that you can imagine a situation where "a b(x)" is an >>>entirely different construct than "ab(x)", which I believe is the case >>>here. I didn't write the parser for this language, so I'm not sure about >>>it, but I think the space is a problem. >>> >>>Why does IDEA need to delimit the token from the next one, or recognize >>>the inserted token? >>> >>>Eugene Vigdorchik (JetBrains) wrote: >>> >>>>Why should you? >>>>the whitespace is there to delimit the created token from the next one. >>>>Without it, it would be >>>> IntellijIdeaRulezzzBlahBlah, so that we won't recognize our inserted >>>> token. Why do you have problems with that? >>>> >>>>Eugene. >>>> >>>>"Keith Lea" <keith@cs.oswego.edu> wrote in message >>>>news:dk64an$gpo$1@is.intellij.net... >>>> >>>> >>>>>It seems that IDEA messes up my parser when it inserts a space after >>>>>IntellijIdeaRulezzz during completion. Is this necessary? Why? How >>>>>should I avoid it? >>>> >>>> >>
I see (though I was thinking you talk about inserting a space after the dummy identifier),
With "dd|d" where | is cursor, pressing Ctrl+Space produces "ddIntellijIdeaRulezzz d" which is passed to ReferenceProvider etc.
and now that I look at the code itself I don't see where the space is inserted. Are you sure this hapens at the same time when dummy identifier is inserted?
I'm not sure when it happens exactly, but I'm not inserting the space myself, so it seems like IDEA is doing it somehow.
>>Let's say in my language, "ab(x)" contains a reference, but "a b(x)" >>contains no reference. So, when a user has "a(x)" and cursor is after "a", >>inside a reference, he presses Ctrl+Space and now there is no reference, >>so completion fails. Do you see the problem? >> >>Eugene Vigdorchik (JetBrains) wrote: >> >>>a b(x) is different form ab(x) in all languages excluding probably some >>>very exotic that I cannot recall right now. >>>Idea needs to recognize this token since it is synthetic, so it needs to >>>be later deleted. And in order to find it, we insert the space >>>(and of course it is deleted with the IntellijIdeaRulezzz token :) >>>I still don't get your problem here. >>> >>>Eugene. >>> >>> >>>"Keith Lea" <keith@cs.oswego.edu> wrote in message >>>news:dk7vc3$8gr$1@is.intellij.net... >>> >>> >>>>I feel sure that you can imagine a situation where "a b(x)" is an >>>>entirely different construct than "ab(x)", which I believe is the case >>>>here. I didn't write the parser for this language, so I'm not sure about >>>>it, but I think the space is a problem. >>>> >>>>Why does IDEA need to delimit the token from the next one, or recognize >>>>the inserted token? >>>> >>>>Eugene Vigdorchik (JetBrains) wrote: >>>> >>>> >>>>>Why should you? >>>>>the whitespace is there to delimit the created token from the next one. >>>>>Without it, it would be >>>>>IntellijIdeaRulezzzBlahBlah, so that we won't recognize our inserted >>>>>token. Why do you have problems with that? >>>>> >>>>>Eugene. >>>>> >>>>>"Keith Lea" <keith@cs.oswego.edu> wrote in message >>>>>news:dk64an$gpo$1@is.intellij.net... >>>>> >>>>> >>>>> >>>>>>It seems that IDEA messes up my parser when it inserts a space after >>>>>>IntellijIdeaRulezzz during completion. Is this necessary? Why? How >>>>>>should I avoid it? >>>>> >>>>>
I'm not sure when it happens exactly, but I'm not inserting the space myself, so it seems like IDEA is doing it somehow.
The point is that IDEA also has some post-processing phase which is triggered when the item is actually inserted in the editor . This phase is indeed buggy from the language point of view (see next thread for an example). Probably you hit the same problem.
I had a similar problem. And the only solution was joining the different reference types.
Keith Lea schrieb:
Let's say in my language, "ab(x)" contains a reference, but "a b(x)" contains no reference. So, when a user has "a(x)" and cursor is after "a", inside a reference, he presses Ctrl+Space and now there is no reference, so completion fails. Do you see the problem?
Why should you?
the whitespace is there to delimit the created token from the next one.
Without it, it would be
IntellijIdeaRulezzzBlahBlah, so that we won't recognize our inserted token.
Why do you have problems with that?
Eugene.
"Keith Lea" <keith@cs.oswego.edu> wrote in message
news:dk64an$gpo$1@is.intellij.net...
I feel sure that you can imagine a situation where "a b(x)" is an
entirely different construct than "ab(x)", which I believe is the case
here. I didn't write the parser for this language, so I'm not sure about
it, but I think the space is a problem.
Why does IDEA need to delimit the token from the next one, or recognize
the inserted token?
Eugene Vigdorchik (JetBrains) wrote:
>>It seems that IDEA messes up my parser when it inserts a space after
>>IntellijIdeaRulezzz during completion. Is this necessary? Why? How should
>>I avoid it?
a b(x) is different form ab(x) in all languages excluding probably some very
exotic that I cannot recall right now.
Idea needs to recognize this token since it is synthetic, so it needs to be
later deleted. And in order to find it, we insert the space
(and of course it is deleted with the IntellijIdeaRulezzz token :)
I still don't get your problem here.
Eugene.
"Keith Lea" <keith@cs.oswego.edu> wrote in message
news:dk7vc3$8gr$1@is.intellij.net...
>I feel sure that you can imagine a situation where "a b(x)" is an entirely
>different construct than "ab(x)", which I believe is the case here. I
>didn't write the parser for this language, so I'm not sure about it, but I
>think the space is a problem.
>
>
>> Why should you?
>> the whitespace is there to delimit the created token from the next one.
>> Without it, it would be
>> IntellijIdeaRulezzzBlahBlah, so that we won't recognize our inserted
>> token. Why do you have problems with that?
>>
>> Eugene.
>>
>> "Keith Lea" <keith@cs.oswego.edu> wrote in message
>> news:dk64an$gpo$1@is.intellij.net...
>>
>>>It seems that IDEA messes up my parser when it inserts a space after
>>>IntellijIdeaRulezzz during completion. Is this necessary? Why? How should
>>>I avoid it?
>>
>>
Let's say in my language, "ab(x)" contains a reference, but "a b(x)"
contains no reference. So, when a user has "a(x)" and cursor is after
"a", inside a reference, he presses Ctrl+Space and now there is no
reference, so completion fails. Do you see the problem?
Eugene Vigdorchik (JetBrains) wrote:
>>I feel sure that you can imagine a situation where "a b(x)" is an entirely
>>different construct than "ab(x)", which I believe is the case here. I
>>didn't write the parser for this language, so I'm not sure about it, but I
>>think the space is a problem.
>>
>>Why does IDEA need to delimit the token from the next one, or recognize
>>the inserted token?
>>
>>Eugene Vigdorchik (JetBrains) wrote:
>>
>>>Why should you?
>>>the whitespace is there to delimit the created token from the next one.
>>>Without it, it would be
>>> IntellijIdeaRulezzzBlahBlah, so that we won't recognize our inserted
>>>token. Why do you have problems with that?
>>>
>>>Eugene.
>>>
>>>"Keith Lea" <keith@cs.oswego.edu> wrote in message
>>>news:dk64an$gpo$1@is.intellij.net...
>>>
>>>
>>>>It seems that IDEA messes up my parser when it inserts a space after
>>>>IntellijIdeaRulezzz during completion. Is this necessary? Why? How should
>>>>I avoid it?
>>>
>>>
I see (though I was thinking you talk about inserting a space after the
dummy identifier),
and now that I look at the code itself I don't see where the space is
inserted.
Are you sure this hapens at the same time when dummy identifier is inserted?
"Keith Lea" <keith@cs.oswego.edu> wrote in message
news:dk84ob$bf3$1@is.intellij.net...
>
>> a b(x) is different form ab(x) in all languages excluding probably some
>> very exotic that I cannot recall right now.
>> Idea needs to recognize this token since it is synthetic, so it needs to
>> be later deleted. And in order to find it, we insert the space
>> (and of course it is deleted with the IntellijIdeaRulezzz token :)
>> I still don't get your problem here.
>>
>> Eugene.
>>
>>
>> "Keith Lea" <keith@cs.oswego.edu> wrote in message
>> news:dk7vc3$8gr$1@is.intellij.net...
>>
>>>I feel sure that you can imagine a situation where "a b(x)" is an
>>>entirely different construct than "ab(x)", which I believe is the case
>>>here. I didn't write the parser for this language, so I'm not sure about
>>>it, but I think the space is a problem.
>>>
>>>Why does IDEA need to delimit the token from the next one, or recognize
>>>the inserted token?
>>>
>>>Eugene Vigdorchik (JetBrains) wrote:
>>>
>>>>Why should you?
>>>>the whitespace is there to delimit the created token from the next one.
>>>>Without it, it would be
>>>> IntellijIdeaRulezzzBlahBlah, so that we won't recognize our inserted
>>>> token. Why do you have problems with that?
>>>>
>>>>Eugene.
>>>>
>>>>"Keith Lea" <keith@cs.oswego.edu> wrote in message
>>>>news:dk64an$gpo$1@is.intellij.net...
>>>>
>>>>
>>>>>It seems that IDEA messes up my parser when it inserts a space after
>>>>>IntellijIdeaRulezzz during completion. Is this necessary? Why? How
>>>>>should I avoid it?
>>>>
>>>>
>>
Eugene Vigdorchik (JetBrains) wrote:
With "dd|d" where | is cursor, pressing Ctrl+Space produces
"ddIntellijIdeaRulezzz d" which is passed to ReferenceProvider etc.
I'm not sure when it happens exactly, but I'm not inserting the space
myself, so it seems like IDEA is doing it somehow.
>>Let's say in my language, "ab(x)" contains a reference, but "a b(x)"
>>contains no reference. So, when a user has "a(x)" and cursor is after "a",
>>inside a reference, he presses Ctrl+Space and now there is no reference,
>>so completion fails. Do you see the problem?
>>
>>Eugene Vigdorchik (JetBrains) wrote:
>>
>>>a b(x) is different form ab(x) in all languages excluding probably some
>>>very exotic that I cannot recall right now.
>>>Idea needs to recognize this token since it is synthetic, so it needs to
>>>be later deleted. And in order to find it, we insert the space
>>>(and of course it is deleted with the IntellijIdeaRulezzz token :)
>>>I still don't get your problem here.
>>>
>>>Eugene.
>>>
>>>
>>>"Keith Lea" <keith@cs.oswego.edu> wrote in message
>>>news:dk7vc3$8gr$1@is.intellij.net...
>>>
>>>
>>>>I feel sure that you can imagine a situation where "a b(x)" is an
>>>>entirely different construct than "ab(x)", which I believe is the case
>>>>here. I didn't write the parser for this language, so I'm not sure about
>>>>it, but I think the space is a problem.
>>>>
>>>>Why does IDEA need to delimit the token from the next one, or recognize
>>>>the inserted token?
>>>>
>>>>Eugene Vigdorchik (JetBrains) wrote:
>>>>
>>>>
>>>>>Why should you?
>>>>>the whitespace is there to delimit the created token from the next one.
>>>>>Without it, it would be
>>>>>IntellijIdeaRulezzzBlahBlah, so that we won't recognize our inserted
>>>>>token. Why do you have problems with that?
>>>>>
>>>>>Eugene.
>>>>>
>>>>>"Keith Lea" <keith@cs.oswego.edu> wrote in message
>>>>>news:dk64an$gpo$1@is.intellij.net...
>>>>>
>>>>>
>>>>>
>>>>>>It seems that IDEA messes up my parser when it inserts a space after
>>>>>>IntellijIdeaRulezzz during completion. Is this necessary? Why? How
>>>>>>should I avoid it?
>>>>>
>>>>>
The point is that IDEA also has some post-processing phase which is
triggered when the item is actually inserted in the editor .
This phase is indeed buggy from the language point of view (see next thread
for an example). Probably you hit the same problem.
I had a similar problem. And the only solution was joining the different
reference types.
Keith Lea schrieb: