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

Replace file content representation with rope crdt #26

Merged
merged 31 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3ade96e
Added nimsumtree and first implementation of synching
Nimaoth Sep 12, 2024
bfcfa50
Progress
Nimaoth Sep 13, 2024
44960da
Removed some debug code
Nimaoth Sep 13, 2024
53a2ba7
Merge branch 'main' into rope-crdt
Nimaoth Sep 13, 2024
f489c22
more progress
Nimaoth Sep 14, 2024
4c30b84
progress
Nimaoth Sep 14, 2024
4a073ba
progress
Nimaoth Sep 15, 2024
9b38663
add basic bench mark tool
Nimaoth Sep 15, 2024
81cc643
made reduced fps mode more configurable
Nimaoth Sep 15, 2024
12ff165
progress
Nimaoth Sep 15, 2024
af6b6a2
Moved treesitter parsing to separate thread, fixed bugs
Nimaoth Sep 16, 2024
c90a027
Progress
Nimaoth Sep 17, 2024
129fd57
progress
Nimaoth Sep 17, 2024
a0b349c
Use anchors for diagnostics, fixed some other issues
Nimaoth Sep 19, 2024
a7c0c6d
Added compile option to debug break on sysFatal
Nimaoth Sep 19, 2024
b4a162c
Added back undo checkpoints, fixed reloading
Nimaoth Sep 19, 2024
c49bd43
Cleaned up some warnings
Nimaoth Sep 19, 2024
d27e33c
Updated nimsumtree version
Nimaoth Sep 19, 2024
92ee263
progress
Nimaoth Sep 19, 2024
640cdee
Moved collab stuff to separate file, fixed reversed selections crashing
Nimaoth Sep 20, 2024
74761d8
Update main.yml (#27)
Nimaoth Sep 20, 2024
238761c
Fixed weird compile errors
Nimaoth Sep 20, 2024
ec9adc7
Progress
Nimaoth Sep 20, 2024
5c1bd53
Updated dependency
Nimaoth Sep 20, 2024
ec3782f
Fixed performance issue, small cleanup
Nimaoth Sep 21, 2024
994187c
Reenabled log document
Nimaoth Sep 21, 2024
811b5b8
Some cleanup, added treesitter mem tracking
Nimaoth Sep 22, 2024
3ed5e61
Add cli option to enable treesitter mem tracking
Nimaoth Sep 22, 2024
64f94c8
A bunch of fixes, perf improvements
Nimaoth Sep 22, 2024
2e07585
Big refactor
Nimaoth Sep 24, 2024
6782aa6
Updated nimsumtree
Nimaoth Sep 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/default_config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ proc loadDefaultKeybindings*(clearExisting: bool = false) {.expose("load-default
addCommand "editor", "<LEADER>gp", "explore-current-file-directory"
addCommand "editor", "<LEADER>gs", "search-global-interactive"
addCommand "editor", "<LEADER>gk", "browse-keybinds"
addCommand "editor", "<LEADER>gn", "open-last-editor"
addCommandBlock "editor", "<LEADER>log":
logs(scrollToBottom = true)
nextView()
Expand Down
1 change: 1 addition & 0 deletions nev.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ requires "https://github.com/Nimaoth/boxy >= 0.4.2"
requires "https://github.com/Nimaoth/nimscripter >= 1.0.21"
requires "https://github.com/Nimaoth/nimtreesitter-api >= 0.1.15"
requires "https://github.com/Nimaoth/nimwasmtime >= 0.1.7"
requires "https://github.com/Nimaoth/nimsumtree >= 0.2.2"

# Use this to include all treesitter languages (takes longer to download)
requires "https://github.com/Nimaoth/nimtreesitter >= 0.1.6"
Expand Down
10 changes: 10 additions & 0 deletions nimble.lock
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,16 @@
"sha1": "dfe09fbcf8040027630301c43b4dbe9d9f0fab4d"
}
},
"nimsumtree": {
"version": "0.2.1",
"vcsRevision": "b1ae9bef951b8c5d64dc97d33f334df09bd5b535",
"url": "https://github.com/Nimaoth/nimsumtree",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "71eb242863b136383a1739c33b5730b92447324a"
}
},
"nimtreesitter": {
"version": "0.1.6",
"vcsRevision": "8e0af3c1efecfd624a169790d29a8b5e0b11edd6",
Expand Down
4 changes: 4 additions & 0 deletions patches/fatal.nim
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,17 @@ else:
when defined(enableSysFatalStackTrace) and not defined(wasm):
writeStackTrace2()
##### patch end
when defined(sysFatalInt3):
asm "int3"
raise (ref exceptn)(msg: message)

func sysFatal(exceptn: typedesc[Defect], message, arg: string) {.inline, noreturn.} =
##### patch begin - I want that stacktrace
when defined(enableSysFatalStackTrace) and not defined(wasm):
writeStackTrace2()
##### patch end
when defined(sysFatalInt3):
asm "int3"
raise (ref exceptn)(msg: message & arg)

{.pop.}
4 changes: 4 additions & 0 deletions scripting/editor_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ proc browseKeybinds*(preview: bool = true; scaleX: float = 0.9;
scaleY: float = 0.8; previewScale: float = 0.4) =
editor_browseKeybinds_void_App_bool_float_float_float_impl(preview, scaleX,
scaleY, previewScale)
proc connectCollaborator*(port: int = 6969) =
editor_connectCollaborator_void_App_int_impl(port)
proc hostCollaborator*(port: int = 6969) =
editor_hostCollaborator_void_App_int_impl(port)
proc chooseFile*(preview: bool = true; scaleX: float = 0.8; scaleY: float = 0.8;
previewScale: float = 0.5) =
## Opens a file dialog which shows all files in the currently open workspaces
Expand Down
27 changes: 27 additions & 0 deletions scripting/editor_api_wasm.nim
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,33 @@ proc browseKeybinds*(preview: bool = true; scaleX: float = 0.9;
argsJsonString.cstring)


proc editor_connectCollaborator_void_App_int_wasm(arg: cstring): cstring {.
importc.}
proc connectCollaborator*(port: int = 6969) =
var argsJson = newJArray()
argsJson.add block:
when int is JsonNode:
port
else:
port.toJson()
let argsJsonString = $argsJson
let res {.used.} = editor_connectCollaborator_void_App_int_wasm(
argsJsonString.cstring)


proc editor_hostCollaborator_void_App_int_wasm(arg: cstring): cstring {.importc.}
proc hostCollaborator*(port: int = 6969) =
var argsJson = newJArray()
argsJson.add block:
when int is JsonNode:
port
else:
port.toJson()
let argsJsonString = $argsJson
let res {.used.} = editor_hostCollaborator_void_App_int_wasm(
argsJsonString.cstring)


proc editor_chooseFile_void_App_bool_float_float_float_wasm(arg: cstring): cstring {.
importc.}
proc chooseFile*(preview: bool = true; scaleX: float = 0.8; scaleY: float = 0.8;
Expand Down
28 changes: 0 additions & 28 deletions scripting/editor_text_api_wasm.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3441,34 +3441,6 @@ proc clearDiagnostics*(self: TextDocumentEditor) =
argsJsonString.cstring)


proc editor_text_updateDiagnosticsForCurrent_void_TextDocumentEditor_wasm(
arg: cstring): cstring {.importc.}
proc updateDiagnosticsForCurrent*(self: TextDocumentEditor) =
var argsJson = newJArray()
argsJson.add block:
when TextDocumentEditor is JsonNode:
self
else:
self.toJson()
let argsJsonString = $argsJson
let res {.used.} = editor_text_updateDiagnosticsForCurrent_void_TextDocumentEditor_wasm(
argsJsonString.cstring)


proc editor_text_showDiagnosticsForCurrent_void_TextDocumentEditor_wasm(
arg: cstring): cstring {.importc.}
proc showDiagnosticsForCurrent*(self: TextDocumentEditor) =
var argsJson = newJArray()
argsJson.add block:
when TextDocumentEditor is JsonNode:
self
else:
self.toJson()
let argsJsonString = $argsJson
let res {.used.} = editor_text_showDiagnosticsForCurrent_void_TextDocumentEditor_wasm(
argsJsonString.cstring)


proc editor_text_setReadOnly_void_TextDocumentEditor_bool_wasm(arg: cstring): cstring {.
importc.}
proc setReadOnly*(self: TextDocumentEditor; readOnly: bool) =
Expand Down
4 changes: 4 additions & 0 deletions scripting/plugin_api_internal.nim
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,10 @@ proc editor_browseKeybinds_void_App_bool_float_float_float_impl*(
preview: bool = true; scaleX: float = 0.9; scaleY: float = 0.8;
previewScale: float = 0.4) =
discard
proc editor_connectCollaborator_void_App_int_impl*(port: int = 6969) =
discard
proc editor_hostCollaborator_void_App_int_impl*(port: int = 6969) =
discard
proc editor_chooseFile_void_App_bool_float_float_float_impl*(
preview: bool = true; scaleX: float = 0.8; scaleY: float = 0.8;
previewScale: float = 0.5) =
Expand Down
Loading