Dino compiler: language, formatter, language server, docs, editor support
Compiler in Rust (lexer, parser, checker, C codegen), maps, chars, dino fmt, dino lsp (diagnostics, formatting, outline, definition, hover, completion, signature help), docs, examples, VS Code/Vim files. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3e2779f447
commit
eaf9567a36
117 files changed
+19970
No files matched your search
@@ -0,0 +1,32 @@
|
||||
// A desktop-style app: shared state, weak back-references, tasks.
|
||||
import ui
|
||||
import task
|
||||
|
||||
struct Document {
|
||||
title: string
|
||||
text: string
|
||||
}
|
||||
|
||||
struct Editor {
|
||||
doc: shared Document // many views can share one document
|
||||
parent: weak Window? // weak: no ownership cycle
|
||||
}
|
||||
|
||||
func main() {
|
||||
var doc = shared Document{title: "Notes", text: ""}
|
||||
|
||||
var win = ui.window("Dino Notes", 640, 480)
|
||||
var editor = Editor{doc: doc}
|
||||
|
||||
win.on_key(func(k: ui.Key) {
|
||||
editor.doc.text += k.char
|
||||
})
|
||||
|
||||
var ch = task.channel[string]()
|
||||
task.spawn(func() { // background autosave
|
||||
for text in ch.recv() { save(text) }
|
||||
})
|
||||
|
||||
win.on_close(func() { ch.send(doc.text) })
|
||||
win.run()
|
||||
}
|
||||
Reference in new issue
Block a user