Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kotlin]custom postfix not working in class, but only working in function. #243

Open
dyguests opened this issue May 15, 2024 · 1 comment

Comments

@dyguests
Copy link

Hi~

I got a template like this:

.flow : val $name$ = MutableStateFlow(false) \ .asStateFlow()
    ANY ->     private val _$name$ = MutableStateFlow($expr$) \
               val $name$: StateFlow<$type$> = _$name$.asStateFlow()

It is working in function:
image

But not working in class:
image

How should I do ?

@xylo
Copy link
Owner

xylo commented Aug 9, 2024

It works if you write

val x  = false.flow

But indeed, it's not working if the expression comes first. Somehow IDEA marks it immediately as an error and does not handle it as an expression.

ATM Custom Postfix templates work only on valid expressions in Kotlin. Not sure if it's possible to change this without side effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants