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

Add live templates for Kobweb #19

Open
bitspittle opened this issue Jan 20, 2024 · 0 comments
Open

Add live templates for Kobweb #19

bitspittle opened this issue Jan 20, 2024 · 0 comments
Labels
IDE: Template Project template / live template related feature
Milestone

Comments

@bitspittle
Copy link
Contributor

bitspittle commented Jan 20, 2024

Live templates autocomplete code AND, if relevant, prompt users to fill out variable names before the completion is considered done.

We'll use VAR to represent things that should be filled out by the user and "$" to represent the cursor position when done.

For now we'll collect everything here because there probably aren't that many Kobweb concepts but we could break this up into multiple bugs if that's better.

Actual live template shortcut names are open for debate!

Frontend

csss/cssstyle = CssStyle

val VAR = CssStyle {
   base { Modifier.$ }
}

csssb/cssstylebase = CssStyle.base

val VAR = CssStyle.base {
   Modifier.$
}

page

@Page
@Composable
fun VAR() {
   $
}

worker

val worker = rememberWorker {
   VAR { output ->
      $
   }
}

initsilk

@InitSilk
fun VAR(ctx: InitSilkContext) {
   $
}

initkobweb

@InitKobweb
fun VAR(ctx: InitKobwebContext) {
   $
}

Backend

api

@Api
fun VAR(ctx: ApiContext) {
   $
}

initapi

@InitApi
fun VAR(ctx: InitApiContext) {
   $
}

objapistream

val VAR = object : ApiStream {
   override suspend fun onTextReceived(ctx: TextReceivedContext) {
      $
   }
}

apistream

val VAR = ApiStream { ctx ->
   $
}
@bitspittle bitspittle added the IDE: Template Project template / live template related feature label Jan 20, 2024
@bitspittle bitspittle added this to the 1.0 milestone Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IDE: Template Project template / live template related feature
Projects
None yet
Development

No branches or pull requests

1 participant