Skip to content

Commit 3046626

Browse files
jmgomezarnetheduck
andauthored
chronos migration wip (#225)
* chronos migration wip - [ ] Need to review `traceAsyncErrors` - [ ] Handle new `except`s * Apply suggestions. Reenable suggestapi tests. Remove Exceptions. Adds back traceAsyncErrors * Progress: Hooks the first call via stdio to the lspclient (still failing) * Update utils.nim Co-authored-by: Jacek Sieka <arnetheduck@gmail.com> * Implements a initial routes and the callAction, now the server can make requests to the client in stdio transport * Discards notifications when responding * Progress basic functionality working * Implements showNotifications. Hook (old) future cancellations * Implements exits procs * Small refactor * progress * WIP stdio draft implemented * refactor in preparation to socket support * WIP getting socket transport to work * socket transport works for basic functionality (similar to stdio but worst than previous impl). Switch to refc (orc crashes) * Progress: starts to unify transports * Progress unifying transports (both now work) * Progress unifying transports: now both transports uses the same actions * unify reads as first step to unify the loop * unifies transports loop * Completes transport unification * Refactor: simplifies further the code by making the RPCServer part of the lsp * Improves stability (for some reason the socket version is more stable than stdio) * Use chronos cancelation system for canceling requests * Progress. Improves stability. Switch to chronos recommend way to thread in lsTransport * wip improves stability and error reporting * Refactor: cleanup startup * Autobinds port when not specified * Fixes an issue where the langserver hanged when failing to parse a file (happens in the prev version too) * [green] initialize from the client should call initialized on the server * Refactor: extract lspSocketClient * specify chronos v4 * update deps cache * Use `nimble local` * A better timeout. Uses timeout in the known command as it usually takes too long and hangs * WIP Tests * progress * Test progress: LspClient mostly done now. Second suite almost there * suite "Suggest api" green * LSP features green * tnimlangserver.nim green * test cleanup * green: should pick `testproject.nim` as the main file and provide suggestions * all tests green * cleanup * lock deps * adds back refc * asyncprocmonitor now compiles in win * remove comments and extra lines --------- Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>
1 parent fa3c9bb commit 3046626

21 files changed

+1433
-1259
lines changed

.github/workflows/binaries.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106

107107
- name: Restore nimble dependencies from cache
108108
id: nimble_deps
109-
uses: actions/cache@v4
109+
uses: actions/cache@v5
110110
with:
111111
path: ~/.nimble/
112112
key: ${{ matrix.target.os }}-${{ env.cache_nonce }}

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Nimble Install
3535
shell: bash
3636
run: |
37-
nimble -y install
37+
nimble -y install -l
3838
3939
- name: Nimble Test
4040
shell: bash

asyncprocmonitor.nim

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
# Monitor a client process and shutdown the current process, if the client
22
# process is found to be dead
33

4-
import os, asyncdispatch
4+
import os, chronos, utils, sugar
55

66
when defined(posix):
77
import posix_utils
88
import posix
99

10+
type Callback* = proc() {.closure, gcsafe, raises: [].}
11+
1012
when defined(windows):
1113
import winlean
1214

13-
when defined(windows):
14-
proc hookAsyncProcMonitor*(pid: int, cb: Callback) =
15-
addProcess(pid, cb)
15+
proc hookAsyncProcMonitor*(pid: int, cb: Callback) = discard
16+
addProcess2(pid, (arg: pointer) => cb())
1617

17-
when defined(posix):
18+
elif defined(posix):
1819
proc hookAsyncProcMonitor*(pid: int, cb: Callback) =
19-
2020
var processExitCallbackCalled = false
2121

22-
proc checkProcCallback(fd: AsyncFD): bool =
22+
proc checkProcCallback(arg: pointer) =
2323
if not processExitCallbackCalled:
2424
try:
2525
sendSignal(Pid(pid), 0)
2626
except:
2727
processExitCallbackCalled = true
28-
result = cb(fd)
29-
else:
30-
result = true
3128

32-
addTimer(1000, false, checkProcCallback)
29+
addTimer(1000.int64, checkProcCallback)

config.nims

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
when withDir(thisDir(), system.fileExists("nimble.paths")):
55
include "nimble.paths"
66
# end Nimble config
7+
8+
--mm:refc

0 commit comments

Comments
 (0)